C# Class EXILANT.Labs.CoAP.Channels.TimedQueue

In CoAP, confirmable messages must wait for an ACK or RST. As long as we do not receive ACK or RST we continue to send the confirmable message, provided, we have not exhausted the maximum number of retries. This queue maintains a list of confirmable messages that are waiting for ACK or RST If we do not receive the response within the timeout, this queue raises a timed-out event
ファイルを表示 Open project: silverspringnetworks/developer_program

Protected Properties

Property Type Description
_conMessageQ ArrayList
_isDone bool
_minTimeoutSecs uint
_waitEvent AutoResetEvent

Public Methods

Method Description
AddToWaitQ ( AbstractCoAPMessage coapMsg ) : void

Add message to wait queue

GetInUseMessageIDs ( ) : ArrayList

Each CON/NON message is associated with a message ID. CON messages cannot be discarded unless ACK/RST is received or delivery attempt fails. This method tells us which message IDs are associated with pending CON messages

GetRequestPendingResponse ( UInt16 msgId ) : CoAPRequest

Get the request message that was pending response

RemoveFromWaitQ ( UInt16 msgId ) : void

Remove message from wait queue

Shutdown ( ) : void

Shutdown the polling

TimedQueue ( uint minTimeoutSecs ) : System

We start a thread here that keeps polling the confirmable messages It checks if the message timed-out, and if yes, raises the timeout event

Protected Methods

Method Description
PollQ ( ) : void

The thread procedure that continues to poll the queue for timeout

Method Details

AddToWaitQ() public method

Add message to wait queue
public AddToWaitQ ( AbstractCoAPMessage coapMsg ) : void
coapMsg AbstractCoAPMessage AbstractCoAPMessage
return void

GetInUseMessageIDs() public method

Each CON/NON message is associated with a message ID. CON messages cannot be discarded unless ACK/RST is received or delivery attempt fails. This method tells us which message IDs are associated with pending CON messages
public GetInUseMessageIDs ( ) : ArrayList
return ArrayList

GetRequestPendingResponse() public method

Get the request message that was pending response
public GetRequestPendingResponse ( UInt16 msgId ) : CoAPRequest
msgId UInt16 The message Id corresponding to the message that needs to be extracted
return CoAPRequest

PollQ() protected method

The thread procedure that continues to poll the queue for timeout
protected PollQ ( ) : void
return void

RemoveFromWaitQ() public method

Remove message from wait queue
public RemoveFromWaitQ ( UInt16 msgId ) : void
msgId UInt16 The message Id corresponding to the message that needs to be removed
return void

Shutdown() public method

Shutdown the polling
public Shutdown ( ) : void
return void

TimedQueue() public method

We start a thread here that keeps polling the confirmable messages It checks if the message timed-out, and if yes, raises the timeout event
public TimedQueue ( uint minTimeoutSecs ) : System
minTimeoutSecs uint What is the minimum timeout in seconds
return System

Property Details

_conMessageQ protected_oe property

Holds all the confirmable messages waiting for ACK or RST
protected ArrayList _conMessageQ
return ArrayList

_isDone protected_oe property

For thread lifetime management
protected bool _isDone
return bool

_minTimeoutSecs protected_oe property

The minimum timeout in seconds
protected uint _minTimeoutSecs
return uint

_waitEvent protected_oe property

For thread synchronization
protected AutoResetEvent _waitEvent
return AutoResetEvent