CS199 Notes for 9/14/2004 Topic: TinyOS Networking Scribe: Xin Yang ================== Internet: - every client and server works independently - End to End traffic - very low loss - lowes 1% packet loss * ----- * * ----- * Sensor Network: - nodes collaborate - variety of traffic networks * >>>> ^ * * <<<< - no wires (in wireless space, not really a graph) - every one can hear each other, so interference issues - Hidden Terminal A B C - A doesn't kno C, C doesn't know B, then A and C can both transmit without knowing - High loss - possibly more than 30-40% loss Active Message: - its a field in the packet - 256 fields (possible values) Example: interface ReceieveMsg { event TOS.MsgPtr receieve(TOS_MsgPtr); } GenericComm { provides interface ReceieveMSG[uint8_t]; provides interface Send[uint8_t]; } implementation { command result_t send(uint8_t addr, uint8_t len, Tos.MsgPtr prt); event result_t SendDone (TOS_MsgPtr ptr, result_t success); } TosMsg: - generic message format, struct Receieve: - must return a pointer for buffer for the next buffer - you swap buffers each time you get a message - does not assume unlimited allocation on receive: keeps limited resources in mind - common source of confusion - receieve(Tos_MsgPtr ptr) send(m) return m; - the send and receieve buffer are the same so it might get over written if a new packet arrives before send !!!! Radio stack will idle and drop packets untill this event returns with new pointer !!!! Thus if your handler takes a long time, you will drastically reduce performance - pervious only does point to point stuff - what about Tree Base collection? - Need to Build layer on top of this point-point stuff - Modules who build ontop of generic comm will implement the following interfaces I Send { C result_t Send(TOS_MsgPtr msg, uint16_t len) C void getBuffer(Tos_MsgPtr, uint16_t len) C result_t sendDone( .. ) } I Receive { E Tos.MsgPtr receieve (TOSMsgPtr ptr, void payload, uint len); } getBuffer: - returns a pointer to where the previous layer can put stuff - just a convenience - still has to know how big headers in the stack are and how much space that takes in the payload of the tosMsg packet Generic Comm can only keep 1 packet at a time - single component not a problem - multiple component a problem - Queued Sends (tos lib queue) - library compoenet that does this