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


You should use UNICAST Addr and not AM_BROADCAST_ADDR when you call
AMSend.send
When you send to AM_BROADCAST_ADDR, it doesn't run on Ack mode 
One mote : make TARGET install.1
Other mote : make TARGET install.2 

NODE ID 1 call AMSend.send(2, .......)...


_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to