Beispiel #1
0
 public void Disconnect()
 {
     if (_gatt != null)
     {
         _gatt.Disconnect();
         _gatt.Dispose();
     }
 }
Beispiel #2
0
 private void CloseGATT()
 {
     if (_gatt != null)
     {
         _gatt.Close();
         _gatt.Dispose();
         _gatt = null;
     }
 }
Beispiel #3
0
 public void Dispose()
 {
     try
     {
         StopUpdates();
         _nativeCharacteristic.Dispose();
         _gatt.Dispose();
     }
     catch
     {
     }
 }
Beispiel #4
0
        public void Disconnect()
        {
            lock (_lock)
            {
                if (_bluetoothGatt != null)
                {
                    _bluetoothGatt.Disconnect();
                    _bluetoothGatt.Close();
                    _bluetoothGatt.Dispose();
                    _bluetoothGatt = null;

                    _bluetoothDevice.Dispose();
                    _bluetoothDevice = null;
                }

                State = BluetoothLEDeviceState.Disconnected;
            }
        }
Beispiel #5
0
        public void Disconnect()
        {
            lock (_lock)
            {
                _onDeviceDisconnected    = null;
                _onCharacteristicChanged = null;

                if (_bluetoothGatt != null)
                {
                    _bluetoothGatt.Disconnect();
                    _bluetoothGatt.Close();
                    _bluetoothGatt.Dispose();
                    _bluetoothGatt = null;

                    _bluetoothDevice.Dispose();
                    _bluetoothDevice = null;
                }

                State = BluetoothLEDeviceState.Disconnected;
            }
        }
Beispiel #6
0
        public void EnumServices(Context ctx, string identifer)
        {
            BluetoothDevice device = mapDevices[identifer];

            if (device != null)
            {
                GattDevice gattdevice = new GattDevice(ctx, identifer);
                if (gatt != null)
                {
                    //gatt.Disconnect();
                    gatt.Close();   //or gatt.Connect() to re-connect to device
                    gatt.Dispose();
                }

                gatt = device.ConnectGatt(ctx, false, gattdevice);  //-> OnConnectionStateChange() -> DiscoverServices() -> OnServicesDiscovered() -> GattDevice.Initialize()
                if (gatt == null)
                {
                    Log.Error(TAG, string.Format("failed to connect to GATT server '{0}'", identifer));
                }
            }
        }
 internal void Disconnect()
 {
     gatt.Disconnect();
     gatt.Close();
     gatt.Dispose();
 }
Beispiel #8
0
 public void Disconnect()
 {
     gatt?.Disconnect();
     gatt?.Dispose();
 }