MqttMonitor/MqttProtocols.py

Mon, 24 Oct 2022 18:01:45 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 24 Oct 2022 18:01:45 +0200
branch
eric7
changeset 127
8982ef7b7d67
parent 123
3d7e63ed4fd1
child 131
899c7cb866a2
permissions
-rw-r--r--

Adapted the import statements to the new structure.

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

# Copyright (c) 2021 - 2022 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