SCHC Datagram Interface
The content of Acklio FullSDK can be described in its simplistic view as an adaptation layer with the SCHC mechanisms, and a set of interfaces: the Management API, the Datagram API, the Network API and the L2A interface.
Refer to the diagram of layers and interfaces for a better understanding.
The demo examples running on the nRF 9160 board use the following AT commands in their communication sequences.
The commands below are ordered from opening to closing a datagram socket.
Create a Datagram Socket
What | Detail |
---|---|
Command | AT#SOCKET[=<psk_id>,<psk>] |
Parameter | <psk_id> - ASCII HEX, Only used when DTGS layer is enabled |
Parameter | <psk> - ASCII HEX, Only used when DTGS layer is enabled |
Result codes | #SOCKET: <socket_id> |
OK | |
ERROR |
The socket ID is a numeric value.
Bind the IP Address and the Port of the Host to a Datagram Socket
What | Detail |
---|---|
Command | AT#BIND=<socket_id>,<dev_addr>,<dev_port> |
Parameters | <socket_id> - The socket ID |
<dev_addr> | |
<dev_port> | |
Result codes | #BIND: <status> |
OK | |
ERROR |
Error Messages
Numeric value | Error code | Comment |
---|---|---|
2 | DTG_CONN_ERR | Not joined yet |
7 | DTG_NO_SOCKET_ERR | No socket available or socket not allocated |
21 | DTG_TPL_PARAMS_ERR | Template parameters are not fully configured |
Send Data to a Remote Application
What | Detail |
---|---|
Command | AT#SEND=<socket_id>,<app_addr>,<app_port>,<data> |
Parameters | <socket_id> - The socket ID |
<app_addr> | |
<app_port> | |
<data> - The data to be sent in ASCII HEX format | |
Result codes | #SEND: <socket_id>,<status>,<error> |
OK | |
ERROR |
Transmissions
The OK
result code or an error is returned immediately. If OK
was returned, a transmission is attempted.
#SEND
, the associated socket ID, a status and an error are returned at the end of the transmission.
The status that can be returned after a transmission failure are:
Numeric value | Error code | Comment |
---|---|---|
1 | DTG_ERROR | Internal error |
10 | DTG_L2_ERR | Error from L2 layer |
11 | DTG_SEND_ABORT_ERR | Session aborted by the sender |
12 | DTG_RECV_ABORT_ERR | Session aborted by the receiver |
Reception of Data from a Remote Application
What | Detail |
---|---|
Command | — |
Parameters | — |
Result codes | #RECVOK,<socket_id>,<binary_data> |
#RECVFAIL,<socket_id>,<status> |
Received data is an HEX ASCII string.
The status that can be returned after a reception failure are:
Numeric value | Error code | Comment |
---|---|---|
1 | DTG_ERROR | Internal error |
10 | DTG_L2_ERR | Error from L2 layer |
11 | DTG_SEND_ABORT_ERR | Session aborted by the sender |
12 | DTG_RECV_ABORT_ERR | Session aborted by the receiver |
14 | DTG_CD_ERR | Error in the CD layer |
15 | DTG_RULES_NOT_FOUND_ERR | No CD rules found |
Close a Datagram Socket
What | Detail |
---|---|
Command | AT#CLOSE,<socket_id> |
Parameter | <socket_id> - The socket ID |
Result codes | #CLOSE: <status> |
OK | |
ERROR |
Error Messages
Numeric value | Error code | Comment |
---|---|---|
7 | DTG_NO_SOCKET_ERR | No socket available or socket not allocated |
Perform a DTLS Handshake
Only with DTGS API enabled
What | Detail |
---|---|
Command | AT#HANDSHAKE=<socket_id>,<app_addr>,<app_port> |
Parameter | <socket_id> - The socket ID |
Parameter | <app_addr> |
Parameter | <app_port> |
Result codes | OK |
ERROR |
Transmissions
The OK
result code or an error is returned immediately. If OK
was returned, a transmission is attempted.
#HANDSHAKE
, the associated socket ID, a status and an error are returned at the end of the transmission.
The status that can be returned after a transmission failure are:
Numeric value | Error code | Comment |
---|---|---|
1 | DTGS_ERROR | Internal error |
10 | DTGS_L2_ERR | Error from L2 layer |
11 | DTGS_SEND_ABORT_ERR | Session aborted by the sender |
12 | DTGS_RECV_ABORT_ERR | Session aborted by the receiver |
25 | DTGS_HANDSHAKE_ERR | DTLS handshake failed |