Exemple #1
0
    def __init__(self,
                 Port=b'/dev/ttyAMA3',
                 baudrate=115200,
                 ReceiveCallBack=None,
                 RCallarg=None):
        self.port = Port
        self.baudrate = baudrate
        self.CallBack = ReceiveCallBack
        self.RCakkarg = RCallarg

        self.rfidcallbackdata = b''
        self.rfidcallbackProssdata = b''
        self.RfidCMD = RfidCommandAnalysis.RfidCMDAnalysis()
        self.com = ComCOMThread(Port=Port,
                                baudrate=baudrate,
                                ReceiveCallBack=self.comrecvcallbackpross,
                                RCallarg=self.rfidcallbackdata)

        self.issysset = 0
        self.recountflg = 0
        self.sysInventoryruningflg = 0
        self.pause = False

        self.devID = b''
        self.RfidAnt = {'a1': 1, 'a2': 0, 'a3': 0, 'a4': 0, 'power': 3000}

        self.isusesubcommand = 0
        self.tag22rev = 0
        self.tag29rev = 0
                logger="RfidReadAndWrite.py").getlog()
#syskey=b''
#sysstatus=b''
usedAnt = 1
usedPower = 1024
EPCProsseRedisflg = 0
GetTagProsseFlg = 0

epcsendthreadalive = 0

isusesubcommand = 1
issysset = 0
rfidcallbackdata = b''
devID = b''
rfidcallbackProssdata = b''
RfidCMD = RfidCommandAnalysis.RfidCMDAnalysis()


def WriteToJsonFile(fpath, fdict):
    try:
        with open(fpath, 'w') as f:
            json.dump(fdict, f)
            return 'OK'
    except:
        return None


def ReadFromJsonFile(fpath):
    try:
        with open(fpath, 'r') as f:
            data = json.load(f)