--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MqttMonitor/MqttProtocols.py Fri Jul 23 19:48:14 2021 +0200 @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +# Copyright (c) 2021 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