class documentation

class MQTTClientHandler(MQTTHandler):

Constructor: MQTTClientHandler(mqttClient)

View In Hierarchy

Handler registering oneM2M topics and handling resceived requests.

Method __init__ Initialize the MQTTClientHandler.
Method logging Forwarding log events to the CSE's log system.
Method onConnect When connected to a broker then register the topics the CSE listens to.
Method onDisconnect Callback when disconnecting from a broker.
Method onError Callback for error handlings.
Method onSubscribed Callback when successfully subscribed to a topic.
Method onUnsubscribed Callback when successfully unsubscribed from a topic.
Class Variable __slots__ Slots for the MQTTClientHandler.
Class Variable cseShutdown Injected function to shut down the CSE.
Class Variable requestManager Injected RequestManager instance.
Class Variable securityManager Injected SecurityManager instance.
Instance Variable mqttClient The MQTTClient instance using this handler.
Instance Variable operationEvents Operation events.
Instance Variable topicPrefixCount Number of elements in the prefix.
Method _handleIncommingRequest Handling incoming requests is rather generic, since the special handling of some requests, like registration is done later anyway.
Method _registrationRequestCB handle an MQTT registration request.
Method _requestCB Handle a normal MQTT request.
Method _responseCB Receive and handle a 'resp' message.

Inherited from MQTTHandler:

Method onShutdown This method is called after the `connection` was shut down.
def __init__(self, mqttClient: MQTTClient):

Initialize the MQTTClientHandler.

Parameters
mqttClient:MQTTClientThe MQTTClient instance using this handler.
def logging(self, connection: MQTTConnection | None, level: int, message: str) -> bool:

Forwarding log events to the CSE's log system.

def onConnect(self, connection: MQTTConnection) -> bool:

When connected to a broker then register the topics the CSE listens to.

def onDisconnect(self, connection: MQTTConnection) -> bool:

Callback when disconnecting from a broker.

def onError(self, _: MQTTConnection, rc: int | None = -1) -> bool:

Callback for error handlings.

def onSubscribed(self, connection: MQTTConnection, topic: str) -> bool:

Callback when successfully subscribed to a topic.

def onUnsubscribed(self, connection: MQTTConnection, topic: str) -> bool:

Callback when successfully unsubscribed from a topic.

__slots__: tuple[str, ...] =

Slots for the MQTTClientHandler.

cseShutdown: Callable[[], None] =

Injected function to shut down the CSE.

requestManager: RequestManager =

Injected RequestManager instance.

securityManager: SecurityManager =

Injected SecurityManager instance.

mqttClient =

The MQTTClient instance using this handler.

operationEvents: dict[Operation, tuple[Event, str]] =

Operation events.

topicPrefixCount =

Number of elements in the prefix.

def _handleIncommingRequest(self, connection: MQTTConnection, topic: str, data: bytes, responseTopicType: str, isRegistration: bool | None = False):

Handling incoming requests is rather generic, since the special handling of some requests, like registration is done later anyway.

def _registrationRequestCB(self, connection: MQTTConnection, topic: str, data: bytes):

handle an MQTT registration request.

def _requestCB(self, connection: MQTTConnection, topic: str, data: bytes):

Handle a normal MQTT request.

def _responseCB(self, connection: MQTTConnection, topic: str, data: bytes):

Receive and handle a 'resp' message.