def __init__(self, protocol, serverAddr, deviceId, deviceKey, deviceHandler):
self.serverAddr = serverAddr
self.protocol = protocol
self.deviceId = deviceId
self.deviceKey = deviceKey
self.lock = threading.Lock()
if self.protocol == "udp":
self.udpHeartbeatSeconds = 2
self.udpDataPacketInterval = 3
self.heartbeatCounter = 0
self.stateFile = "client.dat"
elif self.protocol == "ssl":
self.caCertFile = "servercert.pem"
self.deviceCertFile = "devicecert.pem"
self.deviceKeyFile = "devicekey.pem"
self.sslIntervalSeconds = 6
self.deviceHandler = deviceHandler
self.deviceHandler.service = self
评论列表
文章目录