@Override public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { if (newState == BluetoothProfile.STATE_CONNECTED) { mBluetoothGatt = gatt; mConnectionState = STATE_CONNECTED; ActiveBluetoothDevice.connected(); Log.i(TAG, "Connected to GATT server."); Log.i(TAG, "Connection state: Bonded - " + device.getBondState()); if (device.getBondState() == BluetoothDevice.BOND_BONDED) { currentGattTask = GATT_SETUP; mBluetoothGatt.discoverServices(); } else { device.setPin("000000".getBytes()); device.createBond(); } } else if (newState == BluetoothProfile.STATE_DISCONNECTED) { mConnectionState = STATE_DISCONNECTED; ActiveBluetoothDevice.disconnected(); Log.w(TAG, "Disconnected from GATT server."); } }
@Override public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { if (newState == BluetoothProfile.STATE_CONNECTED) { mBluetoothGatt = gatt; mConnectionState = STATE_CONNECTED; ActiveBluetoothDevice.connected(); Log.i(TAG, "Connected to GATT server."); Log.i(TAG, "Connection state: Bonded - " + device.getBondState()); if (device.getBondState() == BluetoothDevice.BOND_BONDED) { currentGattTask = GATT_SETUP; mBluetoothGatt.discoverServices(); } else { device.setPin("000000".getBytes()); device.createBond(); } } else if (newState == BluetoothProfile.STATE_DISCONNECTED) { mConnectionState = STATE_DISCONNECTED; ActiveBluetoothDevice.disconnected(); Log.w(TAG, "Disconnected from GATT server."); } }
private synchronized void handleDisconnectedStateChange() { if (JoH.ratelimit("handle-disconnected-state-change", 2)) { mConnectionState = STATE_DISCONNECTED; ActiveBluetoothDevice.disconnected();
private synchronized void handleDisconnectedStateChange() { if (JoH.ratelimit("handle-disconnected-state-change", 2)) { mConnectionState = STATE_DISCONNECTED; ActiveBluetoothDevice.disconnected();
private synchronized void handleDisconnectedStateChange() { if (JoH.ratelimit("handle-disconnected-state-change", 2)) { mConnectionState = STATE_DISCONNECTED; ActiveBluetoothDevice.disconnected();
ActiveBluetoothDevice.disconnected(); if(shouldDisconnect) { stopSelf();
ActiveBluetoothDevice.disconnected(); if(shouldDisconnect) { stopSelf();
ActiveBluetoothDevice.disconnected(); if(shouldDisconnect) { stopSelf();