The proprietary %COAP Unsolicited Result Code (URC)s report the progress and the result of a CoAP transaction with nRF Cloud.v1.5.x
Connection and session progress
Notification syntax:
%COAP: ERROR,NO_BEARER
%COAP: SYNCING_TIME to <address>
%COAP: TIMESYNC_HDR,<header>
%COAP: TIMESYNC_PARSED,<unix_secs>
%COAP: TIMESYNC_PARSE_FAIL
%COAP: ERROR,TIME_SYNC_FAILED
%COAP: ERROR,CTX_ALLOC
%COAP: RESOLVING coap.nrfcloud.com (<family>)...
%COAP: ERROR,DNS_FAILED
%COAP: IPv4: <address>, PORT: 5684
%COAP: IPv6: <address>, PORT: 5684
%COAP: CONNECTING ...
%COAP: ERROR,SESSION_ALLOC
%COAP: ERROR,DTLS_TIMEOUT
%COAP: DTLS_STATE,<state>
%COAP: ERROR,SESSION_NOT_ESTABLISHED
%COAP: CONNECTED
%COAP: RECONNECTING
The notifications and their meanings are the following:
- ERROR,NO_BEARER
- There is no activated Packet Data Protocol (PDP) context.
- SYNCING_TIME to <address>
- The RTC is not valid. Attempt to fetch current time.
- TIMESYNC_HDR,<header>
- The
Dateheader value is received. - TIMESYNC_PARSED,<unix_secs>
- The
Dateheader is parsed to UNIX epoch seconds. - TIMESYNC_PARSE_FAIL
- The
Dateheader did not match RFC 7231. - ERROR,TIME_SYNC_FAILED
- Time synchronization failed. DTLS cannot proceed.
- ERROR,CTX_ALLOC
- The CoAP context could not be allocated because the modem is out of memory.
- RESOLVING coap.nrfcloud.com (<family>)...
- The DNS lookup of the server has started.
- ERROR,DNS_FAILED
- The DNS lookup of the server failed.
- IPv4: <address>, PORT: 5684
- The server address is resolved on an IPv4 bearer.
- IPv6: <address>, PORT: 5684
- The server address is resolved on an IPv6 bearer.
- CONNECTING ...
- The creation of the DTLS client session has started.
- ERROR,SESSION_ALLOC
- The DTLS client session could not be created.
- ERROR,DTLS_TIMEOUT
- The DTLS handshake did not finish within 15 seconds.
- DTLS_STATE,<state>
- The handshake loop has exited.
- ERROR,SESSION_NOT_ESTABLISHED
- The final session state is not established.
- CONNECTED
- DTLS is established, and the JSON Web Token (JWT) authentication is accepted.
- RECONNECTING
- Sending failed, and the session was torn down. One reconnection is attempted automatically.
The notification parameters and their defined values are the following:
- <address>
- String. Maximum length 45 characters. IPv4 or IPv6 address of the server.
- <header>
- String. Value of the HTTP
Dateheader as received. - <unix_secs>
- Integer. Time in UNIX epoch seconds.
- <family>
- String. Address family used for the lookup,
IPv4orIPv6. - <state>
- Integer. Session state reported by the CoAP library when the handshake loop exited.
JWT authentication
Notification syntax:
%COAP: SENDING_AUTH
%COAP: AUTH_ERROR,NO_MEMORY
%COAP: AUTH_ERROR,JWT_FAILED
%COAP: AUTH_ERROR,PDU_ALLOC
%COAP: AUTH_ERROR,SEND_FAILED
%COAP: AUTH_ERROR,TIMEOUT
%COAP: AUTH_ERROR,BAD_RESPONSE_<class>.<detail>
The notifications and their meanings are the following:
- SENDING_AUTH
- A JWT is generated, and the authentication request is being sent.
- AUTH_ERROR,NO_MEMORY
- The 1 kB JWT buffer could not be allocated.
- AUTH_ERROR,JWT_FAILED
- JWT generation failed. The device key or the device certificate is missing.
- AUTH_ERROR,PDU_ALLOC
- The CoAP PDU could not be allocated.
- AUTH_ERROR,SEND_FAILED
- Sending the authentication request failed.
- AUTH_ERROR,TIMEOUT
- No authentication response was received within 10 seconds.
- AUTH_ERROR,BAD_RESPONSE_<class>.<detail>
- The response to the authentication request was not
2.01 Created.
Requests and responses
Notification syntax:
%COAP: SEND_ERROR,NOT_CONNECTED
%COAP: SEND_ERROR,PDU_ALLOC
%COAP: SEND_ERROR,SEND_FAILED
%COAP: SEND_ERROR,TIMEOUT
%COAP: RESPONSE,<class>.<detail>
%COAP: DATA,<len>,<payload>
%COAP: DATA,HEX,<hex_payload>
%COAP: NACK,<reason>
%COAP: EVENT,0x<event>,<name>
The notifications and their meanings are the following:
- SEND_ERROR,NOT_CONNECTED
- There was no established session when the request was sent.
- SEND_ERROR,PDU_ALLOC
- The CoAP Protocol Data Unit (PDU) could not be allocated.
- SEND_ERROR,SEND_FAILED
- Sending the request failed. The session is torn down.
- SEND_ERROR,TIMEOUT
- No response was received within the timeout of the command. The session is torn down.
- RESPONSE,<class>.<detail>
- The CoAP response code received from the server.
- DATA,<len>,<payload>
- A text payload is received.
- DATA,HEX,<hex_payload>
- A binary payload is received.
- NACK,<reason>
- The transmission failed.
- EVENT,0x<event>,<name>
- A session event is reported by the CoAP library.
The notification parameters and their defined values are the following:
- <class>
- Integer. Class of the CoAP response code. See CoAP response codes.
- <detail>
- Integer. Detail of the CoAP response code written with two digits. See CoAP response codes.
- <len>
- Integer. Full length of the received payload in bytes.
- <payload>
- String. Received payload as text. The payload is reported as text when the content
format is
text/plain,application/link-format, or JSON, or when the content format is absent and all bytes are printable. - <hex_payload>
- String. Received payload in lowercase hexadecimal format.
- <reason>
- Integer, 0–6. Reason the confirmable message could not be delivered.
- <event>
- String. Session event code of the CoAP library in hexadecimal format.
- <name>
- String. Name of the session event.