I am using the bluepy library to communicate with a bluetooth device but it is not showing me all the characteristics.
When I run the following using gatttool I get:
[EE:50:F0:F8:3C:FF][LE]> char-desc 0x0019 0xffff
handle: 0x0019, uuid: 00002800-0000-1000-8000-00805f9b34fb
handle: 0x001a, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x001b, uuid: 00001532-1212-efde-1523-785feabcd123
handle: 0x001c, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x001d, uuid: 00001531-1212-efde-1523-785feabcd123
handle: 0x001e, uuid: 00002902-0000-1000-8000-00805f9b34fb
handle: 0x001f, uuid: 00002803-0000-1000-8000-00805f9b34fb
handle: 0x0020, uuid: 00001534-1212-efde-1523-785feabcd123
But when I run the following using Bluepy I get:
characteristics = self.peripheral.getCharacteristics(startHnd=0x0019, endHnd=0xFFFF, uuid=None)
for characteristic in characteristics:
print("{}, hnd={}, supports {}".format(characteristic, hex(characteristic.handle), characteristic.propertiesToString()))
Characteristic <00001532-1212-efde-1523-785feabcd123>, hnd=0x1a, supports WRITE NO RESPONSE
Characteristic <00001531-1212-efde-1523-785feabcd123>, hnd=0x1c, supports NOTIFY WRITE
Characteristic <00001534-1212-efde-1523-785feabcd123>, hnd=0x1f, supports READ
I need to be able to write 'x01x00' to characteristic:
handle: 0x001e, uuid: 00002902-0000-1000-8000-00805f9b34fb
followed by writing 'x01x04' to characteristic:
handle: 0x001d, uuid: 00001531-1212-efde-1523-785feabcd123
but I am unable to because Bluepy is not finding the characteristic:
handle: 0x001e, uuid: 00002902-0000-1000-8000-00805f9b34fb
Why is this?
How can I write to the characteristic when Bluepy does not find it?
Why do the handles returned by Bluepy not match those returned by gatttool?
Thanks
Aucun commentaire:
Enregistrer un commentaire