async void WaiterX60()
        {
            await Task.Delay(20000);

            try
            {
                if (!started)
                {
                    device.GattDisconnect();
                    LookWhatYouMadeMeDo(device);
                }
            }
            catch (Exception ex) { DisplayAlert("Error", ex.ToString(), "OK"); }
        }
 private void Button_Clicked_1(object sender, EventArgs e)
 {
     if (dev != null)
     {
         dev.GattDisconnect();
     }
     GC.Collect();
     Application.Current.Quit();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Unregisters GattConnectionStateChanged event handler
        /// and breaks the connection with GATT and GATT Client.
        /// </summary>
        /// <param name="leDevice">Bluetooth LE Device</param>
        public void GattClientExit(BluetoothLeDevice leDevice)
        {
            if (leDevice != null)
            {
                leDevice.GattConnectionStateChanged -= Device_GattConnectionStateChanged;
                leDevice.GattDisconnect();
                leDevice = null;
                GattClient.DestroyClient();
                GattClient = null;
            }

            StateChangedFlag = false;
        }