# cython:language_level=3
# python 3.7.9
from __future__ import print_function
if 82 - 82: Iii1i
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
if 31 - 31: i1I
if 9 - 9: IiI11Ii111 / oOo0O00 / IiIIii11Ii - I11iiIi11i1I - iI1iII1I1I1i
if 16 - 16: i1i1i1111I / i1iiIII111
if 3 - 3: i1 % i1 % i1i1i1111I . Ii * i1
if 9 - 9: i1iiIII111
import binascii
import configparser
import datetime
import logging
import shutil
import socket
import struct
import sys
import time
from collections import deque
from queue import Queue
if 10 - 10: ooOOO / IIiIIiIi11I1 * oOO / i1I / i1I
if 61 - 61: Ooo0Ooo - I1I
from twisted . internet import reactor
from twisted . internet import task
from twisted . internet . protocol import DatagramProtocol
from twisted . internet . threads import deferToThread
if 13 - 13: Ooo0Ooo
from . sm4 import CryptSM4 , SM4_ENCRYPT , SM4_DECRYPT
from . mMonitorInfo import mMonitorInfo
from . wgAppConfig import wgAppConfig
if 46 - 46: iI1iII1I1I1i - Ii * Oo * Ii
from . wgpacket import WGPacket , WGControllerinfo , WGTools , WGCommand , wgGlobal
if 52 - 52: Oo + I1I / oOO / OooOoo - I1Ii1I1 - ooOOO
if 60 - 60: iI1iII1I1I1i . oOO
from tinydb import TinyDB , Query
from . wgpacket import tdz
if 13 - 13: oOO
if 2 - 2: i1
class xid4mobile ( object ) :
 def __init__ ( self , oldxid , addr ) :
  self . xid = oldxid
  self . addr = addr
  self . currentTime = time . time ( )
  if 22 - 22: IIiIIiIi11I1 - ooo000 / I1Ii1I1 . ooo000
  if 1 - 1: iI1iII1I1I1i + Ooo0Ooo + oOO * IIiIIiIi11I1
class OpenDoorByVirtualCard ( object ) :
 controllerSN = 0
 recordDoorNO = 1
 inOrOut = 1
 virtualCardNO = 0
 if 20 - 20: I1I + Ii
 if 75 - 75: Ii % i1iiIII111 * Ii . IIiIIiIi11I1 % I11iiIi11i1I % I1Ii1I1
 if 8 - 8: I1Ii1I1 . IiI11Ii111 . i1 . Oo - i1I
class WGPCinfo ( object ) :
 commPID = 0
 ctickOfPC = 0
 refreshTimeFrom1970ofctickOfPC = time . time ( )
 pcUTC = 0
 if 32 - 32: Ii % i1i1i1111I % i1I - I11iiIi11i1I % i1iiIII111
 def __init__ ( self , data ) :
  self . ctickOfPC = struct . unpack_from ( "I" , data , 60 ) [ 0 ]
  self . refreshTimeFrom1970ofctickOfPC = time . time ( )
  if 34 - 34: i1iiIII111 * i1
  if 34 - 34: oOo0O00 / i1iiIII111 - Iii1i . iI1iII1I1I1i
  if 80 - 80: i1i1i1111I . I1I % ooOOO % IiIIii11Ii / i1i1i1111I
  if 32 - 32: I1Ii1I1 + oOO - oOo0O00
class WGControllerCenter ( DatagramProtocol ) :
 if 79 - 79: Iii1i % oOO * Oo + ooOOO / Oo . oOO
 testModeAllowAutoRemoteOpenDoor = 0
 logModeFileQR = 0
 logModeFileSwipe = 0
 if 20 - 20: IiI11Ii111 + i1iiIII111 / I1I
 logModeHourToClear = 3
 if 88 - 88: I11iiIi11i1I + ooOOO - i1i1i1111I . Ooo0Ooo * Ii + Iii1i
 logModeWeekToClear = 0
 if 43 - 43: ooOOO * I1Ii1I1
 if 95 - 95: Ooo0Ooo % Iii1i % i1i1i1111I . OooOoo
 if 70 - 70: IiIIii11Ii
 if 75 - 75: Ooo0Ooo / Ii / IiIIii11Ii + IiIIii11Ii . I1I
 commPID = [ ]
 dictPC = dict ( )
 if 88 - 88: Oo * IiIIii11Ii
 if 100 - 100: IiI11Ii111 - OooOoo * I1Ii1I1 / Ooo0Ooo / Iii1i
 commSM4 = 0
 commSM4Key = b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
 commSM4_PCNeed = 0
 crypt_sm4_enc = CryptSM4 ( )
 crypt_sm4_dec = CryptSM4 ( )
 if 23 - 23: Ooo0Ooo + i1 * I1Ii1I1 + Oo * Ii - IIiIIiIi11I1
 commTimeControl = 0
 if 29 - 29: IiIIii11Ii - oOo0O00
 if 30 - 30: I1I . ooo000
 if 43 - 43: ooOOO . I11iiIi11i1I + ooo000
 if 87 - 87: Iii1i + ooOOO . i1I / Ii + Oo
 if 77 - 77: i1iiIII111 + IiI11Ii111 - Oo % ooo000
 if 74 - 74: Ii + Ooo0Ooo
 if 1 - 1: I1I % Ooo0Ooo + i1iiIII111 . i1iiIII111 % Oo
 if 93 - 93: oOo0O00 % Ooo0Ooo * i1iiIII111
 if 52 - 52: oOO + I1I / ooo000 - I1Ii1I1 * i1I % oOo0O00
 if 52 - 52: oOo0O00 . I1I + i1I - i1iiIII111 % iI1iII1I1I1i
 if 57 - 57: I1I * IIiIIiIi11I1 % I1Ii1I1 * i1i1i1111I
 if 37 - 37: IiI11Ii111 * i1i1i1111I + oOo0O00 / I1I / OooOoo
 if 4 - 4: i1
 if 61 - 61: iI1iII1I1I1i . i1I - ooo000 / ooo000 - i1
 if 19 - 19: Iii1i * Ooo0Ooo . I1Ii1I1 / I11iiIi11i1I * Ii - oOO
 if 32 - 32: iI1iII1I1I1i
 if 18 - 18: I11iiIi11i1I * IiI11Ii111 % iI1iII1I1I1i + IiI11Ii111
 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
 if 54 - 54: Iii1i % ooo000 % Iii1i - IiIIii11Ii
 if 39 - 39: oOO - oOO * i1 % IIiIIiIi11I1
 if 29 - 29: IIiIIiIi11I1 - ooo000 . i1iiIII111
 if 86 - 86: I1Ii1I1 - OooOoo - oOO % ooo000 . i1I % Iii1i
 if 11 - 11: OooOoo - I1Ii1I1 - ooOOO . i1iiIII111 - iI1iII1I1I1i / i1iiIII111
 def __init__ ( self ) :
  if 44 - 44: Ooo0Ooo + i1i1i1111I + Iii1i - oOO
  super ( WGControllerCenter , self ) . __init__ ( )
  if 7 - 7: i1i1i1111I / Ii * Iii1i
  self . dictXid = dict ( )
  self . _Global_xid = 0
  self . _xid = 0
  self . verbose = 0
  if 32 - 32: IiI11Ii111 . OooOoo
  if 31 - 31: Oo - i1I
  if 28 - 28: ooOOO * I1Ii1I1 + IiI11Ii111 % Oo
  if 100 - 100: Oo + i1I
  self . UDPQueue4HeartBeatPacket = None
  self . UDPQueue4Mobile = None
  self . UDPQueue4ReplyFromController = None
  self . UDPQueue4QRCode = None
  self . UDPQueue4Dingyue = None
  if 4 - 4: ooo000 % I1I - i1i1i1111I
  self . UDPQueue4webAPI = None
  self . UDPQueue4QRwebAPI = None
  if 76 - 76: i1 * oOo0O00 . IiI11Ii111 * i1I . IiIIii11Ii . oOO
  self . UDPQueueFromWEBSocket = None
  if 55 - 55: i1i1i1111I + i1iiIII111 % Ooo0Ooo . Oo - IiIIii11Ii - iI1iII1I1I1i
  self . bytcmdQuey = None
  self . allowErrWrite4sendingBroadcast = 0
  self . dictControllers = dict ( )
  self . dictControllersSendDataTime = dict ( )
  self . UDPQueue4HeartBeatPacket = deque ( )
  self . UDPQueue4Mobile = deque ( )
  self . UDPQueue4QRCode = deque ( )
  self . UDPQueue4ReplyFromController = deque ( )
  self . UDPQueue4Dingyue = deque ( )
  self . UDPQueue4webAPI = deque ( )
  self . UDPQueue4QRwebAPI = deque ( )
  if 91 - 91: I1Ii1I1 - I11iiIi11i1I
  self . UDPQueueFromWEBSocket = deque ( )
  self . taskqueueWGControllerCenter = Queue ( )
  self . taskqueueWGControllerCenter4G = Queue ( )
  self . dictSendDataBuff4G = dict ( )
  self . dictControllersAllowSendDataTime4G = dict ( )
  self . dictControllersAllowSendXid4G = dict ( )
  if 84 - 84: oOO % iI1iII1I1I1i - Ooo0Ooo
  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
  if 63 - 63: IIiIIiIi11I1 / IIiIIiIi11I1 * Iii1i - oOo0O00 . i1
  if 52 - 52: oOo0O00 / i1I * IIiIIiIi11I1 + I11iiIi11i1I % Ooo0Ooo + oOO
  if 43 - 43: iI1iII1I1I1i * oOo0O00 + ooOOO
  if 30 - 30: I1I
  if 41 - 41: oOO
  if 98 - 98: I1I / IIiIIiIi11I1 / i1I + IiI11Ii111 % Oo + I1I
  if 38 - 38: I1Ii1I1 + oOo0O00
  if 2 - 2: OooOoo % Ii + oOO . OooOoo + IIiIIiIi11I1 * Oo
  if 2 - 2: IIiIIiIi11I1 + iI1iII1I1I1i - I1Ii1I1 + ooOOO . IIiIIiIi11I1
  if 15 - 15: ooo000
  if 63 - 63: i1I
 def startProtocol ( self ) :
  self . startnet ( )
  if 81 - 81: OooOoo . i1I / i1i1i1111I + Oo / Ooo0Ooo % IiI11Ii111
  if 77 - 77: I11iiIi11i1I / iI1iII1I1I1i - oOo0O00 - Ooo0Ooo % oOo0O00
 def startnet ( self ) :
  self . DealSendBroadCastToController ( )
  if 73 - 73: IiI11Ii111 . Oo * I1I / i1i1i1111I + I1Ii1I1
  if 31 - 31: i1i1i1111I % I1Ii1I1
  if 1 - 1: IiI11Ii111 - oOo0O00 - i1 . oOo0O00
  self . DealWGRecordLog ( )
  deferToThread ( self . DealMoreData )
  if wgGlobal . supportNXP4G > 0 :
   deferToThread ( self . DealMoreData_4G_SendDataToControllerThread )
  if wgGlobal . supportSendSyncInfo2025 > 0 :
   deferToThread (
 self . DealMoreData_SycInfo_SendDataToControllerThread2025 )
   if 91 - 91: iI1iII1I1I1i * i1 . ooOOO
   if 81 - 81: I1I * Oo - i1 % OooOoo * ooOOO
   if 19 - 19: Ii
   if 22 - 22: i1I % iI1iII1I1I1i + Oo
   if 60 - 60: ooo000 + I11iiIi11i1I + IIiIIiIi11I1 % i1i1i1111I - Ii % Ooo0Ooo
   if 95 - 95: ooOOO % i1i1i1111I . i1
   if 87 - 87: Iii1i % ooOOO * Ii % IIiIIiIi11I1 / I11iiIi11i1I
   if 84 - 84: I1Ii1I1 + Ooo0Ooo % IIiIIiIi11I1 * i1i1i1111I
   if 61 - 61: i1iiIII111 - Oo + I1Ii1I1
   if 43 - 43: IIiIIiIi11I1 * ooo000 + Ii % iI1iII1I1I1i
   if 12 - 12: i1iiIII111 + ooo000 . I11iiIi11i1I
   if 1 - 1: iI1iII1I1I1i % Ii - I11iiIi11i1I / IiI11Ii111 + iI1iII1I1I1i - Ii
   if 27 - 27: OooOoo % iI1iII1I1I1i + IIiIIiIi11I1
   if 16 - 16: IiI11Ii111
   if 31 - 31: oOo0O00 / Iii1i % Ooo0Ooo % i1 . iI1iII1I1I1i . Oo
   if 83 - 83: oOo0O00 - I11iiIi11i1I
   if 91 - 91: IIiIIiIi11I1 - i1 - iI1iII1I1I1i
   if 71 - 71: I1I - IiI11Ii111
   if 66 - 66: i1i1i1111I / Ooo0Ooo + I11iiIi11i1I + Iii1i + oOo0O00 + i1I
   if 75 - 75: OooOoo - oOO - IiIIii11Ii - oOO + ooo000 % iI1iII1I1I1i
   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
   if 46 - 46: OooOoo - I11iiIi11i1I / Ooo0Ooo
   if 73 - 73: I1Ii1I1 / i1i1i1111I / ooo000 % i1 % i1I - OooOoo
   if 30 - 30: ooOOO * ooOOO - Iii1i * iI1iII1I1I1i
   if 37 - 37: I1Ii1I1 % iI1iII1I1I1i . i1I + Ooo0Ooo + ooOOO * iI1iII1I1I1i
   if 39 - 39: IIiIIiIi11I1 - Oo
   if 31 - 31: IiIIii11Ii % oOo0O00 % oOo0O00 * Iii1i
   if 85 - 85: Iii1i + Ii % IIiIIiIi11I1 % oOo0O00
   if 100 - 100: IiIIii11Ii % i1
   if 82 - 82: ooOOO % OooOoo
   if 81 - 81: Ii
   if 40 - 40: i1I . OooOoo + oOo0O00 . i1iiIII111
   if 96 - 96: I1I / oOO / I11iiIi11i1I + I11iiIi11i1I
   if 35 - 35: IIiIIiIi11I1 + oOo0O00
   if 96 - 96: iI1iII1I1I1i . OooOoo . i1
   if 87 - 87: ooo000 * IiIIii11Ii % ooo000 . ooOOO . Oo % iI1iII1I1I1i
   if 48 - 48: ooOOO * ooo000 % IiIIii11Ii * i1 . Iii1i - IiI11Ii111
 def DealMoreData ( self ) :
  if 72 - 72: i1 % i1i1i1111I * iI1iII1I1I1i
  while True :
   Ooo = False
   try :
    if 5 - 5: Oo - i1 . oOO
    if 18 - 18: IiIIii11Ii - oOO * i1I - OooOoo
    if 54 - 54: IIiIIiIi11I1 . Ooo0Ooo % Ii + IiIIii11Ii * iI1iII1I1I1i / iI1iII1I1I1i
    if 31 - 31: IiIIii11Ii . IiIIii11Ii % Ii
    if 51 - 51: Oo / i1i1i1111I - I1I
    if 83 - 83: Iii1i % i1iiIII111 . OooOoo / I1I % oOO . I1I
    if 76 - 76: i1iiIII111 / OooOoo
    if 77 - 77: ooOOO
    if 19 - 19: ooOOO % I1Ii1I1
    if 15 - 15: OooOoo . IiIIii11Ii . i1I / Iii1i + ooOOO / Ii
    Ii1iIII11i = self . DealUDPQueue4HeartBeatPacket ( )
    oo000OO0ooO = ( self . DealUDPQueue4QRCode ( ) )
    OoO0OooO0ooo = ( self . DealUDPQueue4Mobile ( ) )
    O00OO00O = ( self . DealUDPQueue4ReplyFromController ( ) )
    i111iIIiIIII = ( self . DealUDPQueue4Dingyue ( ) )
    oOO0OOo = ( self . DealUDPQueueFromWEBSocket ( ) )
    Ooo = Ooo or Ii1iIII11i or oo000OO0ooO or OoO0OooO0ooo or O00OO00O or i111iIIiIIII or oOO0OOo
   except Exception as ooo :
    pass
    mMonitorInfo . wglog ( "1101" )
    mMonitorInfo . wglog (
 ooo )
   if not Ooo :
    time . sleep ( 0.001 )
    if 56 - 56: IiIIii11Ii
   if not Ooo :
    try :
     i11I1iII1I1 = self . taskqueueWGControllerCenter . get ( block = True )
     self . taskqueueWGControllerCenter . task_done ( )
    except Exception as IIIi11ii1Ii :
     pass
     if 14 - 14: IiIIii11Ii % ooOOO . i1I
     if 29 - 29: IiI11Ii111 % oOO % IiI11Ii111 . ooOOO
 class serial4GDataInfo ( object ) :
  def __init__ ( self , controllerSN , sid , bytescmd , addr ) :
   self . currentTime = time . time ( )
   self . controllerSN = controllerSN
   self . sid = sid
   self . bytescmd = bytescmd
   self . addr = addr
   if 4 - 4: oOo0O00 + i1iiIII111
 def sendSycInfo4G ( self ) :
  oo00 = time . time ( )
  o00o = False
  for iIIIiII1 in self . dictControllersSendDataTime . keys ( ) :
   if 42 - 42: i1i1i1111I % OooOoo . IiI11Ii111 / i1i1i1111I . ooOOO
   O0OOOo0oO = self . dictControllersSendDataTime . get ( iIIIiII1 )
   if 56 - 56: oOo0O00
   if 87 - 87: IIiIIiIi11I1 % oOo0O00 % i1 . IiI11Ii111 - Iii1i . I1I
   if oo00 - O0OOOo0oO > 90 :
    if 39 - 39: ooOOO / oOo0O00
    mMonitorInfo . wglog ( "???SN= {0:d} sendSycInfo4G--OK" . format ( iIIIiII1 ) )
    o00o = True
    if 42 - 42: Iii1i
    if 64 - 64: I1Ii1I1 - ooo000 / i1 % oOO % IiIIii11Ii * i1i1i1111I
    self . dictControllersSendDataTime [ iIIIiII1 ] = time . time ( )
    if 51 - 51: Ooo0Ooo . iI1iII1I1I1i . i1iiIII111 . Ooo0Ooo % ooo000 % Ooo0Ooo
    ooOo0O0O = [ 0x17 , 0x20 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
    if 12 - 12: i1 . i1I - I11iiIi11i1I - i1i1i1111I
    if 51 - 51: i1iiIII111 * i1iiIII111 / I1Ii1I1
    i1iII11iii = iIIIiII1
    ooOo0O0O [ 4 ] = iIIIiII1 & 0xff
    ooOo0O0O [ 5 ] = ( iIIIiII1 >> 8 ) & 0xff
    ooOo0O0O [ 6 ] = ( iIIIiII1 >> 16 ) & 0xff
    ooOo0O0O [ 7 ] = ( iIIIiII1 >> 24 ) & 0xff
    if 19 - 19: I1Ii1I1 / OooOoo % i1i1i1111I
    I11I11111 = 0
    for OOoO in ( 40 , 41 , 42 , 43 ) :
     ooOo0O0O [ OOoO ] = I11I11111 & 0xff
     I11I11111 = I11I11111 >> 8
     if 57 - 57: ooOOO + Ii % I11iiIi11i1I + oOo0O00 . iI1iII1I1I1i - Ii
     if 8 - 8: i1i1i1111I + i1i1i1111I * 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
     if 87 - 87: i1iiIII111 . i1iiIII111 . oOO . ooo000 * oOo0O00
     if 33 - 33: IiI11Ii111 * i1iiIII111 / i1I . OooOoo * oOo0O00 + ooo000
    if WGControllerCenter . commSM4 > 0 :
     ooOo0O0O = WGControllerCenter . commSM4_Enc ( ooOo0O0O )
    try :
     i1I1Ii = self . dictControllers [ i1iII11iii ] . ipport
     if wgGlobal . supportNXP4G > 0 :
      self . insertToSendBuffer ( i1iII11iii , I11I11111 , bytes ( ooOo0O0O ) , i1I1Ii )
     else :
      if 86 - 86: I11iiIi11i1I * Ooo0Ooo . IiIIii11Ii % IiIIii11Ii . I1Ii1I1 + I1I
      self . transport . write ( bytes ( ooOo0O0O ) , i1I1Ii )
    except Exception as ooo :
     pass
     mMonitorInfo . wglog ( "1102-C" )
     mMonitorInfo . wglog ( ooo )
  return o00o
  if 44 - 44: i1 / OooOoo / oOo0O00 . Oo
 def insertToSendBuffer ( self , controllerSN , sid , bytescmd , addr ) :
  if self . dictSendDataBuff4G . get ( controllerSN ) is None :
   self . dictSendDataBuff4G [ controllerSN ] = deque ( )
  self . dictSendDataBuff4G [ controllerSN ] . append ( self . serial4GDataInfo ( controllerSN , sid , bytescmd , addr ) )
  if self . taskqueueWGControllerCenter4G . empty ( ) :
   self . taskqueueWGControllerCenter4G . put ( 1001002 )
  pass
  if 65 - 65: I11iiIi11i1I * i1iiIII111 . OooOoo % ooo000 % OooOoo
 def SendDataToController4GPro ( self ) :
  o00o = False
  if 21 - 21: IiI11Ii111 * I1Ii1I1
  oo00 = time . time ( )
  for iIIIiII1 in self . dictSendDataBuff4G . keys ( ) :
   if self . dictSendDataBuff4G [ iIIIiII1 ] . __len__ ( ) > 0 :
    o00o = True
    oO00oO0O = self . dictSendDataBuff4G [ iIIIiII1 ] [ 0 ]
    ooOOoO00OO = self . dictControllersAllowSendDataTime4G . get ( oO00oO0O . controllerSN )
    O0Ooo0oOo0 = False
    if ooOOoO00OO is None :
     O0Ooo0oOo0 = True
    else :
     if oo00 > ooOOoO00OO :
      if oo00 < oO00oO0O . currentTime + 1 :
       O0Ooo0oOo0 = True
      else :
       self . dictSendDataBuff4G [ iIIIiII1 ] . popleft ( )
     else :
      Oo00oOooOO = self . dictControllersAllowSendXid4G [ oO00oO0O . controllerSN ]
      if Oo00oOooOO == 0 :
       pass
      elif self . dictXid . get ( Oo00oOooOO ) is None :
       O0Ooo0oOo0 = True
    if O0Ooo0oOo0 :
     try :
      self . transport . write ( oO00oO0O . bytescmd ,
 oO00oO0O . addr )
     except Exception as ooo :
      mMonitorInfo . wglog ( "1102-d" )
      mMonitorInfo . wglog ( ooo )
     self . dictControllersAllowSendDataTime4G [ oO00oO0O . controllerSN ] = oo00 + 0.2
     self . dictControllersAllowSendXid4G [ oO00oO0O . controllerSN ] = oO00oO0O . sid
     self . dictSendDataBuff4G [ iIIIiII1 ] . popleft ( )
  return o00o
  if 66 - 66: i1i1i1111I - i1
 def DealMoreData_4G_SendDataToControllerThread ( self ) :
  if 58 - 58: Ooo0Ooo . ooo000 . I11iiIi11i1I
  ooOooOo0 = time . time ( ) + 20
  while True :
   Ooo = False
   try :
    Ooo = Ooo or self . SendDataToController4GPro ( )
    if time . time ( ) > ooOooOo0 :
     Ii1iIII11i = self . sendSycInfo4G ( )
     Ooo = Ooo or Ii1iIII11i
     ooOooOo0 = time . time ( ) + 20
   except Exception as ooo :
    pass
    mMonitorInfo . wglog ( "1102a" )
    mMonitorInfo . wglog ( ooo )
   if not Ooo :
    time . sleep ( 0.001 )
    if 84 - 84: OooOoo / oOo0O00 . IIiIIiIi11I1
   if not Ooo :
    try :
     i11I1iII1I1 = self . taskqueueWGControllerCenter4G . get ( block = True )
     self . taskqueueWGControllerCenter4G . task_done ( )
    except Exception as IIIi11ii1Ii :
     pass
     if 90 - 90: IIiIIiIi11I1 * iI1iII1I1I1i
     if 79 - 79: i1i1i1111I
 def DealMoreData_SycInfo_SendDataToControllerThread2025 ( self ) :
  ooOooOo0 = time . time ( ) + 2
  while True :
   Ooo = False
   try :
    if time . time ( ) > ooOooOo0 :
     Ii1iIII11i = self . sendSycInfoToUDPController2025 ( )
     Ooo = Ooo or Ii1iIII11i
     ooOooOo0 = time . time ( ) + 2
   except Exception as ooo :
    pass
    mMonitorInfo . wglog ( "1102a" )
    mMonitorInfo . wglog ( ooo )
   if not Ooo :
    time . sleep ( 0.001 )
    if 3 - 3: OooOoo / IiI11Ii111 % I11iiIi11i1I
   if not Ooo :
    time . sleep ( 0.5 )
    if 55 - 55: oOo0O00
 def sendSycInfoToUDPController2025 ( self ) :
  oo00 = time . time ( )
  o00o = False
  if 31 - 31: Ii . Ooo0Ooo / IiI11Ii111
  for iIIIiII1 in self . dictControllers . keys ( ) :
   if 59 - 59: Oo
   o00o0oOOo0Oo = self . dictControllers . get ( iIIIiII1 )
   if 74 - 74: i1i1i1111I / IiIIii11Ii % I11iiIi11i1I . oOO
   if 65 - 65: Iii1i % IIiIIiIi11I1 - ooo000 . ooOOO + Iii1i
   if o00o0oOOo0Oo :
    if 46 - 46: IiIIii11Ii
    if 31 - 31: Oo * i1iiIII111 % Ii / oOO + I1Ii1I1 + iI1iII1I1I1i
    o00o = True
    if 90 - 90: I1Ii1I1 * i1i1i1111I / iI1iII1I1I1i * Ii
    if 38 - 38: I1I . Ii
    ooOo0O0O = [ 0x17 , 0xFA , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x55 , 0xAA , 0xAA , 0x55 , 0x02 ,
 0x05 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
    if 41 - 41: ooo000 % IIiIIiIi11I1 % ooOOO
    if 5 - 5: oOo0O00 / Ii + i1iiIII111 * Oo + Ooo0Ooo + ooo000
    i1iII11iii = iIIIiII1
    ooOo0O0O [ 4 ] = iIIIiII1 & 0xff
    ooOo0O0O [ 5 ] = ( iIIIiII1 >> 8 ) & 0xff
    ooOo0O0O [ 6 ] = ( iIIIiII1 >> 16 ) & 0xff
    ooOo0O0O [ 7 ] = ( iIIIiII1 >> 24 ) & 0xff
    if 96 - 96: i1iiIII111 - IIiIIiIi11I1 / IIiIIiIi11I1 * IiIIii11Ii
    I11I11111 = 0
    for OOoO in ( 40 , 41 , 42 , 43 ) :
     ooOo0O0O [ OOoO ] = I11I11111 & 0xff
     I11I11111 = I11I11111 >> 8
     if 67 - 67: Ooo0Ooo . Ooo0Ooo . IiI11Ii111
     if 24 - 24: i1iiIII111 + i1i1i1111I . oOo0O00 + iI1iII1I1I1i + IiI11Ii111
     if 92 - 92: iI1iII1I1I1i / iI1iII1I1I1i + IiIIii11Ii . IiI11Ii111
     if 56 - 56: Ii * ooo000 . IiIIii11Ii
     if 66 - 66: I1Ii1I1 * OooOoo . iI1iII1I1I1i % OooOoo . i1 . IiIIii11Ii
     if 47 - 47: Ii % OooOoo % iI1iII1I1I1i * IiIIii11Ii
     if 48 - 48: i1I . I11iiIi11i1I / ooo000 + i1iiIII111
     if 84 - 84: Oo / I1Ii1I1 . IIiIIiIi11I1
    if WGControllerCenter . commSM4 > 0 :
     ooOo0O0O = WGControllerCenter . commSM4_Enc ( ooOo0O0O )
    try :
     i1I1Ii = self . dictControllers [ i1iII11iii ] . ipport
     if 67 - 67: Oo % ooOOO + iI1iII1I1I1i * I1I
     if wgGlobal . supportNXP4G > 0 :
      pass
      if 79 - 79: IIiIIiIi11I1 * Oo / OooOoo
      if 10 - 10: iI1iII1I1I1i / i1iiIII111 . IiIIii11Ii * i1i1i1111I
      if 71 - 71: oOo0O00 + I1Ii1I1 / I11iiIi11i1I + Oo / I1I
      if 18 - 18: Iii1i - IiIIii11Ii
     else :
      if 71 - 71: iI1iII1I1I1i + OooOoo % i1i1i1111I % oOo0O00 . ooo000
      self . transport . write ( bytes ( ooOo0O0O ) , i1I1Ii )
    except Exception as ooo :
     pass
     mMonitorInfo . wglog ( "1102-C" )
     mMonitorInfo . wglog ( ooo )
  return o00o
  if 92 - 92: I11iiIi11i1I - Ooo0Ooo - i1i1i1111I % i1iiIII111 / i1i1i1111I * iI1iII1I1I1i
  if 60 - 60: IiIIii11Ii % oOO / i1I * OooOoo / I11iiIi11i1I - Ii
 @ staticmethod
 def setTestMode ( val ) :
  WGControllerCenter . testModeAllowAutoRemoteOpenDoor = val
  if 16 - 16: oOo0O00 / I1Ii1I1 / i1 + I11iiIi11i1I + oOo0O00
  if 11 - 11: oOO / OooOoo + oOo0O00
  if 79 - 79: I11iiIi11i1I . I1Ii1I1 * i1I % I1Ii1I1 / IiI11Ii111
 def setModeDebugPrint ( val ) :
  wgGlobal . testModeDebugPrint = val
  if 93 - 93: i1I + Iii1i . Ii . i1I * ooOOO
 def setCommPID ( val ) :
  I1iI11I1IIi = val . split ( "," )
  if len ( I1iI11I1IIi ) == 1 :
   WGControllerCenter . commPID = [ int ( I1iI11I1IIi [ 0 ] ) ]
  else :
   Oo0ooOOOO = [ ]
   for OOoO in I1iI11I1IIi :
    Oo0ooOOOO . append ( int ( OOoO ) )
   WGControllerCenter . commPID = Oo0ooOOOO
   if 27 - 27: OooOoo % i1iiIII111 + IiIIii11Ii
   if 52 - 52: I11iiIi11i1I + oOO
   if 14 - 14: iI1iII1I1I1i / ooOOO . iI1iII1I1I1i
 def setCommSM4 ( val ) :
  iiI = val . encode ( 'utf-8' )
  if len ( iiI ) > 0 :
   if 50 - 50: i1 - i1iiIII111 / i1iiIII111 % I1Ii1I1 / IIiIIiIi11I1
   OOooO0 = b'\xc9\xee\xdb\xda\xce\xa2\xb8\xfb\xca\xb5\xd2\xb5\xd3\xd0\xcf\xde'
   o0Ooo = CryptSM4 ( )
   O00OO0ooOoO = bytes ( binascii . unhexlify ( val ) )
   o0Ooo . set_key ( OOooO0 , SM4_DECRYPT )
   OoOo00o = o0Ooo . crypt_ecb ( O00OO0ooOoO )
   if 47 - 47: i1i1i1111I + I11iiIi11i1I - oOO - IiI11Ii111 + IiI11Ii111
   WGControllerCenter . commSM4 = 1
   I1iI11I1IIi = [ 0x0 , 0x0 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
   iII = 16
   if ( len ( OoOo00o ) < 16 ) :
    iII = len ( OoOo00o )
   for OOoO in range ( 0 , iII ) :
    I1iI11I1IIi [ OOoO ] = OoOo00o [ OOoO ]
   WGControllerCenter . commSM4Key = bytes ( I1iI11I1IIi )
   WGControllerCenter . crypt_sm4_enc . set_key ( WGControllerCenter . commSM4Key , SM4_ENCRYPT )
   WGControllerCenter . crypt_sm4_dec . set_key ( WGControllerCenter . commSM4Key , SM4_DECRYPT )
   if 44 - 44: OooOoo + IiI11Ii111 / ooo000 % Ii % Ii
 def commSM4_Enc ( val ) :
  if 5 - 5: i1iiIII111 * IIiIIiIi11I1
  return WGControllerCenter . crypt_sm4_enc . crypt_ecb ( val )
  if 67 - 67: IiI11Ii111 / OooOoo % IiI11Ii111 + i1iiIII111
 def commSM4_Dec ( val ) :
  return WGControllerCenter . crypt_sm4_dec . crypt_ecb ( val )
  if 21 - 21: oOo0O00 % i1iiIII111 % I11iiIi11i1I % oOO
 def commTimeControl_Enc ( val , cticks , refrestime ) :
  OoOO0oO0O = time . time ( ) - refrestime + 5
  OoOO0oO0O = cticks + int ( ( OoOO0oO0O ) * 50 )
  WGTools . longToByte ( OoOO0oO0O , val , 60 , 4 )
  if 93 - 93: Iii1i * IIiIIiIi11I1 % i1I + i1 % Ii * i1I
 def commTimeStamp_Enc ( val , wginfo ) :
  o000Oo0oo0 = int ( datetime . datetime . now ( ) . timestamp ( ) )
  if wginfo . timestampOfCon == 0 or wginfo . timestampOfCon + 3600 * 24 * 365 < o000Oo0oo0 :
   return
  if wginfo . timestampOfCon + 60 * 45 < o000Oo0oo0 or wginfo . timestampOfCon > o000Oo0oo0 + 60 * 45 :
   if wgAppConfig . timeStampEnable == 1 :
    return
  o000Oo0oo0 = o000Oo0oo0 - wginfo . refreshTimeFrom1970ofctickOfCon
  iI = int ( wginfo . timestampOfCon + o000Oo0oo0 )
  if 41 - 41: Ooo0Ooo / I1I * I11iiIi11i1I - IiI11Ii111
  WGTools . longToByte ( iI , val , 60 , 4 )
  if 61 - 61: Ii * OooOoo * I1I % i1iiIII111 % IIiIIiIi11I1 * I11iiIi11i1I
  if 49 - 49: iI1iII1I1I1i / i1iiIII111 % oOO
  if 46 - 46: 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 43 - 43: Oo - OooOoo * oOO . Ooo0Ooo / IIiIIiIi11I1 * IIiIIiIi11I1
  if 84 - 84: i1iiIII111 + oOo0O00
  if 83 - 83: i1i1i1111I
  if 84 - 84: oOO / Ii * Ooo0Ooo / Ii / ooo000
  if 64 - 64: oOo0O00 * Ii
  if 2 - 2: IiI11Ii111 % i1iiIII111 . oOo0O00
  if 59 - 59: I11iiIi11i1I % OooOoo - iI1iII1I1I1i % I1I + i1iiIII111 . I1Ii1I1
  if 94 - 94: ooOOO * I1Ii1I1 * i1iiIII111 . oOo0O00
  if 73 - 73: I1Ii1I1 / ooo000 % I11iiIi11i1I - i1i1i1111I + Oo - I1Ii1I1
  if 18 - 18: i1 + ooOOO . i1 - iI1iII1I1I1i
  if 97 - 97: oOo0O00 + i1I % Iii1i
  if 34 - 34: i1 + Oo . oOo0O00 - ooo000 / I11iiIi11i1I * oOo0O00
  if 89 - 89: oOo0O00
  if 48 - 48: i1 / IIiIIiIi11I1 / iI1iII1I1I1i / IiI11Ii111 * IiIIii11Ii
  if 54 - 54: IIiIIiIi11I1 % I1I % IiI11Ii111 / I11iiIi11i1I . I11iiIi11i1I - IiIIii11Ii
  if 10 - 10: Ii . I11iiIi11i1I % i1I / OooOoo % I1Ii1I1
 def getNewXid ( self ) :
  self . _Global_xid = self . _Global_xid + 1
  if ( self . _Global_xid >= 0x4fffffff ) or ( self . _Global_xid < 0x40000001 ) :
   self . _Global_xid = 0x40000001
  self . _xid = self . _Global_xid
  return self . _Global_xid
  if 42 - 42: Oo - I1I * i1I * i1i1i1111I - I11iiIi11i1I
 def isConnected ( self , sn ) :
  oo0OO0o0O = self . dictControllers . get ( sn )
  if oo0OO0o0O is None :
   return False
  elif abs ( time . time ( ) - oo0OO0o0O . refreshTimeFrom1970 ) < 60 * 5 :
   return True
  return False
  if 87 - 87: Iii1i * ooOOO - Iii1i
  if 96 - 96: i1i1i1111I % Ii
 def addToUDPQueue4webAPI ( self , data ) :
  if wgAppConfig . ACTIVE_UDPQueue4webAPI :
   if len ( self . UDPQueue4webAPI ) > 1000 :
    self . UDPQueue4webAPI . popleft ( )
   self . UDPQueue4webAPI . append ( data )
   if 55 - 55: i1i1i1111I * Ii % i1i1i1111I
   if 61 - 61: oOo0O00
 def addToUDPQueue4QRwebAPI ( self , data ) :
  if wgAppConfig . ACTIVE_UDPQueue4QRwebAPI :
   if len ( self . UDPQueue4QRwebAPI ) > 1000 :
    self . UDPQueue4QRwebAPI . popleft ( )
   self . UDPQueue4QRwebAPI . append ( data )
   if 53 - 53: Ooo0Ooo / IiIIii11Ii
 def logSend ( self , data , addr ) :
  if wgGlobal . allowprint :
   OOo000o0 = [ '%02X' % i for i in data ]
   wgAppConfig . logdebug ( "m1001CloudServerUDP send to %s DataLen=%d HexData: %s" % (
 addr , len ( data ) , " " . join ( OOo000o0 ) ) )
   if 45 - 45: I1Ii1I1
 def checkAutoAdjustTime ( self , wginfo ) :
  if wgGlobal . bNeedAutoAdjustTime :
   if not abs (
 time . time ( ) - wginfo . timestampOfCon ) < 5 :
    print ( "wgGlobal.bNeedAutoAdjustTime" )
    ooooOO000O0Oo = 1
    I11I11111 = self . getNewXid ( )
    ooOo0O0O = WGCommand . cmdAdjustTime ( wginfo . controllerSN , None , I11I11111 )
    ooOo0O0O [ 0 ] = 0x17
    if 32 - 32: OooOoo + I1I + Oo * Ii
    if 85 - 85: Iii1i % I1I / Oo . IiI11Ii111
    if 5 - 5: Ii % Ii / iI1iII1I1I1i - i1
    if 70 - 70: OooOoo . I11iiIi11i1I
    if wgAppConfig . timeStampEnable > 0 :
     WGControllerCenter . commTimeStamp_Enc ( ooOo0O0O , wginfo )
     for OOoO in ( 56 , 57 , 58 , 59 ) :
      ooOo0O0O [ OOoO ] = ooOo0O0O [ OOoO + 4 ]
     ooOo0O0O [ 55 ] = 0xA5
     ooOo0O0O [ 54 ] = 0xA5
     if 38 - 38: i1I * i1iiIII111
    if WGControllerCenter . commSM4 > 0 :
     ooOo0O0O = WGControllerCenter . commSM4_Enc ( ooOo0O0O )
    try :
     i1I1Ii = wginfo . ipport
     if wgGlobal . supportNXP4G > 0 :
      self . insertToSendBuffer ( wginfo . controllerSN , I11I11111 , bytes ( ooOo0O0O ) , i1I1Ii )
     else :
      self . transport . write ( bytes ( ooOo0O0O ) , i1I1Ii )
      if 74 - 74: i1iiIII111 * oOo0O00 / I11iiIi11i1I / Ooo0Ooo / oOo0O00
      if 36 - 36: oOO
     self . logSend ( ooOo0O0O , i1I1Ii )
    except Exception as ooo :
     pass
     mMonitorInfo . wglog ( "1102" )
     mMonitorInfo . wglog (
 ooo )
     if 76 - 76: Ooo0Ooo / IIiIIiIi11I1 % IiIIii11Ii . ooo000 * i1iiIII111 % Ooo0Ooo
     if 53 - 53: ooo000 + I1Ii1I1
    mMonitorInfo . wglog (
 "Server => Controller Auto Adjust Time, Controller SN={0:d} {1} Old Time={2}" . format ( wginfo . controllerSN ,
 wginfo . ipport ,
 wginfo . timeOfCon ) )
   pass
   if 97 - 97: i1 - oOo0O00 / OooOoo * Ii - oOO
   if 53 - 53: I11iiIi11i1I % ooo000 / ooOOO / I1I
 def DealUDPQueue4HeartBeatPacket ( self ) :
  o00o = False
  while True :
   if self . UDPQueue4HeartBeatPacket . __len__ ( ) > 0 :
    o00o = True
    if 43 - 43: iI1iII1I1I1i . i1i1i1111I + I1I % ooOOO . IiI11Ii111 - IiI11Ii111
    i1111 = self . UDPQueue4HeartBeatPacket . popleft ( )
    if 28 - 28: i1iiIII111 / Iii1i + I1I / Oo
    o00oOo0OOOO00 = i1111 . commandData
    if 46 - 46: IiIIii11Ii + IIiIIiIi11I1 % iI1iII1I1I1i
    i1I1Ii = i1111 . ipport
    if 13 - 13: i1iiIII111 - IiIIii11Ii / Ooo0Ooo + i1I . OooOoo / Iii1i
    if 34 - 34: i1I % Ooo0Ooo * OooOoo + i1iiIII111 / i1
    o00o0oOOo0Oo = WGControllerinfo ( o00oOo0OOOO00 , i1I1Ii )
    if 49 - 49: IIiIIiIi11I1 / i1iiIII111 % IIiIIiIi11I1 + IIiIIiIi11I1 * iI1iII1I1I1i
    oo0OO0o0O = self . dictControllers . get ( o00o0oOOo0Oo . controllerSN )
    Ii11 = mMonitorInfo . updateDSInfo ( o00o0oOOo0Oo . controllerSN , o00oOo0OOOO00 )
    if Ii11 is not None :
     if 63 - 63: Ii % I11iiIi11i1I
     if 5 - 5: Ii
     if 98 - 98: Ooo0Ooo
     if 18 - 18: i1i1i1111I / OooOoo * I1I . iI1iII1I1I1i % Ii + IiI11Ii111
     if 82 - 82: IIiIIiIi11I1 % IIiIIiIi11I1 * Iii1i . oOO % Iii1i - Iii1i
     if 68 - 68: oOO + Iii1i + Ooo0Ooo % Oo / I11iiIi11i1I . OooOoo
     if 31 - 31: I11iiIi11i1I % ooOOO
     pass
    if oo0OO0o0O is None :
     if not wgGlobal . checkconstrollersWhitelist ( o00o0oOOo0Oo . controllerSN ) :
      continue
     self . dictControllers [ o00o0oOOo0Oo . controllerSN ] = o00o0oOOo0Oo
     self . dictControllersSendDataTime [ o00o0oOOo0Oo . controllerSN ] = 0
     if 46 - 46: i1i1i1111I - ooo000 + iI1iII1I1I1i
     if 73 - 73: i1 * oOo0O00
     if 88 - 88: Ii
     if 12 - 12: ooo000 - IIiIIiIi11I1 % Iii1i . I1Ii1I1
     if 11 - 11: i1iiIII111 - Oo % Ii % i1
     if 28 - 28: IIiIIiIi11I1 % Ii + ooOOO . i1I % Ii * I1Ii1I1
     if 41 - 41: I1I
     if 76 - 76: ooo000 * i1i1i1111I
     if 39 - 39: i1 % i1I
     if 50 - 50: i1iiIII111 % OooOoo - i1i1i1111I * IiIIii11Ii % Oo . Ooo0Ooo
     i111IIi = ""
     if ( o00oOo0OOOO00 [ 50 ] & 0x40 ) == 0x40 :
      i111IIi = "-By_4G"
     elif ( o00oOo0OOOO00 [ 50 ] & 0x20 ) == 0x20 :
      i111IIi = "-By_WIFI"
     if i111IIi == "" :
      mMonitorInfo . printCHS (
 "UDP. add controller SN= {0:d} {1} No.{2} [{3}] from {4}" . format ( o00o0oOOo0Oo . controllerSN ,
 o00o0oOOo0Oo . ipport ,
 len ( self . dictControllers ) ,
 time . strftime (
 '%Y-%m-%d %H:%M:%S' ) ,
 self . transport . getHost ( ) ) )
      if 82 - 82: IIiIIiIi11I1 - IiIIii11Ii / oOO
      if 49 - 49: i1I / ooo000 * IiI11Ii111 . oOo0O00
      if 32 - 32: i1i1i1111I . OooOoo + OooOoo - ooo000 * IiIIii11Ii + Oo
      if 12 - 12: oOo0O00
      mMonitorInfo . wglog (
 "UDP. add controller SN= {0:d} {1} No.{2} [{3}]" . format ( o00o0oOOo0Oo . controllerSN , o00o0oOOo0Oo . ipport ,
 len ( self . dictControllers ) ,
 time . strftime (
 '%Y-%m-%d %H:%M:%S' ) ) )
     else :
      mMonitorInfo . printCHS (
 "UDP. add controller SN= {0:d} {1} No.{2} [{3}] from {4}" . format ( o00o0oOOo0Oo . controllerSN ,
 o00o0oOOo0Oo . ipport ,
 len ( self . dictControllers ) ,
 time . strftime (
 '%Y-%m-%d %H:%M:%S' ) ,
 self . transport . getHost ( ) ) + i111IIi )
      if 57 - 57: Oo + i1i1i1111I / I1Ii1I1
      if 56 - 56: oOO % Ooo0Ooo % Iii1i . i1i1i1111I
      if 46 - 46: IiI11Ii111 . i1iiIII111 % Iii1i - Ooo0Ooo + ooo000
      if 100 - 100: oOO
      mMonitorInfo . wglog (
 "UDP. add controller SN= {0:d} {1} No.{2} [{3}]" . format ( o00o0oOOo0Oo . controllerSN , o00o0oOOo0Oo . ipport ,
 len ( self . dictControllers ) ,
 time . strftime (
 '%Y-%m-%d %H:%M:%S' ) ) + i111IIi )
     self . checkAutoAdjustTime ( o00o0oOOo0Oo )
    else :
     if 32 - 32: I1Ii1I1 % ooo000 * OooOoo / oOo0O00 + ooOOO
     if 64 - 64: I1Ii1I1 . Ooo0Ooo
     if 36 - 36: IIiIIiIi11I1 + IiIIii11Ii . i1 + IIiIIiIi11I1
     if 77 - 77: iI1iII1I1I1i / OooOoo . Iii1i + i1iiIII111 - IiI11Ii111
     if 49 - 49: i1iiIII111 - IiI11Ii111 - OooOoo
     if 39 - 39: I1I % i1iiIII111 - I1Ii1I1
     if oo0OO0o0O . ipport != o00o0oOOo0Oo . ipport :
      O000O0 = False
      if 32 - 32: ooOOO - IiIIii11Ii - Oo
      if not abs (
 time . time ( ) - oo0OO0o0O . refreshTimeFrom1970 ) < 95 :
       if 73 - 73: oOO % I1Ii1I1
       if 88 - 88: iI1iII1I1I1i . I1I * oOo0O00 - i1i1i1111I * Ooo0Ooo
       O000O0 = True
      else :
       if mMonitorInfo . allchangePortTime > 0 :
        if mMonitorInfo . allchangePortTime + 3 > time . time ( ) :
         O000O0 = True
         if 87 - 87: oOo0O00 / ooOOO / OooOoo * Ooo0Ooo
         if 49 - 49: iI1iII1I1I1i
         if 77 - 77: ooo000 % I11iiIi11i1I % Ooo0Ooo * oOO
         if 5 - 5: oOO * i1i1i1111I % Oo
         if 99 - 99: IiIIii11Ii * I1Ii1I1
         if 83 - 83: i1I . ooo000 * Ooo0Ooo + Iii1i . Oo
        else :
         mMonitorInfo . allchangePortTime = 0
         if 34 - 34: I11iiIi11i1I % oOO
         if 75 - 75: i1 % IiIIii11Ii - iI1iII1I1I1i - i1I * I11iiIi11i1I * OooOoo
       if o00o0oOOo0Oo . ipport [ 1 ] == wgGlobal . dataserverPort + 1 :
        if 45 - 45: IIiIIiIi11I1
        O000O0 = True
       elif o00o0oOOo0Oo . ipport [ 1 ] == 60000 :
        if oo0OO0o0O . ipport [ 1 ] != wgGlobal . dataserverPort + 1 :
         if 14 - 14: i1i1i1111I - OooOoo . IiIIii11Ii
         O000O0 = True
       else :
        if oo0OO0o0O . ipport [ 1 ] != wgGlobal . dataserverPort + 1 :
         if oo0OO0o0O . ipport [ 1 ] != 60000 :
          if 40 - 40: I1I - IIiIIiIi11I1 % IiIIii11Ii
          O000O0 = True
          if 61 - 61: iI1iII1I1I1i
          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 O000O0 :
       if 37 - 37: i1iiIII111 / iI1iII1I1I1i
       mMonitorInfo . logWGAddrChangeCount = mMonitorInfo . logWGAddrChangeCount + 1
       if mMonitorInfo . logWGAddrChangeCount < 10000 or wgGlobal . testModeDebugPrint > 0 :
        i111IIi = ""
        if ( o00oOo0OOOO00 [ 50 ] & 0x40 ) == 0x40 :
         i111IIi = "-By_4G"
        elif ( o00oOo0OOOO00 [ 50 ] & 0x20 ) == 0x20 :
         i111IIi = "-By_WIFI"
         if 80 - 80: IiIIii11Ii
        if i111IIi == "" :
         mMonitorInfo . wglog (
 "UDP. {0:d} new ip address= {1}  [{2}]" . format ( o00o0oOOo0Oo . controllerSN ,
 o00o0oOOo0Oo . ipport ,
 time . strftime (
 '%Y-%m-%d %H:%M:%S' ) ) )
        else :
         mMonitorInfo . wglog (
 "UDP. {0:d} new ip address= {1}  [{2}]" . format ( o00o0oOOo0Oo . controllerSN ,
 o00o0oOOo0Oo . ipport ,
 time . strftime (
 '%Y-%m-%d %H:%M:%S' ) ) + i111IIi )
         if 2 - 2: I1I / oOO - IIiIIiIi11I1 % Ooo0Ooo
       elif mMonitorInfo . logWGAddrChangeCount == 10000 :
        mMonitorInfo . wglog (
 "UDP. {0:d} new ip address= {1}  [{2}]" . format ( o00o0oOOo0Oo . controllerSN ,
 o00o0oOOo0Oo . ipport ,
 time . strftime (
 '%Y-%m-%d %H:%M:%S' ) ) + "--Over 10000" )
        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
      else :
       continue
       if 39 - 39: iI1iII1I1I1i
       if 34 - 34: iI1iII1I1I1i . i1 . I1I
       if 95 - 95: IiIIii11Ii * IiI11Ii111 * Ooo0Ooo * IiI11Ii111 / OooOoo
       if 27 - 27: i1I . IiIIii11Ii
       if 69 - 69: oOO % i1iiIII111 / oOo0O00
       if 38 - 38: I11iiIi11i1I + Oo * Ooo0Ooo / ooOOO . OooOoo
     self . dictControllers [ o00o0oOOo0Oo . controllerSN ] = o00o0oOOo0Oo
     self . checkAutoAdjustTime ( o00o0oOOo0Oo )
     if 90 - 90: OooOoo / i1iiIII111
     ooooOO000O0Oo = 0
     if o00o0oOOo0Oo . recordIndex != oo0OO0o0O . recordIndex :
      if o00o0oOOo0Oo . recordData is not None :
       self . addToUDPQueue4webAPI ( i1111 )
       mMonitorInfo . sendSwipes ( o00o0oOOo0Oo ,
 oo0OO0o0O . recordIndex )
       if 32 - 32: IIiIIiIi11I1 - i1I / ooOOO * Ooo0Ooo * iI1iII1I1I1i - i1i1i1111I
       if wgGlobal . testModeDebugPrint > 0 :
        if o00o0oOOo0Oo . recordIndex > oo0OO0o0O . recordIndex + 1 :
         if len ( o00o0oOOo0Oo . commandData ) == 192 :
          o00o0oOOo0Oo . get5Swipe ( oo0OO0o0O . recordIndex + 1 )
        o00o0oOOo0Oo . recordData . getDescription ( )
       if WGControllerCenter . logModeFileSwipe > 0 :
        if o00o0oOOo0Oo . recordIndex > oo0OO0o0O . recordIndex + 1 :
         if len ( o00o0oOOo0Oo . commandData ) == 192 :
          if 82 - 82: ooo000
          o00o0oOOo0Oo . get5SwipeFileLog ( oo0OO0o0O . recordIndex + 1 , o00o0oOOo0Oo . controllerSN ,
 root_loggerUDP )
        o00o0oOOo0Oo . recordData . getDescriptionFileLog ( o00o0oOOo0Oo . controllerSN , root_loggerUDP )
        if 66 - 66: IiIIii11Ii + IIiIIiIi11I1 - i1I + i1i1i1111I . iI1iII1I1I1i * IiIIii11Ii
        if 9 - 9: I1I - I1I - ooOOO - oOo0O00 + i1iiIII111
       if wgGlobal . print200Records > 0 :
        I1iii1I = [ ]
        if 3 - 3: I1Ii1I1
        o00o0oOOo0Oo . getNewSwipeJSON ( oo0OO0o0O . recordIndex , I1iii1I )
        if I1iii1I is not None :
         for OOoO in I1iii1I :
          wgGlobal . printWatchingInfo ( OOoO )
          if 57 - 57: Ooo0Ooo . OooOoo / oOo0O00 * I1Ii1I1
          if 36 - 36: IiIIii11Ii
          if 33 - 33: IiIIii11Ii
          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
      if o00o0oOOo0Oo . recordType == 0x01 :
       if ( self . countUsersOfDingyue > 0 ) and ( self . optionNewRecordSend > 0 ) :
        if 71 - 71: IiI11Ii111 % Iii1i + oOo0O00 * I11iiIi11i1I / IiI11Ii111
        self . UDPQueue4Dingyue . append ( i1111 )
        if 66 - 66: ooo000 * oOo0O00
        if 83 - 83: i1
        if 64 - 64: i1 . IiI11Ii111 - I11iiIi11i1I . Iii1i
        if 47 - 47: ooo000 / Ooo0Ooo % IiIIii11Ii
       Ii1 = 0
       if WGControllerCenter . testModeAllowAutoRemoteOpenDoor > 0 :
        Ii1 = 1
       if wgGlobal . visitorDBIsEnabled :
        try :
         if o00o0oOOo0Oo . recordData . recordValid == 0 :
          if 9 - 9: ooOOO
          if 28 - 28: Ii
          if 51 - 51: I11iiIi11i1I + Ooo0Ooo - ooo000 * oOO . oOO
          IIi = wgGlobal . visitorDB
          iII11111iI = Query ( )
          if 90 - 90: i1 * i1 . Ooo0Ooo . Oo
          o0000o = IIi . search ( iII11111iI [ "CardNO" ] == o00o0oOOo0Oo . recordData . recordcurrentval )
          oo00 = datetime . datetime . now ( )
          for ii1iiII111IiI in o0000o :
           if datetime . datetime . strptime ( ii1iiII111IiI [ "End" ] , "%Y-%m-%d %H:%M:%S" ) > oo00 and datetime . datetime . strptime ( ii1iiII111IiI [ "Begin" ] ,
           # ooOOO * Oo
 "%Y-%m-%d %H:%M:%S" ) < oo00 :
            Ii1 = 1
            break
        except Exception as II1iI111 :
         pass
         pass
         if 10 - 10: I11iiIi11i1I - Ii + i1I - I1Ii1I1
         if 48 - 48: Oo + i1I
         if 87 - 87: i1 . I11iiIi11i1I * Ii . i1 . IIiIIiIi11I1 . IiIIii11Ii
         if 50 - 50: Ii / oOO
         if 92 - 92: Ooo0Ooo * i1iiIII111 / Ooo0Ooo / i1iiIII111 * i1i1i1111I + i1I
       if Ii1 > 0 :
        o0ooo0oOoO = [ 0x17 , 0x40 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x01 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 ]
        for OOoO in ( 4 , 5 , 6 , 7 ) :
         o0ooo0oOoO [ OOoO ] = o00oOo0OOOO00 [ OOoO ]
        o0ooo0oOoO [ 8 ] = o00o0oOOo0Oo . recordDoorNO
        I11I11111 = self . getNewXid ( )
        if 37 - 37: i1i1i1111I + iI1iII1I1I1i % Iii1i
        if 48 - 48: i1I + oOo0O00
        if 95 - 95: iI1iII1I1I1i / i1I + I1I - oOO * i1
        WGTools . longToByte ( o00o0oOOo0Oo . recordData . recordcurrentval , o0ooo0oOoO , 20 , 8 )
        if o00o0oOOo0Oo . recordData . recordInOrOut == 2 :
         o0ooo0oOoO [ 28 ] = 1
        o0ooo0oOoO [ 32 ] = 0x5A
        WGTools . longToByte ( I11I11111 , o0ooo0oOoO , 40 , 4 )
        if 20 - 20: Ooo0Ooo
        if 4 - 4: IiIIii11Ii % Iii1i
        if 43 - 43: ooo000
        if wgAppConfig . timeStampEnable > 0 :
         WGControllerCenter . commTimeStamp_Enc ( o0ooo0oOoO ,
 o00o0oOOo0Oo )
        if WGControllerCenter . commSM4 > 0 :
         o0ooo0oOoO = WGControllerCenter . commSM4_Enc ( o0ooo0oOoO )
        self . transport . write ( bytes ( o0ooo0oOoO ) , i1I1Ii )
        ooooOO000O0Oo = 1
        wgAppConfig . wglog (
 "Server Send =>Controller RemoteOpenDoor SN= {0:d} DoorNO= {1:d} {2}" . format (
 o00o0oOOo0Oo . controllerSN ,
 o00o0oOOo0Oo . recordDoorNO ,
 o00o0oOOo0Oo . ipport ) )
        self . logSend ( o0ooo0oOoO , i1I1Ii )
        if 95 - 95: Oo + I11iiIi11i1I / Ooo0Ooo / Ii - ooOOO / i1i1i1111I
      if wgGlobal . visitorDBConfigOnlyOnce > 0 and o00o0oOOo0Oo . recordType == 0x02 :
       if ( o00o0oOOo0Oo . recordData . reason == 44 ) and (
 o00o0oOOo0Oo . recordData . recordcurrentval > 1 ) :
        if 6 - 6: Ooo0Ooo % IiIIii11Ii
        if 59 - 59: i1I . I11iiIi11i1I . ooo000 / i1I . Ii % Ooo0Ooo
        if 85 - 85: oOo0O00 / ooOOO
        IIi = wgGlobal . visitorDB
        iII11111iI = Query ( )
        wgGlobal . visitorDB . remove ( iII11111iI [ "CardNO" ] == o00o0oOOo0Oo . recordData . recordcurrentval )
        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 ooooOO000O0Oo == 0 :
      O0OOOo0oO = self . dictControllersSendDataTime . get ( o00o0oOOo0Oo . controllerSN )
      if 7 - 7: ooOOO + Iii1i / iI1iII1I1I1i - oOO % Oo / iI1iII1I1I1i
      if 14 - 14: Iii1i . Ii
      if 100 - 100: I1I / ooo000
      if ( ( O0OOOo0oO is not None ) and ( ( ( o00o0oOOo0Oo . refreshTimeFrom1970 - O0OOOo0oO ) > 60 ) or (
 ( ( o00oOo0OOOO00 [ 50 ] & 0x40 ) == 0x00 ) and ( o00o0oOOo0Oo . refreshTimeFrom1970 - O0OOOo0oO ) >= (
 wgGlobal . syncCycle - 1 ) ) ) ) :
       if 48 - 48: i1i1i1111I * i1I % i1i1i1111I + i1i1i1111I . iI1iII1I1I1i / OooOoo
       if 12 - 12: Ii . Ii - I1Ii1I1
       self . dictControllersSendDataTime [ o00o0oOOo0Oo . controllerSN ] = time . time ( )
       if 74 - 74: ooo000 * Iii1i - Ooo0Ooo - I1Ii1I1
       ooOo0O0O = [ 0x17 , 0x20 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
       for OOoO in ( 4 , 5 , 6 , 7 ) :
        ooOo0O0O [ OOoO ] = o00oOo0OOOO00 [ OOoO ]
       I11I11111 = self . getNewXid ( )
       for OOoO in ( 40 , 41 , 42 , 43 ) :
        ooOo0O0O [ OOoO ] = I11I11111 & 0xff
        I11I11111 = I11I11111 >> 8
        if 46 - 46: ooOOO / ooOOO
        if 58 - 58: IiI11Ii111 . IiI11Ii111
        if 79 - 79: oOo0O00 * IIiIIiIi11I1
        if 53 - 53: Ii - ooOOO . OooOoo - I1I - I11iiIi11i1I
       if wgAppConfig . timeStampEnable > 0 :
        WGControllerCenter . commTimeStamp_Enc ( ooOo0O0O , o00o0oOOo0Oo )
        for OOoO in ( 56 , 57 , 58 , 59 ) :
         ooOo0O0O [ OOoO ] = ooOo0O0O [ OOoO + 4 ]
        ooOo0O0O [ 55 ] = 0xA5
        ooOo0O0O [ 54 ] = 0xA5
        if 32 - 32: Iii1i % IiIIii11Ii - oOO - IiIIii11Ii - I11iiIi11i1I % i1iiIII111
       if WGControllerCenter . commSM4 > 0 :
        ooOo0O0O = WGControllerCenter . commSM4_Enc ( ooOo0O0O )
       try :
        if wgGlobal . supportNXP4G > 0 :
         self . insertToSendBuffer ( i1111 . controllerSN , I11I11111 , bytes ( ooOo0O0O ) , i1I1Ii )
        else :
         self . transport . write ( bytes ( ooOo0O0O ) , i1I1Ii )
        self . logSend ( ooOo0O0O , i1I1Ii )
       except Exception as ooo :
        pass
        mMonitorInfo . wglog ( "1102" )
        mMonitorInfo . wglog (
 ooo )
        if 50 - 50: Iii1i / IiI11Ii111 + i1
       wgAppConfig . wglog (
 "Server send =>Controller sync ControllerSN= {0:d} {1}" . format ( o00o0oOOo0Oo . controllerSN ,
 o00o0oOOo0Oo . ipport ) )
       if 4 - 4: IIiIIiIi11I1 . IiIIii11Ii % i1I
   else :
    if 30 - 30: i1 . i1
    return o00o
    if 35 - 35: Ii * i1I / IiIIii11Ii - I1Ii1I1 / i1
 def DealUDPQueue4QRCode ( self ) :
  o00o = False
  while True :
   if self . UDPQueue4QRCode . __len__ ( ) > 0 :
    o00o = True
    if 76 - 76: IiIIii11Ii * Iii1i % IiIIii11Ii
    i1111 = self . UDPQueue4QRCode . popleft ( )
    if 73 - 73: i1I / IIiIIiIi11I1 / oOo0O00 % IIiIIiIi11I1 / Ii
    o00oOo0OOOO00 = i1111 . commandData
    i1I1Ii = i1111 . ipport
    i1ii1 = binascii . hexlify ( o00oOo0OOOO00 )
    o0ooO0o = ( o00oOo0OOOO00 [ 8 ] + ( o00oOo0OOOO00 [ 9 ] << 8 ) )
    oo = i1ii1 [ ( 64 * 2 ) : ( 64 * 2 + o0ooO0o * 2 ) ]
    wgAppConfig . wglog ( "Server Receive <=From Controller SN = {0} QRCode Data: {1} " . format ( i1111 . controllerSN , oo ) )
    wgAppConfig . wglog (
 "                                   QRCode(Convert To String): {0} " . format (
 str ( o00oOo0OOOO00 [ 64 : 64 + o0ooO0o ] ) ) )
    if WGControllerCenter . logModeFileQR > 0 :
     if 76 - 76: Oo / IiIIii11Ii % IiIIii11Ii . ooo000 * Oo % i1iiIII111
     if 39 - 39: I1Ii1I1 / Ooo0Ooo * IIiIIiIi11I1
     if 84 - 84: oOO / IiI11Ii111 * IiIIii11Ii
     if 29 - 29: I1Ii1I1 % oOo0O00 - oOo0O00 * I1Ii1I1 / Iii1i * i1I
     o0O0 = "{0:0>2X}{1:0>2X}-{2:0>2X}-{3:0>2X} {4:0>2X}:{5:0>2X}:{6:0>2X}" . format ( 0x20 , o00oOo0OOOO00 [ 51 ] ,
 o00oOo0OOOO00 [ 52 ] , o00oOo0OOOO00 [ 53 ] ,
 o00oOo0OOOO00 [ 37 ] , o00oOo0OOOO00 [ 38 ] ,
 o00oOo0OOOO00 [ 39 ] )
     try :
      iiI1iiIIi = datetime . datetime . strptime ( o0O0 , "%Y-%m-%d %H:%M:%S" )
     except Exception as ooo :
      pass
      iiI1iiIIi = datetime . datetime . strptime ( "2000-01-19 19:19:19" ,
 "%Y-%m-%d %H:%M:%S" )
      mMonitorInfo . wglog ( "1103" )
      wgAppConfig . wglog ( ooo )
     root_loggerUDP . info (
 "SN={0}:QR:DoorNO ={1:d},InExit ={2},Time={3:%Y-%m-%d %H:%M:%S},QRCode={4},ConvertedString={5}" . format (
 i1111 . controllerSN ,
 o00oOo0OOOO00 [ 14 ] , "In" if o00oOo0OOOO00 [ 15 ] == 1 else "Exit" , iiI1iiIIi , oo ,
 str ( o00oOo0OOOO00 [ 64 : 64 + o0ooO0o ] ) ) )
     if 82 - 82: i1iiIII111
    if wgGlobal . print200Records > 0 :
     o0O0 = "{0:0>2X}{1:0>2X}-{2:0>2X}-{3:0>2X} {4:0>2X}:{5:0>2X}:{6:0>2X}" . format ( 0x20 , o00oOo0OOOO00 [ 51 ] ,
 o00oOo0OOOO00 [ 52 ] , o00oOo0OOOO00 [ 53 ] ,
 o00oOo0OOOO00 [ 37 ] , o00oOo0OOOO00 [ 38 ] ,
 o00oOo0OOOO00 [ 39 ] )
     try :
      iiI1iiIIi = datetime . datetime . strptime ( o0O0 , "%Y-%m-%d %H:%M:%S" )
     except Exception as ooo :
      pass
      iiI1iiIIi = datetime . datetime . strptime ( "2000-01-19 19:19:19" ,
 "%Y-%m-%d %H:%M:%S" )
      mMonitorInfo . wglog ( "1103" )
      wgAppConfig . wglog ( ooo )
      if 58 - 58: ooOOO
      if 27 - 27: i1i1i1111I * IiIIii11Ii
      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
      if 55 - 55: oOo0O00
      if 85 - 85: IIiIIiIi11I1 % Oo / I1I . oOo0O00 / IIiIIiIi11I1 . Oo
      if 40 - 40: IIiIIiIi11I1 - ooOOO * oOO . ooo000
      if 24 - 24: IiIIii11Ii - iI1iII1I1I1i / Ii
     OOoO0oo00 = str ( binascii . hexlify ( o00oOo0OOOO00 [ 64 : 64 + o0ooO0o ] ) ,
 encoding = 'UTF-8' )
     iI1I1i1iI1I1 = ""
     try :
      iI1I1i1iI1I1 = str ( o00oOo0OOOO00 [ 64 : 64 + o0ooO0o ] , encoding = "utf-8" )
     except Exception as II1iI111 :
      pass
      pass
      if 88 - 88: i1 % oOo0O00 - ooo000 . Ii
     iiiiiiiIi = (
 { "SN" : i1111 . controllerSN ,
 "ReceivedBytesLength" : o0ooO0o ,
 "PrimitHexData" : oo ,
 "ConvertedToString" : iI1I1i1iI1I1 ,
     "Time" : iiI1iiIIi . strftime ( "%Y-%m-%d %H:%M:%S" ) ,

     "DoorNO" : o00oOo0OOOO00 [ 14 ] ,
 "InExit" : "In" if o00oOo0OOOO00 [ 15 ] == 1 else "Exit" ,
 "SerialNumber" : i1111 . sid ,
     } )
     oo0OO0ooO0O0 = tdz . parseCommand ( binascii . unhexlify ( oo ) )
     if oo0OO0ooO0O0 is not None :
      iiiiiiiIi = (
 { "SN" : i1111 . controllerSN ,
 "ReceivedBytesLength" : o0ooO0o ,
 "PrimitHexData" : oo ,
 "GateInformation" : oo0OO0ooO0O0 ,
      "Time" : iiI1iiIIi . strftime ( "%Y-%m-%d %H:%M:%S" ) ,

      # I11iiIi11i1I + Iii1i - IiI11Ii111
      # Ooo0Ooo % Ooo0Ooo . OooOoo / i1I % i1I
      "SerialNumber" : i1111 . sid ,
      } )
     wgGlobal . printWatchingInfo ( iiiiiiiIi )
     if 98 - 98: 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
    Ii1 = 0
    if WGControllerCenter . testModeAllowAutoRemoteOpenDoor > 0 :
     Ii1 = 1
     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 Ii1 > 0 :
     oooOO0OoO00O = o00oOo0OOOO00 [ 14 ]
     I11I11111 = self . getNewXid ( )
     o00oOo = 123456789888
     o0ooo0oOoO = WGCommand . cmdRemoteOpenDoorInLocalnetwork ( i1111 . controllerSN , oooOO0OoO00O , 1 ,
 o00oOo , I11I11111 )
     if 50 - 50: I1Ii1I1
     if 74 - 74: i1 / I1I
     if 35 - 35: I11iiIi11i1I - Iii1i . OooOoo - I1Ii1I1 * Iii1i % i1
     if 33 - 33: ooOOO + ooo000 - iI1iII1I1I1i + I1I + iI1iII1I1I1i
     if wgAppConfig . timeStampEnable > 0 :
      o00o0oOOo0Oo = self . dictControllers [ i1111 . controllerSN ]
      WGControllerCenter . commTimeStamp_Enc ( o0ooo0oOoO , o00o0oOOo0Oo )
     if WGControllerCenter . commSM4 > 0 :
      o0ooo0oOoO = WGControllerCenter . commSM4_Enc ( o0ooo0oOoO )
     self . transport . write ( bytes ( o0ooo0oOoO ) , i1I1Ii )
     self . logSend ( o0ooo0oOoO , i1I1Ii )
     wgAppConfig . wglog (
 "Server Send =>Controller RemoteOpenDoor SN= {0:d} DoorNO= {1:d} {2}" . format ( i1111 . controllerSN ,
 oooOO0OoO00O ,
 i1111 . ipport ) )
   else :
    if 39 - 39: IiI11Ii111 % i1I - Iii1i . IiIIii11Ii % IiI11Ii111 % IiI11Ii111
    return o00o
    if 37 - 37: Oo * i1i1i1111I - i1iiIII111
 def DealUDPQueue4Mobile ( self ) :
  if 36 - 36: ooOOO + oOo0O00 + OooOoo / i1 % IiI11Ii111 . ooo000
  o00o = False
  while True :
   if self . UDPQueue4Mobile . __len__ ( ) > 0 :
    o00o = True
    if 85 - 85: OooOoo * Iii1i * IIiIIiIi11I1
    i1111 = self . UDPQueue4Mobile . popleft ( )
    if 38 - 38: ooo000 - Ii - i1I
    o00oOo0OOOO00 = i1111 . commandData
    if 91 - 91: i1iiIII111 / i1 * oOO * IIiIIiIi11I1 * IiIIii11Ii
    oo0OO0o0O = self . dictControllers . get ( i1111 . controllerSN )
    wgAppConfig . wglog ( "Server Receive <=Mobile or PC Client [{0}]" . format ( i1111 . ipport ) )
    if self . isConnected ( i1111 . controllerSN ) :
     o0oOoOo0O00o = [ o00oOo0OOOO00 [ OOoO ] for OOoO in range ( 0 , len ( o00oOo0OOOO00 ) ) ]
     if 88 - 88: i1i1i1111I * IiIIii11Ii / i1
     if mMonitorInfo . OnlyVirtualCardOpenDoor > 0 :
      OOO0OOo = False
      if len ( o00oOo0OOOO00 ) == 64 :
       if o0oOoOo0O00o [ 1 ] == 0x40 and WGTools . getLongByByte ( o0oOoOo0O00o , 20 , 4 ) > 0 and o0oOoOo0O00o [
 32 ] == 0 :
        OOO0OOo = True
        if 61 - 61: i1I
       if o0oOoOo0O00o [ 1 ] in [ 0x92 , 0x94 , 0x20 , 0x26 , 0x32 , 0xb0 , 0xf4 ] :
        OOO0OOo = True
      if not OOO0OOo :
       return o00o
       if 75 - 75: IIiIIiIi11I1 . I11iiIi11i1I / ooo000 . oOo0O00 % Ooo0Ooo
     o0oOoOo0O00o [ 0 ] = 0x17
     if 7 - 7: I1I / i1iiIII111
     if len ( WGControllerCenter . commPID ) > 1 :
      o0oOoOo0O00o [ 2 ] = 0
      o0oOoOo0O00o [ 3 ] = 0
     if len ( o00oOo0OOOO00 ) > 64 :
      if 53 - 53: OooOoo - I1Ii1I1 + IIiIIiIi11I1 . I1Ii1I1 + i1iiIII111
      if WGTools . isValid64Group ( o0oOoOo0O00o ) :
       for OOoO in range ( 0 , len ( o00oOo0OOOO00 ) // 64 ) :
        if o0oOoOo0O00o [ OOoO * 64 ] > 0 :
         o0oOoOo0O00o [ OOoO * 64 ] = 0x17
     iIii1iIii = i1111 . sid
     I11I11111 = self . getNewXid ( )
     OOOOoo0o = I11I11111
     for OOoO in ( 40 , 41 , 42 , 43 ) :
      o0oOoOo0O00o [ OOoO ] = I11I11111 & 0xff
      I11I11111 = I11I11111 >> 8
     i1I1Ii = self . dictControllers [ i1111 . controllerSN ] . ipport
     o0oo0o0 = xid4mobile ( iIii1iIii , i1111 . ipport )
     if 94 - 94: IiIIii11Ii / oOo0O00
     self . dictXid [ OOOOoo0o ] = o0oo0o0
     if 17 - 17: ooo000
     if 65 - 65: I1Ii1I1 + Ii . oOo0O00 + I11iiIi11i1I - IiI11Ii111
     if 68 - 68: OooOoo - IIiIIiIi11I1 + IiIIii11Ii
     if 97 - 97: ooo000 / Iii1i
     if 30 - 30: OooOoo * I1I
     if 94 - 94: i1I
     if 65 - 65: IiIIii11Ii . Ii
     if 49 - 49: oOO + Ii % Ii % Oo * Iii1i * Ii
     if wgAppConfig . timeStampEnable > 0 :
      if not ( ( o0oOoOo0O00o [ 1 ] == 0xE2 ) or ( o0oOoOo0O00o [ 1 ] == 0xF8 ) ) :
       o00o0oOOo0Oo = self . dictControllers [ i1111 . controllerSN ]
       WGControllerCenter . commTimeStamp_Enc ( o0oOoOo0O00o , o00o0oOOo0Oo )
       if 89 - 89: Ooo0Ooo
       if 57 - 57: oOO . IIiIIiIi11I1 + OooOoo * I1I
     if WGControllerCenter . commSM4 > 0 :
      o0oOoOo0O00o = WGControllerCenter . commSM4_Enc ( o0oOoOo0O00o )
     if wgGlobal . supportNXP4G > 0 :
      self . insertToSendBuffer ( i1111 . controllerSN , OOOOoo0o , bytes ( o0oOoOo0O00o ) , i1I1Ii )
     else :
      self . transport . write ( bytes ( o0oOoOo0O00o ) , i1I1Ii )
     self . logSend ( o0oOoOo0O00o , i1I1Ii )
     wgAppConfig . wglog ( "Server Send =>Controller SN= {0:d}  {1}" . format ( i1111 . controllerSN , i1I1Ii ) )
    else :
     o0oOoOo0O00o = None
     if 89 - 89: Iii1i * Ooo0Ooo + Oo * I11iiIi11i1I * IiI11Ii111 + IiI11Ii111
     if i1111 . controllerSN == 999999901 :
      if not wgAppConfig . ACTIVE_UDPQueue4webAPI :
       wgAppConfig . ACTIVE_UDPQueue4webAPI = True
       if 90 - 90: Oo - I11iiIi11i1I
      if len ( self . UDPQueue4webAPI ) > 0 :
       IiI = self . UDPQueue4webAPI . popleft ( ) . commandData
       o0oOoOo0O00o = [ IiI [ OOoO ] for OOoO in range ( 0 , len ( IiI ) ) ]
       for OOoO in ( 40 , 41 , 42 , 43 ) :
        o0oOoOo0O00o [ OOoO ] = o00oOo0OOOO00 [ OOoO ]
     elif i1111 . controllerSN == 999999902 :
      if not wgAppConfig . ACTIVE_UDPQueue4QRwebAPI :
       wgAppConfig . ACTIVE_UDPQueue4QRwebAPI = True
       if 26 - 26: ooOOO / I1I % Ooo0Ooo + I1Ii1I1 + Ii
      if len ( self . UDPQueue4QRwebAPI ) > 0 :
       IiI = self . UDPQueue4QRwebAPI . popleft ( ) . commandData
       o0oOoOo0O00o = [ IiI [ OOoO ] for OOoO in range ( 0 , len ( IiI ) ) ]
       for OOoO in ( 40 , 41 , 42 , 43 ) :
        o0oOoOo0O00o [ OOoO ] = o00oOo0OOOO00 [ OOoO ]
     if o0oOoOo0O00o is None :
      if 71 - 71: IIiIIiIi11I1 / i1 + Iii1i . i1i1i1111I
      o0oOoOo0O00o = [ o00oOo0OOOO00 [ OOoO ] for OOoO in range ( 0 , len ( o00oOo0OOOO00 ) ) ]
      o0oOoOo0O00o [ 0 ] = 0x37
      o0oOoOo0O00o [ 8 ] = 0x00
      if 15 - 15: IIiIIiIi11I1 * i1i1i1111I / i1i1i1111I % Oo * ooOOO
      for OOoO in ( 0 , 1 , 2 , 3 ) :
       o0oOoOo0O00o [ OOoO + 44 ] = o0oOoOo0O00o [ OOoO + 40 ]
       o0oOoOo0O00o [ OOoO + 48 ] = o0oOoOo0O00o [ OOoO + 4 ]
       o0oOoOo0O00o [ OOoO + 4 ] = 0
     i1I1Ii = i1111 . ipport
     if ( ( WGControllerCenter . commSM4 > 0 ) and (
 WGControllerCenter . commSM4_PCNeed > 0 ) ) :
      o0oOoOo0O00o = WGControllerCenter . commSM4_Enc ( o0oOoOo0O00o )
     self . transport . write ( bytes ( o0oOoOo0O00o ) , i1I1Ii )
     self . logSend ( o0oOoOo0O00o , i1I1Ii )
     wgAppConfig . wglog (
 "Server Reply =>mobile Controller SN= {0:d} unconnected {1}" . format ( i1111 . controllerSN , i1I1Ii ) )
     if 83 - 83: oOo0O00 - ooOOO
   else :
    if 60 - 60: Oo
    return o00o
    if 23 - 23: oOo0O00
 def DealUDPQueue4ReplyFromController ( self ) :
  o00o = False
  while True :
   try :
    if self . UDPQueue4ReplyFromController . __len__ ( ) > 0 :
     o00o = True
     if 47 - 47: Ooo0Ooo + Oo * Ii . OooOoo . I1Ii1I1 * i1iiIII111
     i1111 = self . UDPQueue4ReplyFromController . popleft ( )
     if 46 - 46: ooOOO % i1i1i1111I * i1iiIII111 + I1Ii1I1
     o00oOo0OOOO00 = i1111 . commandData
     if 15 - 15: iI1iII1I1I1i - ooo000 + IIiIIiIi11I1 * Ooo0Ooo
     o0oo0o0 = self . dictXid . get ( i1111 . sid )
     if o0oo0o0 is not None :
      o0oOoOo0O00o = [ o00oOo0OOOO00 [ OOoO ] for OOoO in range ( 0 ,
 len ( o00oOo0OOOO00 ) ) ]
      if 84 - 84: OooOoo . Ii
      if 21 - 21: Ooo0Ooo
      if 76 - 76: iI1iII1I1I1i % IiI11Ii111 / IiIIii11Ii - IiI11Ii111
      if 4 - 4: OooOoo * IIiIIiIi11I1 - Ooo0Ooo . Ii - ooOOO . i1iiIII111
      if 2 - 2: I11iiIi11i1I * i1I * i1I * i1iiIII111 / I11iiIi11i1I % IiI11Ii111
      if 13 - 13: i1 * IiIIii11Ii - ooo000 * OooOoo
      if 72 - 72: Iii1i . I1Ii1I1 * IIiIIiIi11I1 % I1Ii1I1 - i1i1i1111I
      if 97 - 97: i1 + ooOOO + I11iiIi11i1I . i1
      if 71 - 71: ooo000 - i1i1i1111I / iI1iII1I1I1i - iI1iII1I1I1i % IIiIIiIi11I1 . iI1iII1I1I1i
      if 1 > 0 :
       o0oOoOo0O00o [ 0 ] = 0x37
       if 41 - 41: IIiIIiIi11I1
       if ( len ( o00oOo0OOOO00 ) > 64 ) and ( len ( o00oOo0OOOO00 ) != 192 ) :
        if 96 - 96: Oo . Ooo0Ooo - oOO . Iii1i % IiI11Ii111 . IiI11Ii111
        if 82 - 82: oOO % iI1iII1I1I1i / i1iiIII111
        if 47 - 47: i1
        if not WGTools . isValid64Group ( o00oOo0OOOO00 ) :
         pass
        else :
         for OOoO in range ( 0 , len ( o00oOo0OOOO00 ) // 64 ) :
          if o0oOoOo0O00o [ OOoO * 64 ] > 0 :
           o0oOoOo0O00o [ OOoO * 64 ] = 0x37
           if 59 - 59: IiI11Ii111 % IIiIIiIi11I1 % IiIIii11Ii
      I11I11111 = o0oo0o0 . xid
      for OOoO in ( 40 , 41 , 42 , 43 ) :
       o0oOoOo0O00o [ OOoO ] = I11I11111 & 0xff
       I11I11111 = I11I11111 >> 8
      i1I1Ii = o0oo0o0 . addr
      if ( ( WGControllerCenter . commSM4 > 0 ) and (
 WGControllerCenter . commSM4_PCNeed > 0 ) ) :
       o0oOoOo0O00o = WGControllerCenter . commSM4_Enc ( o0oOoOo0O00o )
      self . transport . write ( bytes ( o0oOoOo0O00o ) , i1I1Ii )
      self . logSend ( o0oOoOo0O00o , i1I1Ii )
      wgAppConfig . logdebug (
 "Server Send =>Mobile New {0} from {1} DataLen={2:d} " . format ( binascii . hexlify ( bytes ( o0oOoOo0O00o ) ) ,
 i1I1Ii , len ( bytes (
 o0oOoOo0O00o ) ) ) )
      wgAppConfig . wglog ( "Server Send =>Mobile = {0}" . format ( i1111 . ipport ) )
      if 92 - 92: Oo . i1 * i1iiIII111 . IiIIii11Ii
      self . dictXid . pop ( i1111 . sid , None )
      if 82 - 82: I11iiIi11i1I % Oo + Ii
    else :
     if 22 - 22: Ooo0Ooo / ooOOO . I1I % I1I
     if self . dictXid . __len__ ( ) > 100 :
      if 16 - 16: iI1iII1I1I1i / i1iiIII111 / Ooo0Ooo . Ii
      I111iIi11 = self . dictXid . keys ( )
      II1i11i1iiI = time . time ( )
      if 85 - 85: i1iiIII111 % ooo000 % IiI11Ii111 - i1 * ooOOO
      if 51 - 51: iI1iII1I1I1i + OooOoo / Ooo0Ooo
      for OOoO in list ( I111iIi11 ) :
       o0oo0o0 = self . dictXid . get ( OOoO )
       if II1i11i1iiI > o0oo0o0 . currentTime + 3 :
        self . dictXid . pop ( OOoO , None )
        if 78 - 78: I11iiIi11i1I * oOO + oOO + I1I * I1I / IiI11Ii111
        if 92 - 92: IiIIii11Ii * OooOoo * I1Ii1I1
        if 65 - 65: i1iiIII111 * Oo * oOO + i1I - i1I
     return o00o
   except Exception as ooo :
    pass
    if 86 - 86: oOO - Ooo0Ooo + I11iiIi11i1I . Iii1i . OooOoo - Ii
    if 86 - 86: I1I
    mMonitorInfo . wglog ( "1104" )
    wgAppConfig . wglog ( "{0}: {1}" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , ooo ) )
    return o00o
    if 35 - 35: ooOOO + OooOoo
 def DealOpenDoorFromWEBSocket ( self , controllerSN , recordDoorNO , inOrOut ,
 virtualCardNO ) :
  I1iII = OpenDoorByVirtualCard ( )
  I1iII . controllerSN = controllerSN
  I1iII . inOrOut = inOrOut
  I1iII . recordDoorNO = recordDoorNO
  I1iII . virtualCardNO = virtualCardNO
  self . UDPQueueFromWEBSocket . append ( I1iII )
  if self . taskqueueWGControllerCenter . empty ( ) :
   self . taskqueueWGControllerCenter . put ( 1001002 )
   if 14 - 14: oOO * oOO / i1 - oOo0O00 % Ii
 def DealUDPQueueFromWEBSocket ( self ) :
  o00o = False
  while True :
   try :
    if self . UDPQueueFromWEBSocket . __len__ ( ) > 0 :
     o00o = True
     i1111 = self . UDPQueueFromWEBSocket . popleft ( )
     if 49 - 49: i1iiIII111 - Ii % ooOOO . I1I
     if 80 - 80: IiIIii11Ii / oOO % IiI11Ii111 * I1I
     if 100 - 100: oOo0O00 / I1Ii1I1 - i1i1i1111I * I1Ii1I1 / I11iiIi11i1I * Oo
     i1iII11iii = i1111 . controllerSN
     oooOO0OoO00O = i1111 . recordDoorNO
     oO0Ooo0O = i1111 . inOrOut
     o00oOo = i1111 . virtualCardNO
     if self . isConnected ( i1iII11iii ) :
      if 1 - 1: OooOoo - OooOoo . i1iiIII111
      I11I11111 = self . getNewXid ( )
      if 77 - 77: IiI11Ii111
      o0ooo0oOoO = WGCommand . cmdRemoteOpenDoorInLocalnetwork ( i1iII11iii , oooOO0OoO00O , oO0Ooo0O ,
 o00oOo , I11I11111 )
      o00oOo0OOOO00 = o0ooo0oOoO
      o0oOoOo0O00o = [ o00oOo0OOOO00 [ OOoO ] for OOoO in range ( 0 , len ( o00oOo0OOOO00 ) ) ]
      o0oOoOo0O00o [ 0 ] = 0x17
      if 85 - 85: i1I - IiIIii11Ii % i1i1i1111I
      if len ( WGControllerCenter . commPID ) > 1 :
       o0oOoOo0O00o [ 2 ] = 0
       o0oOoOo0O00o [ 3 ] = 0
      if len ( o00oOo0OOOO00 ) > 64 :
       if 91 - 91: i1 % I11iiIi11i1I / i1i1i1111I
       if WGTools . isValid64Group ( o0oOoOo0O00o ) :
        for OOoO in range ( 0 , len ( o00oOo0OOOO00 ) // 64 ) :
         if o0oOoOo0O00o [ OOoO * 64 ] > 0 :
          o0oOoOo0O00o [ OOoO * 64 ] = 0x17
          if 65 - 65: oOO - oOO
          if 52 - 52: IiIIii11Ii
          if 29 - 29: i1iiIII111 * i1iiIII111
          if 47 - 47: IiI11Ii111 / IIiIIiIi11I1 % oOO
          if 97 - 97: Oo . IiIIii11Ii * i1 - IiI11Ii111 * i1 % Ii
          if 88 - 88: Oo - ooOOO - oOO
      if wgAppConfig . timeStampEnable > 0 :
       if not ( ( o0oOoOo0O00o [ 1 ] == 0xE2 ) or ( o0oOoOo0O00o [ 1 ] == 0xF8 ) ) :
        o00o0oOOo0Oo = self . dictControllers [ i1111 . controllerSN ]
        WGControllerCenter . commTimeStamp_Enc ( o0oOoOo0O00o , o00o0oOOo0Oo )
        if 93 - 93: I11iiIi11i1I . I11iiIi11i1I + I11iiIi11i1I
        if 58 - 58: oOo0O00 . I1I * I11iiIi11i1I + i1i1i1111I
      if WGControllerCenter . commSM4 > 0 :
       o0oOoOo0O00o = WGControllerCenter . commSM4_Enc ( o0oOoOo0O00o )
      i1I1Ii = self . dictControllers [ i1iII11iii ] . ipport
      if wgGlobal . supportNXP4G > 0 :
       self . insertToSendBuffer ( i1111 . controllerSN , I11I11111 , bytes ( o0oOoOo0O00o ) , i1I1Ii )
      else :
       self . transport . write ( bytes ( o0oOoOo0O00o ) , i1I1Ii )
      self . logSend ( o0oOoOo0O00o , i1I1Ii )
      wgAppConfig . wglog ( "Server Send WEBSocket =>Controller SN= {0:d}  {1}" . format ( i1iII11iii , i1I1Ii ) )
    else :
     if 13 - 13: oOO % Iii1i
     return o00o
   except Exception as ooo :
    pass
    if 81 - 81: I1I
    if 86 - 86: Ooo0Ooo / I1I . Ooo0Ooo % i1i1i1111I * OooOoo * Iii1i
    wgAppConfig . wglog ( "{0}: {1}" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , ooo ) )
    return o00o
    if 59 - 59: Ii + i1i1i1111I . I1Ii1I1 . oOO + i1I . i1
    if 34 - 34: iI1iII1I1I1i - ooo000 * i1iiIII111 - Iii1i
    if 50 - 50: oOO . IiI11Ii111 . i1I . i1i1i1111I . I11iiIi11i1I + Oo
 optionNewRecordSend = 0
 countUsersOfDingyue = 0
 listUsersOfDingyue = [ ]
 cntMs = 0
 if 38 - 38: IiI11Ii111 + oOo0O00 . ooo000 - Iii1i - I1Ii1I1 - oOO
 def DealUDPQueue4Dingyue (
 self ) :
  if 29 - 29: ooo000 * oOO
  if 38 - 38: oOo0O00 / IiIIii11Ii * oOO . OooOoo % Ii . Iii1i
  if 74 - 74: oOO - i1i1i1111I % I1I + IiIIii11Ii * I1I
  if 53 - 53: OooOoo % I1Ii1I1 / IiI11Ii111 / I1I + I1Ii1I1 . i1I
  if 7 - 7: oOO - oOo0O00 . i1i1i1111I * Oo + I1I
  if 93 - 93: i1iiIII111 - OooOoo + i1 * oOo0O00 . IiI11Ii111
  if 9 - 9: IIiIIiIi11I1 + iI1iII1I1I1i
  o00o = False
  while True :
   if self . UDPQueue4Dingyue . __len__ ( ) > 0 :
    o00o = True
    if 43 - 43: oOo0O00 * i1I * i1I / IiIIii11Ii % i1iiIII111
    i1111 = self . UDPQueue4Dingyue . popleft ( )
    if 55 - 55: i1iiIII111 . i1
    o00oOo0OOOO00 = i1111 . commandData
    if 29 - 29: Ooo0Ooo * IiIIii11Ii + i1iiIII111 / iI1iII1I1I1i - IiIIii11Ii - oOo0O00
    if 63 - 63: I1Ii1I1 . IiI11Ii111 * ooOOO . oOO / I1I
    if ( i1111 . functionID == 0x10 and (
 ( i1111 . controllerSN == 0x7EEEEEEE ) or ( i1111 . controllerSN == 0x7EEEEEEC ) ) ) :
     if i1111 . controllerSN == 0x7EEEEEEE :
      if 34 - 34: i1i1i1111I * i1i1i1111I * I11iiIi11i1I . Iii1i * i1I % ooo000
      iI11I1iIIi = 60 * 5
      if o00oOo0OOOO00 [ 8 ] > 0 :
       iI11I1iIIi = 60 * o00oOo0OOOO00 [ 8 ]
      self . optionNewRecordSend = o00oOo0OOOO00 [ 9 ]
      o00oOO0o0 = time . time ( ) + iI11I1iIIi
      iiIii111i1 = 0
      if len ( self . listUsersOfDingyue ) > 0 :
       for OOoO in self . listUsersOfDingyue :
        if OOoO [ 0 ] == i1111 . ipport :
         OOoO [ 1 ] = o00oOO0o0
         iiIii111i1 = 1
         break
      if iiIii111i1 == 0 :
       self . listUsersOfDingyue . append ( [ i1111 . ipport , o00oOO0o0 ] )
       self . countUsersOfDingyue = len ( self . listUsersOfDingyue )
      wgAppConfig . wglog ( "Server receive subscription refresh<= from Mobile or PC Client [{0}]" . format ( i1111 . ipport ) )
      if 94 - 94: Ii + IIiIIiIi11I1 / i1i1i1111I / ooOOO
     if i1111 . controllerSN == 0x7EEEEEEC :
      if 48 - 48: I1I . I11iiIi11i1I
      if len ( self . listUsersOfDingyue ) > 0 :
       for OOoO in self . listUsersOfDingyue :
        if OOoO [ 0 ] == i1111 . ipport :
         self . listUsersOfDingyue . remove ( OOoO )
         self . countUsersOfDingyue = len ( self . listUsersOfDingyue )
         break
      wgAppConfig . wglog ( "Server receive unsubscription <= from Mobile or PC Client [{0}]" . format ( i1111 . ipport ) )
      if 47 - 47: iI1iII1I1I1i - Ii . i1iiIII111 * Oo
      if 91 - 91: ooOOO * ooOOO * oOO % I1Ii1I1 % ooo000
     o0oOoOo0O00o = [ o00oOo0OOOO00 [ OOoO ] for OOoO in range ( 0 , 64 ) ]
     o0oOoOo0O00o [ 0 ] = 0x37
     o0oOoOo0O00o [ 8 ] = 0x01
     i1I1Ii = i1111 . ipport
     if ( ( WGControllerCenter . commSM4 > 0 ) and (
 WGControllerCenter . commSM4_PCNeed > 0 ) ) :
      o0oOoOo0O00o = WGControllerCenter . commSM4_Enc ( o0oOoOo0O00o )
      if 84 - 84: i1I + i1i1i1111I * ooOOO % ooo000
     self . transport . write ( bytes ( o0oOoOo0O00o ) , i1I1Ii )
     self . logSend ( o0oOoOo0O00o , i1I1Ii )
     wgAppConfig . wglog ( "Server reply => Mobile or PC Client [{0}]" . format ( i1I1Ii ) )
    elif i1111 . cmdtype == 0x17 :
     if self . countUsersOfDingyue > 0 :
      oo00 = time . time ( )
      if ( ( WGControllerCenter . commSM4 > 0 ) and (
 WGControllerCenter . commSM4_PCNeed > 0 ) ) :
       i1111 . commandData = WGControllerCenter . commSM4_Enc (
 i1111 . commandData )
      i1I1Ii = i1111 . ipport
      for OOoO in self . listUsersOfDingyue :
       self . transport . write ( i1111 . commandData , OOoO [ 0 ] )
       wgAppConfig . wglog ( "Server Send =>subscriber(mobile or PC) = {0}" . format ( OOoO [ 0 ] ) )
       wgAppConfig . logdebug (
 "????DealUDPQueue4Dingyue Server send =>subscriber(mobile or PC) {0} from {1} DataLen={2:d} " . format (
 binascii . hexlify ( bytes ( i1111 . commandData ) ) , i1I1Ii ,
 len ( bytes ( i1111 . commandData ) ) ) )
       if 29 - 29: IiIIii11Ii - IIiIIiIi11I1 + IiI11Ii111 - I11iiIi11i1I . OooOoo
       if 57 - 57: i1i1i1111I / I11iiIi11i1I
   else :
    if 83 - 83: OooOoo / I1Ii1I1 / IiIIii11Ii
    if 78 - 78: i1 . i1iiIII111 - Oo * IIiIIiIi11I1 - I1I - i1I
    self . cntMs = self . cntMs + 1
    Iii1ii11i1iii = self . cntMs
    if Iii1ii11i1iii % 1000 == 0 :
     if self . countUsersOfDingyue > 0 :
      oo00 = time . time ( )
      for OOoO in self . listUsersOfDingyue :
       if oo00 >= OOoO [ 1 ] :
        self . listUsersOfDingyue . remove ( OOoO )
      self . countUsersOfDingyue = len ( self . listUsersOfDingyue )
    return o00o
    if 34 - 34: ooo000 % IiI11Ii111
 DealWGRecordLogtimeout = 0
 if 73 - 73: oOo0O00 . I1I . IiI11Ii111 - IIiIIiIi11I1 - i1 / Ooo0Ooo
 def DealWGRecordLog ( self ) :
  task . LoopingCall ( self . DealWGRecordLogRealize ) . start ( 5 , True )
  if 77 - 77: I1Ii1I1 % IiI11Ii111
 Dealwebsockettimeout = 0
 if 85 - 85: I1Ii1I1 + i1iiIII111 * IiI11Ii111 - i1i1i1111I % i1
 def DealWGRecordLogRealize ( self ) :
  o00o = False
  if 49 - 49: Oo / I1I . I11iiIi11i1I % Ooo0Ooo
  if 20 - 20: I1Ii1I1 . IiI11Ii111 - Ii % I11iiIi11i1I % Oo
  Ii11i11I1IIi = time . time ( )
  if not Ii11i11I1IIi > self . DealWGRecordLogtimeout :
   return o00o
  self . DealWGRecordLogtimeout = Ii11i11I1IIi + 5
  o00o = True
  if 90 - 90: i1 - ooo000 - i1I + i1I * Oo
  if 55 - 55: IIiIIiIi11I1 + i1
  oo00 = time . localtime ( Ii11i11I1IIi )
  if 11 - 11: oOO % ooOOO - I1I
  if 1 - 1: Iii1i * I11iiIi11i1I % I11iiIi11i1I . ooo000 . I1I * i1iiIII111
  if WGControllerCenter . logModeHourToClear == oo00 . tm_hour and wgAppConfig . wgrecordlogEnable :
   if oo00 . tm_min == 0 :
    if ( ( WGControllerCenter . logModeWeekToClear == 0 ) or ( WGControllerCenter . logModeWeekToClear == (
 oo00 . tm_wday + 1 ) ) ) :
     try :
      if mMonitorInfo . backupLogfile > 0 :
       if 53 - 53: OooOoo . i1I - ooOOO
       if 34 - 34: i1I - IiI11Ii111 + ooo000 + Ooo0Ooo / oOO
       if 72 - 72: IiIIii11Ii / oOO % ooOOO - oOo0O00
       shutil . copy ( wgGlobal . wgcloudpath1001wgrecord_logName ,
 "{}{}wgrecord.log" . format ( wgGlobal . wgcloudpathdir , time . strftime (
 '%Y%m%d_%H%M%S' ) ) )
       shutil . copy ( wgGlobal . wgcloudpath1001wgrecordtcp_logName ,
 "{}{}wgrecordtcp.log" . format ( wgGlobal . wgcloudpathdir ,
 time . strftime ( '%Y%m%d_%H%M%S' ) ) )
       if 74 - 74: ooo000 * OooOoo * Oo
      with open ( wgGlobal . wgcloudpath1001wgrecord_logName , 'w' ) as Iiii1II11111i :
       Iiii1II11111i . seek ( 0 )
       Iiii1II11111i . truncate ( )
      wgAppConfig . wglog ( "Clear wgrecord.log" )
      if 21 - 21: Iii1i * OooOoo . IiI11Ii111 - Ooo0Ooo
      if 12 - 12: ooOOO
      with open ( wgGlobal . wgcloudpath1001wgrecordtcp_logName , 'w' ) as I1i :
       I1i . seek ( 0 )
       I1i . truncate ( )
      wgAppConfig . wglog ( "Clear wgrecordtcp.log" )
     except :
      pass
      wgAppConfig . logprint ( "failed clear wgrecord" )
      pass
      if 93 - 93: IiI11Ii111 - I11iiIi11i1I * IiI11Ii111 + Ii
      if 100 - 100: IIiIIiIi11I1 * iI1iII1I1I1i
     self . DealWGRecordLogtimeout = time . time ( ) + 120
     if 2 - 2: I11iiIi11i1I * oOo0O00
  if mMonitorInfo . websocketHeartCycle > 0 :
   if 25 - 25: IiI11Ii111
   if self . Dealwebsockettimeout > Ii11i11I1IIi :
    return o00o
   self . Dealwebsockettimeout = Ii11i11I1IIi + mMonitorInfo . websocketHeartCycle
   if not ( mMonitorInfo . ws is None ) :
    if 66 - 66: i1 * I1Ii1I1 % Ii * i1 + Iii1i
    mMonitorInfo . ws . dealHeartBeat ( )
  return o00o
  if 21 - 21: ooOOO
 def DealSendBroadCastToController ( self ) :
  wgAppConfig . logdebug ( "DealsendBroadCastToController Start From " , self . transport . getHost ( ) )
  if 100 - 100: ooo000 + i1I - I11iiIi11i1I / Iii1i
  ooOo0O0O = [ 0x17 , 0x26 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  ooOo0O0O [ 12 ] = 0x40
  I11I11111 = 0x7ffffff0
  WGTools . longToByte ( I11I11111 , ooOo0O0O , 40 , 4 )
  self . bytcmdQuey = bytes ( ooOo0O0O )
  if 95 - 95: i1i1i1111I . oOo0O00 % oOO * IiIIii11Ii % ooOOO + i1
  if 78 - 78: ooo000 - i1I
  if 1 - 1: Ooo0Ooo / Oo % oOO
  if 10 - 10: i1iiIII111 + I11iiIi11i1I . oOO + ooOOO % iI1iII1I1I1i
  if 49 - 49: i1 - iI1iII1I1I1i + iI1iII1I1I1i * Iii1i % IIiIIiIi11I1
  if 15 - 15: ooo000 . i1 * i1
  if 41 - 41: I11iiIi11i1I + Iii1i % ooOOO * i1
  if 37 - 37: ooo000
  if 87 - 87: i1i1i1111I + I1Ii1I1 % i1iiIII111 - I1I + ooOOO % I1Ii1I1
  if 96 - 96: IIiIIiIi11I1 / I1I * i1 / I1I + I1I / i1
  if 80 - 80: Oo / i1i1i1111I . IIiIIiIi11I1
  if 79 - 79: oOO
  if 6 - 6: IiI11Ii111 + IIiIIiIi11I1 + ooOOO % IIiIIiIi11I1
  if 24 - 24: ooo000 + i1I / Ii / Ooo0Ooo % IIiIIiIi11I1
  if 70 - 70: I11iiIi11i1I
  if 45 - 45: I1Ii1I1 * Oo - I11iiIi11i1I * iI1iII1I1I1i
  if 41 - 41: Iii1i . I1I * i1I - i1iiIII111 . IiI11Ii111 + ooOOO
  if 24 - 24: i1 + IIiIIiIi11I1 + i1iiIII111 % I1Ii1I1 + IIiIIiIi11I1
  if 55 - 55: IiIIii11Ii - IiIIii11Ii
  if 52 - 52: I1Ii1I1 - OooOoo % i1I
  if 88 - 88: ooOOO . i1
  if 72 - 72: I1I - OooOoo / Iii1i - I1Ii1I1
  if 54 - 54: I11iiIi11i1I / i1iiIII111 % oOo0O00 - ooOOO
  if 72 - 72: ooo000 . I1Ii1I1 . I1I . IIiIIiIi11I1 + Oo
  if 58 - 58: ooOOO + IiIIii11Ii + oOO % IiIIii11Ii + Ooo0Ooo . Oo
 def checkRunning ( self ) :
  if not ( self . arrUsers is None ) :
   if len ( self . arrUsers ) > 0 :
    o0000oOOO00 = time . time ( )
    if 63 - 63: i1i1i1111I - IiI11Ii111 - iI1iII1I1I1i + OooOoo * i1iiIII111 / Ooo0Ooo
    if 81 - 81: ooo000 % i1i1i1111I . i1iiIII111 / i1iiIII111 / i1iiIII111
    if 84 - 84: ooOOO * ooo000 % ooOOO
    if 57 - 57: i1I * iI1iII1I1I1i % Ooo0Ooo
    for OOoO in list ( self . arrUsers . keys ( ) ) :
     if o0000oOOO00 > self . arrUsers [ OOoO ] . deactivateTime :
      self . arrUsers . pop ( OOoO )
      if 22 - 22: OooOoo . i1
      if 85 - 85: i1i1i1111I * I1Ii1I1 / ooo000
      if 14 - 14: i1i1i1111I
      if 61 - 61: Iii1i . I11iiIi11i1I - Oo . IiI11Ii111 + OooOoo
      if 11 - 11: oOo0O00 - i1 / oOo0O00 * OooOoo - I11iiIi11i1I / I1Ii1I1
      if 4 - 4: IiIIii11Ii
      if 42 - 42: oOO - oOO + OooOoo - oOO
      if 23 - 23: iI1iII1I1I1i % i1I * I11iiIi11i1I - oOO * oOo0O00
      if 45 - 45: i1 % iI1iII1I1I1i . IiIIii11Ii + Ooo0Ooo
 def datagramReceived ( self , data , addr ) :
  if wgGlobal . allowprint :
   if 34 - 34: Iii1i + Iii1i
   if 67 - 67: oOo0O00 + IIiIIiIi11I1
   OOo000o0 = [ '%02X' % i for i in data ]
   if 69 - 69: IIiIIiIi11I1
   wgAppConfig . logdebug (
 "m1001CloudServerUDP received from %s DataLen=%d HexData: %s" % ( addr , len ( data ) , " " . join ( OOo000o0 ) ) )
   if 97 - 97: Iii1i + oOo0O00 - i1 % Iii1i
   if 71 - 71: Ooo0Ooo / Ooo0Ooo % ooo000
   if 32 - 32: ooo000 * ooo000
   if 29 - 29: Ooo0Ooo . i1 * I11iiIi11i1I
   if 98 - 98: ooOOO * oOO + Ooo0Ooo + i1i1i1111I / I1Ii1I1
   if 18 - 18: iI1iII1I1I1i . iI1iII1I1I1i % ooOOO
   if 90 - 90: I1I - Iii1i + Ii / Iii1i % I1Ii1I1
   if 14 - 14: OooOoo + iI1iII1I1I1i * Iii1i
   if 30 - 30: OooOoo
   if 2 - 2: i1iiIII111 / oOo0O00 - IiIIii11Ii - iI1iII1I1I1i
   if 90 - 90: i1iiIII111
   if 11 - 11: ooOOO . ooo000
   if 10 - 10: I1Ii1I1 - ooOOO / Iii1i - i1 . ooo000
   if 99 - 99: Ii / iI1iII1I1I1i / Oo * I11iiIi11i1I
   if 86 - 86: ooo000 - oOo0O00
   if 42 - 42: Ii * oOO
   if 67 - 67: ooOOO
   if 62 - 62: I1I + Ii + I1I * i1 . Ooo0Ooo * i1iiIII111
  if len ( data ) % 64 == 0 :
   if self . taskqueueWGControllerCenter . empty ( ) :
    self . taskqueueWGControllerCenter . put ( len ( data ) )
    if 2 - 2: i1I + Oo
    if 51 - 51: Ii . i1I
    if 89 - 89: IiI11Ii111 * IiIIii11Ii / i1 . I1Ii1I1
    if 64 - 64: IiI11Ii111
    if 44 - 44: Ii . OooOoo + oOO * OooOoo . i1 - i1iiIII111
   i1111 = WGPacket ( data , addr )
   if 72 - 72: iI1iII1I1I1i + I1I * ooo000 . OooOoo + Ii + IIiIIiIi11I1
   if 91 - 91: oOo0O00 % IIiIIiIi11I1 % i1I / I1Ii1I1
   if 70 - 70: iI1iII1I1I1i + IiI11Ii111 + oOO
   if ( ( i1111 . cmdtype == 0x17 ) and ( i1111 . controllerSN > 0 ) and (
 ( i1111 . functionID == 0x20 ) or ( i1111 . functionID == 0x22 ) or (
 i1111 . functionID == 0x26 ) ) and i1111 . sid == 0 ) :
    pass
    if 21 - 21: I11iiIi11i1I
    if 20 - 20: ooOOO + IiIIii11Ii % Iii1i - I11iiIi11i1I
    if 49 - 49: Iii1i / IiIIii11Ii % i1 % i1i1i1111I + oOO * ooo000
   elif ( ( ( i1111 . cmdtype == 0x37 ) and ( ( len ( WGControllerCenter . commPID ) == 0 ) or (
 i1111 . reservedA in WGControllerCenter . commPID ) ) ) ) :
    pass
   else :
    if WGControllerCenter . commSM4 > 0 :
     if ( ( len ( data ) == 192 ) and (
 ( data [ 188 ] == 0 ) and ( data [ 189 ] == 0 ) and ( data [ 190 ] == 0 ) and ( data [ 191 ] == 0 ) ) ) :
      Ii1III1Iii = WGControllerCenter . commSM4_Dec ( data )
      o0oOoOo0O00o = [ data [ OOoO ] for OOoO in range ( 0 , len ( data ) ) ]
      for OOoO in range ( 0 , 64 ) :
       o0oOoOo0O00o [ OOoO ] = Ii1III1Iii [ OOoO ]
      data = bytes ( o0oOoOo0O00o )
     else :
      data = WGControllerCenter . commSM4_Dec ( data )
      if 67 - 67: Ii . I1Ii1I1 / I1I . IIiIIiIi11I1 . Oo / Ii
      if 74 - 74: IIiIIiIi11I1 - IiI11Ii111 % i1I * Ii + i1 + IiI11Ii111
      if 92 - 92: Iii1i
     i1111 = WGPacket ( data , addr )
     if 27 - 27: i1i1i1111I - Ii - oOO + Ooo0Ooo * Ii + IiI11Ii111
   if not i1111 . isValidSN ( ) :
    if 35 - 35: i1i1i1111I . i1i1i1111I + I11iiIi11i1I / Oo . i1
    pass
    if 69 - 69: I1I / i1 % I1Ii1I1 % oOO
    if 96 - 96: Oo - i1I * iI1iII1I1I1i + Ooo0Ooo * Oo
    if 22 - 22: ooo000 % I11iiIi11i1I
    if 44 - 44: oOO / iI1iII1I1I1i % i1iiIII111 + i1iiIII111 % Ooo0Ooo + Ooo0Ooo
    if 93 - 93: i1 % oOO % I1I
    if 49 - 49: ooOOO * iI1iII1I1I1i + ooo000 - Ii . oOo0O00
    if 77 - 77: I11iiIi11i1I
    if 18 - 18: oOo0O00 . I1I / i1iiIII111
    if 3 - 3: oOO + oOO % i1I % Oo / iI1iII1I1I1i . IiIIii11Ii
    if 20 - 20: IiIIii11Ii + i1I
    if 32 - 32: oOo0O00 + i1i1i1111I
    if 74 - 74: I1I % i1i1i1111I * i1iiIII111 * IIiIIiIi11I1
   elif ( ( i1111 . cmdtype == 0x17 ) and ( i1111 . controllerSN > 0 ) and (
 i1111 . functionID == 0x20 ) and i1111 . sid == 0 ) :
    if 23 - 23: i1I * IiI11Ii111 . oOo0O00 * Ii
    self . UDPQueue4HeartBeatPacket . append ( i1111 )
    if 94 - 94: i1i1i1111I - i1iiIII111 . Ooo0Ooo + Oo - i1
    if self . countUsersOfDingyue > 0 and ( self . optionNewRecordSend == 0 ) :
     if 96 - 96: Iii1i % ooo000 * oOo0O00 . Ii % oOO + i1I
     self . UDPQueue4Dingyue . append ( i1111 )
     if 20 - 20: i1 % Ii / ooo000
   elif ( ( i1111 . cmdtype == 0x17 ) and ( i1111 . controllerSN > 0 ) and (
 i1111 . functionID == 0x26 ) and i1111 . sid == 0 ) :
    if 58 - 58: I11iiIi11i1I % i1 . oOo0O00 - OooOoo - OooOoo
    self . UDPQueue4HeartBeatPacket . append ( i1111 )
    if 44 - 44: IIiIIiIi11I1
    if self . countUsersOfDingyue > 0 and ( self . optionNewRecordSend == 0 ) :
     if 74 - 74: oOO . ooOOO - ooo000 . Ooo0Ooo % OooOoo * OooOoo
     self . UDPQueue4Dingyue . append ( i1111 )
     if 62 - 62: IIiIIiIi11I1 / i1I - oOO / I11iiIi11i1I % i1
     if 32 - 32: ooOOO
   elif ( ( i1111 . cmdtype == 0x17 ) and ( i1111 . controllerSN > 0 ) and (
 i1111 . functionID == 0x26 ) and i1111 . sid == 0x7ffffff0 ) :
    if 100 - 100: i1I + Oo . Ooo0Ooo * Ooo0Ooo
    if 47 - 47: i1iiIII111 / IiI11Ii111 + Iii1i
    self . UDPQueue4HeartBeatPacket . append ( i1111 )
    if 99 - 99: IiIIii11Ii / iI1iII1I1I1i % IiI11Ii111
    if self . countUsersOfDingyue > 0 and ( self . optionNewRecordSend == 0 ) :
     if 19 - 19: i1 . IiIIii11Ii / i1i1i1111I / Oo
     self . UDPQueue4Dingyue . append ( i1111 )
     if 95 - 95: i1
   elif ( i1111 . cmdtype == 0x17 ) and ( i1111 . controllerSN > 0 ) and ( i1111 . functionID == 0x22 ) :
    if 80 - 80: Iii1i + i1iiIII111
    self . UDPQueue4QRCode . append ( i1111 )
    self . addToUDPQueue4QRwebAPI ( i1111 )
    mMonitorInfo . sendQRCode ( i1111 )
    if 89 - 89: oOo0O00
    if ( self . countUsersOfDingyue ) > 0 :
     if 58 - 58: i1iiIII111 . oOO / I1I / oOO
     self . UDPQueue4Dingyue . append ( i1111 )
     if 67 - 67: IIiIIiIi11I1 % OooOoo % Iii1i
   elif i1111 . cmdtype == 0x37 :
    if 49 - 49: I11iiIi11i1I * ooOOO . Ii / I1I + IiI11Ii111
    if ( ( len ( WGControllerCenter . commPID ) == 0 ) or (
 i1111 . reservedA in WGControllerCenter . commPID ) ) :
     o0ooO0O00 = 1
     if not ( wgGlobal . allowpcip is None ) :
      if not ( addr [ 0 ] in [ wgGlobal . allowpcip ] ) :
       o0ooO0O00 = 0
     if o0ooO0O00 :
      o0ooO0O00 = self . checkValidPCCommandByPCCticks ( data , i1111 )
      if 47 - 47: Iii1i
     if o0ooO0O00 == 0 :
      pass
     elif i1111 . functionID == 0x10 :
      if 38 - 38: i1 - I11iiIi11i1I - Oo * IIiIIiIi11I1 + oOO % i1i1i1111I
      self . UDPQueue4Dingyue . append ( i1111 )
      if 24 - 24: iI1iII1I1I1i % oOO
     else :
      if 92 - 92: Ii
      self . UDPQueue4Mobile . append ( i1111 )
      if 32 - 32: i1iiIII111 + ooo000 - I1Ii1I1 * IiIIii11Ii . IiIIii11Ii
      if 46 - 46: i1 + ooOOO % ooOOO . Iii1i - ooOOO % i1
   elif i1111 . controllerSN > 0 and i1111 . cmdtype in (
 0x17 , 0x11 , 0x13 , 0x15 ,
 0x19 ) :
    wgAppConfig . logdebug ( "Server Receive <= From ControllerSN={0},xid={1}" . format ( i1111 . controllerSN , i1111 . sid ) )
    if i1111 . sid > 0 :
     if 20 - 20: OooOoo - ooo000 . I11iiIi11i1I
     self . UDPQueue4ReplyFromController . append ( i1111 )
     if 87 - 87: i1 * i1 - OooOoo % oOo0O00 - IiI11Ii111
    if i1111 . functionID == 0x20 :
     if 43 - 43: OooOoo % OooOoo / oOO % I1I
     if 18 - 18: I11iiIi11i1I * Ooo0Ooo / OooOoo
     wgAppConfig . wglog (
 "Server Receive <= From ControllerSN={0} ({1}) reply xid= {2:d}" . format (
 i1111 . controllerSN , addr ,
 i1111 . sid ) )
    elif i1111 . functionID == 0x40 :
     if data [ 8 ] == 1 :
      wgAppConfig . wglog (
 "Server Receive <= Controller RemoteOpenDoor Successfully ControllerSN= {0:d}" . format ( i1111 . controllerSN ) )
     else :
      wgAppConfig . wglog (
 "Server Receive <= Controller  ???RemoteOpenDoor Failed ControllerSN= {0:d}" . format ( i1111 . controllerSN ) )
   if self . taskqueueWGControllerCenter . empty ( ) :
    self . taskqueueWGControllerCenter . put ( len ( data ) )
   del i1111
   if 84 - 84: i1iiIII111 / oOO . Oo % i1iiIII111 / OooOoo
 def checkValidPCCommandByPCCticks ( self , data , wgpkt ) :
  o0ooO0O00 = 1
  if 94 - 94: i1iiIII111
  if 53 - 53: iI1iII1I1I1i + ooOOO * I1I / Oo
  if ( len ( WGControllerCenter . commPID ) == 0 ) :
   return o0ooO0O00
  if ( not ( wgpkt . reservedA in WGControllerCenter . commPID ) ) :
   return o0ooO0O00
  i1ooo0oOo0Oo0 = WGPCinfo ( data )
  if 78 - 78: IiIIii11Ii * ooo000 / IIiIIiIi11I1 - OooOoo
  iiIiI = struct . unpack_from ( "I" , data , 60 ) [ 0 ]
  if wgpkt . functionID == 0x20 :
   o0ooooO0O0OOo = 0
   O0 = struct . unpack_from ( "I" , data , 56 ) [ 0 ]
   O0000000 = struct . unpack_from ( "I" , data , 52 ) [ 0 ]
   iIii11I1i = struct . unpack_from ( "I" , data , 48 ) [ 0 ]
   oOOOO = struct . unpack_from ( "I" , data , 36 ) [ 0 ]
   if ( ( O0 == O0000000 ) and ( iIii11I1i == ( ( O0 * wgpkt . reservedA ) & 0x7fffffff ) ) and (
 iiIiI <= O0 + 5 * 50 and iiIiI > O0 ) ) :
    OOO0 = time . time ( )
    if ( abs ( oOOOO - OOO0 ) < 10 * 60 ) :
     if ( abs ( ( i1ooo0oOo0Oo0 . ctickOfPC + oOOOO * 50 ) - (
 O0 + ( i1ooo0oOo0Oo0 . pcUTC * 50 ) ) ) < 3 * 50 ) :
      if ( O0 > i1ooo0oOo0Oo0 . ctickOfPC ) :
       o0ooooO0O0OOo = 1
     else :
      o0ooooO0O0OOo = 1
   if o0ooooO0O0OOo > 0 :
    i1ooo0oOo0Oo0 . ctickOfPC = O0
    i1ooo0oOo0Oo0 . refreshTimeFrom1970ofctickOfPC = time . time ( )
    i1ooo0oOo0Oo0 . pcUTC = oOOOO
    self . dictPC [ wgpkt . reservedA ] = i1ooo0oOo0Oo0
    return o0ooO0O00
  i1ooo0oOo0Oo0 = self . dictPC . get ( wgpkt . reservedA )
  if i1ooo0oOo0Oo0 is None :
   o0ooO0O00 = 0
  else :
   i1ooo0oOo0Oo0 = self . dictPC [ wgpkt . reservedA ]
   OoOO0oO0O = time . time ( ) - i1ooo0oOo0Oo0 . refreshTimeFrom1970ofctickOfPC
   OoOO0oO0O = i1ooo0oOo0Oo0 . ctickOfPC + int (
 ( OoOO0oO0O ) * 50 )
   O0 = OoOO0oO0O
   if 7 - 7: OooOoo % iI1iII1I1I1i - I11iiIi11i1I . I1Ii1I1 . oOO % OooOoo
   if 51 - 51: iI1iII1I1I1i + I1Ii1I1 . i1I - I1I
   if 59 - 59: ooOOO
   if 42 - 42: I1Ii1I1 * Oo * Oo . iI1iII1I1I1i * IiIIii11Ii * i1i1i1111I
   if ( iiIiI + 50 >= OoOO0oO0O and iiIiI <= (
 OoOO0oO0O + 5 * 50 + 50 ) ) :
    pass
   else :
    o0ooO0O00 = 0
  return o0ooO0O00
  if 68 - 68: I11iiIi11i1I - I1Ii1I1 % oOO - Ii - i1iiIII111 / i1I
  if 85 - 85: OooOoo / I1Ii1I1
  if 99 - 99: Ooo0Ooo . oOo0O00 + iI1iII1I1I1i * I1Ii1I1 + OooOoo . I1I
class WGControllerCenter2023 ( DatagramProtocol ) :
 if 1 - 1: Iii1i + IIiIIiIi11I1 - oOO - IiI11Ii111 . IIiIIiIi11I1
 if 31 - 31: IIiIIiIi11I1 % iI1iII1I1I1i
 if 53 - 53: IiI11Ii111 . Iii1i % oOO / ooOOO
 if 80 - 80: I1I % I1Ii1I1 . Ii / IiIIii11Ii * OooOoo . Ii
 if 86 - 86: oOo0O00 % i1i1i1111I + Oo . I1Ii1I1 - I1Ii1I1
 if 87 - 87: IiI11Ii111 % oOO % I1Ii1I1
 if 59 - 59: IiIIii11Ii % i1i1i1111I . i1iiIII111 + ooo000 + Ooo0Ooo . oOO
 if 9 - 9: OooOoo - ooOOO . i1iiIII111
 if 68 - 68: I1I % I1I * Ii % Oo
 if 74 - 74: I11iiIi11i1I * IIiIIiIi11I1 . IiI11Ii111 * oOo0O00 * IiI11Ii111 - i1iiIII111
 if 34 - 34: IiI11Ii111 % OooOoo + i1I % I11iiIi11i1I - IIiIIiIi11I1
 if 64 - 64: i1 % oOo0O00
 allowErrWrite4sendingBroadcast = 0
 if 25 - 25: Oo
 def __init__ ( self ) :
  if 4 - 4: Oo * I1I * Ooo0Ooo % Ooo0Ooo
  super ( WGControllerCenter2023 , self ) . __init__ ( )
  if 6 - 6: oOO + I1I * Iii1i
  if 82 - 82: oOo0O00 * ooOOO
  if 9 - 9: I11iiIi11i1I + i1iiIII111 % Iii1i
  if 15 - 15: i1iiIII111 + i1I - Iii1i % I1I / i1iiIII111 + IIiIIiIi11I1
  if 61 - 61: OooOoo
  if 62 - 62: iI1iII1I1I1i * oOO
  self . UDPQueue4Mobile = None
  self . UDPQueue4ReplyFromController = None
  if 43 - 43: Ii - oOo0O00 % i1iiIII111 % oOO
  self . UDPQueue4Mobile = deque ( )
  self . UDPQueue4ReplyFromController = deque ( )
  if 69 - 69: I1I
  if 74 - 74: IiIIii11Ii + OooOoo . Iii1i + ooo000 + oOO * I1Ii1I1
  if 74 - 74: I1Ii1I1 - Oo % i1iiIII111 + Ii * ooOOO
  if 53 - 53: IIiIIiIi11I1
  if 31 - 31: oOo0O00 - I11iiIi11i1I / oOo0O00
  self . cmdQuey26 = [ 0x17 , 0x26 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  self . cmdQuey26 [ 12 ] = 0x40
  self . taskqueueWGControllerCenter2023 = Queue ( )
  if 23 - 23: IiIIii11Ii
 def startProtocol ( self ) :
  self . startnet ( )
  if 5 - 5: iI1iII1I1I1i . I11iiIi11i1I
  if 4 - 4: OooOoo % i1iiIII111 / I11iiIi11i1I - oOo0O00
 def startnet ( self ) :
  self . DealSendBroadCastToController ( )
  deferToThread ( self . DealMoreData )
  if 100 - 100: Oo / OooOoo % I1I
 def DealMoreData ( self ) :
  if 93 - 93: iI1iII1I1I1i
  if 50 - 50: Oo % oOo0O00 . IiI11Ii111 . i1iiIII111 . Ii - Oo
  if 67 - 67: oOo0O00 * i1I . I1I + I1I + oOo0O00 / ooOOO
  if 69 - 69: Oo - OooOoo + I1Ii1I1
  if 36 - 36: Iii1i
  if 80 - 80: Oo % oOO / oOO + ooOOO + OooOoo
  if 91 - 91: i1 % i1i1i1111I / oOo0O00
  if 79 - 79: iI1iII1I1I1i % OooOoo . Iii1i
  if 61 - 61: Oo . Ii - Ooo0Ooo . I1Ii1I1 - IiI11Ii111 * i1I
  if 81 - 81: iI1iII1I1I1i * IiIIii11Ii % i1iiIII111 + oOO / iI1iII1I1I1i . i1I
  if 17 - 17: iI1iII1I1I1i
  if 13 - 13: iI1iII1I1I1i + i1 - OooOoo / IiI11Ii111
  if 34 - 34: I1Ii1I1 - i1iiIII111 * i1iiIII111
  if 59 - 59: i1i1i1111I . Oo - IIiIIiIi11I1 + iI1iII1I1I1i
  if 22 - 22: IiI11Ii111 + OooOoo % I11iiIi11i1I
  if 14 - 14: Oo * oOO + i1i1i1111I * oOo0O00
  if 69 - 69: i1I - i1 - i1 % oOO
  if 21 - 21: i1i1i1111I - I1I + i1I * Ooo0Ooo
  if 56 - 56: oOO + i1 * i1i1i1111I / i1I * IIiIIiIi11I1
  if 15 - 15: iI1iII1I1I1i % oOO + iI1iII1I1I1i . oOo0O00 / ooo000
  if 9 - 9: IiI11Ii111 . i1iiIII111 - Ii - I1I . OooOoo
  while True :
   Ooo = False
   try :
    Ooo = Ooo or ( self . DealUDPQueue4Mobile ( ) )
    Ooo = Ooo or ( self . DealUDPQueue4ReplyFromController ( ) )
   except Exception as ooo :
    pass
    mMonitorInfo . wglog ( "1101" )
    mMonitorInfo . wglog (
 ooo )
   if not Ooo :
    time . sleep ( 0.001 )
    if mMonitorInfo . bSearchController > 0 :
     mMonitorInfo . allchangePortTime = time . time ( )
     self . sendingBroadcast ( )
     time . sleep ( 0.1 )
     mMonitorInfo . bSearchController = 0
    pass
   if not Ooo :
    try :
     i11I1iII1I1 = self . taskqueueWGControllerCenter2023 . get ( block = True )
     self . taskqueueWGControllerCenter2023 . task_done ( )
    except Exception as IIIi11ii1Ii :
     pass
     if 75 - 75: OooOoo . OooOoo * oOO - ooo000 + i1I % iI1iII1I1I1i
 def DealUDPQueue4Mobile ( self ) :
  if 26 - 26: i1iiIII111 * oOo0O00
  o00o = False
  while True :
   if self . UDPQueue4Mobile . __len__ ( ) > 0 :
    o00o = True
    i1111 = self . UDPQueue4Mobile . popleft ( )
    o00oOo0OOOO00 = i1111 . commandData
    i1I1Ii = ( "255.255.255.255" , 60000 )
    self . transport . write ( bytes ( o00oOo0OOOO00 ) , i1I1Ii )
   else :
    if 73 - 73: Ooo0Ooo + IiIIii11Ii * i1I . IiI11Ii111 . ooo000 % OooOoo
    return o00o
    if 38 - 38: IiIIii11Ii
    if 71 - 71: Iii1i
    if 91 - 91: Oo + Iii1i + Ooo0Ooo / i1I * ooo000
    if 81 - 81: ooo000 * ooo000 - Ooo0Ooo
    if 70 - 70: I1Ii1I1 * IIiIIiIi11I1
    if 18 - 18: ooo000 % IiIIii11Ii
    if 54 - 54: OooOoo + OooOoo
    if 2 - 2: Iii1i
    if 19 - 19: Ooo0Ooo - i1i1i1111I / Ooo0Ooo / IiI11Ii111 - IiI11Ii111 - I1Ii1I1
    if 59 - 59: oOO - ooo000 - i1 + Ooo0Ooo / IiI11Ii111
    if 1 - 1: i1 - I11iiIi11i1I * Ooo0Ooo + i1I % IiIIii11Ii
    if 5 - 5: i1I
    if 62 - 62: Oo + IIiIIiIi11I1 % i1i1i1111I * I11iiIi11i1I / iI1iII1I1I1i + I11iiIi11i1I
    if 11 - 11: i1i1i1111I % IIiIIiIi11I1 / i1i1i1111I * oOO * i1I
    if 40 - 40: i1iiIII111 . Iii1i % iI1iII1I1I1i - IIiIIiIi11I1 % i1I
    if 94 - 94: IiIIii11Ii - oOo0O00 + I1Ii1I1
    if 5 - 5: oOo0O00 % i1I * Ii + IIiIIiIi11I1 * I1Ii1I1 % i1I
    if 7 - 7: IiI11Ii111 + oOo0O00 . i1i1i1111I - I11iiIi11i1I / ooOOO . ooOOO
    if 17 - 17: ooOOO + Iii1i + Oo * I1Ii1I1 % i1I
    if 95 - 95: iI1iII1I1I1i * IiIIii11Ii
    if 23 - 23: i1 * I1Ii1I1 - I11iiIi11i1I
    if 5 - 5: OooOoo . OooOoo % IIiIIiIi11I1
    if 97 - 97: i1 - iI1iII1I1I1i * I1Ii1I1 * I1I
    if 74 - 74: Ii + ooOOO * Ii . iI1iII1I1I1i / IIiIIiIi11I1 - oOo0O00
    if 61 - 61: i1 % ooo000 - ooOOO - I11iiIi11i1I / Iii1i - oOo0O00
    if 58 - 58: i1iiIII111 * Ii % oOO . IiIIii11Ii
    if 56 - 56: ooOOO * ooOOO + Oo + i1I + ooo000
    if 60 - 60: i1 * i1I * I11iiIi11i1I / I1Ii1I1 + oOO + Iii1i
    if 87 - 87: i1i1i1111I
    if 2 - 2: I11iiIi11i1I . iI1iII1I1I1i . i1 + oOo0O00
    if 33 - 33: Iii1i . IiI11Ii111
    if 12 - 12: IiI11Ii111
    if 85 - 85: Oo % Oo
    if 12 - 12: ooo000 / i1I * Oo / I1Ii1I1 * ooOOO
    if 38 - 38: i1i1i1111I * iI1iII1I1I1i * Ooo0Ooo + i1iiIII111
    if 33 - 33: ooOOO . Ii
    if 49 - 49: Ii + ooOOO + iI1iII1I1I1i / i1i1i1111I
    if 63 - 63: ooo000 % I1Ii1I1
    if 83 - 83: OooOoo . Ooo0Ooo % IiI11Ii111 / Oo
    if 57 - 57: Oo + i1i1i1111I . i1I . ooOOO * Iii1i - IIiIIiIi11I1
    if 20 - 20: Iii1i * ooo000 . OooOoo + i1iiIII111 * i1I - Iii1i
    if 66 - 66: IIiIIiIi11I1 - ooo000 - i1i1i1111I * i1 % ooo000 . IIiIIiIi11I1
    if 16 - 16: IiIIii11Ii % oOo0O00 + Ii - i1i1i1111I * IiIIii11Ii
    if 69 - 69: iI1iII1I1I1i . I1I + I1Ii1I1
    if 71 - 71: ooo000
    if 85 - 85: ooo000 + Oo
    if 81 - 81: IIiIIiIi11I1 + iI1iII1I1I1i . I1I * Ii / Iii1i / i1I
    if 31 - 31: i1i1i1111I - oOo0O00 % oOO - iI1iII1I1I1i
    if 3 - 3: i1iiIII111
    if 8 - 8: Ii * Oo - I1I
    if 84 - 84: iI1iII1I1I1i % oOO * i1I / i1i1i1111I / OooOoo . IIiIIiIi11I1
    if 84 - 84: IIiIIiIi11I1
    if 80 - 80: i1
    if 90 - 90: Iii1i / Ii / Oo + IiI11Ii111 - i1I / i1i1i1111I
    if 14 - 14: IIiIIiIi11I1
    if 77 - 77: i1i1i1111I / Ooo0Ooo / ooo000 + Oo + i1I
    if 70 - 70: I1I + Ii
 def DealUDPQueue4ReplyFromController ( self ) :
  o00o = False
  while True :
   try :
    if self . UDPQueue4ReplyFromController . __len__ ( ) > 0 :
     o00o = True
     i1111 = self . UDPQueue4ReplyFromController . popleft ( )
     if self . transport is None :
      continue
     o00oOo0OOOO00 = i1111 . commandData
     if 76 - 76: i1i1i1111I + Oo
     i1I1Ii = ( self . transport . interface , wgGlobal . dataserverPort )
     self . transport . write ( bytes ( o00oOo0OOOO00 ) , i1I1Ii )
    else :
     return o00o
     if 36 - 36: I1Ii1I1 - IiIIii11Ii
   except Exception as ooo :
    pass
    if 71 - 71: i1 - i1I
    if 6 - 6: IiI11Ii111 . ooo000
    mMonitorInfo . wglog ( "Broadcast Server 1104-C" )
    wgAppConfig . wglog ( "{0}: {1}" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , ooo ) )
    return o00o
    if 100 - 100: IIiIIiIi11I1 . i1i1i1111I
    if 1 - 1: I1Ii1I1
    if 12 - 12: i1I * Ooo0Ooo + IIiIIiIi11I1 * OooOoo * OooOoo / ooOOO
    if 67 - 67: i1 - IiI11Ii111 / Ii * IiI11Ii111
    if 24 - 24: IiI11Ii111 - oOo0O00 . Ooo0Ooo + oOO . I1I / Oo
    if 68 - 68: IiI11Ii111
    if 47 - 47: i1 % I1I - Ii + Oo / OooOoo
    if 88 - 88: I1Ii1I1 - Ii / IiIIii11Ii . oOo0O00
    if 27 - 27: i1iiIII111 + iI1iII1I1I1i % Oo . Ii
    if 69 - 69: Iii1i / IIiIIiIi11I1
    if 66 - 66: i1i1i1111I
    if 31 - 31: i1I - i1iiIII111 % I1I - i1iiIII111 * Oo / i1iiIII111
    if 30 - 30: i1
    if 95 - 95: ooo000 / i1i1i1111I / i1I - IIiIIiIi11I1
    if 7 - 7: I1I / iI1iII1I1I1i % ooo000 / IiIIii11Ii
    if 18 - 18: I1I * IiIIii11Ii * I1I + i1iiIII111
    if 17 - 17: i1I
    if 8 - 8: Oo / iI1iII1I1I1i - Ooo0Ooo
    if 22 - 22: oOo0O00 / I1Ii1I1 % IiI11Ii111
    if 22 - 22: i1 % Ooo0Ooo . IIiIIiIi11I1 % i1I / IIiIIiIi11I1
    if 60 - 60: Ooo0Ooo . i1 * i1
    if 42 - 42: i1 % OooOoo % Iii1i % Ooo0Ooo
    if 6 - 6: IIiIIiIi11I1
    if 94 - 94: Ooo0Ooo . ooo000 % Oo - IIiIIiIi11I1 - i1
    if 11 - 11: Ooo0Ooo . OooOoo / oOo0O00 + i1i1i1111I / Iii1i
    if 62 - 62: I1Ii1I1 + iI1iII1I1I1i * i1I % iI1iII1I1I1i . OooOoo - ooo000
    if 24 - 24: iI1iII1I1I1i * Iii1i * i1i1i1111I
    if 50 - 50: I11iiIi11i1I + oOo0O00 . ooOOO - IiI11Ii111 * i1I % I1I
    if 88 - 88: IiI11Ii111
    if 43 - 43: I11iiIi11i1I . IiIIii11Ii * Oo . IiIIii11Ii - IiI11Ii111 - Ii
    if 47 - 47: oOO / i1i1i1111I * oOO
    if 91 - 91: i1iiIII111 / i1
    if 70 - 70: IIiIIiIi11I1
    if 95 - 95: I1I * i1 * IiIIii11Ii + I11iiIi11i1I + Ooo0Ooo
    if 36 - 36: i1i1i1111I
    if 48 - 48: IIiIIiIi11I1 - I11iiIi11i1I % Oo
    if 61 - 61: oOO % iI1iII1I1I1i + IiIIii11Ii % i1i1i1111I * iI1iII1I1I1i / i1i1i1111I
    if 11 - 11: oOo0O00 / Oo . ooOOO / Oo
    if 90 - 90: OooOoo - I1I
    if 67 - 67: oOo0O00 . oOO - IIiIIiIi11I1 / Ooo0Ooo + Iii1i - oOo0O00
    if 25 - 25: Iii1i
    if 30 - 30: i1iiIII111 * i1I - i1iiIII111 + i1I - I11iiIi11i1I
    if 71 - 71: oOo0O00 - OooOoo % I1Ii1I1 + ooOOO
    if 30 - 30: oOo0O00 + OooOoo . oOo0O00 + iI1iII1I1I1i
    if 22 - 22: oOO / I1Ii1I1 + OooOoo / i1 / Oo
    if 6 - 6: OooOoo % ooOOO - IiIIii11Ii
    if 24 - 24: Ii % i1iiIII111
    if 45 - 45: iI1iII1I1I1i + oOO
    if 21 - 21: Oo + ooo000 . OooOoo - i1iiIII111 - OooOoo
    if 1 - 1: I11iiIi11i1I % oOo0O00 + oOo0O00 - OooOoo % iI1iII1I1I1i % i1iiIII111
    if 89 - 89: IIiIIiIi11I1
    if 6 - 6: oOO * Oo
    if 40 - 40: ooo000
    if 80 - 80: IiIIii11Ii - i1i1i1111I
    if 42 - 42: IiI11Ii111
    if 83 - 83: I11iiIi11i1I % i1
    if 99 - 99: Iii1i / oOO . iI1iII1I1I1i
 def DealSendBroadCastToController ( self ) :
  self . transport . setBroadcastAllowed ( True )
  self . bytcmdQuey = bytes ( self . cmdQuey26 )
  task . LoopingCall ( self . sendingBroadcast ) . start ( 60 , True )
  if 87 - 87: I11iiIi11i1I . I1I - i1iiIII111 - IiI11Ii111 % Ii % IiIIii11Ii
 def sendingBroadcast ( self ) :
  try :
   if self . transport :
    i1I1Ii = ( "255.255.255.255" , 60000 )
    self . transport . write ( self . bytcmdQuey , i1I1Ii )
  except Exception as ooo :
   if 51 - 51: Ooo0Ooo * IiIIii11Ii
   pass
   if self . allowErrWrite4sendingBroadcast < 5 :
    wgAppConfig . logprint ( ooo )
    OO = ""
    try :
     OO = self . transport . getHost ( )
    except Exception as IIIi11ii1Ii :
     pass
    finally :
     pass
    mMonitorInfo . wglog (
 "Broadcast Server Err1105 {0}: {1} from {2}" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) ,
 ooo , OO ) )
    if 45 - 45: iI1iII1I1I1i + i1i1i1111I % I1I
    if 94 - 94: Ooo0Ooo * oOo0O00 - Ooo0Ooo / Ooo0Ooo
    if 18 - 18: i1i1i1111I % I1I / IIiIIiIi11I1 + i1iiIII111 % i1i1i1111I
    if 76 - 76: Iii1i . ooOOO - I1Ii1I1 - oOO
    if 60 - 60: OooOoo % I1Ii1I1 / oOo0O00 - IIiIIiIi11I1 % oOo0O00 . i1I
    if 39 - 39: iI1iII1I1I1i % Iii1i / OooOoo . ooOOO
    if 39 - 39: IIiIIiIi11I1 * oOo0O00 . I1Ii1I1 - i1 - Oo . ooOOO
    self . allowErrWrite4sendingBroadcast += 1
    if 64 - 64: IiI11Ii111
 def datagramReceived ( self , data , addr ) :
  if wgGlobal . allowprint :
   if 96 - 96: IIiIIiIi11I1 % Ooo0Ooo % ooOOO
   if 81 - 81: Oo - I11iiIi11i1I + i1I * ooOOO . i1I / Ii
   OOo000o0 = [ '%02X' % i for i in data ]
   if 19 - 19: OooOoo - I1Ii1I1 + Ii
   wgAppConfig . logdebug (
 "Broadcast Server received from %s DataLen=%d HexData: %s" % ( addr , len ( data ) , " " . join ( OOo000o0 ) ) )
  if len ( data ) % 64 == 0 :
   if self . taskqueueWGControllerCenter2023 . empty ( ) :
    self . taskqueueWGControllerCenter2023 . put ( len ( data ) )
   i1111 = WGPacket ( data , addr )
   if ( i1111 . cmdtype == 0x17 ) and ( i1111 . controllerSN > 0 ) :
    if addr [ 1 ] == wgGlobal . dataserverPort :
     self . UDPQueue4Mobile . append ( i1111 )
     if 35 - 35: IiIIii11Ii - oOo0O00 . oOo0O00
    elif addr [ 1 ] == 60000 :
     self . UDPQueue4ReplyFromController . append ( i1111 )
   del i1111
   if self . taskqueueWGControllerCenter2023 . empty ( ) :
    self . taskqueueWGControllerCenter2023 . put ( len ( data ) )
    if 68 - 68: I11iiIi11i1I . I1Ii1I1 / IiI11Ii111 . oOO / i1iiIII111 + oOo0O00
    if 35 - 35: IiIIii11Ii * oOO . IiIIii11Ii % Iii1i / I11iiIi11i1I / oOo0O00
class FrmADCT3000 ( ) :
 arrpcips = None
 if 48 - 48: i1iiIII111 - Oo / OooOoo / I11iiIi11i1I
 def __init__ ( self ) :
  self . arripsAreWatching = [ ]
  self . arripsLast = None
  if 29 - 29: IiI11Ii111 % I11iiIi11i1I
 def start1001server ( self ) :
  IiiiiIII1 = wgAppConfig . getIPV4 ( )
  if 47 - 47: IiI11Ii111 - I11iiIi11i1I
  if 98 - 98: oOo0O00 / Oo . i1
  self . arripsLast = IiiiiIII1 . copy ( )
  FrmADCT3000 . arrpcips = self . arripsLast . copy ( )
  mMonitorInfo . arrwgControllerCenter2023 = [ ]
  if len ( IiiiiIII1 ) > 0 :
   if 17 - 17: i1 / OooOoo + OooOoo / Ooo0Ooo . Oo * i1i1i1111I
   for Iiiii111 in IiiiiIII1 :
    import socket
    IIiIiii1i1ii1Ii = socket . socket ( socket . AF_INET , socket . SOCK_DGRAM )
    if 12 - 12: ooOOO * i1I
    IIiIiii1i1ii1Ii . setblocking ( False )
    if 45 - 45: I11iiIi11i1I / IiI11Ii111 * i1
    if 65 - 65: Oo . Iii1i % I1I % I1I * oOo0O00
    try :
     if 22 - 22: Oo . I11iiIi11i1I / IIiIIiIi11I1 * i1I + I1Ii1I1
     IIiIiii1i1ii1Ii . bind ( ( Iiiii111 , 0 ) )
     if 57 - 57: I1Ii1I1 . ooo000 + I1I - i1 % Oo - i1iiIII111
     if 16 - 16: I11iiIi11i1I . IIiIIiIi11I1 / oOo0O00 + oOO
     IIiIiii1i1ii1Ii . setsockopt ( socket . SOL_SOCKET , socket . SO_BROADCAST , 1 )
     iIiIII1 = WGControllerCenter2023 ( )
     O0OOO = reactor . adoptDatagramPort ( IIiIiii1i1ii1Ii . fileno ( ) , socket . AF_INET , iIiIII1 )
     if 25 - 25: IIiIIiIi11I1
     IIiIiii1i1ii1Ii . close ( )
     self . arripsAreWatching . append ( Iiiii111 )
     mMonitorInfo . arrwgControllerCenter2023 . append ( iIiIII1 )
     mMonitorInfo . arrwgControllerCenter2023Port . append ( O0OOO )
    except Exception as ooo :
     if 87 - 87: Iii1i / IIiIIiIi11I1 * Oo
     pass
     wgAppConfig . logprint (
 "Broadcast Server {0}: {1} {2} {3}" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , Iiiii111 , 0 , ooo ) )
     wgAppConfig . logprint ( "wgconfig.ini..." )
  if len ( self . arripsAreWatching ) == 0 :
   mMonitorInfo . wglog ( "Broadcast Server {0}: create failed\r\n" . format ( "" ) )
  else :
   O00oooOO00 = [ ]
   for ii1iiII111IiI in mMonitorInfo . arrwgControllerCenter2023Port :
    O00oooOO00 . append ( ii1iiII111IiI . getHost ( ) )
    if 14 - 14: i1i1i1111I / I1I + I1I + ooo000 % i1 . Ooo0Ooo
   mMonitorInfo . wglog (
 "Broadcast Server : {0} {1}" . format ( self . arripsAreWatching , O00oooOO00 ) )
   if 93 - 93: i1I + ooOOO % ooo000 * IiIIii11Ii
   if 61 - 61: ooo000 % I11iiIi11i1I - OooOoo + Oo - ooOOO . IIiIIiIi11I1
  task . LoopingCall ( self . checkNetChanged ) . start ( 60 , True )
  if 64 - 64: OooOoo * Iii1i
  if 13 - 13: i1i1i1111I . Iii1i - ooo000 / i1iiIII111 % oOo0O00 / IiI11Ii111
  if 80 - 80: i1i1i1111I
 def checkNetChanged ( self ) :
  IiiiiIII1 = wgAppConfig . getIPV4 ( )
  if IiiiiIII1 == [ ] :
   return
  if self . arripsLast == IiiiiIII1 :
   return
  mMonitorInfo . wglog ( "checkNetChanged--New" )
  mMonitorInfo . wglog ( IiiiiIII1 )
  if self . arripsLast is not None :
   OO0OO = self . arripsLast . copy ( )
  else :
   OO0OO = [ ]
  self . arripsLast = IiiiiIII1
  FrmADCT3000 . arrpcips = self . arripsLast . copy ( )
  if 65 - 65: i1iiIII111 % oOO % Iii1i
  if len ( IiiiiIII1 ) == 0 or len ( OO0OO ) == 0 :
   try :
    if 98 - 98: Ooo0Ooo
    for ii1iiII111IiI in mMonitorInfo . arrwgControllerCenter2023Port :
     ii1iiII111IiI . connectionLost ( )
   except Exception as IIIi11ii1Ii :
    pass
   mMonitorInfo . arrwgControllerCenter2023Port = [ ]
   mMonitorInfo . arrwgControllerCenter2023 = [ ]
   self . arripsAreWatching . clear ( )
  else :
   if 16 - 16: i1iiIII111 - iI1iII1I1I1i - Ii - Ii
   for IiIIiI1IIi11I in OO0OO :
    if IiIIiI1IIi11I not in IiiiiIII1 :
     for Oo0oOOO0O0 in range ( 0 , len ( self . arripsAreWatching ) ) :
      if self . arripsAreWatching [ Oo0oOOO0O0 ] == IiIIiI1IIi11I :
       mMonitorInfo . arrwgControllerCenter2023Port [ Oo0oOOO0O0 ] . connectionLost ( )
       if 87 - 87: i1iiIII111 + Iii1i . i1I
       del mMonitorInfo . arrwgControllerCenter2023 [ Oo0oOOO0O0 ]
       del mMonitorInfo . arrwgControllerCenter2023Port [ Oo0oOOO0O0 ]
       del self . arripsAreWatching [ Oo0oOOO0O0 ]
       break
       if 6 - 6: IiIIii11Ii + i1I
       if 4 - 4: ooo000 + Ooo0Ooo . IiIIii11Ii + IiIIii11Ii - i1 . i1
  if len ( IiiiiIII1 ) > 0 :
   for Iiiii111 in IiiiiIII1 :
    if 31 - 31: i1I + i1i1i1111I . Oo + I1Ii1I1 + oOO . i1iiIII111
    if Iiiii111 not in self . arripsAreWatching :
     import socket
     IIiIiii1i1ii1Ii = socket . socket ( socket . AF_INET , socket . SOCK_DGRAM )
     if 5 - 5: Ooo0Ooo * I11iiIi11i1I % ooOOO - Iii1i
     IIiIiii1i1ii1Ii . setblocking ( False )
     try :
      if 90 - 90: Iii1i % ooo000 + ooo000 % i1iiIII111
      IIiIiii1i1ii1Ii . bind ( ( Iiiii111 , 0 ) )
      if 74 - 74: IIiIIiIi11I1
      if 13 - 13: I1I * IIiIIiIi11I1 + i1iiIII111 % IiI11Ii111 / IiIIii11Ii + Ooo0Ooo
      if 26 - 26: i1i1i1111I * I1I % ooOOO + Ii
      IIiIiii1i1ii1Ii . setsockopt ( socket . SOL_SOCKET , socket . SO_BROADCAST , 1 )
      iIiIII1 = WGControllerCenter2023 ( )
      O0OOO = reactor . adoptDatagramPort ( IIiIiii1i1ii1Ii . fileno ( ) , socket . AF_INET , iIiIII1 )
      if 39 - 39: i1 - i1i1i1111I % i1I * i1I . i1iiIII111
      IIiIiii1i1ii1Ii . close ( )
      if 35 - 35: i1I
      self . arripsAreWatching . append ( Iiiii111 )
      mMonitorInfo . arrwgControllerCenter2023 . append ( iIiIII1 )
      mMonitorInfo . arrwgControllerCenter2023Port . append ( O0OOO )
      if 68 - 68: I1I - i1i1i1111I + oOo0O00 * I11iiIi11i1I
     except Exception as ooo :
      pass
      if 39 - 39: oOO * I1I + ooo000 - ooOOO
      wgAppConfig . logprint (
 "Broadcast Server {0}: {1} {2} {3}" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , Iiiii111 , 0 ,
 ooo ) )
      wgAppConfig . logprint ( "wgconfig.ini..." )
  if len ( self . arripsAreWatching ) == 0 :
   pass
  else :
   O00oooOO00 = [ ]
   for ii1iiII111IiI in mMonitorInfo . arrwgControllerCenter2023Port :
    O00oooOO00 . append ( ii1iiII111IiI . getHost ( ) )
    if 80 - 80: oOO - Iii1i / I11iiIi11i1I * i1I / IIiIIiIi11I1
   mMonitorInfo . wglog (
 "Broadcast Server : {0} {1}" . format ( self . arripsAreWatching , O00oooOO00 ) )
   if 28 - 28: iI1iII1I1I1i * oOO + Ooo0Ooo % Ii % I1I % IiIIii11Ii
 @ staticmethod
 def run_file ( cmd ) :
  try :
   import subprocess
   subprocess . run ( cmd . split ( ) , timeout = 5 )
  except Exception as IIIi11ii1Ii :
   print ( IIIi11ii1Ii )
   print ( cmd )
   if 60 - 60: OooOoo / oOo0O00
 @ staticmethod
 def checkValidIPOnline ( ) :
  global socket
  o00o = 0
  IiiiiIII1 = wgAppConfig . getIPV4 ( )
  if 56 - 56: i1i1i1111I + I1I * ooOOO - oOo0O00
  if 83 - 83: IiI11Ii111 + i1
  if len ( IiiiiIII1 ) > 0 :
   if 52 - 52: OooOoo . I1I
   for Iiiii111 in IiiiiIII1 :
    import socket
    IIiIiii1i1ii1Ii = socket . socket ( socket . AF_INET , socket . SOCK_DGRAM )
    if 4 - 4: iI1iII1I1I1i + IIiIIiIi11I1
    IIiIiii1i1ii1Ii . setblocking ( False )
    if 72 - 72: Ii - I1Ii1I1 / OooOoo + Iii1i
    if 34 - 34: oOO * Ii / IIiIIiIi11I1
    try :
     if 3 - 3: i1i1i1111I
     IIiIiii1i1ii1Ii . bind ( ( Iiiii111 , 0 ) )
     if 41 - 41: i1i1i1111I + IiIIii11Ii - i1i1i1111I * OooOoo - i1
     if 15 - 15: I11iiIi11i1I * I11iiIi11i1I . i1I * ooOOO % IIiIIiIi11I1
     IIiIiii1i1ii1Ii . setsockopt ( socket . SOL_SOCKET , socket . SO_BROADCAST , 1 )
     iIiIII1 = WGControllerCenter2023 ( )
     O0OOO = reactor . adoptDatagramPort ( IIiIiii1i1ii1Ii . fileno ( ) , socket . AF_INET , iIiIII1 )
     if 12 - 12: Oo % i1iiIII111
     IIiIiii1i1ii1Ii . close ( )
     o00o = 1
     if 43 - 43: ooo000 * i1 * I1I - Oo / I1Ii1I1
     O0OOO . connectionLost ( )
     if 28 - 28: Ooo0Ooo - i1I + Ii
     break
    except Exception as ooo :
     if 63 - 63: Oo + oOO + IIiIIiIi11I1 - i1 * ooOOO
     pass
   try :
    I1IIi11i1 = "192.168.123.123"
    i1II11 = [ "NanoPi-R2S" , "luckfox" ]
    if I1IIi11i1 not in IiiiiIII1 :
     ooOOoOOOoo = socket . gethostname ( )
     if ooOOoOOOoo in i1II11 and '/' in wgGlobal . wgcloudpathdir :
      print ( ooOOoOOOoo + " add {}" . format ( I1IIi11i1 ) )
      FrmADCT3000 . run_file ( 'ip addr add {}/24 dev eth0' . format ( I1IIi11i1 ) )
   except Exception as ooo :
    print ( ooo )
    pass
  return o00o
  if 39 - 39: iI1iII1I1I1i / i1iiIII111
  if 99 - 99: Ii - i1i1i1111I + IIiIIiIi11I1 - Ooo0Ooo * Ooo0Ooo + Oo
  if 21 - 21: I11iiIi11i1I + IiIIii11Ii . IiI11Ii111 - oOO * i1iiIII111 * iI1iII1I1I1i
  if 89 - 89: Ii
  if 83 - 83: iI1iII1I1I1i / OooOoo * ooo000 . oOo0O00 / i1I + i1i1i1111I
class WGControllerCenterUDPWS ( DatagramProtocol ) :
 if 15 - 15: I11iiIi11i1I / OooOoo
 if 77 - 77: i1iiIII111 - IIiIIiIi11I1 - OooOoo * I1Ii1I1 + i1I * i1iiIII111
 if 37 - 37: Ooo0Ooo . IiIIii11Ii
 if 24 - 24: i1I - Iii1i / oOO . IiI11Ii111
 if 81 - 81: iI1iII1I1I1i . I1I
 if 34 - 34: Ii / IiI11Ii111 - IiI11Ii111 - OooOoo + IiIIii11Ii . I1Ii1I1
 if 73 - 73: Iii1i
 if 92 - 92: iI1iII1I1I1i - IIiIIiIi11I1 * i1 . I1I * I1I
 if 35 - 35: IIiIIiIi11I1 * OooOoo - Ooo0Ooo
 if 27 - 27: oOo0O00 / I1I * I1Ii1I1 - OooOoo - Iii1i
 if 38 - 38: IiI11Ii111 / i1 - IiIIii11Ii
 if 75 - 75: iI1iII1I1I1i * Iii1i . OooOoo - ooo000 + I1I * ooo000
 if 91 - 91: IiI11Ii111 * i1i1i1111I + oOO . Ii
 if 7 - 7: IIiIIiIi11I1 / IiI11Ii111 + IiI11Ii111
 if 91 - 91: Iii1i . I11iiIi11i1I + ooo000 % ooo000 + IiIIii11Ii * OooOoo
 if 72 - 72: i1I
 if 23 - 23: I11iiIi11i1I / i1iiIII111 - iI1iII1I1I1i
 if 17 - 17: i1iiIII111
 if 91 - 91: OooOoo - Oo + Ii + IIiIIiIi11I1 / ooOOO
 if 96 - 96: oOo0O00 - IiI11Ii111 + ooOOO
 if 67 - 67: I1Ii1I1 - IIiIIiIi11I1 + OooOoo
 if 72 - 72: iI1iII1I1I1i * I1I . Ii / I1Ii1I1 / IIiIIiIi11I1 . ooOOO
 if 21 - 21: Ooo0Ooo - IIiIIiIi11I1 . iI1iII1I1I1i . oOO + iI1iII1I1I1i - IIiIIiIi11I1
 if 15 - 15: Oo / i1i1i1111I + oOo0O00 / I1Ii1I1 / I11iiIi11i1I * ooOOO
 def __init__ ( self ) :
  if 73 - 73: I1I % Iii1i % i1I % Ooo0Ooo / i1 . IIiIIiIi11I1
  super ( WGControllerCenterUDPWS , self ) . __init__ ( )
  if 87 - 87: i1iiIII111
  self . dictXid = dict ( )
  self . _Global_xid = 0
  self . _xid = 0
  self . verbose = 0
  if 4 - 4: Oo * IiIIii11Ii - i1I
  if 14 - 14: Iii1i / iI1iII1I1I1i . IIiIIiIi11I1
  if 59 - 59: IiI11Ii111 + Iii1i * Ii + IiI11Ii111 * i1iiIII111 - i1I
  if 17 - 17: oOo0O00 . i1iiIII111
  self . UDPQueue4HeartBeatPacket = None
  self . UDPQueue4Mobile = None
  self . UDPQueue4ReplyFromController = None
  self . UDPQueue4QRCode = None
  self . UDPQueue4Dingyue = None
  self . UDPQueue4DingyueWS = None
  if 8 - 8: oOO . ooo000 % ooo000 . I1Ii1I1 + ooo000 / i1i1i1111I
  self . UDPQueue4webAPI = None
  self . UDPQueue4QRwebAPI = None
  if 3 - 3: ooo000 / ooo000
  self . UDPQueueFromWEBSocket = None
  if 37 - 37: OooOoo * oOo0O00 . Ooo0Ooo - oOo0O00 * IiI11Ii111 * OooOoo
  self . bytcmdQuey = None
  self . allowErrWrite4sendingBroadcast = 0
  self . dictControllers = dict ( )
  self . dictControllersSendDataTime = dict ( )
  self . UDPQueue4HeartBeatPacket = deque ( )
  self . UDPQueue4Mobile = deque ( )
  self . UDPQueue4QRCode = deque ( )
  self . UDPQueue4ReplyFromController = deque ( )
  self . UDPQueue4Dingyue = deque ( )
  self . UDPQueue4webAPI = deque ( )
  self . UDPQueue4QRwebAPI = deque ( )
  self . UDPQueue4DingyueWS = deque ( )
  if 46 - 46: IiIIii11Ii . I1I % iI1iII1I1I1i - IIiIIiIi11I1 - i1I + IiI11Ii111
  self . UDPQueueFromWEBSocket = deque ( )
  self . taskqueueWGControllerCenterUDPWS = Queue ( )
  if 55 - 55: Ooo0Ooo
 def startProtocol ( self ) :
  self . startnet ( )
  if 48 - 48: Ooo0Ooo / Ooo0Ooo * Ii . i1iiIII111 % iI1iII1I1I1i
  if 87 - 87: OooOoo * IIiIIiIi11I1
 def startnet ( self ) :
  if 68 - 68: I11iiIi11i1I * oOo0O00 . Ooo0Ooo - IIiIIiIi11I1 . OooOoo + OooOoo
  if 88 - 88: I11iiIi11i1I / oOo0O00 - i1I
  if 7 - 7: Ii . Oo % Ooo0Ooo % Oo - iI1iII1I1I1i
  if 85 - 85: ooOOO % ooOOO + i1i1i1111I % Iii1i % iI1iII1I1I1i . I1Ii1I1
  if 24 - 24: i1i1i1111I . oOo0O00 - i1I + iI1iII1I1I1i
  deferToThread ( self . DealMoreData )
  if 97 - 97: IiI11Ii111 - i1iiIII111 + I1I / i1i1i1111I / IiI11Ii111 * ooOOO
 def DealMoreData ( self ) :
  if 87 - 87: Ooo0Ooo
  while True :
   Ooo = False
   try :
    if 69 - 69: Iii1i
    if 51 - 51: Iii1i
    if 22 - 22: iI1iII1I1I1i - ooo000 * IiI11Ii111 * IIiIIiIi11I1 * IiI11Ii111 + IiI11Ii111
    if 47 - 47: ooo000 * i1i1i1111I + OooOoo / I1I . Iii1i . I1I
    Ooo = Ooo or ( self . DealUDPQueue4Dingyue ( ) )
    Ooo = Ooo or ( self . DealUDPQueue4DingyueWS ( ) )
    if 4 - 4: OooOoo - i1
    if 56 - 56: I1I % oOo0O00 . OooOoo - Ooo0Ooo - Oo . I1Ii1I1
    if 20 - 20: iI1iII1I1I1i * IIiIIiIi11I1 - iI1iII1I1I1i . i1 % oOo0O00 / i1I
    if 51 - 51: i1iiIII111
   except Exception as ooo :
    pass
    mMonitorInfo . wglog ( "1101" )
    mMonitorInfo . wglog (
 ooo )
   if not Ooo :
    time . sleep ( 0.001 )
   if not Ooo :
    try :
     i11I1iII1I1 = self . taskqueueWGControllerCenterUDPWS . get ( block = True )
     self . taskqueueWGControllerCenterUDPWS . task_done ( )
    except Exception as IIIi11ii1Ii :
     pass
     if 2 - 2: Ooo0Ooo
     if 54 - 54: i1I * oOO % Ii + IIiIIiIi11I1
 @ staticmethod
 def setTestMode ( val ) :
  WGControllerCenter . testModeAllowAutoRemoteOpenDoor = val
  if 52 - 52: i1I % IiI11Ii111 * IIiIIiIi11I1 * i1
  if 92 - 92: I11iiIi11i1I
  if 3 - 3: i1iiIII111 % i1i1i1111I % Ooo0Ooo + IIiIIiIi11I1
 def setModeDebugPrint ( val ) :
  wgGlobal . testModeDebugPrint = val
  if 15 - 15: IiIIii11Ii % Ooo0Ooo - I1Ii1I1 . oOo0O00
 def setCommPID ( val ) :
  I1iI11I1IIi = val . split ( "," )
  if len ( I1iI11I1IIi ) == 1 :
   WGControllerCenter . commPID = [ int ( I1iI11I1IIi [ 0 ] ) ]
  else :
   Oo0ooOOOO = [ ]
   for OOoO in I1iI11I1IIi :
    Oo0ooOOOO . append ( int ( OOoO ) )
   WGControllerCenter . commPID = Oo0ooOOOO
   if 93 - 93: IiIIii11Ii - iI1iII1I1I1i
   if 30 - 30: i1I / i1iiIII111 * iI1iII1I1I1i % oOo0O00 / ooo000
   if 54 - 54: IiIIii11Ii * I1Ii1I1 - I1I % i1i1i1111I + IIiIIiIi11I1 * OooOoo
 def setCommSM4 ( val ) :
  iiI = val . encode ( 'utf-8' )
  if len ( iiI ) > 0 :
   if 23 - 23: IiI11Ii111 / IIiIIiIi11I1
   OOooO0 = b'\xc9\xee\xdb\xda\xce\xa2\xb8\xfb\xca\xb5\xd2\xb5\xd3\xd0\xcf\xde'
   o0Ooo = CryptSM4 ( )
   O00OO0ooOoO = bytes ( binascii . unhexlify ( val ) )
   o0Ooo . set_key ( OOooO0 , SM4_DECRYPT )
   OoOo00o = o0Ooo . crypt_ecb ( O00OO0ooOoO )
   if 13 - 13: oOo0O00 - I1I / Ii % Iii1i
   WGControllerCenter . commSM4 = 1
   I1iI11I1IIi = [ 0x0 , 0x0 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
   iII = 16
   if ( len ( OoOo00o ) < 16 ) :
    iII = len ( OoOo00o )
   for OOoO in range ( 0 , iII ) :
    I1iI11I1IIi [ OOoO ] = OoOo00o [ OOoO ]
   WGControllerCenter . commSM4Key = bytes ( I1iI11I1IIi )
   WGControllerCenter . crypt_sm4_enc . set_key ( WGControllerCenter . commSM4Key , SM4_ENCRYPT )
   WGControllerCenter . crypt_sm4_dec . set_key ( WGControllerCenter . commSM4Key , SM4_DECRYPT )
   if 46 - 46: I1Ii1I1 + I11iiIi11i1I / Ii
 def commSM4_Enc ( val ) :
  if 9 - 9: Oo - i1 % Oo
  return WGControllerCenter . crypt_sm4_enc . crypt_ecb ( val )
  if 72 - 72: ooOOO - i1iiIII111
 def commSM4_Dec ( val ) :
  return WGControllerCenter . crypt_sm4_dec . crypt_ecb ( val )
  if 46 - 46: oOO
 def commTimeControl_Enc ( val , cticks , refrestime ) :
  OoOO0oO0O = time . time ( ) - refrestime + 5
  OoOO0oO0O = cticks + int ( ( OoOO0oO0O ) * 50 )
  WGTools . longToByte ( OoOO0oO0O , val , 60 , 4 )
  if 35 - 35: I11iiIi11i1I * IiI11Ii111
 def commTimeStamp_Enc ( val , wginfo ) :
  o000Oo0oo0 = int ( datetime . datetime . now ( ) . timestamp ( ) )
  if wginfo . timestampOfCon == 0 or wginfo . timestampOfCon + 3600 * 24 * 365 < o000Oo0oo0 :
   return
  if wginfo . timestampOfCon + 60 * 45 < o000Oo0oo0 or wginfo . timestampOfCon > o000Oo0oo0 + 60 * 45 :
   if wgAppConfig . timeStampEnable == 1 :
    return
  o000Oo0oo0 = o000Oo0oo0 - wginfo . refreshTimeFrom1970ofctickOfCon
  iI = int ( wginfo . timestampOfCon + o000Oo0oo0 )
  if 86 - 86: Ii
  WGTools . longToByte ( iI , val , 60 , 4 )
  if 57 - 57: Oo . IiI11Ii111 % oOO . Ii
  if 65 - 65: I1Ii1I1
  if 81 - 81: I1I
  if 47 - 47: oOo0O00 * iI1iII1I1I1i
  if 98 - 98: Oo - IiIIii11Ii / OooOoo + I1I . iI1iII1I1I1i
  if 54 - 54: i1
  if 61 - 61: I11iiIi11i1I + i1i1i1111I / ooOOO
  if 48 - 48: IiIIii11Ii - i1 * I11iiIi11i1I / i1 - Ooo0Ooo / Ooo0Ooo
  if 53 - 53: IiIIii11Ii % iI1iII1I1I1i . Iii1i / I11iiIi11i1I
  if 9 - 9: i1iiIII111
  if 41 - 41: Ooo0Ooo / ooo000 . OooOoo . i1I
  if 8 - 8: I11iiIi11i1I * Ooo0Ooo + oOO - i1iiIII111 + Iii1i + ooOOO
  if 68 - 68: ooo000 / I1I - IiI11Ii111 % iI1iII1I1I1i % IiIIii11Ii
  if 84 - 84: oOo0O00 / Ii . i1iiIII111 % ooo000
  if 93 - 93: OooOoo * oOO % I1I + I11iiIi11i1I . oOo0O00 % I11iiIi11i1I
  if 44 - 44: Iii1i / oOO . ooOOO % oOo0O00 / Ooo0Ooo * I11iiIi11i1I
  if 15 - 15: IiIIii11Ii . I11iiIi11i1I + Oo + Oo . oOo0O00 - i1I
  if 95 - 95: iI1iII1I1I1i
  if 44 - 44: i1I * i1I
  if 92 - 92: oOO * i1 % oOo0O00 + i1I + OooOoo * ooo000
  if 67 - 67: Oo / I11iiIi11i1I + I1I % iI1iII1I1I1i + OooOoo . Ooo0Ooo
  if 53 - 53: i1i1i1111I
  if 8 - 8: IIiIIiIi11I1 / iI1iII1I1I1i / IiIIii11Ii . I11iiIi11i1I
  if 52 - 52: I11iiIi11i1I % ooOOO - IIiIIiIi11I1 % Ooo0Ooo * iI1iII1I1I1i
 def getNewXid ( self ) :
  self . _Global_xid = self . _Global_xid + 1
  if ( self . _Global_xid >= 0x4fffffff ) or ( self . _Global_xid < 0x40000001 ) :
   self . _Global_xid = 0x40000001
  self . _xid = self . _Global_xid
  return self . _Global_xid
  if 89 - 89: Ooo0Ooo * OooOoo / OooOoo % IIiIIiIi11I1
 def isConnected ( self , sn ) :
  oo0OO0o0O = self . dictControllers . get ( sn )
  if oo0OO0o0O is None :
   return False
  elif abs ( time . time ( ) - oo0OO0o0O . refreshTimeFrom1970 ) < 60 * 5 :
   return True
  return False
  if 92 - 92: I11iiIi11i1I / Oo % I1I * iI1iII1I1I1i
  if 61 - 61: I1Ii1I1
 def addToUDPQueue4webAPI ( self , data ) :
  if wgAppConfig . ACTIVE_UDPQueue4webAPI :
   if len ( self . UDPQueue4webAPI ) > 1000 :
    self . UDPQueue4webAPI . popleft ( )
   self . UDPQueue4webAPI . append ( data )
   if 72 - 72: IiI11Ii111 . Oo - Oo
   if 48 - 48: Ii + OooOoo % IiIIii11Ii . IiIIii11Ii + oOo0O00
 def addToUDPQueue4QRwebAPI ( self , data ) :
  if wgAppConfig . ACTIVE_UDPQueue4QRwebAPI :
   if len ( self . UDPQueue4QRwebAPI ) > 1000 :
    self . UDPQueue4QRwebAPI . popleft ( )
   self . UDPQueue4QRwebAPI . append ( data )
   if 38 - 38: OooOoo . i1I / Ii - oOo0O00
 def logSend ( self , data , addr ) :
  if wgGlobal . allowprint :
   OOo000o0 = [ '%02X' % i for i in data ]
   wgAppConfig . logdebug ( "m1001CloudServerUDP send to %s DataLen=%d HexData: %s" % (
 addr , len ( data ) , " " . join ( OOo000o0 ) ) )
   if 37 - 37: IIiIIiIi11I1 / Iii1i
   if 16 - 16: i1i1i1111I + Ooo0Ooo . i1I - i1I + iI1iII1I1I1i
 def DealUDPQueue4HeartBeatPacket ( self ) :
  o00o = False
  while True :
   if self . UDPQueue4HeartBeatPacket . __len__ ( ) > 0 :
    o00o = True
    if 44 - 44: IiI11Ii111 - OooOoo / iI1iII1I1I1i % iI1iII1I1I1i
    i1111 = self . UDPQueue4HeartBeatPacket . popleft ( )
    if 86 - 86: i1iiIII111 / IiI11Ii111 . IiI11Ii111 * Ooo0Ooo
    o00oOo0OOOO00 = i1111 . commandData
    if 50 - 50: i1iiIII111 - oOO
    i1I1Ii = i1111 . ipport
    if 6 - 6: ooOOO - i1i1i1111I * Iii1i / oOo0O00 % Oo % oOO
    if 11 - 11: oOO % i1I
    o00o0oOOo0Oo = WGControllerinfo ( o00oOo0OOOO00 , i1I1Ii )
    if 97 - 97: i1I
    oo0OO0o0O = self . dictControllers . get ( o00o0oOOo0Oo . controllerSN )
    Ii11 = mMonitorInfo . updateDSInfo ( o00o0oOOo0Oo . controllerSN , o00oOo0OOOO00 )
    if Ii11 is not None :
     if 67 - 67: I11iiIi11i1I - Iii1i
     if 16 - 16: I1Ii1I1 % ooOOO . i1 / i1I * i1i1i1111I - oOO
     if 78 - 78: i1I - IIiIIiIi11I1 . Iii1i
     if 44 - 44: Ooo0Ooo / I11iiIi11i1I . ooo000 + ooOOO
     if 12 - 12: Oo
     if 70 - 70: OooOoo + I1Ii1I1
     if 33 - 33: OooOoo
     pass
    if oo0OO0o0O is None :
     if not wgGlobal . checkconstrollersWhitelist ( o00o0oOOo0Oo . controllerSN ) :
      continue
     self . dictControllers [ o00o0oOOo0Oo . controllerSN ] = o00o0oOOo0Oo
     self . dictControllersSendDataTime [ o00o0oOOo0Oo . controllerSN ] = 0
     if 40 - 40: I1Ii1I1 * IiI11Ii111 . I1Ii1I1 + Iii1i
     if 92 - 92: oOo0O00
     if 50 - 50: i1iiIII111
     if 19 - 19: ooOOO + Oo - I1I . i1
     if 97 - 97: i1 % I11iiIi11i1I - ooo000 % ooOOO . Ii
     if 41 - 41: Ooo0Ooo % IIiIIiIi11I1 . Ooo0Ooo . i1
     if 3 - 3: i1I % Oo * i1
     if 98 - 98: OooOoo * i1I + iI1iII1I1I1i - I11iiIi11i1I . I1I
     if 19 - 19: I1Ii1I1 % oOO / Ooo0Ooo
     if 72 - 72: Iii1i . IiI11Ii111 - I1Ii1I1 + Iii1i
     if 8 - 8: IiI11Ii111 + ooo000 + I1I + i1I
     mMonitorInfo . printCHS (
 "UDP. add controller SN= {0:d} {1} No.{2} [{3}] from {4}" . format ( o00o0oOOo0Oo . controllerSN ,
 o00o0oOOo0Oo . ipport ,
 len ( self . dictControllers ) ,
 time . strftime (
 '%Y-%m-%d %H:%M:%S' ) ,
 self . transport . getHost ( ) ) )
     if 66 - 66: I1Ii1I1 . oOO * i1I
     if 9 - 9: ooo000 . Oo * OooOoo
     if 93 - 93: Ooo0Ooo + IiI11Ii111 / i1iiIII111 % i1iiIII111 * ooOOO
     if 97 - 97: ooOOO - i1iiIII111 / I1I + IiI11Ii111 - Iii1i + OooOoo
     mMonitorInfo . wglog (
 "UDP. add controller SN= {0:d} {1} No.{2} [{3}]" . format ( o00o0oOOo0Oo . controllerSN , o00o0oOOo0Oo . ipport ,
 len ( self . dictControllers ) ,
 time . strftime (
 '%Y-%m-%d %H:%M:%S' ) ) )
    else :
     if 83 - 83: IiI11Ii111
     if 61 - 61: Iii1i
     if 87 - 87: oOO - IIiIIiIi11I1
     if 98 - 98: i1i1i1111I % i1i1i1111I * Iii1i % iI1iII1I1I1i
     if 87 - 87: IiIIii11Ii
     if 49 - 49: ooo000 + Iii1i / iI1iII1I1I1i . I1I + iI1iII1I1I1i
     if oo0OO0o0O . ipport != o00o0oOOo0Oo . ipport :
      O000O0 = False
      if 2 - 2: Iii1i * ooOOO
      if not abs (
 time . time ( ) - oo0OO0o0O . refreshTimeFrom1970 ) < 95 :
       if 88 - 88: I1I + IiI11Ii111 . oOo0O00 * i1 * IIiIIiIi11I1 / IiIIii11Ii
       if 5 - 5: IiI11Ii111 - Iii1i / I1I
       O000O0 = True
      else :
       if 82 - 82: ooOOO . I11iiIi11i1I % I1Ii1I1 - oOO
       if o00o0oOOo0Oo . ipport [ 1 ] == wgGlobal . dataserverPort + 1 :
        if 25 - 25: i1I * IiI11Ii111 * I1Ii1I1 % i1I . i1i1i1111I / OooOoo
        O000O0 = True
       elif o00o0oOOo0Oo . ipport [ 1 ] == 60000 :
        if oo0OO0o0O . ipport [ 1 ] != wgGlobal . dataserverPort + 1 :
         if 34 - 34: I11iiIi11i1I / ooOOO * Iii1i / oOO * IiI11Ii111
         O000O0 = True
       else :
        if oo0OO0o0O . ipport [ 1 ] != wgGlobal . dataserverPort + 1 :
         if oo0OO0o0O . ipport [ 1 ] != 60000 :
          if 33 - 33: iI1iII1I1I1i % Ooo0Ooo . Ii * Ooo0Ooo + ooOOO - Oo
          O000O0 = True
          if 88 - 88: IIiIIiIi11I1 - I11iiIi11i1I + i1 . ooOOO . Ooo0Ooo
          if 69 - 69: Iii1i + I1I - i1i1i1111I + i1I
          if 4 - 4: Ooo0Ooo / i1 . I1Ii1I1 / oOo0O00 + Oo . Iii1i
          if 62 - 62: i1I . i1iiIII111 * i1 + Oo
          if 61 - 61: Ii + i1iiIII111
          if 67 - 67: IiI11Ii111 . IiI11Ii111
          if 57 - 57: iI1iII1I1I1i
          if 75 - 75: i1i1i1111I
          if 8 - 8: ooo000
          if 41 - 41: OooOoo . iI1iII1I1I1i . oOo0O00 . Ooo0Ooo % Oo . Ii
          if 72 - 72: oOo0O00
          if 49 - 49: IiI11Ii111 . i1 - IiI11Ii111 % Iii1i
          if 59 - 59: Ooo0Ooo - IiI11Ii111 % i1iiIII111 . Iii1i
          if 59 - 59: i1I + Oo / Iii1i . i1i1i1111I % i1I
      if O000O0 :
       mMonitorInfo . logWGAddrChangeCount = mMonitorInfo . logWGAddrChangeCount + 1
       if mMonitorInfo . logWGAddrChangeCount < 10000 or wgGlobal . testModeDebugPrint > 0 :
        if 25 - 25: I11iiIi11i1I / IiIIii11Ii + IIiIIiIi11I1 - IiI11Ii111 * iI1iII1I1I1i
        mMonitorInfo . wglog (
 "UDP. {0:d} new ip address= {1}  [{2}]" . format ( o00o0oOOo0Oo . controllerSN ,
 o00o0oOOo0Oo . ipport ,
 time . strftime (
 '%Y-%m-%d %H:%M:%S' ) ) )
        if 24 - 24: Ii / Ii
       elif mMonitorInfo . logWGAddrChangeCount == 10000 :
        mMonitorInfo . wglog (
 "UDP. {0:d} new ip address= {1}  [{2}]" . format ( o00o0oOOo0Oo . controllerSN ,
 o00o0oOOo0Oo . ipport ,
 time . strftime (
 '%Y-%m-%d %H:%M:%S' ) ) + "--Over 10000" )
        if 17 - 17: Ooo0Ooo % IiIIii11Ii % oOo0O00
      else :
       continue
       if 75 - 75: OooOoo / oOo0O00 - i1iiIII111 % IiIIii11Ii + Iii1i
       if 67 - 67: OooOoo * i1 . oOO % Ooo0Ooo . IiIIii11Ii
       if 26 - 26: I1I * i1i1i1111I
       if 44 - 44: IIiIIiIi11I1 * iI1iII1I1I1i
       if 77 - 77: i1I + i1iiIII111 % oOo0O00 % i1iiIII111 - Oo / iI1iII1I1I1i
     self . dictControllers [ o00o0oOOo0Oo . controllerSN ] = o00o0oOOo0Oo
     if 6 - 6: Iii1i / i1 * i1 * iI1iII1I1I1i
     ooooOO000O0Oo = 0
     if o00o0oOOo0Oo . recordIndex != oo0OO0o0O . recordIndex :
      if o00o0oOOo0Oo . recordData is not None :
       self . addToUDPQueue4webAPI ( i1111 )
       mMonitorInfo . sendSwipes ( o00o0oOOo0Oo ,
 oo0OO0o0O . recordIndex )
       if 80 - 80: IIiIIiIi11I1 / i1iiIII111
       if wgGlobal . testModeDebugPrint > 0 :
        if o00o0oOOo0Oo . recordIndex > oo0OO0o0O . recordIndex + 1 :
         if len ( o00o0oOOo0Oo . commandData ) == 192 :
          o00o0oOOo0Oo . get5Swipe ( oo0OO0o0O . recordIndex + 1 )
        o00o0oOOo0Oo . recordData . getDescription ( )
       if WGControllerCenter . logModeFileSwipe > 0 :
        if o00o0oOOo0Oo . recordIndex > oo0OO0o0O . recordIndex + 1 :
         if len ( o00o0oOOo0Oo . commandData ) == 192 :
          if 95 - 95: ooo000 / Iii1i / Iii1i + i1i1i1111I
          o00o0oOOo0Oo . get5SwipeFileLog ( oo0OO0o0O . recordIndex + 1 , o00o0oOOo0Oo . controllerSN ,
 root_loggerUDP )
        o00o0oOOo0Oo . recordData . getDescriptionFileLog ( o00o0oOOo0Oo . controllerSN , root_loggerUDP )
        if 46 - 46: oOO
        if 15 - 15: iI1iII1I1I1i + I1I
       if wgGlobal . print200Records > 0 :
        I1iii1I = [ ]
        if 81 - 81: Ii + I1I . oOo0O00 / i1 / ooOOO
        o00o0oOOo0Oo . getNewSwipeJSON ( oo0OO0o0O . recordIndex , I1iii1I )
        if I1iii1I is not None :
         for OOoO in I1iii1I :
          wgGlobal . printWatchingInfo ( OOoO )
          if 93 - 93: oOO + i1
          if 23 - 23: I1Ii1I1 . ooOOO
          if 13 - 13: OooOoo
          if 49 - 49: i1iiIII111 . oOo0O00 / i1 - IiIIii11Ii + I1Ii1I1 * I11iiIi11i1I
          if 80 - 80: i1i1i1111I * OooOoo . I1I / I1I
          if 69 - 69: IiIIii11Ii * IiI11Ii111 + i1 - Ii
          if 98 - 98: I1I % oOo0O00 % i1iiIII111 / Ii / ooOOO
          if 17 - 17: IIiIIiIi11I1 % i1i1i1111I / IiI11Ii111 - I1Ii1I1 . I11iiIi11i1I
          if 50 - 50: IiIIii11Ii % I11iiIi11i1I - I1Ii1I1 - IiIIii11Ii + IIiIIiIi11I1 % IIiIIiIi11I1
          if 61 - 61: ooo000 % i1I * Ii
      if o00o0oOOo0Oo . recordType == 0x01 :
       if ( self . countUsersOfDingyue > 0 ) and ( self . optionNewRecordSend > 0 ) :
        if 27 - 27: iI1iII1I1I1i / i1
        self . UDPQueue4Dingyue . append ( i1111 )
        if 51 - 51: Ooo0Ooo + ooo000
        if 74 - 74: ooOOO + oOO
        if 11 - 11: oOo0O00 . iI1iII1I1I1i
        if 67 - 67: i1I / iI1iII1I1I1i . I11iiIi11i1I
       Ii1 = 0
       if WGControllerCenter . testModeAllowAutoRemoteOpenDoor > 0 :
        Ii1 = 1
       if wgGlobal . visitorDBIsEnabled :
        try :
         if o00o0oOOo0Oo . recordData . recordValid == 0 :
          if 80 - 80: iI1iII1I1I1i - Ooo0Ooo - Ooo0Ooo
          if 48 - 48: ooOOO + Iii1i - iI1iII1I1I1i / i1
          if 34 - 34: IiIIii11Ii . oOo0O00 . I11iiIi11i1I % i1i1i1111I % i1 + Oo
          IIi = wgGlobal . visitorDB
          iII11111iI = Query ( )
          if 16 - 16: IiIIii11Ii
          o0000o = IIi . search ( iII11111iI [ "CardNO" ] == o00o0oOOo0Oo . recordData . recordcurrentval )
          oo00 = datetime . datetime . now ( )
          for ii1iiII111IiI in o0000o :
           if datetime . datetime . strptime ( ii1iiII111IiI [ "End" ] , "%Y-%m-%d %H:%M:%S" ) > oo00 and datetime . datetime . strptime ( ii1iiII111IiI [ "Begin" ] ,
           # oOO
 "%Y-%m-%d %H:%M:%S" ) < oo00 :
            Ii1 = 1
            break
        except Exception as II1iI111 :
         pass
         pass
         if 26 - 26: i1iiIII111 / oOo0O00 + ooOOO
         if 25 - 25: OooOoo % oOO * Iii1i + oOo0O00 + ooo000 + ooo000
         if 75 - 75: IIiIIiIi11I1 . I11iiIi11i1I * ooo000 / i1 / I1I * IIiIIiIi11I1
         if 30 - 30: oOO % iI1iII1I1I1i - i1i1i1111I + I1I + Ooo0Ooo
         if 99 - 99: I1I - iI1iII1I1I1i - Iii1i % OooOoo + OooOoo % oOo0O00
       if Ii1 > 0 :
        o0ooo0oOoO = [ 0x17 , 0x40 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x01 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 ]
        for OOoO in ( 4 , 5 , 6 , 7 ) :
         o0ooo0oOoO [ OOoO ] = o00oOo0OOOO00 [ OOoO ]
        o0ooo0oOoO [ 8 ] = o00o0oOOo0Oo . recordDoorNO
        I11I11111 = self . getNewXid ( )
        if 95 - 95: IIiIIiIi11I1
        if 85 - 85: i1 + Ooo0Ooo - ooo000
        if 98 - 98: oOo0O00 % i1I + i1I . OooOoo . i1iiIII111 / i1I
        WGTools . longToByte ( o00o0oOOo0Oo . recordData . recordcurrentval , o0ooo0oOoO , 20 , 8 )
        if o00o0oOOo0Oo . recordData . recordInOrOut == 2 :
         o0ooo0oOoO [ 28 ] = 1
        o0ooo0oOoO [ 32 ] = 0x5A
        WGTools . longToByte ( I11I11111 , o0ooo0oOoO , 40 , 4 )
        if 81 - 81: i1I % ooo000 - ooo000 / oOO . ooo000
        if 25 - 25: i1iiIII111 . iI1iII1I1I1i % oOo0O00 * i1i1i1111I
        if 22 - 22: oOO
        if wgAppConfig . timeStampEnable > 0 :
         WGControllerCenter . commTimeStamp_Enc ( o0ooo0oOoO ,
 o00o0oOOo0Oo )
        if WGControllerCenter . commSM4 > 0 :
         o0ooo0oOoO = WGControllerCenter . commSM4_Enc ( o0ooo0oOoO )
        self . transport . write ( bytes ( o0ooo0oOoO ) , i1I1Ii )
        ooooOO000O0Oo = 1
        wgAppConfig . wglog (
 "Server Send =>Controller RemoteOpenDoor SN= {0:d} DoorNO= {1:d} {2}" . format (
 o00o0oOOo0Oo . controllerSN ,
 o00o0oOOo0Oo . recordDoorNO ,
 o00o0oOOo0Oo . ipport ) )
        self . logSend ( o0ooo0oOoO , i1I1Ii )
        if 23 - 23: IiI11Ii111
      if wgGlobal . visitorDBConfigOnlyOnce > 0 and o00o0oOOo0Oo . recordType == 0x02 :
       if ( o00o0oOOo0Oo . recordData . reason == 44 ) and (
 o00o0oOOo0Oo . recordData . recordcurrentval > 1 ) :
        if 63 - 63: I1Ii1I1
        if 26 - 26: ooo000
        if 37 - 37: oOo0O00 / I11iiIi11i1I
        IIi = wgGlobal . visitorDB
        iII11111iI = Query ( )
        wgGlobal . visitorDB . remove ( iII11111iI [ "CardNO" ] == o00o0oOOo0Oo . recordData . recordcurrentval )
        if 9 - 9: IiIIii11Ii . Iii1i % i1iiIII111 / Ooo0Ooo
        if 51 - 51: OooOoo . oOO
        if 54 - 54: i1i1i1111I * I1I - I1I / oOo0O00
        if 56 - 56: IIiIIiIi11I1 * IiI11Ii111 / oOo0O00 % I1I % iI1iII1I1I1i % ooOOO
        if 26 - 26: OooOoo
        if 58 - 58: ooo000
        if 78 - 78: i1iiIII111 % i1I
     if ooooOO000O0Oo == 0 :
      O0OOOo0oO = self . dictControllersSendDataTime . get ( o00o0oOOo0Oo . controllerSN )
      if 63 - 63: i1I - i1i1i1111I . iI1iII1I1I1i + IiIIii11Ii
      if ( ( O0OOOo0oO is not None ) and ( ( ( o00o0oOOo0Oo . refreshTimeFrom1970 - O0OOOo0oO ) > 60 ) or (
 ( ( o00oOo0OOOO00 [ 50 ] & 0x40 ) == 0x00 ) and ( o00o0oOOo0Oo . refreshTimeFrom1970 - O0OOOo0oO ) >= 25 ) ) ) :
       if 90 - 90: ooo000 + I1Ii1I1 % i1 - IiI11Ii111 / Ooo0Ooo * iI1iII1I1I1i
       if 50 - 50: i1I / ooo000 . Ii * I1Ii1I1 / oOO + oOo0O00
       self . dictControllersSendDataTime [ o00o0oOOo0Oo . controllerSN ] = time . time ( )
       if 86 - 86: I1I
       ooOo0O0O = [ 0x17 , 0x20 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
       for OOoO in ( 4 , 5 , 6 , 7 ) :
        ooOo0O0O [ OOoO ] = o00oOo0OOOO00 [ OOoO ]
       I11I11111 = self . getNewXid ( )
       for OOoO in ( 40 , 41 , 42 , 43 ) :
        ooOo0O0O [ OOoO ] = I11I11111 & 0xff
        I11I11111 = I11I11111 >> 8
        if 64 - 64: Oo % i1i1i1111I + I11iiIi11i1I . i1iiIII111
        if 53 - 53: ooOOO / I11iiIi11i1I / iI1iII1I1I1i . Iii1i
        if 10 - 10: iI1iII1I1I1i * i1iiIII111 - ooo000 * ooo000 / Iii1i . ooOOO
        if 15 - 15: i1iiIII111 / iI1iII1I1I1i * iI1iII1I1I1i - i1i1i1111I . i1 % iI1iII1I1I1i
       if wgAppConfig . timeStampEnable > 0 :
        WGControllerCenter . commTimeStamp_Enc ( ooOo0O0O , o00o0oOOo0Oo )
        for OOoO in ( 56 , 57 , 58 , 59 ) :
         ooOo0O0O [ OOoO ] = ooOo0O0O [ OOoO + 4 ]
        ooOo0O0O [ 55 ] = 0xA5
        ooOo0O0O [ 54 ] = 0xA5
        if 18 - 18: I1Ii1I1 + Iii1i / Oo % I1Ii1I1
       if WGControllerCenter . commSM4 > 0 :
        ooOo0O0O = WGControllerCenter . commSM4_Enc ( ooOo0O0O )
       try :
        self . transport . write ( bytes ( ooOo0O0O ) , i1I1Ii )
        self . logSend ( ooOo0O0O , i1I1Ii )
       except Exception as ooo :
        pass
        mMonitorInfo . wglog ( "1102" )
        mMonitorInfo . wglog (
 ooo )
        if 38 - 38: oOO
       wgAppConfig . wglog (
 "Server send =>Controller sync ControllerSN= {0:d} {1}" . format ( o00o0oOOo0Oo . controllerSN ,
 o00o0oOOo0Oo . ipport ) )
       if 95 - 95: i1i1i1111I / Iii1i * ooOOO * OooOoo
   else :
    if 57 - 57: I1I / Ii * oOO
    return o00o
    if 28 - 28: Ii * I11iiIi11i1I * Oo * ooo000
 def DealUDPQueue4QRCode ( self ) :
  o00o = False
  while True :
   if self . UDPQueue4QRCode . __len__ ( ) > 0 :
    o00o = True
    if 89 - 89: Ii - Iii1i % Ii
    i1111 = self . UDPQueue4QRCode . popleft ( )
    if 99 - 99: i1 / i1 + i1i1i1111I / Iii1i
    o00oOo0OOOO00 = i1111 . commandData
    i1I1Ii = i1111 . ipport
    i1ii1 = binascii . hexlify ( o00oOo0OOOO00 )
    o0ooO0o = ( o00oOo0OOOO00 [ 8 ] + ( o00oOo0OOOO00 [ 9 ] << 8 ) )
    oo = i1ii1 [ ( 64 * 2 ) : ( 64 * 2 + o0ooO0o * 2 ) ]
    wgAppConfig . wglog ( "Server Receive <=From Controller SN = {0} QRCode Data: {1} " . format ( i1111 . controllerSN , oo ) )
    wgAppConfig . wglog (
 "                                   QRCode(Convert To String): {0} " . format (
 str ( o00oOo0OOOO00 [ 64 : 64 + o0ooO0o ] ) ) )
    if WGControllerCenter . logModeFileQR > 0 :
     if 54 - 54: Iii1i
     if 44 - 44: i1i1i1111I * i1
     if 13 - 13: I1Ii1I1 / Ooo0Ooo . Oo % i1iiIII111 + I1I % IiI11Ii111
     if 27 - 27: Ooo0Ooo - i1 . Oo / i1iiIII111 + I1Ii1I1
     o0O0 = "{0:0>2X}{1:0>2X}-{2:0>2X}-{3:0>2X} {4:0>2X}:{5:0>2X}:{6:0>2X}" . format ( 0x20 , o00oOo0OOOO00 [ 51 ] ,
 o00oOo0OOOO00 [ 52 ] , o00oOo0OOOO00 [ 53 ] ,
 o00oOo0OOOO00 [ 37 ] , o00oOo0OOOO00 [ 38 ] ,
 o00oOo0OOOO00 [ 39 ] )
     try :
      iiI1iiIIi = datetime . datetime . strptime ( o0O0 , "%Y-%m-%d %H:%M:%S" )
     except Exception as ooo :
      pass
      iiI1iiIIi = datetime . datetime . strptime ( "2000-01-19 19:19:19" ,
 "%Y-%m-%d %H:%M:%S" )
      mMonitorInfo . wglog ( "1103" )
      wgAppConfig . wglog ( ooo )
     root_loggerUDP . info (
 "SN={0}:QR:DoorNO ={1:d},InExit ={2},Time={3:%Y-%m-%d %H:%M:%S},QRCode={4},ConvertedString={5}" . format (
 i1111 . controllerSN ,
 o00oOo0OOOO00 [ 14 ] , "In" if o00oOo0OOOO00 [ 15 ] == 1 else "Exit" , iiI1iiIIi , oo ,
 str ( o00oOo0OOOO00 [ 64 : 64 + o0ooO0o ] ) ) )
     if 2 - 2: i1iiIII111 * ooo000 . iI1iII1I1I1i / i1
    if wgGlobal . print200Records > 0 :
     o0O0 = "{0:0>2X}{1:0>2X}-{2:0>2X}-{3:0>2X} {4:0>2X}:{5:0>2X}:{6:0>2X}" . format ( 0x20 , o00oOo0OOOO00 [ 51 ] ,
 o00oOo0OOOO00 [ 52 ] , o00oOo0OOOO00 [ 53 ] ,
 o00oOo0OOOO00 [ 37 ] , o00oOo0OOOO00 [ 38 ] ,
 o00oOo0OOOO00 [ 39 ] )
     try :
      iiI1iiIIi = datetime . datetime . strptime ( o0O0 , "%Y-%m-%d %H:%M:%S" )
     except Exception as ooo :
      pass
      iiI1iiIIi = datetime . datetime . strptime ( "2000-01-19 19:19:19" ,
 "%Y-%m-%d %H:%M:%S" )
      mMonitorInfo . wglog ( "1103" )
      wgAppConfig . wglog ( ooo )
      if 9 - 9: IiI11Ii111 + Ii + I1I . oOo0O00 - IIiIIiIi11I1 % Oo
      if 92 - 92: I1Ii1I1 % Oo + i1iiIII111 % ooo000 * OooOoo
      if 43 - 43: i1iiIII111 * IIiIIiIi11I1
      if 9 - 9: IiI11Ii111 . iI1iII1I1I1i % ooo000
      if 66 - 66: i1 * i1I % Iii1i * Iii1i / Oo % oOo0O00
      if 31 - 31: i1 - i1i1i1111I % OooOoo . IIiIIiIi11I1 + I1I + OooOoo
      if 49 - 49: Ii * i1
      if 93 - 93: i1iiIII111 - ooOOO / Ii + Ooo0Ooo % oOo0O00
      if 97 - 97: i1
      if 94 - 94: i1 + oOO / Ii
      if 86 - 86: i1 * IiI11Ii111
      if 49 - 49: I1Ii1I1 + Iii1i - IIiIIiIi11I1 . I1I . Ii
      if 82 - 82: OooOoo / i1i1i1111I
      if 23 - 23: I1I % I11iiIi11i1I / Ooo0Ooo . iI1iII1I1I1i * oOo0O00
      if 22 - 22: i1 / I1Ii1I1 - i1 % oOo0O00 + iI1iII1I1I1i % I1I
      if 35 - 35: IiIIii11Ii . ooo000 - IIiIIiIi11I1 / iI1iII1I1I1i
     OOoO0oo00 = str ( binascii . hexlify ( o00oOo0OOOO00 [ 64 : 64 + o0ooO0o ] ) ,
 encoding = 'UTF-8' )
     iI1I1i1iI1I1 = ""
     try :
      iI1I1i1iI1I1 = str ( o00oOo0OOOO00 [ 64 : 64 + o0ooO0o ] , encoding = "utf-8" )
     except Exception as II1iI111 :
      pass
      pass
      if 55 - 55: Ooo0Ooo % IIiIIiIi11I1 / ooo000 . i1i1i1111I - oOo0O00
     iiiiiiiIi = (
 { "SN" : i1111 . controllerSN ,
 "ReceivedBytesLength" : o0ooO0o ,
 "PrimitHexData" : oo ,
 "ConvertedToString" : iI1I1i1iI1I1 ,
     "Time" : iiI1iiIIi . strftime ( "%Y-%m-%d %H:%M:%S" ) ,

     "DoorNO" : o00oOo0OOOO00 [ 14 ] ,
 "InExit" : "In" if o00oOo0OOOO00 [ 15 ] == 1 else "Exit" ,
 "SerialNumber" : i1111 . sid ,
     } )
     oo0OO0ooO0O0 = tdz . parseCommand ( binascii . unhexlify ( oo ) )
     if oo0OO0ooO0O0 is not None :
      iiiiiiiIi = (
 { "SN" : i1111 . controllerSN ,
 "ReceivedBytesLength" : o0ooO0o ,
 "PrimitHexData" : oo ,
 "GateInformation" : oo0OO0ooO0O0 ,
      "Time" : iiI1iiIIi . strftime ( "%Y-%m-%d %H:%M:%S" ) ,

      # OooOoo % I1Ii1I1 % ooo000 + oOo0O00 - iI1iII1I1I1i
      # oOO - IIiIIiIi11I1 % i1i1i1111I
      "SerialNumber" : i1111 . sid ,
      } )
      if 43 - 43: IIiIIiIi11I1 * I1I
     wgGlobal . printWatchingInfo ( iiiiiiiIi )
     if 20 - 20: Iii1i . I11iiIi11i1I
     if 94 - 94: IIiIIiIi11I1 + Ooo0Ooo - IiIIii11Ii - IIiIIiIi11I1 - i1I + i1i1i1111I
     if 53 - 53: Oo
     if 50 - 50: I1I / ooOOO - IiIIii11Ii * IIiIIiIi11I1 % IiIIii11Ii
     if 90 - 90: ooo000
     if 55 - 55: i1 / Ii - Iii1i + OooOoo * IiI11Ii111 + iI1iII1I1I1i
     if 88 - 88: i1 + IiI11Ii111
     if 75 - 75: Iii1i / i1i1i1111I . ooo000 * i1I - I11iiIi11i1I . I1I
    Ii1 = 0
    if WGControllerCenter . testModeAllowAutoRemoteOpenDoor > 0 :
     Ii1 = 1
     if 55 - 55: ooOOO - oOo0O00
     if 65 - 65: ooo000 * oOo0O00 % Ooo0Ooo * i1i1i1111I * Oo
     if 82 - 82: OooOoo + I1I + ooo000 * oOo0O00 * Iii1i
     if 22 - 22: Oo . Ooo0Ooo . Ooo0Ooo % oOo0O00
     if 94 - 94: I1Ii1I1 / I1Ii1I1 + OooOoo * I1I
    if Ii1 > 0 :
     oooOO0OoO00O = o00oOo0OOOO00 [ 14 ]
     I11I11111 = self . getNewXid ( )
     o00oOo = 123456789888
     o0ooo0oOoO = WGCommand . cmdRemoteOpenDoorInLocalnetwork ( i1111 . controllerSN , oooOO0OoO00O , 1 ,
 o00oOo , I11I11111 )
     if 63 - 63: Oo % iI1iII1I1I1i
     if 73 - 73: I1I / Ii
     if 96 - 96: ooOOO / Ooo0Ooo
     if 57 - 57: Oo % I1Ii1I1 * oOo0O00 . ooo000 . ooOOO . i1i1i1111I
     if wgAppConfig . timeStampEnable > 0 :
      o00o0oOOo0Oo = self . dictControllers [ i1111 . controllerSN ]
      WGControllerCenter . commTimeStamp_Enc ( o0ooo0oOoO , o00o0oOOo0Oo )
     if WGControllerCenter . commSM4 > 0 :
      o0ooo0oOoO = WGControllerCenter . commSM4_Enc ( o0ooo0oOoO )
     self . transport . write ( bytes ( o0ooo0oOoO ) , i1I1Ii )
     self . logSend ( o0ooo0oOoO , i1I1Ii )
     wgAppConfig . wglog (
 "Server Send =>Controller RemoteOpenDoor SN= {0:d} DoorNO= {1:d} {2}" . format ( i1111 . controllerSN ,
 oooOO0OoO00O ,
 i1111 . ipport ) )
   else :
    if 44 - 44: i1I
    return o00o
    if 31 - 31: Oo - Ii . Iii1i + i1I
 def DealUDPQueue4Mobile ( self ) :
  if 6 - 6: I1I
  o00o = False
  while True :
   if self . UDPQueue4Mobile . __len__ ( ) > 0 :
    o00o = True
    if 67 - 67: ooo000
    i1111 = self . UDPQueue4Mobile . popleft ( )
    if 78 - 78: IIiIIiIi11I1 + i1iiIII111 - Ooo0Ooo % IiIIii11Ii + i1iiIII111
    o00oOo0OOOO00 = i1111 . commandData
    if 41 - 41: ooo000 + ooo000
    oo0OO0o0O = self . dictControllers . get ( i1111 . controllerSN )
    wgAppConfig . wglog ( "Server Receive <=Mobile or PC Client [{0}]" . format ( i1111 . ipport ) )
    if self . isConnected ( i1111 . controllerSN ) :
     o0oOoOo0O00o = [ o00oOo0OOOO00 [ OOoO ] for OOoO in range ( 0 , len ( o00oOo0OOOO00 ) ) ]
     if 79 - 79: IiIIii11Ii
     if mMonitorInfo . OnlyVirtualCardOpenDoor > 0 :
      OOO0OOo = False
      if len ( o00oOo0OOOO00 ) == 64 :
       if o0oOoOo0O00o [ 1 ] == 0x40 and WGTools . getLongByByte ( o0oOoOo0O00o , 20 , 4 ) > 0 and o0oOoOo0O00o [
 32 ] == 0 :
        OOO0OOo = True
        if 43 - 43: Iii1i
       if o0oOoOo0O00o [ 1 ] in [ 0x92 , 0x94 , 0x20 , 0x26 , 0x32 , 0xb0 , 0xf4 ] :
        OOO0OOo = True
      if not OOO0OOo :
       return o00o
       if 59 - 59: OooOoo - IiI11Ii111 . I11iiIi11i1I . i1 + iI1iII1I1I1i + IiI11Ii111
     o0oOoOo0O00o [ 0 ] = 0x17
     if 88 - 88: I11iiIi11i1I - I1I - i1iiIII111 . IiIIii11Ii . i1iiIII111 . iI1iII1I1I1i
     if len ( WGControllerCenter . commPID ) > 1 :
      o0oOoOo0O00o [ 2 ] = 0
      o0oOoOo0O00o [ 3 ] = 0
     if len ( o00oOo0OOOO00 ) > 64 :
      if 30 - 30: ooo000 - IiI11Ii111 * IiIIii11Ii . IIiIIiIi11I1 - Oo
      if WGTools . isValid64Group ( o0oOoOo0O00o ) :
       for OOoO in range ( 0 , len ( o00oOo0OOOO00 ) // 64 ) :
        if o0oOoOo0O00o [ OOoO * 64 ] > 0 :
         o0oOoOo0O00o [ OOoO * 64 ] = 0x17
     iIii1iIii = i1111 . sid
     I11I11111 = self . getNewXid ( )
     OOOOoo0o = I11I11111
     for OOoO in ( 40 , 41 , 42 , 43 ) :
      o0oOoOo0O00o [ OOoO ] = I11I11111 & 0xff
      I11I11111 = I11I11111 >> 8
     i1I1Ii = self . dictControllers [ i1111 . controllerSN ] . ipport
     o0oo0o0 = xid4mobile ( iIii1iIii , i1111 . ipport )
     if 94 - 94: IiI11Ii111 + OooOoo / i1I % I11iiIi11i1I
     self . dictXid [ OOOOoo0o ] = o0oo0o0
     if 5 - 5: i1i1i1111I - oOo0O00
     if 87 - 87: I1Ii1I1 - Oo - oOO - i1 / I1I
     if 22 - 22: i1i1i1111I * Ooo0Ooo . Iii1i * i1iiIII111 / ooOOO - i1
     if 93 - 93: IIiIIiIi11I1 * Oo * OooOoo
     if 69 - 69: IIiIIiIi11I1 * i1iiIII111 . i1I / i1i1i1111I % i1iiIII111 * ooo000
     if 92 - 92: ooo000 * oOO * i1 - ooOOO / oOo0O00 . i1i1i1111I
     if 15 - 15: i1iiIII111
     if 95 - 95: Oo / IiIIii11Ii % i1iiIII111 / i1I - Iii1i
     if wgAppConfig . timeStampEnable > 0 :
      if not ( ( o0oOoOo0O00o [ 1 ] == 0xE2 ) or ( o0oOoOo0O00o [ 1 ] == 0xF8 ) ) :
       o00o0oOOo0Oo = self . dictControllers [ i1111 . controllerSN ]
       WGControllerCenter . commTimeStamp_Enc ( o0oOoOo0O00o , o00o0oOOo0Oo )
       if 40 - 40: i1I
       if 69 - 69: Ooo0Ooo - i1iiIII111
     if WGControllerCenter . commSM4 > 0 :
      o0oOoOo0O00o = WGControllerCenter . commSM4_Enc ( o0oOoOo0O00o )
     self . transport . write ( bytes ( o0oOoOo0O00o ) , i1I1Ii )
     self . logSend ( o0oOoOo0O00o , i1I1Ii )
     wgAppConfig . wglog ( "Server Send =>Controller SN= {0:d}  {1}" . format ( i1111 . controllerSN , i1I1Ii ) )
    else :
     o0oOoOo0O00o = None
     if 99 - 99: OooOoo * IiI11Ii111 % i1I
     if i1111 . controllerSN == 999999901 :
      if not wgAppConfig . ACTIVE_UDPQueue4webAPI :
       wgAppConfig . ACTIVE_UDPQueue4webAPI = True
       if 29 - 29: ooo000
      if len ( self . UDPQueue4webAPI ) > 0 :
       IiI = self . UDPQueue4webAPI . popleft ( ) . commandData
       o0oOoOo0O00o = [ IiI [ OOoO ] for OOoO in range ( 0 , len ( IiI ) ) ]
       for OOoO in ( 40 , 41 , 42 , 43 ) :
        o0oOoOo0O00o [ OOoO ] = o00oOo0OOOO00 [ OOoO ]
     elif i1111 . controllerSN == 999999902 :
      if not wgAppConfig . ACTIVE_UDPQueue4QRwebAPI :
       wgAppConfig . ACTIVE_UDPQueue4QRwebAPI = True
       if 2 - 2: i1iiIII111 - oOo0O00 / IIiIIiIi11I1 / iI1iII1I1I1i * OooOoo
      if len ( self . UDPQueue4QRwebAPI ) > 0 :
       IiI = self . UDPQueue4QRwebAPI . popleft ( ) . commandData
       o0oOoOo0O00o = [ IiI [ OOoO ] for OOoO in range ( 0 , len ( IiI ) ) ]
       for OOoO in ( 40 , 41 , 42 , 43 ) :
        o0oOoOo0O00o [ OOoO ] = o00oOo0OOOO00 [ OOoO ]
     if o0oOoOo0O00o is None :
      if 77 - 77: Ii / i1iiIII111 % oOo0O00
      o0oOoOo0O00o = [ o00oOo0OOOO00 [ OOoO ] for OOoO in range ( 0 , len ( o00oOo0OOOO00 ) ) ]
      o0oOoOo0O00o [ 0 ] = 0x37
      o0oOoOo0O00o [ 8 ] = 0x00
      if 65 - 65: ooOOO . i1I * I1I - oOo0O00 - ooo000 * Ii
      for OOoO in ( 0 , 1 , 2 , 3 ) :
       o0oOoOo0O00o [ OOoO + 44 ] = o0oOoOo0O00o [ OOoO + 40 ]
       o0oOoOo0O00o [ OOoO + 48 ] = o0oOoOo0O00o [ OOoO + 4 ]
       o0oOoOo0O00o [ OOoO + 4 ] = 0
     i1I1Ii = i1111 . ipport
     if ( ( WGControllerCenter . commSM4 > 0 ) and (
 WGControllerCenter . commSM4_PCNeed > 0 ) ) :
      o0oOoOo0O00o = WGControllerCenter . commSM4_Enc ( o0oOoOo0O00o )
     self . transport . write ( bytes ( o0oOoOo0O00o ) , i1I1Ii )
     self . logSend ( o0oOoOo0O00o , i1I1Ii )
     wgAppConfig . wglog (
 "Server Reply =>mobile Controller SN= {0:d} unconnected {1}" . format ( i1111 . controllerSN , i1I1Ii ) )
     if 43 - 43: I1I * i1
   else :
    if 90 - 90: I1Ii1I1 . ooo000 - I1Ii1I1 + oOO . i1iiIII111 - Ooo0Ooo
    return o00o
    if 87 - 87: ooo000 + i1i1i1111I - oOo0O00 % oOo0O00
 def DealUDPQueue4ReplyFromController ( self ) :
  o00o = False
  while True :
   try :
    if self . UDPQueue4ReplyFromController . __len__ ( ) > 0 :
     o00o = True
     if 90 - 90: oOO * ooo000
     i1111 = self . UDPQueue4ReplyFromController . popleft ( )
     if 13 - 13: i1I + Ii
     o00oOo0OOOO00 = i1111 . commandData
     if 91 - 91: I1Ii1I1 - OooOoo % iI1iII1I1I1i
     o0oo0o0 = self . dictXid . get ( i1111 . sid )
     if o0oo0o0 is not None :
      o0oOoOo0O00o = [ o00oOo0OOOO00 [ OOoO ] for OOoO in range ( 0 ,
 len ( o00oOo0OOOO00 ) ) ]
      if 90 - 90: OooOoo + I1I / I1I * Iii1i
      if 47 - 47: Oo % OooOoo * Ooo0Ooo - I1Ii1I1 * Oo . IiIIii11Ii
      if 61 - 61: Oo . I11iiIi11i1I
      if 84 - 84: Ooo0Ooo % ooo000 / i1
      if 5 - 5: i1
      if 51 - 51: IiI11Ii111 + ooo000 / i1i1i1111I * iI1iII1I1I1i
      if 84 - 84: iI1iII1I1I1i + Iii1i + Oo . i1i1i1111I
      if 16 - 16: I11iiIi11i1I * Iii1i / i1I % i1I
      if 62 - 62: Oo * I1Ii1I1 % ooo000
      if 1 > 0 :
       o0oOoOo0O00o [ 0 ] = 0x37
       if 62 - 62: Ooo0Ooo * i1I + Oo / i1i1i1111I + oOO * I1Ii1I1
       if ( len ( o00oOo0OOOO00 ) > 64 ) and ( len ( o00oOo0OOOO00 ) != 192 ) :
        if 52 - 52: ooo000 . oOO % IIiIIiIi11I1 % I11iiIi11i1I . oOO % Oo
        if 97 - 97: Oo * I1Ii1I1
        if not WGTools . isValid64Group ( o00oOo0OOOO00 ) :
         pass
        else :
         for OOoO in range ( 0 , len ( o00oOo0OOOO00 ) // 64 ) :
          if o0oOoOo0O00o [ OOoO * 64 ] > 0 :
           o0oOoOo0O00o [ OOoO * 64 ] = 0x37
           if 77 - 77: Iii1i / iI1iII1I1I1i % Oo + OooOoo . I1I % I1Ii1I1
      I11I11111 = o0oo0o0 . xid
      for OOoO in ( 40 , 41 , 42 , 43 ) :
       o0oOoOo0O00o [ OOoO ] = I11I11111 & 0xff
       I11I11111 = I11I11111 >> 8
      i1I1Ii = o0oo0o0 . addr
      if ( ( WGControllerCenter . commSM4 > 0 ) and (
 WGControllerCenter . commSM4_PCNeed > 0 ) ) :
       o0oOoOo0O00o = WGControllerCenter . commSM4_Enc ( o0oOoOo0O00o )
      self . transport . write ( bytes ( o0oOoOo0O00o ) , i1I1Ii )
      self . logSend ( o0oOoOo0O00o , i1I1Ii )
      wgAppConfig . logdebug (
 "Server Send =>Mobile New {0} from {1} DataLen={2:d} " . format ( binascii . hexlify ( bytes ( o0oOoOo0O00o ) ) ,
 i1I1Ii , len ( bytes (
 o0oOoOo0O00o ) ) ) )
      wgAppConfig . wglog ( "Server Send =>Mobile = {0}" . format ( i1111 . ipport ) )
      if 12 - 12: Ii + Oo . oOo0O00 % oOO + I1Ii1I1
      self . dictXid . pop ( i1111 . sid , None )
      if 55 - 55: i1 . Ii + oOo0O00 % oOO * OooOoo - i1I
    else :
     if 63 - 63: I11iiIi11i1I + IiI11Ii111 + I11iiIi11i1I % Oo / Ii * i1
     if self . dictXid . __len__ ( ) > 100 :
      if 5 - 5: oOo0O00 / I1I
      I111iIi11 = self . dictXid . keys ( )
      II1i11i1iiI = time . time ( )
      if 18 - 18: I1I % IiIIii11Ii % OooOoo + IiI11Ii111 * Ooo0Ooo
      if 10 - 10: ooOOO + I1Ii1I1 - iI1iII1I1I1i - ooOOO . Ooo0Ooo
      for OOoO in list ( I111iIi11 ) :
       o0oo0o0 = self . dictXid . get ( OOoO )
       if II1i11i1iiI > o0oo0o0 . currentTime + 3 :
        self . dictXid . pop ( OOoO , None )
        if 89 - 89: I1I % i1i1i1111I
        if 81 - 81: I1I + IiIIii11Ii * I11iiIi11i1I % I1Ii1I1 % OooOoo - i1iiIII111
        if 56 - 56: IiI11Ii111 . i1i1i1111I / Oo + oOO
     return o00o
   except Exception as ooo :
    pass
    if 15 - 15: Ooo0Ooo % i1iiIII111 . i1i1i1111I * i1iiIII111 + OooOoo + i1
    if 36 - 36: Oo
    mMonitorInfo . wglog ( "1104" )
    wgAppConfig . wglog ( "{0}: {1}" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , ooo ) )
    return o00o
    if 49 - 49: Oo - Oo
 def DealOpenDoorFromWEBSocket ( self , controllerSN , recordDoorNO , inOrOut ,
 virtualCardNO ) :
  I1iII = OpenDoorByVirtualCard ( )
  I1iII . controllerSN = controllerSN
  I1iII . inOrOut = inOrOut
  I1iII . recordDoorNO = recordDoorNO
  I1iII . virtualCardNO = virtualCardNO
  self . UDPQueueFromWEBSocket . append ( I1iII )
  if self . taskqueueWGControllerCenterUDPWS . empty ( ) :
   self . taskqueueWGControllerCenterUDPWS . put ( 1001003 )
   if 23 - 23: oOo0O00 * IIiIIiIi11I1 % I11iiIi11i1I . i1I + oOo0O00
 def DealUDPQueueFromWEBSocket ( self ) :
  o00o = False
  while True :
   try :
    if self . UDPQueueFromWEBSocket . __len__ ( ) > 0 :
     o00o = True
     i1111 = self . UDPQueueFromWEBSocket . popleft ( )
     if 71 - 71: Oo % I1Ii1I1 . i1iiIII111
     if 97 - 97: IiIIii11Ii / oOO * IiI11Ii111 % ooo000
     if 62 - 62: ooOOO / I11iiIi11i1I . OooOoo * OooOoo * OooOoo
     i1iII11iii = i1111 . controllerSN
     oooOO0OoO00O = i1111 . recordDoorNO
     oO0Ooo0O = i1111 . inOrOut
     o00oOo = i1111 . virtualCardNO
     if self . isConnected ( i1iII11iii ) :
      if 49 - 49: ooOOO * IiIIii11Ii . i1 * IiI11Ii111 * Ooo0Ooo
      I11I11111 = self . getNewXid ( )
      if 91 - 91: iI1iII1I1I1i / iI1iII1I1I1i + oOo0O00 % ooOOO
      o0ooo0oOoO = WGCommand . cmdRemoteOpenDoorInLocalnetwork ( i1iII11iii , oooOO0OoO00O , oO0Ooo0O ,
 o00oOo , I11I11111 )
      o00oOo0OOOO00 = o0ooo0oOoO
      o0oOoOo0O00o = [ o00oOo0OOOO00 [ OOoO ] for OOoO in range ( 0 , len ( o00oOo0OOOO00 ) ) ]
      o0oOoOo0O00o [ 0 ] = 0x17
      if 55 - 55: i1 * i1i1i1111I + Ooo0Ooo + i1i1i1111I + i1i1i1111I
      if len ( WGControllerCenter . commPID ) > 1 :
       o0oOoOo0O00o [ 2 ] = 0
       o0oOoOo0O00o [ 3 ] = 0
      if len ( o00oOo0OOOO00 ) > 64 :
       if 10 - 10: i1i1i1111I / i1I / i1i1i1111I . oOo0O00 * IIiIIiIi11I1 % Iii1i
       if WGTools . isValid64Group ( o0oOoOo0O00o ) :
        for OOoO in range ( 0 , len ( o00oOo0OOOO00 ) // 64 ) :
         if o0oOoOo0O00o [ OOoO * 64 ] > 0 :
          o0oOoOo0O00o [ OOoO * 64 ] = 0x17
          if 55 - 55: OooOoo % IIiIIiIi11I1 - oOO % Oo * Iii1i - IiI11Ii111
          if 25 - 25: Ooo0Ooo . oOO * IiIIii11Ii * I11iiIi11i1I / IiI11Ii111 * Ii
          if 78 - 78: I11iiIi11i1I / I1Ii1I1 / IiIIii11Ii . OooOoo
          if 66 - 66: Ooo0Ooo . ooo000 - I1Ii1I1
          if 48 - 48: i1iiIII111
          if 87 - 87: Oo % oOo0O00
      if wgAppConfig . timeStampEnable > 0 :
       if not ( ( o0oOoOo0O00o [ 1 ] == 0xE2 ) or ( o0oOoOo0O00o [ 1 ] == 0xF8 ) ) :
        o00o0oOOo0Oo = self . dictControllers [ i1111 . controllerSN ]
        WGControllerCenter . commTimeStamp_Enc ( o0oOoOo0O00o , o00o0oOOo0Oo )
        if 39 - 39: ooOOO + Iii1i / i1I * ooo000
        if 28 - 28: I11iiIi11i1I * iI1iII1I1I1i . IiI11Ii111
      if WGControllerCenter . commSM4 > 0 :
       o0oOoOo0O00o = WGControllerCenter . commSM4_Enc ( o0oOoOo0O00o )
      i1I1Ii = self . dictControllers [ i1iII11iii ] . ipport
      self . transport . write ( bytes ( o0oOoOo0O00o ) , i1I1Ii )
      self . logSend ( o0oOoOo0O00o , i1I1Ii )
      wgAppConfig . wglog ( "Server Send WEBSocket =>Controller SN= {0:d}  {1}" . format ( i1iII11iii , i1I1Ii ) )
    else :
     if 63 - 63: IiIIii11Ii
     return o00o
   except Exception as ooo :
    pass
    if 1 - 1: i1iiIII111 - IiIIii11Ii + Iii1i . I1Ii1I1 + ooo000
    if 46 - 46: Oo
    wgAppConfig . wglog ( "{0}: {1}" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , ooo ) )
    return o00o
    if 56 - 56: i1i1i1111I / I11iiIi11i1I % Ooo0Ooo / Oo
    if 63 - 63: OooOoo
    if 99 - 99: i1 + ooo000 - oOo0O00 + Ooo0Ooo + oOO / ooOOO
 optionNewRecordSend = 0
 countUsersOfDingyue = 0
 listUsersOfDingyue = [ ]
 cntMs = 0
 if 14 - 14: iI1iII1I1I1i * OooOoo / Ooo0Ooo + Iii1i
 def DealUDPQueue4Dingyue (
 self ) :
  if 46 - 46: Oo / oOo0O00 / OooOoo . Ooo0Ooo - i1iiIII111 * Ii
  if 21 - 21: IIiIIiIi11I1 / ooOOO * Ooo0Ooo . oOO - OooOoo - i1iiIII111
  if 97 - 97: ooo000 % Oo / Iii1i . OooOoo
  if 20 - 20: Iii1i % i1 * Ii
  if 87 - 87: IiI11Ii111 - Iii1i * Ooo0Ooo
  if 62 - 62: IIiIIiIi11I1 + Ooo0Ooo . i1
  if 80 - 80: I11iiIi11i1I * I1Ii1I1
  o00o = False
  while True :
   if self . UDPQueue4Dingyue . __len__ ( ) > 0 :
    o00o = True
    if 32 - 32: ooOOO . i1 * Ooo0Ooo
    i1111 = self . UDPQueue4Dingyue . popleft ( )
    if 26 - 26: Oo * I11iiIi11i1I * I1Ii1I1 % I1I
    o00oOo0OOOO00 = i1111 . commandData
    if 76 - 76: OooOoo * Oo / ooo000 / ooOOO . OooOoo / Ooo0Ooo
    if 3 - 3: i1i1i1111I / ooo000 . I11iiIi11i1I - i1 + i1
    if ( i1111 . functionID == 0x10 and (
 ( i1111 . controllerSN == 0x7EEEEEEE ) or ( i1111 . controllerSN == 0x7EEEEEEC ) ) ) :
     if i1111 . controllerSN == 0x7EEEEEEE :
      if 44 - 44: Ii - Ooo0Ooo % Ii * oOo0O00
      iI11I1iIIi = 60 * 5
      if o00oOo0OOOO00 [ 8 ] > 0 :
       iI11I1iIIi = 60 * o00oOo0OOOO00 [ 8 ]
      self . optionNewRecordSend = o00oOo0OOOO00 [ 9 ]
      o00oOO0o0 = time . time ( ) + iI11I1iIIi
      iiIii111i1 = 0
      if len ( self . listUsersOfDingyue ) > 0 :
       for OOoO in self . listUsersOfDingyue :
        if OOoO [ 0 ] == i1111 . ipport :
         OOoO [ 1 ] = o00oOO0o0
         iiIii111i1 = 1
         break
      if iiIii111i1 == 0 :
       self . listUsersOfDingyue . append ( [ i1111 . ipport , o00oOO0o0 ] )
       self . countUsersOfDingyue = len ( self . listUsersOfDingyue )
      wgAppConfig . wglog ( "Server receive subscription refresh<= from Mobile or PC Client [{0}]" . format ( i1111 . ipport ) )
      if 15 - 15: ooOOO + Ooo0Ooo + i1
     if i1111 . controllerSN == 0x7EEEEEEC :
      if 41 - 41: I1Ii1I1
      if len ( self . listUsersOfDingyue ) > 0 :
       for OOoO in self . listUsersOfDingyue :
        if OOoO [ 0 ] == i1111 . ipport :
         self . listUsersOfDingyue . remove ( OOoO )
         self . countUsersOfDingyue = len ( self . listUsersOfDingyue )
         break
      wgAppConfig . wglog ( "Server receive unsubscription <= from Mobile or PC Client [{0}]" . format ( i1111 . ipport ) )
      if 6 - 6: Ii
      if 85 - 85: I1I + IIiIIiIi11I1 + IiI11Ii111 + Ooo0Ooo . ooOOO / IIiIIiIi11I1
     o0oOoOo0O00o = [ o00oOo0OOOO00 [ OOoO ] for OOoO in range ( 0 , 64 ) ]
     o0oOoOo0O00o [ 0 ] = 0x37
     o0oOoOo0O00o [ 8 ] = 0x01
     i1I1Ii = i1111 . ipport
     if ( ( WGControllerCenter . commSM4 > 0 ) and (
 WGControllerCenter . commSM4_PCNeed > 0 ) ) :
      o0oOoOo0O00o = WGControllerCenter . commSM4_Enc ( o0oOoOo0O00o )
      if 47 - 47: Oo + Iii1i . oOO
     self . transport . write ( bytes ( o0oOoOo0O00o ) , i1I1Ii )
     self . logSend ( o0oOoOo0O00o , i1I1Ii )
     wgAppConfig . wglog ( "Server reply => Mobile or PC Client [{0}]" . format ( i1I1Ii ) )
    elif i1111 . cmdtype == 0x17 :
     if self . countUsersOfDingyue > 0 :
      oo00 = time . time ( )
      if ( ( WGControllerCenter . commSM4 > 0 ) and (
 WGControllerCenter . commSM4_PCNeed > 0 ) ) :
       i1111 . commandData = WGControllerCenter . commSM4_Enc (
 i1111 . commandData )
      i1I1Ii = i1111 . ipport
      for OOoO in self . listUsersOfDingyue :
       self . transport . write ( i1111 . commandData , OOoO [ 0 ] )
       wgAppConfig . wglog ( "Server Send =>subscriber(mobile or PC) = {0}" . format ( OOoO [ 0 ] ) )
       wgAppConfig . logdebug (
 "????DealUDPQueue4Dingyue Server send =>subscriber(mobile or PC) {0} from {1} DataLen={2:d} " . format (
 binascii . hexlify ( bytes ( i1111 . commandData ) ) , i1I1Ii ,
 len ( bytes ( i1111 . commandData ) ) ) )
       if 99 - 99: IiIIii11Ii + IiIIii11Ii
       if 96 - 96: IiI11Ii111 % i1 + ooOOO * i1I / ooo000
   else :
    if 12 - 12: OooOoo
    if 81 - 81: Oo % i1I . I1I * iI1iII1I1I1i / i1i1i1111I . oOO
    self . cntMs = self . cntMs + 1
    Iii1ii11i1iii = self . cntMs
    if Iii1ii11i1iii % 1000 == 0 :
     if self . countUsersOfDingyue > 0 :
      oo00 = time . time ( )
      for OOoO in self . listUsersOfDingyue :
       if oo00 >= OOoO [ 1 ] :
        self . listUsersOfDingyue . remove ( OOoO )
      self . countUsersOfDingyue = len ( self . listUsersOfDingyue )
    return o00o
   mMonitorInfo . bSendBywsudp = self . countUsersOfDingyue
   if 80 - 80: IIiIIiIi11I1 + oOO / OooOoo
 def DealUDPQueue4DingyueWS ( self ) :
  o00o = False
  while True :
   if self . UDPQueue4DingyueWS . __len__ ( ) > 0 :
    o00o = True
    if 6 - 6: Ooo0Ooo / oOO
    i1111 = self . UDPQueue4DingyueWS . popleft ( )
    if self . countUsersOfDingyue > 0 :
     for OOoO in self . listUsersOfDingyue :
      self . transport . write ( i1111 , OOoO [ 0 ] )
   else :
    break
  return o00o
  if 92 - 92: IiIIii11Ii % iI1iII1I1I1i + Oo
 DealWGRecordLogtimeout = 0
 if 56 - 56: IIiIIiIi11I1
 def DealWGRecordLog ( self ) :
  task . LoopingCall ( self . DealWGRecordLogRealize ) . start ( 5 , True )
  if 54 - 54: Iii1i % IiI11Ii111 / OooOoo + Ii + i1I
 Dealwebsockettimeout = 0
 if 8 - 8: ooo000 / oOO - i1i1i1111I % iI1iII1I1I1i / ooo000 % oOO
 def DealWGRecordLogRealize ( self ) :
  o00o = False
  if 100 - 100: IiI11Ii111 - I1I + Iii1i / I1Ii1I1
  if 74 - 74: Iii1i % I11iiIi11i1I
  Ii11i11I1IIi = time . time ( )
  if not Ii11i11I1IIi > self . DealWGRecordLogtimeout :
   return o00o
  self . DealWGRecordLogtimeout = Ii11i11I1IIi + 5
  o00o = True
  if 59 - 59: I11iiIi11i1I * oOo0O00 + oOo0O00 / ooOOO * oOO
  if 16 - 16: Ii / oOO
  oo00 = time . localtime ( Ii11i11I1IIi )
  if 31 - 31: OooOoo . OooOoo + ooOOO
  if 7 - 7: I1I / Oo % IiIIii11Ii . IiI11Ii111 * i1iiIII111 + i1i1i1111I
  if WGControllerCenter . logModeHourToClear == oo00 . tm_hour and wgAppConfig . wgrecordlogEnable :
   if oo00 . tm_min == 0 :
    if ( ( WGControllerCenter . logModeWeekToClear == 0 ) or ( WGControllerCenter . logModeWeekToClear == (
 oo00 . tm_wday + 1 ) ) ) :
     try :
      if mMonitorInfo . backupLogfile > 0 :
       if 91 - 91: OooOoo + IiI11Ii111 - i1iiIII111 + Iii1i . IiIIii11Ii
       if 29 - 29: I1Ii1I1 + Iii1i + i1I % ooo000 . ooOOO * IiI11Ii111
       if 71 - 71: i1 - i1iiIII111
       shutil . copy ( wgGlobal . wgcloudpath1001wgrecord_logName ,
 "{}{}wgrecord.log" . format ( wgGlobal . wgcloudpathdir , time . strftime (
 '%Y%m%d_%H%M%S' ) ) )
       shutil . copy ( wgGlobal . wgcloudpath1001wgrecordtcp_logName ,
 "{}{}wgrecordtcp.log" . format ( wgGlobal . wgcloudpathdir ,
 time . strftime ( '%Y%m%d_%H%M%S' ) ) )
       if 35 - 35: ooo000 % OooOoo
      with open ( wgGlobal . wgcloudpath1001wgrecord_logName , 'w' ) as Iiii1II11111i :
       Iiii1II11111i . seek ( 0 )
       Iiii1II11111i . truncate ( )
      wgAppConfig . wglog ( "Clear wgrecord.log" )
      if 58 - 58: Ooo0Ooo * IiIIii11Ii
      if 19 - 19: IIiIIiIi11I1 . iI1iII1I1I1i / I1Ii1I1 / I1I
      with open ( wgGlobal . wgcloudpath1001wgrecordtcp_logName , 'w' ) as I1i :
       I1i . seek ( 0 )
       I1i . truncate ( )
      wgAppConfig . wglog ( "Clear wgrecordtcp.log" )
     except :
      pass
      wgAppConfig . logprint ( "failed clear wgrecord" )
      pass
      if 73 - 73: I1Ii1I1 * oOo0O00 * oOo0O00 . I1Ii1I1
      if 23 - 23: IiI11Ii111 * i1i1i1111I / i1i1i1111I / Ooo0Ooo
     self . DealWGRecordLogtimeout = time . time ( ) + 120
     if 32 - 32: ooo000 * I11iiIi11i1I . Iii1i / IiI11Ii111
  if mMonitorInfo . websocketHeartCycle > 0 :
   if 13 - 13: Iii1i - Iii1i . Ii * OooOoo
   if self . Dealwebsockettimeout > Ii11i11I1IIi :
    return o00o
   self . Dealwebsockettimeout = Ii11i11I1IIi + mMonitorInfo . websocketHeartCycle
   if not ( mMonitorInfo . ws is None ) :
    if 32 - 32: ooOOO
    mMonitorInfo . ws . dealHeartBeat ( )
  return o00o
  if 19 - 19: Iii1i % Oo . i1iiIII111 % i1i1i1111I * OooOoo / IIiIIiIi11I1
 def DealSendBroadCastToController ( self ) :
  wgAppConfig . logdebug ( "DealsendBroadCastToController Start From " , self . transport . getHost ( ) )
  if 98 - 98: I1Ii1I1 - i1iiIII111 + OooOoo - Ii / oOO
  ooOo0O0O = [ 0x17 , 0x26 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  ooOo0O0O [ 12 ] = 0x40
  I11I11111 = 0x7ffffff0
  WGTools . longToByte ( I11I11111 , ooOo0O0O , 40 , 4 )
  self . bytcmdQuey = bytes ( ooOo0O0O )
  if 89 - 89: oOO * Iii1i . Ii
  if 14 - 14: Oo + Ooo0Ooo % Iii1i / Iii1i / i1
  if 55 - 55: IiIIii11Ii / oOo0O00 * ooo000 / Oo
  if 63 - 63: i1 . Oo
  if 37 - 37: IiI11Ii111 . Oo + IiIIii11Ii
  if 11 - 11: IiI11Ii111
  if 20 - 20: I11iiIi11i1I - i1iiIII111
  if 77 - 77: Ooo0Ooo * OooOoo
  if 86 - 86: IiI11Ii111 + IiIIii11Ii + ooOOO . IiIIii11Ii - i1i1i1111I + Iii1i
  if 20 - 20: i1iiIII111 / ooo000 / IIiIIiIi11I1 - Oo . Ooo0Ooo % ooOOO
  if 19 - 19: i1iiIII111
  if 17 - 17: IiIIii11Ii - i1iiIII111
  if 64 - 64: Ooo0Ooo - i1iiIII111 % i1 / ooo000
  if 54 - 54: oOO - IIiIIiIi11I1 % oOO % ooo000 / i1i1i1111I
  if 75 - 75: I11iiIi11i1I - i1 % i1i1i1111I * IiIIii11Ii / I1I . Iii1i
  if 47 - 47: OooOoo - Ii . IiIIii11Ii + oOo0O00 / iI1iII1I1I1i
  if 19 - 19: i1 - i1 / OooOoo . OooOoo . ooo000
  if 94 - 94: Ooo0Ooo
  if 48 - 48: Oo
  if 85 - 85: IIiIIiIi11I1 . I1Ii1I1 % OooOoo . OooOoo + i1i1i1111I
  if 32 - 32: Iii1i
  if 73 - 73: I1Ii1I1 / OooOoo - I11iiIi11i1I * oOo0O00
  if 61 - 61: i1iiIII111 * Iii1i - Oo + OooOoo
  if 8 - 8: IiI11Ii111 . I11iiIi11i1I / Iii1i / Ooo0Ooo - iI1iII1I1I1i * oOO
  if 92 - 92: I11iiIi11i1I % i1 + Ooo0Ooo
 def checkRunning ( self ) :
  if not ( self . arrUsers is None ) :
   if len ( self . arrUsers ) > 0 :
    o0000oOOO00 = time . time ( )
    if 21 - 21: I11iiIi11i1I . OooOoo - I1I
    if 52 - 52: i1 . I1Ii1I1 - oOO * i1i1i1111I % iI1iII1I1I1i
    if 62 - 62: ooo000 * I1Ii1I1 - Ii
    if 48 - 48: I1I - Oo + i1i1i1111I . IiI11Ii111 + Iii1i + i1
    for OOoO in list ( self . arrUsers . keys ( ) ) :
     if o0000oOOO00 > self . arrUsers [ OOoO ] . deactivateTime :
      self . arrUsers . pop ( OOoO )
      if 37 - 37: Oo % i1i1i1111I
      if 28 - 28: oOo0O00 . oOO / Ii / ooOOO / i1i1i1111I
      if 73 - 73: i1I . Ii - i1iiIII111 . oOo0O00 . Iii1i
      if 46 - 46: I11iiIi11i1I - i1iiIII111 / ooo000
      if 93 - 93: Oo / Ooo0Ooo + I11iiIi11i1I
      if 13 - 13: Iii1i / ooo000 % i1I - oOo0O00 . I1Ii1I1
      if 20 - 20: i1i1i1111I - i1i1i1111I * i1 * OooOoo / I1Ii1I1 * I11iiIi11i1I
      if 67 - 67: I11iiIi11i1I % iI1iII1I1I1i + i1iiIII111 / IiIIii11Ii + Ooo0Ooo % Ii
      if 92 - 92: i1 - IiI11Ii111 / i1i1i1111I % i1I / IIiIIiIi11I1 * Oo
 def datagramReceived ( self , data , addr ) :
  if wgGlobal . allowprint :
   if 2 - 2: oOO + i1i1i1111I
   if 64 - 64: iI1iII1I1I1i
   OOo000o0 = [ '%02X' % i for i in data ]
   if 41 - 41: I1Ii1I1 + i1i1i1111I
   wgAppConfig . logdebug (
 "m1001CloudServerUDP received from %s DataLen=%d HexData: %s" % ( addr , len ( data ) , " " . join ( OOo000o0 ) ) )
   if 36 - 36: IiIIii11Ii + i1i1i1111I . iI1iII1I1I1i / IIiIIiIi11I1 + ooOOO
   if 98 - 98: OooOoo * i1I . Ii - IiIIii11Ii
   if 37 - 37: IiI11Ii111 - OooOoo * IiIIii11Ii - I11iiIi11i1I
   if 80 - 80: i1i1i1111I + Ooo0Ooo * I11iiIi11i1I
   if 58 - 58: Ii * Ii % i1
   if 90 - 90: OooOoo . oOo0O00 . I1Ii1I1 - ooo000 % i1i1i1111I
   if 29 - 29: i1i1i1111I - iI1iII1I1I1i + oOO - iI1iII1I1I1i
   if 14 - 14: I1Ii1I1
   if 94 - 94: ooo000
   if 99 - 99: ooo000 / i1i1i1111I + i1iiIII111 + IiI11Ii111
   if 63 - 63: IIiIIiIi11I1 * Oo
   if 36 - 36: oOO . IIiIIiIi11I1 / I1I / i1iiIII111
   if 73 - 73: IiI11Ii111
   if 100 - 100: IiIIii11Ii . IIiIIiIi11I1 - Ii / I1I
   if 3 - 3: ooOOO - I1Ii1I1 + OooOoo . ooOOO . i1i1i1111I - oOo0O00
   if 92 - 92: I11iiIi11i1I - ooOOO / Ii / i1i1i1111I
   if 55 - 55: I1Ii1I1 + IiIIii11Ii / Ooo0Ooo
   if 62 - 62: I1Ii1I1 % Ooo0Ooo * i1I + ooo000
  if len ( data ) % 64 == 0 :
   if self . taskqueueWGControllerCenterUDPWS . empty ( ) :
    self . taskqueueWGControllerCenterUDPWS . put ( len ( data ) )
    if 2 - 2: I1I % i1I . OooOoo % i1iiIII111 + Iii1i
    if 20 - 20: IIiIIiIi11I1 / Oo + Ooo0Ooo * ooOOO
    if 67 - 67: iI1iII1I1I1i . iI1iII1I1I1i / i1I * Ii . I1I / Ooo0Ooo
    if 90 - 90: IiI11Ii111 / I1I - I1I + i1I / Iii1i
    if 48 - 48: oOo0O00 . I11iiIi11i1I + Oo
   i1111 = WGPacket ( data , addr )
   if 90 - 90: iI1iII1I1I1i * Ooo0Ooo - IiIIii11Ii + oOO
   if 55 - 55: Oo + iI1iII1I1I1i / IiIIii11Ii - oOO / IiI11Ii111
   if 21 - 21: ooo000 - Ooo0Ooo + oOo0O00 * IiI11Ii111 * Oo
   if ( ( i1111 . cmdtype == 0x17 ) and ( i1111 . controllerSN > 0 ) and (
 ( i1111 . functionID == 0x20 ) or ( i1111 . functionID == 0x22 ) or (
 i1111 . functionID == 0x26 ) ) and i1111 . sid == 0 ) :
    pass
    if 12 - 12: i1i1i1111I
    if 84 - 84: IiI11Ii111
    if 53 - 53: IIiIIiIi11I1
   elif ( ( ( i1111 . cmdtype == 0x37 ) and ( ( len ( WGControllerCenter . commPID ) == 0 ) or (
 i1111 . reservedA in WGControllerCenter . commPID ) ) ) ) :
    pass
   else :
    if WGControllerCenter . commSM4 > 0 :
     if ( ( len ( data ) == 192 ) and (
 ( data [ 188 ] == 0 ) and ( data [ 189 ] == 0 ) and ( data [ 190 ] == 0 ) and ( data [ 191 ] == 0 ) ) ) :
      Ii1III1Iii = WGControllerCenter . commSM4_Dec ( data )
      o0oOoOo0O00o = [ data [ OOoO ] for OOoO in range ( 0 , len ( data ) ) ]
      for OOoO in range ( 0 , 64 ) :
       o0oOoOo0O00o [ OOoO ] = Ii1III1Iii [ OOoO ]
      data = bytes ( o0oOoOo0O00o )
     else :
      data = WGControllerCenter . commSM4_Dec ( data )
      if 96 - 96: Oo % iI1iII1I1I1i * i1I % oOo0O00 . Ooo0Ooo
      if 28 - 28: oOO - ooo000
      if 15 - 15: Oo - IiIIii11Ii
     i1111 = WGPacket ( data , addr )
     if 60 - 60: ooo000 * IiIIii11Ii . I11iiIi11i1I / oOo0O00
   if ( 1 < 0 ) :
    pass
    if 35 - 35: oOo0O00 + i1 - Ooo0Ooo . Iii1i . OooOoo . IiIIii11Ii
    if 67 - 67: i1iiIII111 % I1Ii1I1 + Ooo0Ooo % oOO / I1I - IiI11Ii111
    if 83 - 83: i1I . OooOoo - ooo000 * I1Ii1I1
    if 52 - 52: I1Ii1I1 % i1 - Oo
    if 91 - 91: Oo % i1I
    if 51 - 51: oOO + i1iiIII111 / i1i1i1111I / Iii1i . Iii1i - i1I
    if 20 - 20: IiI11Ii111
    if 91 - 91: i1I . Iii1i - OooOoo * IiIIii11Ii - I1Ii1I1
    if 31 - 31: oOo0O00 / oOO / ooo000 / Ii + i1i1i1111I + OooOoo
    if 81 - 81: i1I
    if 14 - 14: iI1iII1I1I1i
    if 77 - 77: Oo
   elif ( ( i1111 . cmdtype == 0x17 ) and ( i1111 . controllerSN > 0 ) and (
 i1111 . functionID == 0x20 ) and i1111 . sid == 0 ) :
    if 19 - 19: I1Ii1I1 + i1i1i1111I . IIiIIiIi11I1
    self . UDPQueue4HeartBeatPacket . append ( i1111 )
    if 47 - 47: Oo - IIiIIiIi11I1
    if ( self . countUsersOfDingyue ) > 0 and ( self . optionNewRecordSend == 0 ) :
     if 3 - 3: IIiIIiIi11I1 . i1i1i1111I * Ooo0Ooo / ooo000
     self . UDPQueue4Dingyue . append ( i1111 )
     if 41 - 41: I1Ii1I1 - oOo0O00 / I1Ii1I1 . i1I * IiI11Ii111 * Ii
   elif ( ( i1111 . cmdtype == 0x17 ) and ( i1111 . controllerSN > 0 ) and (
 i1111 . functionID == 0x26 ) and i1111 . sid == 0 ) :
    if 16 - 16: IIiIIiIi11I1 + IiI11Ii111 % oOO
    self . UDPQueue4HeartBeatPacket . append ( i1111 )
    if 1 - 1: ooOOO % Oo
    if self . countUsersOfDingyue > 0 and ( self . optionNewRecordSend == 0 ) :
     if 25 - 25: oOO . I11iiIi11i1I . OooOoo % IiIIii11Ii / Oo
     self . UDPQueue4Dingyue . append ( i1111 )
     if 28 - 28: i1iiIII111
     if 18 - 18: OooOoo . ooOOO
   elif ( ( i1111 . cmdtype == 0x17 ) and ( i1111 . controllerSN > 0 ) and (
 i1111 . functionID == 0x26 ) and i1111 . sid == 0x7ffffff0 ) :
    if 36 - 36: i1i1i1111I / oOO + oOo0O00 * iI1iII1I1I1i
    if 96 - 96: I11iiIi11i1I - I1I - I1Ii1I1 + I1I
    self . UDPQueue4HeartBeatPacket . append ( i1111 )
    if 88 - 88: ooo000 + i1I . oOo0O00 % I1I / IIiIIiIi11I1 * Ooo0Ooo
    if self . countUsersOfDingyue > 0 and ( self . optionNewRecordSend == 0 ) :
     if 58 - 58: ooOOO % IiI11Ii111 + IiI11Ii111 . ooo000
     self . UDPQueue4Dingyue . append ( i1111 )
     if 55 - 55: IiIIii11Ii % IiIIii11Ii
   elif ( i1111 . cmdtype == 0x17 ) and ( i1111 . controllerSN > 0 ) and ( i1111 . functionID == 0x22 ) :
    if 81 - 81: iI1iII1I1I1i
    self . UDPQueue4QRCode . append ( i1111 )
    self . addToUDPQueue4QRwebAPI ( i1111 )
    mMonitorInfo . sendQRCode ( i1111 )
    if 22 - 22: I11iiIi11i1I
    if ( self . countUsersOfDingyue ) > 0 :
     if 33 - 33: oOo0O00 - I11iiIi11i1I % ooo000 + Oo . I1Ii1I1
     self . UDPQueue4Dingyue . append ( i1111 )
     if 42 - 42: IiIIii11Ii / i1i1i1111I / IiIIii11Ii / IiIIii11Ii
   elif i1111 . cmdtype == 0x37 :
    if 19 - 19: Iii1i . Iii1i + i1iiIII111
    if ( ( len ( WGControllerCenter . commPID ) == 0 ) or (
 i1111 . reservedA in WGControllerCenter . commPID ) ) :
     o0ooO0O00 = 1
     if not ( wgGlobal . allowpcip is None ) :
      if not ( addr [ 0 ] in [ wgGlobal . allowpcip ] ) :
       o0ooO0O00 = 0
     if o0ooO0O00 :
      o0ooO0O00 = self . checkValidPCCommandByPCCticks ( data , i1111 )
      if 28 - 28: i1iiIII111 % oOO / ooo000 . oOo0O00
     if o0ooO0O00 == 0 :
      pass
     elif ( i1111 . functionID == 0x10 ) :
      if 78 - 78: I1I % Oo
      self . UDPQueue4Dingyue . append ( i1111 )
      if 72 - 72: IiI11Ii111 * i1i1i1111I * i1I
     else :
      if 83 - 83: Ooo0Ooo * i1iiIII111 + I1I / Ii
      self . UDPQueue4Mobile . append ( i1111 )
      if 64 - 64: ooOOO . Oo - iI1iII1I1I1i . I1Ii1I1
   elif i1111 . controllerSN > 0 :
    wgAppConfig . logdebug ( "Server Receive <= From ControllerSN={0},xid={1}" . format ( i1111 . controllerSN , i1111 . sid ) )
    if i1111 . sid > 0 :
     if 77 - 77: ooo000 % i1I / Iii1i
     self . UDPQueue4ReplyFromController . append ( i1111 )
     if 37 - 37: i1I
    if i1111 . functionID == 0x20 :
     if 1 - 1: OooOoo + Ii - I11iiIi11i1I % Ii
     if 44 - 44: i1i1i1111I . Oo - oOo0O00 - i1iiIII111 + ooo000 + i1i1i1111I
     wgAppConfig . wglog (
 "Server Receive <= From ControllerSN={0} ({1}) reply xid= {2:d}" . format (
 i1111 . controllerSN , addr ,
 i1111 . sid ) )
    elif i1111 . functionID == 0x40 :
     if data [ 8 ] == 1 :
      wgAppConfig . wglog (
 "Server Receive <= Controller RemoteOpenDoor Successfully ControllerSN= {0:d}" . format ( i1111 . controllerSN ) )
     else :
      wgAppConfig . wglog (
 "Server Receive <= Controller  ???RemoteOpenDoor Failed ControllerSN= {0:d}" . format ( i1111 . controllerSN ) )
   del i1111
   if self . taskqueueWGControllerCenterUDPWS . empty ( ) :
    self . taskqueueWGControllerCenterUDPWS . put ( len ( data ) )
    if 72 - 72: IiI11Ii111 - ooo000 . oOo0O00
 def checkValidPCCommandByPCCticks ( self , data , wgpkt ) :
  o0ooO0O00 = 1
  if 90 - 90: Oo - IiI11Ii111 + Iii1i . i1
  if 7 - 7: OooOoo
  if ( len ( WGControllerCenter . commPID ) == 0 ) :
   return o0ooO0O00
  if ( not ( wgpkt . reservedA in WGControllerCenter . commPID ) ) :
   return o0ooO0O00
  i1ooo0oOo0Oo0 = WGPCinfo ( data )
  if 14 - 14: Ooo0Ooo * I1Ii1I1 / i1i1i1111I
  iiIiI = struct . unpack_from ( "I" , data , 60 ) [ 0 ]
  if wgpkt . functionID == 0x20 :
   o0ooooO0O0OOo = 0
   O0 = struct . unpack_from ( "I" , data , 56 ) [ 0 ]
   O0000000 = struct . unpack_from ( "I" , data , 52 ) [ 0 ]
   iIii11I1i = struct . unpack_from ( "I" , data , 48 ) [ 0 ]
   oOOOO = struct . unpack_from ( "I" , data , 36 ) [ 0 ]
   if ( ( O0 == O0000000 ) and ( iIii11I1i == ( ( O0 * wgpkt . reservedA ) & 0x7fffffff ) ) and (
 iiIiI <= O0 + 5 * 50 and iiIiI > O0 ) ) :
    OOO0 = time . time ( )
    if ( abs ( oOOOO - OOO0 ) < 10 * 60 ) :
     if ( abs ( ( i1ooo0oOo0Oo0 . ctickOfPC + oOOOO * 50 ) - (
 O0 + ( i1ooo0oOo0Oo0 . pcUTC * 50 ) ) ) < 3 * 50 ) :
      if ( O0 > i1ooo0oOo0Oo0 . ctickOfPC ) :
       o0ooooO0O0OOo = 1
     else :
      o0ooooO0O0OOo = 1
   if o0ooooO0O0OOo > 0 :
    i1ooo0oOo0Oo0 . ctickOfPC = O0
    i1ooo0oOo0Oo0 . refreshTimeFrom1970ofctickOfPC = time . time ( )
    i1ooo0oOo0Oo0 . pcUTC = oOOOO
    self . dictPC [ wgpkt . reservedA ] = i1ooo0oOo0Oo0
    return o0ooO0O00
  i1ooo0oOo0Oo0 = self . dictPC . get ( wgpkt . reservedA )
  if i1ooo0oOo0Oo0 is None :
   o0ooO0O00 = 0
  else :
   i1ooo0oOo0Oo0 = self . dictPC [ wgpkt . reservedA ]
   OoOO0oO0O = time . time ( ) - i1ooo0oOo0Oo0 . refreshTimeFrom1970ofctickOfPC
   OoOO0oO0O = i1ooo0oOo0Oo0 . ctickOfPC + int (
 ( OoOO0oO0O ) * 50 )
   O0 = OoOO0oO0O
   if 25 - 25: oOO + Ii . Ii + Ii . i1i1i1111I + ooOOO
   if 43 - 43: ooo000 % I1Ii1I1 + i1I / Oo - i1iiIII111 / OooOoo
   if 97 - 97: iI1iII1I1I1i - Oo * I11iiIi11i1I % i1I / IIiIIiIi11I1
   if 85 - 85: i1iiIII111 + IIiIIiIi11I1 * i1i1i1111I / ooOOO
   if ( iiIiI + 50 >= OoOO0oO0O and iiIiI <= (
 OoOO0oO0O + 5 * 50 + 50 ) ) :
    pass
   else :
    o0ooO0O00 = 0
  return o0ooO0O00
  if 99 - 99: i1i1i1111I * oOO + i1
  if 85 - 85: I1I * i1i1i1111I * IIiIIiIi11I1 . I1I . I1I . iI1iII1I1I1i
  if 50 - 50: Oo - i1iiIII111
  if 27 - 27: I11iiIi11i1I % oOo0O00 + iI1iII1I1I1i * OooOoo * I11iiIi11i1I
  if 14 - 14: IiIIii11Ii / ooo000
  if 58 - 58: I1I % I1I - ooOOO . I1Ii1I1 - oOo0O00
  if 74 - 74: OooOoo . Oo - Oo * Iii1i / I1Ii1I1 - ooOOO
  if 4 - 4: I11iiIi11i1I * IiIIii11Ii - Oo + oOO
  if 11 - 11: I1I - ooo000 / I11iiIi11i1I
  if 56 - 56: Ii + ooOOO - Oo + ooo000 . Ooo0Ooo
  if 25 - 25: ooo000 / IiI11Ii111 / ooOOO
  if 68 - 68: I11iiIi11i1I - Oo - Ii * i1 * Oo
  if 29 - 29: Ii
  if 5 - 5: i1 + oOO . ooOOO . IiI11Ii111 / ooo000
  if 51 - 51: i1 . ooOOO * I1I - I1Ii1I1
  if 27 - 27: oOo0O00 * IiI11Ii111 * oOo0O00
  if 94 - 94: Oo
  if 24 - 24: IiI11Ii111 * oOo0O00 - i1 * i1iiIII111 / i1i1i1111I
  if 22 - 22: iI1iII1I1I1i + OooOoo
  if 2 - 2: Ooo0Ooo - Iii1i + ooOOO / I1Ii1I1 . Iii1i * IiI11Ii111
cp = configparser . ConfigParser ( allow_no_value = True )
cp . read ( wgGlobal . wgcloudpath1001configfileName , encoding = "utf-8-sig" )
if ( cp . has_section ( 'wgconf' ) ) :
 config = cp . items ( "wgconf" )
 if 46 - 46: Iii1i % i1 - Oo - Ii
 if ( cp . has_option ( 'wgconf' , 'cloudserverIP' ) ) :
  wgGlobal . dataserverIP = cp [ 'wgconf' ] [ 'cloudserverIP' ]
 if ( cp . has_option ( 'wgconf' , 'cloudserverPort' ) ) :
  wgGlobal . dataserverPort = int ( cp [ 'wgconf' ] [ 'cloudserverPort' ] )
  if 3 - 3: oOo0O00 * I11iiIi11i1I / I1Ii1I1 % Oo / Oo
  if 39 - 39: iI1iII1I1I1i + IiIIii11Ii - ooOOO % IIiIIiIi11I1 * IiIIii11Ii + iI1iII1I1I1i
  if 2 - 2: i1iiIII111 + IiI11Ii111 % IIiIIiIi11I1
  if 15 - 15: I11iiIi11i1I * Iii1i * OooOoo
  if 53 - 53: OooOoo * IiIIii11Ii
  if 64 - 64: i1
  if 74 - 74: Ooo0Ooo * I1I + i1i1i1111I * ooo000 / Oo * ooOOO
  if 81 - 81: iI1iII1I1I1i % I1Ii1I1 % IiIIii11Ii + ooo000 + Ooo0Ooo % ooOOO
  if 40 - 40: i1I . I11iiIi11i1I
  if 90 - 90: Oo % iI1iII1I1I1i - i1I
  if 45 - 45: Iii1i . OooOoo - iI1iII1I1I1i
  if 88 - 88: oOo0O00 % IiI11Ii111
  if 72 - 72: oOo0O00 / oOo0O00 - oOo0O00 . iI1iII1I1I1i . I1I . oOo0O00
 if ( cp . has_option ( 'wgconf' , 'testModeAllowAutoRemoteOpenDoor' ) ) :
  if 76 - 76: Ii
  WGControllerCenter . setTestMode ( int ( cp [ 'wgconf' ] [ 'testModeAllowAutoRemoteOpenDoor' ] ) )
  if ( int ( cp [ 'wgconf' ] [ 'testModeAllowAutoRemoteOpenDoor' ] ) > 0 ) :
   wgAppConfig . logprint (
 "当前服务处于测试模式:  刷任意卡 远程开门...\r\n[可以通过修改 wgconfig.ini 文件中的 testModeAllowAutoRemoteOpenDoor =0 来关闭测试模式]" )
 if ( cp . has_option ( 'wgconf' , 'testModeDebugPrint' ) ) :
  wgGlobal . testModeDebugPrint = int ( cp [ 'wgconf' ] [ 'testModeDebugPrint' ] )
  if 63 - 63: Ooo0Ooo . Iii1i + Ii
 if ( cp . has_option ( 'wgconf' , 'commPID' ) ) :
  if 33 - 33: oOo0O00 + I11iiIi11i1I
  WGControllerCenter . setCommPID ( ( cp [ 'wgconf' ] [ 'commPID' ] ) )
  if 86 - 86: i1i1i1111I / ooOOO * I1I / i1I - i1i1i1111I
 if ( cp . has_option ( 'wgconf' , 'commSM4' ) ) :
  if 38 - 38: IIiIIiIi11I1 . IiIIii11Ii
  WGControllerCenter . setCommSM4 ( cp [ 'wgconf' ] [ 'commSM4' ] )
  if __name__ == "__main__" :
   wgAppConfig . logprint ( "当前服务 启用了通信加密...\r\n[可以通过修改 wgconfig.ini 文件中的 commSM4 =0 来关闭]" )
 if ( cp . has_option ( 'wgconf' , 'allowpcip' ) ) :
  if 32 - 32: ooo000 * ooo000 - ooOOO . IiI11Ii111 + I1Ii1I1 + i1I
  wgGlobal . allowpcip = ( cp [ 'wgconf' ] [ 'allowpcip' ] )
 if ( cp . has_option ( 'wgconf' , 'logModeFileQR' ) ) :
  WGControllerCenter . logModeFileQR = ( int ( cp [ 'wgconf' ] [ 'logModeFileQR' ] ) )
  if not wgAppConfig . wgrecordlogEnable :
   wgAppConfig . wgrecordlogEnable = WGControllerCenter . logModeFileQR != 0
 if ( cp . has_option ( 'wgconf' , 'logModeFileSwipe' ) ) :
  WGControllerCenter . logModeFileSwipe = ( int ( cp [ 'wgconf' ] [ 'logModeFileSwipe' ] ) )
  if not wgAppConfig . wgrecordlogEnable :
   wgAppConfig . wgrecordlogEnable = WGControllerCenter . logModeFileSwipe != 0
 if ( cp . has_option ( 'wgconf' , 'logModeHourToClear' ) ) :
  WGControllerCenter . logModeHourToClear = ( int ( cp [ 'wgconf' ] [ 'logModeHourToClear' ] ) )
 if ( cp . has_option ( 'wgconf' , 'logModeWeekToClear' ) ) :
  WGControllerCenter . logModeWeekToClear = ( int ( cp [ 'wgconf' ] [ 'logModeWeekToClear' ] ) )
  if 56 - 56: i1I + I1I / OooOoo + oOO - oOo0O00 / oOo0O00
  if 11 - 11: iI1iII1I1I1i % I1Ii1I1 % ooo000
  if 56 - 56: OooOoo
  if 68 - 68: i1iiIII111 * IiIIii11Ii % IiIIii11Ii - Ooo0Ooo
  if 60 - 60: iI1iII1I1I1i - oOO . Ooo0Ooo . i1i1i1111I
  if 97 - 97: oOo0O00 % i1
  if 75 - 75: OooOoo + oOO % oOo0O00 % ooo000 . OooOoo
  if 52 - 52: iI1iII1I1I1i . iI1iII1I1I1i % i1i1i1111I . ooOOO . Oo * i1iiIII111
  if 77 - 77: oOo0O00
  if 73 - 73: i1iiIII111 * Oo . i1I * I11iiIi11i1I
  if 95 - 95: I1I . OooOoo % IIiIIiIi11I1 % i1 / OooOoo * oOo0O00
  if 81 - 81: Iii1i * IiI11Ii111 - I1I
  if 15 - 15: Iii1i
  if 20 - 20: I11iiIi11i1I . i1 . Oo / Iii1i - I11iiIi11i1I
  if 57 - 57: Oo . ooo000 + I1Ii1I1 - i1
  if 70 - 70: iI1iII1I1I1i % IiI11Ii111 * Oo
  if 56 - 56: Iii1i * I1Ii1I1
  if 19 - 19: i1 * I11iiIi11i1I / oOO * IIiIIiIi11I1 / oOo0O00 - oOo0O00
  if 86 - 86: i1I
  if 64 - 64: ooOOO * ooo000 - Oo
  if 60 - 60: OooOoo - oOo0O00 . Oo - i1I
  if 50 - 50: i1I
  if 39 - 39: IiI11Ii111
  if 57 - 57: IiIIii11Ii
  if 18 - 18: iI1iII1I1I1i * Iii1i + IiIIii11Ii / I11iiIi11i1I
  if 65 - 65: I11iiIi11i1I + ooo000
  if 66 - 66: I1Ii1I1
  if 84 - 84: i1I + i1iiIII111
  if 59 - 59: ooOOO / oOo0O00 * i1i1i1111I - IIiIIiIi11I1 * IIiIIiIi11I1 - IiI11Ii111
  if 85 - 85: I11iiIi11i1I % I11iiIi11i1I
  if 34 - 34: i1iiIII111 * i1I
root_loggerUDP = logging . getLogger ( "wglogUDP" )
root_loggerUDP . setLevel ( logging . INFO )
if 75 - 75: IiI11Ii111 % i1i1i1111I - Ii
if wgAppConfig . wgrecordlogEnable :
 if 4 - 4: i1 / Oo . IIiIIiIi11I1 - i1 + i1 * Oo
 handler = logging . FileHandler ( wgGlobal . wgcloudpath1001wgrecord_logName , 'a' , 'utf-8' )
 formatter = logging . Formatter ( '%(asctime)s:%(message)s' )
 handler . setFormatter ( formatter )
 root_loggerUDP . addHandler ( handler )
 if 23 - 23: Ooo0Ooo - Ii . ooOOO % Ii . i1i1i1111I * iI1iII1I1I1i
 if 98 - 98: Iii1i % i1iiIII111 / Oo
 if 90 - 90: OooOoo - i1I * I1I % I1I
if __name__ == "__main__" :
 if 33 - 33: oOo0O00 - I1I / I1Ii1I1 * Ooo0Ooo
 if 68 - 68: i1I . Iii1i
 if ( len ( sys . argv ) == 2 ) :
  wgGlobal . dataserverIP = sys . argv [ 1 ]
  if 81 - 81: I1I . OooOoo . IiIIii11Ii . i1I - i1i1i1111I % i1iiIII111
 if ( len ( sys . argv ) == 3 ) :
  wgGlobal . dataserverIP = sys . argv [ 1 ]
  wgGlobal . dataserverPort = int ( sys . argv [ 2 ] )
  if 24 - 24: I11iiIi11i1I * I1I - i1I / I11iiIi11i1I - IiIIii11Ii + IiI11Ii111
 if ( len ( wgGlobal . dataserverIP ) < 1 ) :
  wgAppConfig . logprint ( "??? wgconfig.ini , configuration..." )
  input ( "Press Enter exit..." )
  sys . exit ( 0 )
  if 72 - 72: iI1iII1I1I1i . Ooo0Ooo
  if 81 - 81: i1I . OooOoo . oOo0O00 % Oo
  if 16 - 16: Ii / oOO % Iii1i + i1
  if 38 - 38: IiIIii11Ii - I1Ii1I1 . oOo0O00
  if 10 - 10: i1 % IiI11Ii111 % oOo0O00 % IiI11Ii111 - Ii
  if 70 - 70: i1I . ooOOO - Iii1i * i1iiIII111 . ooOOO - I1I
 wgAppConfig . logprint ( "wgconfig.ini Configuration[UTF-8]..." )
 if 43 - 43: OooOoo
 if 27 - 27: i1iiIII111 * Ii * IIiIIiIi11I1 / i1I . IiI11Ii111
 if 90 - 90: IiIIii11Ii
 if 10 - 10: IiI11Ii111 % oOO . OooOoo - ooOOO
 if 93 - 93: Oo
 if 5 - 5: i1 % IiIIii11Ii * IIiIIiIi11I1 - oOo0O00
 wgAppConfig . logprint (
 "V2.0 2021-02-04 引入支持SM4 start wg cloud server 启动云服务 IP信息: [{0:s}.{1:d}  udp]" . format (
 wgGlobal . dataserverIP ,
 wgGlobal . dataserverPort ) )
 if 30 - 30: Ii
 if 4 - 4: IiI11Ii111 % ooo000
 portSocket = socket . socket ( socket . AF_INET , socket . SOCK_DGRAM )
 if 88 - 88: Iii1i * IIiIIiIi11I1 % ooo000 . OooOoo - Ooo0Ooo - oOO
 if 18 - 18: iI1iII1I1I1i
 portSocket . setblocking ( False )
 try :
  portSocket . bind ( ( wgGlobal . dataserverIP , wgGlobal . dataserverPort ) )
 except Exception as e :
  pass
  if 16 - 16: IiIIii11Ii + i1iiIII111 / Ii - i1 / i1i1i1111I
  wgAppConfig . logprint ( "{0}: {1} {2} {3}\r\n" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , wgGlobal . dataserverIP ,
 wgGlobal . dataserverPort , e ) )
  wgAppConfig . logprint ( "wgconfig.ini..." )
  input ( "Press Enter exit..." )
  sys . exit ( 0 )
  if 76 - 76: i1
  if 53 - 53: i1I % Iii1i . i1 * i1i1i1111I . OooOoo . iI1iII1I1I1i
 port = reactor . adoptDatagramPort (
 portSocket . fileno ( ) , socket . AF_INET , WGControllerCenter ( ) )
 if 24 - 24: i1iiIII111 . IiI11Ii111 + i1
 if 38 - 38: ooo000 % IIiIIiIi11I1
 portSocket . close ( )
 reactor . run ( )
# dd678faae9ac167bc83abf78e5cb2f3f0688d3a3
