What would be the right way to send this string over ble, with gattc_write?
Code: Select all
data_sfs = '7e00822c0100a5aa342906c15706cf5710382ce02e25d386302155369a1cd64023576dc1105a878e0f7f12bd79ae3ce5e297cf8f68e1234fae5d1b6d9cec0aca33b226adbe3506232abbc44e7a9483f3d54d4fb16b0bd15a343ea8027b9b9c77e1b3b4cdcbdced2c72b60b5d72d00c2b7e0d14677a2a137936a7a9b5990dc8faa4710f37ccb2'
data_sfs = bytearray(binascii.unhexlify(data_sfs))
ble.gattc_write(self._conn_handle, self._write_handle, data, 1)
I've seen, only a couple of examples, of BLE here, and they used either bytes directly, or they used struct. But I can't get my head to understand how can I struct.pack this bytearray, and tell it the size (format) of the struct... or if it is even necessary.
Thanks for the help in advance,