- Added new class
- This allows one to build up a new CoAP request of some form in a method-call-by-method-call manner.
- In order to instantiate one of these please do so via the `CoapClient`.
- Added new class
- This represents a request that has been made. This is normally stored inside the `CoapClient` and used to find matching responses that come through in the messaging layer.
- It is composed of the `token` and the future which was created. Therefore when the messaging layer receives a new CoAP packet it can then try match it to one of these requests, in the event it finds a match it can retrieve the future, place the received `CoapPacket` into it and then wake up anyone doing a blocking `get()` on it.
- Added `getType()`
- Added `getTokenLength()`
- Added `getVersion()`
- Added `fromBytes(ubyte[])` which decodes the provided bytes and produces a `CoapPacket` at the end
Packet (unit tests)
- Added initial decode tests
- Added note to set the options (when supported)
- Set the payload
- Added note to check for encoded options (and offset everything beneath it respectively)
- Check for payload marker
- Check payload
- Now encodes the message ID in a platform independent manner. We will encode it into big endian seeing as it feels like it could be used in a number like fashion
- Added `setMessageId(ushort)` to set the message id
- Added `setTokenLength(ulong)` which returns `false` if the token length is above 15, else sets the token length (<=15) and returns `true`
- Added `setToken(ubyte[])` which sets the token (and length) and checks that the length is fine
Exceptions
- Added new exception time `CoapException`
- Added `setType(MessageType)` which sets the messagr type
- The `type` field is no longer a `ubyte` but rather a `MessageType`
Packet (unit tests)
- Test the encoding of the type field
Types
- Added new module
- Added `MessageType` enum
- Defined `CoapPacket` to represent a CoAP packet
- Added the required fields
- Constructor sets the version to `1` (the only version available)
- `getBytes()` no encodes the first byte of the CoAP header (versio, type and token length)