Upload
basil-mathews
View
212
Download
0
Embed Size (px)
Citation preview
Feb 2007WSN Training: XMesh Services 1
Lab6
Objectives: Route Control Interface Understand XMesh transport services
1. Upstream
2. Upstream with end-to-end acknowledgement
3. Downstream
4. Downstream with end-to-end acknowledgement
Note: we’ll not cover services 3 and 4; if you’d like to understand them, read “MoteWorks getting started”
WSN Training: XMesh Services 2 Feb 2007
RouteControl Interface
User can make application level decisions based on network conditions.
RouteControl interface extracts information from the routing component.
Example Wiring: MyAppM.RouteControl -> XMeshRouter;
Example Usage: parent = call RouteControl.getParent();
WSN Training: XMesh Services 3 Feb 2007
RouteControl Interface
Interface: command uint16_t getParent() Description: Returns parent’s address (0xffff for broadcast)
Interface: command uint16_t getDepth() Description: Number of hops away the mote is from the base
station.
Interface: command uint16_t getSender(TOS_MsgPtr)Description: Returns address of the mote that sent the
message
Interface: command uint8_t getOccupancy() Description: Returns the length of the routing forwarding
queue
WSN Training: XMesh Services 4 Feb 2007
RouteControl Interfaces
Interface: command uint8_t getQuality(uint8_t type)Description: Gets a measure of goodness for the
current parent. Returns value between 0 to 255, where 255 represents that 100% of messages has been heard. Type = 1: Send goodness Type = 2: Receive goodness
Interface: command result_t setUpdateInterval(uint16_t Interval)
Description: Sets the routing component’s internal route update interval = interval duration in seconds.
WSN Training: XMesh Services 5 Feb 2007
XMesh Service Identifier: AM type
Predefined AM types QoS Service Types:
1. UPSTREAM2. UPSTREAM_ACK3. DOWNSTREAM4. DOWNSTREAM_ACK
Explanation of the predefined AM types See tos/types/Messages.h for predefined AM types. All these predefined AM types have been wired to the GenericComm by XMesh
Note: Application must not wire it again.
WSN Training: XMesh Services 6 Feb 2007
End-to-end acknowledgement
Source code: under /MoteWorks/apps/tutorials/lesson_5
What does it do? send upstream packet (from nodes to base station),
requesting end-to-end ack Use XMesh UpstreamAck service wirings and APIs Yellow LED toggles when an acknowledgement
message is received back from the base station
WSN Training: XMesh Services 7 Feb 2007
Required Hardware and PC Setup
1. Three MICA Motes: MICA2 (MPR4x0) or MICAz (MPR2600)
2. One sensor or data acquisition board: MTS300 or MTS310, MDA100 is OK too
3. One gateway board: MIB510, MIB520, or MIB600 and the associated hardware (cables, power supply) for each
4. A Windows PC with MoteWorks installed
WSN Training: XMesh Services 8 Feb 2007
Top-level configuration
The ReceiveAck interface is required to implement an event callback function that will be generated by XMesh when the acknowledgment message has arrived from the base station.
configuration MyApp_MeshAck {}implementation { //… MyApp_MeshAckM.RouteControl -> MULTIHOPROUTER; MyApp_MeshAckM.Send -> MULTIHOPROUTER.MhopSend[AM_XMULTIHOP_MSG]; MyApp_MeshAckM.ReceiveAck -> MULTIHOPROUTER.ReceiveAck[AM_XMULTIHOP_MSG]; MULTIHOPROUTER.ReceiveMsg[AM_XMULTIHOP_MSG] ->
Comm.ReceiveMsg[AM_XMULTIHOP_MSG]; }
The only change to the configuration file is the addition of the ReceiveAck interface wiring.
The only change to the configuration file is the addition of the ReceiveAck interface wiring.
WSN Training: XMesh Services 9 Feb 2007
Top-level Module
The first change is the transport mode of MODE_UPSTREAM_ACK. This tells XMesh to send an acknowledgement message back to the message originator when the message is received at the base station.
The second change is the addition of the ReceiveAck.receive event function. This is the event called by XMesh when the acknowledgement message has arrived from the base station for the most recently sent message. The yellow LED is toggled upon receiving this acknowledgment message.
void task SendData() {… if (call Send.send(BASE_STATION_ADDRESS, MODE_UPSTREAM_ACK, &msg_buffer, sizeof(XDataMsg)) != SUCCESS)… event TOS_MsgPtr ReceiveAck.receive(TOS_MsgPtr pMsg, void* payload, uint16_t payloadLen) { call Leds.yellowToggle();…
Add handling of end-to-end acknowledgement received from base station.
Add handling of end-to-end acknowledgement received from base station.
Switch service type to MODE_UPSTREAM_ACKSwitch service type to MODE_UPSTREAM_ACK
WSN Training: XMesh Services 10 Feb 2007
Compile & flash motes
1.Compile with designated radio frequency in MakeXbowlocal and typingmake <platform>
Or by typingmake <platform> route,hp
2.Program the remote nodes by typingmake <platform> reinstall,1 <programmer>,com#
3.Compile and program a separate base station with XMeshBase by typingmake <platform> install,0 <programmer>,com#
WSN Training: XMesh Services 11 Feb 2007
Visualize traffic
Visualize the traffic in the Mesh: Use the XSniffer GUI. Program a mote with application (TOSBase) found in
MoteWorks/apps/general/XSniffer. Start XSniffer GUI, connect it to the gateway board with
the XSniffer (i.e., TOSBase) mote.
Receive upstream packet from your PC Start XServe Connect it to the base station mote.
WSN Training: XMesh Services 12 Feb 2007
What you need to do?
Finish Lab 6 (posted in HuskyCT)