SaBLE-x Serial-to-BLE API
The SaBLE-x Serial-to-BLE API is based on the JSON-RPC 2.0 Specification. Please refer to the JSON-RPC specification for more information.
3 Video

This brief video provides a conceptual overview of how Serial-to-BLE simplifies Bluetooth communication between a Central and Peripheral device. (2:16)

1 Overview

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.

2 Message Integrity

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:

{"jsonrpc":"2.0","method":"QueryFirmwareVersion","id":1}

The calculated CRC is 0x8CBB.

The CRC is added to the message and sent over the wire. The result over the wire looks like:

{{"jsonrpc":"2.0","method":"QueryFirmwareVersion","id":1}{CRC:8CBB}}

All messages sent over the wire to the module must have a correct CRC or the message will be rejected.

Next: Exploring the API library for Serial-to-BLE