⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 agrimonitorrootappc.nc

📁 tinyos2.0版本驱动
💻 NC
字号:
#include "../Node/Datastructure.h"

configuration AgriMonitorRootAppC { }
implementation
{
  components AgriMonitorRootC, MainC, LedsC, ActiveMessageC, SerialActiveMessageC;
  AgriMonitorRootC.Boot -> MainC;
  AgriMonitorRootC.Leds -> LedsC;
  AgriMonitorRootC.RadioControl -> ActiveMessageC;
  AgriMonitorRootC.RadioAMPacket -> ActiveMessageC;
  AgriMonitorRootC.RadioPacket -> ActiveMessageC;  
  //初始化  
  
  components SerialActiveMessageC as SerialActiveMessage;
  AgriMonitorRootC.SerialControl -> SerialActiveMessage;
  AgriMonitorRootC.SerialAMPacket -> SerialActiveMessage;
  AgriMonitorRootC.SerialPacket -> SerialActiveMessage;
  //串口ActiveMessage
  
   
  components CollectionC;
  components new SerialAMSenderC(AM_SERIAL_SENSORDATA) as SerialSensorSenderC;
  components new SerialAMSenderC(AM_SERIAL_STATEDATA) as SerialStateSenderC;
  components new SerialAMSenderC(AM_SERIAL_TOPOLOGYDATA) as SerialTopoSenderC;
  AgriMonitorRootC.CollectionControl -> CollectionC;
  AgriMonitorRootC.CtpPacket -> CollectionC;
  AgriMonitorRootC.RootControl -> CollectionC;
  AgriMonitorRootC.SensorDataReceive -> CollectionC.Receive[COL_AM_SENSOR];
  AgriMonitorRootC.StateDataReceive -> CollectionC.Receive[COL_AM_STATE];
  AgriMonitorRootC.TopoDataReceive -> CollectionC.Receive[COL_AM_TOPOLOGY];
  //接收感知,状态,拓扑数据  
  AgriMonitorRootC.SerialSendSensorData -> SerialSensorSenderC;
  AgriMonitorRootC.SerialSendStateData -> SerialStateSenderC;
  AgriMonitorRootC.SerialSendTopoData -> SerialTopoSenderC;
  //发送感知,状态,拓扑数据  
  
  
  components new PoolC(message_t, 10) as SensorDataPoolC;
  components new QueueC(message_t*, 10) as SensorDataQueueC;
  AgriMonitorRootC.SensorDataPool -> SensorDataPoolC;
  AgriMonitorRootC.SensorDataQueue -> SensorDataQueueC;
  //感知数据的Pool和Queue
  
  components new PoolC(message_t, 10) as StateDataPoolC;
  components new QueueC(message_t*, 10) as StateDataQueueC;
  AgriMonitorRootC.StateDataPool -> StateDataPoolC;
  AgriMonitorRootC.StateDataQueue -> StateDataQueueC;
  //状态数据的Pool和Queue
  
  
  components new PoolC(message_t, 10) as TopoDataPoolC;
  components new QueueC(message_t*, 10) as TopoDataQueueC;
  AgriMonitorRootC.TopoDataPool -> TopoDataPoolC;
  AgriMonitorRootC.TopoDataQueue -> TopoDataQueueC;
  //拓扑数据的Pool和Queue
      

  components SerialActiveMessageC as DisCommand;
  AgriMonitorRootC.DisCommandReceive -> DisCommand.Receive[SERIAL_DIS_COMMAND];
  AgriMonitorRootC.DisCommandPacket -> DisCommand.Packet;
  //分发指令  
  
  components SerialActiveMessageC as BcastCommand;
  AgriMonitorRootC.BcastCommandReceive -> BcastCommand.Receive[SERIAL_BCAST_COMMAND];
  AgriMonitorRootC.BcastCommandPacket -> BcastCommand.Packet;
  //广播指令  
  components DisseminationC;
  AgriMonitorRootC.DisseminationControl -> DisseminationC;
  components new DisseminatorC(rootDissemination_t, DISEMINATION_KEY);
  AgriMonitorRootC.DisCommandUpdate -> DisseminatorC;

  components new BcastSenderC(BCAST_AM) as BcastCommandSender;
  AgriMonitorRootC.BcastCommandSender -> BcastCommandSender;  
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -