private void LocationManagerOnFailed( object sender, NSErrorEventArgs nsErrorEventArgs) { throw new LocationException( StringResources.GPSDisabledConnectivityException); }
private void HandleDiscoveredService(object sender, NSErrorEventArgs e) { CBPeripheral peripheral = sender as CBPeripheral; if (peripheral == null || peripheral != Peripheral) return; int servicesCount = peripheral.Services.Length; peripheral.DiscoveredCharacteristic += (o, es) => { servicesCount--; if (servicesCount == 0) { IsServiceDiscovered = true; if (e.Error == null) { OnServicesDiscovered(this, new BleServicesDiscoveredEventArgs(BleGattOperationState.Success)); ConnectionState = BleConnectionState.ConnectedWithServices; } else { OnServicesDiscovered(this, new BleServicesDiscoveredEventArgs(BleGattOperationState.Failure)); } } }; foreach (CBService service in peripheral.Services) { peripheral.DiscoverCharacteristics(service); } }
private void OnFailed(object sender, NSErrorEventArgs e) { if ((CLError)(int)e.Error.Code == CLError.Network) { this.OnPositionError(new PositionErrorEventArgs(new GeolocationPositionUnavailableException())); } }
private void OnFailed(object sender, NSErrorEventArgs e) { if ((int)e.Error.Code == (int)CLError.Network) { OnPositionError(new PositionErrorEventArgs(GeolocationError.PositionUnavailable)); } }
void Peripheral_DiscoveredServices(object sender, NSErrorEventArgs e) { var peripheral = (CBPeripheral)sender; var ble_peripheral = devices [peripheral.Identifier.ToString()]; foreach (var service in peripheral.Services) { var ble_service = new BleService() { Name = service.ToString(), }; if (service.Characteristics != null) { foreach (var characteristic in service.Characteristics) { ble_service.Characteristics.Add(new BleCharacteristic() { Name = characteristic.ToString(), }); } } ble_peripheral.Services.Add(ble_service); } OnSomethingHappened(); }
void OnFailure(object sender, NSErrorEventArgs e) { if (IsMonitoring) { StopMonitoringAllRegions(); } CrossGeofence.GeofenceListener.OnError(e.Error.LocalizedDescription); }
private async void OnFailed(object sender, NSErrorEventArgs e) { if ((CLError)(int)e.Error.Code == CLError.Network) { await StopListeningAsync(); OnPositionError(new PositionErrorEventArgs(GeolocationError.PositionUnavailable)); } }
private void LocationManager_OnFailed(object sender, NSErrorEventArgs args) { if ((CLError)(int)args.Error.Code != CLError.Network) { return; } this.LocationStatus = PositionStatus.NotAvailable; this.StatusChanged?.Invoke(this, new StatusChangedEventArgs(this.LocationStatus)); }
private void HandleRssiUpdated(object sender, NSErrorEventArgs e) { CBPeripheral peripheral = sender as CBPeripheral; if (peripheral == null || peripheral != Peripheral) return; if (e.Error == null) OnReadRemoteRssi(this, new BleReadRemoteRssiEventArgs(Peripheral.RSSI.Int32Value, BleGattOperationState.Success)); else OnReadRemoteRssi(this, new BleReadRemoteRssiEventArgs(Peripheral.RSSI.Int32Value, BleGattOperationState.Failure)); }
static async void OnFailed(object sender, NSErrorEventArgs e) { var error = (CLError)(int)e.Error.Code; if (error == CLError.Network) { await PositionError.RaiseOn(Thread.Pool, new Exception(UNAVAILABLE_ERROR)); } if (error == CLError.Denied) { await PositionError.RaiseOn(Thread.Pool, new Exception(UNAUTHORISED_ERROR)); } }
private void DiscoveredService(object sender, NSErrorEventArgs args) { if (_peripheral.Services != null) { Services.Clear(); foreach (var s in _peripheral.Services) { var service = new Service(_peripheral, s); Services.Add(service); } ServicesDiscovered(this, new ServicesDiscoveredEventArgs(Services)); } _peripheral.DiscoveredService -= DiscoveredService; }
private void OnDiscoveredService(object sender, NSErrorEventArgs e) { if (e.Error != null) { RaiseDiscoverServicesFailed(e.Error.ToShared()); } else { var services = Peripheral .Services .Select(s => new BLEService(_peripheralWrapper, s)) .ToList(); RaiseServicesDiscovered(services); } }
void HandleDiscoveredService(object sender, NSErrorEventArgs e) { var peripheral = (CBPeripheral)sender; foreach (CBService service in peripheral.Services) { Console.WriteLine("Discovered Service: {0}", service.Description); if (!services.Contains(service)) { services.Add(service); } } ServicesTableView.ReloadData(); }
private void DiscoveredService(object sender, NSErrorEventArgs args) { if (_peripheral.Services != null) { foreach (var s in _peripheral.Services) { var serviceId = s.UUID.ToString().ToGuid(); if (Services.All(x => x.Id != serviceId)) { var service = new Service(_peripheral, s); Services.Add(service); ServiceDiscovered(this, new ServiceDiscoveredEventArgs(service)); } } } }
static void OnPeripheralDiscoveredService(object sender, NSErrorEventArgs e) { if (e.Error != null) { Console.WriteLine(e.Error); peripheral.DiscoverServices(); return; } foreach (CBService s in (sender as CBPeripheral).Services) { Console.WriteLine("Discovered service {0}", s); peripheral.DiscoverCharacteristics(s); } }
void OnDiscoveredService(object sender, NSErrorEventArgs e) { foreach (CBService cbs in nativePeripheral.Services) { BLEService bles = new BLEService(cbs); services.Add(bles); } EventHandler <BLEErrorEventArgs> handler = DiscoveredService; if (handler != null) { BLEErrorEventArgs args = new BLEErrorEventArgs(); args.Error = e.Error?.ToString(); handler(this, args); } }
void DiscoveredService(object sender, NSErrorEventArgs e) { // In Swift, we get a single "peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?)" // callback, but for some reason the Mono folks decided to send an // event for each discovered service - without telling us which // actual service the individual event is for. So we'll need to // remove the event handler. connectedCbPeripheral.DiscoveredService -= DiscoveredService; if (e.Error != null) { Console.Error.WriteLine($"Could not discover services: {e.Error.Description}"); Environment.Exit(1); } Console.Error.WriteLine("Discovered services"); var services = Array.ConvertAll(connectedCbPeripheral.Services, service => new Service(service.UUID.Uuid)); connectedPeripheral = new Peripheral(connectedCbPeripheral.Name, connectedCbPeripheral.Identifier.ToString(), services); ConnectedToPeripheralEventHandler?.Invoke(this, new ConnectedToPeripheralEventArgs(connectedPeripheral)); }
/// <summary> /// Get Called on Failure. /// </summary> /// <param name="sender">Sender who fired the event.</param> /// <param name="e">Event arguemnts</param> private void OnFailure(object sender, NSErrorEventArgs e) { if (this.IsMonitoring) { this.StopMonitoringAllRegions(); } CrossGeofence.GeofenceListener.OnError(e.Error.LocalizedDescription); }
private void OnFailed(object sender, NSErrorEventArgs e) { if ((CLError)(int)e.Error.Code == CLError.Network) OnPositionError(new PositionErrorEventArgs(GeolocationError.PositionUnavailable)); }
private void ClManagerOnDeferredUpdatesFinished(object sender, NSErrorEventArgs nsErrorEventArgs) { Log.Debug("ClManagerOnDeferredUpdatesFinished"); }
private void DidAdvertisingStarted(object sender, NSErrorEventArgs e) { System.Diagnostics.Debug.WriteLine("DidAdvertisingStarted"); }
void OnFailed (object sender, NSErrorEventArgs e) { LocationManager.StopUpdatingLocation (); }
private void OnRssiUpdated(object sender, NSErrorEventArgs e) => _wes.RaiseEvent(nameof(RSSIUpdated), sender, e);
private void OnDiscoveredService(object sender, NSErrorEventArgs args) { if (_peripheral.Services == null) { _discoveryTaskSource.TrySetException(new Exception("Bluetooth: Failed to discover service")); } else { _peripheral.DiscoverCharacteristics(_peripheral.Services.First()); } }
void nativeDevice_DiscoveredService(object sender, NSErrorEventArgs e) { _servicesDiscovered.Set(); }
private void OnDiscoveredService(object sender, NSErrorEventArgs e) => _wes.RaiseEvent(nameof(DiscoveredService), sender, e);
private void locMgr_OnFailure(object sender, NSErrorEventArgs e) { Console.WriteLine("didFailWithError " + e.Error); Console.WriteLine("didFailWithError coe " + e.Error.Code); }
private void OriginMapView_DidFailToLocateUser(object sender, NSErrorEventArgs e) { // throw new NotImplementedException(); }
static void OnDeferredUpdatedFinished(object sender, NSErrorEventArgs e) { IsDeferringUpdates = false; }
private void OnDeferredUpdatedFinished(object sender, NSErrorEventArgs e) => deferringUpdates = false;
void OnFailed(object sender, NSErrorEventArgs e) { locationManager.StopUpdatingLocation(); }
/// <summary> /// Converts the <see cref="NSErrorEventArgs"/> to <see cref="ErrorEvent"/>. /// </summary> /// <param name="args">The arguments.</param> /// <returns>The notification.</returns> public static ErrorEvent ToNotification(this NSErrorEventArgs args) => new ErrorEvent { };
void OnDeferredUpdatedFinished (object sender, NSErrorEventArgs e) { deferringUpdates = false; }
void _locationManager_Failed(object sender, NSErrorEventArgs e) { this.PositionError(sender, new PositionErrorEventArgs(GeolocationError.Unauthorized)); }
void HandleDiscoveredService (object sender, NSErrorEventArgs e) { var peripheral = (CBPeripheral)sender; foreach (CBService service in peripheral.Services) { Console.WriteLine ("Discovered Service: {0}", service.Description); if (!services.Contains (service)) services.Add (service); } ServicesTableView.ReloadData (); }
private void _peripheral_DiscoveredService(object sender, NSErrorEventArgs e) { _servicesHandle.Set(); }