# cython:language_level=3
import configparser
import http
if 82 - 82: Iii1i
import sys
import threading
import time
import binascii
import json
import logging
import time
if 87 - 87: Ii % i1i1i1111I . Oo / OooOoo * I1Ii1I1 - I1I
if 81 - 81: i1 + ooOOO / oOo0O00 * i1iiIII111 * IiIIii11Ii
if 84 - 84: ooo000 - Ooo0Ooo + iI1iII1I1I1i . IIiIIiIi11I1
if 98 - 98: I11iiIi11i1I % oOO
from collections import deque
from http . client import HTTPConnection
from queue import Queue
if 31 - 31: i1I
if 9 - 9: IiI11Ii111 / oOo0O00 / IiIIii11Ii - I11iiIi11i1I - iI1iII1I1I1i
if 16 - 16: i1i1i1111I / i1iiIII111
from twisted . internet . protocol import DatagramProtocol
if 3 - 3: i1 % i1 % i1i1i1111I . Ii * i1
from twisted . internet import defer
if 9 - 9: i1iiIII111
from . wgpacket import tdz
if 10 - 10: ooOOO / IIiIIiIi11I1 * oOO / i1I / i1I
from . wgpacket import WGControllerinfo , WGCommand , wgGlobal , WGPacket
if 61 - 61: Ooo0Ooo - I1I
if 13 - 13: Ooo0Ooo
import os
if 46 - 46: iI1iII1I1I1i - Ii * Oo * Ii
if 52 - 52: Oo + I1I / oOO / OooOoo - I1Ii1I1 - ooOOO
class wgcontrollerDoorStatus ( object ) :
 sn = 0
 ds1 = 0
 ds2 = 0
 ds3 = 0
 ds4 = 0
 refreshTimeFrom1970 = time . time ( )
 appError = 0
 warndoor = ( 0 , 0 , 0 , 0 )
 forceClosedWarn = 0
 fireWarn = 0
 externboardValue = 0
 externboardExisted = 0
 refreshTimeFrom1970MQTT = time . time ( )
 floor01_20input = 0
 floor21_40input = 0
 if 60 - 60: iI1iII1I1I1i . oOO
 if 13 - 13: oOO
class wgConRPCLongTime ( DatagramProtocol ) :
 runStatus = - 1
 _Global_xid = 0
 _xid = 0
 recv = None
 debugSendCnt = 0
 debugRecvCnt = 0
 if 2 - 2: i1
 if 22 - 22: IIiIIiIi11I1 - ooo000 / I1Ii1I1 . ooo000
 if 1 - 1: iI1iII1I1I1i + Ooo0Ooo + oOO * IIiIIiIi11I1
 if 20 - 20: I1I + Ii
 if 75 - 75: Ii % i1iiIII111 * Ii . IIiIIiIi11I1 % I11iiIi11i1I % I1Ii1I1
 if 8 - 8: I1Ii1I1 . IiI11Ii111 . i1 . Oo - i1I
 if 32 - 32: Ii % i1i1i1111I % i1I - I11iiIi11i1I % i1iiIII111
 if 34 - 34: i1iiIII111 * i1
 if 34 - 34: oOo0O00 / i1iiIII111 - Iii1i . iI1iII1I1I1i
 if 80 - 80: i1i1i1111I . I1I % ooOOO % IiIIii11Ii / i1i1i1111I
 def __init__ ( self ) :
  self . command = None
  self . port = 0
  self . ip = None
  self . runticks = time . time ( )
  if 32 - 32: I1Ii1I1 + oOO - oOo0O00
 def getNewXid ( self ) :
  wgConRPCLongTime . _Global_xid = wgConRPCLongTime . _Global_xid + 1
  if ( ( wgConRPCLongTime . _Global_xid >= 0x4fffffff ) or ( wgConRPCLongTime . _Global_xid < 0x40000001 ) ) :
   wgConRPCLongTime . _Global_xid = 0x40000001
  self . _xid = wgConRPCLongTime . _Global_xid
  return self . _xid
  if 79 - 79: Iii1i % oOO * Oo + ooOOO / Oo . oOO
 def startProtocol ( self ) :
  pass
  if 20 - 20: IiI11Ii111 + i1iiIII111 / I1I
 def run ( self , ip , port , command ) :
  self . runStatus = - 1
  self . ip = ip
  self . port = port
  self . command = command
  self . tryagain ( )
  if 88 - 88: I11iiIi11i1I + ooOOO - i1i1i1111I . Ooo0Ooo * Ii + Iii1i
 def tryagain ( self ) :
  self . transport . write ( self . command , ( self . ip , self . port ) )
  if wgGlobal . debugWEBAPI :
   wgConRPCLongTime . debugSendCnt = wgConRPCLongTime . debugSendCnt + 1
   mMonitorInfo . printCHS ( "wgConRPC Send: {} Send {}#  {}" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) ,
 wgConRPCLongTime . debugSendCnt ,
 binascii . hexlify ( self . command ) ) )
   mMonitorInfo . wglog (
 "wgConRPC Send: {} Send {}#  {}" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) ,
 wgConRPCLongTime . debugSendCnt ,
 binascii . hexlify ( self . command ) ) )
   if 43 - 43: ooOOO * I1Ii1I1
   if 95 - 95: Ooo0Ooo % Iii1i % i1i1i1111I . OooOoo
 cmdWithResponseLocbyte8 = [ 0x40 ,
 0x50 ,
 0x52 ,
 0x54 ,
 0x56 ,
 0xB2 ,
 0x8a , 0x88 ,
 0xcc ,
 0x8e ,
 0
 ]
 if 70 - 70: IiIIii11Ii
 def datagramReceived ( self , data , addr ) :
  self . runticks = time . time ( )
  if 75 - 75: Ooo0Ooo / Ii / IiIIii11Ii + IiIIii11Ii . I1I
  if wgGlobal . debugWEBAPI :
   wgConRPCLongTime . debugRecvCnt = wgConRPCLongTime . debugRecvCnt + 1
   mMonitorInfo . printCHS (
 "wgConRPC datagramReceived: {} receive {}#  {}" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) ,
 wgConRPCLongTime . debugRecvCnt , binascii . hexlify (
 data ) ) )
   mMonitorInfo . wglog ( "wgConRPC datagramReceived: {} receive {}#  {}" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) ,
 wgConRPCLongTime . debugRecvCnt ,
 binascii . hexlify (
 data ) ) )
  if len ( data ) % 64 == 0 :
   i1I11ii = WGPacket ( data , addr )
   if i1I11ii . controllerSN == 0 :
    if 21 - 21: Iii1i - I1Ii1I1
    self . runStatus = 2
   elif i1I11ii . sid == self . _xid :
    if 95 - 95: i1 - I1Ii1I1 + Oo
    self . recv = data
    self . runStatus = 0
    if i1I11ii . cmdtype == 0 :
     if 49 - 49: IIiIIiIi11I1
     pass
    elif i1I11ii . functionID in self . cmdWithResponseLocbyte8 :
     if data [ 8 ] == 1 :
      if 29 - 29: IiIIii11Ii - oOo0O00
      self . runStatus = 0
     else :
      if 30 - 30: I1I . ooo000
      self . runStatus = 1
   del i1I11ii
   if 43 - 43: ooOOO . I11iiIi11i1I + ooo000
   if 87 - 87: Iii1i + ooOOO . i1I / Ii + Oo
def DealUDPQueue4AHTTP ( ) :
 while True :
  if mMonitorInfo . UDPQueue4AHTTP . __len__ ( ) > 0 :
   i1I11ii = mMonitorInfo . UDPQueue4AHTTP . popleft ( )
   if mMonitorInfo . sendByHttp ( i1I11ii ) is None :
    mMonitorInfo . UDPQueue4AHTTP . clear ( )
    time . sleep ( 3 )
  else :
   time . sleep ( 0.001 )
   try :
    OOO00oO0oOo0O = mMonitorInfo . taskqueueUDPQueue4AHTTP . get (
 block = True )
    mMonitorInfo . taskqueueUDPQueue4AHTTP . task_done ( )
   except Exception as iIi1I1I :
    pass
    if 85 - 85: oOo0O00
    if 65 - 65: Ooo0Ooo * ooo000 + oOo0O00
def DealUDPQueue4BHTTP ( ) :
 while True :
  if mMonitorInfo . UDPQueue4BHTTP . __len__ ( ) > 0 :
   i1I11ii = mMonitorInfo . UDPQueue4BHTTP . popleft ( )
   if mMonitorInfo . sendByHttps ( i1I11ii ) is None :
    mMonitorInfo . UDPQueue4BHTTP . clear ( )
    time . sleep ( 3 )
  else :
   time . sleep ( 0.001 )
   try :
    OOO00oO0oOo0O = mMonitorInfo . taskqueueUDPQueue4BHTTP . get (
 block = True )
    mMonitorInfo . taskqueueUDPQueue4BHTTP . task_done ( )
   except Exception as iIi1I1I :
    pass
    if 71 - 71: Ooo0Ooo / ooo000
    if 87 - 87: IiI11Ii111 / oOo0O00 % oOO - oOo0O00 . I1I + Ooo0Ooo
class mMonitorInfo ( object ) :
 watchingController = dict ( )
 refreshTimeFrom1970 = time . time ( )
 if 75 - 75: i1iiIII111 * iI1iII1I1I1i - I1I - IIiIIiIi11I1 % I1Ii1I1
 ws = None
 mqttclient = None
 bSendByMQTT = False
 wgConRPC4MQTT = None
 mqttclientStatus = 0
 if 85 - 85: oOo0O00
 wgroot_logger = None
 wgchs_logger = None
 if 66 - 66: IiI11Ii111 * i1i1i1111I + oOo0O00 / I1I / Iii1i / Ii
 wgConRPCCommonWebapi = None
 websocketHeartCycle = 30
 backupLogfile = 0
 memAllocMaxMB = 300
 OnlyVirtualCardOpenDoor = 0
 if 32 - 32: i1i1i1111I % Ooo0Ooo - i1I * I1I
 bSearchController = 0
 allchangePortTime = 0
 arrwgControllerCenter2023 = [ ]
 arrwgControllerCenter2023Port = [ ]
 if 92 - 92: IIiIIiIi11I1 - i1 - Iii1i / Ooo0Ooo . I1Ii1I1 / I11iiIi11i1I
 if 60 - 60: oOO
 mqtt_timesMaxInOneSecond = 100
 mqtt_englishTopic = 0
 mqtt_cycle_seconds = 30
 allowErrWrite4mqtt_on_disconnect = 0
 if 32 - 32: iI1iII1I1I1i
 if 18 - 18: I11iiIi11i1I * IiI11Ii111 % iI1iII1I1I1i + IiI11Ii111
 wsudp = None
 bSendBywsudp = 0
 if 93 - 93: oOO - I1Ii1I1 - IIiIIiIi11I1 * ooOOO - i1
 if 82 - 82: IIiIIiIi11I1 % i1 * ooOOO
 if 57 - 57: oOo0O00
 if 31 - 31: i1iiIII111 + i1i1i1111I % OooOoo
 if 20 - 20: OooOoo - I1I
 if 9 - 9: i1iiIII111 - iI1iII1I1I1i % Ii - I1I
 taskqueueUDPQueue4AHTTP = Queue ( )
 taskqueueUDPQueue4BHTTP = Queue ( )
 if 54 - 54: Iii1i % ooo000 % Iii1i - IiIIii11Ii
 if 39 - 39: oOO - oOO * i1 % IIiIIiIi11I1
 wgFrmADCT3000 = None
 def mqttclientpublish ( topic , payload = None , qos = 0 , retain = False , properties = None ) :
  if 29 - 29: IIiIIiIi11I1 - ooo000 . i1iiIII111
  if 86 - 86: I1Ii1I1 - OooOoo - oOO % ooo000 . i1I % Iii1i
  if 11 - 11: OooOoo - I1Ii1I1 - ooOOO . i1iiIII111 - iI1iII1I1I1i / i1iiIII111
  if 44 - 44: Ooo0Ooo + i1i1i1111I + Iii1i - oOO
  if 7 - 7: i1i1i1111I / Ii * Iii1i
  if 32 - 32: IiI11Ii111 . OooOoo
  if 31 - 31: Oo - i1I
  if 28 - 28: ooOOO * I1Ii1I1 + IiI11Ii111 % Oo
  try :
   mMonitorInfo . mqttclient . publish ( topic , payload , qos )
   if 100 - 100: Oo + i1I
   if 4 - 4: ooo000 % I1I - i1i1i1111I
   if 76 - 76: i1 * oOo0O00 . IiI11Ii111 * i1I . IiIIii11Ii . oOO
   if 55 - 55: i1i1i1111I + i1iiIII111 % Ooo0Ooo . Oo - IiIIii11Ii - iI1iII1I1I1i
   if 91 - 91: I1Ii1I1 - I11iiIi11i1I
   if 84 - 84: oOO % iI1iII1I1I1i - Ooo0Ooo
  except Exception as iIi1I1I :
   print ( iIi1I1I )
   mMonitorInfo . wglog ( "mqttclientpublish--Error-1:" )
   mMonitorInfo . wglog ( iIi1I1I )
   mMonitorInfo . wglog ( topic )
   mMonitorInfo . wglog ( payload )
   if 94 - 94: i1iiIII111 + i1i1i1111I / iI1iII1I1I1i + iI1iII1I1I1i / i1I
   if 79 - 79: i1iiIII111 - IIiIIiIi11I1 . I1Ii1I1 + I1I - ooOOO + i1iiIII111
   if 36 - 36: ooOOO * Iii1i % I1I % i1 . Ooo0Ooo
 def detailOfDS ( ds ) :
  oO00OOooOoO0o = time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( time . time ( ) ) )
  O00OO00OO = "ServerTime"
  OOoo0o = ( {
 'SN' : ds . sn ,
  'Door1#' : 'Closed' if ds . ds1 == 0 else 'Open' ,
 'Door2#' : 'Closed' if ds . ds2 == 0 else 'Open' ,
 'Door3#' : 'Closed' if ds . ds3 == 0 else 'Open' ,
 'Door4#' : 'Closed' if ds . ds4 == 0 else 'Open' ,
 'RefreshTime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 O00OO00OO : oO00OOooOoO0o ,
  } )
  o00ooo0OO0000 = ds . sn
  oOoOo = int ( ds . sn / 10000000 )
  if oOoOo == 17 :
   o0oOoo0O0o0Oo = [ ]
   IIIIiiIIi = [ ]
   if ( ds . floor01_20input & 0x800000 ) > 0 :
    Ii111iii1 = ds . floor01_20input
    for oo0O0 in range ( 20 ) :
     if Ii111iii1 & ( 1 << oo0O0 ) :
      o0oOoo0O0o0Oo . append ( oo0O0 + 1 )
     else :
      IIIIiiIIi . append ( oo0O0 + 1 )
   if ( ds . floor21_40input & 0x800000 ) > 0 :
    Ii111iii1 = ds . floor21_40input
    for oo0O0 in range ( 20 ) :
     if Ii111iii1 & ( 1 << oo0O0 ) :
      o0oOoo0O0o0Oo . append ( oo0O0 + 20 + 1 )
     else :
      IIIIiiIIi . append ( oo0O0 + 20 + 1 )
   OOoo0o = ( {
 'SN' : ds . sn ,
   'Door1#' : 'Closed' if ds . ds1 == 0 else 'Open' ,
 'OpenedCabinetDoor' : o0oOoo0O0o0Oo ,
 'ClosededCabinetDoor' : IIIIiiIIi ,
 'RefreshTime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 O00OO00OO : oO00OOooOoO0o ,
 } )
  elif ds . externboardExisted == 1 :
   if o00ooo0OO0000 >= 300000000 :
    OOoo0o = ( {
 'SN' : ds . sn ,
    'Door1#' : 'Closed' if ds . ds1 == 0 else 'Open' ,
 'Door2#' : 'Closed' if ds . ds2 == 0 else 'Open' ,
 'Door3#' : 'Closed' if ds . ds3 == 0 else 'Open' ,
 'Door4#' : 'Closed' if ds . ds4 == 0 else 'Open' ,

    'ExternOutput1' : 'NormalClosed' if ( ds . externboardValue & 0x1 ) == 0 else 'NormalOpen' ,
 'ExternOutput2' : 'NormalClosed' if ( ds . externboardValue & 0x2 ) == 0 else 'NormalOpen' ,
 'ExternOutput3' : 'NormalClosed' if ( ds . externboardValue & 0x4 ) == 0 else 'NormalOpen' ,
 'ExternOutput4' : 'NormalClosed' if ( ds . externboardValue & 0x8 ) == 0 else 'NormalOpen' ,
 'ExternInput1' : 'Connected' if ( ds . externboardValue & 0x10 ) != 0 else 'Unconnected' ,
 'ExternInput2' : 'Connected' if ( ds . externboardValue & 0x20 ) != 0 else 'Unconnected' ,
 'ExternInput3' : 'Connected' if ( ds . externboardValue & 0x40 ) != 0 else 'Unconnected' ,
 'ExternInput4' : 'Connected' if ( ds . externboardValue & 0x80 ) == 0 else 'Unconnected' ,
 'Fire' : 'Deactive' if ds . fireWarn == 0 else 'Active' ,
 'RefreshTime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 O00OO00OO : oO00OOooOoO0o ,
 } )
   elif o00ooo0OO0000 >= 200000000 :
    if 77 - 77: I11iiIi11i1I / iI1iII1I1I1i - oOo0O00 - Ooo0Ooo % oOo0O00
    OOoo0o = ( {
 'SN' : ds . sn ,
    'Door1#' : 'Closed' if ds . ds1 == 0 else 'Open' ,
 'Door2#' : 'Closed' if ds . ds2 == 0 else 'Open' ,

    'ExternOutput1' : 'NormalClosed' if ( ds . externboardValue & 0x1 ) == 0 else 'NormalOpen' ,
 'ExternOutput2' : 'NormalClosed' if ( ds . externboardValue & 0x2 ) == 0 else 'NormalOpen' ,
 'ExternOutput3' : 'NormalClosed' if ( ds . externboardValue & 0x4 ) == 0 else 'NormalOpen' ,
 'ExternOutput4' : 'NormalClosed' if ( ds . externboardValue & 0x8 ) == 0 else 'NormalOpen' ,
 'ExternInput1' : 'Connected' if ( ds . externboardValue & 0x10 ) != 0 else 'Unconnected' ,
 'ExternInput2' : 'Connected' if ( ds . externboardValue & 0x20 ) != 0 else 'Unconnected' ,
 'ExternInput3' : 'Connected' if ( ds . externboardValue & 0x40 ) != 0 else 'Unconnected' ,
 'ExternInput4' : 'Connected' if ( ds . externboardValue & 0x80 ) == 0 else 'Unconnected' ,
 'Fire' : 'Deactive' if ds . fireWarn == 0 else 'Active' ,
 'RefreshTime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 O00OO00OO : oO00OOooOoO0o ,
 } )
   elif o00ooo0OO0000 >= 100000000 :
    if 73 - 73: IiI11Ii111 . Oo * I1I / i1i1i1111I + I1Ii1I1
    OOoo0o = ( {
 'SN' : ds . sn ,
    'Door1#' : 'Closed' if ds . ds1 == 0 else 'Open' ,

    'ExternOutput1' : 'NormalClosed' if ( ds . externboardValue & 0x1 ) == 0 else 'NormalOpen' ,
 'ExternOutput2' : 'NormalClosed' if ( ds . externboardValue & 0x2 ) == 0 else 'NormalOpen' ,
 'ExternOutput3' : 'NormalClosed' if ( ds . externboardValue & 0x4 ) == 0 else 'NormalOpen' ,
 'ExternOutput4' : 'NormalClosed' if ( ds . externboardValue & 0x8 ) == 0 else 'NormalOpen' ,
 'ExternInput1' : 'Connected' if ( ds . externboardValue & 0x10 ) != 0 else 'Unconnected' ,
 'ExternInput2' : 'Connected' if ( ds . externboardValue & 0x20 ) != 0 else 'Unconnected' ,
 'ExternInput3' : 'Connected' if ( ds . externboardValue & 0x40 ) != 0 else 'Unconnected' ,
 'ExternInput4' : 'Connected' if ( ds . externboardValue & 0x80 ) == 0 else 'Unconnected' ,
 'Fire' : 'Deactive' if ds . fireWarn == 0 else 'Active' ,
 'RefreshTime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 O00OO00OO : oO00OOooOoO0o ,
 } )
    if ( o00ooo0OO0000 >= 170000000 ) and ( o00ooo0OO0000 <= 179999999 ) :
     pass
  else :
   if o00ooo0OO0000 >= 300000000 :
    pass
   elif o00ooo0OO0000 >= 200000000 :
    if 31 - 31: i1i1i1111I % I1Ii1I1
    OOoo0o = ( {
 'SN' : ds . sn ,
    'Door1#' : 'Closed' if ds . ds1 == 0 else 'Open' ,
 'Door2#' : 'Closed' if ds . ds2 == 0 else 'Open' ,
 'RefreshTime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 O00OO00OO : oO00OOooOoO0o ,
 } )
   elif o00ooo0OO0000 >= 100000000 :
    if 1 - 1: IiI11Ii111 - oOo0O00 - i1 . oOo0O00
    OOoo0o = ( {
 'SN' : ds . sn ,
    'Door1#' : 'Closed' if ds . ds1 == 0 else 'Open' ,
 'RefreshTime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 O00OO00OO : oO00OOooOoO0o ,
 } )
    if ( o00ooo0OO0000 >= 170000000 ) and ( o00ooo0OO0000 <= 179999999 ) :
     pass
  return OOoo0o
  if 91 - 91: iI1iII1I1I1i * i1 . ooOOO
 def detailOfDS2023 ( ds ) :
  OOoo0o = ( {
 'SN' : ds . sn ,
  'Door1#' : 'Closed' if ds . ds1 == 0 else 'Open' ,
 'Door2#' : 'Closed' if ds . ds2 == 0 else 'Open' ,
 'Door3#' : 'Closed' if ds . ds3 == 0 else 'Open' ,
 'Door4#' : 'Closed' if ds . ds4 == 0 else 'Open' ,
 'RefreshTime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 } )
  o00ooo0OO0000 = ds . sn
  if ds . externboardExisted == 1 :
   if o00ooo0OO0000 >= 300000000 :
    OOoo0o = ( {
 'SN' : ds . sn ,
    'Door1#' : 'Closed' if ds . ds1 == 0 else 'Open' ,
 'Door2#' : 'Closed' if ds . ds2 == 0 else 'Open' ,
 'Door3#' : 'Closed' if ds . ds3 == 0 else 'Open' ,
 'Door4#' : 'Closed' if ds . ds4 == 0 else 'Open' ,

    'ExternOutput1' : 'NormalClosed' if ( ds . externboardValue & 0x1 ) == 0 else 'NormalOpen' ,
 'ExternOutput2' : 'NormalClosed' if ( ds . externboardValue & 0x2 ) == 0 else 'NormalOpen' ,
 'ExternOutput3' : 'NormalClosed' if ( ds . externboardValue & 0x4 ) == 0 else 'NormalOpen' ,
 'ExternOutput4' : 'NormalClosed' if ( ds . externboardValue & 0x8 ) == 0 else 'NormalOpen' ,
 'ExternInput1' : 'Connected' if ( ds . externboardValue & 0x10 ) != 0 else 'Unconnected' ,
 'ExternInput2' : 'Connected' if ( ds . externboardValue & 0x20 ) != 0 else 'Unconnected' ,
 'ExternInput3' : 'Connected' if ( ds . externboardValue & 0x40 ) != 0 else 'Unconnected' ,
 'ExternInput4' : 'Connected' if ( ds . externboardValue & 0x80 ) == 0 else 'Unconnected' ,
 'Fire' : 'Deactive' if ds . fireWarn == 0 else 'Active' ,
 'RefreshTime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 } )
   elif o00ooo0OO0000 >= 200000000 :
    if 81 - 81: I1I * Oo - i1 % OooOoo * ooOOO
    OOoo0o = ( {
 'SN' : ds . sn ,
    'Door1#' : 'Closed' if ds . ds1 == 0 else 'Open' ,
 'Door2#' : 'Closed' if ds . ds2 == 0 else 'Open' ,

    'ExternOutput1' : 'NormalClosed' if ( ds . externboardValue & 0x1 ) == 0 else 'NormalOpen' ,
 'ExternOutput2' : 'NormalClosed' if ( ds . externboardValue & 0x2 ) == 0 else 'NormalOpen' ,
 'ExternOutput3' : 'NormalClosed' if ( ds . externboardValue & 0x4 ) == 0 else 'NormalOpen' ,
 'ExternOutput4' : 'NormalClosed' if ( ds . externboardValue & 0x8 ) == 0 else 'NormalOpen' ,
 'ExternInput1' : 'Connected' if ( ds . externboardValue & 0x10 ) != 0 else 'Unconnected' ,
 'ExternInput2' : 'Connected' if ( ds . externboardValue & 0x20 ) != 0 else 'Unconnected' ,
 'ExternInput3' : 'Connected' if ( ds . externboardValue & 0x40 ) != 0 else 'Unconnected' ,
 'ExternInput4' : 'Connected' if ( ds . externboardValue & 0x80 ) == 0 else 'Unconnected' ,
 'Fire' : 'Deactive' if ds . fireWarn == 0 else 'Active' ,
 'RefreshTime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 } )
   elif o00ooo0OO0000 >= 100000000 :
    if 19 - 19: Ii
    OOoo0o = ( {
 'SN' : ds . sn ,
    'Door1#' : 'Closed' if ds . ds1 == 0 else 'Open' ,

    'ExternOutput1' : 'NormalClosed' if ( ds . externboardValue & 0x1 ) == 0 else 'NormalOpen' ,
 'ExternOutput2' : 'NormalClosed' if ( ds . externboardValue & 0x2 ) == 0 else 'NormalOpen' ,
 'ExternOutput3' : 'NormalClosed' if ( ds . externboardValue & 0x4 ) == 0 else 'NormalOpen' ,
 'ExternOutput4' : 'NormalClosed' if ( ds . externboardValue & 0x8 ) == 0 else 'NormalOpen' ,
 'ExternInput1' : 'Connected' if ( ds . externboardValue & 0x10 ) != 0 else 'Unconnected' ,
 'ExternInput2' : 'Connected' if ( ds . externboardValue & 0x20 ) != 0 else 'Unconnected' ,
 'ExternInput3' : 'Connected' if ( ds . externboardValue & 0x40 ) != 0 else 'Unconnected' ,
 'ExternInput4' : 'Connected' if ( ds . externboardValue & 0x80 ) == 0 else 'Unconnected' ,
 'Fire' : 'Deactive' if ds . fireWarn == 0 else 'Active' ,
 'RefreshTime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 } )
    if ( o00ooo0OO0000 >= 170000000 ) and ( o00ooo0OO0000 <= 179999999 ) :
     pass
  else :
   if o00ooo0OO0000 >= 300000000 :
    pass
   elif o00ooo0OO0000 >= 200000000 :
    if 22 - 22: i1I % iI1iII1I1I1i + Oo
    OOoo0o = ( {
 'SN' : ds . sn ,
    'Door1#' : 'Closed' if ds . ds1 == 0 else 'Open' ,
 'Door2#' : 'Closed' if ds . ds2 == 0 else 'Open' ,
 'RefreshTime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 } )
   elif o00ooo0OO0000 >= 100000000 :
    if 60 - 60: ooo000 + I11iiIi11i1I + IIiIIiIi11I1 % i1i1i1111I - Ii % Ooo0Ooo
    OOoo0o = ( {
 'SN' : ds . sn ,
    'Door1#' : 'Closed' if ds . ds1 == 0 else 'Open' ,
 'RefreshTime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 } )
    if ( o00ooo0OO0000 >= 170000000 ) and ( o00ooo0OO0000 <= 179999999 ) :
     pass
  return OOoo0o
  if 95 - 95: ooOOO % i1i1i1111I . i1
 def detailOfDSandWarn ( ds ) :
  OOoo0o = ( {
 'SN' : ds . sn ,
  'ds' : ( ds . ds1 , ds . ds2 , ds . ds3 , ds . ds4 ) ,
  'appError' : ds . appError ,
  'warndoor' : ds . warndoor ,
  'forceClosedWarn' : ds . forceClosedWarn ,
  'fireWarn' : ds . fireWarn ,
  'refreshtime' : time . strftime ( "%Y-%m-%d %H:%M:%S" , time . localtime ( ds . refreshTimeFrom1970 ) ) ,
 } )
  return OOoo0o
  if 87 - 87: Iii1i % ooOOO * Ii % IIiIIiIi11I1 / I11iiIi11i1I
 onesecondsent4MQTT = 0
 lastsendtick4MQTT = time . time ( )
 if 84 - 84: I1Ii1I1 + Ooo0Ooo % IIiIIiIi11I1 * i1i1i1111I
 def sendMQTTHeartBeat ( doorstatus ) :
  if mMonitorInfo . bSendByMQTT :
   if mMonitorInfo . lastsendtick4MQTT + 1 > time . time ( ) :
    if mMonitorInfo . onesecondsent4MQTT > mMonitorInfo . mqtt_timesMaxInOneSecond :
     return
   else :
    mMonitorInfo . onesecondsent4MQTT = 0
    mMonitorInfo . lastsendtick4MQTT = time . time ( )
   mMonitorInfo . onesecondsent4MQTT += 1
   if 61 - 61: i1iiIII111 - Oo + I1Ii1I1
   OOO0O0oOoOOOo = doorstatus
   o0OOoo0O0O0O = "{0:d},{1:d}" . format ( OOO0O0oOoOOOo . sn , OOO0O0oOoOOOo . ds1 )
   if OOO0O0oOoOOOo . sn > 400000000 :
    o0OOoo0O0O0O = "{0:d},{1:d},{2:d},{3:d},{4:d}" . format ( OOO0O0oOoOOOo . sn , OOO0O0oOoOOOo . ds1 , OOO0O0oOoOOOo . ds2 , OOO0O0oOoOOOo . ds3 , OOO0O0oOoOOOo . ds4 )
   elif OOO0O0oOoOOOo . sn > 200000000 :
    o0OOoo0O0O0O = "{0:d},{1:d},{2:d}" . format ( OOO0O0oOoOOOo . sn , OOO0O0oOoOOOo . ds1 , OOO0O0oOoOOOo . ds2 , OOO0O0oOoOOOo )
   i1iII1 = 'DoorStatus'
   o0 = 'HeartBeat'
   if mMonitorInfo . mqtt_englishTopic > 0 :
    i1iII1 = 'menzhuangtai'
    o0 = 'xintiaobao'
    if 78 - 78: I1Ii1I1 * oOo0O00
    if 71 - 71: oOO
    if 53 - 53: i1
    if 15 - 15: OooOoo . oOo0O00 - ooOOO % Ooo0Ooo
   mMonitorInfo . mqttclientpublish ( i1iII1 , payload = o0OOoo0O0O0O ,
 qos = 0 )
   OOoo0o = mMonitorInfo . detailOfDS ( doorstatus )
   if 62 - 62: iI1iII1I1I1i / OooOoo % I1I - IiI11Ii111
   if 66 - 66: i1i1i1111I / Ooo0Ooo + I11iiIi11i1I + Iii1i + oOo0O00 + i1I
   if 75 - 75: OooOoo - oOO - IiIIii11Ii - oOO + ooo000 % iI1iII1I1I1i
   mMonitorInfo . mqttclientpublish ( o0 , payload = ( json . dumps ( OOoo0o , sort_keys = False ) ) ,
 qos = 0 )
   OOO0O0oOoOOOo . refreshTimeFrom1970MQTT = time . time ( )
   if 42 - 42: i1 * i1I
   if 50 - 50: Ii - i1iiIII111
   if 96 - 96: ooo000 * OooOoo - Ii - OooOoo
   if 65 - 65: Oo + Oo - iI1iII1I1I1i % OooOoo . Ooo0Ooo
   if 84 - 84: IIiIIiIi11I1 . ooOOO
   if 44 - 44: ooo000 * i1i1i1111I * oOO + i1iiIII111 - IIiIIiIi11I1
   if 70 - 70: IiI11Ii111
   if 9 - 9: oOo0O00 * i1
   if 96 - 96: Ooo0Ooo
   if 13 - 13: Oo * I1Ii1I1 - oOo0O00 * Ii . Ii + oOo0O00
 def updateDSInfo ( sn , data ) :
  OOO0O0oOoOOOo = wgcontrollerDoorStatus ( )
  OOO0O0oOoOOOo . sn = sn
  OOO0O0oOoOOOo . ds1 = data [ 28 ]
  OOO0O0oOoOOOo . ds2 = data [ 29 ]
  OOO0O0oOoOOOo . ds3 = data [ 30 ]
  OOO0O0oOoOOOo . ds4 = data [ 31 ]
  OOO0O0oOoOOOo . refreshTimeFrom1970 = time . time ( )
  OOO0O0oOoOOOo . appError = data [ 36 ]
  OOO0O0oOoOOOo . warndoor = (
 ( ( data [ 49 ] >> 4 ) & 1 ) , ( ( data [ 49 ] >> 5 ) & 1 ) , ( ( data [ 49 ] >> 6 ) & 1 ) ,
 ( ( data [ 49 ] >> 7 ) & 1 ) )
  OOO0O0oOoOOOo . forceClosedWarn = ( ( data [ 50 ] >> 0 ) & 1 )
  OOO0O0oOoOOOo . fireWarn = ( ( data [ 50 ] >> 1 ) & 1 )
  OOO0O0oOoOOOo . externboardValue = data [ 54 ]
  oOoOo = int ( OOO0O0oOoOOOo . sn / 10000000 )
  if oOoOo == 17 :
   OOO0O0oOoOOOo . floor01_20input = ( data [ 34 ] << 16 ) + ( data [ 33 ] << 8 ) + ( data [ 32 ] )
   OOO0O0oOoOOOo . floor21_40input = ( data [ 30 ] << 16 ) + ( data [ 29 ] << 8 ) + ( data [ 28 ] )
  OOO0O0oOoOOOo . externboardExisted = 1 if ( data [ 50 ] & 0x80 ) > 0 else 0
  if 46 - 46: OooOoo - I11iiIi11i1I / Ooo0Ooo
  ii1I = mMonitorInfo . watchingController . get ( sn )
  mMonitorInfo . refreshTimeFrom1970 = time . time ( )
  if 80 - 80: IIiIIiIi11I1 / OooOoo % iI1iII1I1I1i / ooOOO * ooOOO - Iii1i
  if not ( ii1I is None ) :
   if 60 - 60: oOO * i1i1i1111I / iI1iII1I1I1i
   if ( ( ii1I . ds1 == OOO0O0oOoOOOo . ds1 ) and ( ii1I . ds2 == OOO0O0oOoOOOo . ds2 ) and ( ii1I . ds3 == OOO0O0oOoOOOo . ds3 ) and ( ii1I . ds4 == OOO0O0oOoOOOo . ds4 )
 and ( ii1I . appError == OOO0O0oOoOOOo . appError ) and ( ii1I . warndoor == OOO0O0oOoOOOo . warndoor )
 and ( ii1I . forceClosedWarn == OOO0O0oOoOOOo . forceClosedWarn ) and (
 ii1I . fireWarn == OOO0O0oOoOOOo . fireWarn )
 and (
 OOO0O0oOoOOOo . externboardExisted == ii1I . externboardExisted and ii1I . externboardValue == OOO0O0oOoOOOo . externboardValue )
   and ( OOO0O0oOoOOOo . floor01_20input == ii1I . floor01_20input and ii1I . floor21_40input == OOO0O0oOoOOOo . floor21_40input ) ) :
    ii1I . refreshTimeFrom1970 = time . time ( )
    if 45 - 45: Ooo0Ooo + ooOOO * oOo0O00 - ooo000 / IIiIIiIi11I1
    if ii1I . refreshTimeFrom1970MQTT + mMonitorInfo . mqtt_cycle_seconds < time . time ( ) :
     mMonitorInfo . sendMQTTHeartBeat ( OOO0O0oOoOOOo )
    return None
  mMonitorInfo . watchingController [ sn ] = OOO0O0oOoOOOo
  if 14 - 14: i1I - IiIIii11Ii
  if 74 - 74: oOo0O00 * ooo000 . ooOOO
  if 2 - 2: Ii * IIiIIiIi11I1 % i1 + IiIIii11Ii % i1
  if 82 - 82: ooOOO % OooOoo
  iIi1I1 = False
  if not ( mMonitorInfo . ws is None ) :
   if mMonitorInfo . ws . count > 0 :
    iIi1I1 = True
  if iIi1I1 or mMonitorInfo . bSendByMQTT :
   if iIi1I1 :
    OOoo0o = mMonitorInfo . detailOfDS ( OOO0O0oOoOOOo )
    mMonitorInfo . ws . broadcast (
 bytes ( json . dumps ( [ OOoo0o ] , sort_keys = False , indent = 4 ) , encoding = 'utf8' ) )
   mMonitorInfo . sendMQTTHeartBeat ( OOO0O0oOoOOOo )
   if 17 - 17: oOo0O00
  return OOO0O0oOoOOOo
  if 42 - 42: I1Ii1I1 - OooOoo / IiIIii11Ii % I11iiIi11i1I % I1Ii1I1 + ooOOO
  if 62 - 62: i1iiIII111 * iI1iII1I1I1i . i1i1i1111I
 def getAllControllerDSInfo ( notuse = None ) :
  i11I1IiIiI1i = [ ]
  if 59 - 59: ooOOO * ooo000 % IiIIii11Ii
  for ii11I1i1i in list ( mMonitorInfo . watchingController . keys ( ) ) :
   OOO0O0oOoOOOo = mMonitorInfo . watchingController [ ii11I1i1i ]
   OOoo0o = mMonitorInfo . detailOfDS ( OOO0O0oOoOOOo )
   i11I1IiIiI1i . append ( OOoo0o )
  if len ( i11I1IiIiI1i ) > 0 :
   return bytes ( json . dumps ( i11I1IiIiI1i , sort_keys = False , indent = 4 ) , encoding = 'utf8' )
  return None
  if 82 - 82: oOo0O00 * Ooo0Ooo * OooOoo . Ii
  if 5 - 5: Oo - i1 . oOO
  if 18 - 18: IiIIii11Ii - oOO * i1I - OooOoo
 def getAllControllerDSInfoBy20 ( sended ) :
  i11I1IiIiI1i = [ ]
  if 54 - 54: IIiIIiIi11I1 . Ooo0Ooo % Ii + IiIIii11Ii * iI1iII1I1I1i / iI1iII1I1I1i
  for ii11I1i1i in list ( mMonitorInfo . watchingController . keys ( ) ) :
   if ii11I1i1i in sended :
    continue
   sended . append ( ii11I1i1i )
   OOO0O0oOoOOOo = mMonitorInfo . watchingController [ ii11I1i1i ]
   OOoo0o = mMonitorInfo . detailOfDS ( OOO0O0oOoOOOo )
   i11I1IiIiI1i . append ( OOoo0o )
  if len ( i11I1IiIiI1i ) > 0 :
   return bytes ( json . dumps ( i11I1IiIiI1i , sort_keys = False , indent = 4 ) , encoding = 'utf8' )
  return None
  if 31 - 31: IiIIii11Ii . IiIIii11Ii % Ii
  if 51 - 51: Oo / i1i1i1111I - I1I
  if 83 - 83: Iii1i % i1iiIII111 . OooOoo / I1I % oOO . I1I
 def sendSwipes ( wginfo , startIndex ) :
  if 76 - 76: i1iiIII111 / OooOoo
  if 77 - 77: ooOOO
  if 19 - 19: ooOOO % I1Ii1I1
  if 15 - 15: OooOoo . IiIIii11Ii . i1I / Iii1i + ooOOO / Ii
  if 17 - 17: I11iiIi11i1I - i1i1i1111I . iI1iII1I1I1i - I11iiIi11i1I + Oo % iI1iII1I1I1i
  if 65 - 65: Ii % I11iiIi11i1I
  if 39 - 39: Iii1i * IIiIIiIi11I1 . Ooo0Ooo - Oo
  if 63 - 63: i1i1i1111I - i1iiIII111 . OooOoo % OooOoo . IiI11Ii111 + i1I
  iIi1I1 = False
  if 71 - 71: ooo000 + I11iiIi11i1I % iI1iII1I1I1i + IiI11Ii111 % Oo - Oo
  IiIIIII1i = False
  if ( mMonitorInfo . ASendRecordSwipe | mMonitorInfo . BSendRecordSwipe |
 mMonitorInfo . ASendRecordOther | mMonitorInfo . BSendRecordOther |
 mMonitorInfo . ASendRecordWarn | mMonitorInfo . BSendRecordWarn | mMonitorInfo . ASendRecordSwipeInvalid |
 mMonitorInfo . BSendRecordSwipeInvalid ) > 0 :
   IiIIIII1i = True
  if not ( mMonitorInfo . ws is None ) :
   if mMonitorInfo . ws . count > 0 :
    iIi1I1 = True
    if 41 - 41: ooOOO + OooOoo + IIiIIiIi11I1 * i1i1i1111I
  if iIi1I1 or mMonitorInfo . bSendByMQTT or IiIIIII1i or mMonitorInfo . bSendBywsudp > 0 :
   iIi = [ ]
   if 96 - 96: OooOoo + Ii % oOO % i1iiIII111 % Oo * Ooo0Ooo
   wginfo . getNewSwipeJSON ( startIndex , iIi )
   if len ( iIi ) > 0 :
    OOoo0o = iIi
    if iIi1I1 :
     mMonitorInfo . ws . broadcast (
 bytes ( json . dumps ( OOoo0o , sort_keys = False , indent = 4 ) , encoding = 'utf8' ) )
    if mMonitorInfo . bSendByMQTT :
     if 46 - 46: Ii - IiI11Ii111 + IiIIii11Ii + i1I . I1I % OooOoo
     if 85 - 85: Oo / oOO + Oo + ooOOO
     if 74 - 74: oOO - IiI11Ii111
     if 79 - 79: oOO * IiI11Ii111 . ooOOO * I1Ii1I1 . oOo0O00 + i1iiIII111
     oo00 = 'Swipe'
     o00o = 'RemoteOpenRecord'
     iIIIiII1 = 'RemoteOpenRecord'
     oo = 'OtherRecord'
     if mMonitorInfo . mqtt_englishTopic > 0 :
      oo00 = 'shuaka'
      o00o = 'yuanchengkaimenjilu'
      iIIIiII1 = 'baojing'
      oo = 'qita'
     for oo0O0 in range ( 0 , len ( iIi ) ) :
      if iIi [ oo0O0 ] [ 'RecordType' ] == 1 :
       if 21 - 21: i1i1i1111I . iI1iII1I1I1i + Ooo0Ooo * IiI11Ii111 - iI1iII1I1I1i
       if 54 - 54: I11iiIi11i1I / IiIIii11Ii . Ooo0Ooo
       if 15 - 15: i1I * I11iiIi11i1I - oOo0O00
       if 6 - 6: IiI11Ii111 - Ii
       if 1 - 1: I1I + OooOoo
       mMonitorInfo . mqttclientpublish ( oo00 ,
 payload = ( json . dumps ( iIi [ oo0O0 ] , sort_keys = False ) ) ,
 qos = 0 )
      elif iIi [ oo0O0 ] [ 'RecordType' ] == 2 :
       if 98 - 98: i1iiIII111 + Iii1i . IIiIIiIi11I1
       if 96 - 96: OooOoo / oOO - i1 * I11iiIi11i1I
       if 72 - 72: i1i1i1111I + Ii - Iii1i - i1i1i1111I - i1I + Ooo0Ooo
       if 74 - 74: Ooo0Ooo * Oo + Iii1i - i1iiIII111
       mMonitorInfo . mqttclientpublish ( oo , payload = ( json . dumps ( iIi [ oo0O0 ] , sort_keys = False ) ) ,
 qos = 0 )
       if iIi [ oo0O0 ] [ 'Description' ] == 'Remote Open Door' :
        if 22 - 22: IiIIii11Ii - Ooo0Ooo . i1 . i1I - ooo000
        if 68 - 68: ooo000
        o0OOoo0O0O0O = "{0:d},{1:d}" . format ( iIi [ oo0O0 ] [ 'SN' ] , iIi [ oo0O0 ] [ 'DoorNO' ] )
        if 40 - 40: i1 + I1Ii1I1 + I11iiIi11i1I . Oo * I11iiIi11i1I % I1I
        if 100 - 100: OooOoo + Oo / OooOoo
        if 33 - 33: IiI11Ii111 / OooOoo
        if 98 - 98: I1Ii1I1 . IIiIIiIi11I1 * i1I - iI1iII1I1I1i % i1I * IiI11Ii111
        mMonitorInfo . mqttclientpublish ( o00o , payload = o0OOoo0O0O0O ,
 qos = 0 )
        if 42 - 42: OooOoo + i1i1i1111I - iI1iII1I1I1i - oOo0O00 * i1I + Ii
        if 46 - 46: oOo0O00 . iI1iII1I1I1i - Ii . oOo0O00 + i1i1i1111I
      elif iIi [ oo0O0 ] [ 'RecordType' ] == 3 :
       if 83 - 83: IiI11Ii111
       if 77 - 77: iI1iII1I1I1i - oOO % Ii * i1I - I1I
       if 42 - 42: I11iiIi11i1I - Ii / Oo - i1i1i1111I + I11iiIi11i1I
       if 83 - 83: i1 . iI1iII1I1I1i
       if 57 - 57: IiI11Ii111 % IiIIii11Ii / oOo0O00 + Ooo0Ooo - i1iiIII111
       mMonitorInfo . mqttclientpublish ( iIIIiII1 ,
 payload = ( json . dumps ( iIi [ oo0O0 ] , sort_keys = False ) ) ,
 qos = 0 )
    if IiIIIII1i :
     for oo0O0 in range ( 0 , len ( iIi ) ) :
      IIi = (
 {
 "jsonrpc" : "2.0" ,
 "method" : "RealData" ,
 "params" : [
 iIi [ oo0O0 ]
 ] ,
 "id" : 1001
 } )
      O000oO = False
      iI111Ii = False
      if iIi [ oo0O0 ] [ 'RecordType' ] == 1 :
       O000oO = mMonitorInfo . ASendRecordSwipe > 0
       iI111Ii = mMonitorInfo . BSendRecordSwipe > 0
       if iIi [ oo0O0 ] [ 'Valid' ] != "Pass" :
        O000oO = O000oO or ( mMonitorInfo . ASendRecordSwipeInvalid > 0 )
        iI111Ii = iI111Ii or ( mMonitorInfo . BSendRecordSwipeInvalid > 0 )
      elif iIi [ oo0O0 ] [ 'RecordType' ] == 2 :
       O000oO = mMonitorInfo . ASendRecordOther > 0
       iI111Ii = mMonitorInfo . BSendRecordOther > 0
      elif iIi [ oo0O0 ] [ 'RecordType' ] == 3 :
       O000oO = mMonitorInfo . ASendRecordWarn > 0
       iI111Ii = mMonitorInfo . BSendRecordWarn > 0
       if 77 - 77: oOo0O00 . ooo000 % i1iiIII111 * I11iiIi11i1I / Ooo0Ooo . I11iiIi11i1I
       if 47 - 47: IiIIii11Ii
       if 40 - 40: i1iiIII111 / IIiIIiIi11I1
       if 25 - 25: OooOoo / i1i1i1111I
       if 38 - 38: I11iiIi11i1I
       if 99 - 99: I11iiIi11i1I * i1iiIII111 . OooOoo % ooo000 % OooOoo
       if 21 - 21: IiI11Ii111 * I1Ii1I1
       if 93 - 93: Ooo0Ooo . i1 + IiI11Ii111 - oOo0O00
       if 97 - 97: i1 - i1 % IIiIIiIi11I1 + IiIIii11Ii / i1I * iI1iII1I1I1i
      if O000oO > 0 :
       mMonitorInfo . UDPQueue4AHTTP . append (
 bytes ( json . dumps ( IIi , sort_keys = False , indent = 4 ) , encoding = 'utf8' ) )
       if mMonitorInfo . taskqueueUDPQueue4AHTTP . empty ( ) :
        mMonitorInfo . taskqueueUDPQueue4AHTTP . put ( "UDPQueue4AHTTP" )
      if iI111Ii > 0 :
       mMonitorInfo . UDPQueue4BHTTP . append (
 bytes ( json . dumps ( IIi , sort_keys = False , indent = 4 ) , encoding = 'utf8' ) )
       if mMonitorInfo . taskqueueUDPQueue4BHTTP . empty ( ) :
        mMonitorInfo . taskqueueUDPQueue4BHTTP . put ( "UDPQueue4BHTTP" )
    if mMonitorInfo . bSendBywsudp > 0 :
     for oo0O0 in range ( 0 , len ( iIi ) ) :
      IIi = (
 {
 "jsonrpc" : "2.0" ,
 "method" : "RealData" ,
 "params" : [
 iIi [ oo0O0 ]
 ] ,
 "id" : 1001
 } )
      mMonitorInfo . wsudp . UDPQueue4DingyueWS . append ( bytes ( json . dumps ( IIi , sort_keys = False , indent = 4 ) , encoding = 'utf8' ) )
     if mMonitorInfo . wsudp . taskqueueWGControllerCenterUDPWS . empty ( ) :
      mMonitorInfo . wsudp . taskqueueWGControllerCenterUDPWS . put ( 10010039 )
      if 60 - 60: I11iiIi11i1I - Ooo0Ooo % I1Ii1I1
 def sendQRCode ( wgpkt ) :
  iIi1I1 = False
  if 26 - 26: ooOOO / IIiIIiIi11I1 . oOO + I11iiIi11i1I . Oo
  if not ( mMonitorInfo . ws is None ) :
   if mMonitorInfo . ws . count > 0 :
    iIi1I1 = True
  if iIi1I1 or mMonitorInfo . bSendByMQTT :
   oOO0 = WGControllerinfo ( wgpkt . commandData , ( "0.0.0.0" , 0 ) )
   if oOO0 . recordIndex >= 1 :
    iIi = [ ]
    IiI = str ( binascii . hexlify ( oOO0 . commandData [ 64 : 64 + oOO0 . recordIndex ] ) , encoding = 'UTF-8' )
    ooO0OoOo = ""
    try :
     ooO0OoOo = str ( oOO0 . commandData [ 64 : 64 + oOO0 . recordIndex ] , encoding = "utf-8" )
    except Exception as oO :
     pass
     pass
    IiiI = ( {
 "SN" : oOO0 . controllerSN ,
 'PrimitHexData' : IiI ,
 'ConvertedToString' : ooO0OoOo ,
 'Time' : oOO0 . timeOfCon . strftime ( "%Y-%m-%d %H:%M:%S" ) ,
 'DoorNO' : oOO0 . recordDoorNO ,

    # OooOoo * IIiIIiIi11I1 * IiI11Ii111 - Iii1i
    'InExit' : 'In' if oOO0 . commandData [ 15 ] == 1 else 'Exit' ,
    'SerialNumber' : oOO0 . sid
 } )
    iii111 = tdz . parseCommand ( oOO0 . commandData [ 64 : 64 + oOO0 . recordIndex ] )
    if iii111 is not None :
     IiiI = ( {
 "ControllerSN" : oOO0 . controllerSN ,
 'PrimitHexData' : IiI ,
 "GateInformation" : iii111 ,
     'Time' : oOO0 . timeOfCon . strftime ( "%Y-%m-%d %H:%M:%S" ) ,
 'SerialNumber' : oOO0 . sid
 } )
    iIi . append ( IiiI )
    OOoo0o = iIi
    if 68 - 68: oOo0O00 . oOo0O00 / Ii . i1
    if iIi1I1 :
     mMonitorInfo . ws . broadcast (
 bytes ( json . dumps ( OOoo0o , sort_keys = False , indent = 4 ) , encoding = 'utf8' ) )
    if mMonitorInfo . bSendByMQTT :
     OoO = 'QRCode'
     if mMonitorInfo . mqtt_englishTopic > 0 :
      OoO = 'erweima'
      if 77 - 77: I11iiIi11i1I . i1 % OooOoo * Ooo0Ooo + Iii1i
      if 79 - 79: i1I / I1Ii1I1 - i1i1i1111I
      if 68 - 68: I11iiIi11i1I . I11iiIi11i1I % I11iiIi11i1I
      if 71 - 71: ooo000
      if 61 - 61: ooo000
     mMonitorInfo . mqttclientpublish ( OoO , payload = ( json . dumps ( OOoo0o , sort_keys = False ) ) ,
 qos = 0 )
     if 48 - 48: Iii1i * i1i1i1111I + IiIIii11Ii
     if 31 - 31: Oo * i1iiIII111 % Ii / oOO + I1Ii1I1 + iI1iII1I1I1i
  if mMonitorInfo . ASendQR > 0 or mMonitorInfo . BSendQR > 0 :
   oOO0 = WGControllerinfo ( wgpkt . commandData , ( "0.0.0.0" , 0 ) )
   if oOO0 . recordIndex >= 1 :
    ooO0OoOo = ""
    try :
     ooO0OoOo = str ( oOO0 . commandData [ 64 : 64 + oOO0 . recordIndex ] , encoding = "utf-8" )
    except Exception as oO :
     pass
     pass
     return
    IiiI = ( {
 "jsonrpc" : "2.0" ,
 "method" : "RealData" ,
 "params" : [
 {
 "SN" : oOO0 . controllerSN ,
 "QRCodeInformation" : ooO0OoOo ,
 'Time' : oOO0 . timeOfCon . strftime ( "%Y-%m-%d %H:%M:%S" ) ,
 'DoorNO' : oOO0 . recordDoorNO ,
 'InExit' : 'In' if oOO0 . commandData [ 15 ] == 1 else 'Exit' ,
    'SerialNumber' : oOO0 . sid
 }
 ] ,
 "id" : 1001
 } )
    if mMonitorInfo . ASendQR > 0 :
     mMonitorInfo . UDPQueue4AHTTP . append (
 bytes ( json . dumps ( IiiI , sort_keys = False , indent = 4 ) , encoding = 'utf8' ) )
     if 90 - 90: I1Ii1I1 * i1i1i1111I / iI1iII1I1I1i * Ii
     if 38 - 38: I1I . Ii
     if 41 - 41: ooo000 % IIiIIiIi11I1 % ooOOO
     if mMonitorInfo . taskqueueUDPQueue4AHTTP . empty ( ) :
      mMonitorInfo . taskqueueUDPQueue4AHTTP . put ( "UDPQueue4AHTTP" )
    if mMonitorInfo . BSendQR > 0 :
     mMonitorInfo . UDPQueue4BHTTP . append (
 bytes ( json . dumps ( IiiI , sort_keys = False , indent = 4 ) , encoding = 'utf8' ) )
     if 5 - 5: oOo0O00 / Ii + i1iiIII111 * Oo + Ooo0Ooo + ooo000
     if 96 - 96: i1iiIII111 - IIiIIiIi11I1 / IIiIIiIi11I1 * IiIIii11Ii
     if 67 - 67: Ooo0Ooo . Ooo0Ooo . IiI11Ii111
     if mMonitorInfo . taskqueueUDPQueue4BHTTP . empty ( ) :
      mMonitorInfo . taskqueueUDPQueue4BHTTP . put ( "UDPQueue4BHTTP" )
      if 24 - 24: i1iiIII111 + i1i1i1111I . oOo0O00 + iI1iII1I1I1i + IiI11Ii111
 @ staticmethod
 def mqtt_on_connect ( client , userdata , flags , rc ) :
  mMonitorInfo . mqttclientStatus = 1
  if mMonitorInfo . mqttclient :
   if 92 - 92: iI1iII1I1I1i / iI1iII1I1I1i + IiIIii11Ii . IiI11Ii111
   mMonitorInfo . mqttclient . subscribe ( 'OpenDoorCommand' , qos = 0 )
   mMonitorInfo . mqttclient . subscribe ( 'kaimenzhiling' , qos = 0 )
   if 56 - 56: Ii * ooo000 . IiIIii11Ii
   if 66 - 66: I1Ii1I1 * OooOoo . iI1iII1I1I1i % OooOoo . i1 . IiIIii11Ii
  pass
  if 47 - 47: Ii % OooOoo % iI1iII1I1I1i * IiIIii11Ii
  if 48 - 48: i1I . I11iiIi11i1I / ooo000 + i1iiIII111
 @ staticmethod
 def mqtt_on_disconnect ( client , userdata , rc ) :
  mMonitorInfo . mqttclientStatus = - 1
  if rc != 0 :
   if mMonitorInfo . allowErrWrite4mqtt_on_disconnect < 5 :
    mMonitorInfo . allowErrWrite4mqtt_on_disconnect += 1
    print ( "mqtt 101 Unexpected disconnection." )
    if 84 - 84: Oo / I1Ii1I1 . IIiIIiIi11I1
    mMonitorInfo . wglog ( "mqtt Unexpected disconnection.  Reconnect" )
   try :
    mMonitorInfo . mqttclient . reconnect ( )
    if 67 - 67: Oo % ooOOO + iI1iII1I1I1i * I1I
    mMonitorInfo . mqttclient . subscribe ( 'OpenDoorCommand' , qos = 0 )
    mMonitorInfo . mqttclient . subscribe ( 'kaimenzhiling' , qos = 0 )
   except Exception as iIi1I1I :
    print ( iIi1I1I )
    mMonitorInfo . wglog ( iIi1I1I )
    if 79 - 79: IIiIIiIi11I1 * Oo / OooOoo
 @ staticmethod
 def mqtt_tryconnect ( ) :
  if 10 - 10: iI1iII1I1I1i / i1iiIII111 . IiIIii11Ii * i1i1i1111I
  if not ( wgGlobal . mqttHostName == "127.0.0.1" ) :
   try :
    if mMonitorInfo . mqttclientStatus == 0 :
     print ( "mqtt mqtt_tryconnect trying connect ." )
     O000 = mMonitorInfo . mqttclient
     O000 . connect ( wgGlobal . mqttHostName , wgGlobal . mqttHostPort , 5 )
     O000 . loop_start ( )
     O000 . subscribe ( 'OpenDoorCommand' , qos = 0 )
     O000 . subscribe ( 'kaimenzhiling' , qos = 0 )
     if 82 - 82: I11iiIi11i1I + i1
     mMonitorInfo . bSendByMQTT = True
     mMonitorInfo . printCHS (
 "2021-10-13 Introduced support for publishing information to MQTT server: [{0:s}:{1:d}] (Topics: Door status, card swipe, QR code, heartbeat packets, alarms, remote door opening records, others) [Door status: 1 indicates door open, 0 indicates door closed]" . format (
 wgGlobal . mqttHostName , wgGlobal . mqttHostPort ) )
     print ( "mqtt mqtt_tryconnect trying OK!" )
    elif mMonitorInfo . mqttclientStatus == - 1 :
     print ( "mqtt mqtt_tryconnect trying reconnect." )
     mMonitorInfo . mqttclient . reconnect ( )
     if 16 - 16: i1 / IIiIIiIi11I1
     mMonitorInfo . mqttclient . subscribe ( 'OpenDoorCommand' , qos = 0 )
     mMonitorInfo . mqttclient . subscribe ( 'kaimenzhiling' , qos = 0 )
     print ( "mqtt mqtt_tryconnect trying OK!" )
   except Exception as iIi1I1I :
    print ( "mqtt mqtt_tryconnect failed." )
    print ( iIi1I1I )
    mMonitorInfo . wglog ( iIi1I1I )
    if 4 - 4: i1I % iI1iII1I1I1i + oOO
    if 17 - 17: i1i1i1111I . ooo000 + IIiIIiIi11I1 * Ooo0Ooo % Ooo0Ooo
    if 74 - 74: OooOoo
    if 41 - 41: iI1iII1I1I1i . I11iiIi11i1I - OooOoo + i1I % OooOoo / Ooo0Ooo
 def mqtt_on_message ( client , userdata , msg ) :
  if 65 - 65: Oo
  try :
   IiI1 = str ( msg . payload . decode ( ) )
   if 29 - 29: oOo0O00 % ooOOO . I1I
   if 82 - 82: OooOoo + oOo0O00 * oOO % I11iiIi11i1I . I1Ii1I1
   if 76 - 76: I1Ii1I1 / IiI11Ii111 * IiI11Ii111 * i1I + Ii
   if len ( IiI1 ) < 9 :
    return
   i1oO00oO00O0O = IiI1 . split ( "," )
   if len ( i1oO00oO00O0O ) >= 2 :
    oOOOo0ooOOOO = int ( i1oO00oO00O0O [ 0 ] )
    IiI1I1IIiI1 = int ( i1oO00oO00O0O [ 1 ] )
    IIiII = 1
    iiI = 0
    if len ( i1oO00oO00O0O ) >= 3 :
     iiI = int ( i1oO00oO00O0O [ 2 ] )
    OoO00 = mMonitorInfo . wgConRPC4MQTT . getNewXid ( )
    oO0O = WGCommand . cmdremoteOpenDoorByCloudServer ( oOOOo0ooOOOO , IiI1I1IIiI1 , IIiII , iiI , OoO00 )
    if 64 - 64: Iii1i - ooo000 . I11iiIi11i1I
    if 59 - 59: i1I / IiIIii11Ii
    if wgGlobal . dataserverIP == "0.0.0.0" :
     mMonitorInfo . wgConRPC4MQTT . run ( "127.0.0.1" , wgGlobal . dataserverPort ,
 bytes ( oO0O ) )
    else :
     mMonitorInfo . wgConRPC4MQTT . run ( wgGlobal . dataserverIP , wgGlobal . dataserverPort ,
 bytes ( oO0O ) )
     if 7 - 7: oOo0O00
     if 64 - 64: IIiIIiIi11I1 * oOO + Oo . OooOoo - ooOOO
  except Exception as oO :
   pass
   if 94 - 94: IiIIii11Ii - ooo000 . Ii
   mMonitorInfo . wglog ( "1503" )
   mMonitorInfo . wglog ( oO )
   if 73 - 73: IiIIii11Ii / oOo0O00 % ooo000 . iI1iII1I1I1i % oOO
   if 36 - 36: IiI11Ii111 * OooOoo . ooo000 . i1iiIII111 + oOO
 @ staticmethod
 def wglog ( msg ) :
  if 47 - 47: IiI11Ii111 / I11iiIi11i1I
  if 52 - 52: Ii . OooOoo . i1iiIII111 * I11iiIi11i1I - iI1iII1I1I1i
  try :
   if wgGlobal . AllowMonitorInfowgroot_logger :
    if mMonitorInfo . wgroot_logger is None :
     if 20 - 20: OooOoo % IiI11Ii111 + I1Ii1I1 + IiI11Ii111 - oOo0O00
     O0OOoOO0oO0O0 = logging . getLogger ( "wg_log" )
     O0OOoOO0oO0O0 . setLevel ( logging . INFO )
     from logging . handlers import RotatingFileHandler
     if 89 - 89: IiI11Ii111 . ooOOO - i1I * i1 % Ii * i1I
     o000Oo0oo0 = RotatingFileHandler ( wgGlobal . wgcloudpath1001wg_logName , maxBytes = wgGlobal . wglogmaxBytes , backupCount = 3 , mode = 'a' , encoding = 'utf-8' )
     if 90 - 90: I1I
     IIiI1iI = logging . Formatter ( '%(asctime)s:%(message)s' )
     o000Oo0oo0 . setFormatter ( IIiI1iI )
     O0OOoOO0oO0O0 . addHandler ( o000Oo0oo0 )
     mMonitorInfo . wgroot_logger = O0OOoOO0oO0O0
     if 65 - 65: Ii - OooOoo * I1I % i1iiIII111 % IIiIIiIi11I1
     if 68 - 68: I1Ii1I1 + oOO - oOO + IiIIii11Ii
     if 87 - 87: ooOOO * IIiIIiIi11I1 % i1 / oOO + i1 + oOo0O00
     if 99 - 99: I1I * IIiIIiIi11I1 * i1iiIII111
     if 62 - 62: ooOOO % Oo + i1I
     if 87 - 87: ooo000 - OooOoo + Ii + i1i1i1111I + IiIIii11Ii
     if 57 - 57: IIiIIiIi11I1 + I1I / ooOOO % ooOOO % Oo / IiI11Ii111
     if 95 - 95: i1 / I11iiIi11i1I . i1 / Oo . Ooo0Ooo
    if msg is not None :
     mMonitorInfo . wgroot_logger . info (
 msg )
     if 43 - 43: Oo - OooOoo * oOO . Ooo0Ooo / IIiIIiIi11I1 * IIiIIiIi11I1
     if 84 - 84: i1iiIII111 + oOo0O00
     if 83 - 83: i1i1i1111I
  except Exception as oO :
   pass
   if 84 - 84: oOO / Ii * Ooo0Ooo / Ii / ooo000
  finally :
   pass
   if 64 - 64: oOo0O00 * Ii
   if 2 - 2: IiI11Ii111 % i1iiIII111 . oOo0O00
   if 59 - 59: I11iiIi11i1I % OooOoo - iI1iII1I1I1i % I1I + i1iiIII111 . I1Ii1I1
 def wglog20220618 ( info ) :
  if wgGlobal . testModeDebugPrint > 0 :
   mMonitorInfo . printCHS ( "{} UDP.{}\r" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , info ) )
   mMonitorInfo . wglog ( "1504" )
   mMonitorInfo . wglog (
 "{} UDP.{}\r" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , info ) )
   if 94 - 94: ooOOO * I1Ii1I1 * i1iiIII111 . oOo0O00
 AHTTP_host = "webapi.wiegand.com.cn"
 AHTTP_port = 61080
 AHTTP_uri = "/doorcontrol"
 if 73 - 73: I1Ii1I1 / ooo000 % I11iiIi11i1I - i1i1i1111I + Oo - I1Ii1I1
 if 18 - 18: i1 + ooOOO . i1 - iI1iII1I1I1i
 ASendQR = 0
 if 97 - 97: oOo0O00 + i1I % Iii1i
 ASendRecordSwipeInvalid = 0
 if 34 - 34: i1 + Oo . oOo0O00 - ooo000 / I11iiIi11i1I * oOo0O00
 ASendRecordSwipe = 0
 if 89 - 89: oOo0O00
 ASendRecordWarn = 0
 if 48 - 48: i1 / IIiIIiIi11I1 / iI1iII1I1I1i / IiI11Ii111 * IiIIii11Ii
 ASendRecordOther = 0
 if 54 - 54: IIiIIiIi11I1 % I1I % IiI11Ii111 / I11iiIi11i1I . I11iiIi11i1I - IiIIii11Ii
 if 10 - 10: Ii . I11iiIi11i1I % i1I / OooOoo % I1Ii1I1
 if 42 - 42: Oo - I1I * i1I * i1i1i1111I - I11iiIi11i1I
 BHTTPS_host = "app.wiegand.com.cn"
 BHTTPS_port = 80
 BHTTPS_uri = "/doorcontrol"
 if 58 - 58: iI1iII1I1I1i
 BSendRecordSwipeInvalid = 0
 if 17 - 17: iI1iII1I1I1i - Ii % iI1iII1I1I1i % oOo0O00 * Iii1i
 BSendQR = 0
 if 51 - 51: I1I . i1i1i1111I % Ii
 BSendRecordSwipe = 0
 if 55 - 55: i1i1i1111I * Ii % i1i1i1111I
 BSendRecordWarn = 0
 if 61 - 61: oOo0O00
 BSendRecordOther = 0
 if 53 - 53: Ooo0Ooo / IiIIii11Ii
 UDPQueue4AHTTP = deque ( )
 UDPQueue4BHTTP = deque ( )
 if 49 - 49: ooo000 - oOO . IiIIii11Ii / Oo
 def loadhttpconifg ( val ) :
  if 23 - 23: I11iiIi11i1I - i1 / Iii1i . iI1iII1I1I1i + oOO
  if 55 - 55: i1 - iI1iII1I1I1i / OooOoo + I1I + Oo
  mMonitorInfo . AHTTP_host = mMonitorInfo . getConfigString ( "127.0.0.1" ,
 "AHTTP_host" )
  if 5 - 5: IiI11Ii111 - i1 . i1i1i1111I / IiI11Ii111 . iI1iII1I1I1i . IiI11Ii111
  if 87 - 87: i1 . Ii * iI1iII1I1I1i - oOO / Ii / OooOoo
  if 65 - 65: i1I / i1I + IiI11Ii111
  if 99 - 99: i1 + OooOoo + I11iiIi11i1I * Ooo0Ooo / ooOOO + Ii
  IiiI = ( {
 "jsonrpc" : "2.0" ,
 "method" : "RealData" ,
 "params" : [
 {
 "SN" : 0 ,
 "QRCodeInformation" : "1001 start HTTP Push Service" ,
  'Time' : time . strftime ( '%Y-%m-%d %H:%M:%S' ) ,
  'DoorNO' : 1 ,
 'InExit' : 'In' ,
 'SerialNumber' : 1001
 }
 ] ,
 "id" : 1001
 } )
  if ( mMonitorInfo . AHTTP_host is not None ) and ( mMonitorInfo . AHTTP_host != 0 ) :
   mMonitorInfo . AHTTP_port = mMonitorInfo . getConfigInt ( None , "AHTTP_port" )
   mMonitorInfo . AHTTP_uri = mMonitorInfo . getConfigString ( "/" , "AHTTP_uri" )
   if 72 - 72: I1Ii1I1 * Ooo0Ooo * IIiIIiIi11I1 % IiIIii11Ii . ooo000
   if 68 - 68: Ooo0Ooo * OooOoo - oOo0O00
   mMonitorInfo . ASendQR = mMonitorInfo . getConfigInt ( 1 , "ASendQR" )
   if 49 - 49: IIiIIiIi11I1 % i1
   mMonitorInfo . ASendRecordSwipeInvalid = mMonitorInfo . getConfigInt ( 0 , "ASendRecordSwipeInvalid" )
   if 29 - 29: OooOoo * Ii - oOO
   mMonitorInfo . ASendRecordSwipe = mMonitorInfo . getConfigInt ( 0 , "ASendRecordSwipe" )
   if 53 - 53: I11iiIi11i1I % ooo000 / ooOOO / I1I
   mMonitorInfo . ASendRecordWarn = mMonitorInfo . getConfigInt ( 0 , "ASendRecordWarn" )
   if 43 - 43: iI1iII1I1I1i . i1i1i1111I + I1I % ooOOO . IiI11Ii111 - IiI11Ii111
   mMonitorInfo . ASendRecordOther = mMonitorInfo . getConfigInt ( 0 , "ASendRecordOther" )
   i1111 = mMonitorInfo . sendByHttp ( bytes ( json . dumps ( IiiI , sort_keys = False , indent = 4 ) , encoding = 'utf8' ) )
   if ( i1111 is not None ) and ( "Operation" in i1111 ) :
    if mMonitorInfo . AHTTP_port is None :
     if 28 - 28: i1iiIII111 / Iii1i + I1I / Oo
     mMonitorInfo . printCHS (
 "2022-06-18 Push to http Server: [{0:s}:80]" . format ( mMonitorInfo . AHTTP_host ) )
    else :
     mMonitorInfo . printCHS (
 "2022-06-18 Push to http Server: [{0:s}:{1:d}]" . format ( mMonitorInfo . AHTTP_host ,
 mMonitorInfo . AHTTP_port ) )
     if 96 - 96: IiI11Ii111 / I1I * i1 - oOO
     if 42 - 42: iI1iII1I1I1i - IiIIii11Ii % oOo0O00
    OOOo0OOoOO = threading . Thread ( target = DealUDPQueue4AHTTP )
    OOOo0OOoOO . start ( )
    mMonitorInfo . wglog ( "2022-06-18 Push to http Server: {0:s}" . format ( mMonitorInfo . AHTTP_host ) )
   else :
    if mMonitorInfo . AHTTP_host != "127.0.0.1" :
     if 53 - 53: i1I
     if 29 - 29: Iii1i / oOO + i1I % Ooo0Ooo * OooOoo + I1I
     if 43 - 43: i1I - i1
     if 64 - 64: i1iiIII111 * IIiIIiIi11I1 + IIiIIiIi11I1 * I1Ii1I1 - IiIIii11Ii
     if 22 - 22: oOO * IIiIIiIi11I1
     if 24 - 24: Ii * Ii % Ii . Ooo0Ooo . OooOoo
     OOOo0OOoOO = threading . Thread ( target = DealUDPQueue4AHTTP )
     OOOo0OOoOO . start ( )
     mMonitorInfo . wglog (
 "2024-08-21 Introduced support for publishing information to HTTP server: {0:s} [Enabled]" . format ( mMonitorInfo . AHTTP_host ) )
     if 81 - 81: OooOoo . Iii1i
  else :
   if 28 - 28: IiIIii11Ii - IiI11Ii111 . IiI11Ii111 * IIiIIiIi11I1 - Iii1i
   mMonitorInfo . ASendQR = 0
   mMonitorInfo . ASendRecordSwipeInvalid = 0
   if 1 - 1: Ooo0Ooo % Iii1i . ooOOO % oOo0O00 % Iii1i
   mMonitorInfo . ASendRecordSwipe = 0
   if 65 - 65: Ooo0Ooo * Oo / I11iiIi11i1I . i1 / IiI11Ii111 / I11iiIi11i1I
   mMonitorInfo . ASendRecordWarn = 0
   if 33 - 33: ooo000 + IiIIii11Ii . ooo000
   mMonitorInfo . ASendRecordOther = 0
   if 59 - 59: i1 / i1i1i1111I + Ii * ooo000 . ooo000
   if 49 - 49: Ii - Iii1i * I1Ii1I1 * IIiIIiIi11I1 . Ooo0Ooo
   if 83 - 83: Oo % Ii % i1
   if 28 - 28: IIiIIiIi11I1 % Ii + ooOOO . i1I % Ii * I1Ii1I1
   if 41 - 41: I1I
   if 76 - 76: ooo000 * i1i1i1111I
  mMonitorInfo . BHTTPS_host = mMonitorInfo . getConfigString ( None , "BHTTPS_host" )
  if mMonitorInfo . BHTTPS_host is not None :
   mMonitorInfo . BHTTPS_port = mMonitorInfo . getConfigInt ( None , "BHTTPS_port" )
   mMonitorInfo . BHTTPS_uri = mMonitorInfo . getConfigString ( "/" , "BHTTPS_uri" )
   if 39 - 39: i1 % i1I
   mMonitorInfo . BSendQR = mMonitorInfo . getConfigInt ( 1 , "BSendQR" )
   if 50 - 50: i1iiIII111 % OooOoo - i1i1i1111I * IiIIii11Ii % Oo . Ooo0Ooo
   mMonitorInfo . BSendRecordSwipeInvalid = mMonitorInfo . getConfigInt ( 0 , "BSendRecordSwipeInvalid" )
   if 30 - 30: i1iiIII111
   mMonitorInfo . BSendRecordSwipe = mMonitorInfo . getConfigInt ( 0 , "BSendRecordSwipe" )
   if 78 - 78: ooo000 % Iii1i + ooOOO * IIiIIiIi11I1 - i1
   mMonitorInfo . BSendRecordWarn = mMonitorInfo . getConfigInt ( 0 , "BSendRecordWarn" )
   if 46 - 46: Ooo0Ooo - i1I / ooo000 * IiI11Ii111 . oOo0O00
   mMonitorInfo . BSendRecordOther = mMonitorInfo . getConfigInt ( 0 , "BSendRecordOther" )
   if 32 - 32: i1i1i1111I . OooOoo + OooOoo - ooo000 * IiIIii11Ii + Oo
   if 12 - 12: oOo0O00
   i1111 = mMonitorInfo . sendByHttps ( bytes ( json . dumps ( IiiI , sort_keys = False , indent = 4 ) , encoding = 'utf8' ) )
   if i1111 is not None :
    mMonitorInfo . printCHS (
 "2022-06-18 Push to https Server: {0:s}" . format ( mMonitorInfo . BHTTPS_host ) )
    if 57 - 57: Oo + i1i1i1111I / I1Ii1I1
    OOOo0OOoOO = threading . Thread ( target = DealUDPQueue4BHTTP )
    OOOo0OOoOO . start ( )
    mMonitorInfo . wglog ( "2022-06-18 Push to https Server: {0:s}" . format ( mMonitorInfo . BHTTPS_host ) )
   else :
    print (
 " https Server not support: {0:s}" . format (
 mMonitorInfo . BHTTPS_host ) )
    mMonitorInfo . wglog (
 " https Server not support: {0:s}" . format (
 mMonitorInfo . BHTTPS_host ) )
    if 56 - 56: oOO % Ooo0Ooo % Iii1i . i1i1i1111I
  else :
   if 46 - 46: IiI11Ii111 . i1iiIII111 % Iii1i - Ooo0Ooo + ooo000
   mMonitorInfo . BSendQR = 0
   mMonitorInfo . BSendRecordSwipeInvalid = 0
   if 100 - 100: oOO
   mMonitorInfo . BSendRecordSwipe = 0
   if 32 - 32: I1Ii1I1 % ooo000 * OooOoo / oOo0O00 + ooOOO
   mMonitorInfo . BSendRecordWarn = 0
   if 64 - 64: I1Ii1I1 . Ooo0Ooo
   mMonitorInfo . BSendRecordOther = 0
   if 36 - 36: IIiIIiIi11I1 + IiIIii11Ii . i1 + IIiIIiIi11I1
   if 77 - 77: iI1iII1I1I1i / OooOoo . Iii1i + i1iiIII111 - IiI11Ii111
 def sendByHttp ( arrinfo ) :
  i1111 = None
  try :
   if mMonitorInfo . AHTTP_port is None :
    OOO00oOO0 = http . client . HTTPConnection ( host = mMonitorInfo . AHTTP_host , timeout = 3 )
   else :
    OOO00oOO0 = http . client . HTTPConnection ( host = mMonitorInfo . AHTTP_host , port = mMonitorInfo . AHTTP_port , timeout = 3 )
   i1oO00oO00O0O = arrinfo
   IiIII11 = json . loads ( arrinfo . decode ( "utf-8" ) )
   oOOOOo0 = IiIII11 [ "params" ] [ 0 ] [ "SN" ]
   if 26 - 26: I1Ii1I1 % oOO * iI1iII1I1I1i . I1I * iI1iII1I1I1i
   if 38 - 38: Ooo0Ooo . IIiIIiIi11I1 * oOo0O00 / ooOOO / OooOoo * Ooo0Ooo
   mMonitorInfo . wglog20220618 (
 "Server Send =>To HTTP Server {}:{}: {}" . format ( mMonitorInfo . AHTTP_host , mMonitorInfo . AHTTP_port ,
 IiIII11 ) )
   o0O0O000O = { "Content-type" : "application/json" , "Accept" : "application/json" }
   OOO00oOO0 . timeout = 3
   OOO00oOO0 . request ( "POST" , mMonitorInfo . AHTTP_uri , i1oO00oO00O0O , o0O0O000O )
   I111iii11Ii11 = OOO00oOO0 . getresponse ( )
   i1111 = I111iii11Ii11 . read ( ) . decode ( 'utf-8' )
   if 6 - 6: ooo000 * Ooo0Ooo + Iii1i . ooOOO . i1
   if 66 - 66: oOO % i1I % iI1iII1I1I1i / ooo000 + i1I - I11iiIi11i1I
   OOO00oOO0 . close ( )
   try :
    II = json . loads ( i1111 )
   except Exception as Iii1iIII :
    pass
    if 59 - 59: IIiIIiIi11I1 % IiIIii11Ii
    mMonitorInfo . wglog ( "1505" )
    mMonitorInfo . wglog ( i1111 )
    i1111 = None
    return i1111
    if 61 - 61: iI1iII1I1I1i
   mMonitorInfo . wglog20220618 (
 "Server Receive <=From HTTP Server: {}" . format ( II ) )
   if 93 - 93: i1iiIII111 - oOo0O00 . Oo . i1iiIII111 . Oo * I1Ii1I1
   if 95 - 95: I1Ii1I1 % oOO
   if 21 - 21: Ooo0Ooo % i1 - ooo000
   if 81 - 81: Ooo0Ooo / ooo000
   if 4 - 4: I1I % i1I - ooo000 - I1I . ooOOO / i1i1i1111I
   if 74 - 74: oOO
   if 24 - 24: I1I + Oo - ooOOO
   if 86 - 86: i1iiIII111 % ooo000 % ooo000 % i1I
   if 15 - 15: iI1iII1I1I1i + I1Ii1I1 % oOo0O00
   if 79 - 79: OooOoo . Oo + oOo0O00 / I1Ii1I1 . IiIIii11Ii
   if 89 - 89: ooo000 % Ooo0Ooo
   if 77 - 77: ooo000 % Ooo0Ooo
   if 24 - 24: oOO * I1Ii1I1 * I1Ii1I1 % IIiIIiIi11I1
   if 37 - 37: i1iiIII111 / iI1iII1I1I1i
   if 80 - 80: IiIIii11Ii
   if 2 - 2: I1I / oOO - IIiIIiIi11I1 % Ooo0Ooo
   if 88 - 88: iI1iII1I1I1i - I1Ii1I1 - i1I . Iii1i
   if 98 - 98: Ii + ooOOO
   if 29 - 29: I1Ii1I1 + i1I - IIiIIiIi11I1 * I11iiIi11i1I % Oo
   if 74 - 74: ooOOO
   if 100 - 100: oOO + iI1iII1I1I1i . I1I % Oo - i1
   if 39 - 39: iI1iII1I1I1i
   if 34 - 34: iI1iII1I1I1i . i1 . I1I
   O0oo = None
   if ( "result" in II ) and ( "Operation" in II [ "result" ] ) :
    O0oo = II [ "result" ]
   elif ( "result" in II ) and ( "Operation" in II [ "result" ] [ 0 ] ) :
    O0oo = II [ "result" ] [ 0 ]
   if O0oo is not None :
    if O0oo [ "Operation" ] == "RemoteOpenDoor" :
     oOOOo0ooOOOO = O0oo [ "ControllerSN" ]
     if oOOOo0ooOOOO == oOOOOo0 :
      IIiII = 1
      iiI = 0
      IiI1I1IIiI1 = O0oo [ "DoorNO" ]
      if 27 - 27: i1I
      if 45 - 45: IiI11Ii111 + I1Ii1I1 % oOo0O00 + i1I + ooOOO
      if 66 - 66: OooOoo . Ii - OooOoo + OooOoo * OooOoo / i1iiIII111
      OoO00 = mMonitorInfo . wgConRPC4MQTT . getNewXid ( )
      oO0O = WGCommand . cmdremoteOpenDoorByCloudServer ( oOOOo0ooOOOO , IiI1I1IIiI1 , IIiII , iiI , OoO00 )
      if 32 - 32: IIiIIiIi11I1 - i1I / ooOOO * Ooo0Ooo * iI1iII1I1I1i - i1i1i1111I
      if 82 - 82: ooo000
      if wgGlobal . dataserverIP == "0.0.0.0" :
       mMonitorInfo . wgConRPC4MQTT . run ( "127.0.0.1" , wgGlobal . dataserverPort ,
 bytes (
 oO0O ) )
      else :
       mMonitorInfo . wgConRPC4MQTT . run ( wgGlobal . dataserverIP , wgGlobal . dataserverPort ,
 bytes (
 oO0O ) )
       if 66 - 66: IiIIii11Ii + IIiIIiIi11I1 - i1I + i1i1i1111I . iI1iII1I1I1i * IiIIii11Ii
   return i1111
  except Exception as oO :
   pass
   if mMonitorInfo . AHTTP_port is not None :
    mMonitorInfo . wglog ( "1506" )
    mMonitorInfo . wglog ( oO )
    if 9 - 9: I1I - I1I - ooOOO - oOo0O00 + i1iiIII111
    if 71 - 71: i1I / i1iiIII111 - Ii * Oo . iI1iII1I1I1i
    if 3 - 3: I1Ii1I1
  return None
  if 57 - 57: Ooo0Ooo . OooOoo / oOo0O00 * I1Ii1I1
 def sendByHttps ( arrinfo ) :
  if 36 - 36: IiIIii11Ii
  i1111 = None
  try :
   if 33 - 33: IiIIii11Ii
   import ssl
   if 86 - 86: Ii / oOo0O00 - i1 * i1i1i1111I - Oo * Iii1i
   if 28 - 28: OooOoo . i1 % iI1iII1I1I1i % Iii1i
   if 2 - 2: Oo + OooOoo - i1i1i1111I - ooo000 / Oo . Oo
   if 41 - 41: OooOoo + OooOoo - OooOoo
   if 9 - 9: Iii1i % I1Ii1I1 % IiIIii11Ii - I1I * OooOoo
   if 53 - 53: iI1iII1I1I1i * i1i1i1111I / OooOoo . i1I . ooo000
   if 45 - 45: OooOoo + ooOOO / i1i1i1111I * i1
   oOo000o0OO0o = ssl . SSLContext ( ssl . PROTOCOL_SSLv23 )
   if 31 - 31: Oo - IIiIIiIi11I1 / IiI11Ii111 * i1i1i1111I
   if 68 - 68: IiIIii11Ii
   if 41 - 41: i1I - Ooo0Ooo
   if 47 - 47: I1Ii1I1 * i1i1i1111I - i1I . Iii1i . ooOOO
   if 28 - 28: Ii
   if 51 - 51: I11iiIi11i1I + Ooo0Ooo - ooo000 * oOO . oOO
   if 79 - 79: i1i1i1111I + oOo0O00
   OOO00oOO0 = http . client . HTTPSConnection ( host = mMonitorInfo . BHTTPS_host , context = oOo000o0OO0o ,
 port = mMonitorInfo . BHTTPS_port , timeout = 3 )
   i1oO00oO00O0O = arrinfo
   IiIII11 = json . loads ( arrinfo . decode ( "utf-8" ) )
   oOOOOo0 = IiIII11 [ "params" ] [ 0 ] [ "SN" ]
   if 11 - 11: OooOoo / i1iiIII111 % i1I - i1i1i1111I * oOo0O00
   if 90 - 90: i1 * i1 . Ooo0Ooo . Oo
   mMonitorInfo . wglog20220618 (
 "Server Send =>To HTTPS Server {}:{}: {}" . format ( mMonitorInfo . BHTTPS_host , mMonitorInfo . BHTTPS_port ,
 IiIII11 ) )
   if 59 - 59: Ii % I1Ii1I1 + Iii1i . OooOoo * Iii1i
   o0O0O000O = { "Content-type" : "application/json" , "Accept" : "application/json" }
   OOO00oOO0 . timeout = 3
   OOO00oOO0 . request ( "POST" , mMonitorInfo . BHTTPS_uri , i1oO00oO00O0O , o0O0O000O )
   I111iii11Ii11 = OOO00oOO0 . getresponse ( )
   i1111 = I111iii11Ii11 . read ( ) . decode ( 'utf-8' )
   if 21 - 21: I11iiIi11i1I + ooOOO % IiIIii11Ii / OooOoo
   if 96 - 96: Oo * i1iiIII111 . Ooo0Ooo
   if 35 - 35: ooOOO . i1I * i1i1i1111I * iI1iII1I1I1i - I11iiIi11i1I
   if 47 - 47: IIiIIiIi11I1
   OOO00oOO0 . close ( )
   try :
    II = json . loads ( i1111 )
   except Exception as Iii1iIII :
    pass
    if 73 - 73: I1Ii1I1 + ooOOO
    mMonitorInfo . wglog ( "1507" )
    mMonitorInfo . wglog ( i1111 )
    i1111 = None
    return i1111
    if 99 - 99: i1I
   mMonitorInfo . wglog20220618 ( "Server Receive <=From HTTPS Server" . format ( II ) )
   if 87 - 87: i1 . I11iiIi11i1I * Ii . i1 . IIiIIiIi11I1 . IiIIii11Ii
   if 50 - 50: Ii / oOO
   if 92 - 92: Ooo0Ooo * i1iiIII111 / Ooo0Ooo / i1iiIII111 * i1i1i1111I + i1I
   if 48 - 48: I11iiIi11i1I
   if 87 - 87: I1Ii1I1
   if 29 - 29: ooo000 . iI1iII1I1I1i . oOo0O00 + i1i1i1111I + oOO
   if 59 - 59: IiIIii11Ii
   if 26 - 26: oOo0O00 % IiI11Ii111 * i1
   if 60 - 60: IIiIIiIi11I1 % oOO / i1
   if 20 - 20: Ooo0Ooo
   if 4 - 4: IiIIii11Ii % Iii1i
   if 43 - 43: ooo000
   if 95 - 95: Oo + I11iiIi11i1I / Ooo0Ooo / Ii - ooOOO / i1i1i1111I
   if 6 - 6: Ooo0Ooo % IiIIii11Ii
   if 59 - 59: i1I . I11iiIi11i1I . ooo000 / i1I . Ii % Ooo0Ooo
   if 85 - 85: oOo0O00 / ooOOO
   if 41 - 41: i1iiIII111 * iI1iII1I1I1i + i1 + i1i1i1111I
   if 26 - 26: Oo % OooOoo
   if 14 - 14: iI1iII1I1I1i - i1iiIII111
   if 53 - 53: oOO
   if 46 - 46: oOo0O00 - iI1iII1I1I1i
   if 34 - 34: i1i1i1111I
   if 21 - 21: IiI11Ii111 + I1I . OooOoo + i1 . ooo000 + I11iiIi11i1I
   if 7 - 7: ooOOO + Iii1i / iI1iII1I1I1i - oOO % Oo / iI1iII1I1I1i
   if 14 - 14: Iii1i . Ii
   if 100 - 100: I1I / ooo000
   if 48 - 48: i1i1i1111I * i1I % i1i1i1111I + i1i1i1111I . iI1iII1I1I1i / OooOoo
   if 12 - 12: Ii . Ii - I1Ii1I1
   if 74 - 74: ooo000 * Iii1i - Ooo0Ooo - I1Ii1I1
   if 46 - 46: ooOOO / ooOOO
   if 58 - 58: IiI11Ii111 . IiI11Ii111
   if 79 - 79: oOo0O00 * IIiIIiIi11I1
   O0oo = None
   if ( "result" in II ) and ( "Operation" in II [ "result" ] ) :
    O0oo = II [ "result" ]
   elif ( "result" in II ) and ( "Operation" in II [ "result" ] [ 0 ] ) :
    O0oo = II [ "result" ] [ 0 ]
   if O0oo is not None :
    if O0oo [ "Operation" ] == "RemoteOpenDoor" :
     oOOOo0ooOOOO = O0oo [ "ControllerSN" ]
     if oOOOo0ooOOOO == oOOOOo0 :
      if 53 - 53: Ii - ooOOO . OooOoo - I1I - I11iiIi11i1I
      IiI1I1IIiI1 = O0oo [ "DoorNO" ]
      IIiII = 1
      iiI = 0
      if 32 - 32: Iii1i % IiIIii11Ii - oOO - IiIIii11Ii - I11iiIi11i1I % i1iiIII111
      if 50 - 50: Iii1i / IiI11Ii111 + i1
      OoO00 = mMonitorInfo . wgConRPC4MQTT . getNewXid ( )
      oO0O = WGCommand . cmdremoteOpenDoorByCloudServer ( oOOOo0ooOOOO , IiI1I1IIiI1 , IIiII , iiI , OoO00 )
      if 4 - 4: IIiIIiIi11I1 . IiIIii11Ii % i1I
      if 30 - 30: i1 . i1
      if wgGlobal . dataserverIP == "0.0.0.0" :
       mMonitorInfo . wgConRPC4MQTT . run ( "127.0.0.1" , wgGlobal . dataserverPort ,
 bytes (
 oO0O ) )
      else :
       mMonitorInfo . wgConRPC4MQTT . run ( wgGlobal . dataserverIP , wgGlobal . dataserverPort ,
 bytes (
 oO0O ) )
       if 35 - 35: Ii * i1I / IiIIii11Ii - I1Ii1I1 / i1
       if 76 - 76: IiIIii11Ii * Iii1i % IiIIii11Ii
       if 73 - 73: i1I / IIiIIiIi11I1 / oOo0O00 % IIiIIiIi11I1 / Ii
   return i1111
  except Exception as oO :
   pass
   mMonitorInfo . wglog ( "1508" )
   mMonitorInfo . wglog ( oO )
   if 12 - 12: i1
   if 78 - 78: I11iiIi11i1I . IIiIIiIi11I1
   if 1 - 1: I1I % i1iiIII111 / I1Ii1I1
  return None
  if 42 - 42: Iii1i
  if 19 - 19: OooOoo * I11iiIi11i1I . i1i1i1111I + ooo000 + i1I
  if 13 - 13: i1iiIII111 + I1Ii1I1 / Ooo0Ooo
  if 82 - 82: i1iiIII111 * oOO / IiI11Ii111 * IiIIii11Ii
 def getConfigString ( paramval , paramName ) :
  iI11Iii1 = configparser . ConfigParser ( allow_no_value = True )
  iI11Iii1 . read ( wgGlobal . wgcloudpath1001configfileName , encoding = "utf-8-sig" )
  if iI11Iii1 . has_option ( 'wgconf' , paramName ) :
   paramval = iI11Iii1 [ 'wgconf' ] [ paramName ]
  return paramval
  if 1 - 1: ooo000 % Ii % IiI11Ii111 / IiI11Ii111 + i1I / Oo
 def getConfigInt ( paramval , paramName ) :
  iI11Iii1 = configparser . ConfigParser ( allow_no_value = True )
  iI11Iii1 . read ( wgGlobal . wgcloudpath1001configfileName , encoding = "utf-8-sig" )
  if iI11Iii1 . has_option ( 'wgconf' , paramName ) :
   paramval = int ( iI11Iii1 [ 'wgconf' ] [ paramName ] )
  return paramval
  if 64 - 64: i1i1i1111I + i1
 def printCHS ( * args ) :
  if wgGlobal . printSupportChinese :
   try :
    print ( * args )
   except Exception as oO :
    pass
    if 45 - 45: i1i1i1111I / i1iiIII111 * iI1iII1I1I1i
   finally :
    pass
  else :
   if 2 - 2: i1 / i1i1i1111I * IiIIii11Ii
   try :
    if mMonitorInfo . wgchs_logger is None :
     if 33 - 33: Iii1i
     if 7 - 7: Ooo0Ooo - Ooo0Ooo / ooo000 - IiIIii11Ii
     if 70 - 70: IIiIIiIi11I1 . i1 % iI1iII1I1I1i / i1i1i1111I
     if 5 - 5: i1iiIII111 . Oo + i1i1i1111I
     if 44 - 44: I1Ii1I1 - i1i1i1111I
     if 71 - 71: i1iiIII111
     if 77 - 77: Iii1i - I1Ii1I1 - Ooo0Ooo % Ii / Oo
     if 43 - 43: Ooo0Ooo / oOO
     if 93 - 93: ooOOO % oOo0O00 * i1 + Ii . i1I - oOO
     if 63 - 63: IiIIii11Ii . Iii1i
     O0OOoOO0oO0O0 = logging . getLogger ( "wgchs_log" )
     O0OOoOO0oO0O0 . setLevel ( logging . INFO )
     from logging . handlers import RotatingFileHandler
     if 55 - 55: oOo0O00
     o000Oo0oo0 = RotatingFileHandler ( wgGlobal . wgcloudpath1001wgchs_logName , maxBytes = wgGlobal . wglogmaxBytes , backupCount = 3 , mode = 'a' , encoding = 'utf-8' )
     if 85 - 85: IIiIIiIi11I1 % Oo / I1I . oOo0O00 / IIiIIiIi11I1 . Oo
     IIiI1iI = logging . Formatter ( '%(asctime)s:%(message)s' )
     o000Oo0oo0 . setFormatter ( IIiI1iI )
     O0OOoOO0oO0O0 . addHandler ( o000Oo0oo0 )
     mMonitorInfo . wgchs_logger = O0OOoOO0oO0O0
    if args is not None :
     mMonitorInfo . wgchs_logger . info (
 * args )
   except Exception as oO :
    pass
    if 40 - 40: IIiIIiIi11I1 - ooOOO * oOO . ooo000
   finally :
    pass
  mMonitorInfo . wglog ( * args )
  if 24 - 24: IiIIii11Ii - iI1iII1I1I1i / Ii
 abccnt = 0
 if 34 - 34: ooOOO - ooOOO / Ii % OooOoo
 if 97 - 97: Oo * IiIIii11Ii . Ooo0Ooo % i1 % Ii % ooo000
 if 67 - 67: IIiIIiIi11I1 % i1 % oOo0O00 - i1i1i1111I
 if 51 - 51: I11iiIi11i1I . I11iiIi11i1I % IiI11Ii111 % Oo / I1Ii1I1 - I1Ii1I1
 if 28 - 28: Ii / Ooo0Ooo
 if 11 - 11: I1I - OooOoo * ooOOO % i1i1i1111I + ooo000 . oOO
 if 51 - 51: ooOOO + iI1iII1I1I1i % IiI11Ii111 . I11iiIi11i1I % Ooo0Ooo
 if 15 - 15: OooOoo / i1I % Oo % Oo
 if 73 - 73: oOo0O00
 if 69 - 69: ooOOO - IIiIIiIi11I1 - i1I
 if 78 - 78: I1Ii1I1 . ooo000 + IiI11Ii111 / IiI11Ii111
 if 88 - 88: Ii - i1iiIII111 - i1 * IIiIIiIi11I1 . IiIIii11Ii + Iii1i
 if 44 - 44: ooOOO + Oo - i1
 if 18 - 18: iI1iII1I1I1i * ooOOO + Ooo0Ooo
 if 78 - 78: I1I . I1I - IIiIIiIi11I1 - IiIIii11Ii % I11iiIi11i1I . I1Ii1I1
 if 9 - 9: I11iiIi11i1I * OooOoo - I11iiIi11i1I
 if 73 - 73: I1Ii1I1
 if 25 - 25: i1 . Ii
 if 59 - 59: IiIIii11Ii
 if 91 - 91: IiIIii11Ii + iI1iII1I1I1i
 if 65 - 65: Oo * Iii1i * IiIIii11Ii / IIiIIiIi11I1
 if 77 - 77: IIiIIiIi11I1 / oOO % IiIIii11Ii + I1Ii1I1
 if 34 - 34: i1i1i1111I * Iii1i + Ii - i1I / i1 / i1
 if 87 - 87: Ooo0Ooo + I11iiIi11i1I
 if 3 - 3: IIiIIiIi11I1 . I1Ii1I1 / Iii1i % ooOOO / oOo0O00 % ooOOO
 if 55 - 55: iI1iII1I1I1i + I1I + oOo0O00 - I11iiIi11i1I
 if 80 - 80: Oo % I11iiIi11i1I . IiIIii11Ii * oOO
 if 83 - 83: oOo0O00 % Oo + i1i1i1111I - ooOOO + i1iiIII111
 if 36 - 36: oOo0O00 * OooOoo / I11iiIi11i1I
 if 98 - 98: IiI11Ii111 . ooo000
 if 85 - 85: OooOoo * Iii1i * IIiIIiIi11I1
 if 38 - 38: ooo000 - Ii - i1I
 if 91 - 91: i1iiIII111 / i1 * oOO * IIiIIiIi11I1 * IiIIii11Ii
 if 65 - 65: oOO / oOo0O00 / Oo
 if 61 - 61: ooOOO * oOO
 if 98 - 98: i1iiIII111 * i1i1i1111I
 if 29 - 29: oOo0O00 / i1iiIII111 - IiIIii11Ii
 if 34 - 34: iI1iII1I1I1i + IIiIIiIi11I1 . i1I . IiI11Ii111 % i1i1i1111I
 if 61 - 61: Oo % ooo000
 if 68 - 68: Ii - OooOoo / I1I
 if 44 - 44: iI1iII1I1I1i % i1iiIII111 / I1Ii1I1 * i1i1i1111I
 if 63 - 63: I1Ii1I1 * Ii + Iii1i
 if 58 - 58: I1Ii1I1 / I1Ii1I1 % IIiIIiIi11I1
 if 98 - 98: OooOoo
 if 79 - 79: Ooo0Ooo * Ooo0Ooo - ooo000 - Iii1i
 memcurrentmaxval = 0
 if 5 - 5: IiIIii11Ii / i1iiIII111 . I1I % Iii1i . i1
 logWGAddrChangeCount = 0
 if 29 - 29: oOo0O00 + Oo / I11iiIi11i1I - oOo0O00 % i1i1i1111I / Ii
 @ staticmethod
 def getmem ( ) :
  O0000OO0o = 0
  try :
   import platform
   if platform . processor ( ) == 'aarch64' :
    return O0000OO0o
   import psutil
   O0000OO0o = int ( psutil . Process ( os . getpid ( ) ) . memory_info ( ) . rss / 1024 / 1024 )
  except Exception as oO :
   pass
   if 44 - 44: I1I + ooo000 / i1 . i1
  finally :
   pass
  return O0000OO0o
  if 94 - 94: Iii1i / i1I
 @ staticmethod
 def checkoverrun ( ) :
  if 65 - 65: IiIIii11Ii . Ii
  O0000OO0o = mMonitorInfo . getmem ( )
  if 49 - 49: oOO + Ii % Ii % Oo * Iii1i * Ii
  if 89 - 89: Ooo0Ooo
  if 57 - 57: oOO . IIiIIiIi11I1 + OooOoo * I1I
  if O0000OO0o > mMonitorInfo . memAllocMaxMB :
   print ( "Restart..." )
   mMonitorInfo . wglog ( "{} occupied memmory {} MB..." . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , O0000OO0o ) )
   mMonitorInfo . wglog ( "{} Restart..." . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) ) )
   I1i11I11 = sys . executable
   os . execl ( I1i11I11 , I1i11I11 , * sys . argv )
   sys . exit ( )
  if O0000OO0o > mMonitorInfo . memcurrentmaxval :
   mMonitorInfo . memcurrentmaxval = O0000OO0o
   mMonitorInfo . wglog ( "{} occupied memmory {} MB..." . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , O0000OO0o ) )
  if wgGlobal . testModeDebugPrint == 0 :
   if O0000OO0o > mMonitorInfo . memAllocMaxMB / 2 :
    print ( "{} occupied memmory {} MB..." . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) ,
 " too much memmory " ) )
    wgGlobal . testModeDebugPrint = 1
    if 90 - 90: Oo - I11iiIi11i1I
    if 93 - 93: oOo0O00 . Oo . I1I - I1I % ooOOO
 lastTimecheckAllControllersNotConnected = 0
 @ staticmethod
 def checkAllControllersNotConnected ( ) :
  if len ( mMonitorInfo . watchingController ) <= 0 :
   return
   if 67 - 67: Ooo0Ooo + oOo0O00
  iIi1IIiii1 = time . time ( )
  if abs ( iIi1IIiii1 - mMonitorInfo . lastTimecheckAllControllersNotConnected ) > 2 * 60 :
   if 12 - 12: i1I
   mMonitorInfo . lastTimecheckAllControllersNotConnected = iIi1IIiii1
   for ii11I1i1i in mMonitorInfo . watchingController :
    mMonitorInfo . watchingController [ ii11I1i1i ] . refreshTimeFrom1970 = iIi1IIiii1
    break
   return
  else :
   mMonitorInfo . lastTimecheckAllControllersNotConnected = iIi1IIiii1
  for ii11I1i1i in mMonitorInfo . watchingController :
   OOO0O0oOoOOOo = mMonitorInfo . watchingController [ ii11I1i1i ]
   if abs ( iIi1IIiii1 - OOO0O0oOoOOOo . refreshTimeFrom1970 ) < 5 * 60 :
    if 86 - 86: i1i1i1111I / i1i1i1111I % Oo * ooOOO
    if 83 - 83: oOo0O00 - ooOOO
    return
    if 60 - 60: Oo
  print ( "Restart..." )
  print ( "{} All Controllers Not Connected..." . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) ) )
  if 23 - 23: oOo0O00
  if 47 - 47: Ooo0Ooo + Oo * Ii . OooOoo . I1Ii1I1 * i1iiIII111
  mMonitorInfo . wglog ( "{} All Controllers Not Connected..." . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) ) )
  i11I1IiIiI1i = [ ]
  if 46 - 46: ooOOO % i1i1i1111I * i1iiIII111 + I1Ii1I1
  for ii11I1i1i in list ( mMonitorInfo . watchingController . keys ( ) ) :
   OOO0O0oOoOOOo = mMonitorInfo . watchingController [ ii11I1i1i ]
   OOoo0o = mMonitorInfo . detailOfDS ( OOO0O0oOoOOOo )
   i11I1IiIiI1i . append ( OOoo0o )
  print ( i11I1IiIiI1i )
  mMonitorInfo . wglog ( i11I1IiIiI1i )
  mMonitorInfo . wglog ( "{} Restart..." . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) ) )
  if 15 - 15: iI1iII1I1I1i - ooo000 + IIiIIiIi11I1 * Ooo0Ooo
  I1i11I11 = sys . executable
  os . execl ( I1i11I11 , I1i11I11 , * sys . argv )
  sys . exit ( )
  if 84 - 84: OooOoo . Ii
  if 21 - 21: Ooo0Ooo
  if 76 - 76: iI1iII1I1I1i % IiI11Ii111 / IiIIii11Ii - IiI11Ii111
 @ staticmethod
 def restartsoft ( ) :
  if 4 - 4: OooOoo * IIiIIiIi11I1 - Ooo0Ooo . Ii - ooOOO . i1iiIII111
  O0000OO0o = mMonitorInfo . getmem ( )
  if 2 - 2: I11iiIi11i1I * i1I * i1I * i1iiIII111 / I11iiIi11i1I % IiI11Ii111
  print ( "restartsoft ..." )
  mMonitorInfo . wglog ( "{} occupied memmory {} MB..." . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , O0000OO0o ) )
  mMonitorInfo . wglog ( "{}restartsoft ..." . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) ) )
  from twisted . internet import reactor
  if 13 - 13: i1 * IiIIii11Ii - ooo000 * OooOoo
  reactor . stop ( )
  I1i11I11 = sys . executable
  if 72 - 72: Iii1i . I1Ii1I1 * IIiIIiIi11I1 % I1Ii1I1 - i1i1i1111I
  time . sleep ( 1 )
  import subprocess
  subprocess . run ( I1i11I11 )
  sys . exit ( )
  if 97 - 97: i1 + ooOOO + I11iiIi11i1I . i1
 @ staticmethod
 def exitsoft ( ) :
  if 71 - 71: ooo000 - i1i1i1111I / iI1iII1I1I1i - iI1iII1I1I1i % IIiIIiIi11I1 . iI1iII1I1I1i
  O0000OO0o = mMonitorInfo . getmem ( )
  print ( os . getpid ( ) )
  print ( "exitsoft ..." )
  mMonitorInfo . wglog ( "{} occupied memmory {} MB..." . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , O0000OO0o ) )
  mMonitorInfo . wglog ( "{} exitsoft ..." . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) ) )
  from twisted . internet import reactor
  if 41 - 41: IIiIIiIi11I1
  reactor . stop ( )
  sys . exit ( )
  if 96 - 96: Oo . Ooo0Ooo - oOO . Iii1i % IiI11Ii111 . IiI11Ii111
 @ staticmethod
 def printMemInfo ( ) :
  if 82 - 82: oOO % iI1iII1I1I1i / i1iiIII111
  O0000OO0o = mMonitorInfo . getmem ( )
  mMonitorInfo . wglog ( "{} occupied memmory {} MB..." . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , O0000OO0o ) )
# dd678faae9ac167bc83abf78e5cb2f3f0688d3a3
