def _hello(self):
self._logger.debug('hello')
if self._serial and self._challenge:
self._hello_sent = True
self._status_now = True
self._logger.debug('emit hello')
self._printer_type = self._settings.get(["printer_type"])
camUrl = self._settings.global_get(["webcam", "stream"])
try:
if camUrl:
camUrl = normalize_url(camUrl)
except:
self._logger.exception("Unable to canonicalize the url {}".format(camUrl))
self._logger.debug("camUrl: {}".format(camUrl))
transformImg = 0
if self._settings.global_get(["webcam", "flipH"]):
transformImg += 1
if self._settings.global_get(["webcam", "flipV"]):
transformImg += 2
if self._settings.global_get(["webcam", "rotate90"]):
transformImg += 4
self._socket.emit('hello', {
'serialNumber': self._serial,
'signature': base64.b64encode(crypto.sign(self._key, self._challenge, b'sha256')),
'MAC': get_mac(),
'localIP': get_ip(),
'protocol': '2',
'camUrl': camUrl,
'transformImg': transformImg,
'printerType': self._printer_type
})
self._challenge = None
else:
self._logger.debug('skip emit hello, serial: {}'.format(self._serial))
#~~ capabilities -> polar: capabilitiesResponse
评论列表
文章目录