Exemplo n.º 1
0
 public void Disconnect()
 {
     if (_gatt != null)
     {
         _gatt.Disconnect();
         _gatt.Dispose();
     }
 }
Exemplo n.º 2
0
 private void CloseGATT()
 {
     if (_gatt != null)
     {
         _gatt.Close();
         _gatt.Dispose();
         _gatt = null;
     }
 }
Exemplo n.º 3
0
 public void Dispose()
 {
     try
     {
         StopUpdates();
         _nativeCharacteristic.Dispose();
         _gatt.Dispose();
     }
     catch
     {
     }
 }
Exemplo n.º 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;
            }
        }
Exemplo n.º 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;
            }
        }
Exemplo n.º 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));
                }
            }
        }
Exemplo n.º 7
0
 internal void Disconnect()
 {
     gatt.Disconnect();
     gatt.Close();
     gatt.Dispose();
 }
Exemplo n.º 8
0
 public void Disconnect()
 {
     gatt?.Disconnect();
     gatt?.Dispose();
 }