class documentation

class CoAPServer:

View In Hierarchy

CoAPServer Server implementation.

Method configure Configure the CoAP server.
Method initCoAPServer Initialization of the CoAP Server.
Method pause Stop handling requests.
Method run Initialize and run the CoAP server as a BackgroundWorker/Actor.
Method sendCoAPRequest Send a CoAP request to a URL.
Method shutdown Shutdown the CoAP server.
Method unpause Continue handling requests.
Method validate Validate the CoAP server configuration.
Class Variable __slots__ Define slots for instance variables.
Instance Variable actor The actor for running the synchronous CoAP server in the background.
Instance Variable coapServer The CoAP server object.
Instance Variable isPaused Flag whether the server is currently paused. Requests are not handled when the server is paused.
Instance Variable operationEvents Events for the different operations.
Method _configUpdate Callback for the configUpdate event.
Method _run CoAP server main loop.
Method _stop Stop the CoAP server.
def configure(self, config: Configuration):

Configure the CoAP server.

Parameters
config:ConfigurationThe configuration object to read the configuration from.
def initCoAPServer(self):

Initialization of the CoAP Server.

def pause(self):

Stop handling requests.

def run(self):

Initialize and run the CoAP server as a BackgroundWorker/Actor.

Returns
True if the server has been started successfully.
def sendCoAPRequest(self, request: CSERequest, url: str, isDirectURL: bool = False) -> Result:

Send a CoAP request to a URL.

Parameters
request:CSERequestThe request to send.
url:strThe URL to send the request to.
isDirectURL:boolFlag whether the URL is a direct URL.
Returns
ResultThe result of the request.
def shutdown(self) -> bool:

Shutdown the CoAP server.

Returns
boolTrue if the server has been shut down successfully.
def unpause(self):

Continue handling requests.

def validate(self, config: Configuration):

Validate the CoAP server configuration.

Parameters
config:ConfigurationThe configuration object to validate.
__slots__: list[str] =

Define slots for instance variables.

actor: BackgroundWorker | None =

The actor for running the synchronous CoAP server in the background.

coapServer: ACMECoAPServer | None =

The CoAP server object.

isPaused: bool =

Flag whether the server is currently paused. Requests are not handled when the server is paused.

operationEvents =

Events for the different operations.

@onEvent(eventManager.configUpdate)
def _configUpdate(self, eventData: EventData):

Callback for the configUpdate event.

Parameters
eventData:EventDataThe event data, containing the key and value of the updated configuration.
def _run(self):

CoAP server main loop.

def _stop(self):

Stop the CoAP server.