@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."); } }
servicesDiscovered = DISCOVERED.PENDING; ActiveBluetoothDevice.connected();
servicesDiscovered = DISCOVERED.PENDING; ActiveBluetoothDevice.connected();
servicesDiscovered = DISCOVERED.PENDING; ActiveBluetoothDevice.connected();
device = mBluetoothGatt.getDevice(); mConnectionState = STATE_CONNECTED; ActiveBluetoothDevice.connected(); Log.i(TAG, "Connected to GATT server.");
device = mBluetoothGatt.getDevice(); mConnectionState = STATE_CONNECTED; ActiveBluetoothDevice.connected(); Log.i(TAG, "Connected to GATT server.");
device = mBluetoothGatt.getDevice(); mConnectionState = STATE_CONNECTED; ActiveBluetoothDevice.connected(); Log.i(TAG, "Connected to GATT server.");