Lab 1:
Write a PingPong application that runs on two nodes.
When a node boots, it sends a broadcast packet using the AMSend interface.
When it receives a packet, it a) wait one second; b) sends a packet; c)
toggle an LED whenever a node sends a packet.
Lab 2:
Please add the reliable data transmission feature to the
PingPong application from the Application and the Link layers,
respectively. Suppose that two motes
A and B are talking to each other.
1.
Application Layer:
When mote A sends a
broadcast pack P to node B, mote A will start a timer T. When mote B
receives the packet P, mote B will send an ACK to node A.
a.
If the timer T expires
before mote A receives the ACK from mote B (either the packet P or the ACK
is lost), mote A will retransmit the packet;
b.
If mote A receives the ACK
from mote B before the timer T expires, mote A will do nothing when the
timer T expires.
c.
If mote B receive a packet
which has already been received (based on sequence number), node B just drop
this packet.
There is a sequence number
included in the payload of the packet P. The sequence number starts from 0.
When a packet P is received, the receiver will display the bottom three bits
(through LEDs) of the sequence number in the packet P.
2.
Link Layer:
In TEP 126 (http://www.tinyos.net/tinyos-2.x/doc/html/tep126.html
), it says: “PacketLink: This layer provides automatic retransmission
functionality and is responsible for retrying a packet transmission if no
acknowledgement was heard from the receiver. PacketLink is activated on a
per-message basis, meaning the outgoing packet will not use PacketLink
unless it is configured ahead of time to do so”
Therefore, as an
alternative, you may also configure PacketLink to provide automatic
retransmission functionality.
|