Links

Modem Command Protocol

The functions that the Blecon Modem makes available to your firmware
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 bytes
n bytes
Request Id
Request Field
The structure of a response is:
2 bytes
n bytes
Error code
Response Field
The response data field is only present when the command executed successfully (error code 0).

Error codes

Code
Description
0
OK
1
Invalid command ID
2
Invalid size
3
Parsing error
4
Invalid state

List of commands

Read Status

Get information about the modem's status.
Request Id: 0x00000001
Request field: Empty
Response field:
Field
Size (bytes)
Description
Status
4
Bit 0: Network Connection Status (1: connected)
Bit 1: Blecon Response Event (1: response available) Bit 2: Blecon Error Event (1: error available) Bits 3..31: RFU

Ping

Check communication with the Blecon modem.
Request Id: 0x00000002
Request field: Empty
Response field: Empty

Get Identity

Retrieve the Blecon Device Identifier.
Request Id: 0x00000003
Request field: Empty
Response field:
Field
Size (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: 0x00000004
Request field: Empty
Response field:
Field
Size (bytes)
Description
Device URL
192
A zero-terminated, ASCII-encoded URL

Request Connection

Request a connection to the Blecon network. Once the connection is available, a connection event is raised.
Request Id: 0x00000005
Request field: Empty
Response field: Empty

Close Connection

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: 0x00000006
Request field: Empty
Response field: Empty

Send Request

Send a request on the Blecon network. This command will only succeed if a connection to the Blecon network is currently available.
Request Id: 0x00000007
Request field:
Field
Size (bytes)
Description
Request data
MTU
The data to send to the network, up to MTU bytes long.
Response field: Empty

Get Response

Get the response sent back by the Blecon network. This command will only succeed if a response is available. Issuing this command clears the response event.
Request Id: 0x00000008
Request field: Empty
Response field:
Field
Size (bytes)
Description
Response data
MTU
The data sent back from the network, up to MTU bytes long.

Get Error

Get the error issued for the last request. This command will only succeed if an error was raised during a request. Issuing this command clears the error event.
Request Id: 0x00000009
Request field: Empty
Response field:
Field
Size (bytes)
Description
Error
2
An error code as listed below.
List of error codes:
Error Code
Description
0x0
OK
0x100
Timeout
0x101
Security Error
0x102
Disconnection Error
0x200
Handler not set
0x201
Handler Timeout
0x202
Handler Failed

Get Info

Get information about the modem's firmware & state.
Request Id: 0x0000000A
Request field: Empty
Response field:
Field
Size (bytes)
Description
Firmware Version
4
The Blecon Modem firmware version
Uptime
4
Time in milliseconds since the modem was started