コード例 #1
0
 public partial ValueTask DisposeAsync()
 {
     session.Dispose();
     device.Dispose();
     // TODO: wait for disconnect
     return(ValueTask.CompletedTask);
 }
コード例 #2
0
ファイル: BikeDevice.cs プロジェクト: m8e/UnderDeskBike
 /// <summary>
 /// Stops the device from listening and resets.
 /// </summary>
 public void StopListening()
 {
     if (device != null)
     {
         OnDisconnect();
         gattSession?.Dispose();
         gattSession = null;
         if (device != null)
         {
             device.ConnectionStatusChanged -= Device_ConnectionStatusChanged;
         }
         device?.Dispose();
         device = null;
     }
 }
コード例 #3
0
        public void Dispose()
        {
            if (mBluetoothGatt != null)
            {
                mBluetoothGatt.MaintainConnection = false;
                mBluetoothGatt.Dispose();
                mBluetoothGatt = null;
            }

            if (bluetoothLeDevice != null)
            {
                bluetoothLeDevice.Dispose();
                bluetoothLeDevice = null;
            }
        }