Reputation: 62
I'm working with a BPM, the OMRON BP7350.
Device works smoothly with the manufacturer android app, with the raspberry pi I'm able to connect to the device, but when I try to write the indication request 0200
I don't get any response from the BPM sensor.
Then, I tested the OMRON BP7350 with the nRF Connect SDK android app and I was able to read the indications as smoothly as I'm able to do in the manufacturer app... So I don't understand what could possibly is wrong.
I've tried also working with the hcitool
and gatttool
in the pi, was able to connect to the device, but again, unable to get indications from the BPM sensor, I'm starting to think that is a pairing problem related that I might need to understand better, but since I'm running out of options, I wanted to know if you could give me a hand debugging this issue.
This are the log messages from the nRF Connect SDK:
nRF Connect, 2020-06-03
BLESmart_0000015328FFB28ADF2F (28:FF:B2:8A:DF:2F)
V 14:59:11.616 Connecting to 28:FF:B2:8A:DF:2F...
D 14:59:11.616 gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
D 14:59:11.901 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I 14:59:11.901 Connected to 28:FF:B2:8A:DF:2F
D 14:59:11.902 wait(1600ms)
D 14:59:11.935 [Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
I 14:59:12.464 Connection parameters updated (interval: 30.0ms, latency: 0, timeout: 2000ms)
V 14:59:13.503 Discovering services...
D 14:59:13.503 gatt.discoverServices()
D 14:59:13.518 [Callback] Services discovered with status: 0
I 14:59:13.518 Services discovered
V 14:59:13.567 Generic Access (0x1800)
- Device Name [R] (0x2A00)
- Appearance [R] (0x2A01)
- Peripheral Privacy Flag [R W WNR] (0x2A02)
- Reconnection Address [R] (0x2A03)
- Peripheral Preferred Connection Parameters [R] (0x2A04)
Generic Attribute (0x1801)
- Service Changed [I] (0x2A05)
Client Characteristic Configuration (0x2902)
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)
- IEEE 11073-20601 Regulatory Certification Data List [R] (0x2A2A)
Unknown Service (ecbe3980-c9a2-11e1-b1bd-0002a5d5c51b)
- Unknown Characteristic [N R W WNR] (b305b680-aee7-11e1-a730-0002a5d5c51b)
Client Characteristic Configuration (0x2902)
- Unknown Characteristic [W WNR] (db5b55e0-aee7-11e1-965e-0002a5d5c51b)
- Unknown Characteristic [W WNR] (e0b8a060-aee7-11e1-92f4-0002a5d5c51b)
- Unknown Characteristic [W WNR] (0ae12b00-aee8-11e1-a192-0002a5d5c51b)
- Unknown Characteristic [W WNR] (10e1ba60-aee8-11e1-89e5-0002a5d5c51b)
- Unknown Characteristic [N R] (49123040-aee8-11e1-a74d-0002a5d5c51b)
Client Characteristic Configuration (0x2902)
- Unknown Characteristic [N R] (4d0bf320-aee8-11e1-a0d9-0002a5d5c51b)
Client Characteristic Configuration (0x2902)
- Unknown Characteristic [N R] (5128ce60-aee8-11e1-b84b-0002a5d5c51b)
Client Characteristic Configuration (0x2902)
- Unknown Characteristic [N R] (560f1420-aee8-11e1-8184-0002a5d5c51b)
Client Characteristic Configuration (0x2902)
- Unknown Characteristic [N] (8858eb40-aee8-11e1-bb67-0002a5d5c51b)
Client Characteristic Configuration (0x2902)
Battery Service (0x180F)
- Battery Level [N R] (0x2A19)
Client Characteristic Configuration (0x2902)
Current Time Service (0x1805)
- Current Time [N R W] (0x2A2B)
Client Characteristic Configuration (0x2902)
Unknown Service (5df5e817-a945-4f81-89c0-3d4e9759c07c)
- Record Access Control Point [I W] (0x2A52)
Client Characteristic Configuration (0x2902)
- Unknown Characteristic [I] (c195da8a-0e23-4582-acd8-d446c77c45de)
Client Characteristic Configuration (0x2902)
User Data (0x181C)
- Database Change Increment [N R W] (0x2A99)
Client Characteristic Configuration (0x2902)
- User Index [R] (0x2A9A)
- User Control Point [I W] (0x2A9F)
Client Characteristic Configuration (0x2902)
- Date of Birth [R W] (0x2A85)
Blood Pressure (0x1810)
- Blood Pressure Measurement [I] (0x2A35)
Client Characteristic Configuration (0x2902)
- Blood Pressure Feature [R] (0x2A49)
D 14:59:13.568 gatt.setCharacteristicNotification(00002a05-0000-1000-8000-00805f9b34fb, true)
D 14:59:13.571 gatt.setCharacteristicNotification(b305b680-aee7-11e1-a730-0002a5d5c51b, true)
D 14:59:13.573 gatt.setCharacteristicNotification(49123040-aee8-11e1-a74d-0002a5d5c51b, true)
D 14:59:13.574 gatt.setCharacteristicNotification(4d0bf320-aee8-11e1-a0d9-0002a5d5c51b, true)
D 14:59:13.576 gatt.setCharacteristicNotification(5128ce60-aee8-11e1-b84b-0002a5d5c51b, true)
D 14:59:13.577 gatt.setCharacteristicNotification(560f1420-aee8-11e1-8184-0002a5d5c51b, true)
D 14:59:13.579 gatt.setCharacteristicNotification(8858eb40-aee8-11e1-bb67-0002a5d5c51b, true)
D 14:59:13.581 gatt.setCharacteristicNotification(00002a19-0000-1000-8000-00805f9b34fb, true)
D 14:59:13.584 gatt.setCharacteristicNotification(00002a2b-0000-1000-8000-00805f9b34fb, true)
D 14:59:13.585 gatt.setCharacteristicNotification(00002a52-0000-1000-8000-00805f9b34fb, true)
D 14:59:13.587 gatt.setCharacteristicNotification(c195da8a-0e23-4582-acd8-d446c77c45de, true)
D 14:59:13.588 gatt.setCharacteristicNotification(00002a99-0000-1000-8000-00805f9b34fb, true)
D 14:59:13.589 gatt.setCharacteristicNotification(00002a9f-0000-1000-8000-00805f9b34fb, true)
D 14:59:13.590 gatt.setCharacteristicNotification(00002a35-0000-1000-8000-00805f9b34fb, true)
V 14:59:37.265 Disabling indications for 00002a35-0000-1000-8000-00805f9b34fb
D 14:59:37.267 gatt.setCharacteristicNotification(00002a35-0000-1000-8000-00805f9b34fb, false)
D 14:59:37.278 gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0000)
I 14:59:37.454 Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 00-00
A 14:59:37.454 "Notifications and indications disabled" sent
V 14:59:37.480 Notifications and indications disabled for 00002a35-0000-1000-8000-00805f9b34fb
V 14:59:39.728 Enabling indications for 00002a35-0000-1000-8000-00805f9b34fb
D 14:59:39.728 gatt.setCharacteristicNotification(00002a35-0000-1000-8000-00805f9b34fb, true)
D 14:59:39.730 gatt.writeDescriptor(00002902-0000-1000-8000-00805f9b34fb, value=0x0200)
I 14:59:39.793 Data written to descr. 00002902-0000-1000-8000-00805f9b34fb, value: (0x) 02-00
A 14:59:39.793 "Indications enabled" sent
V 14:59:39.805 Indications enabled for 00002a35-0000-1000-8000-00805f9b34fb
I 14:59:40.592 Indication received from 00002a35-0000-1000-8000-00805f9b34fb, value: (0x) 1E-70-00-4B-00-57-00-E4-07-06-03-0B-1F-1F-46-00-01-00-00
A 14:59:40.592 "Systolic: 112.0 mmHg
Diastolic: 75.0 mmHg
Mean AP: 87.0 mmHg
Timestamp: 11:31:31 2.07.2020
Pulse: 70.0 bpm
User ID: 1" received
I 14:59:40.635 Indication received from 00002a35-0000-1000-8000-00805f9b34fb, value: (0x) 1E-71-00-4B-00-57-00-E4-07-06-03-0E-15-26-52-00-01-00-00
A 14:59:40.635 "Systolic: 113.0 mmHg
Diastolic: 75.0 mmHg
Mean AP: 87.0 mmHg
Timestamp: 14:21:38 2.07.2020
Pulse: 82.0 bpm
User ID: 1" received
D 14:59:48.769 [Callback] Connection state changed with status: 19 and new state: DISCONNECTED (0)
W 14:59:48.770 Connection terminated by peer (status 19)
I 14:59:48.770 Disconnected
D 14:59:48.840 [Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
and this is my code to subscribe to the notifications/indications:
def subscribe(dev_addr, char_uuid, dev_name, dev_service, indication=False):
try:
if dev_addr is not None:
global mydevice, keep_subscribe
mydevice = dev_name
# connection process
print("going to connect to ", mydevice)
p = Peripheral( dev_addr )
p.setDelegate( ScanDelegate() )
print("device connected: ", mydevice)
# Setup to turn notifications on, e.g.
svc = p.getServiceByUUID( dev_service )
notification_value = "" # this will save the value to send
if indication:
# setting security level to medium for encrypted data exchage
p.setSecurityLevel("medium")
notification_value = b"\x02\x00" # enable indications
else:
notification_value = b"\x01\x00" # enable notifications
# to turn on notifications, we need to write this to the characteristic
characteristic_target = svc.getCharacteristics(char_uuid)[0]
print("characteristic_target", characteristic_target)
# characteristic configuration client 'almost' always is the characteristic value + 1
ccc_handle = characteristic_target.getHandle() + 1
print("ccc_handle", ccc_handle)
# write to the characteristic
p.writeCharacteristic(ccc_handle, notification_value, withResponse=True)
# Main loop --------
while True:
if p.waitForNotifications(1.0):
# handleNotification() was called
continue
print("Waiting notifications...")
# Perhaps do something else here
except bluepy.btle.BTLEDisconnectError as e:
keep_subscribe = False
print("device disconnected, a BTLEDisconnectError happened: ", e)
With this function I'm able to get data from other sensors but without sucess with the BPM, what I can't get the data from this device?
Upvotes: 1
Views: 1507
Reputation: 13305
As Martijn van Welie suggested, it looks like you are not enabling indications on the correct descriptor. This is the sequence of steps you need to follow using hcitool and gatttool:-
Scan for your device using:-
sudo hcitool lescan
Once found, connect to your device using the following gatttool commands:-
gatttool -I
[ ][LE]> connect 00:11:22:33:44:55
If the above doesn't work, it is probably due to your device using a random address, in which case you need to try with:-
[ ][LE]> connect 00:11:22:33:44:55 random
Now that you are connected, you need to find the handle of the 0x2902 descriptor and enable indications on it. To do this, you need to first find the handle range of the Blood Pressure characteristic (0x1810)
[00:11:22:33:44:55][LE]> characteristics # This lists all the characteristics
Note down the handle of the blood pressure characteristic and the one after it (e.g. 0x001c, 0x001e). Now you want to look for descriptors in that handle range using:-
[00:11:22:33:44:55][LE]> char-desc 0x001c 0x001e
This should return a few descriptors, one of them being 0x2902 (e.g. handle: 0x0016, uuid: 00002902-0000-1000-8000-00805f9b34fb). You then need to enable indications on that handle:-
[00:11:22:33:44:55][LE]> char-write-req 0x0016 0200
And this should enable indications on your device.
Upvotes: 1