CoapPacket

Represents a CoAP packet

Constructors

this
this()

Constructs a new CoapPacket with protocol version 1

Members

Functions

getBytes
ubyte[] getBytes()

Encodes the current CoapPacket into the byte sequence

getCode
Code getCode()

Returns the code

getMessageId
ushort getMessageId()

Returns the message id

getToken
ubyte[] getToken()

Returns the token

getTokenLength
ubyte getTokenLength()

Returns the length of the currently set token

getType
MessageType getType()

Returns the type of message

getVersion
ubyte getVersion()

Returns the protocol version

setCode
void setCode(Code code)

Sets the code

setMessageId
void setMessageId(ushort mid)

Sets the message ID

setOptions
void setOptions()
Undocumented in source. Be warned that the author may not have intended to support it.
setPayload
void setPayload(ubyte[] payload)

Sets the payload for this message

setToken
void setToken(ubyte[] token)

Sets the token

setType
void setType(MessageType type)

Sets the message type

toString
string toString()

Returns a string represenation of this packet

Static functions

fromBytes
CoapPacket fromBytes(ubyte[] data)

Decodes the given bytes into a CoapPacket

Meta