UPDATE:
I guessed, from another example, that I had to use the write_handle that was calculated previously for the write characteristic. And for the value handle, I used the value of the handle for the write_service.
self._ble.gattc_write(self.conn_handle, self.write_handle, data, 1)
And now, I am getting:
_IRQ_GATTC_WRITE_DONE-> 0 13
from this:
Code: Select all
elif event == _IRQ_GATTC_WRITE_DONE:
# Write completed (no-op).
conn_handle, value_handle, status = data
print('_IRQ_GATTC_WRITE_DONE-> ', status, value_handle)
But I expected a response from the server, with data. How can I get the data that I receive back? With the value handle? I am expecting a hex string of data. How can I extract it now?
----
Also, if the data that I want to send is an HEX string:
data = '7e00822c012ca118d436fc5fb42bf18a67d8041001710ecf8bb898ab462b0ffcd753f8702d22873ff88e82599b6bb0d29d53615596847eaeb6beda6a00f557afa65e120d3d44249fd9920f1c4d762283c4a92d981d9d7c85fc3b8a397af938e1a3f0697972ff6db62527d5e003500a6225a6c0a72451b40a0a4ea6360599ea82a91bdff045b6'
What is the best way to prepare it for the self._ble.gattc_write function? Using unhexlify?
data = binascii.unhexlify(data)
I tried to send it like that, directly, and with conversion and I also got status:0, value_handle:13.
Where can I get a list of all the status and their meanings, @jimmo? I am a bit lost, to be honest.
Thanks!