MqttMonitor/MqttProtocols.py

Fri, 19 Apr 2024 15:15:01 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 19 Apr 2024 15:15:01 +0200
branch
eric7
changeset 143
51bc5bcc672a
parent 139
b7ca79939cc7
child 154
b66cfd856e93
permissions
-rw-r--r--

Modified the plugin for 'paho-mqtt' >=2.0.0.

# -*- coding: utf-8 -*-

# Copyright (c) 2021 - 2024 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing an enum defining the supported MQTT protocol versions.
"""

import enum

try:
    import paho.mqtt.client as mqtt

    class MqttProtocols(enum.IntEnum):
        """
        Class defining the supported MQTT protocol versions.
        """

        MQTTv31 = mqtt.MQTTv31
        MQTTv311 = mqtt.MQTTv311
        MQTTv5 = mqtt.MQTTv5

except ImportError:
    # define the enum with known values
    class MqttProtocols(enum.IntEnum):
        """
        Class defining the supported MQTT protocol versions.
        """

        MQTTv31 = 3
        MQTTv311 = 4
        MQTTv5 = 5

eric ide

mercurial