[Tinyos-help] Handling events in Tossim
Doman, Marguerite
mdoman at email.uncc.edu
Thu Nov 2 12:01:59 PST 2006
How can I trace events?
I'm trying to handle an ADCDataReadyEvent event in my Tython script. I issue the command
SetADCPortValueCommand. The status message appears:
status: Wrote command: SetADCPortValueCommand [mote 0] [port 2] [value 33]
But I don't see the event in my handler. So, I think there are 2 possibilities:
1. my handler is wrong -> most probable
2. The event is already being handled somewhere in Tossim and is not re-signaled for me to handle.
So, I'd like to see the event to be able to correct my handling.
Thanks,
.......
fyi... here's my handler:
def readSensorData (event):
if (event is simcore.comm.ADCDataReadyEvent):
# Get the information from the ADCDataReadyEvent
id = event.getMoteID()
port = event.getPort()
value = event.getValue()
# issue a remove and add attribute to change the value.
if (port == tempPort):
simcore.motes[id].removeAttribute(TempAttribute.getField()) # remove attribute
simcore.motes[id].addAttribute(TempAttribute.getField(), # add attribute
TempAttribute)
# Register a handler to get the ADCDataReadyEvent events
simcore.interp.addEventHandler (readSensorData, # event handler
net.tinyos.sim.event.ADCDataReadyEvent) #event types to be handled
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20061102/45e5fb28/attachment.html
More information about the Tinyos-help
mailing list