public void Stop()
        {
            Debug.WriteLine("BluetoothPacketProvider:Stop()");
            centralDelegate.OnAdvertisementPacketReceived -= ScanCallback_OnAdvertisementPacketReceived;

            central.StopScan();
            WatcherStopped?.Invoke(sender: this, e: new BTError(BTError.BluetoothError.Success));
        }
Exemplo n.º 2
0
        public void Stop()
        {
            Debug.WriteLine($"{nameof(Stop)}()", LogTag);


            if (CLLocationManager.IsMonitoringAvailable(typeof(CLBeaconRegion)))
            {
                _locationManager.StopMonitoring(_clBeaconRegion);
            }
            else
            {
                Debug.WriteLine("Beacon monitor stop failed, monitoring not available.", LogTag);
            }

            WatcherStopped?.Invoke(sender: this, e: new BeaconError(BeaconError.BeaconErrorType.Success));
        }
Exemplo n.º 3
0
        public void Stop()
        {
            lock (_lock)
            {
                SystemDebug.WriteLine("cancelling adapter discovery", LogTag);

                _adapter?.CancelDiscovery();

                try
                {
                    SystemDebug.WriteLine("cancelling beaconing operations", LogTag);

                    _cancellationTokenSource?.Cancel();
                    _cancellationTokenSource?.Dispose();
                }
                catch (Exception)
                {
                    SystemDebug.WriteLine("failed to cancel beacon scanning", LogTag);
                }

                try
                {
                    SystemDebug.WriteLine("cancelling beacon exit task", LogTag);

                    _regionExitedCancellationTokenSource?.Cancel();
                    _regionExitedCancellationTokenSource?.Dispose();
                }
                catch (Exception)
                {
                    SystemDebug.WriteLine("failed to cancel beacon exit task", LogTag);
                }

                WatcherStopped?.Invoke(sender: this, e: new BeaconError(BeaconError.BeaconErrorType.Success));

#if DEBUG
                lock (_bluetoothDevicesListLock)
                {
                    _bluetoothDevicesWeHaveReceivedBeaconsFrom?.Clear();
                }
#endif
            }
        }
 private void WatcherOnStopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     WatcherStopped?.Invoke(this, new BTError((BTError.BluetoothError)args.Error));
 }