# cython:language_level=3
import binascii
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 datetime
import struct
import time
if 10 - 10: ooOOO / IIiIIiIi11I1 * oOO / i1I / i1I
if 61 - 61: Ooo0Ooo - I1I
if 13 - 13: Ooo0Ooo
CMDTYPE_37 = 0x37
if 46 - 46: iI1iII1I1I1i - Ii * Oo * Ii
if 52 - 52: Oo + I1I / oOO / OooOoo - I1Ii1I1 - ooOOO
if 60 - 60: iI1iII1I1I1i . oOO
if 13 - 13: oOO
if 2 - 2: i1
if 22 - 22: IIiIIiIi11I1 - ooo000 / I1Ii1I1 . ooo000
if 1 - 1: iI1iII1I1I1i + Ooo0Ooo + oOO * IIiIIiIi11I1
if 20 - 20: I1I + Ii
if 75 - 75: Ii % i1iiIII111 * Ii . IIiIIiIi11I1 % I11iiIi11i1I % I1Ii1I1
class wgGlobal ( object ) :
 if 8 - 8: I1Ii1I1 . IiI11Ii111 . i1 . Oo - i1I
 commTimeout10ms = 300
 allowpcip = None
 if 32 - 32: Ii % i1i1i1111I % i1I - I11iiIi11i1I % i1iiIII111
 dataserverIP = "0.0.0.0"
 dataserverPort = 61005
 webServerPort = 61080
 mqttHostName = "127.0.0.1"
 mqttHostPort = 1883
 if 34 - 34: i1iiIII111 * i1
 softwareVersion = "2.33 (2021-04-24)"
 debugWEBAPI = 0
 if 34 - 34: oOo0O00 / i1iiIII111 - Iii1i . iI1iII1I1I1i
 startuptime = time . strftime ( '%Y-%m-%d %H:%M:%S' )
 if 80 - 80: i1i1i1111I . I1I % ooOOO % IiIIii11Ii / i1i1i1111I
 if 32 - 32: I1Ii1I1 + oOO - oOo0O00
 testModeDebugPrint = 0
 if 79 - 79: Iii1i % oOO * Oo + ooOOO / Oo . oOO
 if 20 - 20: IiI11Ii111 + i1iiIII111 / I1I
 allowprint = False
 if 88 - 88: I11iiIi11i1I + ooOOO - i1i1i1111I . Ooo0Ooo * Ii + Iii1i
 if 43 - 43: ooOOO * I1Ii1I1
 AllowMonitorInfowgroot_logger = True
 if 95 - 95: Ooo0Ooo % Iii1i % i1i1i1111I . OooOoo
 printSupportChinese = True
 if 70 - 70: IiIIii11Ii
 visitorDB = None
 visitorDBIsEnabled = False
 visitorDBConfigOnlyOnce = 0
 wgrsapublic = 22871457225969557235584174218332656045678182459897609307745842473314123895198891616514982229258958114930227577808068643343126876590333725408602946921142338872615410057094778127168154265050535793101505790949185223848103518871042435304793982341528258861825154302640534167051753659436658258538346804965885562595065744614657043508978381518404396475316386322630173527215895786133970871347294056259930156520763343376919658671958183071382237970572580592506504602395063783710908998778330299961532114077710298221454958523534518584757281565334255967764133938834418783429819017167765643315475133137318627526237345753971520423753
 if 75 - 75: Ooo0Ooo / Ii / IiIIii11Ii + IiIIii11Ii . I1I
 cmdWithResponseLocbyte8 = [ 0x40 ,
 0x50 ,
 0x52 ,
 0x54 ,
 0x56 ,
 0xB2 ,
 0
 ]
 whitelist = None
 controllersWhiteList = None
 if 88 - 88: Oo * IiIIii11Ii
 supportNXP4G = 0
 bNeedAutoAdjustTime = 0
 syncCycle = 26
 supportSendSyncInfo2025 = 0
 if 100 - 100: IiI11Ii111 - OooOoo * I1Ii1I1 / Ooo0Ooo / Iii1i
 if 23 - 23: Ooo0Ooo + i1 * I1Ii1I1 + Oo * Ii - IIiIIiIi11I1
 print200Records = 1
 print200RecordsCount = 0
 print200RecordsMax = 200
 if 29 - 29: IiIIii11Ii - oOo0O00
 wgcloudpathdir = ""
 wgcloudpath1001configfileName = "wgconfig.ini"
 wgcloudpath1001wg_logName = "wg_log.log"
 if 30 - 30: I1I . ooo000
 wgcloudpath1001wgrecord_logName = "wgrecord.log"
 wgcloudpath1001wgrecordtcp_logName = "wgrecordtcp.log"
 wgcloudpath1001wgchs_logName = "wgchs_log.log"
 if 43 - 43: ooOOO . I11iiIi11i1I + ooo000
 wglogmaxBytes = 30 * 1024 * 1024
 if 87 - 87: Iii1i + ooOOO . i1I / Ii + Oo
 @ staticmethod
 def checkwhitelist ( ipstr ) :
  if wgGlobal . whitelist is None :
   return True
  if ipstr in wgGlobal . whitelist :
   return True
  return False
  if 77 - 77: i1iiIII111 + IiI11Ii111 - Oo % ooo000
 @ staticmethod
 def printWatchingInfo ( info ) :
  if info is not None :
   if wgGlobal . print200Records > 0 :
    try :
     if wgGlobal . print200RecordsMax > wgGlobal . print200RecordsCount :
      if 74 - 74: Ii + Ooo0Ooo
      print ( info )
      wgGlobal . print200RecordsCount += 1
     else :
      print (
 "200 records have been displayed. If you wish to display more, please restart or enable debug mode (set testModeDebugPrint=1 in wgconfig.ini)" )
      wgGlobal . print200Records = 0
    except Exception as iIi1I1I :
     pass
     if 85 - 85: oOo0O00
    finally :
     pass
     if 65 - 65: Ooo0Ooo * ooo000 + oOo0O00
 @ staticmethod
 def checkconstrollersWhitelist ( controllerSN ) :
  if wgGlobal . controllersWhiteList is None :
   return True
  if controllerSN in wgGlobal . controllersWhiteList :
   return True
  return False
  if 71 - 71: Ooo0Ooo / ooo000
 @ staticmethod
 def IsElevator ( sn ) :
  return 176 * 10 ** 6 > sn > 170 * 10 ** 6
  if 87 - 87: IiI11Ii111 / oOo0O00 % oOO - oOo0O00 . I1I + Ooo0Ooo
class WGPacket ( object ) :
 cmdtype = 0
 functionID = 0
 reservedA = 0
 controllerSN = 0
 ipport = None
 sid = 0
 commandData = None
 if 75 - 75: i1iiIII111 * iI1iII1I1I1i - I1I - IIiIIiIi11I1 % I1Ii1I1
 def isValidSN ( self ) :
  I111Iii1Ii = self . controllerSN
  ii = True
  if 32 - 32: i1i1i1111I % Ooo0Ooo - i1I * I1I
  if 92 - 92: IIiIIiIi11I1 - i1 - Iii1i / Ooo0Ooo . I1Ii1I1 / I11iiIi11i1I
  if 60 - 60: oOO
  if 32 - 32: iI1iII1I1I1i
  if 18 - 18: I11iiIi11i1I * IiI11Ii111 % iI1iII1I1I1i + IiI11Ii111
  if 93 - 93: oOO - I1Ii1I1 - IIiIIiIi11I1 * ooOOO - i1
  if I111Iii1Ii in [ 0x7eeeeeee , 0x7eeeeeec , 999999901 , 999999902 ] :
   pass
  elif ( I111Iii1Ii < 100000000 ) or ( I111Iii1Ii > 500000000 ) :
   ii = False
  elif ( I111Iii1Ii >= 300000000 ) and ( I111Iii1Ii < 400000000 ) :
   ii = False
  elif ( I111Iii1Ii >= 160000000 ) and ( I111Iii1Ii <= 160999999 ) :
   if 82 - 82: IIiIIiIi11I1 % i1 * ooOOO
   pass
  elif ( I111Iii1Ii >= 170000000 ) and ( I111Iii1Ii <= 179999999 ) :
   pass
   if 57 - 57: oOo0O00
   if 31 - 31: i1iiIII111 + i1i1i1111I % OooOoo
   if 20 - 20: OooOoo - I1I
   if 9 - 9: i1iiIII111 - iI1iII1I1I1i % Ii - I1I
  return ii
  if 54 - 54: Iii1i % ooo000 % Iii1i - IiIIii11Ii
 def __init__ ( self , data , addr ) :
  if len ( data ) >= 64 and ( ( len ( data ) % 64 ) == 0 ) :
   self . ipport = addr
   self . commandData = data
   if 39 - 39: oOO - oOO * i1 % IIiIIiIi11I1
   IIiII11I = struct . Struct ( "<BBhI32BL20B" )
   if len ( data ) > 64 :
    I11i = "<BBhI32BL20B{0:d}B" . format ( len ( data ) - 64 )
    IIiII11I = struct . Struct ( I11i )
   o0O = IIiII11I . unpack ( data )
   self . cmdtype = o0O [ 0 ]
   self . functionID = o0O [ 1 ]
   self . reservedA = o0O [ 2 ]
   self . controllerSN = o0O [ 3 ]
   if 18 - 18: Ii / ooo000 + I1I + iI1iII1I1I1i
   self . sid = o0O [ 32 + 4 ]
   if 42 - 42: ooOOO - ooOOO - i1i1i1111I
   if 61 - 61: oOO
   if 7 - 7: i1i1i1111I / Ii * Iii1i
   if 32 - 32: IiI11Ii111 . OooOoo
   if 31 - 31: Oo - i1I
class WGControllerinfo ( WGPacket ) :
 if 28 - 28: ooOOO * I1Ii1I1 + IiI11Ii111 % Oo
 if 100 - 100: Oo + i1I
 if 4 - 4: ooo000 % I1I - i1i1i1111I
 if 76 - 76: i1 * oOo0O00 . IiI11Ii111 * i1I . IiIIii11Ii . oOO
 if 55 - 55: i1i1i1111I + i1iiIII111 % Ooo0Ooo . Oo - IiIIii11Ii - iI1iII1I1I1i
 if 91 - 91: I1Ii1I1 - I11iiIi11i1I
 if 84 - 84: oOO % iI1iII1I1I1i - Ooo0Ooo
 if 94 - 94: i1iiIII111 + i1i1i1111I / iI1iII1I1I1i + iI1iII1I1I1i / i1I
 def __init__ ( self , data , addr ) :
  super ( ) . __init__ ( data , addr )
  if 79 - 79: i1iiIII111 - IIiIIiIi11I1 . I1Ii1I1 + I1I - ooOOO + i1iiIII111
  self . refreshTimeFrom1970 = time . time ( )
  self . timeOfCon = None
  self . recordIndex = 0
  self . recordType = 0
  self . recordDoorNO = 0
  self . recordData = None
  self . ctickOfCon = 0
  if 36 - 36: ooOOO * Iii1i % I1I % i1 . Ooo0Ooo
  self . refreshTimeFrom1970ofctickOfCon = int (
 datetime . datetime . now ( ) . timestamp ( ) )
  self . doorstatus = ( - 1 , - 1 , - 1 , - 1 )
  self . timestampOfCon = 0
  if 63 - 63: IIiIIiIi11I1 / IIiIIiIi11I1 * Iii1i - oOo0O00 . i1
  if 52 - 52: oOo0O00 / i1I * IIiIIiIi11I1 + I11iiIi11i1I % Ooo0Ooo + oOO
  self . appError = data [ 36 ]
  self . warndoor = (
 ( ( data [ 49 ] >> 4 ) & 1 ) , ( ( data [ 49 ] >> 5 ) & 1 ) , ( ( data [ 49 ] >> 6 ) & 1 ) ,
 ( ( data [ 49 ] >> 7 ) & 1 ) )
  self . forceClosedWarn = ( ( data [ 50 ] >> 0 ) & 1 )
  self . fireWarn = ( ( data [ 50 ] >> 1 ) & 1 )
  I11i = "20{0:0>2X}-{1:0>2X}-{2:0>2X} {3:0>2X}:{4:0>2X}:{5:0>2X}" . format ( data [ 51 ] , data [ 52 ] , data [ 53 ] ,
 data [ 37 ] , data [ 38 ] , data [ 39 ] )
  try :
   self . timeOfCon = datetime . datetime . strptime ( I11i , "%Y-%m-%d %H:%M:%S" )
   self . timestampOfCon = int ( self . timeOfCon . timestamp ( ) )
  except Exception as iIi1I1I :
   pass
   self . timeOfCon = datetime . datetime . strptime ( "2000-01-19 19:19:19" ,
 "%Y-%m-%d %H:%M:%S" )
  self . recordIndex = struct . unpack_from ( "I" , data , 8 ) [ 0 ]
  self . recordType = data [ 12 ]
  self . recordDoorNO = data [ 14 ]
  self . doorstatus = ( data [ 28 ] , data [ 29 ] , data [ 30 ] , data [ 31 ] )
  if 43 - 43: iI1iII1I1I1i * oOo0O00 + ooOOO
  self . commByWIFI = ( ( data [ 50 ] >> 6 ) & 1 )
  self . commBy4G = ( ( data [ 50 ] >> 5 ) & 1 )
  if 30 - 30: I1I
  if self . functionID == 0x20 :
   if self . recordIndex > 0 :
    self . recordData = WGSwipeRecord ( data )
  if self . functionID == 0x22 :
   self . commByWIFI = 0
   self . commBy4G = 0
   pass
  if self . functionID == 0x26 :
   self . ctickOfCon = struct . unpack_from ( "I" , data , 188 ) [ 0 ]
   if self . recordIndex > 0 :
    self . recordData = WGSwipeRecord ( data )
    if 41 - 41: oOO
 def get5Swipe ( self , startIndex ) :
  i1II1 = self . commandData
  if 76 - 76: oOo0O00 % I1I . i1 + 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
  if 81 - 81: OooOoo . i1I / i1i1i1111I + Oo / Ooo0Ooo % IiI11Ii111
  if 77 - 77: I11iiIi11i1I / iI1iII1I1I1i - oOo0O00 - Ooo0Ooo % oOo0O00
  i1iI1 = struct . unpack_from ( "I" , i1II1 , 8 ) [ 0 ]
  for ii1ii in range ( 1 , 6 ) :
   if ( i1iI1 - ( 5 - ii1ii + 1 ) ) >= startIndex :
    I11IIiiI1 = 64 + 24 * ( 5 - ii1ii )
    O0o = WGSwipeRecord192 ( self . commandData , I11IIiiI1 , 5 - ii1ii + 1 )
    O0o . getDescription ( )
    if 34 - 34: I1I % Oo - i1 % OooOoo * OooOoo + i1i1i1111I
 def get5SwipeFileLog ( self , startIndex , sn , root_loggerpar ) :
  i1II1 = self . commandData
  if 8 - 8: IiI11Ii111 + i1I
  if 37 - 37: iI1iII1I1I1i . oOo0O00 * ooo000 * ooOOO
  if 65 - 65: iI1iII1I1I1i - IiI11Ii111 . Ooo0Ooo . i1iiIII111 * IiI11Ii111
  if 33 - 33: i1i1i1111I
  if 30 - 30: i1I % ooOOO . Ii % IIiIIiIi11I1 / iI1iII1I1I1i % ooOOO
  if 24 - 24: IIiIIiIi11I1 - IIiIIiIi11I1 . Ooo0Ooo + i1iiIII111 + Oo
  if 21 - 21: IIiIIiIi11I1 - ooo000 + oOO
  i1iI1 = struct . unpack_from ( "I" , i1II1 , 8 ) [ 0 ]
  for ii1ii in range ( 1 , 6 ) :
   if ( i1iI1 - ( 5 - ii1ii + 1 ) ) >= startIndex :
    I11IIiiI1 = 64 + 24 * ( 5 - ii1ii )
    O0o = WGSwipeRecord192 ( self . commandData , I11IIiiI1 , 5 - ii1ii + 1 )
    O0o . getDescriptionFileLog ( sn , root_loggerpar )
    if 5 - 5: i1iiIII111 . i1iiIII111 + ooo000 . I11iiIi11i1I
    if 1 - 1: iI1iII1I1I1i % Ii - I11iiIi11i1I / IiI11Ii111 + iI1iII1I1I1i - Ii
 def get5SwipeJSON ( self , startIndex ) :
  i1II1 = self . commandData
  if 27 - 27: OooOoo % iI1iII1I1I1i + IIiIIiIi11I1
  i1iI1 = struct . unpack_from ( "I" , i1II1 , 8 ) [ 0 ]
  if 16 - 16: IiI11Ii111
  if 31 - 31: oOo0O00 / Iii1i % Ooo0Ooo % i1 . iI1iII1I1I1i . Oo
  II11IIIIiI1iI = None
  try :
   if self . recordData is not None :
    II11IIIIiI1iI = [ self . recordData . getDescriptionJSON ( ) ]
    if len ( i1II1 ) == 192 :
     for ii1ii in ( 5 , 4 , 3 , 2 , 1 ) :
      if ( i1iI1 - ( 5 - ii1ii + 1 ) ) >= startIndex :
       I11IIiiI1 = 64 + 24 * ( 5 - ii1ii )
       O0o = WGSwipeRecord192 ( self . commandData , I11IIiiI1 , 5 - ii1ii + 1 )
       II11IIIIiI1iI . append ( O0o . getDescriptionJSON ( ) )
  except Exception as iIi1I1I :
   pass
   print ( "get5SwipeJSON 1201: " )
   print ( iIi1I1I )
  return II11IIIIiI1iI
  if 25 - 25: OooOoo % ooOOO . i1iiIII111 - ooOOO % Iii1i
  if 37 - 37: i1I + IIiIIiIi11I1 % iI1iII1I1I1i / IIiIIiIi11I1 % i1iiIII111 + oOO
 def getNewSwipeJSON ( self , startIndex , infolist ) :
  i1II1 = self . commandData
  if 98 - 98: iI1iII1I1I1i - I1I + i1 * ooo000 % i1
  i1iI1 = struct . unpack_from ( "I" , i1II1 , 8 ) [ 0 ]
  o0O0OO0 = None
  if len ( i1II1 ) == 192 :
   for ii1ii in ( 1 , 2 , 3 , 4 , 5 ) :
    if ( i1iI1 - ( 5 - ii1ii + 1 ) ) > startIndex :
     I11IIiiI1 = 64 + 24 * ( 5 - ii1ii )
     O0o = WGSwipeRecord192 ( self . commandData , I11IIiiI1 , 5 - ii1ii + 1 )
     Iioo0Oo0oO0 = O0o . getDescriptionJSONWithSN (
 self . controllerSN )
     try :
      if o0O0OO0 is not None :
       if Iioo0Oo0oO0 [ 'Time' ] == o0O0OO0 [ 'Time' ] and Iioo0Oo0oO0 [ 'DoorNO' ] == o0O0OO0 [ 'DoorNO' ] and Iioo0Oo0oO0 [ 'InExit' ] == o0O0OO0 [ 'InExit' ] :
        if 20 - 20: IIiIIiIi11I1
        if 34 - 34: ooo000 % i1i1i1111I * i1iiIII111
        if 'IDCardName' in Iioo0Oo0oO0 . keys ( ) :
         O0O0o0oo00Oo = str ( o0O0OO0 [ 'CardNO' ] )
         if len ( O0O0o0oo00Oo ) < 18 :
          O0O0o0oo00Oo = O0O0o0oo00Oo + "X"
         if len ( infolist ) > 0 :
          infolist [ len ( infolist ) - 1 ] [ "IDCardNumber" ] = O0O0o0oo00Oo
          infolist [ len ( infolist ) - 1 ] [ 'Name' ] = Iioo0Oo0oO0 [ 'IDCardName' ]
        elif 'IDCardName' in o0O0OO0 . keys ( ) :
         O0O0o0oo00Oo = str ( Iioo0Oo0oO0 [ 'CardNO' ] )
         if len ( O0O0o0oo00Oo ) < 18 :
          O0O0o0oo00Oo = O0O0o0oo00Oo + "X"
         Iioo0Oo0oO0 [ "IDCardNumber" ] = O0O0o0oo00Oo
         Iioo0Oo0oO0 [ 'Name' ] = o0O0OO0 [ 'IDCardName' ]
     except Exception as iIi1I1I :
      pass
      pass
     o0O0OO0 = Iioo0Oo0oO0
     infolist . append ( Iioo0Oo0oO0 )
   if o0O0OO0 is None and i1iI1 > 2 :
    ii1ii = 5
    if 96 - 96: Ooo0Ooo
    I11IIiiI1 = 64 + 24 * ( 5 - ii1ii )
    O0o = WGSwipeRecord192 ( self . commandData , I11IIiiI1 , 5 - ii1ii + 1 )
    o0O0OO0 = O0o . getDescriptionJSONWithSN ( self . controllerSN )
  if i1iI1 > startIndex :
   if self . recordData is not None :
    Iioo0Oo0oO0 = self . recordData . getDescriptionJSONWithSN ( self . controllerSN )
    try :
     if o0O0OO0 is not None :
      if Iioo0Oo0oO0 [ 'Time' ] == o0O0OO0 [ 'Time' ] and Iioo0Oo0oO0 [ 'DoorNO' ] == o0O0OO0 [ 'DoorNO' ] and Iioo0Oo0oO0 [ 'InExit' ] == o0O0OO0 [ 'InExit' ] :
       if 13 - 13: Oo * I1Ii1I1 - oOo0O00 * Ii . Ii + oOo0O00
       if 'IDCardName' in Iioo0Oo0oO0 . keys ( ) :
        O0O0o0oo00Oo = str ( o0O0OO0 [ 'CardNO' ] )
        if len ( O0O0o0oo00Oo ) < 18 :
         O0O0o0oo00Oo = O0O0o0oo00Oo + "X"
        if len ( infolist ) > 0 :
         infolist [ len ( infolist ) - 1 ] [ "IDCardNumber" ] = O0O0o0oo00Oo
         infolist [ len ( infolist ) - 1 ] [ 'Name' ] = Iioo0Oo0oO0 [ 'IDCardName' ]
       elif 'IDCardName' in o0O0OO0 . keys ( ) :
        O0O0o0oo00Oo = str ( Iioo0Oo0oO0 [ 'CardNO' ] )
        if len ( O0O0o0oo00Oo ) < 18 :
         O0O0o0oo00Oo = O0O0o0oo00Oo + "X"
        Iioo0Oo0oO0 [ "IDCardNumber" ] = O0O0o0oo00Oo
        Iioo0Oo0oO0 [ 'Name' ] = o0O0OO0 [ 'IDCardName' ]
    except Exception as iIi1I1I :
     pass
     pass
     if 46 - 46: OooOoo - I11iiIi11i1I / Ooo0Ooo
    infolist . append ( Iioo0Oo0oO0 )
    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
    if 72 - 72: i1 % i1i1i1111I * iI1iII1I1I1i
    if 90 - 90: Ooo0Ooo * OooOoo . Ii
 def get5Swipe200Records ( self , startIndex , sn ) :
  i1II1 = self . commandData
  I11IIiiI1 = 64
  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
  i1iI1 = struct . unpack_from ( "I" , i1II1 , 8 ) [ 0 ]
  for ii1ii in range ( 1 , 6 ) :
   if ( i1iI1 - ( 5 - ii1ii + 1 ) ) >= startIndex :
    I11IIiiI1 = 64 + 24 * ( 5 - ii1ii )
    O0o = WGSwipeRecord192 ( self . commandData , I11IIiiI1 , 5 - ii1ii + 1 )
    O0o . getDescription200Records ( sn )
    if 76 - 76: i1iiIII111 / OooOoo
    if 77 - 77: ooOOO
class WGSwipeRecord ( object ) :
 def __init__ ( self , data ) :
  if 19 - 19: ooOOO % I1Ii1I1
  self . controllerSN = struct . unpack_from ( "I" , data , 4 ) [ 0 ]
  if 15 - 15: OooOoo . IiIIii11Ii . i1I / Iii1i + ooOOO / Ii
  if 17 - 17: I11iiIi11i1I - i1i1i1111I . iI1iII1I1I1i - I11iiIi11i1I + Oo % iI1iII1I1I1i
  if 65 - 65: Ii % I11iiIi11i1I
  self . recordIndex = struct . unpack_from ( "I" , data , 8 ) [ 0 ]
  if 39 - 39: Iii1i * IIiIIiIi11I1 . Ooo0Ooo - Oo
  if 63 - 63: i1i1i1111I - i1iiIII111 . OooOoo % OooOoo . IiI11Ii111 + i1I
  if 71 - 71: ooo000 + I11iiIi11i1I % iI1iII1I1I1i + IiI11Ii111 % Oo - Oo
  if 84 - 84: I1I % iI1iII1I1I1i - Ooo0Ooo / iI1iII1I1I1i + Ooo0Ooo - Oo
  if 41 - 41: ooOOO + OooOoo + IIiIIiIi11I1 * i1i1i1111I
  if 12 - 12: i1i1i1111I
  if 56 - 56: IiIIii11Ii
  if 17 - 17: i1I . oOO % Oo + IiIIii11Ii - Ooo0Ooo
  if 93 - 93: oOo0O00
  if 77 - 77: Oo + I11iiIi11i1I % I1I
  if 20 - 20: i1 - IiIIii11Ii . IiIIii11Ii % ooOOO . i1 % Ooo0Ooo
  if 72 - 72: oOO % IiI11Ii111 . ooOOO * I1Ii1I1 . ooOOO
  self . recordType = data [ 12 ]
  if 90 - 90: IiIIii11Ii + I1Ii1I1 . OooOoo
  if 73 - 73: i1i1i1111I - Iii1i / I11iiIi11i1I . ooo000 / iI1iII1I1I1i - i1iiIII111
  if 21 - 21: i1iiIII111 + IiI11Ii111 % i1i1i1111I
  self . recordValid = data [ 13 ]
  if 7 - 7: IiI11Ii111 / Ii
  if 87 - 87: ooOOO
  if 57 - 57: IIiIIiIi11I1 - iI1iII1I1I1i % ooOOO - I11iiIi11i1I / IiIIii11Ii . Ooo0Ooo
  self . recordDoorNO = data [ 14 ]
  if 15 - 15: i1I * I11iiIi11i1I - oOo0O00
  if 6 - 6: IiI11Ii111 - Ii
  if 1 - 1: I1I + OooOoo
  self . recordInOrOut = data [ 15 ]
  if 98 - 98: i1iiIII111 + Iii1i . IIiIIiIi11I1
  if 96 - 96: OooOoo / oOO - i1 * I11iiIi11i1I
  if 72 - 72: i1i1i1111I + Ii - Iii1i - i1i1i1111I - i1I + Ooo0Ooo
  if 74 - 74: Ooo0Ooo * Oo + Iii1i - i1iiIII111
  if 22 - 22: IiIIii11Ii - Ooo0Ooo . i1 . i1I - ooo000
  if 68 - 68: ooo000
  if 40 - 40: i1 + I1Ii1I1 + I11iiIi11i1I . Oo * I11iiIi11i1I % I1I
  if 100 - 100: OooOoo + Oo / OooOoo
  o0o0 = struct . unpack_from ( "I" , data , 16 ) [ 0 ]
  iII11I11111I = struct . unpack_from ( "I" , data , 44 ) [ 0 ]
  self . recordcurrentval = o0o0 + ( iII11I11111I << 32 )
  if self . recordcurrentval >= 0x8000000000000000 :
   self . recordcurrentval = self . recordcurrentval - 0x10000000000000000
   if 81 - 81: iI1iII1I1I1i / IIiIIiIi11I1 . iI1iII1I1I1i
   if 81 - 81: i1I + IiIIii11Ii . I11iiIi11i1I
   if 10 - 10: iI1iII1I1I1i - Ii . IiIIii11Ii
  I11i = "{0:0>2X}{1:0>2X}-{2:0>2X}-{3:0>2X} {4:0>2X}:{5:0>2X}:{6:0>2X}" . format ( data [ 20 ] , data [ 21 ] , data [ 22 ] ,
 data [ 23 ] , data [ 24 ] , data [ 25 ] ,
 data [ 26 ] )
  if 37 - 37: i1i1i1111I
  try :
   self . recordTime = datetime . datetime . strptime ( I11i , "%Y-%m-%d %H:%M:%S" )
  except Exception as iIi1I1I :
   pass
   self . recordTime = datetime . datetime . strptime ( "2000-01-19 19:19:19" ,
 "%Y-%m-%d %H:%M:%S" )
   if 79 - 79: ooo000 % i1I - Ii % i1I - I1I
   if 42 - 42: I11iiIi11i1I - Ii / Oo - i1i1i1111I + I11iiIi11i1I
   if 83 - 83: i1 . iI1iII1I1I1i
   if 57 - 57: IiI11Ii111 % IiIIii11Ii / oOo0O00 + Ooo0Ooo - i1iiIII111
  self . reason = data [ 27 ]
  self . reason4byte = data [ 56 + 4 : 64 ]
  self . ymdhms = WGTools . getLongByByte ( data , 56 ,
 4 )
  if 87 - 87: i1iiIII111 . i1iiIII111 . oOO . ooo000 * oOo0O00
  if 33 - 33: IiI11Ii111 * i1iiIII111 / i1I . OooOoo * oOo0O00 + ooo000
 def wgLog ( self , data ) :
  if 17 - 17: i1i1i1111I * oOO + i1iiIII111 - I11iiIi11i1I / i1i1i1111I
  pass
  if 83 - 83: I11iiIi11i1I - Iii1i + oOo0O00 + I1I / IIiIIiIi11I1 + I1I
  if 29 - 29: i1i1i1111I / oOo0O00
  if 13 - 13: I11iiIi11i1I % i1iiIII111 . OooOoo % ooo000 % OooOoo
  if 21 - 21: IiI11Ii111 * I1Ii1I1
  if 93 - 93: Ooo0Ooo . i1 + IiI11Ii111 - oOo0O00
 def getReacordFloorDescription ( self ) :
  if 97 - 97: i1 - i1 % IIiIIiIi11I1 + IiIIii11Ii / i1I * iI1iII1I1I1i
  if 60 - 60: I11iiIi11i1I - Ooo0Ooo % I1Ii1I1
  ii1II1 = ""
  try :
   iiiII1 = self . recordDoorNO
   IiI = None
   if self . recordType == 1 :
    if self . recordValid :
     IiI = "Swipe"
    else :
     ii1II1 = getReasonDetailChinese ( self . reason )
     return ii1II1
   if self . recordType == 2 :
    IiI = "RemoteOpenDoor"
   if IiI :
    if self . reason == 44 :
     ooO0OoOo = self . recordcurrentval
     if ooO0OoOo == 90 :
      return "CabinetDoorClosed"
     if ooO0OoOo == 91 :
      return "CabinetDoorNormalOpen"
     if ooO0OoOo == 92 :
      return "CabinetDoorAbnormalOpen"
    if iiiII1 < 128 :
     if iiiII1 < 10 :
      oO = "{0} DirectGo=_{1}Floor" . format ( IiI , iiiII1 )
     else :
      oO = "{0} DirectGo={1}Floor" . format ( IiI , iiiII1 )
    else :
     oO = "{0} Allow More Floors..." . format ( IiI )
    ii1II1 = oO
   else :
    if self . recordType == 3 :
     ii1II1 = getReasonDetailChinese ( self . reason )
  except Exception as IiiI :
   if 61 - 61: IIiIIiIi11I1 / IiI11Ii111 - i1i1i1111I . ooOOO . OooOoo / oOO
   pass
  return ii1II1
  if 94 - 94: Ooo0Ooo % oOo0O00 . oOo0O00 / Ii . i1
  if 54 - 54: iI1iII1I1I1i % Oo . IiI11Ii111 - Iii1i % I11iiIi11i1I * i1I
 def getDescription ( self ) :
  if 31 - 31: oOo0O00 / Iii1i - IiIIii11Ii % i1I / I1Ii1I1 - i1i1i1111I
  if 68 - 68: I11iiIi11i1I . I11iiIi11i1I % I11iiIi11i1I
  if 71 - 71: ooo000
  if 61 - 61: ooo000
  if 48 - 48: Iii1i * i1i1i1111I + IiIIii11Ii
  if 31 - 31: Oo * i1iiIII111 % Ii / oOO + I1Ii1I1 + iI1iII1I1I1i
  if 90 - 90: I1Ii1I1 * i1i1i1111I / iI1iII1I1I1i * Ii
  if 38 - 38: I1I . Ii
  if 41 - 41: ooo000 % IIiIIiIi11I1 % ooOOO
  if 5 - 5: oOo0O00 / Ii + i1iiIII111 * Oo + Ooo0Ooo + ooo000
  OoO0OO0 = ""
  if self . recordType == 0 :
   if 35 - 35: Ooo0Ooo
   if 11 - 11: I1Ii1I1 % oOo0O00 % Oo + i1i1i1111I
   if 42 - 42: oOo0O00 + IiI11Ii111 - Ooo0Ooo * iI1iII1I1I1i / iI1iII1I1I1i + Ii
   self . wgLog ( "Index position={0:d}, Type=No record" . format ( self . recordIndex ) )
   OoO0OO0 = ( "Index position={0:d}, Type=No record" . format ( self . recordIndex ) )
  elif self . recordType == 0xff :
   if 94 - 94: Ooo0Ooo % Ii + i1i1i1111I
   self . wgLog ( "The record at the specified index position has been overwritten. Please use index 0 to retrieve the index value of the earliest record." )
   if 86 - 86: IiIIii11Ii - I1Ii1I1 % OooOoo . iI1iII1I1I1i % OooOoo . i1i1i1111I
  else :
   if wgGlobal . IsElevator ( self . controllerSN ) :
    II1i1i1 = self . getReacordFloorDescription ( )
   else :
    II1i1i1 = getReasonDetailChinese ( self . reason )
   if self . recordType == 1 :
    if 58 - 58: iI1iII1I1I1i + i1I . OooOoo
    if 68 - 68: i1iiIII111 - ooOOO * i1
    if 15 - 15: I1Ii1I1
    if 64 - 64: oOO - ooOOO . iI1iII1I1I1i + IiI11Ii111 / oOo0O00
    if 89 - 89: Oo / i1i1i1111I / I1Ii1I1 - iI1iII1I1I1i
    if 12 - 12: IiIIii11Ii + i1i1i1111I * oOO % oOo0O00 + I1Ii1I1 / IiIIii11Ii
    if 66 - 66: I1I . OooOoo
    if 31 - 31: IiIIii11Ii . i1I % iI1iII1I1I1i + oOO
    if 17 - 17: i1i1i1111I . ooo000 + IIiIIiIi11I1 * Ooo0Ooo % Ooo0Ooo
    if 74 - 74: OooOoo
    if 41 - 41: iI1iII1I1I1i . I11iiIi11i1I - OooOoo + i1I % OooOoo / Ooo0Ooo
    if 65 - 65: Oo
    if 67 - 67: I1Ii1I1 + I1Ii1I1
    if 42 - 42: IiIIii11Ii / oOo0O00 % ooOOO . oOO / OooOoo + oOo0O00
    if 79 - 79: I11iiIi11i1I . I1Ii1I1 * i1I % I1Ii1I1 / IiI11Ii111
    if 93 - 93: i1I + Iii1i . Ii . i1I * ooOOO
    self . wgLog (
 "RecordIndex={0:d},RecrodType=SwipeRecord,CardNO={1:d},DoorNumber={2:d},InOut={3:d},Valid={4:d},Time={5:%Y-%m-%d %H:%M:%S},Description={6:s}" . format (
 self . recordIndex , self . recordcurrentval ,
 self . recordDoorNO , self . recordInOrOut , self . recordValid , self . recordTime ,
 II1i1i1 ) )
    OoO0OO0 = (
 "RecordIndex={0:d},RecrodType=SwipeRecord,CardNO={1:d},DoorNumber={2:d},InOut={3:d},Valid={4:d},Time={5:%Y-%m-%d %H:%M:%S},Description={6:s}" . format (
 self . recordIndex , self . recordcurrentval ,
 self . recordDoorNO , self . recordInOrOut , self . recordValid , self . recordTime ,
 II1i1i1 ) )
    if 84 - 84: Ooo0Ooo % IiI11Ii111
   elif self . recordType == 2 :
    if 82 - 82: IIiIIiIi11I1
    if 81 - 81: oOo0O00 + i1 - ooo000 * iI1iII1I1I1i + i1i1i1111I
    if 89 - 89: I1Ii1I1
    if 57 - 57: iI1iII1I1I1i - i1iiIII111 / OooOoo % i1iiIII111
    if 92 - 92: IiIIii11Ii * OooOoo - IiIIii11Ii
    if ( self . reason == 44 ) and ( self . recordcurrentval > 1 ) :
     self . wgLog (
 "RecordIndex={0:d},RecrodType=Non-SwipeRecord,VirtualCardNO={1:d},DoorNumber={2:d},InOut=0,Valid=1,Time={3:%Y-%m-%d %H:%M:%S},Description={4:s}" . format (
 self . recordIndex ,
 self . recordcurrentval ,
 self . recordDoorNO ,
 self . recordTime ,
 II1i1i1
     ) )
     OoO0OO0 = (
 "RecordIndex={0:d},RecrodType=Non-SwipeRecord,VirtualCardNO={1:d},DoorNumber={2:d},InOut=0,Valid=0,Time={3:%Y-%m-%d %H:%M:%S},Description={4:s}" . format (
 self . recordIndex ,
 self . recordcurrentval ,
 self . recordDoorNO ,
 self . recordTime ,
 II1i1i1
     ) )
    else :
     if 66 - 66: i1iiIII111 . iI1iII1I1I1i / ooOOO . i1 - OooOoo
     self . wgLog (
 "RecordIndex={0:d},RecrodType=Non-SwipeRecord,CardNO={1:d},DoorNumber={2:d},InOut=0,Valid=0,Time={3:%Y-%m-%d %H:%M:%S},Description={4:s}" . format (
 self . recordIndex ,
 self . recordcurrentval ,
 self . recordDoorNO ,
 self . recordTime ,
 II1i1i1
     ) )
     OoO0OO0 = (
 "RecordIndex={0:d},RecrodType=Non-SwipeRecord,CardNO={1:d},DoorNumber={2:d},InOut=0,Valid=0,Time={3:%Y-%m-%d %H:%M:%S},Description={4:s}" . format (
 self . recordIndex ,
 self . recordcurrentval ,
 self . recordDoorNO ,
 self . recordTime ,
 II1i1i1
     ) )
   elif self . recordType == 3 :
    if 13 - 13: oOo0O00
    if 50 - 50: i1 - i1iiIII111 / i1iiIII111 % I1Ii1I1 / IIiIIiIi11I1
    if 66 - 66: oOo0O00 - Iii1i - ooo000 . I11iiIi11i1I
    self . wgLog (
 "RecordIndex={0:d},RecrodType=WarnRecord,CardNO={1:d},DoorNumber={2:d},InOut=0,Valid=0,Time={3:%Y-%m-%d %H:%M:%S},Description={4:s}" . format (
 self . recordIndex ,
 self . recordcurrentval ,
 self . recordDoorNO ,
 self . recordTime ,
 II1i1i1
    ) )
    OoO0OO0 = (
 "RecordIndex={0:d},RecrodType=WarnRecord,CardNO={1:d},DoorNumber={2:d},InOut=0,Valid=0,Time={3:%Y-%m-%d %H:%M:%S},Description={4:s}" . format (
 self . recordIndex ,
 self . recordcurrentval ,
 self . recordDoorNO ,
 self . recordTime ,
 II1i1i1
    ) )
  return OoO0OO0
  if 59 - 59: i1I / IiIIii11Ii
 def getDescriptionFileLog ( self , SN , root_loggerpar ) :
  if 7 - 7: oOo0O00
  if 64 - 64: IIiIIiIi11I1 * oOO + Oo . OooOoo - ooOOO
  if 94 - 94: IiIIii11Ii - ooo000 . Ii
  if 73 - 73: IiIIii11Ii / oOo0O00 % ooo000 . iI1iII1I1I1i % oOO
  if 36 - 36: IiI11Ii111 * OooOoo . ooo000 . i1iiIII111 + oOO
  if 47 - 47: IiI11Ii111 / I11iiIi11i1I
  if 52 - 52: Ii . OooOoo . i1iiIII111 * I11iiIi11i1I - iI1iII1I1I1i
  if 20 - 20: OooOoo % IiI11Ii111 + I1Ii1I1 + IiI11Ii111 - oOo0O00
  if 76 - 76: I11iiIi11i1I % IIiIIiIi11I1 % i1I
  if 39 - 39: IiIIii11Ii . Oo + i1I - oOo0O00
  OoO0OO0 = ""
  if self . recordType == 0 :
   OoO0OO0 = ( "Index position={0:d}, Type=No record" . format ( self . recordIndex ) )
  elif self . recordType == 0xff :
   if 93 - 93: Iii1i * IIiIIiIi11I1 % i1I + i1 % Ii * i1I
   pass
  else :
   if wgGlobal . IsElevator ( self . controllerSN ) :
    II1i1i1 = self . getReacordFloorDescription ( )
   else :
    II1i1i1 = getReasonDetailChinese ( self . reason )
   if self . recordType == 1 :
    if 62 - 62: IiI11Ii111 % ooo000
    OoO0OO0 = (
 "RecordIndex={0:d},RecrodType=SwipeRecord,CardNO={1:d},DoorNumber={2:d},InOut={3:d},Valid={4:d},Time={5:%Y-%m-%d %H:%M:%S},Description={6:s}" . format (
 self . recordIndex , self . recordcurrentval ,
 self . recordDoorNO , self . recordInOrOut , self . recordValid , self . recordTime ,
 II1i1i1
    ) )
   elif self . recordType == 2 :
    if 19 - 19: Ii / Oo % Iii1i / i1iiIII111 - OooOoo - Ooo0Ooo
    if 89 - 89: I11iiIi11i1I - IiI11Ii111
    if 61 - 61: Ii * OooOoo * I1I % i1iiIII111 % IIiIIiIi11I1 * I11iiIi11i1I
    if 49 - 49: iI1iII1I1I1i / i1iiIII111 % oOO
    if ( self . reason == 44 ) and ( self . recordcurrentval > 1 ) :
     OoO0OO0 = (
 "RecordIndex={0:d},RecrodType=Non-SwipeRecord,VirtualCardNO={1:d},DoorNumber={2:d},InOut=0,Valid=1,Time={3:%Y-%m-%d %H:%M:%S},Description={4:s}" . format (
 self . recordIndex ,
 self . recordcurrentval ,
 self . recordDoorNO ,
 self . recordTime ,
 II1i1i1
     ) )
    else :
     OoO0OO0 = (
 "RecordIndex={0:d},RecrodType=Non-SwipeRecord,CardNO={1:d},DoorNumber={2:d},InOut=0,Valid=0,Time={3:%Y-%m-%d %H:%M:%S},Description={4:s}" . format (
 self . recordIndex ,
 self . recordcurrentval ,
 self . recordDoorNO ,
 self . recordTime ,
 II1i1i1
     ) )
   elif self . recordType == 3 :
    if 46 - 46: ooOOO * IIiIIiIi11I1 % i1 / oOO + i1 + oOo0O00
    if 99 - 99: I1I * IIiIIiIi11I1 * i1iiIII111
    OoO0OO0 = (
 "RecordIndex={0:d},RecrodType=WarnRecord,CardNO={1:d},DoorNumber={2:d},InOut=0,Valid=0,Time={3:%Y-%m-%d %H:%M:%S},Description={4:s}" . format (
 self . recordIndex ,
 self . recordcurrentval ,
 self . recordDoorNO ,
 self . recordTime ,
 II1i1i1
    ) )
  if OoO0OO0 != "" :
   if 62 - 62: ooOOO % Oo + i1I
   if root_loggerpar is not None :
    root_loggerpar . info ( "SN={0}:REC:{1} " . format ( SN , OoO0OO0 ) )
    if 87 - 87: ooo000 - OooOoo + Ii + i1i1i1111I + IiIIii11Ii
 def getDescriptionJSON ( self ) :
  if 57 - 57: IIiIIiIi11I1 + I1I / ooOOO % ooOOO % Oo / IiI11Ii111
  ii1II1 = None
  if 95 - 95: i1 / I11iiIi11i1I . i1 / Oo . Ooo0Ooo
  if 43 - 43: Oo - OooOoo * oOO . Ooo0Ooo / IIiIIiIi11I1 * IIiIIiIi11I1
  if self . recordType == 0 :
   ii1II1 = ( { "RecordIndex" : self . recordIndex , "RecordType" : self . recordType , "Description" : "None" ,
 "CardNO" : "None" , "DoorNO" : "None" , "InExit" : "None" , "Valid" : "None" , "Time" : "2001-01-01 00:00:00" } )
  elif self . recordType == 0xff :
   ii1II1 = ( { "RecordIndex" : self . recordIndex , "RecordType" : self . recordType ,
 "Description" : "The record with the specified index has been overwritten. Please use index 0 to retrieve the index value of the earliest record" ,
 "CardNO" : "None" , "DoorNO" : "None" , "InExit" : "None" , "Valid" : "None" , "Time" : "2001-01-01 00:00:00" } )
  else :
   if 84 - 84: i1iiIII111 + oOo0O00
   if wgGlobal . IsElevator ( self . controllerSN ) :
    II1i1i1 = self . getReacordFloorDescription ( )
   else :
    II1i1i1 = getReasonDetailChinese ( self . reason )
   if self . recordType == 1 :
    ii1II1 = (
 { "RecordIndex" : self . recordIndex , "RecordType" : self . recordType , "Description" : II1i1i1 ,
    "CardNO" : self . recordcurrentval , "DoorNO" : self . recordDoorNO ,
 "InExit" : "In" if self . recordInOrOut == 1 else "Exit" ,
 "Valid" : "Pass" if self . recordValid == 1 else "Forbidden" ,
 "Time" : self . recordTime . strftime ( "%Y-%m-%d %H:%M:%S" ) } )
   elif self . recordType == 2 :
    if 83 - 83: i1i1i1111I
    if 84 - 84: oOO / Ii * Ooo0Ooo / Ii / ooo000
    if 64 - 64: oOo0O00 * Ii
    if 2 - 2: IiI11Ii111 % i1iiIII111 . oOo0O00
    if ( self . reason == 44 ) and ( self . recordcurrentval > 1 ) :
     if 59 - 59: I11iiIi11i1I % OooOoo - iI1iII1I1I1i % I1I + i1iiIII111 . I1Ii1I1
     ii1II1 = (
 { "RecordIndex" : self . recordIndex , "RecordType" : self . recordType ,
 "Description" : II1i1i1 ,
     "CardNO" : self . recordcurrentval , "DoorNO" : self . recordDoorNO ,

     "InExit" : "In" if self . recordInOrOut == 1 else "Exit" , "Valid" : "Pass" ,

     "Time" : self . recordTime . strftime ( "%Y-%m-%d %H:%M:%S" ) } )
    else :
     if 94 - 94: ooOOO * I1Ii1I1 * i1iiIII111 . oOo0O00
     ii1II1 = (
 { "RecordIndex" : self . recordIndex , "RecordType" : self . recordType ,
 "Description" : II1i1i1 ,
     "CardNO" : self . recordcurrentval , "DoorNO" : self . recordDoorNO ,
 "InExit" : "None" , "Valid" : "None" ,
 "Time" : self . recordTime . strftime ( "%Y-%m-%d %H:%M:%S" ) } )
   elif self . recordType == 3 :
    if 73 - 73: I1Ii1I1 / ooo000 % I11iiIi11i1I - i1i1i1111I + Oo - I1Ii1I1
    if 18 - 18: i1 + ooOOO . i1 - iI1iII1I1I1i
    ii1II1 = (
 { "RecordIndex" : self . recordIndex , "RecordType" : self . recordType , "Description" : II1i1i1 ,
    "CardNO" : self . recordcurrentval , "DoorNO" : self . recordDoorNO ,
 "InExit" : "None" , "Valid" : "None" ,
 "Time" : self . recordTime . strftime ( "%Y-%m-%d %H:%M:%S" ) } )
  return ii1II1
  if 97 - 97: oOo0O00 + i1I % Iii1i
 def getDescriptionJSONWithSN ( self , SN ) :
  if 34 - 34: i1 + Oo . oOo0O00 - ooo000 / I11iiIi11i1I * oOo0O00
  ii1II1 = None
  if self . recordType == 0 :
   ii1II1 = ( { "SN" : SN , "RecordIndex" : self . recordIndex , "RecordType" : self . recordType , "Description" : "None" } )
  elif self . recordType == 0xff :
   ii1II1 = (
 { "SN" : SN , "RecordIndex" : self . recordIndex , "RecordType" : self . recordType ,
 "Description" : "The record with the specified index has been overwritten. Please use index 0 to retrieve the index value of the earliest record" } )
  else :
   if wgGlobal . IsElevator ( self . controllerSN ) :
    II1i1i1 = self . getReacordFloorDescription ( )
   else :
    II1i1i1 = getReasonDetailChinese ( self . reason )
   if self . recordType == 1 :
    ii1II1 = (
 { "SN" : SN , "RecordIndex" : self . recordIndex , "RecordType" : self . recordType ,
 "Description" : II1i1i1 ,
    "CardNO" : self . recordcurrentval , "DoorNO" : self . recordDoorNO ,
 "InExit" : "In" if self . recordInOrOut == 1 else "Exit" ,
 "Valid" : "Pass" if self . recordValid == 1 else "Forbidden" ,
 "Time" : self . recordTime . strftime ( "%Y-%m-%d %H:%M:%S" ) } )
   elif self . recordType == 2 :
    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
    if ( self . reason == 44 ) and ( self . recordcurrentval > 1 ) :
     if 42 - 42: Oo - I1I * i1I * i1i1i1111I - I11iiIi11i1I
     if 58 - 58: iI1iII1I1I1i
     if 17 - 17: iI1iII1I1I1i - Ii % iI1iII1I1I1i % oOo0O00 * Iii1i
     if 51 - 51: I1I . i1i1i1111I % Ii
     if 55 - 55: i1i1i1111I * Ii % i1i1i1111I
     if 61 - 61: oOo0O00
     if 53 - 53: Ooo0Ooo / IiIIii11Ii
     ii1II1 = (
 { "SN" : SN , "RecordIndex" : self . recordIndex , "RecordType" : self . recordType ,

     "Description" : II1i1i1 ,
     "CardNO" : self . recordcurrentval , "DoorNO" : self . recordDoorNO ,

     "InExit" : "In" if self . recordInOrOut == 1 else "Exit" , "Valid" : "Pass" ,

     "Time" : self . recordTime . strftime ( "%Y-%m-%d %H:%M:%S" ) } )
    else :
     if 49 - 49: ooo000 - oOO . IiIIii11Ii / Oo
     ii1II1 = (
 { "SN" : SN , "RecordIndex" : self . recordIndex , "RecordType" : self . recordType ,
 "Description" : II1i1i1 ,
     "CardNO" : self . recordcurrentval , "DoorNO" : self . recordDoorNO ,
 "InExit" : "None" , "Valid" : "None" ,
 "Time" : self . recordTime . strftime ( "%Y-%m-%d %H:%M:%S" ) } )
   elif self . recordType == 3 :
    if 23 - 23: I11iiIi11i1I - i1 / Iii1i . iI1iII1I1I1i + oOO
    if 55 - 55: i1 - iI1iII1I1I1i / OooOoo + I1I + Oo
    ii1II1 = (
 { "SN" : SN , "RecordIndex" : self . recordIndex , "RecordType" : self . recordType ,
 "Description" : II1i1i1 ,
    "CardNO" : self . recordcurrentval , "DoorNO" : self . recordDoorNO ,
 "InExit" : "None" , "Valid" : "None" ,
 "Time" : self . recordTime . strftime ( "%Y-%m-%d %H:%M:%S" ) } )
    if 5 - 5: IiI11Ii111 - i1 . i1i1i1111I / IiI11Ii111 . iI1iII1I1I1i . IiI11Ii111
  iiIIi1iii1Ii1 = self . reason4byte [ 2 ]
  OOo00 = self . reason4byte [ 3 ]
  if ( ( ( iiIIi1iii1Ii1 << 8 ) | OOo00 ) == 0x400 ) or (
 ( ( iiIIi1iii1Ii1 << 8 ) | OOo00 ) == 0x600 ) :
   IIi111 = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ]
   IIi111 [ 8 ] = 0x20
   IIi111 [ 9 ] = 0x00
   for ii1ii in range ( 8 ) :
    IIi111 [ ii1ii ] = ( self . recordcurrentval >> ( ii1ii * 8 ) ) & 0xff
   IIi111 = str ( bytes ( IIi111 ) , encoding = "utf-16" )
   IIi111 = IIi111 . replace ( "\0" , "" ) . strip ( )
   ii1II1 [ 'IDCardName' ] = IIi111
   if 23 - 23: Ooo0Ooo * IIiIIiIi11I1 % IiIIii11Ii . ooo000 * i1iiIII111 % Ooo0Ooo
   if 53 - 53: ooo000 + I1Ii1I1
  return ii1II1
  if 97 - 97: i1 - oOo0O00 / OooOoo * Ii - oOO
 def getDescription200Records ( self , SN ) :
  OoO0OO0 = self . getDescriptionJSONWithSN ( SN )
  if OoO0OO0 != "" :
   wgGlobal . printWatchingInfo ( OoO0OO0 )
   if 53 - 53: I11iiIi11i1I % ooo000 / ooOOO / I1I
  return
  if 43 - 43: iI1iII1I1I1i . i1i1i1111I + I1I % ooOOO . IiI11Ii111 - IiI11Ii111
  if 6 - 6: I1I
  if 98 - 98: oOO * IIiIIiIi11I1 / i1iiIII111 / Iii1i + I1I
  if 25 - 25: IIiIIiIi11I1 . IiI11Ii111 / I1I * i1 - i1iiIII111 % oOo0O00
  if 49 - 49: IiIIii11Ii % ooOOO + I11iiIi11i1I + IIiIIiIi11I1
  if 60 - 60: IIiIIiIi11I1
  if 98 - 98: IiIIii11Ii / Ooo0Ooo + Ii
  if 73 - 73: OooOoo * Iii1i
  if 34 - 34: i1I % Ooo0Ooo * OooOoo + i1iiIII111 / i1
  if 49 - 49: IIiIIiIi11I1 / i1iiIII111 % IIiIIiIi11I1 + IIiIIiIi11I1 * iI1iII1I1I1i
  if 22 - 22: I1Ii1I1 + oOO / I1Ii1I1 - Ii % Ii % i1i1i1111I
  if 86 - 86: Iii1i
  if 53 - 53: i1 * i1i1i1111I
  if 91 - 91: I1I . I11iiIi11i1I
  if 59 - 59: IiI11Ii111 . IiI11Ii111 * IIiIIiIi11I1
  if 85 - 85: Iii1i . oOO % Iii1i - Iii1i
  if 68 - 68: oOO + Iii1i + Ooo0Ooo % Oo / I11iiIi11i1I . OooOoo
  if 31 - 31: I11iiIi11i1I % ooOOO
  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
  if 30 - 30: i1iiIII111
  if 78 - 78: ooo000 % Iii1i + ooOOO * IIiIIiIi11I1 - i1
  if 46 - 46: Ooo0Ooo - i1I / ooo000 * IiI11Ii111 . oOo0O00
  if 32 - 32: i1i1i1111I . OooOoo + OooOoo - ooo000 * IiIIii11Ii + Oo
  if 12 - 12: oOo0O00
  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
  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 51 - 51: IIiIIiIi11I1 + i1 % i1iiIII111
  if 49 - 49: IiIIii11Ii - i1I . I1I
  if 76 - 76: oOO / iI1iII1I1I1i . I1I * oOo0O00 - i1i1i1111I
  if 53 - 53: OooOoo - oOo0O00 * ooOOO / OooOoo * Ooo0Ooo * ooo000
  if 10 - 10: IIiIIiIi11I1 % ooo000 % I11iiIi11i1I % Ooo0Ooo
  if 70 - 70: IiIIii11Ii
  if 90 - 90: i1i1i1111I % i1 . IiIIii11Ii * IiI11Ii111 / Ii
  if 73 - 73: ooo000 * Ooo0Ooo + Iii1i . ooOOO . I11iiIi11i1I / I11iiIi11i1I
  if 72 - 72: i1I * iI1iII1I1I1i / ooo000 + i1I - I11iiIi11i1I
  if 20 - 20: IIiIIiIi11I1 . oOo0O00 . Ooo0Ooo
  if 11 - 11: OooOoo
  if 45 - 45: iI1iII1I1I1i + I11iiIi11i1I / IIiIIiIi11I1
  if 45 - 45: iI1iII1I1I1i . iI1iII1I1I1i * i1i1i1111I + oOo0O00
  if 6 - 6: Iii1i . Oo + I1Ii1I1 * i1 * I1Ii1I1 % oOO
  if 21 - 21: Ooo0Ooo % i1 - ooo000
  if 81 - 81: Ooo0Ooo / ooo000
  if 4 - 4: I1I % i1I - ooo000 - I1I . ooOOO / i1i1i1111I
  if 74 - 74: oOO
  if 24 - 24: I1I + Oo - ooOOO
  if 86 - 86: i1iiIII111 % ooo000 % ooo000 % i1I
  if 15 - 15: iI1iII1I1I1i + I1Ii1I1 % oOo0O00
  if 79 - 79: OooOoo . Oo + oOo0O00 / I1Ii1I1 . IiIIii11Ii
  if 89 - 89: ooo000 % Ooo0Ooo
  if 77 - 77: ooo000 % Ooo0Ooo
  if 24 - 24: oOO * I1Ii1I1 * I1Ii1I1 % IIiIIiIi11I1
  if 37 - 37: i1iiIII111 / iI1iII1I1I1i
  if 80 - 80: IiIIii11Ii
  if 2 - 2: I1I / oOO - IIiIIiIi11I1 % Ooo0Ooo
  if 88 - 88: iI1iII1I1I1i - I1Ii1I1 - i1I . Iii1i
  if 98 - 98: Ii + ooOOO
  if 29 - 29: I1Ii1I1 + i1I - IIiIIiIi11I1 * I11iiIi11i1I % Oo
  if 74 - 74: ooOOO
  if 100 - 100: oOO + iI1iII1I1I1i . I1I % Oo - i1
  if 39 - 39: iI1iII1I1I1i
  if 34 - 34: iI1iII1I1I1i . i1 . I1I
  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
  if 90 - 90: OooOoo / i1iiIII111
  if 32 - 32: IIiIIiIi11I1 - i1I / ooOOO * Ooo0Ooo * iI1iII1I1I1i - i1i1i1111I
  if 82 - 82: ooo000
  if 66 - 66: IiIIii11Ii + IIiIIiIi11I1 - i1I + i1i1i1111I . iI1iII1I1I1i * IiIIii11Ii
  if 9 - 9: I1I - I1I - ooOOO - oOo0O00 + i1iiIII111
  if 71 - 71: i1I / i1iiIII111 - Ii * Oo . iI1iII1I1I1i
  if 3 - 3: I1Ii1I1
  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 71 - 71: IiI11Ii111 % Iii1i + oOo0O00 * I11iiIi11i1I / IiI11Ii111
  if 66 - 66: ooo000 * oOo0O00
  if 83 - 83: i1
class WGSwipeRecord192 ( WGSwipeRecord ) :
 def __init__ ( self , data , loc , swipeIndex ) :
  self . controllerSN = struct . unpack_from ( "I" , data , 4 ) [ 0 ]
  if 64 - 64: i1 . IiI11Ii111 - I11iiIi11i1I . Iii1i
  if 47 - 47: ooo000 / Ooo0Ooo % IiIIii11Ii
  if 70 - 70: IIiIIiIi11I1 / Iii1i . i1i1i1111I % ooOOO . Ii / Ii
  self . recordIndex = struct . unpack_from ( "I" , data , 8 ) [ 0 ]
  self . recordIndex = self . recordIndex - swipeIndex
  if 51 - 51: I11iiIi11i1I + Ooo0Ooo - ooo000 * oOO . oOO
  if 79 - 79: i1i1i1111I + oOo0O00
  if 11 - 11: OooOoo / i1iiIII111 % i1I - i1i1i1111I * oOo0O00
  if 90 - 90: i1 * i1 . Ooo0Ooo . Oo
  if 59 - 59: Ii % I1Ii1I1 + Iii1i . OooOoo * Iii1i
  if 21 - 21: I11iiIi11i1I + ooOOO % IiIIii11Ii / OooOoo
  if 96 - 96: Oo * i1iiIII111 . Ooo0Ooo
  if 35 - 35: ooOOO . i1I * i1i1i1111I * iI1iII1I1I1i - I11iiIi11i1I
  if 47 - 47: IIiIIiIi11I1
  if 73 - 73: I1Ii1I1 + ooOOO
  if 99 - 99: i1I
  self . recordType = data [ loc - 8 + 12 ]
  if 87 - 87: i1 . I11iiIi11i1I * Ii . i1 . IIiIIiIi11I1 . IiIIii11Ii
  if 50 - 50: Ii / oOO
  if 92 - 92: Ooo0Ooo * i1iiIII111 / Ooo0Ooo / i1iiIII111 * i1i1i1111I + i1I
  self . recordValid = data [ loc - 8 + 13 ]
  if 48 - 48: I11iiIi11i1I
  if 87 - 87: I1Ii1I1
  if 29 - 29: ooo000 . iI1iII1I1I1i . oOo0O00 + i1i1i1111I + oOO
  self . recordDoorNO = data [ loc - 8 + 14 ]
  if 59 - 59: IiIIii11Ii
  if 26 - 26: oOo0O00 % IiI11Ii111 * i1
  if 60 - 60: IIiIIiIi11I1 % oOO / i1
  self . recordInOrOut = data [ loc - 8 + 15 ]
  if 20 - 20: Ooo0Ooo
  if 4 - 4: IiIIii11Ii % Iii1i
  if 43 - 43: ooo000
  if 95 - 95: Oo + I11iiIi11i1I / Ooo0Ooo / Ii - ooOOO / i1i1i1111I
  if 6 - 6: Ooo0Ooo % IiIIii11Ii
  if 59 - 59: i1I . I11iiIi11i1I . ooo000 / i1I . Ii % Ooo0Ooo
  if 85 - 85: oOo0O00 / ooOOO
  if 41 - 41: i1iiIII111 * iI1iII1I1I1i + i1 + i1i1i1111I
  o0o0 = struct . unpack_from ( "I" , data , loc - 8 + 16 ) [ 0 ]
  iII11I11111I = struct . unpack_from ( "I" , data , loc ) [ 0 ]
  self . recordcurrentval = o0o0 + ( iII11I11111I << 32 )
  if self . recordcurrentval >= 0x8000000000000000 :
   self . recordcurrentval = self . recordcurrentval - 0x10000000000000000
   if 26 - 26: Oo % OooOoo
   if 14 - 14: iI1iII1I1I1i - i1iiIII111
   if 53 - 53: oOO
  I11i = "{0:0>2X}{1:0>2X}-{2:0>2X}-{3:0>2X} {4:0>2X}:{5:0>2X}:{6:0>2X}" . format ( data [ loc - 8 + 20 ] ,
 data [ loc - 8 + 21 ] ,
 data [ loc - 8 + 22 ] ,
 data [ loc - 8 + 23 ] ,
 data [ loc - 8 + 24 ] ,
 data [ loc - 8 + 25 ] ,
 data [ loc - 8 + 26 ] )
  if 46 - 46: oOo0O00 - iI1iII1I1I1i
  try :
   self . recordTime = datetime . datetime . strptime ( I11i , "%Y-%m-%d %H:%M:%S" )
  except Exception as iIi1I1I :
   pass
   self . recordTime = datetime . datetime . strptime ( "2000-01-19 19:19:19" ,
 "%Y-%m-%d %H:%M:%S" )
   if 34 - 34: i1i1i1111I
   if 21 - 21: IiI11Ii111 + I1I . OooOoo + i1 . ooo000 + I11iiIi11i1I
   if 7 - 7: ooOOO + Iii1i / iI1iII1I1I1i - oOO % Oo / iI1iII1I1I1i
   if 14 - 14: Iii1i . Ii
  self . reason = data [ loc - 8 + 27 ]
  self . reason4byte = data [ loc - 8 + 28 : loc - 8 + 28 + 4 ]
  self . ymdhms = 0
  if 100 - 100: I1I / ooo000
  if 48 - 48: i1i1i1111I * i1I % i1i1i1111I + i1i1i1111I . iI1iII1I1I1i / OooOoo
class WGSwipeRecord16Byte ( WGSwipeRecord ) :
 def __init__ ( self , data , loc , swipeIndex ) :
  self . controllerSN = struct . unpack_from ( "I" , data , 4 ) [ 0 ]
  if 12 - 12: Ii . Ii - I1Ii1I1
  if 74 - 74: ooo000 * Iii1i - Ooo0Ooo - I1Ii1I1
  if 46 - 46: ooOOO / ooOOO
  self . recordIndex = struct . unpack_from ( "I" , data , 8 ) [ 0 ]
  self . recordIndex = self . recordIndex + swipeIndex + 1
  if 58 - 58: IiI11Ii111 . IiI11Ii111
  if 79 - 79: oOo0O00 * IIiIIiIi11I1
  if 53 - 53: Ii - ooOOO . OooOoo - I1I - I11iiIi11i1I
  if 32 - 32: Iii1i % IiIIii11Ii - oOO - IiIIii11Ii - I11iiIi11i1I % i1iiIII111
  if 50 - 50: Iii1i / IiI11Ii111 + i1
  if 4 - 4: IIiIIiIi11I1 . IiIIii11Ii % i1I
  if 30 - 30: i1 . i1
  if 35 - 35: Ii * i1I / IiIIii11Ii - I1Ii1I1 / i1
  if 76 - 76: IiIIii11Ii * Iii1i % IiIIii11Ii
  if 73 - 73: i1I / IIiIIiIi11I1 / oOo0O00 % IIiIIiIi11I1 / Ii
  if 12 - 12: i1
  if 78 - 78: I11iiIi11i1I . IIiIIiIi11I1
  if 1 - 1: I1I % i1iiIII111 / I1Ii1I1
  self . recordType = data [ loc - 8 + 12 ]
  if 42 - 42: Iii1i
  if 19 - 19: OooOoo * I11iiIi11i1I . i1i1i1111I + ooo000 + i1I
  if 13 - 13: i1iiIII111 + I1Ii1I1 / Ooo0Ooo
  self . recordValid = data [ loc - 8 + 13 ]
  if 82 - 82: i1iiIII111 * oOO / IiI11Ii111 * IiIIii11Ii
  if 29 - 29: I1Ii1I1 % oOo0O00 - oOo0O00 * I1Ii1I1 / Iii1i * i1I
  if 51 - 51: I1Ii1I1 . i1iiIII111 % i1 % i1I * Oo
  self . recordDoorNO = data [ loc - 8 + 14 ]
  if 64 - 64: i1i1i1111I + i1
  if 45 - 45: i1i1i1111I / i1iiIII111 * iI1iII1I1I1i
  if 2 - 2: i1 / i1i1i1111I * IiIIii11Ii
  self . recordInOrOut = data [ loc - 8 + 15 ]
  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
  o0o0 = struct . unpack_from ( "I" , data , loc - 8 + 16 ) [ 0 ]
  iII11I11111I = 0
  self . recordcurrentval = o0o0 + ( iII11I11111I << 32 )
  if self . recordcurrentval >= 0x8000000000000000 :
   self . recordcurrentval = self . recordcurrentval - 0x10000000000000000
   if 93 - 93: ooOOO % oOo0O00 * i1 + Ii . i1I - oOO
   if 63 - 63: IiIIii11Ii . Iii1i
   if 55 - 55: oOo0O00
  I11i = "{0:0>2X}{1:0>2X}-{2:0>2X}-{3:0>2X} {4:0>2X}:{5:0>2X}:{6:0>2X}" . format ( data [ loc - 8 + 20 ] ,
 data [ loc - 8 + 21 ] ,
 data [ loc - 8 + 22 ] ,
 data [ loc - 8 + 23 ] ,
 data [ loc - 8 + 24 ] ,
 data [ loc - 8 + 25 ] ,
 data [ loc - 8 + 26 ] )
  if 85 - 85: IIiIIiIi11I1 % Oo / I1I . oOo0O00 / IIiIIiIi11I1 . Oo
  try :
   self . recordTime = datetime . datetime . strptime ( I11i , "%Y-%m-%d %H:%M:%S" )
  except Exception as iIi1I1I :
   pass
   self . recordTime = datetime . datetime . strptime ( "2000-01-19 19:19:19" ,
 "%Y-%m-%d %H:%M:%S" )
   if 40 - 40: IIiIIiIi11I1 - ooOOO * oOO . ooo000
   if 24 - 24: IiIIii11Ii - iI1iII1I1I1i / Ii
   if 34 - 34: ooOOO - ooOOO / Ii % OooOoo
   if 97 - 97: Oo * IiIIii11Ii . Ooo0Ooo % i1 % Ii % ooo000
  self . reason = data [ loc - 8 + 27 ]
  if 67 - 67: IIiIIiIi11I1 % i1 % oOo0O00 - i1i1i1111I
  if 51 - 51: I11iiIi11i1I . I11iiIi11i1I % IiI11Ii111 % Oo / I1Ii1I1 - I1Ii1I1
  if 28 - 28: Ii / Ooo0Ooo
class WGSwipeRecord24Byte ( WGSwipeRecord ) :
 def __init__ ( self , data , loc , swipeIndex ) :
  self . controllerSN = struct . unpack_from ( "I" , data , 4 ) [ 0 ]
  if 11 - 11: I1I - OooOoo * ooOOO % i1i1i1111I + ooo000 . oOO
  if 51 - 51: ooOOO + iI1iII1I1I1i % IiI11Ii111 . I11iiIi11i1I % Ooo0Ooo
  if 15 - 15: OooOoo / i1I % Oo % Oo
  self . recordIndex = struct . unpack_from ( "I" , data , 8 ) [ 0 ]
  self . recordIndex = self . recordIndex + swipeIndex + 1
  if 73 - 73: oOo0O00
  if 69 - 69: ooOOO - IIiIIiIi11I1 - i1I
  if 78 - 78: I1Ii1I1 . ooo000 + IiI11Ii111 / IiI11Ii111
  if 88 - 88: Ii - i1iiIII111 - i1 * IIiIIiIi11I1 . IiIIii11Ii + Iii1i
  if 44 - 44: ooOOO + Oo - i1
  if 18 - 18: iI1iII1I1I1i * ooOOO + Ooo0Ooo
  if 78 - 78: I1I . I1I - IIiIIiIi11I1 - IiIIii11Ii % I11iiIi11i1I . I1Ii1I1
  if 9 - 9: I11iiIi11i1I * OooOoo - I11iiIi11i1I
  if 73 - 73: I1Ii1I1
  if 25 - 25: i1 . Ii
  if 59 - 59: IiIIii11Ii
  if 91 - 91: IiIIii11Ii + iI1iII1I1I1i
  if 65 - 65: Oo * Iii1i * IiIIii11Ii / IIiIIiIi11I1
  self . recordType = data [ loc - 8 + 12 ]
  if 77 - 77: IIiIIiIi11I1 / oOO % IiIIii11Ii + I1Ii1I1
  if 34 - 34: i1i1i1111I * Iii1i + Ii - i1I / i1 / i1
  if 87 - 87: Ooo0Ooo + I11iiIi11i1I
  self . recordValid = data [ loc - 8 + 13 ]
  if 3 - 3: IIiIIiIi11I1 . I1Ii1I1 / Iii1i % ooOOO / oOo0O00 % ooOOO
  if 55 - 55: iI1iII1I1I1i + I1I + oOo0O00 - I11iiIi11i1I
  if 80 - 80: Oo % I11iiIi11i1I . IiIIii11Ii * oOO
  self . recordDoorNO = data [ loc - 8 + 14 ]
  if 83 - 83: oOo0O00 % Oo + i1i1i1111I - ooOOO + i1iiIII111
  if 36 - 36: oOo0O00 * OooOoo / I11iiIi11i1I
  if 98 - 98: IiI11Ii111 . ooo000
  self . recordInOrOut = data [ loc - 8 + 15 ]
  if 85 - 85: OooOoo * Iii1i * IIiIIiIi11I1
  if 38 - 38: ooo000 - Ii - i1I
  if 91 - 91: i1iiIII111 / i1 * oOO * IIiIIiIi11I1 * IiIIii11Ii
  if 65 - 65: oOO / oOo0O00 / Oo
  if 61 - 61: ooOOO * oOO
  if 98 - 98: i1iiIII111 * i1i1i1111I
  if 29 - 29: oOo0O00 / i1iiIII111 - IiIIii11Ii
  if 34 - 34: iI1iII1I1I1i + IIiIIiIi11I1 . i1I . IiI11Ii111 % i1i1i1111I
  o0o0 = struct . unpack_from ( "I" , data , loc - 8 + 16 ) [ 0 ]
  iII11I11111I = struct . unpack_from ( "I" , data , loc ) [ 0 ]
  self . recordcurrentval = o0o0 + ( iII11I11111I << 32 )
  if self . recordcurrentval >= 0x8000000000000000 :
   self . recordcurrentval = self . recordcurrentval - 0x10000000000000000
   if 61 - 61: Oo % ooo000
   if 68 - 68: Ii - OooOoo / I1I
   if 44 - 44: iI1iII1I1I1i % i1iiIII111 / I1Ii1I1 * i1i1i1111I
  I11i = "{0:0>2X}{1:0>2X}-{2:0>2X}-{3:0>2X} {4:0>2X}:{5:0>2X}:{6:0>2X}" . format ( data [ loc - 8 + 20 ] ,
 data [ loc - 8 + 21 ] ,
 data [ loc - 8 + 22 ] ,
 data [ loc - 8 + 23 ] ,
 data [ loc - 8 + 24 ] ,
 data [ loc - 8 + 25 ] ,
 data [ loc - 8 + 26 ] )
  if 63 - 63: I1Ii1I1 * Ii + Iii1i
  try :
   self . recordTime = datetime . datetime . strptime ( I11i , "%Y-%m-%d %H:%M:%S" )
  except Exception as iIi1I1I :
   pass
   self . recordTime = datetime . datetime . strptime ( "2000-01-19 19:19:19" ,
 "%Y-%m-%d %H:%M:%S" )
   if 58 - 58: I1Ii1I1 / I1Ii1I1 % IIiIIiIi11I1
   if 98 - 98: OooOoo
   if 79 - 79: Ooo0Ooo * Ooo0Ooo - ooo000 - Iii1i
   if 5 - 5: IiIIii11Ii / i1iiIII111 . I1I % Iii1i . i1
  self . reason = data [ loc - 8 + 27 ]
  self . option = data [ loc - 8 + 27 + 1 : loc - 8 + 27 + 1 + 4 ]
  if 29 - 29: oOo0O00 + Oo / I11iiIi11i1I - oOo0O00 % i1i1i1111I / Ii
  if 39 - 39: I11iiIi11i1I - I11iiIi11i1I % i1iiIII111
  if 56 - 56: i1iiIII111 / IiIIii11Ii - I1Ii1I1 / Iii1i - i1 / OooOoo
RecordDetails = [

# Iii1i * i1I
"1" , "SwipePass" , "Swipe" , "Swipe" ,
 "2" , "SwipePass" , "Swipe Open" , "Swipe Open" ,
 "3" , "SwipePass" , "Swipe Close" , "Swipe Close" ,
 "4" , "SwipePass" , "Swipe Limited Times" , "Swipe Limited Times" ,
 "5" , "SwipeNOPass" , "Denied Access: PC Control" , "Denied Access:PC Control" ,
 "6" , "SwipeNOPass" , "Denied Access: No PRIVILEGE" , "Denied Access:No PRIVILEGE" ,
 "7" , "SwipeNOPass" , "Denied Access: Wrong PASSWORD" , "Denied Access: Wrong PASSWORD" ,
 "8" , "SwipeNOPass" , "Denied Access: AntiBack" , "Denied Access: AntiBack" ,
 "9" , "SwipeNOPass" , "Denied Access: More Cards" , "Denied Access: More Cards" ,
 "10" , "SwipeNOPass" , "Denied Access: First Card Open" , "Denied Access: First Card Open" ,
 "11" , "SwipeNOPass" , "Denied Access: Door Set NC" , "Denied Access: Door Set NC" ,
 "12" , "SwipeNOPass" , "Denied Access: InterLock" , "Denied Access: InterLock" ,
 "13" , "SwipeNOPass" , "Denied Access: Limited Times" , "Denied Access: Limited Times" ,
 "14" , "SwipeNOPass" , "Denied Access: Limited Person Indoor" , "Denied Access: Limited Person Indoor" ,
 "15" , "SwipeNOPass" , "Denied Access: Invalid Timezone" , "Denied Access: Invalid Timezone" ,
 "16" , "SwipeNOPass" , "Denied Access: In Order" , "Denied Access: In Order" ,
 "17" , "SwipeNOPass" , "Denied Access: SWIPE GAP LIMIT" , "Denied Access: SWIPE GAP LIMIT" ,
 "18" , "SwipeNOPass" , "Denied Access" , "Denied Access" ,
 "19" , "SwipeNOPass" , "Denied Access: Limited Times" , "Denied Access: Limited Times" ,
 "20" , "ValidEvent" , "Push Button" , "Push Button" ,
 "21" , "ValidEvent" , "Push Button Open" , "Push Button Open" ,
 "22" , "ValidEvent" , "Push Button Close" , "Push Button Close" ,
 "23" , "ValidEvent" , "Door Open" , "Door Open[DS]" ,
 "24" , "ValidEvent" , "Door Closed" , "Door Closed[DS]" ,
 "25" , "ValidEvent" , "Super Password Open Door" , "Super Password Open Door" ,
 "26" , "ValidEvent" , "Super Password Open" , "Super Password Open" ,
 "27" , "ValidEvent" , "Super Password Close" , "Super Password Close" ,
 "28" , "Warn" , "Controller Power On" , "Controller Power On" ,
 "29" , "Warn" , "Controller Reset" , "Controller Reset" ,
 "30" , "Warn" , "Push Button Invalid: Disable" , "Push Button Invalid: Disable" ,
 "31" , "Warn" , "Push Button Invalid: Forced Lock" , "Push Button Invalid: Forced Lock" ,
 "32" , "Warn" , "Push Button Invalid: Not On Line" , "Push Button Invalid: Not On Line" ,
 "33" , "Warn" , "Push Button Invalid: InterLock" , "Push Button Invalid: InterLock" ,
 "34" , "Warn" , "Threat" , "Threat" ,
 "35" , "Warn" , "Threat Open" , "Threat Open" ,

"36" , "Warn" , "Invalid Swipe Warn" , "Invalid Swipe Warn" ,
"37" , "Warn" , "Open too long" , "Open too long[Valid Open]" ,
 "38" , "Warn" , "Forced Open" , "Forced Open" ,
 "39" , "Warn" , "Fire" , "Fire" ,
 "40" , "Warn" , "Forced Close" , "Forced Close" ,
 "41" , "Warn" , "Guard Against Theft" , "Guard Against Theft" ,
 "42" , "Warn" , "7*24Hour Zone" , "7*24Hour Zone" ,
 "43" , "Warn" , "Emergency Call" , "Emergency Call" ,
 "44" , "RemoteOpen" , "Remote Open Door" , "Remote Open Door" ,
 "45" , "RemoteOpen" , "Remote Open Door By USB Reader" , "Remote Open Door By USB Reader"
 ]
if 65 - 65: IiIIii11Ii . Ii
if 49 - 49: oOO + Ii % Ii % Oo * Iii1i * Ii
if 89 - 89: Ooo0Ooo
if 57 - 57: oOO . IIiIIiIi11I1 + OooOoo * I1I
if 89 - 89: Iii1i * Ooo0Ooo + Oo * I11iiIi11i1I * IiI11Ii111 + IiI11Ii111
if 90 - 90: Oo - I11iiIi11i1I
if 93 - 93: oOo0O00 . Oo . I1I - I1I % ooOOO
if 67 - 67: Ooo0Ooo + oOo0O00
if 21 - 21: oOO
if 64 - 64: IIiIIiIi11I1 * i1iiIII111
if 31 - 31: Iii1i
if 86 - 86: Oo
if 74 - 74: OooOoo - I11iiIi11i1I . Oo . i1 + oOo0O00 - ooOOO
if 60 - 60: Oo
if 23 - 23: oOo0O00
if 47 - 47: Ooo0Ooo + Oo * Ii . OooOoo . I1Ii1I1 * i1iiIII111
if 46 - 46: ooOOO % i1i1i1111I * i1iiIII111 + I1Ii1I1
if 15 - 15: iI1iII1I1I1i - ooo000 + IIiIIiIi11I1 * Ooo0Ooo
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
def getReasonDetailChinese ( Reason ) :
 if Reason > 45 :
  return ""
 if Reason <= 0 :
  return ""
  if 97 - 97: i1 + ooOOO + I11iiIi11i1I . i1
  if 71 - 71: ooo000 - i1i1i1111I / iI1iII1I1I1i - iI1iII1I1I1i % IIiIIiIi11I1 . iI1iII1I1I1i
  if 41 - 41: IIiIIiIi11I1
  if 96 - 96: Oo . Ooo0Ooo - oOO . Iii1i % IiI11Ii111 . IiI11Ii111
  if 82 - 82: oOO % iI1iII1I1I1i / i1iiIII111
  if 47 - 47: i1
  if 59 - 59: IiI11Ii111 % IIiIIiIi11I1 % IiIIii11Ii
  if 92 - 92: Oo . i1 * i1iiIII111 . IiIIii11Ii
  if 82 - 82: I11iiIi11i1I % Oo + Ii
 return RecordDetails [ ( Reason - 1 ) * 4 + 3 ]
 if 22 - 22: Ooo0Ooo / ooOOO . I1I % I1I
 if 16 - 16: iI1iII1I1I1i / i1iiIII111 / Ooo0Ooo . Ii
 if 82 - 82: Oo % iI1iII1I1I1i - i1I * OooOoo % Iii1i - I11iiIi11i1I
 if 95 - 95: oOO
 if 56 - 56: I11iiIi11i1I - i1I / OooOoo / ooo000 . IiI11Ii111
 if 78 - 78: ooo000 % IiI11Ii111 - i1
 if 36 - 36: oOo0O00 + OooOoo - Ooo0Ooo / IiI11Ii111
 if 90 - 90: oOo0O00 % oOO * oOO + I1I * I1I / IiI11Ii111
 if 92 - 92: IiIIii11Ii * OooOoo * I1Ii1I1
 if 65 - 65: i1iiIII111 * Oo * oOO + i1I - i1I
 if 86 - 86: oOO - Ooo0Ooo + I11iiIi11i1I . Iii1i . OooOoo - Ii
 if 86 - 86: I1I
 if 35 - 35: ooOOO + OooOoo
 if 8 - 8: I1I + Ii % iI1iII1I1I1i + IiI11Ii111 . oOO * i1
 if 96 - 96: ooo000 % I11iiIi11i1I / oOo0O00 * Ii * ooo000 - Ooo0Ooo
 if 88 - 88: Ii % ooOOO . I1I
 if 80 - 80: IiIIii11Ii / oOO % IiI11Ii111 * I1I
 if 100 - 100: oOo0O00 / I1Ii1I1 - i1i1i1111I * I1Ii1I1 / I11iiIi11i1I * Oo
class WGTools ( object ) :
 @ staticmethod
 def logDebug ( info ) :
  if 49 - 49: Ooo0Ooo
  try :
   print ( "{0} {1}" . format ( time . strftime ( '%Y-%m-%d %H:%M:%S' ) , info ) )
  except Exception as iIi1I1I :
   pass
   if 36 - 36: OooOoo + i1I / Iii1i + iI1iII1I1I1i + OooOoo
  finally :
   pass
   if 6 - 6: IiI11Ii111 + Ii
   if 100 - 100: oOo0O00 % i1I - IiIIii11Ii % i1iiIII111 . i1 % I1Ii1I1
   if 67 - 67: I11iiIi11i1I
   if 21 - 21: oOO % i1i1i1111I - i1 + I1I
   if 85 - 85: IiIIii11Ii + I1I + IiI11Ii111
   if 68 - 68: Iii1i % IiIIii11Ii . i1 - IiI11Ii111
   if 80 - 80: i1iiIII111 . ooo000
   if 15 - 15: oOO + oOo0O00 * I11iiIi11i1I . IiIIii11Ii
   if 66 - 66: IIiIIiIi11I1 - oOo0O00 . I1I * I11iiIi11i1I + i1i1i1111I
   if 13 - 13: oOO % Iii1i
   if 81 - 81: I1I
   if 86 - 86: Ooo0Ooo / I1I . Ooo0Ooo % i1i1i1111I * OooOoo * Iii1i
 @ staticmethod
 def getLongByByte ( data , startIndex , bytlen ) :
  OoiI1i = - 1
  if ( bytlen >= 1 ) and ( bytlen <= 8 ) :
   OoiI1i = data [ startIndex + bytlen - 1 ]
   for III1IIIi in range ( 1 , bytlen ) :
    OoiI1i <<= 8
    OoiI1i += ( data [ startIndex + bytlen - 1 - III1IIIi ] )
  return OoiI1i
  if 50 - 50: oOO . IiI11Ii111 . i1I . i1i1i1111I . I11iiIi11i1I + Oo
  if 38 - 38: IiI11Ii111 + oOo0O00 . ooo000 - Iii1i - I1Ii1I1 - oOO
 @ staticmethod
 def longToByte ( number , data , startIndex , bytlen ) :
  for III1IIIi in range ( 0 , bytlen ) :
   data [ startIndex + III1IIIi ] = ( number % 256 )
   number >>= 8
   if 29 - 29: ooo000 * oOO
 @ staticmethod
 def getBCD ( val ) :
  return ( int ) ( ( ( val % 10 ) + ( ( ( val - ( val % 10 ) ) / 10 ) % 10 ) * 16 ) )
  if 38 - 38: oOo0O00 / IiIIii11Ii * oOO . OooOoo % Ii . Iii1i
 @ staticmethod
 def getHexString1Byte ( val ) :
  oo000O = ""
  I1iiii1Iiii1 = val
  oo000O = oo000O + "{0:02X}" . format ( I1iiii1Iiii1 & 0xff )
  return oo000O
  if 73 - 73: oOO
 @ staticmethod
 def getHexString2Byte ( val ) :
  oo000O = ""
  I1iiii1Iiii1 = val
  for ii1ii in range ( 0 , 2 ) :
   oo000O = oo000O + "{0:02X}" . format ( I1iiii1Iiii1 & 0xff )
   I1iiii1Iiii1 = I1iiii1Iiii1 >> 8
  return oo000O
  if 60 - 60: i1i1i1111I % i1i1i1111I + Oo + i1I / i1iiIII111 - IiIIii11Ii
 @ staticmethod
 def getHexString4Byte ( val ) :
  oo000O = ""
  I1iiii1Iiii1 = val
  for ii1ii in range ( 0 , 4 ) :
   oo000O = oo000O + "{0:02X}" . format ( I1iiii1Iiii1 & 0xff )
   I1iiii1Iiii1 = I1iiii1Iiii1 >> 8
  return oo000O
  if 17 - 17: i1 * oOo0O00 . i1i1i1111I % i1iiIII111 / iI1iII1I1I1i - i1iiIII111
 @ staticmethod
 def getHexString8Byte ( val ) :
  oo000O = ""
  I1iiii1Iiii1 = val
  for ii1ii in range ( 0 , 8 ) :
   oo000O = oo000O + "{0:02X}" . format ( I1iiii1Iiii1 & 0xff )
   I1iiii1Iiii1 = I1iiii1Iiii1 >> 8
  return oo000O
  if 79 - 79: i1I + i1I / IiIIii11Ii % Ooo0Ooo + Iii1i / i1iiIII111
 @ staticmethod
 def getHexString ( arrbyte ) :
  oo000O = ""
  i11IIIi11IIII = len ( arrbyte )
  for ii1ii in range ( 0 , i11IIIi11IIII ) :
   oo000O = oo000O + "{0:02X}" . format ( arrbyte [ ii1ii ] & 0xff )
  return oo000O
  if 46 - 46: oOO - I1Ii1I1 . IiI11Ii111
 @ staticmethod
 def getIPString4Byte ( data , startIndex ) :
  oo000O = ""
  oo000O = oo000O + "{0:d}" . format ( data [ startIndex ] & 0xff )
  oo000O = oo000O + "."
  oo000O = oo000O + "{0:d}" . format ( data [ startIndex + 1 ] & 0xff )
  oo000O = oo000O + "."
  oo000O = oo000O + "{0:d}" . format ( data [ startIndex + 2 ] & 0xff )
  oo000O = oo000O + "."
  oo000O = oo000O + "{0:d}" . format ( data [ startIndex + 3 ] & 0xff )
  return oo000O
  if 11 - 11: oOO / ooOOO / i1i1i1111I
  if 94 - 94: Iii1i
 @ staticmethod
 def crc8 ( buf , len ) :
  Iii1I11I1iI = 0
  for o0OoO00oOO0 in range ( 0 , len ) :
   Iii1I11I1iI = ( Iii1I11I1iI ^ ( buf [ o0OoO00oOO0 ] ) ) & 0xff
   for III1IIIi in range ( 0 , 8 ) :
    if ( ( Iii1I11I1iI & 0x80 ) > 0 ) :
     Iii1I11I1iI = ( ( Iii1I11I1iI << 1 ) ^ 0x31 ) & 0xff
    else :
     Iii1I11I1iI = ( Iii1I11I1iI << 1 ) & 0xff
  return Iii1I11I1iI
  if 2 - 2: IiI11Ii111 / I1Ii1I1 * OooOoo % I1Ii1I1 - i1I / i1I
  if 85 - 85: IIiIIiIi11I1 * IiIIii11Ii
 @ staticmethod
 def getYMD ( Year , Month , Day ) :
  iiiIIii1i = ( Year % 100 ) << 9
  iiiIIii1i += ( Month << 5 )
  iiiIIii1i += Day
  return iiiIIii1i
  if 67 - 67: IIiIIiIi11I1 - Ii - Ii
  if 84 - 84: I11iiIi11i1I . ooOOO * ooOOO
 @ staticmethod
 def getHMS ( Hour , Minute , Second ) :
  III11i1IIi1I = 0
  III11i1IIi1I += ( Second >> 1 )
  III11i1IIi1I += Minute << 5
  III11i1IIi1I += Hour << 11
  return III11i1IIi1I
  if 46 - 46: IIiIIiIi11I1 - Iii1i % I11iiIi11i1I
  if 18 - 18: i1 / I11iiIi11i1I . ooOOO * I1I
  if 20 - 20: IiIIii11Ii / IiI11Ii111
  if 92 - 92: i1
  if 54 - 54: Oo * IIiIIiIi11I1 - IIiIIiIi11I1
  if 27 - 27: Ooo0Ooo / i1 . OooOoo . i1I % I1Ii1I1
  if 18 - 18: Ii % OooOoo % I1Ii1I1 . I1Ii1I1 + ooo000 % IiI11Ii111
  if 73 - 73: oOo0O00 . I1I . IiI11Ii111 - IIiIIiIi11I1 - i1 / Ooo0Ooo
  if 77 - 77: I1Ii1I1 % IiI11Ii111
  if 85 - 85: I1Ii1I1 + i1iiIII111 * IiI11Ii111 - i1i1i1111I % i1
  if 49 - 49: Oo / I1I . I11iiIi11i1I % Ooo0Ooo
  if 20 - 20: I1Ii1I1 . IiI11Ii111 - Ii % I11iiIi11i1I % Oo
  if 12 - 12: OooOoo * oOO % Ooo0Ooo . I11iiIi11i1I
  if 54 - 54: I11iiIi11i1I . i1 - IIiIIiIi11I1
 @ staticmethod
 def getarrStringWithsplitDou ( cmdarr ) :
  O000oOoOOoo = ''
  for Ooo00o in cmdarr :
   if O000oOoOOoo == '' :
    O000oOoOOoo += Ooo00o
   else :
    O000oOoOOoo += ',' + Ooo00o
  return O000oOoOOoo
  if 74 - 74: I11iiIi11i1I . ooo000 . I1I * i1iiIII111 * Ooo0Ooo
 @ staticmethod
 def isValid64Group ( cmdNew ) :
  if ( cmdNew [ 64 ] == 0xaa ) and ( cmdNew [ 65 ] == 0x55 ) :
   return False
   if 47 - 47: OooOoo
  if ( ( cmdNew [ 64 ] == 0 ) and ( cmdNew [ 65 ] == 0 ) and ( cmdNew [ 66 ] == 0 ) and (
 cmdNew [ 67 ] == 0 ) and
 ( ( ( cmdNew [ 64 + 4 ] == 0x55 ) and ( cmdNew [ 65 + 4 ] == 0xaa ) and ( cmdNew [ 66 + 4 ] == 0xaa ) and (
 cmdNew [ 67 + 4 ] == 0x55 ) ) or (
 ( cmdNew [ 64 + 4 ] == 0 ) and ( cmdNew [ 65 + 4 ] == 0 ) and ( cmdNew [ 66 + 4 ] == 0 ) and (
 cmdNew [ 67 + 4 ] == 0 ) ) ) ) :
   return False
  else :
   return True
   if 55 - 55: ooOOO % oOO + i1I - IiI11Ii111 + ooo000 + I1I
   if 53 - 53: IIiIIiIi11I1 % IiIIii11Ii / oOO % ooOOO - oOo0O00
   if 74 - 74: ooo000 * OooOoo * Oo
   if 96 - 96: I1Ii1I1 - Oo
   if 28 - 28: i1iiIII111 - IiI11Ii111 % Ii * ooo000 / Iii1i
   if 12 - 12: IiI11Ii111 - Ooo0Ooo
   if 12 - 12: ooOOO
   if 29 - 29: IiI11Ii111 . ooo000 . ooo000
   if 79 - 79: oOo0O00 % IiI11Ii111 * I1Ii1I1 . IIiIIiIi11I1 * Iii1i - I1I
   if 85 - 85: I1I + IiI11Ii111 . I11iiIi11i1I % i1 * IiI11Ii111
   if 22 - 22: IiIIii11Ii . Iii1i / i1i1i1111I / ooo000 + ooo000 + ooo000
   if 76 - 76: Iii1i % i1i1i1111I
   if 12 - 12: oOO + IiIIii11Ii % ooOOO + IiI11Ii111 / I1I
   if 59 - 59: Iii1i % I1Ii1I1 + I11iiIi11i1I - Oo
class WGCommand ( object ) :
 @ staticmethod
 def cmdRemoteOpenDoorInLocalnetworkDefault ( ) :
  return [ 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 ]
  if 72 - 72: I11iiIi11i1I
  if 38 - 38: I11iiIi11i1I . oOO + i1I
 @ staticmethod
 def cmdRemoteOpenDoorInLocalnetwork ( sn , doorno , inOrOut , virtualcurrentval , xid ) :
  O0OoOO0O = WGCommand . cmdRemoteOpenDoorInLocalnetworkDefault ( )
  WGTools . longToByte ( sn , O0OoOO0O , 4 , 4 )
  O0OoOO0O [ 8 ] = doorno
  WGTools . longToByte ( xid , O0OoOO0O , 40 , 4 )
  if 76 - 76: IIiIIiIi11I1
  if inOrOut == 1 :
   O0OoOO0O [ 28 ] = 0
  else :
   O0OoOO0O [ 28 ] = 1
  WGTools . longToByte ( virtualcurrentval , O0OoOO0O , 20 , 8 )
  O0OoOO0O [ 32 ] = 0x5A
  if 170000000 < sn < 179999999 :
   O0OoOO0O [ 8 ] = 1
   O0OoOO0O [ 9 ] = doorno
  return O0OoOO0O
  if 15 - 15: ooo000 . i1 * i1
  if 41 - 41: I11iiIi11i1I + Iii1i % ooOOO * i1
 @ staticmethod
 def cmdremoteOpenDoorByCloudServer ( sn , doorno , inOrOut , virtualcurrentval , xid , floorNO = 0 , floorDelay = 0 ) :
  O0OoOO0O = WGCommand . cmdRemoteOpenDoorInLocalnetworkDefault ( )
  O0OoOO0O [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , O0OoOO0O , 4 , 4 )
  O0OoOO0O [ 8 ] = doorno
  O0OoOO0O [ 9 ] = floorNO
  O0OoOO0O [ 10 ] = floorDelay & 0xff
  O0OoOO0O [ 11 ] = ( floorDelay >> 8 ) & 0xff
  if 37 - 37: ooo000
  WGTools . longToByte ( xid , O0OoOO0O , 40 , 4 )
  if 87 - 87: i1i1i1111I + I1Ii1I1 % i1iiIII111 - I1I + ooOOO % I1Ii1I1
  if inOrOut == 1 :
   O0OoOO0O [ 28 ] = 0
  else :
   O0OoOO0O [ 28 ] = 1
  WGTools . longToByte ( virtualcurrentval , O0OoOO0O , 20 , 8 )
  O0OoOO0O [ 32 ] = 0x5A
  return O0OoOO0O
  if 96 - 96: IIiIIiIi11I1 / I1I * i1 / I1I + I1I / i1
 @ staticmethod
 def cmdremoteOpenDoorByCloudServer1024 ( sn , doorno , inOrOut , virtualcurrentval , xid , arrfloorNO , floorDelay = 0 ) :
  ooo = [ 0 ] * 1024
  if 87 - 87: IiI11Ii111 - oOO . IIiIIiIi11I1 . IiI11Ii111 + IIiIIiIi11I1 + i1I
  ii1ii = 0
  O0OO = arrfloorNO [ 0 ]
  i1Oo0OO0oOo0 = WGCommand . cmdremoteOpenDoorByCloudServer ( sn , doorno , inOrOut , virtualcurrentval , xid + ii1ii , O0OO ,
 floorDelay )
  if 67 - 67: Iii1i + I1I . i1I - Oo
  OOo0OoOO0OO = len ( arrfloorNO )
  if OOo0OoOO0OO > 16 :
   OOo0OoOO0OO = 16
   if 24 - 24: I1I - IiIIii11Ii - ooo000 + ooOOO
  oo00oo0Oo0O = xid
  for ii1ii in range ( 0 , OOo0OoOO0OO ) :
   WGTools . longToByte ( arrfloorNO [ ii1ii ] , i1Oo0OO0oOo0 , 9 , 1 )
   WGTools . longToByte ( oo00oo0Oo0O , i1Oo0OO0oOo0 , 40 , 4 )
   oo00oo0Oo0O += 1
   for o0oO in range ( 0 , 64 ) :
    ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
    if 2 - 2: IIiIIiIi11I1 - OooOoo
  return ooo
  if 81 - 81: i1iiIII111 % oOo0O00 - oOO + Ii % ooo000
 @ staticmethod
 def cmdremoteExternBoardByCloudServer ( sn , externBoardNo , delay , xid ) :
  O0OoOO0O = WGCommand . cmdRemoteOpenDoorInLocalnetworkDefault ( )
  O0OoOO0O [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , O0OoOO0O , 4 , 4 )
  O0OoOO0O [ 8 ] = externBoardNo | 0xC0
  O0OoOO0O [ 10 ] = delay & 0xff
  O0OoOO0O [ 11 ] = ( delay >> 8 ) & 0xff
  WGTools . longToByte ( xid , O0OoOO0O , 40 , 4 )
  return O0OoOO0O
  if 13 - 13: Ii / ooOOO / Oo - i1iiIII111 - IiIIii11Ii + IiIIii11Ii
  if 72 - 72: IiIIii11Ii + Ooo0Ooo . IiIIii11Ii . IiI11Ii111 * I1I
  if 74 - 74: oOO * oOo0O00 / i1iiIII111 + I11iiIi11i1I * IIiIIiIi11I1
  if 100 - 100: i1i1i1111I - IiI11Ii111 - iI1iII1I1I1i + OooOoo * i1iiIII111 / Ooo0Ooo
  if 81 - 81: ooo000 % i1i1i1111I . i1iiIII111 / i1iiIII111 / i1iiIII111
 @ staticmethod
 def cmdgetrecordIndexReadByCloudServer ( sn , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0xB4 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  return i1Oo0OO0oOo0
  if 84 - 84: ooOOO * ooo000 % ooOOO
  if 57 - 57: i1I * iI1iII1I1I1i % Ooo0Ooo
 @ staticmethod
 def cmdgetrecordParam1024ByCloudServer ( sn , recordIndex , xid ) :
  ooo = [ 0 ] * 1024
  ii1ii = 0
  i1Oo0OO0oOo0 = WGCommand . cmdgetrecordIndexReadByCloudServer ( sn , xid + ii1ii )
  for o0oO in range ( 0 , 64 ) :
   ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  ii1ii = 1
  i1Oo0OO0oOo0 = WGCommand . cmdgetrecord64ByCloudServer ( sn , 0 , xid + ii1ii )
  for o0oO in range ( 0 , 64 ) :
   ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  ii1ii = 2
  i1Oo0OO0oOo0 = WGCommand . cmdgetrecord64ByCloudServer ( sn , 0xffffffff , xid + ii1ii )
  for o0oO in range ( 0 , 64 ) :
   ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  ii1ii = 3
  i1Oo0OO0oOo0 = WGCommand . cmdgetrecord64ByCloudServer ( sn , recordIndex , xid + ii1ii )
  for o0oO in range ( 0 , 64 ) :
   ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  return ooo
  if 22 - 22: OooOoo . i1
  if 85 - 85: i1i1i1111I * I1Ii1I1 / ooo000
 @ staticmethod
 def cmdgetrecord64ByCloudServer ( sn , recordIndex , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0xB0 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  WGTools . longToByte ( recordIndex , i1Oo0OO0oOo0 , 8 , 4 )
  return i1Oo0OO0oOo0
  if 14 - 14: i1i1i1111I
  if 61 - 61: Iii1i . I11iiIi11i1I - Oo . IiI11Ii111 + OooOoo
 @ staticmethod
 def cmdgetrecord1024ByCloudServer ( sn , recordIndexToGetStart , xid ) :
  ooo = [
 0 ] * 1024
  for ii1ii in range ( 0 , 16 ) :
   i1Oo0OO0oOo0 = WGCommand . cmdgetrecord64ByCloudServer ( sn , recordIndexToGetStart + ii1ii , xid + ii1ii )
   for o0oO in range ( 0 , 64 ) :
    ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  return ooo
  if 11 - 11: oOo0O00 - i1 / oOo0O00 * OooOoo - I11iiIi11i1I / I1Ii1I1
  if 4 - 4: IiIIii11Ii
 @ staticmethod
 def cmdgetrecord1024_Card4ByCloudServer ( sn , recordIndexToGetStart , xid ) :
  ooo = [
 0 ] * 1024
  ii1ii = 0
  i1Oo0OO0oOo0 = WGCommand . cmdgetrecord64ByCloudServer ( sn , recordIndexToGetStart + ii1ii , xid + ii1ii )
  for o0oO in range ( 0 , 64 ) :
   ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  ooo [ 64 ] = 0xaa
  ooo [ 65 ] = 0x55
  ooo [ 66 ] = 0x02
  ooo [ 67 ] = 0x01
  return ooo
  if 42 - 42: oOO - oOO + OooOoo - oOO
  if 23 - 23: iI1iII1I1I1i % i1I * I11iiIi11i1I - oOO * oOo0O00
 @ staticmethod
 def cmdgetrecord1024_Card8ByCloudServer ( sn , recordIndexToGetStart , xid ) :
  if wgGlobal . supportNXP4G > 0 :
   return WGCommand . cmdgetrecord1024_16ByteByCloudServer ( sn , recordIndexToGetStart , xid )
  ooo = [
 0 ] * 1024
  ii1ii = 0
  i1Oo0OO0oOo0 = WGCommand . cmdgetrecord64ByCloudServer ( sn , recordIndexToGetStart + ii1ii , xid + ii1ii )
  for o0oO in range ( 0 , 64 ) :
   ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  ooo [ 64 ] = 0xaa
  ooo [ 65 ] = 0x55
  ooo [ 66 ] = 0x02
  ooo [ 67 ] = 0x02
  return ooo
  if 45 - 45: i1 % iI1iII1I1I1i . IiIIii11Ii + Ooo0Ooo
  if 34 - 34: Iii1i + Iii1i
 @ staticmethod
 def cmdgetrecord1024_16ByteByCloudServer ( sn , recordIndexToGetStart , xid ) :
  ooo = [
 0 ] * 1024
  ii1ii = 0
  i1Oo0OO0oOo0 = WGCommand . cmdgetrecord64ByCloudServer ( sn , recordIndexToGetStart + ii1ii , xid + ii1ii )
  for o0oO in range ( 0 , 64 ) :
   ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  ooo [ 64 ] = 0xaa
  ooo [ 65 ] = 0x55
  ooo [ 66 ] = 0x02
  ooo [ 67 ] = 0x03
  return ooo
  if 67 - 67: oOo0O00 + IIiIIiIi11I1
  if 69 - 69: IIiIIiIi11I1
 @ staticmethod
 def cmdsetrecordIndexReadByCloudServer ( sn , recordIndex , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0xB2 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  if 97 - 97: Iii1i + oOo0O00 - i1 % Iii1i
  if 71 - 71: Ooo0Ooo / Ooo0Ooo % ooo000
  if 32 - 32: ooo000 * ooo000
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  WGTools . longToByte ( recordIndex , i1Oo0OO0oOo0 , 8 , 4 )
  II1 = 0x55AAAA55
  WGTools . longToByte ( II1 , i1Oo0OO0oOo0 , 12 , 4 )
  if 31 - 31: ooOOO % oOO + Ooo0Ooo + i1i1i1111I / I1Ii1I1
  return i1Oo0OO0oOo0
  if 18 - 18: iI1iII1I1I1i . iI1iII1I1I1i % ooOOO
  if 90 - 90: I1I - Iii1i + Ii / Iii1i % I1Ii1I1
 @ staticmethod
 def cmduploadAllPriviege64ByCloudServer ( sn , currentvalOfPrivilege , cardCount , indexOfPrivilege , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0x56 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  WGTools . longToByte ( currentvalOfPrivilege [ 0 ] , i1Oo0OO0oOo0 , 8 , 4 )
  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
  oooO0o00oOO0O = currentvalOfPrivilege [ 0 ] >> 16
  o0o000oOO0Oo = oooO0o00oOO0O >> 16
  if 47 - 47: I1I
  WGTools . longToByte ( o0o000oOO0Oo , i1Oo0OO0oOo0 , 44 , 4 )
  if 15 - 15: Ooo0Ooo * i1iiIII111
  if 2 - 2: i1I + Oo
  if 51 - 51: Ii . i1I
  if 89 - 89: IiI11Ii111 * IiIIii11Ii / i1 . I1Ii1I1
  if 64 - 64: IiI11Ii111
  i1Oo0OO0oOo0 [ 8 + 4 ] = WGTools . getBCD ( currentvalOfPrivilege [ 1 ] . year // 100 )
  i1Oo0OO0oOo0 [ 8 + 5 ] = WGTools . getBCD ( currentvalOfPrivilege [ 1 ] . year % 100 )
  i1Oo0OO0oOo0 [ 8 + 6 ] = WGTools . getBCD ( currentvalOfPrivilege [ 1 ] . month )
  i1Oo0OO0oOo0 [ 8 + 7 ] = WGTools . getBCD ( currentvalOfPrivilege [ 1 ] . day )
  if 44 - 44: Ii . OooOoo + oOO * OooOoo . i1 - i1iiIII111
  if 72 - 72: iI1iII1I1I1i + I1I * ooo000 . OooOoo + Ii + IIiIIiIi11I1
  if 91 - 91: oOo0O00 % IIiIIiIi11I1 % i1I / I1Ii1I1
  if 70 - 70: iI1iII1I1I1i + IiI11Ii111 + oOO
  if 21 - 21: I11iiIi11i1I
  i1Oo0OO0oOo0 [ 8 + 8 ] = WGTools . getBCD ( currentvalOfPrivilege [ 2 ] . year // 100 )
  i1Oo0OO0oOo0 [ 8 + 9 ] = WGTools . getBCD ( currentvalOfPrivilege [ 2 ] . year % 100 )
  i1Oo0OO0oOo0 [ 8 + 10 ] = WGTools . getBCD ( currentvalOfPrivilege [ 2 ] . month )
  i1Oo0OO0oOo0 [ 8 + 11 ] = WGTools . getBCD ( currentvalOfPrivilege [ 2 ] . day )
  if 20 - 20: ooOOO + IiIIii11Ii % Iii1i - I11iiIi11i1I
  i1Oo0OO0oOo0 [ 38 ] = WGTools . getBCD ( currentvalOfPrivilege [ 2 ] . hour )
  i1Oo0OO0oOo0 [ 39 ] = WGTools . getBCD ( currentvalOfPrivilege [ 2 ] . minute )
  if 49 - 49: Iii1i / IiIIii11Ii % i1 % i1i1i1111I + oOO * ooo000
  if currentvalOfPrivilege [ 9 ] == 0 :
   if sn < 300000000 :
    i1Oo0OO0oOo0 [ 49 ] = WGTools . getBCD ( currentvalOfPrivilege [ 2 ] . second )
    i1Oo0OO0oOo0 [ 50 ] = WGTools . getBCD ( currentvalOfPrivilege [ 1 ] . hour )
    i1Oo0OO0oOo0 [ 51 ] = WGTools . getBCD ( currentvalOfPrivilege [ 1 ] . minute )
    i1Oo0OO0oOo0 [ 52 ] = WGTools . getBCD ( currentvalOfPrivilege [ 1 ] . second )
    if 25 - 25: IIiIIiIi11I1 * OooOoo % oOo0O00 % Ooo0Ooo + i1iiIII111
    if 15 - 15: I11iiIi11i1I
    if 85 - 85: Ii
  i1Oo0OO0oOo0 [ 8 + 12 ] = currentvalOfPrivilege [ 3 ]
  if 17 - 17: I1I . Oo
  i1Oo0OO0oOo0 [ 8 + 13 ] = currentvalOfPrivilege [ 4 ]
  if 63 - 63: Ii . i1I
  i1Oo0OO0oOo0 [ 8 + 14 ] = currentvalOfPrivilege [ 5 ]
  if 83 - 83: IIiIIiIi11I1 * IiI11Ii111 % i1I * ooOOO
  i1Oo0OO0oOo0 [ 8 + 15 ] = currentvalOfPrivilege [ 6 ]
  WGTools . longToByte ( currentvalOfPrivilege [ 7 ] , i1Oo0OO0oOo0 , 24 , 3 )
  if 7 - 7: IiI11Ii111 / i1i1i1111I * Iii1i
  WGTools . longToByte ( cardCount , i1Oo0OO0oOo0 , 32 , 3 )
  WGTools . longToByte ( indexOfPrivilege + 1 , i1Oo0OO0oOo0 , 35 , 3 )
  if 27 - 27: i1i1i1111I - Ii - oOO + Ooo0Ooo * Ii + IiI11Ii111
  if 35 - 35: i1i1i1111I . i1i1i1111I + I11iiIi11i1I / Oo . i1
  if 69 - 69: I1I / i1 % I1Ii1I1 % oOO
  if currentvalOfPrivilege [ 9 ] == 3 or currentvalOfPrivilege [ 9 ] == 2 :
   i1Oo0OO0oOo0 [ 48 ] = currentvalOfPrivilege [ 9 ]
   if 96 - 96: Oo - i1I * iI1iII1I1I1i + Ooo0Ooo * Oo
  if len ( currentvalOfPrivilege [ 10 ] ) > 0 :
   iI1I1i11II = currentvalOfPrivilege [ 10 ]
   i1Oo0OO0oOo0 [ 21 ] , i1Oo0OO0oOo0 [ 22 ] , i1Oo0OO0oOo0 [ 23 ] , i1Oo0OO0oOo0 [ 29 ] , i1Oo0OO0oOo0 [ 30 ] , i1Oo0OO0oOo0 [ 31 ] = iI1I1i11II [ 0 ] , iI1I1i11II [ 1 ] , iI1I1i11II [ 2 ] , iI1I1i11II [ 3 ] , iI1I1i11II [ 4 ] , iI1I1i11II [ 5 ]
   if 41 - 41: IiIIii11Ii + Ooo0Ooo - i1iiIII111 * i1 % i1I
   if 70 - 70: oOO - ooOOO
  if len ( currentvalOfPrivilege [ 11 ] ) > 0 :
   OOo0oO0o0 = currentvalOfPrivilege [ 11 ]
   i1Oo0OO0oOo0 [ 28 ] , i1Oo0OO0oOo0 [ 29 ] , i1Oo0OO0oOo0 [ 30 ] , i1Oo0OO0oOo0 [ 31 ] = OOo0oO0o0 [ 0 ] , OOo0oO0o0 [ 1 ] , OOo0oO0o0 [ 2 ] , OOo0oO0o0 [ 3 ]
   if 18 - 18: oOo0O00 . I1I / i1iiIII111
   if 3 - 3: oOO + oOO % i1I % Oo / iI1iII1I1I1i . IiIIii11Ii
  return i1Oo0OO0oOo0
  if 20 - 20: IiIIii11Ii + i1I
  if 32 - 32: oOo0O00 + i1i1i1111I
 @ staticmethod
 def cmduploadAllPriviege1024ByCloudServer ( sn , privilegeList , cardCount , indexOfPrivilege ,
 xid ) :
  if ( indexOfPrivilege >= cardCount ) :
   return None
  ooo = [
 0 ] * 1024
  for ii1ii in range ( 0 , 16 ) :
   i1Oo0OO0oOo0 = WGCommand . cmduploadAllPriviege64ByCloudServer ( sn , privilegeList [ indexOfPrivilege + ii1ii ] , cardCount ,
 indexOfPrivilege + ii1ii , xid + ii1ii )
   for o0oO in range ( 0 , 64 ) :
    ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
   if ( indexOfPrivilege + ii1ii + 1 >= cardCount ) :
    if ( ii1ii == 0 ) :
     return i1Oo0OO0oOo0
    break
  return ooo
  if 74 - 74: I1I % i1i1i1111I * i1iiIII111 * IIiIIiIi11I1
  if 23 - 23: i1I * IiI11Ii111 . oOo0O00 * Ii
 @ staticmethod
 def cmduploadAllPriviege1024_Card4ByCloudServer ( sn , privilegeList , cardCount , indexOfPrivilege , xid ) :
  if ( indexOfPrivilege >= cardCount ) :
   return None
  ooo = [
 0 ] * 1024
  ii1ii = 0
  i1Oo0OO0oOo0 = WGCommand . cmduploadAllPriviege64ByCloudServer ( sn , privilegeList [ indexOfPrivilege + ii1ii ] , cardCount ,
 indexOfPrivilege + ii1ii , xid + ii1ii )
  if indexOfPrivilege + ii1ii + 1 >= cardCount :
   if 94 - 94: i1i1i1111I - i1iiIII111 . Ooo0Ooo + Oo - i1
   return i1Oo0OO0oOo0
  for o0oO in range ( 0 , 64 ) :
   ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  ooo [ 64 ] = 0xaa
  ooo [ 65 ] = 0x55
  ooo [ 66 ] = 0x01
  ooo [ 67 ] = 0x01
  if 96 - 96: Iii1i % ooo000 * oOo0O00 . Ii % oOO + i1I
  for I1iii11II1 in range ( 0 , ( ( 1024 - 64 - 4 ) >> 2 ) ) :
   WGTools . longToByte ( privilegeList [ indexOfPrivilege + I1iii11II1 + 1 ] [ 0 ] , ooo , 68 + I1iii11II1 * 4 , 4 )
   if ( cardCount <= indexOfPrivilege + I1iii11II1 + 1 + 1 ) :
    break
  return ooo
  if 74 - 74: i1 . oOo0O00 - OooOoo - i1iiIII111 / i1i1i1111I
  if 61 - 61: Ii * ooo000 % i1i1i1111I + I11iiIi11i1I - Ooo0Ooo
 @ staticmethod
 def cmduploadAllPriviege1024_Card8ByCloudServer ( sn , privilegeList , cardCount , indexOfPrivilege , xid ) :
  if ( indexOfPrivilege >= cardCount ) :
   return None
  ooo = [
 0 ] * 1024
  ii1ii = 0
  i1Oo0OO0oOo0 = WGCommand . cmduploadAllPriviege64ByCloudServer ( sn , privilegeList [ indexOfPrivilege + ii1ii ] , cardCount ,
 indexOfPrivilege + ii1ii , xid + ii1ii )
  if ( indexOfPrivilege + ii1ii + 1 >= cardCount ) :
   if ( ii1ii == 0 ) :
    return i1Oo0OO0oOo0
  for o0oO in range ( 0 , 64 ) :
   ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  ooo [ 64 ] = 0xaa
  ooo [ 65 ] = 0x55
  ooo [ 66 ] = 0x01
  ooo [ 67 ] = 0x02
  if 100 - 100: OooOoo / oOO - IIiIIiIi11I1 / i1I - oOO / IiI11Ii111
  for I1iii11II1 in range ( 0 , ( ( 1024 - 64 - 4 ) >> 3 ) ) :
   WGTools . longToByte ( privilegeList [ indexOfPrivilege + I1iii11II1 + 1 ] [ 0 ] , ooo , 68 + I1iii11II1 * 8 , 8 )
   if ( cardCount <= indexOfPrivilege + I1iii11II1 + 1 + 1 ) :
    break
  return ooo
  if 95 - 95: i1 / ooOOO . i1iiIII111 - i1I * i1i1i1111I
  if 15 - 15: Ooo0Ooo - IiIIii11Ii + i1iiIII111 / IiI11Ii111 + Iii1i * oOo0O00
  if 22 - 22: iI1iII1I1I1i % OooOoo % iI1iII1I1I1i
  if 6 - 6: IiIIii11Ii / OooOoo
  if 97 - 97: Oo . Ii * IiI11Ii111 / oOo0O00 / i1iiIII111 . Oo
  if 40 - 40: Iii1i - I1I + oOO * I1I
  if 27 - 27: ooOOO % IIiIIiIi11I1 % OooOoo % Iii1i * ooo000
  if 75 - 75: Ii % I1Ii1I1 + oOo0O00 . IiI11Ii111 / Ii + iI1iII1I1I1i
 @ staticmethod
 def cmduploadAllPriviege1024PostByCloudServer ( sn , privilegeList , cardCount , indexOfPrivilege , xid , totalPrivileges ,
 sentPrivileges ) :
  if ( indexOfPrivilege >= cardCount ) :
   return None
  ooo = [
 0 ] * 1024
  for ii1ii in range ( 0 , 16 ) :
   i1Oo0OO0oOo0 = WGCommand . cmduploadAllPriviege64ByCloudServer ( sn , privilegeList [ indexOfPrivilege + ii1ii ] ,
 totalPrivileges , indexOfPrivilege + ii1ii + sentPrivileges ,
 xid + ii1ii )
   for o0oO in range ( 0 , 64 ) :
    ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
   if ( indexOfPrivilege + ii1ii + 1 >= cardCount ) :
    if ( ii1ii == 0 ) :
     return i1Oo0OO0oOo0
    break
  return ooo
  if 84 - 84: i1i1i1111I
  if 50 - 50: IiIIii11Ii + Iii1i . ooo000 + ooo000 / Oo % i1iiIII111
  if 63 - 63: i1i1i1111I % I1I / iI1iII1I1I1i % Iii1i % Ii
  if 32 - 32: i1iiIII111 + ooo000 - I1Ii1I1 * IiIIii11Ii . IiIIii11Ii
 @ staticmethod
 def cmduploadAllPriviege1024_Card4PostByCloudServer ( sn , privilegeList , cardCount , indexOfPrivilege , xid ,
 totalPrivileges , sentPrivileges ) :
  if ( indexOfPrivilege >= cardCount ) :
   return None
  ooo = [
 0 ] * 1024
  ii1ii = 0
  i1Oo0OO0oOo0 = WGCommand . cmduploadAllPriviege64ByCloudServer ( sn , privilegeList [ indexOfPrivilege + ii1ii ] , totalPrivileges ,
 indexOfPrivilege + ii1ii + sentPrivileges , xid + ii1ii )
  if ( indexOfPrivilege + ii1ii + 1 >= cardCount ) :
   if 46 - 46: i1 + ooOOO % ooOOO . Iii1i - ooOOO % i1
   return i1Oo0OO0oOo0
  for o0oO in range ( 0 , 64 ) :
   ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  ooo [ 64 ] = 0xaa
  ooo [ 65 ] = 0x55
  ooo [ 66 ] = 0x01
  ooo [ 67 ] = 0x01
  if 20 - 20: OooOoo - ooo000 . I11iiIi11i1I
  for I1iii11II1 in range ( 0 , ( ( 1024 - 64 - 4 ) >> 2 ) ) :
   WGTools . longToByte ( privilegeList [ indexOfPrivilege + I1iii11II1 + 1 ] [ 0 ] , ooo , 68 + I1iii11II1 * 4 , 4 )
   if ( cardCount <= indexOfPrivilege + I1iii11II1 + 1 + 1 ) :
    break
  return ooo
  if 87 - 87: i1 * i1 - OooOoo % oOo0O00 - IiI11Ii111
  if 43 - 43: OooOoo % OooOoo / oOO % I1I
  if 18 - 18: I11iiIi11i1I * Ooo0Ooo / OooOoo
  if 84 - 84: i1iiIII111 / oOO . Oo % i1iiIII111 / OooOoo
 @ staticmethod
 def cmduploadAllPriviege1024_Card8PostByCloudServer ( sn , privilegeList , cardCount , indexOfPrivilege , xid ,
 totalPrivileges , sentPrivileges ) :
  if ( indexOfPrivilege >= cardCount ) :
   return None
  ooo = [
 0 ] * 1024
  ii1ii = 0
  i1Oo0OO0oOo0 = WGCommand . cmduploadAllPriviege64ByCloudServer ( sn , privilegeList [ indexOfPrivilege + ii1ii ] , totalPrivileges ,
 indexOfPrivilege + ii1ii + sentPrivileges , xid + ii1ii )
  if indexOfPrivilege + ii1ii + 1 >= cardCount :
   if ii1ii == 0 :
    return i1Oo0OO0oOo0
  for o0oO in range ( 0 , 64 ) :
   ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  ooo [ 64 ] = 0xaa
  ooo [ 65 ] = 0x55
  ooo [ 66 ] = 0x01
  ooo [ 67 ] = 0x02
  if 94 - 94: i1iiIII111
  for I1iii11II1 in range ( 0 , ( ( 1024 - 64 - 4 ) >> 3 ) ) :
   WGTools . longToByte ( privilegeList [ indexOfPrivilege + I1iii11II1 + 1 ] [ 0 ] , ooo , 68 + I1iii11II1 * 8 , 8 )
   if cardCount <= indexOfPrivilege + I1iii11II1 + 1 + 1 :
    break
  return ooo
  if 53 - 53: iI1iII1I1I1i + ooOOO * I1I / Oo
 @ staticmethod
 def cmduploadPrivieges0x50ByCloudServer ( sn , privilegeList , cardCount , indexOfPrivilege , xid ) :
  if indexOfPrivilege >= cardCount :
   return None
  ooo = [
 0 ] * 1024
  for ii1ii in range ( 0 , 16 ) :
   i1Oo0OO0oOo0 = WGCommand . cmduploadAllPriviege64ByCloudServer ( sn , privilegeList [ indexOfPrivilege + ii1ii ] , cardCount ,
 indexOfPrivilege + ii1ii , xid + ii1ii )
   i1Oo0OO0oOo0 [ 1 ] = 0x50
   for o0oO in range ( 0 , 64 ) :
    ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
   if indexOfPrivilege + ii1ii + 1 >= cardCount :
    if ii1ii == 0 :
     return i1Oo0OO0oOo0
    break
  return ooo
  if 17 - 17: IiI11Ii111 . IiI11Ii111
 @ staticmethod
 def cmdDeletePriviegeByCloudServer ( sn , privilegeList , cardCount , indexOfPrivilege , xid ) :
  if ( indexOfPrivilege >= cardCount ) :
   return None
  ooo = [
 0 ] * 1024
  for ii1ii in range ( 0 , 16 ) :
   i1Oo0OO0oOo0 = WGCommand . cmduploadAllPriviege64ByCloudServer ( sn , privilegeList [ indexOfPrivilege + ii1ii ] , cardCount ,
 indexOfPrivilege + ii1ii , xid + ii1ii )
   i1Oo0OO0oOo0 [ 1 ] = 0x52
   for o0oO in range ( 0 , 64 ) :
    ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
   if ( indexOfPrivilege + ii1ii + 1 >= cardCount ) :
    if ( ii1ii == 0 ) :
     return i1Oo0OO0oOo0
    break
  return ooo
  if 35 - 35: IiI11Ii111 % IiI11Ii111 / i1 / Iii1i * IiIIii11Ii
 @ staticmethod
 def cmdEditPrivilegeLostCardByCloudServer ( sn , privilegeList , cardCount , indexOfPrivilege ,
 xid ) :
  if ( indexOfPrivilege >= cardCount ) :
   return None
  I11I = privilegeList [ 0 ] [ 0 ]
  oOOooooo = privilegeList [ 1 ] [ 0 ]
  if 53 - 53: ooOOO
  if 53 - 53: I1I * I1I
  if oOOooooo == 0 and I11I == 0 :
   return None
  if oOOooooo == 0 :
   i1Oo0OO0oOo0 = WGCommand . cmduploadAllPriviege64ByCloudServer ( sn , privilegeList [ 0 ] , 0 , 0 , xid + 0 )
   i1Oo0OO0oOo0 [ 1 ] = 0x50
   return i1Oo0OO0oOo0
  if I11I == 0 :
   i1Oo0OO0oOo0 = WGCommand . cmduploadAllPriviege64ByCloudServer ( sn , privilegeList [ 1 ] , 0 , 0 , xid + 0 )
   i1Oo0OO0oOo0 [ 1 ] = 0x52
   return i1Oo0OO0oOo0
   if 9 - 9: IiI11Ii111 - IIiIIiIi11I1
  ooo = [
 0 ] * 1024
  i1Oo0OO0oOo0 = WGCommand . cmduploadAllPriviege64ByCloudServer ( sn , privilegeList [ 0 ] , 0 , 0 , xid + 0 )
  i1Oo0OO0oOo0 [ 1 ] = 0x50
  for o0oO in range ( 0 , 64 ) :
   ooo [ 0 * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  i1Oo0OO0oOo0 = WGCommand . cmduploadAllPriviege64ByCloudServer ( sn , privilegeList [ 1 ] , 0 , 0 , xid + 1 )
  i1Oo0OO0oOo0 [ 1 ] = 0x52
  for o0oO in range ( 0 , 64 ) :
   ooo [ 1 * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  return ooo
  if 89 - 89: i1 - ooo000 - Ii
 @ staticmethod
 def cmdclearPriviege64ByCloudServer ( sn , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0x54 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  i1Oo0OO0oOo0 [ 1 ] = 0x54
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  II1 = 0x55AAAA55
  WGTools . longToByte ( II1 , i1Oo0OO0oOo0 , 8 , 4 )
  return i1Oo0OO0oOo0
  if 78 - 78: i1iiIII111 - IiI11Ii111 - i1I * oOO % Ii % I11iiIi11i1I
 @ staticmethod
 def cmdgetPriviegeNum64ByCloudServer ( sn , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0x58 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  i1Oo0OO0oOo0 [ 1 ] = 0x58
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  return i1Oo0OO0oOo0
  if 14 - 14: Ii - I11iiIi11i1I / ooo000 % Ii
 @ staticmethod
 def cmdgetPriviegeInfoByCardNO64ByCloudServer ( sn , cardNO , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0x5A , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  i1Oo0OO0oOo0 [ 1 ] = 0x5A
  WGTools . longToByte ( cardNO , i1Oo0OO0oOo0 , 8 , 4 )
  if 72 - 72: Ii % oOo0O00 / ooo000 - oOo0O00
  oooO0o00oOO0O = cardNO >> 16
  o0o000oOO0Oo = oooO0o00oOO0O >> 16
  if 100 - 100: I1Ii1I1 - oOo0O00 - IiI11Ii111
  if 7 - 7: OooOoo % iI1iII1I1I1i - I11iiIi11i1I . I1Ii1I1 . oOO % OooOoo
  WGTools . longToByte ( o0o000oOO0Oo , i1Oo0OO0oOo0 , 44 , 4 )
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  return i1Oo0OO0oOo0
  if 51 - 51: iI1iII1I1I1i + I1Ii1I1 . i1I - I1I
 @ staticmethod
 def cmdgetPriviegeInfoByIndex64ByCloudServer ( sn , cardNOIndex , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0x5C , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  i1Oo0OO0oOo0 [ 1 ] = 0x5C
  WGTools . longToByte ( cardNOIndex , i1Oo0OO0oOo0 , 8 , 4 )
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  return i1Oo0OO0oOo0
  if 59 - 59: ooOOO
  if 42 - 42: I1Ii1I1 * Oo * Oo . iI1iII1I1I1i * IiIIii11Ii * i1i1i1111I
 @ staticmethod
 def cmdgetPriviegeInfoByIndex1024ByCloudServer ( sn , cardNOIndexStart , xid ) :
  ooo = [ 0 ] * 1024
  o0OooO00 = 0
  if 20 - 20: I1Ii1I1 / Ii
  oo00oo0Oo0O = xid
  while o0OooO00 < 16 :
   ooo [ 0 + 64 * o0OooO00 ] = CMDTYPE_37
   ooo [ 1 + 64 * o0OooO00 ] = 0x5C
   WGTools . longToByte ( cardNOIndexStart + o0OooO00 , ooo , 8 + 64 * o0OooO00 , 4 )
   WGTools . longToByte ( sn , ooo , 4 + 64 * o0OooO00 , 4 )
   WGTools . longToByte ( oo00oo0Oo0O , ooo , 40 + 64 * o0OooO00 , 4 )
   o0OooO00 += 1
   oo00oo0Oo0O += 1
  return ooo
  if 54 - 54: iI1iII1I1I1i + I1Ii1I1 + Oo
 @ staticmethod
 def cmdgetComm64ByCloudServer ( sn , strCommCommand , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0x00 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1oOO0o0Ooo = strCommCommand . replace ( " " , "" )
  if len ( i1oOO0o0Ooo ) == 64 * 2 :
   OOo00oo0 = ( binascii . unhexlify ( i1oOO0o0Ooo ) )
  else :
   return None
  for ii1ii in range ( 0 , 64 ) :
   i1Oo0OO0oOo0 [ ii1ii ] = OOo00oo0 [ ii1ii ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  return i1Oo0OO0oOo0
  if 36 - 36: oOO * Ii / OooOoo / IiIIii11Ii . Ii
  if 19 - 19: i1I
 @ staticmethod
 def cmdgetComm64X37 ( sn , strCommCommand , xid ) :
  if type ( strCommCommand ) is str :
   i1Oo0OO0oOo0 = bytearray ( binascii . unhexlify ( strCommCommand . replace ( " " , "" ) ) )
  else :
   i1Oo0OO0oOo0 = bytearray ( binascii . unhexlify ( strCommCommand ) )
   if 78 - 78: i1i1i1111I + Oo . Ooo0Ooo
  if 64 > len ( i1Oo0OO0oOo0 ) > 0 :
   if i1Oo0OO0oOo0 [ 0 ] != 0x17 and i1Oo0OO0oOo0 [ 0 ] != 0x37 :
    iI1111111iI1 = [ 0 ] * 64
    for ii1ii in range ( 0 , len ( i1Oo0OO0oOo0 ) ) :
     iI1111111iI1 [ ii1ii + 1 ] = i1Oo0OO0oOo0 [ ii1ii ]
   else :
    if 75 - 75: i1i1i1111I . i1iiIII111 + IiIIii11Ii
    iI1111111iI1 = [ 0 ] * 64
    for ii1ii in range ( 0 , len ( i1Oo0OO0oOo0 ) ) :
     iI1111111iI1 [ ii1ii ] = i1Oo0OO0oOo0 [ ii1ii ]
    i1Oo0OO0oOo0 = iI1111111iI1
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  if 49 - 49: Ooo0Ooo
  if 71 - 71: oOo0O00
  return i1Oo0OO0oOo0
  if 61 - 61: ooOOO . i1iiIII111
  if 68 - 68: I1I % I1I * Ii % Oo
 @ staticmethod
 def cmdAdjustTimeByCloudServer ( sn , newtime , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0x30 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  i1Oo0OO0oOo0 [ 1 ] = 0x30
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  I111II1II111I = time . localtime ( time . time ( ) )
  if not ( newtime is None ) :
   I111II1II111I = time . strptime ( newtime ,
 '%Y-%m-%d %H:%M:%S' )
  i1Oo0OO0oOo0 [ 8 ] = WGTools . getBCD ( I111II1II111I . tm_year // 100 )
  i1Oo0OO0oOo0 [ 8 + 1 ] = WGTools . getBCD ( I111II1II111I . tm_year % 100 )
  i1Oo0OO0oOo0 [ 8 + 2 ] = WGTools . getBCD ( I111II1II111I . tm_mon )
  i1Oo0OO0oOo0 [ 8 + 3 ] = WGTools . getBCD ( I111II1II111I . tm_mday )
  i1Oo0OO0oOo0 [ 8 + 4 ] = WGTools . getBCD ( I111II1II111I . tm_hour )
  i1Oo0OO0oOo0 [ 8 + 5 ] = WGTools . getBCD ( I111II1II111I . tm_min )
  i1Oo0OO0oOo0 [ 8 + 6 ] = WGTools . getBCD ( I111II1II111I . tm_sec )
  return i1Oo0OO0oOo0
  if 17 - 17: IIiIIiIi11I1 % IIiIIiIi11I1 % I1Ii1I1 - i1 % oOo0O00
  if 25 - 25: Oo
 @ staticmethod
 def cmdSetControlModeByCloudServer ( sn , doorno , mode , doordelay , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0x30 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  i1Oo0OO0oOo0 [ 1 ] = 0x80
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  i1Oo0OO0oOo0 [ 8 ] = doorno
  i1Oo0OO0oOo0 [ 9 ] = mode
  i1Oo0OO0oOo0 [ 10 ] = doordelay
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  return i1Oo0OO0oOo0
  if 4 - 4: Oo * I1I * Ooo0Ooo % Ooo0Ooo
  if 6 - 6: oOO + I1I * Iii1i
 @ staticmethod
 def cmdGetControlModeByCloudServer ( sn , xid ) :
  ooo = [ 0 ] * 1024
  IiII11 = (
 '820000FFFFFFFF01' , '820000FFFFFFFF02' , '820000FFFFFFFF03' ,
 '820000FFFFFFFF04' )
  o0OooO00 = 0
  while o0OooO00 < len ( IiII11 ) :
   if 42 - 42: Oo
   O000oooO = '17{}0000FFFFFFFF' . format ( IiII11 [ o0OooO00 ] )
   i1Oo0OO0oOo0 = WGCommand . cmdgetComm64X37 ( sn , O000oooO , xid + o0OooO00 )
   ooo [ o0OooO00 * 64 : ( o0OooO00 + 1 ) * 64 ] = i1Oo0OO0oOo0 [ 0 : 64 ]
   o0OooO00 += 1
  return ooo
  if 44 - 44: IIiIIiIi11I1 - OooOoo . OooOoo - iI1iII1I1I1i * i1iiIII111 % iI1iII1I1I1i
  if 53 - 53: I11iiIi11i1I . i1I + i1iiIII111 * oOO % I1I . i1I
 @ staticmethod
 def cmdAdjustTime ( sn , newtime , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0x30 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  i1Oo0OO0oOo0 [ 1 ] = 0x30
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  I111II1II111I = time . localtime ( time . time ( ) )
  if ( not ( newtime == None ) ) :
   I111II1II111I = time . strptime ( newtime ,
 '%Y-%m-%d %H:%M:%S' )
  i1Oo0OO0oOo0 [ 8 ] = WGTools . getBCD ( I111II1II111I . tm_year // 100 )
  i1Oo0OO0oOo0 [ 8 + 1 ] = WGTools . getBCD ( I111II1II111I . tm_year % 100 )
  i1Oo0OO0oOo0 [ 8 + 2 ] = WGTools . getBCD ( I111II1II111I . tm_mon )
  i1Oo0OO0oOo0 [ 8 + 3 ] = WGTools . getBCD ( I111II1II111I . tm_mday )
  i1Oo0OO0oOo0 [ 8 + 4 ] = WGTools . getBCD ( I111II1II111I . tm_hour )
  i1Oo0OO0oOo0 [ 8 + 5 ] = WGTools . getBCD ( I111II1II111I . tm_min )
  i1Oo0OO0oOo0 [ 8 + 6 ] = WGTools . getBCD ( I111II1II111I . tm_sec )
  return i1Oo0OO0oOo0
  if 88 - 88: i1i1i1111I + ooOOO / Iii1i
  if 44 - 44: oOO * i1I / ooo000 % I1Ii1I1
  if 77 - 77: oOo0O00
 @ staticmethod
 def checkCompressSend ( wgCommStatusVal ) :
  oOoOoO = wgCommStatusVal . privilegesAll [ wgCommStatusVal . privilegesSentIndex ]
  O0Ooo = 240
  if wgCommStatusVal . cardbyte8 :
   O0Ooo = 120
  if O0Ooo > wgCommStatusVal . totalPrivilege - wgCommStatusVal . privilegesSentIndex :
   O0Ooo = wgCommStatusVal . totalPrivilege - wgCommStatusVal . privilegesSentIndex
  if O0Ooo > wgCommStatusVal . cardCount :
   O0Ooo = wgCommStatusVal . cardCount
  I111II1II111I = datetime . datetime . now ( )
  OOo0OoOO0OO = len ( oOoOoO )
  for ii1ii in range ( 1 , O0Ooo ) :
   ooO0o = wgCommStatusVal . privilegesAll [ ii1ii ]
   if 62 - 62: I1I / IIiIIiIi11I1 + I11iiIi11i1I * i1iiIII111 + OooOoo
   if ( ( ( oOoOoO [ 1 ] == ooO0o [ 1 ] )
   or ( ( I111II1II111I >= oOoOoO [ 1 ] ) and ( I111II1II111I >= ooO0o [ 1 ] ) ) )
   # I11iiIi11i1I
   and ( oOoOoO [ 2 : OOo0OoOO0OO ] == next [ 2 : OOo0OoOO0OO ] ) ) :
    pass
   else :
    return False
  return True
  if 87 - 87: Ii / iI1iII1I1I1i
  if 50 - 50: Oo % oOo0O00 . IiI11Ii111 . i1iiIII111 . Ii - Oo
 @ staticmethod
 def cmdgetRunInformationByCloudServer ( sn , xid ) :
  ooo = [ 0 ] * 1024
  IiII11 = (
 '20' , '58' , 'B4' , '94' , '820000FFFFFFFF01' , '820000FFFFFFFF02' , '820000FFFFFFFF03' ,
 '820000FFFFFFFF04' )
  o0OooO00 = 0
  while o0OooO00 < len ( IiII11 ) :
   if 67 - 67: oOo0O00 * i1I . I1I + I1I + oOo0O00 / ooOOO
   O000oooO = '17{}0000FFFFFFFF' . format ( IiII11 [ o0OooO00 ] )
   i1Oo0OO0oOo0 = WGCommand . cmdgetComm64X37 ( sn , O000oooO , xid + o0OooO00 )
   ooo [ o0OooO00 * 64 : ( o0OooO00 + 1 ) * 64 ] = i1Oo0OO0oOo0 [ 0 : 64 ]
   o0OooO00 += 1
  return ooo
  if 69 - 69: Oo - OooOoo + I1Ii1I1
 @ staticmethod
 def cmdgetConfigure1024ByCloudServer ( sn , xid ) :
  ooo = [ 0 ] * 1024
  ooo [ 0 ] = CMDTYPE_37
  ooo [ 1 ] = 0xF4
  WGTools . longToByte ( sn , ooo , 4 , 4 )
  WGTools . longToByte ( xid , ooo , 40 , 4 )
  ooo [ 64 + 4 ] = 0x55
  ooo [ 65 + 4 ] = 0xaa
  ooo [ 66 + 4 ] = 0xaa
  ooo [ 67 + 4 ] = 0x55
  return ooo
  if 36 - 36: Iii1i
 @ staticmethod
 def cmduploadConfigure1024ByCloudServer ( sn , dataNeedUpdate , dataParam ,
 xid ) :
  ooo = [ 0 ] * 1024
  ooo [ 0 ] = CMDTYPE_37
  ooo [ 1 ] = 0xF2
  WGTools . longToByte ( sn , ooo , 4 , 4 )
  WGTools . longToByte ( xid , ooo , 40 , 4 )
  ooo [ 64 + 4 ] = 0x55
  ooo [ 65 + 4 ] = 0xaa
  ooo [ 66 + 4 ] = 0xaa
  ooo [ 67 + 4 ] = 0x55
  if 80 - 80: Oo % oOO / oOO + ooOOO + OooOoo
  if 91 - 91: i1 % i1i1i1111I / oOo0O00
  ooo [ 72 : ( 72 + 64 ) ] = dataNeedUpdate [ 0 : 64 ]
  ooo [ 136 : ( 136 + 512 ) ] = dataParam [ 0 : 512 ]
  return ooo
  if 79 - 79: iI1iII1I1I1i % OooOoo . Iii1i
 @ staticmethod
 def cmdgetControlSeg1024ByCloudServer ( sn , controlseglist , start , xid ) :
  if start >= len ( controlseglist ) :
   return None
  ooo = [ 0 ] * 1024
  o0OooO00 = 0
  oOo = len ( controlseglist )
  while o0OooO00 < 16 and o0OooO00 + start < oOo :
   ooo [ 0 + 64 * o0OooO00 ] = CMDTYPE_37
   ooo [ 1 + 64 * o0OooO00 ] = 0x98
   ooo [ 8 + 64 * o0OooO00 ] = controlseglist [ start + o0OooO00 ] [ 8 ]
   WGTools . longToByte ( sn , ooo , 4 + 64 * o0OooO00 , 4 )
   WGTools . longToByte ( xid , ooo , 40 + 64 * o0OooO00 , 4 )
   o0OooO00 += 1
  return ooo
  if 12 - 12: I1Ii1I1 - IiI11Ii111 * iI1iII1I1I1i % IiI11Ii111
 @ staticmethod
 def cmdclearControlSeg64ByCloudServer ( sn , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0x8A , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  i1Oo0OO0oOo0 [ 1 ] = 0x8A
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  II1 = 0x55AAAA55
  WGTools . longToByte ( II1 , i1Oo0OO0oOo0 , 8 , 4 )
  return i1Oo0OO0oOo0
  if 46 - 46: I1I + oOO * i1i1i1111I
 @ staticmethod
 def cmduploadControlSeg1024ByCloudServer ( sn , controlseglist , start , xid ) :
  if start >= len ( controlseglist ) :
   return None
  ooo = [ 0 ] * 1024
  o0OooO00 = 0
  oOo = len ( controlseglist )
  while o0OooO00 < 16 and o0OooO00 + start < oOo :
   ooo [ 0 + 64 * o0OooO00 ] = CMDTYPE_37
   ooo [ 1 + 64 * o0OooO00 ] = 0x88
   ooo [ 8 + 64 * o0OooO00 : 36 + 1 + 64 * o0OooO00 ] = controlseglist [ start + o0OooO00 ] [ 8 : 36 + 1 ]
   WGTools . longToByte ( sn , ooo , 4 + 64 * o0OooO00 , 4 )
   WGTools . longToByte ( xid + o0OooO00 , ooo , 40 + 64 * o0OooO00 , 4 )
   o0OooO00 += 1
  return ooo
  if 97 - 97: OooOoo % iI1iII1I1I1i . iI1iII1I1I1i . oOo0O00
  if 88 - 88: iI1iII1I1I1i * i1 - OooOoo / ooOOO % ooo000 + I1Ii1I1
 @ staticmethod
 def cmdgetrecord1024_960ByCloudServer ( sn , recordIndexToGetStart , xid , spec = 0 ) :
  ooo = [
 0 ] * 1024
  ii1ii = 0
  i1Oo0OO0oOo0 = WGCommand . cmdgetrecord64ByCloudServer ( sn , recordIndexToGetStart + ii1ii , xid + ii1ii )
  if spec > 0 :
   WGTools . longToByte ( spec , i1Oo0OO0oOo0 , 4 + 8 , 4 )
  for o0oO in range ( 0 , 64 ) :
   ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  ooo [ 64 ] = 0xaa
  ooo [ 65 ] = 0x55
  ooo [ 66 ] = 0x02
  ooo [ 67 ] = 0x99
  return ooo
  if 90 - 90: i1iiIII111 + IIiIIiIi11I1 - i1i1i1111I . Oo - IIiIIiIi11I1 + iI1iII1I1I1i
 @ staticmethod
 def cmdgetControlSegmentInfoByIndex1024ByCloudServer ( sn , IndexStart , xid ) :
  if 22 - 22: IiI11Ii111 + OooOoo % I11iiIi11i1I
  if IndexStart > 254 :
   return None
  ooo = [ 0 ] * 1024
  o0OooO00 = 0
  if 14 - 14: Oo * oOO + i1i1i1111I * oOo0O00
  oo00oo0Oo0O = xid
  while o0OooO00 < 16 :
   ooo [ 0 + 64 * o0OooO00 ] = CMDTYPE_37
   ooo [ 1 + 64 * o0OooO00 ] = 0x98
   WGTools . longToByte ( IndexStart + o0OooO00 , ooo , 8 + 64 * o0OooO00 , 4 )
   WGTools . longToByte ( sn , ooo , 4 + 64 * o0OooO00 , 4 )
   WGTools . longToByte ( oo00oo0Oo0O , ooo , 40 + 64 * o0OooO00 , 4 )
   o0OooO00 += 1
   oo00oo0Oo0O += 1
   if IndexStart + o0OooO00 > 254 :
    break
  return ooo
  if 69 - 69: i1I - i1 - i1 % oOO
 @ staticmethod
 def cmdclearAllcontrolseg64ByCloudServer ( sn , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0x8A , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x55 , 0xaa , 0xaa , 0x55 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  return i1Oo0OO0oOo0
  if 21 - 21: i1i1i1111I - I1I + i1I * Ooo0Ooo
 @ staticmethod
 def cmdcleartasklist64ByCloudServer ( sn , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0xA6 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x55 , 0xaa , 0xaa , 0x55 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  return i1Oo0OO0oOo0
  if 56 - 56: oOO + i1 * i1i1i1111I / i1I * IIiIIiIi11I1
 @ staticmethod
 def cmdrefreshtasklist64ByCloudServer ( sn , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0xAC , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x55 , 0xaa , 0xaa , 0x55 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  return i1Oo0OO0oOo0
  if 15 - 15: iI1iII1I1I1i % oOO + iI1iII1I1I1i . oOo0O00 / ooo000
 @ staticmethod
 def cmdEraseFlash4PrivilegeByCloudServer ( sn , validprivlen , xid ) :
  if 9 - 9: IiI11Ii111 . i1iiIII111 - Ii - I1I . OooOoo
  ooo = [
 0 ] * 1024
  if not validprivlen % 512 == 0 :
   return None
  if validprivlen == 0 :
   return None
  iiI1II11Iii1 = validprivlen * 8
  I11IIiiI1 = [ iiI1II11Iii1 , iiI1II11Iii1 + 4096 , iiI1II11Iii1 + 800 * 1024 , iiI1II11Iii1 + 800 * 1024 + 4096 ]
  for ii1ii in range ( 0 , 4 ) :
   i1Oo0OO0oOo0 = WGCommand . cmdEraseFlash4Privilege64ByCloudServer ( sn , I11IIiiI1 [ ii1ii ] , xid + ii1ii )
   for o0oO in range ( 0 , 64 ) :
    ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
  return ooo
  if 41 - 41: oOo0O00 % IiIIii11Ii - i1i1i1111I
 @ staticmethod
 def cmdEraseFlash4Privilege64ByCloudServer ( sn , flashloc , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0xba , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x55 , 0xaa , 0xaa , 0x55 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( flashloc , i1Oo0OO0oOo0 , 12 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  return i1Oo0OO0oOo0
  if 75 - 75: IiI11Ii111
  if 66 - 66: oOo0O00 / IiIIii11Ii . Ii % 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
 @ staticmethod
 def cmduploadAllcontrolseg1024PostByCloudServer ( sn , controlsegList , cardCount , indexOfcontrolseg , xid ,
 totalcontrolsegs ,
 sentcontrolsegs ) :
  ooo = [
 0 ] * 1024
  for ii1ii in range ( 0 , 16 ) :
   if controlsegList [ indexOfcontrolseg + ii1ii ] [ 0 ] > 254 :
    if ii1ii == 0 :
     return None
    break
   i1Oo0OO0oOo0 = WGCommand . cmduploadAllcontrolseg64ByCloudServer ( sn , controlsegList [ indexOfcontrolseg + ii1ii ] , xid + ii1ii )
   for o0oO in range ( 0 , 64 ) :
    ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
   if ( indexOfcontrolseg + ii1ii + 1 >= cardCount ) :
    if ( ii1ii == 0 ) :
     return i1Oo0OO0oOo0
    break
  return ooo
  if 94 - 94: IiIIii11Ii - oOo0O00 + I1Ii1I1
 @ staticmethod
 def cmduploadAllcontrolseg64ByCloudServer ( sn , currentvalOfcontrolseg , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0x88 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  i1Oo0OO0oOo0 [ 8 ] = currentvalOfcontrolseg [ 0 ]
  i1Oo0OO0oOo0 [ 5 + 4 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 1 ] . year // 100 )
  i1Oo0OO0oOo0 [ 5 + 5 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 1 ] . year % 100 )
  i1Oo0OO0oOo0 [ 5 + 6 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 1 ] . month )
  i1Oo0OO0oOo0 [ 5 + 7 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 1 ] . day )
  i1Oo0OO0oOo0 [ 9 + 4 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 2 ] . year // 100 )
  i1Oo0OO0oOo0 [ 9 + 5 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 2 ] . year % 100 )
  i1Oo0OO0oOo0 [ 9 + 6 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 2 ] . month )
  i1Oo0OO0oOo0 [ 9 + 7 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 2 ] . day )
  for I1Ii1I1i1i1I1 in range ( 7 ) :
   i1Oo0OO0oOo0 [ 17 + I1Ii1I1i1i1I1 ] = currentvalOfcontrolseg [ I1Ii1I1i1i1I1 + 3 ]
  for Iii1iIIi1 in range ( 6 ) :
   i1Oo0OO0oOo0 [ 24 + 2 * Iii1iIIi1 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 10 + Iii1iIIi1 ] . hour )
   i1Oo0OO0oOo0 [ 24 + 2 * Iii1iIIi1 + 1 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 10 + Iii1iIIi1 ] . minute )
  i1Oo0OO0oOo0 [ 36 ] = currentvalOfcontrolseg [ 16 ]
  i1Oo0OO0oOo0 [ 47 ] = currentvalOfcontrolseg [ 17 ]
  if 36 - 36: Iii1i + Oo * IiI11Ii111
  i1Oo0OO0oOo0 [ 37 ] = currentvalOfcontrolseg [ 18 ]
  i1Oo0OO0oOo0 [ 38 ] = currentvalOfcontrolseg [ 19 ]
  i1Oo0OO0oOo0 [ 39 ] = currentvalOfcontrolseg [ 20 ]
  i1Oo0OO0oOo0 [ 44 ] = currentvalOfcontrolseg [ 21 ]
  i1Oo0OO0oOo0 [ 45 ] = currentvalOfcontrolseg [ 22 ]
  i1Oo0OO0oOo0 [ 46 ] = currentvalOfcontrolseg [ 23 ]
  return i1Oo0OO0oOo0
  if 23 - 23: OooOoo * iI1iII1I1I1i * I1Ii1I1 + i1 + IIiIIiIi11I1
 @ staticmethod
 def cmduploadAlltasklist64ByCloudServer ( sn , currentvalOftasklist , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0xA8 , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  i1Oo0OO0oOo0 [ 8 ] = WGTools . getBCD ( currentvalOftasklist [ 1 ] . year // 100 )
  i1Oo0OO0oOo0 [ 9 ] = WGTools . getBCD ( currentvalOftasklist [ 1 ] . year % 100 )
  i1Oo0OO0oOo0 [ 10 ] = WGTools . getBCD ( currentvalOftasklist [ 1 ] . month )
  i1Oo0OO0oOo0 [ 11 ] = WGTools . getBCD ( currentvalOftasklist [ 1 ] . day )
  i1Oo0OO0oOo0 [ 12 ] = WGTools . getBCD ( currentvalOftasklist [ 2 ] . year // 100 )
  i1Oo0OO0oOo0 [ 13 ] = WGTools . getBCD ( currentvalOftasklist [ 2 ] . year % 100 )
  i1Oo0OO0oOo0 [ 14 ] = WGTools . getBCD ( currentvalOftasklist [ 2 ] . month )
  i1Oo0OO0oOo0 [ 15 ] = WGTools . getBCD ( currentvalOftasklist [ 2 ] . day )
  for I1Ii1I1i1i1I1 in range ( 7 ) :
   i1Oo0OO0oOo0 [ 16 + I1Ii1I1i1i1I1 ] = currentvalOftasklist [ I1Ii1I1i1i1I1 + 3 ]
  i1Oo0OO0oOo0 [ 23 ] = WGTools . getBCD ( currentvalOftasklist [ 0 ] . hour )
  i1Oo0OO0oOo0 [ 24 ] = WGTools . getBCD ( currentvalOftasklist [ 0 ] . minute )
  if 24 - 24: i1iiIII111 . OooOoo . OooOoo % Ooo0Ooo - ooo000
  i1Oo0OO0oOo0 [ 25 ] = currentvalOftasklist [ 10 ]
  i1Oo0OO0oOo0 [ 26 ] = currentvalOftasklist [ 11 ]
  i1Oo0OO0oOo0 [ 27 ] = currentvalOftasklist [ 12 ]
  return i1Oo0OO0oOo0
  if 31 - 31: I1Ii1I1 - i1I / IiIIii11Ii * ooOOO . Ii . I1Ii1I1
 @ staticmethod
 def cmdgetrecord1024_64byteByCloudServer ( sn , recordIndexToGetStart , recordIndexToGetEnd , xid ) :
  ooo = [
 0 ] * 1024
  ii1ii = 0
  i1Oo0OO0oOo0 = WGCommand . cmdgetrecord64ByCloudServer ( sn , recordIndexToGetStart + ii1ii , xid + ii1ii )
  OOO00oO00 = int ( ( recordIndexToGetEnd - recordIndexToGetStart ) / 15 ) + 1
  for ii1ii in range ( 0 , 16 ) :
   WGTools . longToByte ( recordIndexToGetStart + ii1ii * OOO00oO00 , i1Oo0OO0oOo0 , 8 , 4 )
   if ii1ii == 15 :
    WGTools . longToByte ( recordIndexToGetEnd , i1Oo0OO0oOo0 , 8 , 4 )
   if ii1ii == 0 :
    WGTools . longToByte ( recordIndexToGetStart , i1Oo0OO0oOo0 , 8 , 4 )
   for o0oO in range ( 0 , 64 ) :
    ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
    if 50 - 50: OooOoo + Ooo0Ooo % oOo0O00 . iI1iII1I1I1i
  return ooo
  if 49 - 49: I11iiIi11i1I + Ii * oOO . IiIIii11Ii * IiI11Ii111 - ooOOO
 @ staticmethod
 def cmduploadAllHolidayConfig1024PostByCloudServer ( sn , controlsegList , cardCount , indexOfcontrolseg ,
 xid ) :
  ooo = [ 0 ] * 1024
  for ii1ii in range ( 0 , 16 ) :
   i1Oo0OO0oOo0 = WGCommand . cmduploadAllHolidayConfig64ByCloudServer ( sn , controlsegList [ indexOfcontrolseg + ii1ii ] , xid + ii1ii )
   for o0oO in range ( 0 , 64 ) :
    ooo [ ii1ii * 64 + o0oO ] = i1Oo0OO0oOo0 [ o0oO ]
   if indexOfcontrolseg + ii1ii + 1 >= cardCount :
    if ( ii1ii == 0 ) :
     return i1Oo0OO0oOo0
    break
  return ooo
  if 43 - 43: Oo + i1I + ooo000
 @ staticmethod
 def cmduploadAllHolidayConfig64ByCloudServer ( sn , currentvalOfcontrolseg , xid ) :
  i1Oo0OO0oOo0 = [ 0x17 , 0xCC , 0x00 , 0x00 , 0xFF , 0xFF , 0xFF , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  i1Oo0OO0oOo0 [ 8 ] = currentvalOfcontrolseg [ 0 ]
  i1Oo0OO0oOo0 [ 5 + 4 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 1 ] . year // 100 )
  i1Oo0OO0oOo0 [ 5 + 5 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 1 ] . year % 100 )
  i1Oo0OO0oOo0 [ 5 + 6 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 1 ] . month )
  i1Oo0OO0oOo0 [ 5 + 7 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 1 ] . day )
  i1Oo0OO0oOo0 [ 5 + 8 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 1 ] . hour )
  i1Oo0OO0oOo0 [ 5 + 9 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 1 ] . minute )
  if 60 - 60: i1 * i1I * I11iiIi11i1I / I1Ii1I1 + oOO + Iii1i
  i1Oo0OO0oOo0 [ 11 + 4 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 2 ] . year // 100 )
  i1Oo0OO0oOo0 [ 11 + 5 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 2 ] . year % 100 )
  i1Oo0OO0oOo0 [ 11 + 6 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 2 ] . month )
  i1Oo0OO0oOo0 [ 11 + 7 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 2 ] . day )
  i1Oo0OO0oOo0 [ 11 + 8 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 2 ] . hour )
  i1Oo0OO0oOo0 [ 11 + 9 ] = WGTools . getBCD ( currentvalOfcontrolseg [ 2 ] . minute )
  return i1Oo0OO0oOo0
  if 87 - 87: i1i1i1111I
  if 2 - 2: I11iiIi11i1I . iI1iII1I1I1i . i1 + oOo0O00
 @ staticmethod
 def cmdgetCommFromUARTInfo ( sn , strCommCommand , xid ) :
  if 33 - 33: Iii1i . IiI11Ii111
  try :
   if type ( strCommCommand ) is str :
    i1i11i1ii1i = bytearray ( binascii . unhexlify ( strCommCommand . replace ( " " , "" ) ) )
   else :
    i1i11i1ii1i = bytearray ( binascii . unhexlify ( strCommCommand ) )
  except Exception as iIi1I1I :
   pass
   print ( iIi1I1I )
   return None
   if 49 - 49: i1I * Oo / I1Ii1I1 * oOo0O00 + i1i1i1111I - iI1iII1I1I1i
  i1Oo0OO0oOo0 = [ 0 ] * 64
  if 36 - 36: i1iiIII111 * I1Ii1I1 + ooOOO . Ii
  if len ( i1i11i1ii1i ) >= 1024 - 64 - 64 :
   return None
   if 49 - 49: Ii + ooOOO + iI1iII1I1I1i / i1i1i1111I
  if len ( i1i11i1ii1i ) <= 30 :
   i1Oo0OO0oOo0 [ 8 ] = len ( i1i11i1ii1i )
   for ii1ii in range ( 0 , len ( i1i11i1ii1i ) ) :
    i1Oo0OO0oOo0 [ ii1ii + 8 + 2 ] = i1i11i1ii1i [ ii1ii ]
  else :
   i1Oo0OO0oOo0 = [ 0 ] * 1024
   i1Oo0OO0oOo0 [ 8 ] = ( len ( i1i11i1ii1i ) & 0xff )
   i1Oo0OO0oOo0 [ 9 ] = ( ( len ( i1i11i1ii1i ) >> 8 ) & 0xff )
   for ii1ii in range ( 0 , len ( i1i11i1ii1i ) ) :
    i1Oo0OO0oOo0 [ ii1ii + 8 + 64 ] = i1i11i1ii1i [ ii1ii ]
  i1Oo0OO0oOo0 [ 0 ] = CMDTYPE_37
  i1Oo0OO0oOo0 [ 1 ] = 0x24
  WGTools . longToByte ( sn , i1Oo0OO0oOo0 , 4 , 4 )
  WGTools . longToByte ( xid , i1Oo0OO0oOo0 , 40 , 4 )
  return i1Oo0OO0oOo0
  if 63 - 63: ooo000 % I1Ii1I1
 @ staticmethod
 def cmdgetComm1024X37 ( sn , cmdarr , xid ) :
  ooo = [ 0 ] * 1024
  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
  o0OooO00 = 0
  while o0OooO00 < len ( cmdarr ) :
   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 cmdarr [ o0OooO00 ] . startswith ( 'F2' ) or cmdarr [ o0OooO00 ] . startswith ( 'F4' ) :
    O000oooO = '17{}' . format ( cmdarr [ o0OooO00 ] )
   else :
    O000oooO = '17{}0000FFFFFFFF' . format ( cmdarr [ o0OooO00 ] )
   i1Oo0OO0oOo0 = WGCommand . cmdgetComm64X37 ( sn , O000oooO , xid + o0OooO00 )
   ooo [ o0OooO00 * 64 : ( o0OooO00 + 1 ) * 64 ] = i1Oo0OO0oOo0 [ 0 : 64 ]
   o0OooO00 += 1
  return ooo
  if 85 - 85: ooo000 + Oo
  if 81 - 81: IIiIIiIi11I1 + iI1iII1I1I1i . I1I * Ii / Iii1i / i1I
  if 31 - 31: i1i1i1111I - oOo0O00 % oOO - iI1iII1I1I1i
class WGSwipeRecord16PrimByte ( WGSwipeRecord ) :
 def __init__ ( self , data , loc , swipeIndex ) :
  self . controllerSN = struct . unpack_from ( "I" , data , 4 ) [ 0 ]
  if 3 - 3: i1iiIII111
  if 8 - 8: Ii * Oo - I1I
  if 84 - 84: iI1iII1I1I1i % oOO * i1I / i1i1i1111I / OooOoo . IIiIIiIi11I1
  self . recordIndex = struct . unpack_from ( "I" , data , 8 ) [ 0 ]
  self . recordIndex = self . recordIndex + swipeIndex + 1
  if 84 - 84: IIiIIiIi11I1
  i1iii1iIiI1i1 = data [ loc + 12 ]
  iI1 = data [ loc + 13 ]
  if 79 - 79: I1I . Ooo0Ooo
  if 44 - 44: ooo000 * Oo + i1I * OooOoo % I1I + Ii
  IiII1I1 = 0
  IiII1I1 += ( ( i1iii1iIiI1i1 >> 1 ) & 0x01 ) << 2
  IiII1I1 += ( ( i1iii1iIiI1i1 >> 2 ) & 0x01 ) << 1
  IiII1I1 += ( ( iI1 >> 7 ) & 0x01 )
  if 22 - 22: i1I / OooOoo . IiI11Ii111 . ooo000
  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
  Oo0o = [ 0 ] * 32
  if 7 - 7: oOo0O00 + Ooo0Ooo / i1iiIII111 + iI1iII1I1I1i % Oo . Ii
  if IiII1I1 in ( 0 , 1 , 2 , 3 ) :
   Oo0o [ 4 ] = 1
   if IiII1I1 in ( 0 , 2 ) :
    Oo0o [ 5 ] = 1
  elif IiII1I1 == 4 or IiII1I1 == 6 :
   Oo0o [ 4 ] = 2
  elif IiII1I1 == 5 :
   Oo0o [ 4 ] = 3
   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
  o0o0 = struct . unpack_from ( "I" , data , loc ) [ 0 ]
  iII11I11111I = struct . unpack_from ( "I" , data , loc + 4 ) [ 0 ]
  self . recordcurrentval = o0o0 + ( iII11I11111I << 32 )
  if self . recordcurrentval >= 0x8000000000000000 :
   self . recordcurrentval = self . recordcurrentval - 0x10000000000000000
   if 8 - 8: Oo / iI1iII1I1I1i - Ooo0Ooo
  if wgGlobal . IsElevator ( self . controllerSN ) :
   iiiII1 = ( iI1 >> 2 ) & 0x1f
   iiiII1 = ( i1iii1iIiI1i1 & 0xE0 ) + iiiII1
   Oo0o [ 6 ] = iiiII1
   Oo0o [ 7 ] = 1
  elif i1iii1iIiI1i1 & REC_BIDIRECTION :
   if 22 - 22: oOo0O00 / I1Ii1I1 % IiI11Ii111
   if Oo0o [ 4 ] == 1 :
    Oo0o [ 6 ] = ( ( iI1 >> 1 ) & 0x01 ) + 1
    Oo0o [ 7 ] = ( iI1 & 0x01 ) + 1
   elif self . recordcurrentval == 0x0A :
    if 22 - 22: i1 % Ooo0Ooo . IIiIIiIi11I1 % i1I / IIiIIiIi11I1
    Oo0o [ 6 ] = ( ( iI1 >> 1 ) & 0x01 ) + 1
    Oo0o [ 7 ] = ( iI1 & 0x01 ) + 1
   elif ( IiII1I1 == 6 ) and ( iI1 & 0x4 ) > 0 :
    Oo0o [ 6 ] = ( iI1 & 0x01 ) + 1
    Oo0o [ 7 ] = 2
   else :
    if 60 - 60: Ooo0Ooo . i1 * i1
    Oo0o [ 6 ] = ( iI1 & 0x01 ) + 1
    Oo0o [ 7 ] = 1
  else :
   Oo0o [ 6 ] = ( iI1 & 0x3 ) + 1
   Oo0o [ 7 ] = 1
   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
  self . recordType = Oo0o [ 4 ]
  if 48 - 48: IIiIIiIi11I1 - I11iiIi11i1I % Oo
  if 61 - 61: oOO % iI1iII1I1I1i + IiIIii11Ii % i1i1i1111I * iI1iII1I1I1i / i1i1i1111I
  if 11 - 11: oOo0O00 / Oo . ooOOO / Oo
  self . recordValid = Oo0o [ 5 ]
  if 90 - 90: OooOoo - I1I
  if 67 - 67: oOo0O00 . oOO - IIiIIiIi11I1 / Ooo0Ooo + Iii1i - oOo0O00
  if 25 - 25: Iii1i
  self . recordDoorNO = Oo0o [ 6 ]
  if 30 - 30: i1iiIII111 * i1I - i1iiIII111 + i1I - I11iiIi11i1I
  if 71 - 71: oOo0O00 - OooOoo % I1Ii1I1 + ooOOO
  if 30 - 30: oOo0O00 + OooOoo . oOo0O00 + iI1iII1I1I1i
  self . recordInOrOut = Oo0o [ 7 ]
  if 22 - 22: oOO / I1Ii1I1 + OooOoo / i1 / Oo
  if 6 - 6: OooOoo % ooOOO - IiIIii11Ii
  if 24 - 24: Ii % i1iiIII111
  oO0o0Oo = int ( data [ loc + 8 + 0 ] | ( data [ loc + 8 + 1 ] << 8 ) )
  IiIIii111 = int ( data [ loc + 8 + 2 ] | ( data [ loc + 8 + 3 ] << 8 ) )
  OO00o00OO = int ( ( IiIIii111 & 0x1F ) << 1 )
  OO00o00OO = int ( OO00o00OO + ( ( OO00o00OO - ( OO00o00OO % 10 ) ) / 10 ) * 6 )
  if 89 - 89: IIiIIiIi11I1
  i1iIiI1iIIiI = int ( ( ( IiIIii111 >> 5 ) & 0x3F ) )
  i1iIiI1iIIiI = int ( i1iIiI1iIIiI + ( ( i1iIiI1iIIiI - ( i1iIiI1iIIiI % 10 ) ) / 10 ) * 6 )
  if 8 - 8: I1I * I11iiIi11i1I % ooOOO / Iii1i / i1i1i1111I
  oOoOO000o0 = int ( IiIIii111 >> 11 )
  oOoOO000o0 = int ( oOoOO000o0 + ( ( oOoOO000o0 - ( oOoOO000o0 % 10 ) ) / 10 ) * 6 )
  if 47 - 47: Ooo0Ooo / ooo000 + Iii1i + oOo0O00
  OO0oo0 = int ( oO0o0Oo & 0x1F )
  OO0oo0 = int ( OO0oo0 + ( ( OO0oo0 - ( OO0oo0 % 10 ) ) / 10 ) * 6 )
  if 57 - 57: iI1iII1I1I1i - I1Ii1I1 + Ooo0Ooo * Ooo0Ooo * i1I / IiI11Ii111
  iII1I = int ( ( oO0o0Oo >> 5 ) & 0x0F )
  iII1I = int ( iII1I + ( ( iII1I - ( iII1I % 10 ) ) / 10 ) * 6 )
  if 9 - 9: i1i1i1111I - Ooo0Ooo . ooOOO * I1Ii1I1 - oOO
  ooOO0 = int ( ( oO0o0Oo >> 9 ) )
  ooOO0 = int ( ooOO0 + ( ( ooOO0 - ( ooOO0 % 10 ) ) / 10 ) * 6 )
  if ( i1iii1iIiI1i1 ) & REC_SECOND :
   OO00o00OO = OO00o00OO | 1
  Oo0o [ 12 ] = 0x20
  Oo0o [ 13 ] = ooOO0
  Oo0o [ 14 ] = iII1I
  Oo0o [ 15 ] = OO0oo0
  Oo0o [ 16 ] = oOoOO000o0
  Oo0o [ 17 ] = i1iIiI1iIIiI
  Oo0o [ 18 ] = OO00o00OO
  Oo0o [ 19 ] = getReason ( iI1 , i1iii1iIiI1i1 , self . recordcurrentval )
  if Oo0o [ 19 ] in ( 20 , 25 , 44 ) :
   Oo0o [ 5 ] = 1
  elif ( Oo0o [ 19 ] == 29 ) or ( Oo0o [ 19 ] == 28 ) :
   Oo0o [ 6 ] = 1
   if 63 - 63: oOo0O00
   if 75 - 75: oOO - iI1iII1I1I1i * i1
   if 4 - 4: OooOoo
   if 34 - 34: IIiIIiIi11I1 * oOo0O00 . Ooo0Ooo
   if 23 - 23: i1 * Oo . IIiIIiIi11I1 + i1i1i1111I
   if 77 - 77: i1I + i1I - ooOOO - IIiIIiIi11I1 * Oo * IiIIii11Ii
   if 66 - 66: Iii1i % I1Ii1I1 + Ii % i1iiIII111 / OooOoo - IiIIii11Ii
   if 21 - 21: ooOOO
   if 47 - 47: IiIIii11Ii * oOo0O00 . I11iiIi11i1I + i1i1i1111I
   if 66 - 66: I1Ii1I1 * Oo
   if 77 - 77: i1iiIII111 % i1iiIII111
  I11i = "{0:0>2X}{1:0>2X}-{2:0>2X}-{3:0>2X} {4:0>2X}:{5:0>2X}:{6:0>2X}" . format ( Oo0o [ 0 - 8 + 20 ] ,
 Oo0o [ 0 - 8 + 21 ] ,
 Oo0o [ 0 - 8 + 22 ] ,
 Oo0o [ 0 - 8 + 23 ] ,
 Oo0o [ 0 - 8 + 24 ] ,
 Oo0o [ 0 - 8 + 25 ] ,
 Oo0o [ 0 - 8 + 26 ] )
  if 88 - 88: IiIIii11Ii + oOO . i1I
  try :
   self . recordTime = datetime . datetime . strptime ( I11i , "%Y-%m-%d %H:%M:%S" )
  except Exception as iIi1I1I :
   pass
   self . recordTime = datetime . datetime . strptime ( "2000-01-19 19:19:19" ,
 "%Y-%m-%d %H:%M:%S" )
   if 46 - 46: OooOoo . I11iiIi11i1I
   if 37 - 37: Ooo0Ooo - I1Ii1I1 + Oo
   if 28 - 28: i1 % I1I
   if 72 - 72: I11iiIi11i1I * oOO % Oo * iI1iII1I1I1i - i1i1i1111I
  self . reason = Oo0o [ 0 - 8 + 27 ]
  self . option = [ 0 , 0 , 0 , 0 ]
  if 15 - 15: IIiIIiIi11I1 . IiIIii11Ii
  if 40 - 40: OooOoo + IiI11Ii111 - i1iiIII111 % oOo0O00 / Oo . i1
EVENTYPE_BUTTON_OPENDOOR = 1
EVENTYPE_BUTTON_SWITCH_OPEN = 2
EVENTYPE_BUTTON_SWITCH_CLOSE = 3
EVENTYPE_REMOTEOPEN_OPENDOOR = 3
EVENTYPE_REMOTEOPEN_SWITCH_OPEN = 4
EVENTYPE_REMOTEOPEN_SWITCH_CLOSE = 5
EVENTYPE_CARDREAD_OPENDOOR = ( 0 << 4 )
EVENTYPE_CARDREAD_SWITCH_OPEN = ( 1 << 4 )
EVENTYPE_CARDREAD_SWITCH_CLOSE = ( 2 << 4 )
CARDTYPE_WIEGAND26 = 0
CARDTYPE_WIEGAND4BYTE = ( 1 << 0 )
REC_CARD = 0
REC_CARD_BITLOC = 1
REC_EVENT = ( 1 << 1 )
REC_EVENT_REMOTEOPENDOOR = ( 1 << 2 )
REC_SECOND = ( 1 << 3 )
REC_BIDIRECTION = ( 1 << 4 )
CARDRECORD_10BYTE = ( 1 << 2 )
EVENTYPE_SUPERPASSWORD_OPENDOOR = 0x0A
EVENTYPE_SUPERPASSWORD_SWITCH_OPEN = 0x0B
EVENTYPE_SUPERPASSWORD_SWITCH_CLOSE = 0x0C
if 17 - 17: i1 / OooOoo + OooOoo / Ooo0Ooo . Oo * i1i1i1111I
EVENTYPE_XPPASSWORD_OPENDOOR = 0x51
EVENTYPE_XPPASSWORD_SWITCH_OPEN = 0x52
EVENTYPE_XPPASSWORD_SWITCH_CLOSE = 0x53
if 3 - 3: Ii - Oo / I11iiIi11i1I . i1I
EVENTYPE_DOOR_OPENTOOLONG = 0x54
EVENTYPE_DOOR_INVALIDOPEN = 0x55
EVENTYPE_CONTROLLER_FIRE = 0x56
EVENTYPE_CONTROLLER_FORCELOCK = 0x57
EVENTYPE_ALARM_SETBYCARD = 0x58
EVENTYPE_ALARM_24HOUR = 0x59
EVENTYPE_ALARM_HELP = 0x5A
SYSCTL_RESC_POR = 0x00000002
STATUS_FAIL = ( 1 << 7 )
if 8 - 8: ooOOO . i1i1i1111I . Iii1i + Oo
if 16 - 16: i1I / I1Ii1I1 / IiIIii11Ii * i1i1i1111I . OooOoo
def getReason ( pmjrecstatus , pmjrecoption , pmjreclngCardId ) :
 Oo000o0 = 0
 ii1i1iIi1i1 = pmjrecstatus
 if 13 - 13: IIiIIiIi11I1 % IiIIii11Ii
 if pmjrecoption & ( 1 << REC_CARD_BITLOC ) :
  if 90 - 90: iI1iII1I1I1i / Oo * IiIIii11Ii / Ooo0Ooo - I1I
  if pmjrecoption & REC_EVENT_REMOTEOPENDOOR :
   if 66 - 66: Oo - i1iiIII111
   Oo000o0 = 44
  else :
   while True :
    if pmjreclngCardId == 0x00 :
     if 16 - 16: I11iiIi11i1I . IIiIIiIi11I1 / oOo0O00 + oOO
     Oo000o0 = 28
     if 93 - 93: i1i1i1111I
     if ii1i1iIi1i1 == 0 :
      pass
     elif ( ii1i1iIi1i1 & ( 0x80 | SYSCTL_RESC_POR ) ) == ( 0x80 | SYSCTL_RESC_POR ) :
      pass
     else :
      Oo000o0 = 29
     break
    if pmjreclngCardId == 0x01 :
     if 42 - 42: ooo000 . iI1iII1I1I1i + oOo0O00 % iI1iII1I1I1i
     Oo000o0 = 20
     break
     if 29 - 29: oOo0O00 - I1I - IIiIIiIi11I1 . IiIIii11Ii * I1Ii1I1
    if pmjreclngCardId == 0x08 :
     if 2 - 2: Oo - iI1iII1I1I1i - i1i1i1111I % OooOoo . ooo000 - i1I
     Oo000o0 = 23
     break
    if pmjreclngCardId == 0x09 :
     if 14 - 14: i1i1i1111I / I1I + I1I + ooo000 % i1 . Ooo0Ooo
     Oo000o0 = 24
     break
    if pmjreclngCardId == 0x0A :
     if pmjrecoption & REC_BIDIRECTION :
      pass
     else :
      pass
      if 93 - 93: i1I + ooOOO % ooo000 * IiIIii11Ii
      if 61 - 61: ooo000 % I11iiIi11i1I - OooOoo + Oo - ooOOO . IIiIIiIi11I1
      if 64 - 64: OooOoo * Iii1i
     Oo000o0 = 25
     break
     if 13 - 13: i1i1i1111I . Iii1i - ooo000 / i1iiIII111 % oOo0O00 / IiI11Ii111
     if 80 - 80: i1i1i1111I
     if 85 - 85: iI1iII1I1I1i - oOo0O00 / IIiIIiIi11I1 * I11iiIi11i1I - ooOOO
     if 70 - 70: oOO % Ii . Ooo0Ooo
     if 16 - 16: i1iiIII111 - iI1iII1I1I1i - Ii - Ii
     if 23 - 23: oOo0O00 * I1Ii1I1 * Ooo0Ooo - oOo0O00 / ooo000
     if 63 - 63: i1I
     if 87 - 87: oOO * oOO * IIiIIiIi11I1 % IIiIIiIi11I1
     if 72 - 72: Ii % ooo000
     if 34 - 34: ooo000 % IiIIii11Ii % i1iiIII111 + Ii
     if 4 - 4: OooOoo . IiIIii11Ii + i1I * i1iiIII111 . ooo000
     if 13 - 13: IiIIii11Ii + IiIIii11Ii - i1 . i1
     if 31 - 31: i1I + i1i1i1111I . Oo + I1Ii1I1 + oOO . i1iiIII111
    if pmjreclngCardId == 0x04 :
     if ( ii1i1iIi1i1 >= 0x80 ) and ( ii1i1iIi1i1 <= 0x83 ) :
      Oo000o0 = 30
     break
    if pmjreclngCardId == 0x05 :
     if ( ii1i1iIi1i1 >= 0x80 ) and ( ii1i1iIi1i1 <= 0x83 ) :
      Oo000o0 = 31
     break
    if pmjreclngCardId == 0x06 :
     if ( ii1i1iIi1i1 >= 0x80 ) and ( ii1i1iIi1i1 <= 0x83 ) :
      Oo000o0 = 32
     break
    if pmjreclngCardId == 0x07 :
     if ( ii1i1iIi1i1 >= 0x80 ) and ( ii1i1iIi1i1 <= 0x83 ) :
      Oo000o0 = 33
     break
    if pmjreclngCardId == 0x51 :
     if ( ii1i1iIi1i1 >= 0x80 ) and ( ii1i1iIi1i1 <= 0x83 ) :
      Oo000o0 = 34
     break
    if pmjreclngCardId == 0x52 :
     if ( ii1i1iIi1i1 >= 0x80 ) and ( ii1i1iIi1i1 <= 0x83 ) :
      Oo000o0 = 35
     break
    if pmjreclngCardId == 0x53 :
     if ( ii1i1iIi1i1 >= 0x80 ) and ( ii1i1iIi1i1 <= 0x83 ) :
      Oo000o0 = 36
     break
    if pmjreclngCardId == 0x54 :
     if ( ii1i1iIi1i1 >= 0x80 ) and ( ii1i1iIi1i1 <= 0x83 ) :
      Oo000o0 = 37
     break
    if pmjreclngCardId == 0x55 :
     if ( ii1i1iIi1i1 >= 0x80 ) and ( ii1i1iIi1i1 <= 0x83 ) :
      Oo000o0 = 38
     break
    if pmjreclngCardId == 0x56 :
     if ii1i1iIi1i1 == 0x80 :
      Oo000o0 = 39
     break
    if pmjreclngCardId == 0x57 :
     if ii1i1iIi1i1 == 0x80 :
      Oo000o0 = 40
     break
    if pmjreclngCardId == 0x58 :
     if ii1i1iIi1i1 == 0x80 :
      Oo000o0 = 41
     break
    if pmjreclngCardId == 0x59 :
     if ii1i1iIi1i1 == 0x80 :
      Oo000o0 = 42
     break
    if pmjreclngCardId == 0x5A :
     if ii1i1iIi1i1 == 0x80 :
      Oo000o0 = 43
     break
     if 5 - 5: Ooo0Ooo * I11iiIi11i1I % ooOOO - Iii1i
     if 90 - 90: Iii1i % ooo000 + ooo000 % i1iiIII111
     if 74 - 74: IIiIIiIi11I1
    Oo000o0 = 255
    break
 else :
  if ( pmjrecstatus & STATUS_FAIL ) == 0 :
   if 13 - 13: I1I * IIiIIiIi11I1 + i1iiIII111 % IiI11Ii111 / IiIIii11Ii + Ooo0Ooo
   if 0 < ii1i1iIi1i1 <= 3 :
    Oo000o0 = 0
   if ii1i1iIi1i1 in ( 0 , 1 , 2 , 3 ) :
    Oo000o0 = 1
    if 26 - 26: i1i1i1111I * I1I % ooOOO + Ii
   if ii1i1iIi1i1 in ( 0x10 , 0x11 , 0x12 , 0x13 ) :
    Oo000o0 = 2
    if 39 - 39: i1 - i1i1i1111I % i1I * i1I . i1iiIII111
   if ii1i1iIi1i1 in ( 0x20 , 0x21 , 0x22 , 0x23 ) :
    Oo000o0 = 3
  else :
   while ( True ) :
    if pmjrecstatus in ( 0x84 , 0x85 , 0x86 , 0x87 ) :
     Oo000o0 = 5
     break
    if pmjrecstatus in ( 0x90 , 0x91 , 0x92 , 0x93 ) :
     Oo000o0 = 6
     break
    if pmjrecstatus in ( 0xA0 , 0xA1 , 0xA2 , 0xA3 ) :
     Oo000o0 = 7
     break
    if pmjrecstatus in ( 0xC4 , 0xC5 , 0xC6 , 0xC7 ) :
     Oo000o0 = 8
     break
    if pmjrecstatus in ( 0xC8 , 0xC9 , 0xCA , 0xCB ) :
     Oo000o0 = 9
     break
    if pmjrecstatus in ( 0xCC , 0xCD , 0xCE , 0xCF ) :
     Oo000o0 = 10
     break
    if pmjrecstatus in ( 0xD0 , 0xD1 , 0xD2 , 0xD3 ) :
     Oo000o0 = 11
     break
    if pmjrecstatus in ( 0xD4 , 0xD5 , 0xD6 , 0xD7 ) :
     Oo000o0 = 12
     break
    if pmjrecstatus in ( 0xD8 , 0xD9 , 0xDA , 0xDB ) :
     Oo000o0 = 13
     break
    if pmjrecstatus in ( 0xDC , 0xDD , 0xDE , 0xDF ) :
     Oo000o0 = 14
     break
    if pmjrecstatus in ( 0xE0 , 0xE1 , 0xE2 , 0xE3 ) :
     Oo000o0 = 15
     break
    if pmjrecstatus in ( 0xE4 , 0xE5 , 0xE6 , 0xE7 ) :
     Oo000o0 = 16
     break
    if pmjrecstatus in ( 0xE8 , 0xE9 , 0xEA , 0xEB ) :
     Oo000o0 = 17
     break
    if True :
     Oo000o0 = 18
     break
 return Oo000o0
 if 35 - 35: i1I
 if 68 - 68: I1I - i1i1i1111I + oOo0O00 * I11iiIi11i1I
class tdz ( object ) :
 if 39 - 39: oOO * I1I + ooo000 - ooOOO
 staticcommand = [ "QueryGateStatus" , "EntryDirectionGateOpen" , "EntryDirectionGateOpenAndHold" , "EntryDirectionGateClose" , "ExitDirectionGateOpen" , "ExitDirectionGateOpenAndHold" , "ExitDirectionGateClose" ,
 "SetGateMode" ,
 "GetGateMode" ,
 "SetPassageDuration" ,
 "DeviceRestart" ,
 "ReadVersionInformation" ,
 "BidirectionalGateClose" ,
 "BidirectionalGateCloseAndHode" ,
 ]
 uartcommand = ( {
 "QueryGateStatus" : "AA 00 01 02 00 02 08 FF 00 00 00 00 00 00 00 0C" ,

 "EntryDirectionGateOpen" : "AA 00 01 02 00 02 08 00 00 00 00 00 00 00 00 0D" ,
 "EntryDirectionGateOpenAndHold" : "AA 00 01 02 00 02 08 00 01 00 00 00 00 00 00 0E" ,
 "EntryDirectionGateClose" : "AA 00 01 02 00 02 08 00 02 00 00 00 00 00 00 0F" ,
 "ExitDirectionGateOpen" : "AA 00 01 02 00 02 08 00 03 00 00 00 00 00 00 10" ,
 "ExitDirectionGateOpenAndHold" : "AA 00 01 02 00 02 08 00 04 00 00 00 00 00 00 11" ,

 "ExitDirectionGateClose" : "AA 00 01 02 00 02 08 00 02 00 00 00 00 00 00 0F" ,

 "SetGateMode" : "AA 00 01 02 06 02 01 GM 00 00 00 00 00 00 00 ss" ,
 "GetGateMode" : "AA 00 01 02 06 02 00 00 00 00 00 00 00 00 00 0B" ,
 "SetPassageDuration" : "AA 00 01 02 07 02 01 GM 00 00 00 00 00 00 00 ss" ,
 # iI1iII1I1I1i % oOO * Iii1i / I11iiIi11i1I * I1Ii1I1
 "DeviceRestart" : "AA 00 01 01 0E 02 01 01 00 00 00 00 00 00 00 14" ,
 "ReadVersionInformation" : "AA 00 01 01 03 02 00 00 00 00 00 00 00 00 00 07" ,

 "BidirectionalGateClose" : "AA 00 01 02 00 02 08 00 02 00 00 00 00 00 00 0F" ,
 "BidirectionalGateCloseAndHode" : "AA 00 01 02 00 02 08 00 05 00 00 00 00 00 00 12" ,
 } )
 if 74 - 74: iI1iII1I1I1i / oOO + Ooo0Ooo % i1I
 uartcommand_testreply = ( {
 "QueryGateStatus" : "AA 00 xx 12 00 00 08 00 00 00 00 00 00 00 00 ss" ,

 "EntryDirectionGateOpen" : "AA 00 02 12 00 00 08 00 00 00 00 00 00 00 00 ss" ,
 "EntryDirectionGateOpenAndHold" : "AA 00 xx 12 00 00 08 00 00 00 00 00 00 00 00 ss" ,
 "EntryDirectionGateClose" : "AA 00 xx 12 00 00 08 00 00 00 00 00 00 00 00 ss" ,
 "ExitDirectionGateOpen" : "AA 00 xx 12 00 00 08 00 00 00 00 00 00 00 00 ss" ,
 "ExitDirectionGateOpenAndHold" : "AA 00 xx 12 00 00 08 00 00 00 00 00 00 00 00 ss" ,
 "ExitDirectionGateClose" : "AA 00 xx 12 00 00 08 00 00 00 00 00 00 00 00 ss" ,
 "SetGateMode" : "AA 00 xx 12 06 00 01 GM 00 00 00 00 00 00 00 ss" ,
 "GetGateMode" : "AA 00 xx 12 06 00 01 GM 00 00 00 00 00 00 00 ss" ,
 "SetPassageDuration" : "AA 00 xx 12 07 00 01 GM 00 00 00 00 00 00 00 ss" ,
 "DeviceRestart" : "AA 00 xx 11 0E 01 02 01 01 00 00 00 00 00 00 ss" ,

 "ReadVersionInformation" : "AA 00 02 11 03 01 08 01 00 5D 1A 01 00 58 D0 C0"
 } )
 if 94 - 94: I11iiIi11i1I . IiIIii11Ii / OooOoo - OooOoo / oOo0O00 * Ooo0Ooo
 @ staticmethod
 def checksum ( uartbytes ) :
  O0oO0oO00 = 0
  for III1IIIi in range ( 14 ) :
   O0oO0oO00 = O0oO0oO00 + uartbytes [ III1IIIi + 1 ]
  O0oO0oO00 = O0oO0oO00 & 0xff
  return O0oO0oO00
  if 31 - 31: Oo / I1I / i1 . oOo0O00
 @ staticmethod
 def getCommand ( webcmd ) :
  OOO0oooOoo = None
  if "BarrierGateCommand" not in webcmd :
   return OOO0oooOoo
  O0o0o0OoooO0 = webcmd [ "BarrierGateCommand" ]
  if O0o0o0OoooO0 in tdz . staticcommand :
   OOO0oooOoo = tdz . uartcommand [ O0o0o0OoooO0 ]
   if "GM" in OOO0oooOoo :
    oO00oO0o = 0
    if "ParameterValue" in webcmd :
     if type ( webcmd [ "ParameterValue" ] ) is int :
      oO00oO0o = webcmd [ "ParameterValue" ]
     elif type ( webcmd [ "ParameterValue" ] ) is str :
      i11i1111IIi = webcmd [ "ParameterValue" ]
      i11i1111IIi = i11i1111IIi . replace ( "，" , ", " )
      if i11i1111IIi in tdz . modeinfo :
       oO00oO0o = tdz . modeinfo . index ( i11i1111IIi ) + 1
    OOO0oooOoo = OOO0oooOoo . replace ( "GM" , WGTools . getHexString1Byte ( oO00oO0o ) )
   if "xx" in OOO0oooOoo :
    OOO0oooOoo = OOO0oooOoo . replace ( "xx" , "02" )
   if "ss" in OOO0oooOoo :
    if 31 - 31: i1iiIII111 . i1I + ooo000 * i1 * Ooo0Ooo
    if 28 - 28: I1Ii1I1 . I1I
    i1i11i1ii1i = bytearray ( binascii . unhexlify ( OOO0oooOoo . replace ( " " , "" ) . replace ( "ss" , "00" ) ) )
    OO0oO0O0 = tdz . checksum ( i1i11i1ii1i )
    OOO0oooOoo = OOO0oooOoo . replace ( "ss" , WGTools . getHexString1Byte ( OO0oO0O0 ) )
    if 15 - 15: Ooo0Ooo % i1 - ooOOO
   pass
   if 19 - 19: IiIIii11Ii - Iii1i + IiI11Ii111
  return OOO0oooOoo
  if 5 - 5: Ii * i1 * oOO + oOo0O00 - IiIIii11Ii * Oo
 statusInfo = [ "Gate closed (idle)" , "Gate closed (fire alarm)" , "Gate closed (power loss)" , "Gate open (idle)" ,
 "Gate open (fire alarm)" , "Gate open (manual)" , "Gate open (entry direction)" , "Gate open (exit direction)" ,
 "Closing in entry direction" , "Closing in exit direction" , "Closing in entry direction (anti-pinch, person detected)" , "Closing in exit direction (anti-pinch, person detected)" ,
 "Opening in entry direction" , "Opening in exit direction" , "Manually pushing open in entry direction" , "Manually pushing open in exit direction" ]
 statusInfoWarn = [ "Loitering alarm" , "Intrusion alarm" , "Reverse direction alarm" , "Tailgating alarm" , "External alarm" ]
 if 69 - 69: ooo000 - Iii1i
 @ staticmethod
 def getTDZStatusDesc ( code ) :
  ii1II1 = ""
  if 51 - 51: i1i1i1111I + oOo0O00 / I1I
  if 21 - 21: i1iiIII111 * Ooo0Ooo * ooOOO . i1i1i1111I
  if 100 - 100: Ooo0Ooo - Ooo0Ooo + I1Ii1I1 . ooOOO
  if 65 - 65: IiIIii11Ii
  if 54 - 54: oOO * i1iiIII111 * Iii1i - I1Ii1I1 . iI1iII1I1I1i
  if 83 - 83: ooo000 . I1I
  if 81 - 81: i1I + Oo . I1Ii1I1
  if 32 - 32: OooOoo * Ooo0Ooo % iI1iII1I1I1i + OooOoo - ooOOO
  if 23 - 23: i1iiIII111 % I1I + Ooo0Ooo . I1Ii1I1 + ooo000 - i1I
  if 29 - 29: Iii1i
  if 72 - 72: i1 % iI1iII1I1I1i . ooOOO / I1Ii1I1 * ooo000 . IiI11Ii111
  if 55 - 55: OooOoo + IiIIii11Ii . i1I / Iii1i . I11iiIi11i1I
  if 56 - 56: 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 code < 16 :
   ii1II1 = tdz . statusInfo [ code ]
  elif 0x5F <= code <= 0x63 :
   ii1II1 = tdz . statusInfoWarn [ code - 0x5f ]
  elif code == 0xFF :
   ii1II1 = "Power-on self-test in progress"
  return ii1II1
  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
 modeinfo = [ "Normally closed, bidirectional card swiping" , "Normally closed, bidirectional free passage" , "Normally closed, bidirectional prohibited" , "Normally closed, entry direction card swiping + exit direction free passage" ,
 "Normally closed, entry direction card swiping + exit direction prohibited" , "Normally closed, entry direction free passage + exit direction card swiping" ,
 "Normally closed, entry direction free passage + exit direction prohibited" , "Normally closed, entry direction prohibited + exit direction free passage" ,
 "Normally closed, entry direction prohibited + exit direction card swiping"
 ]
 if 91 - 91: OooOoo - Oo + Ii + IIiIIiIi11I1 / ooOOO
 @ staticmethod
 def getMode ( code ) :
  ii1II1 = ""
  if code > 0 and code <= 9 :
   ii1II1 = tdz . modeinfo [ code - 1 ]
  return ii1II1
  if 96 - 96: oOo0O00 - IiI11Ii111 + ooOOO
 @ staticmethod
 def parseCommand ( uartbyte ) :
  OOO0oooOoo = None
  while True :
   if uartbyte [ 0 ] != 0xaa :
    break
    if 67 - 67: I1Ii1I1 - IIiIIiIi11I1 + OooOoo
   if uartbyte [ 6 ] == 0x03 and uartbyte [ 7 ] == 0xEE and uartbyte [ 8 ] == 0xEE and uartbyte [ 9 ] == 0xEE :
    OOO0oooOoo = (
 {
 "AbnormalInformation" : "Command not compatible"
 }
 )
    break
   if uartbyte [ 3 ] == 0x12 and uartbyte [ 4 ] == 0x06 :
    OOO0oooOoo = (
 {
 "GateMode" : tdz . getMode ( uartbyte [ 7 ] )
 }
 )
    break
   if uartbyte [ 3 ] == 0x12 and uartbyte [ 4 ] == 0x07 :
    OOO0oooOoo = (
 {
 "PassageDuration(0.1sec)" : uartbyte [ 7 ]
 }
 )
    break
   if uartbyte [ 3 ] == 0x11 and uartbyte [ 4 ] == 0x0e and uartbyte [ 5 ] == 0x01 :
    if 72 - 72: iI1iII1I1I1i * I1I . Ii / I1Ii1I1 / IIiIIiIi11I1 . ooOOO
    OOO0oooOoo = (
 {
 "Operation" : "DeviceRestart"
 }
 )
    break
    if 21 - 21: Ooo0Ooo - IIiIIiIi11I1 . iI1iII1I1I1i . oOO + iI1iII1I1I1i - IIiIIiIi11I1
   if uartbyte [ 3 ] == 0x12 and uartbyte [ 4 ] == 0x00 and uartbyte [ 5 ] == 0x00 and uartbyte [ 6 ] == 0x08 :
    if 15 - 15: Oo / i1i1i1111I + oOo0O00 / I1Ii1I1 / I11iiIi11i1I * ooOOO
    if 73 - 73: I1I % Iii1i % i1I % Ooo0Ooo / i1 . IIiIIiIi11I1
    if 87 - 87: i1iiIII111
    if 4 - 4: Oo * IiIIii11Ii - i1I
    IiiIOO00oOo00OO0 = ( uartbyte [ 7 + 2 ] << 16 ) + ( uartbyte [ 7 + 3 ] << 8 ) + uartbyte [ 7 + 4 ]
    i1O0 = ( uartbyte [ 7 + 5 ] << 16 ) + ( uartbyte [ 7 + 6 ] << 8 ) + uartbyte [ 7 + 7 ]
    III = [ ]
    if uartbyte [ 8 ] & 1 :
     III . append ( "Power loss alarm" )
    if uartbyte [ 8 ] & 2 :
     III . append ( "Tamper alarm" )
    if uartbyte [ 8 ] & 4 :
     III . append ( "Battery under-voltage alarm" )
    if len ( III ) == 0 :
     if 23 - 23: i1i1i1111I - Iii1i
     OOO0oooOoo = (
 {
 "GateStatus" : tdz . getTDZStatusDesc ( uartbyte [ 7 ] ) ,

     "EntryDirectionPassedCount" : IiiIOO00oOo00OO0 ,
 "ExitDirectionPassedCount" : i1O0
 }
 )
    else :
     III = "," . join ( III )
     OOO0oooOoo = (
 {
 "GateStatus" : tdz . getTDZStatusDesc ( uartbyte [ 7 ] ) ,
 "AlarmInformation" : III ,
 "EntryDirectionPassedCount" : IiiIOO00oOo00OO0 ,
 "ExitDirectionPassedCount" : i1O0
 }
 )
    break
   if uartbyte [ 3 ] == 0x11 and uartbyte [ 4 ] == 0x03 and uartbyte [ 5 ] == 0x01 :
    if 27 - 27: ooo000 - oOo0O00
    iII1I1 = [ uartbyte [ 9 ] >> 2 , ( ( uartbyte [ 9 ] & 0x3 ) << 2 ) + ( ( uartbyte [ 10 ] ) >> 6 ) , ( uartbyte [ 10 ] & 0x3F ) ]
    IiI1iIIIII11 = "" . join ( [ '%02d' % i for i in iII1I1 ] )
    oO0oO0Oo = [ uartbyte [ 9 + 4 ] >> 2 , ( ( uartbyte [ 9 + 4 ] & 0x3 ) << 2 ) + ( ( uartbyte [ 10 + 4 ] ) >> 6 ) ,
 ( uartbyte [ 10 + 4 ] & 0x3F ) ]
    I1i111iI1 = "" . join ( [ '%02d' % i for i in oO0oO0Oo ] )
    OOO0oooOoo = (
 {
 "SoftwareVersion" : "{}.{}.{}" . format ( uartbyte [ 7 ] , uartbyte [ 8 ] , IiI1iIIIII11 ) ,
 "HardwareVersion" : "{}.{}.{}" . format ( uartbyte [ 7 + 4 ] , uartbyte [ 8 + 4 ] , I1i111iI1 ) ,
 }
 )
    break
   break
  return OOO0oooOoo
# dd678faae9ac167bc83abf78e5cb2f3f0688d3a3
