CoapClient

- Implemented `newMid()`  to provide a unique new mid
This commit is contained in:
Tristan B. Velloza Kildaire 2023-09-25 19:43:23 +02:00
parent 4c788b91c3
commit d6eefb3a9b

View File

@ -74,6 +74,22 @@ public class CoapClient
init();
}
package ulong newMid()
{
ulong newValue;
// Lock rolling counter
this.rollingLock.lock();
newValue = this.rollingMid;
this.rollingMid++;
// Unlock rolling counter
this.rollingLock.unlock();
return newValue;
}
/**
* Constructs a new CoAP client to the
* provided endpoint address and port.