Android Question Writing using to Characteristic using BLE 2 - Library

JTolhurst

Member
Licensed User
Longtime User
Hi,
I have been having a play with the B4A BLE example. I can connect to my bluetooth device and see some basic information about numerous services and characteristics.
I have a service which I am interested in: 0000ffe0-0000-1000-8000-00805f9b34fb
which has a characteristic: 0000ffe1-0000-1000-8000-00805f9b34fb
which has attributes: read, write without response, notify.

The protocol I am interested in requires that communication is always started by the Android device writing to the characteristic. The answers are "notified" by the bluetooth device varying the value of the characteristic.

The commands and answers are packets with the following structure:

x55 xAA len x09 x01 com ... ck0 ck1

where:
  • ... Are a UInt8 array of l-2 elements
  • ck0, ck1 are a checksum computed from the elements from l to the last of ...
  • x55 and xAA are fixed and are Beggining of buffer
  • len is the size of ... + 2
  • x09 and x01 are fixed
  • com is a command or variable.
How would I go about writing this kind of packet to the characteristic, and then receiving the response (which can sometimes be spread over more than one packet)?

Many Thanks
 
Top