[Tinyos-commits] CVS: tinyos-1.x/tools/python/pytos Comm.py, 1.1, 1.2

Kamin Whitehouse kaminw at users.sourceforge.net
Wed Oct 26 19:23:39 PDT 2005


Update of /cvsroot/tinyos/tinyos-1.x/tools/python/pytos
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv871

Modified Files:
	Comm.py 
Log Message:
Added register/unregister functions to Drip and RamSymbols and updated the messageSnooper to know how to snoop on these messages.  Added "get" functions to comm, drip and drain, so that only a single instance of each needs to be instantiated.  Added a logically "negative" message filter.  


Index: Comm.py
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tools/python/pytos/Comm.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Comm.py	23 Sep 2005 10:20:33 -0000	1.1
--- Comm.py	27 Oct 2005 02:23:37 -0000	1.2
***************
*** 31,34 ****
--- 31,50 ----
  from copy import deepcopy
  
+ 
+ def getCommObject(app, motecom=None) :
+   """This function returns the comm object stored in app.  If there
+   is none, it creates one.  If it is not connected to motecom, it connects it."""
+   for conn in app.connections :
+     if isinstance(conn, Comm) :
+       if motecom != None and motecom not in conn._connected :
+         conn.connect(motecom)
+       return conn
+   if motecom==None:
+     return None
+   comm = Comm()
+   comm.connect(motecom)
+   app.connections.append(comm)
+   return comm
+ 
  def migTosMsgInvariant( msg, messageListener) :
    """This function takes either a mig or TosMsg object (with a Comm.MessageListener Object)



More information about the Tinyos-commits mailing list