[Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/TestFtsp FtspDataLogger.py, NONE, 1.1

Razvan Musaloiu-E. razvanm at users.sourceforge.net
Sun Dec 14 16:50:39 PST 2008


Update of /cvsroot/tinyos/tinyos-2.x/apps/tests/TestFtsp
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23246/apps/tests/TestFtsp

Added Files:
	FtspDataLogger.py 
Log Message:
Improvements to tos.py. 

This latest version includes:
  * support for MIB600
  * a generic dump program (tos-dump) that has support for decoding the
    printf packets
  * a few example programs for some of the applications (Oscilloscope,
    MultihopOscilloscope, TestFtsp, TestLocalTime).



--- NEW FILE: FtspDataLogger.py ---
#!/usr/bin/env python

import sys, time
import tos

AM_TEST_FTSP_MSG = 137

class FtspMsg(tos.Packet):
    def __init__(self, packet = None):
        tos.Packet.__init__(self,
                            [('src_addr',            'int', 2),
                             ('counter',             'int', 2),
                             ('local_rx_timestamp',  'int', 4),
                             ('global_rx_timestamp', 'int', 4),
                             ('skew_times_1000000',  'int', 4),
                             ('is_synced',           'int', 1),
                             ('ftsp_root_addr',      'int', 2),
                             ('ftsp_seq',            'int', 1),
                             ('ftsp_table_entries',  'int', 2)],
                            packet)

if '-h' in sys.argv:
    print "Usage:", sys.argv[0], "serial@/dev/ttyUSB0:57600"
    sys.exit()

am = tos.AM()

while True:
    p = am.read()
    if p and p.type == AM_TEST_FTSP_MSG:
        msg = FtspMsg(p.data)
        print int(time.time()), msg.src_addr, msg.counter, msg.global_rx_timestamp, msg.is_synced
        #print msg



More information about the Tinyos-2-commits mailing list