private void _Watcher_Stopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     System.Diagnostics.Debug.WriteLine("Bluetooth LE Advertisement Watcher stopped with status: "+ _Watcher.Status);
     if(Stopped != null){
         Stopped(_Watcher.Status);
     }
 }
Exemple #2
0
        private void WatcherStopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
        {
            BluetoothError a = args.Error;

            //AssertSameThreadAndContext();
            GlobalCounters.IncrementWatchersClosed();
        }
        private void WatcherStopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
        {
            //AssertSameThreadAndContext();
            GlobalCounters.IncrementWatchersClosed();

            Log($"Watcher stopped for reason {args.Error}, has status {_watcher.Status}.");
            IsStopped.Set();
        }
Exemple #4
0
        private void OnWatcherStopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
        {
            _watcherBLE.Received -= OnAdvertisementReceived;
            _watcherBLE.Stopped  -= OnWatcherStopped;

            Log.d("BluetoothLEAdvertisementWatcher stopped");
            //CommonTools.InfoMessage("BluetoothLEAdvertisementWatcher stopped");
        }
 private void _Watcher_Stopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     System.Diagnostics.Debug.WriteLine("Bluetooth LE Advertisement Watcher stopped with status: " + _Watcher.Status);
     if (Stopped != null)
     {
         Stopped(_Watcher.Status);
     }
 }
Exemple #6
0
 private async void Watcher_Stopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     if (args.Error != Windows.Devices.Bluetooth.BluetoothError.Success)
     {
         await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
         {
             MessageDialog dialog = new MessageDialog("Error: " + args.Error.ToString(), "Can not start Watcher");
             await dialog.ShowAsync();
         });
     }
 }
Exemple #7
0
        private void OnWatcherStopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
        {
            if (_bluetoothLeAdvertisementWatcher != null)
            {
                Logger.Debug("Scanner: .OnWatcherStopped(): Status: " + _bluetoothLeAdvertisementWatcher.Status);

                Status = _bluetoothLeAdvertisementWatcher.Status == BluetoothLEAdvertisementWatcherStatus.Aborted ? ScannerStatus.Aborted : ScannerStatus.Stopped;

                _bluetoothLeAdvertisementWatcher.Received -= OnAdvertisementReceived;
                _bluetoothLeAdvertisementWatcher.Stopped  -= OnWatcherStopped;
                _bluetoothLeAdvertisementWatcher           = null;
            }
        }
Exemple #8
0
 // Method for when the watcher is stopped or aborted. Really, all we
 // do is write a debug line that this event has occurred.
 private void OnAdvertisementStopped(
     BluetoothLEAdvertisementWatcher watcher,
     BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs
     )
 {
     if (watcher.Status == BluetoothLEAdvertisementWatcherStatus.Aborted)
     {
         Debug.WriteLine("Watcher aborted due to inactivity.");
     }
     if (watcher.Status == BluetoothLEAdvertisementWatcherStatus.Stopped)
     {
         Debug.WriteLine("Watcher has been stopped.");
     }
 }
        private void Watcher_Stopped(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs)
        {
            Dispatcher.Invoke(() =>
            {
                string btError;
                switch (eventArgs.Error)
                {
                case BluetoothError.RadioNotAvailable:
                    btError = "Bluetooth not available";
                    break;

                case BluetoothError.ResourceInUse:
                    btError = "Device is busy elsewhere";
                    break;
                }
            });
        }
        private void WatcherOnStopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
        {
            string errorMsg = null;

            if (args != null)
            {
                switch (args.Error)
                {
                case BluetoothError.Success:
                    errorMsg = "WatchingSuccessfullyStopped";
                    break;

                case BluetoothError.RadioNotAvailable:
                    errorMsg = "ErrorNoRadioAvailable";
                    break;

                case BluetoothError.ResourceInUse:
                    errorMsg = "ErrorResourceInUse";
                    break;

                case BluetoothError.DeviceNotConnected:
                    errorMsg = "ErrorDeviceNotConnected";
                    break;

                case BluetoothError.DisabledByPolicy:
                    errorMsg = "ErrorDisabledByPolicy";
                    break;

                case BluetoothError.NotSupported:
                    errorMsg = "ErrorNotSupported";
                    break;
                }
            }
            if (errorMsg == null)
            {
                // All other errors - generic error message
                errorMsg = _restartingBeaconWatch
                    ? "FailedRestartingBluetoothWatch"
                    : "AbortedWatchingBeacons";
            }
            SetStatusOutput(_resourceLoader.GetString(errorMsg));
        }
Exemple #11
0
        private static void WatcherOnStopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
        {
            string errorMsg = null;

            if (args != null)
            {
                switch (args.Error)
                {
                case BluetoothError.Success:
                    errorMsg = "WatchingSuccessfullyStopped";
                    break;

                case BluetoothError.RadioNotAvailable:
                    errorMsg = "ErrorNoRadioAvailable";
                    break;

                case BluetoothError.ResourceInUse:
                    errorMsg = "ErrorResourceInUse";
                    break;

                case BluetoothError.DeviceNotConnected:
                    errorMsg = "ErrorDeviceNotConnected";
                    break;

                case BluetoothError.DisabledByPolicy:
                    errorMsg = "ErrorDisabledByPolicy";
                    break;

                case BluetoothError.NotSupported:
                    errorMsg = "ErrorNotSupported";
                    break;
                }
            }

            WriteLine(errorMsg);
            WriteLine("Press any key to continue");
            ReadKey();
        }
Exemple #12
0
        private void OnWatcherStopped(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
        {
            // Utils.Info("OnWatcherStopped: {0}", args.Error.ToString());

            lock (mLockObject)
            {
                if (mStatus != Status.Scan)
                {
                    return;
                }

                Utils.Error("error: {0}", args.Error.ToString());

                if (args.Error == BluetoothError.RadioNotAvailable)
                {
                    mCallback.OnBluetoothRequire();
                }

                StopScanInternal();

                mCallback.OnFail();
            }
        }
Exemple #13
0
 private void OnBLEAdvertismentStopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     Debug.WriteLine("#### OnBLEAdvertismentStopped ####");
     DiagnosticsHandler?.Invoke(this, "#### OnBLEAdvertismentStopped ####");
 }
 /// <summary>
 /// Invoked as an event handler when the watcher is stopped or aborted.
 /// </summary>
 /// <param name="watcher">Instance of watcher that triggered the event.</param>
 /// <param name="eventArgs">Event data containing information about why the watcher stopped or aborted.</param>
 private async void OnAdvertisementWatcherStopped(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs)
 {
     // Notify the user that the watcher was stopped
 }
Exemple #15
0
 private void Watcher_Stopped(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs)
 {
     errReported = "Watcher Stopped. \nPlease check that bluetooth is switched on";
     isFaulted   = true;
 }
Exemple #16
0
 private void OnStoppedHandler(AdvertisementWatcher sender,
                               BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     _stopped.OnNext(DateTime.Now);
 }
Exemple #17
0
 private void BluetoothLEAdvertisementWatcher_Stopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     onStopSearch(this, args.Error);
 }
        /// <summary>
        /// Invoked as an event handler when the watcher is stopped or aborted.
        /// </summary>
        /// <param name="watcher">Instance of watcher that triggered the event.</param>
        /// <param name="eventArgs">Event data containing information about why the watcher stopped or aborted.</param>
        private async void OnAdvertisementWatcherStopped(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs)
        {
            // Notify the user that the watcher was stopped
            await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {

            });
        }
 private void WatcherOnStopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     WatcherStopped?.Invoke(this, new BTError((BTError.BluetoothError)args.Error));
 }
 private void Watcher_Stopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 => Debug.WriteLine($"[WATCHER-EVENT] => Handler: {nameof(Watcher_Stopped)} - Data: {args.Error.ToString()}");
 private void OnWatcherStopped(BluetoothLEAdvertisementWatcher aObj,
                               BluetoothLEAdvertisementWatcherStoppedEventArgs aEvent)
 {
     BpLogger.Info("Stopped BLE Scanning");
     InvokeScanningFinished();
 }
Exemple #22
0
 private void Watcher_Stopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     OnStopped(args.Error.ToAdvertisementWatcherError());
 }
 /// <summary>
 /// Invoked as an event handler when the watcher is stopped or aborted.
 /// </summary>
 /// <param name="watcher">Instance of watcher that triggered the event.</param>
 /// <param name="eventArgs">Event data containing information about why the watcher stopped or aborted.</param>
 private async void OnAdvertisementWatcherStopped(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs)
 {
     // Notify the user that the watcher was stopped
     await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         rootPage.NotifyUser(string.Format("Watcher stopped or aborted: {0}", eventArgs.Error.ToString()), NotifyType.StatusMessage);
     });
 }
Exemple #24
0
 private void OnAdvertisementWatcherStopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     _isActive = false;
     UnsubscribeHandlers();
 }
 private void WatcherOnStopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     string errorMsg = null;
     if (args != null)
     {
         switch (args.Error)
         {
             case BluetoothError.Success:
                 errorMsg = "WatchingSuccessfullyStopped";
                 break;
             case BluetoothError.RadioNotAvailable:
                 errorMsg = "ErrorNoRadioAvailable";
                 break;
             case BluetoothError.ResourceInUse:
                 errorMsg = "ErrorResourceInUse";
                 break;
             case BluetoothError.DeviceNotConnected:
                 errorMsg = "ErrorDeviceNotConnected";
                 break;
             case BluetoothError.DisabledByPolicy:
                 errorMsg = "ErrorDisabledByPolicy";
                 break;
             case BluetoothError.NotSupported:
                 errorMsg = "ErrorNotSupported";
                 break;
         }
     }
     if (errorMsg == null)
     {
         // All other errors - generic error message
         errorMsg = _restartingBeaconWatch
             ? "FailedRestartingBluetoothWatch"
             : "AbortedWatchingBeacons";
     }
     SetStatusOutput(_resourceLoader.GetString(errorMsg));
 }
 /// <summary>
 /// Invoked as an event handler when the watcher is stopped or aborted.
 /// </summary>
 /// <param name="watcher">Instance of watcher that triggered the event.</param>
 /// <param name="eventArgs">Event data containing information about why the watcher stopped or aborted.</param>
 private void OnAdvertisementWatcherStopped(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs)
 {
     // Notify the user that the watcher was stopped
     NotifyUser(string.Format("Watcher stopped or aborted: {0}", eventArgs.Error.ToString()), NotifyType.StatusMessage);
 }
 /// <summary>
 /// Invoked as an event handler when the watcher is stopped or aborted.
 /// </summary>
 /// <param name="watcher">Instance of watcher that triggered the event.</param>
 /// <param name="eventArgs">Event data containing information about why the watcher stopped or aborted.</param>
 private async void OnAdvertisementWatcherStopped(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs)
 {
     // Notify the user that the watcher was stopped
     await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
         rootPage.NotifyUser(string.Format("Watcher stopped or aborted: {0}", eventArgs.Error.ToString()), NotifyType.StatusMessage);
     });
 }
Exemple #28
0
        private async void OnWatcherStoppedAsync(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
        {
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
                Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
                {
                    System.Diagnostics.Debug.WriteLine("Bluetooth LE Advertisement Watcher stopped with status: "
                        + _bluetoothLEAdvertisemenetWatcher.Status);
                    IsWatcherStarted = false;

                    if (_bluetoothLEAdvertisemenetWatcher.Status == BluetoothLEAdvertisementWatcherStatus.Aborted)
                    {
                        // Aborted status most likely means that Bluetooth is not enabled (i.e. turned off)
                        MessageDialog messageDialog = new MessageDialog("Bluetooth LE Advertisement Watcher aborted. Make sure you have Bluetooth turned on on your device and try again.");
                        await messageDialog.ShowAsync();
                    }
                });
        }
Exemple #29
0
 private void OnAdvertisementWatcherStopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     Debug.WriteLine($"{DateTime.Now} [{sender.Status}] [{sender.GetHashCode()}] stopped called");
 }
Exemple #30
0
 private async void OnAdvertisementWatcherStopped(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs)
 {
     await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
     {
     });
 }
 private async void OnAdvertisementWatcherStopped(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs)
 {
     if (watcher.Status == BluetoothLEAdvertisementWatcherStatus.Aborted && _bluetoothNotOnDialogOperation == null)
     {
         MessageDialog messageDialog = new MessageDialog(
             "Do you wish to enable Bluetooth on this device?",
             "Failed to start Bluetooth LE advertisement watcher");
         messageDialog.Commands.Add(new UICommand("Yes",
                                                  async command => { await LaunchBluetoothSettingsAsync(); }));
         messageDialog.Commands.Add(new UICommand("No",
                                                  command => { watcher.Stop(); }));
         _bluetoothNotOnDialogOperation = messageDialog.ShowAsync();
     }
 }
Exemple #32
0
        private async void OnWatcherStoppedAsync(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
        {
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(
                Windows.UI.Core.CoreDispatcherPriority.Normal, async() =>
            {
                System.Diagnostics.Debug.WriteLine("Bluetooth LE Advertisement Watcher stopped with status: "
                                                   + _bluetoothLEAdvertisemenetWatcher.Status);
                IsWatcherStarted = false;

                if (_bluetoothLEAdvertisemenetWatcher.Status == BluetoothLEAdvertisementWatcherStatus.Aborted)
                {
                    // Aborted status most likely means that Bluetooth is not enabled (i.e. turned off)
                    MessageDialog messageDialog = new MessageDialog("Bluetooth LE Advertisement Watcher aborted. Make sure you have Bluetooth turned on on your device and try again.");
                    await messageDialog.ShowAsync();
                }
            });
        }
Exemple #33
0
 private void watcherStopped(BluetoothLEAdvertisementWatcher yes, BluetoothLEAdvertisementWatcherStoppedEventArgs no)
 {
 }
Exemple #34
0
 private void OnAdvertisementWatcherStopped(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs)
 {
     // Received?.Invoke(this, DeviceWatchEvent.Stopped, null);
 }
Exemple #35
0
 /// <summary>
 /// Invoked as an event handler when the watcher is stopped or aborted.
 /// </summary>
 /// <param name="watcher">Instance of watcher that triggered the event.</param>
 /// <param name="eventArgs">Event data containing information about why the watcher stopped or aborted.</param>
 private async void OnAdvertisementWatcherStopped(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs)
 {
     // Notify the user that the watcher was stopped
 }
        private void OnWatcherStopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
        {
            if (_bluetoothLeAdvertisementWatcher != null)
            {
                Logger.Debug("Scanner: .OnWatcherStopped(): Status: " + _bluetoothLeAdvertisementWatcher.Status);

                Status = _bluetoothLeAdvertisementWatcher.Status == BluetoothLEAdvertisementWatcherStatus.Aborted ? ScannerStatus.Aborted : ScannerStatus.Stopped;

                _bluetoothLeAdvertisementWatcher.Received -= OnAdvertisementReceived;
                _bluetoothLeAdvertisementWatcher.Stopped -= OnWatcherStopped;
                _bluetoothLeAdvertisementWatcher = null;
            }
        }
Exemple #37
0
 private void _watcher_Stopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
 }
 private void Watcher_Stopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     Debug.WriteLine("비콘을 잡을 수 없습니다.");
 }
 /// <summary>
 /// Invoked as an event handler when the watcher is stopped or aborted.
 /// </summary>
 /// <param name="watcher">Instance of watcher that triggered the event.</param>
 /// <param name="eventArgs">Event data containing information about why the watcher stopped or aborted.</param>
 private async void OnAdvertisementWatcherStopped(BluetoothLEAdvertisementWatcher watcher,
                                                  BluetoothLEAdvertisementWatcherStoppedEventArgs eventArgs)
 {
     // Notify the user that the watcher was stopped
     await Dispatcher.RunAsync(CoreDispatcherPriority.Normal,
         () => rootPage.NotifyUser($"Watcher stopped or aborted: {eventArgs.Error}",
             NotifyType.StatusMessage));
 }
Exemple #40
0
 private async void Watcher_Stopped(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementWatcherStoppedEventArgs args)
 {
     if (args.Error != Windows.Devices.Bluetooth.BluetoothError.Success)
     {
         await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, async () =>
         {
             MessageDialog dialog = new MessageDialog("Error: " + args.Error.ToString(), "Can not start Watcher");
             await dialog.ShowAsync();
         });
         
     }
 }