- tinyos.GenericPacket.__init__(self,
- [('error', 'int', 1),
- ('data', 'blob', None)],
- packet)
-
-# Displays an integer representation of byte stream to hex representation
-def print_hex(start_addr, byte_stream):
- num_iterations = int( (len(byte_stream) - 1) / HEX_OUTPUT_LINE_SIZE ) + 1
-
- for i in range(num_iterations):
- line = "%07x" % start_addr + " " # Prints memory address
- for j in range(HEX_OUTPUT_LINE_SIZE):
- if (i * HEX_OUTPUT_LINE_SIZE + j) < len(byte_stream):
- line += "%02x" % byte_stream[i * HEX_OUTPUT_LINE_SIZE + j] + " "
- print line
-
- start_addr += HEX_OUTPUT_LINE_SIZE
+ tos.Packet.__init__(self,
+ [('error', 'int', 1),
+ ('data', 'blob', None)],
+ packet)
+
+class Ident(tos.Packet):
+ def __init__(self, packet = None):
+ tos.Packet.__init__(self,
+ [('uidhash', 'int', 4),
+ ('size', 'int', 4),
+ ('pages', 'int', 1),
+ ('reserved', 'int', 1),
+ ('crc', 'int', 2),
+ ('appname', 'string', 16),
+ ('username', 'string', 16),
+ ('hostname', 'string', 16),
+ ('platform', 'string', 16),
+ ('timestamp','int', 4),
+ ('userhash', 'int', 4)],
+ packet)
+
+class ShortIdent(tos.Packet):
+ def __init__(self, packet = None):
+ tos.Packet.__init__(self,
+ [('appname', 'string', 16),
+ ('timestamp','int', 4),
+ ('uidhash', 'int', 4),
+ ('nodeid', 'int', 2)],
+ packet)
+