23 lines
1.0 KiB
Python
23 lines
1.0 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}" |