This brief video provides a conceptual overview of how Serial-to-BLE simplifies Bluetooth communication between a Central and Peripheral device. (2:16)
In most cases the SaBLE-x module will be considered the JSON-RPC server and the origin of response messages. The host is the JSON-RPC client, or the origin of request messages. There are some transactions where the client and server roles are reversed. One example of this would be when the module receives OTA data. The module will generate a ReceiveOtaData request and send it to the host. It is up to the host to respond to the module so the module knows the host received the data.
For any request generated by the module, if the host does not respond, the same message will be sent two more times for a total of three tries. The Serial-to-BLE API in the Developer Tool Suite details all the commands along with the direction of the message.
To ensure data contained in the JSON-RPC message sent over the UART to the module is valid, a CRC-16-CCITT seeded with 0xFFFF, is calculated on the entire JSON-RPC message.
For example, a query firmware message would look like:
The calculated CRC is 0x8CBB.
The CRC is added to the message and sent over the wire. The result over the wire looks like:
All messages sent over the wire to the module must have a correct CRC or the message will be rejected.