The "usual" way to include nescc files is to just reference them from the main module (or something referenced from there). So if RadioCountToLedsC.nc makes a call to RadioMachineStateHandlerFcts() and is "wired up" in the config file (and that file is in the source search path, or likely in the app's directory) it should get pulled in automagically. Alternately you could make your function a regular C file and #include it as you show.
I have to say I never thought I'd see an embedded application that was amenable to UMLization... MS Peter Mueller wrote: > 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 > <http://www.sinelabore.com/download/nesc/RadioCountToLeds.taz> > www.sinelabore.com/download/nesc/machine.png > <http://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 <http://www.sinelabore.com> > [email protected] <mailto:[email protected]> > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
