private DeviceInformation RemoveNearByBtDevice(string deviceID, string btName)
        {
            string btID        = BluetoothDevices.ConvertDeviceIdType(deviceID, AddressType.Bluetooth);
            string bleDeviceID = BluetoothDevices.ConvertDeviceIdType(deviceID, AddressType.BLE);

            DeviceInformation found = GetNearbyBleDevice(bleDeviceID);

            if (found == null)
            {
                return(null);
            }

            lock (NearbyDeviceList)
            {
                NearbyDeviceList.Remove(found);
            }

            BleDeviceUpdated?.Invoke(this, DeviceWatchEvent.Added, found);

            if (App.IsForeground)
            {
                OnBleDeviceUpdated_InBackground("remove", btName, btID);
            }

            return(found);
        }
        private async void AddNearByBtDevice(string deviceID, string btName)
        {
            string btID        = BluetoothDevices.ConvertDeviceIdType(deviceID, AddressType.Bluetooth);
            string bleDeviceID = BluetoothDevices.ConvertDeviceIdType(deviceID, AddressType.BLE);

            DeviceInformation found = GetNearbyBleDevice(bleDeviceID);

            if (found != null)
            {
                return;
            }

            DeviceInformation bleDeviceInformation = await DeviceInformation.CreateFromIdAsync(bleDeviceID);

            lock (NearbyDeviceList) {
                NearbyDeviceList.Add(bleDeviceInformation);
            }

            BleDeviceUpdated?.Invoke(this, DeviceWatchEvent.Added, bleDeviceInformation);

            if (App.IsForeground)
            {
                OnBleDeviceUpdated_InBackground("added", btName, btID);
            }
        }
        public void Stop()
        {
            bleAdvertisementWatcher.Received -= OnBleAdvertisementUpdated;
            bleAdvertisementWatcher.DestoryBleWatcher();

            bluetoothWatcher.Received -= OnBluetoothDeviceUpdated;
            bluetoothWatcher.Stop();

            PairingManager.FeatureStateChanged -= PairingManagerFeagtureChanged;
            PairingManager.Start();

            PairedDeviceList.Clear();
            BleDeviceUpdated?.Invoke(this, DeviceWatchEvent.Stopped, null);
            PairedDeviceUpdated?.Invoke(this, DeviceWatchEvent.Stopped, null);
        }