Modem Commands
The functions that the Blecon Modem makes available to your firmware
Id | Command | Description | Request | Response |
---|---|---|---|---|
1 | Read connection status | | Event bits:
| |
2 | Check communication with device | | | |
3 | Get device's unique identifier | | Device Identifier (UUID) | |
4 | Get device's URL | | Zero-terminated, ASCII-encoded URL | |
5 | Request connection to the Blecon network | | | |
6 | Close or cancel connection | | | |
7 | Send request to Blecon network | The request to send (byte array) | | |
8 | Retrieve response front the Blecon network | | The response (byte array) | |
9 | Retrieve the error issued for the last request | | An error code | |
10 | Get information about the modem | |
| |
11 | Configure your device's model ID and schema version |
| | |
12 | Identify the device with nearby Blecon hotspots | | |
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).
Code | Description |
---|---|
0 | OK |
1 | Invalid command ID |
2 | Invalid size |
3 | Parsing error |
4 | Invalid state |
Get information about the modem's status.
Request Id: 1
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 |
Check communication with the Blecon modem.
Request Id: 2
Request field: Empty
Response field: Empty
Retrieve the Blecon Device Identifier.
Request Id: 3
Request field: Empty
Response field:
Field | Size (bytes) | Description |
---|---|---|
BDID | 16 | The Blecon Device Identifier (Version 4 UUID) |
Retrieve the Blecon Device URL used for device connection. This is the same URL exposed by the modem via NFC.
Request Id: 4
Request field: Empty
Response field:
Field | Size (bytes) | Description |
---|---|---|
Device URL | 192 | A zero-terminated, ASCII-encoded URL |
Request a connection to the Blecon network. Once the connection is available, a connection event is raised.
Request Id: 5
Request field: Empty
Response field: Empty
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: 6
Request field: Empty
Response field: Empty
Send a request on the Blecon network. This command will only succeed if a connection to the Blecon network is currently available.
Request Id: 7
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 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: 8
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 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: 9
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 |
0x203 | Network not set |
Get information about the modem's firmware & state.
Request Id: 10
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 |
Set the model ID and schema version to use. This allows you to use a translator for your device. The schema version is passed to the translator and lets it adapt its behaviour as the data format used by your device evolves.
Request Id: 11
Request field:
Field | Size (bytes) | Description |
---|---|---|
Model ID | 16 | A model ID as generated in the Blecon console, or API. |
Schema version | 4 | A schema version which should be incremented on each schema change. |
Response field: Empty
Identify the device, so that any Blecon hotspot in range can identify the device in order to connect it to a network, or manage it.
Request Id: 12
Request field: Empty
Response field: Empty
Last modified 5mo ago