PiBee63
Posts: 4
Joined: Tue May 28, 2019 8:18 am

Read BLE device service, characteristic and descriptors

Tue May 28, 2019 8:39 am

Hi, currently I want to connect to the bluetooth low energy device and read its service, characteristic and descriptors.
Any best way can suggest to me? I am using the raspberry pi 3 model b+ , Linux raspberrypi 4.14.98-v7+ and bluez 5.50. Thank You

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Read BLE device service, characteristic and descriptors

Tue May 28, 2019 10:48 am

Node.js has excellent BLE libraries bleno and noble. I've used bluepy with Python. The BlueZ github has examples in Python and C. Gatttool and bluetoothctl are good CLI interfaces for exploring BLE devices.

PiBee63
Posts: 4
Joined: Tue May 28, 2019 8:18 am

Re: Read BLE device service, characteristic and descriptors

Wed May 29, 2019 8:32 am

Douglas6 wrote:
Tue May 28, 2019 10:48 am
Node.js has excellent BLE libraries bleno and noble. I've used bluepy with Python. The BlueZ github has examples in Python and C. Gatttool and bluetoothctl are good CLI interfaces for exploring BLE devices.
Hi Douglas6, Thanks for your recommendation. Now I was able to read the characteristic value by using the bluepy. Now I'm looking for notify in the bluepy, is it the notification means I will get the notification once my bluetooth device has get the data?

User avatar
Douglas6
Posts: 4874
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: Read BLE device service, characteristic and descriptors

Wed May 29, 2019 2:00 pm

I'm not understanding, and of course I don't know how your Bluetooth device works. You say you are reading a characteristic on the Pi. So you have the data. I'm afraid I don't understand where notifications come in. There's a section in the bluepy documentation on how to read notifications, if your device is sending them.

PiBee63
Posts: 4
Joined: Tue May 28, 2019 8:18 am

Re: Read BLE device service, characteristic and descriptors

Thu May 30, 2019 6:45 am

Im sorry for that because I also not clear about it so leave the notification first. Now I want write to my characteristic. I want to write "81 80 0 0 0 0 163 68" into it but I have research some people's sample, I see them have to convert the text that i want to write in bytes format. So i got try " [ p.writeCharacteristic(0x001d, b'\x51\x50\x00\x00\x00\x00\xA3\x44', withResponse=True) ]". p is represent my peripheral connect to my device. But I also didn't get the response of True after this line execute. So I think I may write it wrongly. How should I to write it correctly? Thank You for your support.

PiBee63
Posts: 4
Joined: Tue May 28, 2019 8:18 am

Re: Read BLE device service, characteristic and descriptors

Fri May 31, 2019 9:39 am

Thank You Douglas6. Thanks for your valuable suggestion. I have settle all my issue.


Return to “General discussion”