BlinkToRadio与AMSenderC,AMReceiveC

来源:互联网 发布:linux定时任务不执行 编辑:程序博客网 时间:2024/06/05 10:41
configuration BlinkToRadioAppC {
}
implementation {
  components MainC;
  components LedsC;
  components BlinkToRadioC as App;
  components new TimerMilliC() as Timer0;
  components ActiveMessageC;
  components new AMSenderC(AM_BLINKTORADIOMSG);
  components new AMReceiverC(AM_BLINKTORADIOMSG);

  App.Boot -> MainC;
  App.Leds -> LedsC;
  App.Timer0 -> Timer0;
  App.Packet -> AMSenderC;
  App.AMPacket -> AMSenderC;
  App.AMControl -> ActiveMessageC;
  App.AMSend -> AMSenderC;
  App.Receive -> AMReceiverC;

}

................................................................................................................................................................................................................................................

generic configuration AMSenderC(am_id_t AMId) {  //tinyos-2.X/tos/system
  provides {
    interface AMSend;
    interface Packet;
    interface AMPacket;
    interface PacketAcknowledgements as Acks;
  }
}
implementation {
#if defined(LOW_POWER_LISTENING)
  components new LplAMSenderC(AMId) as SenderC;
#else
  components new DirectAMSenderC(AMId) as SenderC;
#endif
  AMSend = SenderC;
  Packet = SenderC;
  AMPacket = SenderC;
  Acks = SenderC;
}

.......................................................................................................................................................................................................................................................

#include "AM.h"
generic configuration AMReceiverC(am_id_t amId) {    //tinyos-2.X/tos/system
  provides {
    interface Receive;
    interface Packet;
    interface AMPacket;
  }
}
implementation {
  components ActiveMessageC;
  Receive = ActiveMessageC.Receive[amId];
  Packet = ActiveMessageC;
  AMPacket = ActiveMessageC;
}

.......................................................................................................................................................................................................................................

generic configuration DirectAMSenderC(am_id_t AMId) {
  provides {
    interface AMSend;
    interface Packet;
    interface AMPacket;
    interface PacketAcknowledgements as Acks;
  }
}


implementation {
  components new AMQueueEntryP(AMId) as AMQueueEntryP;
  components AMQueueP, ActiveMessageC;


  AMQueueEntryP.Send -> AMQueueP.Send[unique(UQ_AMQUEUE_SEND)];
  AMQueueEntryP.AMPacket -> ActiveMessageC;
  
  AMSend = AMQueueEntryP;
  Packet = ActiveMessageC;
  AMPacket = ActiveMessageC;
  Acks = ActiveMessageC;
}

到此发现,又追溯到了ActiveMessageC这个组件中,有上一篇博文所示,ActiveMessageC可以继续追溯。

0 0
原创粉丝点击