July 2021
23
if BPPReader.stopRequest:
BPPReader.stopAck = True
print("BPPReader stopping.")
return
time.sleep(10)
print("Reopen port")
except Exception as e:
print(str(e))
exc_type, exc_obj, exc_tb = sys.exc_info()
print(exc_type, exc_tb.tb_lineno)
if BPPReader.stopRequest:
BPPReader.stopAck = True
print("BPPReader stopping.")
return
print("Restarting")
def stop(self):
BPPReader.stopRequest = True
def stopAcked(self):
return BPPReader.stopAck
def processHeader(self,header):
ret_ = False
self.lenPacket = 0
if len(header) == self.headerLength - 2:
self.lenPacket = int(header[self.lengthOffset:self.length 4],16)
#print("lenPacket=",lenPacket)
if self.lenPacket < 65512:
self.major = header[0]
self.str = "Maj=" + format(self.major,'c')
self.minor = header[1]
self.str = self.str + " Min=" + format(self.minor,'c')
self.senderAddr = int(header[self.senderAddrOffset:self.senderAddr 2], 16)
self.senderID = int(header[self.senderIDOffset:self.senderID1], 16)
self.str = self.str + " Sender Addr,Id=" + hex(self.senderAddr) + ',' + hex(self.senderID)
self.recipientAddr = int(header[self.recipientAddrOffset:self.recipientAddr 2], 16)
self.recipientID = int(header[self.recipientIDOffset:self.recipientID 1], 16)
self.str = self.str + " Recipient Addr,Id=" + hex(self.recipientAddr) + ',' + hex(self.recipientID)
if self.gui is None:
print(self.str)
b_chksum = bytes(header[self.chksumOffset:self.chksum 4])
b_chksum = b_chksum.decode('utf-8')
#print("b_chksum=",b_chksum)
self.parsedChecksum = int(b_chksum,16)
#print("parsedChecksum=", hex(parsedChecksum))
ret_ = True
else:
print("Invalid packet size");
else:
print("Header length incorrect");
return ret_
def updateData(self):
if self.gui != None:
eeData = self.timedate[2].split(',')
self.gui.updateData(eeData)
def updateStatus(self):
if self.gui != None:
self.gui.updateStatus(self)
Содержание ReCO2ver
Страница 8: ...July 2021 8 Figure 2 Data Packet Figure 3 Event Packet...
Страница 32: ...July 2021 32 Glossary...