Example #1
0
File: app.py Project: charwliu/tmsp
 def check_tx(self, txBytes):
     if self.serial:
         txByteArray = bytearray(txBytes)
         if len(txBytes) >= 2 and txBytes[:2] == "0x":
             txByteArray = hex2bytes(txBytes[2:])
         txValue = decode_big_endian(
             BytesBuffer(txByteArray), len(txBytes))
         if txValue < self.txCount:
             return 6
     return 0
Example #2
0
 def append_tx(self, txBytes):
     if self.serial:
         txByteArray = bytearray(txBytes)
         if len(txBytes) >= 2 and txBytes[:2] == "0x":
             txByteArray = hex2bytes(txBytes[2:])
         txValue = decode_big_endian(
             BytesBuffer(txByteArray), len(txBytes))
         if txValue != self.txCount:
             return None, 1
     self.txCount += 1
     return None, 0