Files
ess-moxa-configuration-tools/Python/isight_device.py
Quentin WEPHRE 856d7ecac3 tagging cube type
2025-04-02 14:49:36 +02:00

33 lines
1.3 KiB
Python

from azure.iot.hub.protocol.models import Module
from typing import Optional
class iSightDevice:
def __init__(self, deviceId: str, site: str, number: int, cloudVersion: str):
if not isinstance(deviceId, str) or not isinstance(site, str) or not isinstance(cloudVersion, str):
raise TypeError("deviceId, site, and cloudVersion must be strings.")
if not isinstance(number, int) or number < 0:
raise ValueError("number must be a non-negative integer.")
self.deviceId = deviceId
self.site = site
self.number = number
self.cloudVersion = cloudVersion
self.thingsproModule: Optional[Module] = None
def setModule(self, module: Module):
if not isinstance(module, Module):
raise TypeError("module must be an instance of azure.iot.hub.protocol.models.module_py3.Module")
self.thingsproModule = module
def __str__(self):
return f"{self.deviceId} {self.site} {self.number} {self.cloudVersion}"
class CubeDevice:
def __init__(self, deviceId: str):
if not isinstance(deviceId, str):
raise TypeError("deviceId must be a str")
self.deviceId = deviceId
def __str__(self):
return f"{self.deviceId}"