Hello,
I have a question regarding the programming concept of Tinyos.
Looking into the example RadioCountToLedsC I found that basically a
state machine was realized. It is a bit hard to see because the
machine is distributed over a number of callback (event handler)
functions.
I tried to draw the state machine and came up with the following
diagram. Maybe it is not complete but I think it is very clear what
the application is doing. I wonder if it isn't it possible to
extract the behaviour and put it into an own function i.e. a state
handler.
meanwhile I tried out to automatically generate the state machine for
the RadioCountToLeds example from the UML state chart (see link).
The following files are generated
RadioMachineStateHandlerFcts.h -> definitions
RadioMachineStateHandlerFcts.nc -> state machine function
RadioMachine_ext.h -> list of events the machine accepts
The file RadioCountToLedsC.nc basically just calles the state machine
handler
from within the callback functions and offers some helper functions to
send / set Leds. RadioCountToLedsAppC.nc is not changed.
You can download the complete code here:
www.sinelabore.com/download/nesc/RadioCountToLeds.taz
www.sinelabore.com/download/nesc/machine.png (screenshot of the UML
diagram).
I'm very interested on your feedback as I consider to add support for
nesc/Tinyos to our state machine tool.
I have no good idea so far how to integrate the generated code into
RadioCountToLedsC. So I just included it using #inlcude "xxx.nc". Is
there a better way?
Peter
--
Peter Mueller
www.sinelabore.com
[email protected]
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help