import collections
import re
if 82 - 82: Iii1i
from flask_wtf . csrf import CSRFError , generate_csrf
if 87 - 87: Ii % i1i1i1111I . Oo / OooOoo * I1Ii1I1 - I1I
import binascii
import http
import json
import threading
import time
from collections import deque
from datetime import datetime
if 81 - 81: i1 + ooOOO / oOo0O00 * i1iiIII111 * IiIIii11Ii
from flask import Blueprint , render_template , request , g
from sqlalchemy import text
if 84 - 84: ooo000 - Ooo0Ooo + iI1iII1I1I1i . IIiIIiIi11I1
from blueprints . wgcomm_console import WGControllerCenter2023 , sendByHttp , sendByHttpWithMsg
from exts import db
from decorators import login_required
from models . iccard import *
from vwAppConfig import WGTools
from vwAppConfigParam import vwAppConfigParam
import vwAppConfig
if 98 - 98: I11iiIi11i1I % oOO
__all__ = [
 "bp" ,
 "web_console_center_list" ,
 "opendoorSingle" ,
 "web_console_checkcontroller_getselected" ,
 "web_console_remoteopendoor_getselected" ,

# i1I . i1I1
]
if 22 - 22: i1I1 % I1I - oOO
bp = Blueprint ( 'wgcomm_center' , __name__ , url_prefix = '/' )
if 97 - 97: I1I * oOo0O00 * IiIIii11Ii - I11iiIi11i1I - Oo - i1
if 29 - 29: i1iiIII111
if 3 - 3: i1 % i1 % i1i1i1111I . Ii * i1
@ bp . route ( '/console_center' , methods = [ 'GET' , 'POST' ] )
@ login_required
def web_console_center_list ( ) :
 ii1iI1I = db . session . query ( TBDoor . f_DoorID , TBDoor . f_DoorName , TBDoor . f_DoorNO , TBController . f_ControllerSN ,
 TBDoor . f_DoorEnabled ) . filter_by ( f_DoorEnabled = True ) . join ( TBController , TBController . f_ControllerID == TBDoor . f_ControllerID ) . order_by (
 TBDoor . f_DoorName )
 i11IiIIiii1II = ii1iI1I . all ( )
 if 55 - 55: Ii - Oo * ooo000 . i1iiIII111
 if 14 - 14: I1I / oOO
 if 58 - 58: I1Ii1I1 - ooOOO
 if 60 - 60: iI1iII1I1I1i . oOO
 if 13 - 13: oOO
 if 2 - 2: i1
 IIiIiiIiI = {

 "objlistDoor" : i11IiIIiii1II ,
 "deleteUrl" : "/user_del" ,
 "losecardUrl" : "/user_losecard"
 }
 return render_template ( "wgcomm/console-center.html" , ** IIiIiiIiI )
 if 34 - 34: Ooo0Ooo + oOO * IIiIIiIi11I1 * OooOoo
 if 25 - 25: Ii / oOO % Ii
 if 96 - 96: Ii . IIiIIiIi11I1 % I11iiIi11i1I
def iiii1i1iIi ( doorDst , op ) :
 if 73 - 73: i1I1 % Ii
 I111IIi11IiI = WGControllerCenter2023 ( )
 if 51 - 51: oOo0O00 * iI1iII1I1I1i
 oO = ""
 for ii1IiIiiII in doorDst :
  oO += str ( ii1IiIiiII ) + ","
 oO += '0'
 if 21 - 21: oOo0O00 % I11iiIi11i1I % oOO . oOo0O00
 ii1iI1I = db . session . query ( TBController . f_ControllerID , TBController . f_ControllerSN , TBDoor . f_DoorNO ,
 TBDoor . f_DoorID ) . join ( TBDoor ,
 TBDoor . f_ControllerID == TBController . f_ControllerID )
 iii11i = ii1iI1I . all ( )
 Oo0Oo00O0OO = dict ( )
 for ii1IiIiiII in iii11i :
  iIIiiIi1Ii1I = ii1IiIiiII . f_ControllerSN
  oo0 = ii1IiIiiII . f_DoorNO
  Oo0Oo00O0OO [ iIIiiIi1Ii1I * 10 + oo0 ] = ii1IiIiiII . f_DoorID
  if ii1IiIiiII . f_DoorID not in I111IIi11IiI . doorIDOperateAll :
   if ii1IiIiiII . f_DoorID in doorDst :
    i11iIii = ii1IiIiiII . f_DoorID
    I111IIi11IiI . doorIDOperateAll . append ( ii1IiIiiII . f_DoorID )
    OO = threading . Thread ( target = op , args = ( iIIiiIi1Ii1I , oo0 , i11iIii , I111IIi11IiI ) )
    OO . start ( )
 iiI1I11iiiiI = time . time ( )
 while time . time ( ) < iiI1I11iiiiI + 10 :
  if len ( I111IIi11IiI . doorIDOperateOK ) + len ( I111IIi11IiI . doorIDOperateFailed ) == len ( I111IIi11IiI . doorIDOperateAll ) :
   break
  time . sleep ( 0.1 )
  if 4 - 4: i1iiIII111 * Ooo0Ooo
 print ( I111IIi11IiI . getswipeSNConnectedOK )
 return { "doorID_OK" : I111IIi11IiI . doorIDOperateOK , "doorID_Fail" : I111IIi11IiI . doorIDOperateFailed , "doorID_Info" : I111IIi11IiI . doorIDOperateInfo }
 if 86 - 86: ooOOO / Oo / Ii - i1 - iI1iII1I1I1i / IiIIii11Ii
 if 40 - 40: Iii1i / I1I
 if 52 - 52: i1i1i1111I + IiIIii11Ii + I11iiIi11i1I
 if 52 - 52: i1iiIII111 % Oo . I1Ii1I1 + ooOOO % Oo . i1I1
@ bp . route ( '/console_remoteopendoor_getselected' , methods = [ 'POST' ] )
@ login_required
def web_console_remoteopendoor_getselected ( ) :
 if 56 - 56: i1iiIII111 * i1I1 - I11iiIi11i1I
 IiIi1Ii1111 = request . form . get ( "selecteddoor" )
 if 95 - 95: I1I * Ooo0Ooo + i1iiIII111 . i1iiIII111 % Oo * oOo0O00
 if len ( IiIi1Ii1111 ) == 0 :
  return "OK"
  if 65 - 65: Ooo0Ooo * ooo000 + oOo0O00
 IiIi1Ii1111 = IiIi1Ii1111 . split ( "," )
 IiIi1Ii1111 = [ int ( x ) for x in IiIi1Ii1111 ]
 IiIi1Ii1111 . sort ( )
 i1I11i11 = iiii1i1iIi ( IiIi1Ii1111 , opendoorSingle )
 vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "{}-remote open door" . format ( "" ) , i1I11i11 ) )
 if 39 - 39: Iii1i % oOo0O00 + Ooo0Ooo / i1I
 print ( "Doors={}" . format ( len ( IiIi1Ii1111 ) ) )
 if 78 - 78: iI1iII1I1I1i + iI1iII1I1I1i - I1I * IIiIIiIi11I1 % I1Ii1I1 * i1i1i1111I
 return i1I11i11
 if 37 - 37: i1I1 * i1i1i1111I + oOo0O00 / I1I / OooOoo
 if 4 - 4: i1
def oO00o00OO ( doorDst ) :
 print ( "console_checkcontroller_getselected" )
 if 52 - 52: Iii1i / Oo
def opendoorSingle ( sn , doorno , conid , wgcondata ) :
 o00O = ( {
 "jsonrpc" : "2.0" ,
 "method" : "RemoteOpenDoor" ,
 "params" : [ { "ControllerSN" : sn , "DoorNO" : doorno } ] ,
 "id" : 1002
 } )
 if sendByHttp ( o00O ) == "OK" :
  if 7 - 7: Oo / OooOoo - I11iiIi11i1I - i1I1 % i1iiIII111
  wgcondata . doorIDOperateOK . append ( conid )
 else :
  wgcondata . doorIDOperateFailed . append ( conid )
  if 97 - 97: I11iiIi11i1I % oOO - I1Ii1I1 - IIiIIiIi11I1
  if 58 - 58: ooOOO / IIiIIiIi11I1 % i1
@ bp . route ( '/console_adjusttime_getselected' , methods = [ 'POST' ] )
@ login_required
def O0O ( ) :
 if 31 - 31: i1iiIII111 + i1i1i1111I % OooOoo
 IiIi1Ii1111 = request . form . get ( "selecteddoor" )
 if 20 - 20: OooOoo - I1I
 if len ( IiIi1Ii1111 ) == 0 :
  return "OK"
  if 9 - 9: i1iiIII111 - iI1iII1I1I1i % Ii - I1I
 IiIi1Ii1111 = IiIi1Ii1111 . split ( "," )
 IiIi1Ii1111 = [ int ( x ) for x in IiIi1Ii1111 ]
 IiIi1Ii1111 . sort ( )
 i1I11i11 = iiii1i1iIi ( IiIi1Ii1111 , O0o0OOoOOOO )
 vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "{}-adjust time" . format ( "" ) , i1I11i11 ) )
 if 69 - 69: oOO * i1 % i1 - Ooo0Ooo + Iii1i - ooo000
 print ( "Doors={}" . format ( len ( IiIi1Ii1111 ) ) )
 if 44 - 44: ooo000 * I1Ii1I1 * OooOoo - oOO % ooo000 . i1I
 return i1I11i11
 if 73 - 73: i1i1i1111I . Ooo0Ooo * iI1iII1I1I1i / Ii / ooo000 + i1iiIII111
def O0o0OOoOOOO ( sn , doorno , conid , wgcondata ) :
 if 28 - 28: i1iiIII111 + ooOOO - ooOOO - i1i1i1111I
 if 61 - 61: oOO
 if 7 - 7: i1i1i1111I / Ii * Iii1i
 if 32 - 32: i1I1 . OooOoo
 if 31 - 31: Oo - i1I
 if 28 - 28: ooOOO * I1Ii1I1 + i1I1 % Oo
 o00O = ( {
 "jsonrpc" : "2.0" ,
 "method" : "AdjustTime" ,
 "params" : [ { "ControllerSN" : sn } ] ,
 "id" : 1002
 } )
 if sendByHttp ( o00O ) == "OK" :
  if 100 - 100: Oo + i1I
  wgcondata . doorIDOperateOK . append ( conid )
 else :
  wgcondata . doorIDOperateFailed . append ( conid )
  if 4 - 4: ooo000 % I1I - i1i1i1111I
  if 76 - 76: i1 * oOo0O00 . i1I1 * i1I . IiIIii11Ii . oOO
  if 55 - 55: i1i1i1111I + i1iiIII111 % Ooo0Ooo . Oo - IiIIii11Ii - iI1iII1I1I1i
@ bp . route ( '/console_checkcontroller_getselected' , methods = [ 'POST' ] )
@ login_required
def web_console_checkcontroller_getselected ( ) :
 if 91 - 91: I1Ii1I1 - I11iiIi11i1I
 IiIi1Ii1111 = request . form . get ( "selecteddoor" )
 if 84 - 84: oOO % iI1iII1I1I1i - Ooo0Ooo
 if len ( IiIi1Ii1111 ) == 0 :
  return "OK"
  if 94 - 94: i1iiIII111 + i1i1i1111I / iI1iII1I1I1i + iI1iII1I1I1i / i1I
 IiIi1Ii1111 = IiIi1Ii1111 . split ( "," )
 IiIi1Ii1111 = [ int ( x ) for x in IiIi1Ii1111 ]
 IiIi1Ii1111 . sort ( )
 i1I11i11 = iiii1i1iIi ( IiIi1Ii1111 , OOooOOOO00O )
 vwAppConfig . vwlog ( '{}--{}[{}]' . format ( g . user . f_OperatorName ,
 "{}-check controller" . format ( "" ) , i1I11i11 ) )
 if 72 - 72: I11iiIi11i1I
 print ( "Doors={}" . format ( len ( IiIi1Ii1111 ) ) )
 if 25 - 25: i1
 return i1I11i11
 if 93 - 93: oOO - IIiIIiIi11I1 / IIiIIiIi11I1 * iI1iII1I1I1i
def OOooOOOO00O ( sn , doorno , conid , wgcondata ) :
 if 3 - 3: oOo0O00
 if 29 - 29: i1 * i1I + IIiIIiIi11I1 + oOO
 if 68 - 68: oOO - IiIIii11Ii + iI1iII1I1I1i
 if 35 - 35: i1 + I1I . i1iiIII111
 if 16 - 16: I1Ii1I1 % I1I / IIiIIiIi11I1 * i1I + i1I1 % oOo0O00
 if 13 - 13: i1 + IiIIii11Ii
 if 23 - 23: oOO . ooOOO / Ii
 if 7 - 7: OooOoo + IIiIIiIi11I1 * Iii1i . oOo0O00 % IIiIIiIi11I1
 if 62 - 62: I1Ii1I1 + ooOOO . Oo - i1i1i1111I
 if 52 - 52: i1I . Ii * OooOoo / i1I
 if 39 - 39: i1
 if 16 - 16: i1I1 - i1I1 % I11iiIi11i1I / iI1iII1I1I1i - iI1iII1I1I1i
 if 39 - 39: oOo0O00 - i1I1 % i1I1 . Oo * I1I
 if 81 - 81: i1i1i1111I + I1Ii1I1
 if 31 - 31: i1i1i1111I % I1Ii1I1
 if 1 - 1: i1I1 - oOo0O00 - i1 . oOo0O00
 if 91 - 91: iI1iII1I1I1i * i1 . ooOOO
 if 81 - 81: I1I * Oo - i1 % OooOoo * ooOOO
 if 19 - 19: Ii
 if 22 - 22: i1I % iI1iII1I1I1i + Oo
 oo0 = doorno
 if 60 - 60: ooo000 + I11iiIi11i1I + IIiIIiIi11I1 % i1i1i1111I - Ii % Ooo0Ooo
 OoiI1iiI11IIi1 = [ 0 ] * 1024
 OOO = [ 0 ] * 1024
 if 53 - 53: Oo + i1iiIII111 / Ooo0Ooo
 if 89 - 89: ooo000 + Ii % i1i1i1111I - i1iiIII111
 if 33 - 33: ooo000 . Iii1i % oOO
 if 60 - 60: I1I . IiIIii11Ii % IIiIIiIi11I1 % iI1iII1I1I1i
 if 98 - 98: I1I
 if 35 - 35: oOo0O00 / IIiIIiIi11I1 - Iii1i . i1I1 * i1
 if 91 - 91: oOO + Iii1i
 if 71 - 71: i1 . iI1iII1I1I1i . OooOoo . IIiIIiIi11I1
 OOOoO0oO = (
 '20' , '58' , 'B4' , '94' , '820000FFFFFFFF01' , '820000FFFFFFFF02' , '820000FFFFFFFF03' , '820000FFFFFFFF04' ,
 'F40000FFFFFFFF55aaaa55f101009a0100ec0100f90100ef01002d0000' )
 if 25 - 25: OooOoo % ooOOO . i1iiIII111 - ooOOO % Iii1i
 O00OoO0OOO0 = 0
 if 98 - 98: iI1iII1I1I1i - I1I + i1 * ooo000 % i1
 o00O = {
 "jsonrpc" : "2.0" ,
 "method" : "Primit64ByteCommand" ,
 "params" : [ { 'ControllerSN' : sn ,
 'CommandPacket' : WGTools . getarrStringWithsplitDou ( OOOoO0oO )
 } ] ,
 "id" : "1005"
 }
 i1I11i11 = sendByHttpWithMsg ( o00O )
 if vwAppConfig . successIsTrue ( i1I11i11 ) :
  if 100 - 100: i1iiIII111 . IIiIIiIi11I1 * ooo000 * ooo000
  if 85 - 85: IIiIIiIi11I1 / OooOoo . i1I % Oo + Oo - I11iiIi11i1I
  ooO0ooOOO00O0 = i1I11i11 [ "ReturnPacket" ]
  OOO = bytearray ( binascii . unhexlify ( ooO0ooOOO00O0 . replace ( " " , "" ) ) )
  if 11 - 11: oOO * i1iiIII111 - IIiIIiIi11I1
 else :
  if 70 - 70: i1I1
  if 9 - 9: oOo0O00 * i1
  if 96 - 96: Ooo0Ooo
  if 13 - 13: Oo * I1Ii1I1 - oOo0O00 * Ii . Ii + oOo0O00
  wgcondata . doorIDOperateFailed . append ( conid )
  return
 if OOO [ 1 ] == 0x20 :
  Ooo0O00o = OOO [ 0 : 64 ]
  if 22 - 22: i1I1 . ooo000
  IiiI1III1iI = (
 "255.255.255.255" , 60000 )
  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
  I1i1I = "OnLine"
  if OOO [ 64 * ( 4 + oo0 - 1 ) + 9 ] == 1 :
   I1i1I = 'NormalOpen'
  if OOO [ 64 * ( 4 + oo0 - 1 ) + 9 ] == 2 :
   I1i1I = 'NormalClosed'
  i1iIIi1I1iiI = OOO [ 64 * ( 4 + oo0 - 1 ) + 10 ]
  try :
   Ooo0 = "20{0:0>2X}-{1:0>2X}-{2:0>2X} {3:0>2X}:{4:0>2X}:{5:0>2X}" . format ( Ooo0O00o [ 51 ] , Ooo0O00o [ 52 ] , Ooo0O00o [ 53 ] ,
 Ooo0O00o [ 37 ] , Ooo0O00o [ 38 ] , Ooo0O00o [ 39 ] )
   OOOO = datetime . strptime ( Ooo0 , "%Y-%m-%d %H:%M:%S" )
  except Exception as oooo000O0 :
   OOOO = datetime . strptime ( "2000-01-19 19:19:19" ,
 "%Y-%m-%d %H:%M:%S" )
   if 47 - 47: ooo000
  IiII111I1I = 0
  if 82 - 82: i1 . Iii1i - i1I1
  oo0O0O0Ooooo = ( 200 * 1024 )
  Ooo = WGTools . getLongByByte ( OOO , 64 * 2 + 8 , 4 )
  II1111I11 = WGTools . getLongByByte ( OOO , 8 , 4 )
  if ( ( Ooo == 0 ) or (
 II1111I11 >= ( Ooo + oo0O0O0Ooooo - 4096 / 16 - 1 ) )
 or ( II1111I11 < Ooo ) ) :
   if II1111I11 > 0 :
    if II1111I11 >= oo0O0O0Ooooo :
     IiII111I1I = oo0O0O0Ooooo - 4096 / 16 + (
 II1111I11 % ( 4096 / 16 ) )
    else :
     IiII111I1I = II1111I11
   else :
    pass
  else :
   IiII111I1I = II1111I11 - Ooo
  if IiII111I1I < 0 :
   IiII111I1I = 0
  Ooo0 = "{0:0>2X}{1:0>2X}-{2:0>2X}-{3:0>2X}" . format ( OOO [ 64 * 3 + 28 ] ,
 OOO [ 64 * 3 + 29 ] , OOO [ 64 * 3 + 30 ] ,
 OOO [ 64 * 3 + 31 ] )
  IiI1IIi1IiII = "{0:0>2X}" . format ( OOO [ 64 * 3 + 20 ] )
  for I1IoOooOo0o in range ( 5 ) :
   IiI1IIi1IiII += "-{0:0>2X}" . format ( OOO [ 64 * 3 + 21 + I1IoOooOo0o ] )
   if 83 - 83: Iii1i % i1iiIII111 . OooOoo / I1I % oOO . I1I
  ii1iIii = "V{}.{}[{}]" . format ( OOO [ 64 * 3 + 26 ] - ( OOO [ 64 * 3 + 26 ] >> 4 ) * 6 ,
 OOO [ 64 * 3 + 27 ] - ( OOO [ 64 * 3 + 27 ] >> 4 ) * 6 ,
 Ooo0 )
  if 70 - 70: Oo / Iii1i * OooOoo
  if 2 - 2: i1I / Iii1i + I1Ii1I1
  o0O0 = "{}.{}.{}.{}" . format ( OOO [ 64 * 3 + 8 ] , OOO [ 64 * 3 + 9 ] , OOO [ 64 * 3 + 10 ] ,
 OOO [ 64 * 3 + 11 ] )
  if o0O0 in ( "192.168.0.0" , "192.168.168.0" , "0.0.0.0" ) :
   o0O0 = ""
   if 15 - 15: IIiIIiIi11I1 . IiIIii11Ii - i1I % iI1iII1I1I1i . i1 % i1I1
   if 6 - 6: I11iiIi11i1I * iI1iII1I1I1i + Iii1i * IIiIIiIi11I1 . Ooo0Ooo - Oo
   if 63 - 63: i1i1i1111I - i1iiIII111 . OooOoo % OooOoo . i1I1 + i1I
   if 71 - 71: ooo000 + I11iiIi11i1I % iI1iII1I1I1i + i1I1 % 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 % i1I1 . ooOOO * I1Ii1I1 . ooOOO
   if 90 - 90: IiIIii11Ii + I1Ii1I1 . OooOoo
   if 73 - 73: i1i1i1111I - Iii1i / I11iiIi11i1I . ooo000 / iI1iII1I1I1i - i1iiIII111
   if 21 - 21: i1iiIII111 + i1I1 % i1i1i1111I
  i1i1 = ''
  I1II1IIIi = ''
  if 97 - 97: IiIIii11Ii . Oo - i1I + I11iiIi11i1I - oOo0O00
  if 6 - 6: i1I1 - Ii
  if 1 - 1: I1I + OooOoo
  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
  i1i1 += "{}:\t{}\r\n" . format ( "Door Status" , 'Closed' if Ooo0O00o [ 28 + oo0 - 1 ] == 0 else 'Open' )
  I1II1IIIi += "{}-" . format ( 'Closed' if Ooo0O00o [ 28 + oo0 - 1 ] == 0 else 'Open' )
  i1i1 += "{}:\t{}\r\n" . format ( "DoorControlMode" , I1i1I )
  I1II1IIIi += "{}-" . format ( I1i1I )
  i1i1 += "{}:\t{}\r\n" . format ( "OpenDelay(seconds)" , i1iIIi1I1iiI )
  I1II1IIIi += "{}-" . format ( i1iIIi1I1iiI )
  i1i1 += "{}:\t{}\r\n" . format ( "Controller SN" , sn )
  I1II1IIIi += "{}-" . format ( sn )
  i1i1 += "{}:\t{}\r\n" . format ( "IP" , o0O0 )
  I1II1IIIi += "{}-" . format ( o0O0 )
  i1i1 += "{}:\t{}\r\n" . format ( "--Records" , int ( IiII111I1I ) )
  I1II1IIIi += "{}-" . format ( int ( IiII111I1I ) )
  i1i1 += "{}:\t{}\r\n" . format ( "--Privilege" , WGTools . getLongByByte ( OOO , 64 + 8 , 4 ) )
  I1II1IIIi += "{}-" . format ( WGTools . getLongByByte ( OOO , 64 + 8 , 4 ) )
  i1i1 += "{}:\t{}\r\n" . format ( "--Time" , OOOO . strftime ( "%Y-%m-%d %H:%M:%S" ) )
  I1II1IIIi += "{}-" . format ( OOOO . strftime ( "%Y-%m-%d %H:%M:%S" ) )
  i1i1 += "{}:\t{}\r\n" . format ( "Driver Version" , ii1iIii )
  I1II1IIIi += "{}-" . format ( ii1iIii )
  i1i1 += "{}:\t{}\r\n" . format ( "--MAC" , IiI1IIi1IiII )
  I1II1IIIi += "{}-" . format ( IiI1IIi1IiII )
  if 22 - 22: IiIIii11Ii - Ooo0Ooo . i1 . i1I - ooo000
  if 68 - 68: ooo000
  OOoo0 = WGTools . getLongByByte ( OOO , 64 * 8 + 8 + 6 , 1 )
  if OOoo0 == 0x87 :
   i1i1 += "{}:\t{}\r\n" . format ( "--QRCode" , "Enable QR code transparent transmission, allowing both card swiping + QR code scanning" )
   I1II1IIIi += "{}-" . format ( "Enable QR code transparent transmission, allowing both card swiping + QR code scanning" )
  elif OOoo0 == 0x81 :
   i1i1 += "{}:\t{}\r\n" . format ( "--QRCode" , "Enable QR code transparent transmission" )
   I1II1IIIi += "{}-" . format ( "Enable QR code transparent transmission" )
  elif OOoo0 != 0 :
   i1i1 += "{}:\t{}\r\n" . format ( "--QRCode" , "{0:0>2X}" . format ( OOoo0 ) )
   I1II1IIIi += "{}{}-" . format ( "QRCode" , "{0:0>2X}" . format ( OOoo0 ) )
   if 82 - 82: I11iiIi11i1I
  OOoo0 = WGTools . getLongByByte ( OOO , 64 * 8 + 8 + 6 + 3 , 1 )
  if OOoo0 == 0xa5 :
   i1i1 += "{}:\t{}\r\n" . format ( "--Scheduled upload" , "Card swipe upload 192 bytes (0x26)" )
   I1II1IIIi += "{}-" . format ( "Card swipe upload 192 bytes (0x26)" )
   if 66 - 66: IiIIii11Ii + OooOoo
  OOoo0 = WGTools . getLongByByte ( OOO , 64 * 8 + 8 + 6 + 3 * 2 , 1 )
  if OOoo0 > 0 :
   if ( WGTools . getLongByByte ( OOO , 64 * 8 + 8 + 6 + 3 * 3 , 1 ) & ( 1 << 3 ) ) > 0 :
    iIii = "115200"
   else :
    iIii = "9600"
   i1i1 += "{}:\t{}\r\n" . format ( "--Serial port" , "" + iIii )
   I1II1IIIi += "{}-" . format ( "Serial port enabled" )
   i1i1 += "{}:\t{}\r\n" . format ( "--Modbus address" , WGTools . getLongByByte ( OOO , 64 * 8 + 8 + 6 + 3 * 4 , 1 ) )
   if 78 - 78: i1i1i1111I * I1Ii1I1
  OOoo0 = WGTools . getLongByByte ( OOO , 64 * 8 + 8 + 6 + 3 * 5 , 1 )
  if OOoo0 > 0 :
   i1i1 += "{}:\t{}\r\n" . format ( "--Event logging" , "Enabled logging of door contact/button alarm events" )
   I1II1IIIi += "{}-" . format ( "Enabled logging of door contact/button alarm events" )
   if 99 - 99: iI1iII1I1I1i - i1I % i1I - i1I1 * i1iiIII111 + OooOoo
  oO0OO0oO0 = """if (pkt.recv[8 + 6] == 0x87)

                        if (pkt.recv[8 + 6 + 3] == 0xA5)
                        {

                            info192 = (string.Format("{0} {1}  定时上传:\t{2}-[0x{3:X2}]", DateTime.Now.ToString("HH:mm:ss"), controllerSN, "Card swipe upload 192 bytes (0x26)", pkt.recv[8 + 6 + 3])); //
                        }
                        if (pkt.recv[8 + 6 + 3 * 2] > 0)
                        {

                            logInfo(string.Format("{0} {1}  串口:\t{2}-[0x{3:X2}]", DateTime.Now.ToString("HH:mm:ss"), controllerSN, "", pkt.recv[8 + 6 + 3 * 2])); //
                            logInfo(string.Format("{0} {1}  串口波特率:\t{2}-[0x{3:X2}]", DateTime.Now.ToString("HH:mm:ss"), controllerSN, (pkt.recv[8 + 6 + 3 * 3] & (1 << 3)) > 0 ? "115200" : "9600", pkt.recv[8 + 6 + 3 * 3])); //
                            logInfo(string.Format("{0} {1}  modbus地址:\t{2}-[0x{3:X2}]", DateTime.Now.ToString("HH:mm:ss"), controllerSN, pkt.recv[8 + 6 + 3 * 4], pkt.recv[8 + 6 + 3 * 4])); //
                        }
                        if (pkt.recv[8 + 6 + 3 * 5] == 1)
                        {
                            logInfo(string.Format("{0} {1}  Enabled logging of door contact/button alarm events", DateTime.Now.ToString("HH:mm:ss"), controllerSN)); //
                        }
        """
  if 10 - 10: iI1iII1I1I1i - Ii . IiIIii11Ii
  if 37 - 37: i1i1i1111I
  if 79 - 79: ooo000 % i1I - Ii % i1I - I1I
  if 42 - 42: I11iiIi11i1I - Ii / Oo - i1i1i1111I + I11iiIi11i1I
  if 83 - 83: i1 . iI1iII1I1I1i
  if 57 - 57: i1I1 % IiIIii11Ii / oOo0O00 + Ooo0Ooo - i1iiIII111
  wgcondata . doorIDOperateOK . append ( conid )
  wgcondata . doorIDOperateInfo . append ( i1i1 . replace ( "\r\n" , ';' ) )
  if 87 - 87: i1iiIII111 . i1iiIII111 . oOO . ooo000 * oOo0O00
  return i1i1
  if 33 - 33: i1I1 * i1iiIII111 / i1I . OooOoo * oOo0O00 + ooo000
  if 17 - 17: i1i1i1111I * oOO + i1iiIII111 - I11iiIi11i1I / i1i1i1111I
 wgcondata . doorIDOperateFailed . append ( conid )
 return "Communication Failed-1"
# dd678faae9ac167bc83abf78e5cb2f3f0688d3a3
