OSTC over BLE experiences and questions
Jan Mulder
jlmulder at xs4all.nl
Thu Jul 13 02:00:05 PDT 2017
On 13-07-17 08:30, Alex Blasche wrote:
>
> OK, looking through your log I can see a few strange things. Here is the relevant sections of the log:
>
> 07-12 15:32:54.840 4741 4837 W QtBluetoothGatt: Performing queued job, handle: 18 Read (false) ValueKnown: false Skipping: false Descriptor
> ...
> 07-12 15:32:57.843 4741 4741 W QtBluetoothGatt: ****** Timeout for request on handle 18
> 07-12 15:32:57.843 4741 4741 W QtBluetoothGatt: ****** Looks like the characteristic or descriptor does NOT act in accordance to Bluetooth 4.x spec.
> 07-12 15:32:57.843 4741 4741 W QtBluetoothGatt: ****** Please check server implementation. Continuing under reservation.
> 07-12 15:32:57.843 4741 4741 W QtBluetoothGatt: Performing queued job, handle: 19 Read (false) ValueKnown: false Skipping: true Characteristic
> 07-12 15:32:57.843 4741 4741 D QtBluetoothGatt: Non-readable characteristic 00000004-0000-1000-8000-008025000000 for service 0000fefb-0000-1000-8000-00805f9b34fb
> ...
> 07-12 15:32:57.849 4741 4741 W QtBluetoothGatt: Performing queued job, handle: 21 Read (false) ValueKnown: false Skipping: true Descriptor
> 07-12 15:32:57.850 4741 4741 D QtBluetoothGatt: Non-readable descriptor 00002902-0000-1000-8000-00805f9b34fb for service/char0000fefb-0000-1000-8000-00805f9b34fb/00000004-0000-1000-8000-008025000000
>
>
> There is an unusual amount of chars and descriptors in your service (0000fefb) which are not readable or every attempt by Android to read them fails. This is strange because for example a descriptor like the last read for 00002902 (handle 21) should succeed. If I read the standard right there is no concept of non-readable descriptors.
Not sure you are aware of that 0000fefb service. Part of it is described
in
http://www.telit.com/fileadmin/user_upload/products/Downloads/sr-rf/BlueMod/TIO_Implementation_Guide_r04.pdf.
So, yes, it has 4 characteristics each with one descriptor.
>
> Handle 18 above is unusual as well. Trying to read the handle never returns. That's why there is this timeout kicking in. Otherwise the state machine discovering the service details would have been stuck.
Which seems a good thing.
>
> Can you read those descriptors using "nRF Connect". In fact, I would appreciate it if you could send me a snapshot of what the tools tells you about service 0xfefb (including your attempts to read the values). In some way I would argue the timeouts and non-readable chars make the service non-compliant. At the very least it screws up Qt Bluetooth's discovery process.
I have added 3 attachments. Not fully sure that I captured everything
you would like to see, but I can write to the OSTC (tested this by
sending a 0xBB byte, to tell the OSTC3 to enter download mode). That
session is in the attached txt file. The discovery process in there
shows a successful service discovery. Further, that 0000fefb service is
officially given a vendor specific UUID from the Bluetooth SIG, so I
assume (and hope) that they at least checked for compliance to the
standard. (and don't worry about the GATT error 133 at the end ... just
me switching off the OSTC).
>
> Since your communication doesn't continue I assume that subsurface is waiting for the state transition of QLowEnergyService from DiscoveringServices to ServiceDiscovered. Can you confirm that?
Yes, this is confirmed. And as the transition is not made within (the
stupid long) timeout of 12 seconds, Subsurface gives up, ie. closes the
controller.
>
> The immediate problem that I believe I can see is that the state machine has a missing end transition on my side. The last descriptor read of the service discovery is a failure and therefore the usual Android callbacks which finish the discovery do not kick in. I have to add an exit conditions which unfortunately means that you'll need a custom patch for QtBluetoothLE.java. I am stuck in workshop today and tomorrow. I'll try to squeeze it somewhere in between.
>
Don't worry about speed. I am afk the coming 3 days, and think that I
(finally) have to make a step towards self built Qt.
> Having said all that I still don't know how much further you get. Depending which chars and descriptors you need to read to retrieve information it may or may not matter.
And let me say that I truly appreciate you effort in this. I am
convinced that we would never get a working BLE setup without guys like you.
--jan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot_20170713-095011.png
Type: image/png
Size: 111178 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20170713/11f1a386/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot_20170713-094957.png
Type: image/png
Size: 110256 bytes
Desc: not available
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20170713/11f1a386/attachment-0003.png>
-------------- next part --------------
nRF Connect, 2017-07-13
OSTC3#0 (00:80:25:4A:0F:C3)
V 10:01:12.226 Connecting to 00:80:25:4A:0F:C3...
D 10:01:12.226 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE)
D 10:01:12.893 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I 10:01:12.893 Connected to 00:80:25:4A:0F:C3
D 10:01:12.894 wait(1600ms)
D 10:01:12.903 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
V 10:01:14.498 Discovering services...
D 10:01:14.498 gatt.discoverServices()
D 10:01:14.535 [Callback] Services discovered with status: 0
I 10:01:14.552 Services discovered
V 10:01:14.600 Generic Access (0x1800)
- Device Name [R] (0x2A00)
- Appearance [R] (0x2A01)
Generic Attribute (0x1801)
Device Information (0x180A)
- PnP ID [R] (0x2A50)
Unknown Service (0000fefb-0000-1000-8000-00805f9b34fb)
- Unknown Characteristic [WNR] (00000001-0000-1000-8000-008025000000)
Client Characteristic Configuration (0x2902)
- Unknown Characteristic [N] (00000002-0000-1000-8000-008025000000)
Client Characteristic Configuration (0x2902)
- Unknown Characteristic [W] (00000003-0000-1000-8000-008025000000)
Client Characteristic Configuration (0x2902)
- Unknown Characteristic [I] (00000004-0000-1000-8000-008025000000)
Client Characteristic Configuration (0x2902)
Unknown Service (53544d54-4552-494f-5345-525631303030)
- Unknown Characteristic [N WNR] (53544f55-4152-5449-4e20-205630303031)
Client Characteristic Configuration (0x2902)
- Unknown Characteristic [N WNR] (53544f47-5049-4f49-4e20-205630303031)
Client Characteristic Configuration (0x2902)
- Unknown Characteristic [W] (53544f44-4556-5345-4c20-205630303031)
- Unknown Characteristic [N W] (53544f54-494f-4341-4e44-435630303031)
Client Characteristic Configuration (0x2902)
V 10:01:43.591 Reading descriptor 00002902-0000-1000-8000-00805f9b34fb
D 10:01:43.591 gatt.readDescriptor(00002902-0000-1000-8000-00805f9b34fb)
I 10:01:43.688 Read Response received from descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 00-00
A 10:01:43.688 "Notifications and indications disabled" received
V 10:01:46.007 Reading descriptor 00002902-0000-1000-8000-00805f9b34fb
D 10:01:46.007 gatt.readDescriptor(00002902-0000-1000-8000-00805f9b34fb)
I 10:01:46.076 Read Response received from descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 00-00
A 10:01:46.076 "Notifications and indications disabled" received
V 10:01:47.360 Reading descriptor 00002902-0000-1000-8000-00805f9b34fb
D 10:01:47.360 gatt.readDescriptor(00002902-0000-1000-8000-00805f9b34fb)
I 10:01:47.440 Read Response received from descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 00-00
A 10:01:47.440 "Notifications and indications disabled" received
V 10:02:01.353 Writing request to characteristic 00000003-0000-1000-8000-008025000000
D 10:02:01.353 gatt.writeCharacteristic(00000003-0000-1000-8000-008025000000, value=0xFF)
I 10:02:01.435 Data written to 00000003-0000-1000-8000-008025000000, value: (0x) FF
A 10:02:01.435 "(0x) FF" sent
V 10:02:25.338 Writing command to characteristic 00000001-0000-1000-8000-008025000000
D 10:02:25.338 gatt.writeCharacteristic(00000001-0000-1000-8000-008025000000, value=0xBB)
I 10:02:25.346 Data written to 00000001-0000-1000-8000-008025000000, value: (0x) BB
A 10:02:25.346 "(0x) BB" sent
V 10:02:39.183 Reading descriptor 00002902-0000-1000-8000-00805f9b34fb
D 10:02:39.183 gatt.readDescriptor(00002902-0000-1000-8000-00805f9b34fb)
I 10:02:39.262 Read Response received from descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 00-00
A 10:02:39.262 "Notifications and indications disabled" received
V 10:02:40.270 Reading descriptor 00002902-0000-1000-8000-00805f9b34fb
D 10:02:40.270 gatt.readDescriptor(00002902-0000-1000-8000-00805f9b34fb)
I 10:02:40.335 Read Response received from descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 00-00
A 10:02:40.335 "Notifications and indications disabled" received
V 10:02:41.661 Reading descriptor 00002902-0000-1000-8000-00805f9b34fb
D 10:02:41.661 gatt.readDescriptor(00002902-0000-1000-8000-00805f9b34fb)
I 10:02:41.750 Read Response received from descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 00-00
A 10:02:41.750 "Notifications and indications disabled" received
V 10:03:02.367 Reading descriptor 00002902-0000-1000-8000-00805f9b34fb
D 10:03:02.367 gatt.readDescriptor(00002902-0000-1000-8000-00805f9b34fb)
E 10:03:13.851 Error 133 (0x85): GATT ERROR
D 10:03:13.852 [Callback] Connection state changed with status: 8 and new state: DISCONNECTED (0)
E 10:03:13.852 Error 8 (0x8): GATT CONN TIMEOUT
I 10:03:13.852 Disconnected
D 10:03:13.986 [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
D 10:03:41.764 gatt.close()
D 10:03:41.781 wait(200)
More information about the subsurface
mailing list