Skip to main content
Version: 5.0

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.

info

The commands below are ordered from opening to closing a datagram socket.

Create a Datagram Socket

WhatDetail
CommandAT#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

WhatDetail
CommandAT#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 valueError codeComment
2DTG_CONN_ERRNot joined yet
7DTG_NO_SOCKET_ERRNo socket available or socket not allocated
21DTG_TPL_PARAMS_ERRTemplate parameters are not fully configured

Send Data to a Remote Application

WhatDetail
CommandAT#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 valueError codeComment
1DTG_ERRORInternal error
10DTG_L2_ERRError from L2 layer
11DTG_SEND_ABORT_ERRSession aborted by the sender
12DTG_RECV_ABORT_ERRSession aborted by the receiver

Reception of Data from a Remote Application

WhatDetail
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 valueError codeComment
1DTG_ERRORInternal error
10DTG_L2_ERRError from L2 layer
11DTG_SEND_ABORT_ERRSession aborted by the sender
12DTG_RECV_ABORT_ERRSession aborted by the receiver
14DTG_CD_ERRError in the CD layer
15DTG_RULES_NOT_FOUND_ERRNo CD rules found

Close a Datagram Socket

WhatDetail
CommandAT#CLOSE,<socket_id>
Parameter<socket_id> - The socket ID
Result codes#CLOSE: <status>
 OK
 ERROR

Error Messages

Numeric valueError codeComment
7DTG_NO_SOCKET_ERRNo socket available or socket not allocated

Perform a DTLS Handshake

Only with DTGS API enabled

WhatDetail
CommandAT#HANDSHAKE=<socket_id>,<app_addr>,<app_port>
Parameter<socket_id> - The socket ID
Parameter<app_addr>
Parameter<app_port>
Result codesOK
 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 valueError codeComment
1DTGS_ERRORInternal error
10DTGS_L2_ERRError from L2 layer
11DTGS_SEND_ABORT_ERRSession aborted by the sender
12DTGS_RECV_ABORT_ERRSession aborted by the receiver
25DTGS_HANDSHAKE_ERRDTLS handshake failed