Quick start guide

Quick start guide

GATT server setup from the device settings

Initially, utilize an admin settings template with a minimum version of V8. Then, navigate to GATT server settings:

image-20250407-045307.png

These are the available options for the GATT server:

image-20250407-045254.png

Setting

Description

Setting

Description

GATT server enable (required)

Enables the GATT server by starting connectable advertisements.

Device name (optional)

Device name advertised on the connectable advertisement message which is set up automatically by the firmware. If this field is left blank, the device advertises the packet with no name data type.

Passkey enable (optional)

Enables the highest level of security and passkey entry when pairing.

Passkey (required)

Passkey for the GATT server. If passkey is not used, this can be a random value, but it is limited to 100000-999999. This option is recommended for secure transfer of data.

Command key (required)

Command key for the GATT command service. Must be between 1 and 32 characters.


GATT command message generation example

To generate a full GATT command message, a few things should be acquired:

  • Device IMEI - 869738062295360

  • GATT command key - 987654321

  • Command expiry time (decimal) - 1733047200

  • Output ID - 01h

  • Output data - 1000h

Using BT command serialiser (BT command serializer app )

  1. Execute the bt_command_serialiser.py file with the following arguments in this order:

    1. Device IMEI 869738062295360

    2. UTC expiry time in decimal format 1733047200 (2024-12-01 12:00)

    3. Command key 987654321(from device settings)

    4. Output command id and output command data 01010064 (Turn on OUT2 for 1s)

  2. This is what the command line command would look like: python.exe "bt_command_serialiser.py" 869738062295360 1733047200 987654321 01010064

  3. The output: 86c40070e00d8cff6a7b3d596630b32277c573c5a5b7f91feaa2712c705af49902040a00a0334c6701b703010064b6

Not using BT command serialiser

  1. Access token generation:

    1. Firstly, IMEI, command expiry time (UTC) and command key must be appended in the said order.

    2. Secondly, HMACSHA256 algorithm must be applied to the data in the earlier step.

    3. This is what the access token should look like with the provided data: 86c40070e00d8cff6a7b3d596630b32277c573c5a5b7f91feaa2712c705af499

  2. Output command generation:

    1. Go to BT IOTM output command generation and fill out the data according to the tables

    2. According to the data provided at the start, this is what an output command would look like: 02040a00a0334c6701b703010064b6

  3. Connecting output command and access token:

    1. The full output command is the access token appended to the output data:

    2. 86c40070e00d8cff6a7b3d596630b32277c573c5a5b7f91feaa2712c705af49902040a00a0334c6701b703010064b6

Sending the command:

An appropriate phone app (nRF Connect mobile is recommended) or a different Bluetooth device that supports GATT client functionality must be used to send the command to the device.

  1. The two devices must be connected and paired to send the command.

  2. Find the TX characteristic (00000101-0000-1000-8000-00805f9b34fb) in the Command service (00000100-0000-1000-8000-00805f9b34fb).

  3. Write data to the TX characteristic.

  4. To check if the message is received and executed, either subscribe to the RX characteristic (00000102-0000-1000-8000-00805f9b34fb) or manually read from it.

 

  • Note: MTU exchange must be done before the command is sent.