Android BluetoothGatt status code 128 BLE connection - android

I'm trying to connect a BLE Device (Sigma chest strap) to my Sony Smartwatch 3 and the writeDescriptor() method fails to enable Notifications on the Device. The onDescriptorWrite() method displays the status code "128" which apparently stands for "GATT_NO_RESOURCES". Does anyone know what this error means or how to fix it?
Another BLE Device (Alpha Mio 2) works without any problems. descriptor is written and data received via onCharacteristicChanged().
Descriptor UUID: 00002902-0000-1000-8000-00805f9b34fb
Service UUID: 0000180d-0000-1000-8000-00805f9b34fb

Related

flutter blue example can't connect to gatt server

I am trying to create an application (on flutter/android studio) that can connect to a Ble server and read his characteristics. I used the flutter_blue_example : https://github.com/pauldemarco/flutter_blue/tree/master/example .
The scan goes fine, but when I try to connect to the BLE device it does'nt work and I get the following log on android studio :
D/BluetoothGatt( 8205): onClientConnectionState() - status=133 clientIf=8
device=00:1A:7D:DA:71:13
D/FlutterBluePlugin( 8205): onConnectionStateChange:
D/BluetoothGatt( 8205): close()
D/BluetoothGatt( 8205): unregisterApp() - mClientIf=8
I used the following example to create my Ble server : https://github.com/Jumperr-labs/python-gatt-server
The problem could come from the server but as it works good with an app like Ble scanner available on the playstore, I think the problem is more likely to come from the app based on flutter.
I finally found that I had to pair with the device in the bluetooth parameters before launching my app. BTW there are still issues with the refresh of the discovered services, but I am working on it.

BluetoothGattCharacteristic limit causing issues?

In my app I have tried everything to connec my BLE device and receive calls to onCharacteristicChanged. I have had success with initial connection where my console reads like this:
BluetoothGatt: onConnectionUpdated() - Device=B4:E6:2D:B3:D0:DB interval=6 latency=0 timeout=500 status=0
BluetoothGatt: setCharacteristicNotification() - uuid: 0a990c1f-0000-441c-8f7d-f775b6ff9400 enable: true
BluetoothGatt: setCharacteristicNotification() - uuid: f7c21d1c-0000-4b9b-ab7e-e1d8e7a51724 enable: true
Although I have no calls to onCharacteristicChanged?
I am not sure this is the proper way to check but I have used nRF Connect app to test if there is any activity between the BLE device and the Android phone. Using that app, it recoded no activity after connecting to the device. Just to be sure, I tested other BLE devices and saw the expected activity.
The BLE device has 8 characteristics that I read/get notified from, and another 8 that I write to (16 total). I have read that Android may only support 15, I could be wrong on how this works.
Does any of this seem like an issue? I can post code too.

BLE device works on ios but not on Android

Here's my problem
I have an electronic lock that uses BLE, it works fine on ios(Both LightBlue & the app I made)
But on Android, after bonding with the lock(I entered the pin code 000000), I can connect to the device, but one of the Service (UUID:7570) becomes empty, and I can't read or write to any characteristic.
Also the device always gets disconnected after about 20 seconds.
This is the ScreenShot from ios
This is the ScreenShot from android (with empty Service)
Here's the log I got from nRF Connect
nRF Connect, 2018-02-07
OHGA-ELock 60012 (68:C9:0B:15:99:0D)
V 17:57:52.234 Connecting to 68:C9:0B:15:99:0D...
D 17:57:52.234 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE)
D 17:57:52.767 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I 17:57:52.767 Connected to 68:C9:0B:15:99:0D
D 17:57:52.769 wait(1600ms)
D 17:57:52.785 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
V 17:57:54.373 Discovering services...
D 17:57:54.373 gatt.discoverServices()
D 17:57:54.395 [Callback] Services discovered with status: 0
I 17:57:54.395 Services discovered
V 17:57:54.414 Generic Access (0x1800)
- Device Name [R] (0x2A00)
- Appearance [R] (0x2A01)
- Peripheral Preferred Connection Parameters [R] (0x2A04)
Generic Attribute (0x1801)
Unknown Service (00007570-0000-0000-0000-000000000000)
Device Information (0x180A)
- System ID [R] (0x2A23)
- Model Number String [R] (0x2A24)
- Serial Number String [R] (0x2A25)
- Firmware Revision String [R] (0x2A26)
- Hardware Revision String [R] (0x2A27)
- Software Revision String [R] (0x2A28)
- Manufacturer Name String [R] (0x2A29)
D 17:58:10.701 [Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0)
E 17:58:10.701 Error 8 (0x8): GATT CONN TIMEOUT
I 17:58:10.701 Disconnected
D 17:58:10.794 [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
I've tested it on different Android phones with different testing apps.
Is there a chance this is an issue of the BLE device?
Please let me know if more specific details are needed.
Any help or suggestion would be appreciated.
Thanks!
the device always gets disconnected after about 20 seconds
This is because of the supervision timeout. In Android it is hardcoded to 20 seconds during which a re-connect doesn’t work. For more information to know what this 20 seconds and supervision timeout take a look here- Android BLE connection timeouts and GATT internal errors

Proper way to handle BLE Error Codes

Here is the list of error which i got while developing BLE App for A&D UA-651BLE model
onClientConnectionState() - status=8 clientIf=5 device=D0:5F:B8:03:79:70
onClientConnectionState() - status=22 clientIf=5 device=5C:31:3E:5E:E2:36
onClientConnectionState() - status=19 clientIf=5 device=5C:31:3E:5E:E2:36
As of now I'm handling this with gatt.disconnect(); ,
Description of above error codes :
22 is 0x16 which means connection terminated by local host.
8 is 0x8 which means connection timeout.
19 is 0x13 which means connection terminate by peer user.
How to handle this in different way?
1.Is there any way to handle this issue other than disconnecting BluetoothGatt? (Just curious to know)
2.Shall I show popup to user that your values are stored in BP device,On next successful connection vital device will push your values automatically?
P.S: If I see from developer's perspective,I know that this is BLE Stack exception,By if i see from user's perspective,they will think something wrong in android app,that is why it is not Showing my BP reading in android Screen.

Android 4.3 BLE connection with Raspbery Pi (Bluez 5.8)

Device1: Nexus 4 Android 4.3 BLE Central (Using BluetoothLeGatt sample app in API 18 SDK as is)
Device2: Raspberry Pi with working BT4.0 USB Dongle, Raspbian Whezzy 20130726. Compiled Bluez 5.8 from the sources.(Since the packaged ver is 4.99 which not officially support BLE yet)
Working as peripheral, I started bluetoothd with "-p alert" (GATT Alert profile).
Test1: Using two raspi (device2 above) I can connect and browse alert gatt service/characteristics on other device using gattool.
Test2: Using iPhone/iPad (free BLE app: LightBlue) as Central I can also connect and browse alert gatt services and characteristics value on the Raspi.
Test3: When connecting using Nexus 4 sample app, (which is unstable), it asking for authorization on both device.Even after I can get rid off the authorization, the hcidump look like they are exchanging SDP info, the service list still not come up on Android sample app.
Test4: Nexus 4 sample app can connect and browse service on Fitbit One and Wahoo HRM.
Using hcidump (on the raspi), I can see different connection initiation:
Test1/2:
>HCI Event: LE Meta Event (0x3e) plen 19
LE Connection Complete
status 0x00 handle 44, role slave
bdaddr ... (Public)
Test3:
>HCI Event: Connect Request (0x04) plen 10
bdaddr ... class 0x5a020c type ACL
(Is it Bluetooth classic connection?)
Question:
Is there any way I can make Android BLE connection to create HCI Event: LE Meta Event on Raspi?

Categories

Resources