Command Protocol

This page describes the underlying commands exposed by the modem.

Commands List

IdCommandDescriptionRequestResponse

0x100

Check communication with device

0x101

Get the modem's command protocol version

Protocol version

0x102

Get device's unique identifier

Device Identifier (UUID)

0x103

Get device's URL

Zero-terminated, ASCII-encoded URL

0x104

Get information about the modem

Modem firmware version & uptime

0x200

Read connection status and events

Status & event bits

0x201

Request connection to the Blecon network

0x202

Close or cancel connection

0x203

Queue outgoing frame

Outgoing frame to send

0x204

Get number of free slots in outgoing queue

Number of free slots

0x205

Dequeue incoming response frame

Incoming frame

0x206

Get the number of queued incoming frames

Number of queued frames

0x207

Clear all frames from incoming queue

0x208

Announce the device to nearby Blecon hotspots

Command Format

A command always consists of a request sent by the host MCU, and corresponding response sent back by the Blecon modem.

All data is sent in little endian.

The structure of a request is:

4 bytesn bytes

Request Id

Request Field

The structure of a response is:

2 bytesn bytes

Error code

Response Field

The response data field is only present when the command executed successfully (error code 0).

Error codes

CodeDescription

0

OK

1

Invalid command ID

2

Invalid size

3

Parsing error

4

Invalid state

5

Internal Memory Error

Commands Details

Attention

Check communication with the Blecon modem.

Request Id: 0x100

Request field: Empty

Response field: Empty

Protocol Version

Get the modem's command protocol version.

Request Id: 0x101

Request field: Empty

Response field:

FieldSize (bytes)Description

Protocol Version

4

The supported protocol version (2)

Get Identity

Retrieve the Blecon Device Identifier.

Request Id: 0x102

Request field: Empty

Response field:

FieldSize (bytes)Description

BDID

16

The Blecon Device Identifier (Version 4 UUID)

Get Device URL

Retrieve the Blecon Device URL used for device connection. This is the same URL exposed by the modem via NFC.

Request Id: 0x103

Request field: Empty

Response field:

FieldSize (bytes)Description

Device URL

192

A zero-terminated, ASCII-encoded URL

Get Info

Get information about the modem's firmware & state.

Request Id: 0x104

Request field: Empty

Response field:

FieldSize (bytes)Description

Firmware Version

4

The Blecon Modem firmware version

Uptime

4

Time in milliseconds since the modem was started

Status

Get information about the modem's status.

All event bits are set on a specific event, and cleared when read.

Request Id: 0x200

Request field: Empty

Response field:

FieldSize (bytes)Description

Status

2

Bit 0: Network Connection Status (1: connected) Bits 1..15: RFU

Events

2

Bit 0: Connection Event

Bit 1: Disconnection Event

Bit 2: Outgoing Queue Space Event

Bit 3: Incoming Queue Data Event Bits 3..31: RFU

Connection Initiate

Request a connection to the Blecon network. Once the connection is available, a connection event is raised.

Request Id: 0x201

Request field: Empty

Response field: Empty

Connection Terminate

Close the current connection to the Blecon network, or stop requesting for one. Issuing this command clears all connection, response and error events.

Request Id: 0x202

Request field: Empty

Response field: Empty

Outgoing Queue Push

Queue a frame to send to the Blecon network. This command will succeed if the queue is not full and the modem connected to the network.

Request Id: 0x203

Request field:

FieldSize (bytes)Description

Outgoing request frame

Frame-specific

See request frames description

Response field: Empty

Outgoing Queue Space

Get number of free slots in the outgoing queue.

Request Id: 0x204

Request field: Empty

Response field:

FieldSize (bytes)Description

Slots

2

Number of free slots in queue

Incoming Queue Pop

Dequeue an incoming frame received from the Blecon network. This command will succeed if the queue is not empty.

Request Id: 0x205

Request field: Empty

Response field:

FieldSize (bytes)Description

Incoming request frame

Frame-specific

See request frames description

Incoming Queue Count

Get the number of frames queued in the incoming queue.

Request Id: 0x206

Request field: Empty

Response field:

FieldSize (bytes)Description

Count

2

Number of frames in queue

Incoming Queue Clear

Clear all frames in incoming queue.

Request Id: 0x207

Request field: Empty

Response field: Empty

Announce

Announce the device to nearby hotspots, so that any Blecon hotspot in range can identify the device in order to connect it to a network, or manage it.

Request Id: 0x208

Request field: Empty

Response field: Empty

Last updated