Hi all,

I added ack functions on tinyos 2.0 application BlinktoRadio and ran this application on Micaz platform. I deleted the counter display on LEDs and added a ack status displayed on LEDS. The modifications are listed below:

 event void Timer0.fired() {
   counter++;
   if (!busy) {
     BlinkToRadioMsg* btrpkt =
      (BlinkToRadioMsg*)(call Packet.getPayload(&pkt, NULL));
     btrpkt->nodeid = TOS_NODE_ID;
     btrpkt->counter = counter;
if(call Acks.requestAck(&pkt) == SUCCESS) // adding ack request
     {
                if (call AMSend.send(AM_BROADCAST_ADDR,
                        &pkt, sizeof(BlinkToRadioMsg)) == SUCCESS) {
                        busy = TRUE;
                }
     }
   }
 }

 event void AMSend.sendDone(message_t* msg, error_t err) {
   if (&pkt == msg) {
     busy = FALSE;
     status = call  Acks.wasAcked(&pkt);            // ack status display
     if (status == SUCCESS)
                call Leds.led2Toggle();
     else if (status == FAIL)
                call Leds.led1Toggle();
   }
 }

I installed the revised application on two motes and used BaseStation to receive the messages. But all the transmitted packets were not acknowledged on two motes. And then I powered off one mote, another one's LEDs displayed that the transmitted packets were acknowledged. I didnot quite understand this phenomenon. Was it because of collision? Is the interface PacketAcknowledgements used to acknowledge that the transmitted packet is really transmitted?
Thanks a lot

_________________________________________________________________
Advertisement: Getting married? Tell us why to WIN @ LetsShop http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fwww%2Eletsshop%2Ecom%2FCompetitions%2FLetsMarry%2Ftabid%2F549%2FDefault%2Easpx&_t=751480117&_r=HM_tagline_letsshop_wedding&_m=EXT

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to