Example #1
0
        public async Task Unpair()
        {
            var errorHandle = new ErrorHandle();

            try
            {
                if (_Device == null)
                {
                    return;
                }
                _Device.ConnectionStatusChanged -= _Device_ConnectionStatusChanged;
                await _Device.DeviceInformation.Pairing.UnpairAsync();

                errorHandle.logEvent($"Unpair BLE: {_Device.Name}");
                Dispose();
            }
            catch (Exception ex)
            {
            }
        }
Example #2
0
        private async Task forgetBLE()
        {
            var errorHandle = new ErrorHandle();

            try
            {//TODO: use BLEDevice Unpair method
                var isConnected = IsConnected;
                var device      = await BluetoothLEDevice.FromIdAsync(Id);

                await device.DeviceInformation.Pairing.UnpairAsync();

                if (isConnected)
                {
                    HIOStaticValues.CONNECTIONBRIDGE = false;
                    HIOStaticValues.BaS.devInfo      = null;
                    HIOStaticValues.BaS.dev.Dispose();
                    HIOStaticValues.BaS.dev = null;
                }
                errorHandle.logEvent($"Forget BLE: {Title}");
            }
            catch (Exception ex)
            {
            }
        }