-
Notifications
You must be signed in to change notification settings - Fork 123
Accessing a RileyLink via BLE
Razz Fox edited this page Jan 28, 2017
·
3 revisions
- c842e849-5028-42e2-867c-016adada9155 - Data
- 6e6c7910-b89e-43a5-a0fe-50c5e2b81f4a - Response Count
- 6e6c7910-b89e-43a5-78af-50c5e2b86f7e - Timer Tick
Communication with a RL is done by issuing commands and waiting for responses.
To issue a command, you must write to the Data attribute. The format of bytes you need to write is as follows:
- 0 - the first byte is the total size of the data to be written, minus 1 (this byte)
- 1 - this byte holds the command, which is one of these: Command Types
- params - remaining bytes are command dependent. Some commands have no params, in which case only the two above bytes need to be written to the Data attribute. See commands.c to see what is expected.
You should subscribe to notifications on the Response Count attribute. Do not rely on response count incrementing (it loops), but just use its notifications as a signal that a response is waiting. When you receive a notification, you can perform a read on the Data attribute. You should buffer data received in this manner, and append it to any data you have previously received. Responses can then be parsed out from this data by searching for null characters ('\0') that will mark the end of each response.
- 0xaa - Timeout. This response can be returned during normal operations if the command was expecting to hear something over the radio, and didn't within the specified time.
- 0xbb - Command Interrupted. This response happens if you send a new command before a previous one has finished. It's useful to do so in cases such as you are running a long listen for packets, but the user needs to take some action that requires interrupting the listen and sending out new packets.
- 0xcc - Zero Data. This should be a rare occurrence, and indicates very noisy radio reception.