Does BluetoothGattCallback never happen? Status = 0?

UPDATE: The question does not matter. Careful debugging showed that it had achieved a change in the state of the connection. I just need to learn more about the tools built into the android studio. Reading the GATT documentation on the Android website shows that Status = 0 indicates a successful connection, and not some kind of null state that I read.

For others concerned about their GATT status, the documentation is here: https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html

ORIGINAL : I am trying to connect to a Bluetooth LE device using Android studio, and I can find it and try to connect to it. The device stops flashing, indicating that it is still connected, however I cannot get a code that will ever reach my BluetoothGattCallback. The magazine also reads

D/BluetoothGatt: onSearchComplete() = Device=F4:B8:5E:A6:CE:D0 Status=0 06-06 16:35:09.682 17511-19374/com.somesite.dl503.vacuumgauge D/BluetoothGatt: onClientConnParamsChanged() - Device=F4:B8:5E:A6:CE:D0 interval=39 status=0 06-06 16:35:13.112 17511-17522/com.somesite.dl503.vacuumgauge D/BluetoothGatt: onClientConnParamsChanged() - Device=F4:B8:5E:A6:CE:D0 interval=15 status=0 

Has anyone else encountered Status = 0 or never entered the Gatt callback?

Connected by code:

 mConnectedGatt = device.connectGatt(this, false, mGattCallback, BluetoothDevice.TRANSPORT_AUTO); 

My Gatt callback onConncectionStateChange to be called first, right?

 @Override public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) { if (status == BluetoothGatt.GATT_SUCCESS && newState == BluetoothProfile.STATE_CONNECTED) { gatt.discoverServices(); } else if (status == BluetoothGatt.GATT_SUCCESS && newState == BluetoothProfile.STATE_DISCONNECTED) { } else if (status != BluetoothGatt.GATT_SUCCESS) { gatt.disconnect(); } } 
+5
source share

All Articles