Dear all,
I have some troubles implementing a parametrized interface of Timers. I have
used the code snippets from "Software design Patterns for Tinyos" from Gay et
al. and some hints online and from this mailing list. I am attaching the
complete code (it is basically the Blink application with an array of 3
timers). When compiling, the error is:
In component `BlinkC':
BlinkC.nc: In function `Boot.booted':
BlinkC.nc:51: Timers.startPeriodic not connected
BlinkC.nc:52: Timers.startPeriodic not connected
BlinkC.nc:53: Timers.startPeriodic not connected
make: *** [exe0] Error 1
I found a hint on this mailing list from Phil Lewis that I need a default
implementation for the event, but this hint leads to yet another compilation
error, saying:
In file included from BlinkAppC.nc:45:
In component `BlinkC':
BlinkC.nc:61: `fired' is defined, not used, in this component
BlinkC.nc:61: (default implementations are only for used commands or events)
BlinkC.nc:61: conflicting types for `Timers.fired'
BlinkC.nc:56: previous declaration of `Timers.fired'
make: *** [exe0] Error 1
I would be very thankful for any ideas of how to get this wokrking. And, yes, I
am sure I need such a parametrized interface (not for the Blink application, of
course.. ) :-)
Anna
CODE
____
##############################
BlinkAppC.nc:
##############################
configuration BlinkAppC
{
}
implementation
{
components MainC, BlinkC, LedsC;
components new TimerMilliC() as Timer0;
components new TimerMilliC() as Timer1;
components new TimerMilliC() as Timer2;
BlinkC -> MainC.Boot;
BlinkC.Timers[0] -> Timer0;
BlinkC.Timers[1] -> Timer1;
BlinkC.Timers[2] -> Timer2;
BlinkC.Leds -> LedsC;
}
##############################
BlinkC.nc
##############################
#include "Timer.h"
module BlinkC @safe()
{
uses interface Timer<TMilli> as Timers[int id];
// uses interface Timer<TMilli> as Timer1;
// uses interface Timer<TMilli> as Timer2;
uses interface Leds;
uses interface Boot;
}
implementation
{
event void Boot.booted()
{
call Timers.startPeriodic[0]( 250 );
call Timers.startPeriodic[1]( 500 );
call Timers.startPeriodic[2]( 1000 );
}
event void Timers.fired[int id1]()
{
int id = 0;
}
/*default event void Timers.fired() {
}
*/
}
--
Dr. Anna Förster
PostDoctoral Researcher
Networking Laboratory, SUPSI
Via Cantonale, Galleria 2
Manno, Switzerland
www.inf.unisi.ch/postdoc/foerster
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help