def onACK(self): b = self.reply.body self.reply.info = { 'errors.crc': b[0], 'errors.sequence': b[1], 'errors.naks': b[2], 'errors.timeouts': b[3], 'packets.received': lib.BangLong(b[4:8]), 'packets.transmit': lib.BangLong(b[8:12]) } self.info = self.reply.info
def decode_chunk(chunk): """ Experiment: decode a chunk! TODO: how do we decode historical data? It's likely composed of regions representing records, either with some kind of delimiter, or with a common header. Looking at the hex dump of chunks, it does indeed look like there is some kind of repeating pattern. But is there an offset to begin? Is each record the same size, or is there a header describing the record? """ hex_dump_data(chunk) longs = [] for x in range(0, 32, 4): q = lib.BangLong(chunk[x:x + 4]) longs.append(q) logger.info('longs? %s' % ' '.join(map(str, longs)))
def ls_long(B): B.reverse() return lib.BangLong(B)
def getData(self): data = self.data log.info("XXX: READ cur page number:\n%s" % lib.hexdump(data)) return lib.BangLong(data[0:4])