Skip to content

Commit c81e8f3

Browse files
committed
Moved a function around
1 parent 2ace7aa commit c81e8f3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

adafruit_azureiot/iothub_device.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,15 @@ def connect(self) -> None:
292292
):
293293
self._mqtt.subscribe_to_twins()
294294

295+
def loop(self) -> None:
296+
"""Listens for MQTT messages
297+
:raises IoTError: if there is no open connection to the MQTT broker
298+
"""
299+
if self._mqtt is None:
300+
raise IoTError("You are not connected to IoT Central")
301+
302+
self._mqtt.loop()
303+
295304
def disconnect(self) -> None:
296305
"""Disconnects from the MQTT broker
297306
:raises IoTError: if there is no open connection to the MQTT broker
@@ -318,15 +327,6 @@ def is_connected(self) -> bool:
318327

319328
return False
320329

321-
def loop(self) -> None:
322-
"""Listens for MQTT messages
323-
:raises IoTError: if there is no open connection to the MQTT broker
324-
"""
325-
if self._mqtt is None:
326-
raise IoTError("You are not connected to IoT Central")
327-
328-
self._mqtt.loop()
329-
330330
def send_device_to_cloud_message(self, message, system_properties=None) -> None:
331331
"""Send a device to cloud message from this device to Azure IoT Hub
332332
:param message: The message data as a JSON string or a dictionary

0 commit comments

Comments
 (0)