It is possible to do that.

component A {
  uses Interface Timer[uint8_t id];
  ...          ....
}

 components A;
 components TimerC;
 A.Timer -> TimerC;

And then you can use " call Timer[0].start "
But TimerC is also used by other components. It will cause some
problem. So you had better not to do it in that way. Just like daniel
mentioned, It is  incorrect  to use " interface Timer Ack[4];" in
tinyos.

On 4/7/08, JungDoyeong <[EMAIL PROTECTED]> wrote:
>
>
> Hi~daniel??
> First of all , Thanks so much for your fast reply.
> I don't want to bother you. But I have a further question about this.
>
> Actually, I've got the point of yours.
>
> The fact is I need to parameterized interface. and I need to know how to use
> it.
>
> Let me explain the why I need it.
>
> enum{AckOne=0,AckTwo=1,...};
>
> configuration A{
>
>   }
>
> { components TimerC, ...,..., ;
>
>  BeaconMoteM.Ack[AckOne] -> TimerC.Timer[unique("Timer")];
>  BeaconMoteM.Ack[AckTwo] -> TimerC.Timer[unique("Timer")];
>  BeaconMoteM.Ack[AckThree] -> TimerC.Timer[unique("Timer")];
>  BeaconMoteM.Ack[AckFour] -> TimerC.Timer[unique("Timer")];
> }
>
> module A{
>
>  uses interface Timer Ack[4];
>
> }
>
> Originally, I need parameterized interace with Timer interface type.
>
> I want to start and stop the timer by Ack[index] indivisually. by not unique
> interface instance name one by one.
>
> That's why I need parameterized interface.
>
> The Reference manual of nesC v1.1 says that you can use interface SendMsg
> S[uint8_t id ] as a parameter interface
>
> instead of interface X  as Y as simple interface.
>
> Is there a way to call start function of the timer by index of Ack[index].
> not acktimer1 or acktimer2.
>
> like these one, call Ack[index].start (.....) or call
> Ack.start[index](.........).
>
> I'm not sure that it is enough for you to understand what I want.
>
> Thanks for your reply again.
>
> With regards
>
> Jung
> >
> > Hi,
> >
> > You should view parameterized interface as array of interfaces.
> >
> > Hence:
> > --------------
> > module A {
> > uses interface SendMsg[uint8_t channel];
> > }
> > --------------
> > should be viewed as:
> > --------------
> > module A {
> > uses interface SendMsg as SendMsg1;
> > uses interface SendMsg as SendMsg2;
> > uses interface SendMsg as SendMsg3;
> > uses interface SendMsg as SendMsg4;
> > ...
> > uses interface SendMsg as SendMsg255;
> > }
> > --------------
> >
> > However, this array is not similar with array declaration of variables:
> > ---------
> > uint8_t myData[4];
> > ---------
> > Therefore, you cannot expand single interface into multiple interfaces:
> > ---------
> > uses interface SendMsg mySendMsg[4]; // ILLEGAL
> > ---------
> >
> > The correct thing is to describe the! m one by one:
>
> > ---------
> > uses interface SendMsg as SendMsg1;
> > uses interface SendMsg as SendMsg2;
> > uses interface SendMsg as SendMsg3;
> > uses interface SendMsg as SendMsg4;
> > ---------
> >
> > So, your previous method (uses interface X as Y) was correct. You don't
> > need parameterized interface for this case
> >
> > Hope that helps
> >
> > Regards,
> > -daniel
> >
> >
> > On Mon, 2008-04-07 at 08:20 +0000, JungDoyeong wrote:
> > > Hi~ everyone~!
> > > I've programmed some embedded solution in nesC v 1.1.
> > > I have one question about interface parameter.
> > >
> > > Actually, I need to use interface parameter on my work.
> > > So, I read nesC manual again carefully. The manual says that
> > >
> > > interface SendMsg S[uint_t id] that is possible expression within
> > > specification range.
> > >
> > >! But when I coded like below
> > >
> > > module A1 {
> > > .
> > > .
> > > .
> > >
> > > uses interface SendMsg Send[(uint8_t) 4]; // Actually I need four
> > > parameterized interface instance.
> > >
> > > }
> > >
> > > then I just see complie error related to syntax .
> > > parse error before 'Send'
> > >
> > > What should I do with this?
> > >
> > > The definition of single interface instance is working well.(e.g. uses
> > > interface X as Y;)
> > >
> > > How can I use parameterized interface instance ??
> > >
> > > If you can help me with this problem, Plz let me know
> > >
> > > Thanks in advance.
> > >
> > >
> > > with regards
> > >
> > > Jung
> >
> >
> >
>
>
> ________________________________
> 내 맘대로 바꾸는 배경 화면 색, 더욱 다양해진 홈페이지 슬라이드 쇼 구성! 확 달라진 MSN 홈페이� �
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help@millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>


-- 
Renjie Huang
Sensorweb Research Laboratory
http://sensorweb.vancouver.wsu.edu/
Washington State University

_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to