@Override public void run() { bluetoothGatt.disconnect(); } });
/** * 蓝牙断开连接 */ public void disconnect() { if (mBluetoothGatt == null) { return; } mBluetoothGatt.disconnect(); }
/** * Disconnect the connection. */ public void disConnect(){ if (mBluetoothGatt != null){ mBluetoothGatt.disconnect(); } }
@Override public void onDestroy() { super.onDestroy(); if (mBluetoothGatt != null) mBluetoothGatt.disconnect(); mHandler = null; mBluetoothDevice = null; }
public void disconnect() { Log.d(LOG_TAG, "BLE disconnect"); if(mBluetoothAdapter == null || mBluetoothGatt == null) { Log.d(LOG_TAG, "BluetoothAdapter not initialized"); return; } mBluetoothGatt.disconnect(); }
public synchronized void remove(final String address) { if (bluetoothGatt.containsKey(address)) { Log.d(TAG, "remove() - to device " + address); if (bluetoothGatt.get(address) != null) { bluetoothGatt.get(address).disconnect(); } bluetoothGatt.remove(address); } } }
public void disconnect() { if (mBluetoothAdapter == null || mBluetoothGatt == null) { Log.w(TAG, "BluetoothAdapter not initialized"); return; } mBluetoothGatt.disconnect(); }
public synchronized void disconnect(final String address) { if (bluetoothGatt.containsKey(address)) { Log.d(TAG, "disconnect() - to device " + address); if (!Devices.isEnabled(this, address)) { Log.d(TAG, "disconnect() - no background linked for " + address); if (bluetoothGatt.get(address) != null) { bluetoothGatt.get(address).disconnect(); } bluetoothGatt.remove(address); } } }
public void disconnect() { if (mBluetoothAdapter == null || mBluetoothGatt == null) { Log.w(TAG, "BluetoothAdapter not initialized"); return; } mBluetoothGatt.disconnect(); }
private void closeConn() { if (mBluetoothGatt != null) { mBluetoothGatt.disconnect(); mBluetoothGatt.close(); } }
private void closeConnect() { if (null != mBluetoothGatt) { mBluetoothGatt.close(); mBluetoothGatt.disconnect(); mBluetoothGatt = null; } }
private void closeConnect() { if (null != mBluetoothGatt) { mBluetoothGatt.close(); mBluetoothGatt.disconnect(); mBluetoothGatt = null; } }
void gattTaskCompleted() { int count = nGattOps.decrementAndGet(); if (count == 0 && readyToClose.get()) { Task.delay(1000).continueWith(ignored -> { if (androidBtGatt != null) { androidBtGatt.disconnect(); } return null; }); } }
public void forceConnect() { if(mBluetoothDeviceAddress != null) { Log.d(LOG_TAG, "Trying to force connection: "+mBluetoothDeviceAddress); mConnectionState = STATE_FORCE; mBluetoothGatt.disconnect(); final BluetoothDevice device = mBluetoothAdapter.getRemoteDevice(mBluetoothDeviceAddress); mBluetoothGatt = device.connectGatt(this, true, mGattCallback); } else { Log.d(LOG_TAG, "Force connect called without previous connection"); } }
@Override public Void call() throws InterruptedException { Log.d(TAG, "DISCONNECT"); mBluetoothGatt.disconnect(); while (mConnectionState != BluetoothProfile.STATE_DISCONNECTED) { bleStateCondition.await(); } Log.d(TAG, "CLOSE"); mBluetoothGatt.close(); return null; } });
void disconnect() { if (mConnected && mBluetoothGatt != null) { cancelReadRssiTimerTask(); mBluetoothGatt.disconnect(); mConnected = false; mServiceDiscovered = false; mBluetoothGatt = null; clearQueue(); } }
/** Will cancel an in-progress connection, and close the socket */ public void cancel() { gat.setCharacteristicNotification(cc,false); descriptor.setValue( BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE); gat.writeDescriptor(descriptor); gat.disconnect(); gat.close(); Log.i("H7ConnectThread", "Closing HRsensor"); }
private synchronized void doDisconnectMessage(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { Log.d(TAG, "doDisconnectMessage() start"); gatt.setCharacteristicNotification(controlCharacteristic, false); final DisconnectTxMessage disconnectTx = new DisconnectTxMessage(); characteristic.setValue(disconnectTx.byteSequence); gatt.writeCharacteristic(characteristic); gatt.disconnect(); Log.d(TAG, "doDisconnectMessage() finished"); }
private synchronized void doDisconnectMessage(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { Log.d(TAG, "doDisconnectMessage() start"); gatt.setCharacteristicNotification(controlCharacteristic, false); final DisconnectTxMessage disconnectTx = new DisconnectTxMessage(); characteristic.setValue(disconnectTx.byteSequence); gatt.writeCharacteristic(characteristic); gatt.disconnect(); Log.d(TAG, "doDisconnectMessage() finished"); }
private synchronized void doDisconnectMessage(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { Log.d(TAG, "doDisconnectMessage() start"); gatt.setCharacteristicNotification(controlCharacteristic, false); final DisconnectTxMessage disconnectTx = new DisconnectTxMessage(); characteristic.setValue(disconnectTx.byteSequence); gatt.writeCharacteristic(characteristic); gatt.disconnect(); Log.d(TAG, "doDisconnectMessage() finished"); }