Angaza Nexus Channel Core

Logo

Interoperability for off-grid devices

View the Project on GitHub angaza/nexus-channel-models

Nexus Channel Core - CoAP Specification

Version: 0.9.1

Purpose and Background

Nexus Channel Core is based on the OCF Specification, which subsequently relies on the CoAP Standard when sending messages between devices.

Nexus Channel Core highlights a subset of functionality from the above specifications applicable to constrained devices, while still producing IETF standards-compliant CoAP messages.

A Nexus Channel Core device may implement more of the CoAP standard than listed in this specification (for example, confirmable messages). However, when communicating to other Nexus Channel Core devices, only the subset of functionality outlined in this document is guaranteed to be available.

Some helpful terminology from the CoAP specification:

In Nexus Channel Core, devices often are both clients and servers. For example, an SHS might ‘serve’ a battery resource to expose its own battery state, but it might also act as a client towards other devices acting as servers (for example, to adjust their demand-response load shedding parameters).

‘Server’ and ‘client’ are in no way related to device functionality, capability, or power flow direction.

CoAP Header - Base

The following parameters must be present in the CoAP header:

The use of non-confirmable messages implies that devices using Nexus Channel Core do not need to expect or handle “CON” or “ACK” CoAP message types.

In other words, most device exchanges in Nexus Channel Core look similar to the following (example of a request to get battery charge percentage):

Client              Server
   |                  |
   |   NON [0x7a11]   |
   |   GET /batt      |
   |   (Token 0x74)   |
   +----------------->|
   |                  |
   |   NON [0x23bc]   |
   |   2.05 Content   |
   |   (Token 0x74)   |
   |    {'cp': 58}    |
   |<-----------------+
   |                  |

(Modified from RFC 7252 Figure 6)

Devices do, however, need to handle retries at the application layer, as there is no required underlying retry logic specified by Nexus Channel Core (Nexus Channel Core does not require constrained devices to implement the CoAP CON message retry behavior).

CoAP Header - Token

A 1-byte token must be present, and the value should be unique for any currently pending message exchange between any two devices. That is, device A and device B must not have two message exchanges (e.g. exchange 1 to endpoint ‘/x/y’ and exchange 2 to endpoint ‘/c/d’) active at the same time with the same token value.

CoAP Header - Options

The following option type must be present in all requests:

The following option type should be present in all responses:

The following option type may be present in requests:

CoAP Message Types

Must support nonconfirmable (“NON”) message requests and replies. No other types are required (no CON, ACK, or RST).

Message ID and Token Use

Implementations should use the message ID to deduplicate messages in the presence of retries (two messages with the same message ID from a single source do not both need to be processed). However, in implementations where only a single request/response message exchange is active at any given time, message ID may be ignored.

Implementations should use the token value to match a specific request with a response (particularly in implementations where a client might make multiple distinct requests to the same endpoint). However, in implementations where only a single request/response message exchange is active at any given time, the token value may be ignored.

Message Size

The CoAP header plus any encapsulated payload should be <= 120 bytes in length, to allow drop-in compatibility with link layers that expect the transmitted packet to fit within 128 bytes after adding header and footer data).

No IP networking or internet access is assumed or implied for any devices. Instead, Nexus Channel Core CoAP messages are exchanged over lower-level links including but not limited to:

The COAP header and CBOR payload contain no address information, however, every Nexus Channel Core device has a “Nexus ID”. This Nexus ID is a 6-byte identifier which is globally unique and that supports multicast and limited-scope (such as link-local) address assignment. Read more here.

Reference Implementation

The nexus-embedded implementation meets the above specifications, and assumes a compliant underlying link layer is present.

Appendix: Example Compliant CoAP Headers

  1. GET to /batt resource URI:

10 bytes, as below:

51 01 00 04 8a b4 62 61 74 74

  1. GET to /batt/main resource URI (demonstrating longer URI paths):

15 bytes, as below:

51 01 00 01 c1 b4 62 61 74 74 04 6d 61 69 6e