spacecheese / bluez_peripheral

A library for building BLE peripherals using GATT and bluez
MIT License
38 stars 8 forks source link

How to declare a service with a READ & WRITE characteristic ? #8

Closed ubicore closed 2 years ago

ubicore commented 2 years ago

Hello,

I am trying to declare a service with a READ & WRITE characteristic, and with it's setter and getter functions.

But if i declare it, i have an error either :

I found that the same "self._value" is used for ReadValue and WriteValue method in the characteristic class and it could not be at the same time of type "bytes" (after a READ call) and support the item assignement (in a WRITE call).

Did i miss something ? Thanks

spacecheese commented 2 years ago

Sorry for the slow response. Fixed by e584370. To clarify getters and setters should only deal with bytes. I'm open to changing that behaviour but I imagine it would cause more problems than it solves on balance.

ubicore commented 2 years ago

Thanks for the changes.