Reputation: 8945
Is there a problem with writing-to and notifying-from the same characteristic? Or is it recommended that one create two characteristics, one for receiving data, and the other for transmitting? Is this less of a concern for Android then the NRF52 series?
Thanks
Upvotes: 1
Views: 1859
Reputation: 1059
The officially approved Current Time Service contains the Current Time characteristics that allows for both writing and notifying. So I assume that there is no fundamental problem with that.
Upvotes: 0
Reputation: 1098
There is no problem with a Characteristic having both Write and Notify properties. I would use a single Characteristic if the writing and notifying is associated with the same data.
As far as I know, this should not be a concern with any BLE device.
Having two characteristics does not eliminate the "race condition" on Android devices. The GATT API is synchronous, i.e. you cannot read or write on more than one characteristic at a time.
Upvotes: 2
Reputation: 18452
Generally there is no such issue but you shouldn't do it if you intend to communicate with an Android phone since there is a race condition in the API itself you can read about here How could i achieve maximum thread safety with a read/write BLE Gatt Characteristic?
So I would definitely recommend you to have two characteristics.
Upvotes: 1