CoapRequest

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.

Constructors

this
this(CoapPacket requestPacket, CoapRequestFuture future)

Constructs a new request

Members

Functions

getElapsedTime
Duration getElapsedTime()

Returns the elapsed time of this request thus far

getMid
ushort getMid()

Gets the message ID from the original request that was made

getRequestPacket
CoapPacket getRequestPacket()

Gets the original request made

getToken
ubyte[] getToken()

Gets the token from the original request that was made

hasTimedOut
bool hasTimedOut(Duration timeoutThreshold)

Checks if this request has expired according to the given timeout threshold

startTime
void startTime()

Starts the timer

Variables

future
CoapRequestFuture future;

The future which we can fill up with the response and then wake up the receiver

Meta