Subsurface-mobile with BT and BLE support [was Re: updates to libdc with ABI change]

Anton Lundin glance at acc.umu.se
Thu Jun 29 15:31:46 PDT 2017


On 29 June, 2017 - Jan Mulder wrote:

> On 29-06-17 17:59, Linus Torvalds wrote:
> >
> >>In order to check my hypothesis, I hacked around in qt-ble.cpp. And yes, I'm
> >>basically sure that the service 0000fefb... is the right one. In the code in
> >>master this one is discarded as standard, but by using this anyway I am able
> >>to get the OSTC3 in download mode. I did not succeed up to now to receive
> >>data from the OSTC3, so obviously, the parsing fails right at the start.
> >You could probably  just verify my "enable notification from the
> >second characteristic" by extending on your hack with the attached
> >patch. Does that make it work for you?
> 
> I verified your patch to select the proper notify characteristic,
> and that works correctly. I suppose that this patch does not break
> other already working BLE devices, so this one should go in master I
> think.
> 
> >Note that you'll still need your code to pick the right characteristic
> >- this is just the "enable notifications right" side.
> Yes, did that, and then the receiving/reading of data is still no
> yet working (not surprising as I had the correct notify
> characteristic hard coded selected). I found out that
> BLEObject::characteristcStateChanged() is never called in my
> situation, so no incoming packets are seen. Not sure why (yet).

I tested this to, against a OSTC4, and I actually got some data back.
It looks scrambled, and haven't had the time to decipher what might
be wrong.


//Anton


-- 
Anton Lundin	+46702-161604
-------------- next part --------------
Starting download from  BT
Starting the thread 0
qt.bluetooth.bluez: Bluez 5 detected.
qt.network.ssl: QSslSocket: cannot resolve SSLv2_client_method
qt.network.ssl: QSslSocket: cannot resolve SSLv2_server_method
qt.bluetooth.bluez: Enabling GATT request timeout behavior 20000
qt_ble_open( 00:80:25:4A:CF:BD )
qt.bluetooth.bluez: No settings found for peer device.
qt.bluetooth.bluez: HCI event triggered, type: e
qt.bluetooth.bluez: HCI event triggered, type: e
qt.bluetooth.bluez: HCI event triggered, type: e
qt.bluetooth.bluez: HCI event triggered, type: f
qt.bluetooth.bluez: HCI event triggered, type: f
qt.bluetooth.bluez: HCI event triggered, type: f
qt.bluetooth.bluez: Current l2cp sec level: 1
qt.bluetooth.bluez: Exchanging MTU
connected to the controller for device 00:80:25:4A:CF:BD
  .. discovering services
qt.bluetooth.bluez: Sending read_by_group_type request, startHandle: 1
endHandle: ffff 2800
qt.bluetooth.bluez: Received size: 3 data: "031700"
qt.bluetooth.bluez: Server MTU: 23 resulting mtu: 23
qt.bluetooth.bluez: Received size: 20 data:
"1106010005000018060006000118070009000a18"
qt.bluetooth.bluez: Found uuid: "{00001800-0000-1000-8000-00805f9b34fb}"
start handle: 1 end handle: 5
Found service "{00001800-0000-1000-8000-00805f9b34fb}"
 .. ignoring standard service
qt.bluetooth.bluez: Found uuid: "{00001801-0000-1000-8000-00805f9b34fb}"
start handle: 6 end handle: 6
Found service "{00001801-0000-1000-8000-00805f9b34fb}"
 .. ignoring standard service
qt.bluetooth.bluez: Found uuid: "{0000180a-0000-1000-8000-00805f9b34fb}"
start handle: 7 end handle: 9
Found service "{0000180a-0000-1000-8000-00805f9b34fb}"
 .. ignoring standard service
qt.bluetooth.bluez: Sending read_by_group_type request, startHandle: a
endHandle: ffff 2800
qt.bluetooth.bluez: Received size: 8 data: "11060a001600fbfe"
qt.bluetooth.bluez: Found uuid: "{0000fefb-0000-1000-8000-00805f9b34fb}"
start handle: a end handle: 16
Found service "{0000fefb-0000-1000-8000-00805f9b34fb}"
 .. ignoring standard service
qt.bluetooth.bluez: Sending read_by_group_type request, startHandle: 17
endHandle: ffff 2800
qt.bluetooth.bluez: Received size: 22 data:
"11141700ffff30303031565245534f495245544d5453"
qt.bluetooth.bluez: Found uuid: "{53544d54-4552-494f-5345-525631303030}"
start handle: 17 end handle: ffff
Found service "{53544d54-4552-494f-5345-525631303030}"
 .. created service object QLowEnergyService(0x7f23d8009290)
qt.bluetooth.bluez: Sending read_by_type request, startHandle: 17
endHandle: ffff type: 2802 packet: "081700ffff0228"
qt.bluetooth.bluez: Sending read_by_group_type request, startHandle: 1
endHandle: ffff 2801
qt.bluetooth.bluez: Received size: 5 data: "010817000a"
qt.bluetooth.bluez: Error1: "no attribute in given range found" last
command: 8 handle: 17
qt.bluetooth.bluez: Sending read_by_type request, startHandle: 17
endHandle: ffff type: 2803 packet: "081700ffff0328"
qt.bluetooth.bluez: Received size: 5 data: "011001000a"
qt.bluetooth.bluez: Error1: "no attribute in given range found" last
command: 10 handle: 1
 .. done discovering services
 .. discovering details
qt.bluetooth.bluez: Received size: 23 data:
"09151800141900313030305620204e49545241554f5453"
qt.bluetooth.bluez: Found handle: 18 properties: QFlags(0x4|0x10) value
handle: 19 uuid: "{53544f55-4152-5449-4e20-205630303031}"
qt.bluetooth.bluez: Sending read_by_type request, startHandle: 19
endHandle: ffff type: 2803 packet: "081900ffff0328"
qt.bluetooth.bluez: Received size: 23 data:
"09151b00141c00313030305620204e494f4950474f5453"
qt.bluetooth.bluez: Found handle: 1b properties: QFlags(0x4|0x10) value
handle: 1c uuid: "{53544f47-5049-4f49-4e20-205630303031}"
qt.bluetooth.bluez: Sending read_by_type request, startHandle: 1c
endHandle: ffff type: 2803 packet: "081c00ffff0328"
qt.bluetooth.bluez: Received size: 23 data:
"09151e00081f00313030305620204c45535645444f5453"
qt.bluetooth.bluez: Found handle: 1e properties: QFlags(0x8) value
handle: 1f uuid: "{53544f44-4556-5345-4c20-205630303031}"
qt.bluetooth.bluez: Sending read_by_type request, startHandle: 1f
endHandle: ffff type: 2803 packet: "081f00ffff0328"
qt.bluetooth.bluez: Received size: 23 data:
"09152000182100313030305643444e41434f49544f5453"
qt.bluetooth.bluez: Found handle: 20 properties: QFlags(0x8|0x10) value
handle: 21 uuid: "{53544f54-494f-4341-4e44-435630303031}"
qt.bluetooth.bluez: Sending read_by_type request, startHandle: 21
endHandle: ffff type: 2803 packet: "082100ffff0328"
qt.bluetooth.bluez: Received size: 5 data: "010821000a"
qt.bluetooth.bluez: Error1: "no attribute in given range found" last
command: 8 handle: 21
qt.bluetooth.bluez: Reading all characteristic values for
"{53544d54-4552-494f-5345-525631303030}"
qt.bluetooth.bluez: Discovering descriptor values for
"{53544d54-4552-494f-5345-525631303030}"
qt.bluetooth.bluez: Sending find_info request (18, 1b, 1e, 20) 18
qt.bluetooth.bluez: Received size: 6 data: "050118000328"
qt.bluetooth.bluez: Suppressing primary/characteristic 2803
qt.bluetooth.bluez: Sending find_info request (18, 1b, 1e, 20) 19
qt.bluetooth.bluez: Received size: 20 data:
"05021900313030305620204e49545241554f5453"
qt.bluetooth.bluez: Suppressing char handle 19
qt.bluetooth.bluez: Sending find_info request (18, 1b, 1e, 20) 1a
qt.bluetooth.bluez: Received size: 6 data: "05011a000229"
qt.bluetooth.bluez: Descriptor found, uuid:
"{00002902-0000-1000-8000-00805f9b34fb}" descriptor handle: 1a
qt.bluetooth.bluez: Sending find_info request (1b, 1e, 20) 1b
qt.bluetooth.bluez: Received size: 6 data: "05011b000328"
qt.bluetooth.bluez: Suppressing primary/characteristic 2803
qt.bluetooth.bluez: Sending find_info request (1b, 1e, 20) 1c
qt.bluetooth.bluez: Received size: 20 data:
"05021c00313030305620204e494f4950474f5453"
qt.bluetooth.bluez: Suppressing char handle 1c
qt.bluetooth.bluez: Sending find_info request (1b, 1e, 20) 1d
qt.bluetooth.bluez: Received size: 6 data: "05011d000229"
qt.bluetooth.bluez: Descriptor found, uuid:
"{00002902-0000-1000-8000-00805f9b34fb}" descriptor handle: 1d
qt.bluetooth.bluez: Sending find_info request (1e, 20) 1e
qt.bluetooth.bluez: Received size: 6 data: "05011e000328"
qt.bluetooth.bluez: Suppressing primary/characteristic 2803
qt.bluetooth.bluez: Sending find_info request (1e, 20) 1f
qt.bluetooth.bluez: Received size: 20 data:
"05021f00313030305620204c45535645444f5453"
qt.bluetooth.bluez: Suppressing char handle 1f
qt.bluetooth.bluez: Sending find_info request (20) 20
qt.bluetooth.bluez: Received size: 6 data: "050120000328"
qt.bluetooth.bluez: Suppressing primary/characteristic 2803
qt.bluetooth.bluez: Sending find_info request (20) 21
qt.bluetooth.bluez: Received size: 20 data:
"05022100313030305643444e41434f49544f5453"
qt.bluetooth.bluez: Suppressing char handle 21
qt.bluetooth.bluez: Sending find_info request (20) 22
qt.bluetooth.bluez: Received size: 6 data: "050122000229"
qt.bluetooth.bluez: Descriptor found, uuid:
"{00002902-0000-1000-8000-00805f9b34fb}" descriptor handle: 22
qt.bluetooth.bluez: Sending find_info request (20) 23
qt.bluetooth.bluez: Received size: 5 data: "010423000a"
qt.bluetooth.bluez: Error1: "no attribute in given range found" last
command: 4 handle: 23
qt.bluetooth.bluez: Reading all descriptor values for
"{53544d54-4552-494f-5345-525631303030}"
qt.bluetooth.bluez: Received size: 3 data: "0b0000"
qt.bluetooth.bluez: Received size: 3 data: "0b0000"
qt.bluetooth.bluez: Received size: 3 data: "0b0000"
    "{53544f55-4152-5449-4e20-205630303031}"
    "{53544f47-5049-4f49-4e20-205630303031}"
    "{53544f44-4556-5345-4c20-205630303031}"
    "{53544f54-494f-4341-4e44-435630303031}"
 .. enabling notifications
Descriptor list with 1 elements
Descriptor: "Client Characteristic Configuration" uuid:
"{00002902-0000-1000-8000-00805f9b34fb}"
now writing "0x0100" to the first descriptor
qt.bluetooth.bluez: Writing descriptor 1a (size: 5 )
INFO: dc_deveice_open error value of 0
qt.bluetooth.bluez: Writing characteristic 18 (size: 4 with response:
false signed: false )
qt.bluetooth.bluez: Received size: 1 data: "13"
BLE write completed
qt.bluetooth.bluez: Received size: 5 data: "1b1900bb4d"
qt.bluetooth.bluez: Change notification for handle 19
qt.bluetooth.bluez: Writing characteristic 18 (size: 4 with response:
false signed: false )
qt.bluetooth.bluez: Received size: 10 data: "1b190060003b0000434d"
qt.bluetooth.bluez: Change notification for handle 19
qt.bluetooth.bluez: Writing characteristic 18 (size: 4 with response:
false signed: false )
qt.bluetooth.bluez: Received size: 23 data:
"1b1900695b00c008416e746f6e204c756e64696e202020"
qt.bluetooth.bluez: Change notification for handle 19
qt.bluetooth.bluez: Received size: 23 data:
"1b19002020202020202020202020202020202020202020"
qt.bluetooth.bluez: Change notification for handle 19
[6.749998] ERROR: Unexpected ready byte. [in
../../libdivecomputer/src/hw_ostc3.c:310 (hw_ostc3_transfer)]
[6.750015] ERROR: Failed to read the version. [in
../../libdivecomputer/src/hw_ostc3.c:628 (hw_ostc3_device_foreach)]
qt.bluetooth.bluez: Writing characteristic 18 (size: 4 with response:
false signed: false )
qt.bluetooth.bluez: Received size: 23 data:
"1b19002020202020202020202020202020202020202020"
qt.bluetooth.bluez: Change notification for handle 19
[6.750917] ERROR: Unexpected echo. [in
../../libdivecomputer/src/hw_ostc3.c:221 (hw_ostc3_transfer)]
[6.750933] ERROR: Failed to send the command. [in
../../libdivecomputer/src/hw_ostc3.c:530 (hw_ostc3_device_close)]
Finishing the thread Dive data import error dives downloaded 0



More information about the subsurface mailing list