2018-08-13 12:32:04 -04:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import requests
|
|
|
|
import csv
|
|
|
|
from io import StringIO
|
|
|
|
|
|
|
|
from common import *
|
|
|
|
|
|
|
|
def hexToCode(hex):
|
|
|
|
b = bin(int(hex, 16))[2:]
|
|
|
|
facility = int(b[0:8], 2)
|
|
|
|
code = int(b[9:24], 2)
|
|
|
|
return((facility, code))
|
|
|
|
|
|
|
|
def codeToHex(facility, code):
|
|
|
|
return "{:08X}".format(int(bin(facility)[2:] + "0" + bin(code)[2:] + "1", 2))
|
|
|
|
|
|
|
|
# hexToCode("01E29DA1") <-> codeToHex(241, 20176)
|
|
|
|
|
|
|
|
def forEachDoor(fxn):
|
2018-08-16 14:01:42 -04:00
|
|
|
for door in doors.values():
|
|
|
|
print(door.name)
|
|
|
|
fxn(door)
|
2018-08-13 12:32:04 -04:00
|
|
|
|
2018-08-16 14:01:42 -04:00
|
|
|
#forEachDoor(lambda door: door.sendCardFormat("A901146A-244", 1, 244))
|
|
|
|
#forEachDoor(lambda door: door.sendSchedules())
|