TinyOS 高级编程:布线、组件库与设计模式解析
1. 高级布线相关内容
在编程过程中,高级布线起着关键作用。例如AMQueueImplP的相关布线如下:
AMQueueImplP . AMSend -> ActiveMessageC ; AMQueueImplP . AMPacket -> ActiveMessageC ; AMQueueImplP . Packet -> ActiveMessageC ;在AMSendQueueImplP中,发送数据包的逻辑如下:
nextPacket (); if ( current == QUEUE_EMPTY ) { return ; } else { message_t * msg; am_id_t id; am_addr_t addr ; uint8_t len ; msg = queue [ current ]; id = call AMPacket . getType ( msg ); addr = call AMPacket . getDestination ( msg ); len = call Packet . getLength ( msg ); if ( call AMSend . send [id ]( addr , msg , len) == SUCCESS ) { ..