Kristof T'Jonck / Mbed 2 deprecated CYS_Receiver

Dependencies:   xtoff2 RF24Network mbed

Fork of xtoff3 by pieter Berteloot

Committer:
akashvibhute
Date:
Mon Jul 06 03:17:33 2015 +0000
Revision:
0:3982c0e9eda1
First mbed-arduino working program!; mbed is able to receive data from arduino nodes 0 or 1 depending on address set

Who changed what in which revision?

UserRevisionLine numberNew contents of line
akashvibhute 0:3982c0e9eda1 1 /*
akashvibhute 0:3982c0e9eda1 2 Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>
akashvibhute 0:3982c0e9eda1 3
akashvibhute 0:3982c0e9eda1 4 This program is free software; you can redistribute it and/or
akashvibhute 0:3982c0e9eda1 5 modify it under the terms of the GNU General Public License
akashvibhute 0:3982c0e9eda1 6 version 2 as published by the Free Software Foundation.
akashvibhute 0:3982c0e9eda1 7 */
akashvibhute 0:3982c0e9eda1 8
akashvibhute 0:3982c0e9eda1 9 #ifndef __RF24NETWORK_H__
akashvibhute 0:3982c0e9eda1 10 #define __RF24NETWORK_H__
akashvibhute 0:3982c0e9eda1 11
akashvibhute 0:3982c0e9eda1 12 /**
akashvibhute 0:3982c0e9eda1 13 * @file RF24Network.h
akashvibhute 0:3982c0e9eda1 14 *
akashvibhute 0:3982c0e9eda1 15 * Class declaration for RF24Network
akashvibhute 0:3982c0e9eda1 16 */
akashvibhute 0:3982c0e9eda1 17
akashvibhute 0:3982c0e9eda1 18 #include <stddef.h>
akashvibhute 0:3982c0e9eda1 19 #include <stdint.h>
akashvibhute 0:3982c0e9eda1 20
akashvibhute 0:3982c0e9eda1 21 class RF24;
akashvibhute 0:3982c0e9eda1 22
akashvibhute 0:3982c0e9eda1 23 /**
akashvibhute 0:3982c0e9eda1 24 * Header which is sent with each message
akashvibhute 0:3982c0e9eda1 25 *
akashvibhute 0:3982c0e9eda1 26 * The frame put over the air consists of this header and a message
akashvibhute 0:3982c0e9eda1 27 */
akashvibhute 0:3982c0e9eda1 28 struct RF24NetworkHeader
akashvibhute 0:3982c0e9eda1 29 {
akashvibhute 0:3982c0e9eda1 30 uint16_t from_node; /**< Logical address where the message was generated */
akashvibhute 0:3982c0e9eda1 31 uint16_t to_node; /**< Logical address where the message is going */
akashvibhute 0:3982c0e9eda1 32 uint16_t id; /**< Sequential message ID, incremented every message */
akashvibhute 0:3982c0e9eda1 33 unsigned char type; /**< Type of the packet. 0-127 are user-defined types, 128-255 are reserved for system */
akashvibhute 0:3982c0e9eda1 34 unsigned char reserved; /**< Reserved for future use */
akashvibhute 0:3982c0e9eda1 35
akashvibhute 0:3982c0e9eda1 36 static uint16_t next_id; /**< The message ID of the next message to be sent */
akashvibhute 0:3982c0e9eda1 37
akashvibhute 0:3982c0e9eda1 38 /**
akashvibhute 0:3982c0e9eda1 39 * Default constructor
akashvibhute 0:3982c0e9eda1 40 *
akashvibhute 0:3982c0e9eda1 41 * Simply constructs a blank header
akashvibhute 0:3982c0e9eda1 42 */
akashvibhute 0:3982c0e9eda1 43 RF24NetworkHeader() {}
akashvibhute 0:3982c0e9eda1 44
akashvibhute 0:3982c0e9eda1 45 /**
akashvibhute 0:3982c0e9eda1 46 * Send constructor
akashvibhute 0:3982c0e9eda1 47 *
akashvibhute 0:3982c0e9eda1 48 * Use this constructor to create a header and then send a message
akashvibhute 0:3982c0e9eda1 49 *
akashvibhute 0:3982c0e9eda1 50 * @code
akashvibhute 0:3982c0e9eda1 51 * RF24NetworkHeader header(recipient_address,'t');
akashvibhute 0:3982c0e9eda1 52 * network.write(header,&message,sizeof(message));
akashvibhute 0:3982c0e9eda1 53 * @endcode
akashvibhute 0:3982c0e9eda1 54 *
akashvibhute 0:3982c0e9eda1 55 * @param _to The logical node address where the message is going
akashvibhute 0:3982c0e9eda1 56 * @param _type The type of message which follows. Only 0-127 are allowed for
akashvibhute 0:3982c0e9eda1 57 * user messages.
akashvibhute 0:3982c0e9eda1 58 */
akashvibhute 0:3982c0e9eda1 59 RF24NetworkHeader(uint16_t _to, unsigned char _type = 0): to_node(_to), id(next_id++), type(_type&0x7f) {}
akashvibhute 0:3982c0e9eda1 60
akashvibhute 0:3982c0e9eda1 61 /**
akashvibhute 0:3982c0e9eda1 62 * Create debugging string
akashvibhute 0:3982c0e9eda1 63 *
akashvibhute 0:3982c0e9eda1 64 * Useful for debugging. Dumps all members into a single string, using
akashvibhute 0:3982c0e9eda1 65 * internal static memory. This memory will get overridden next time
akashvibhute 0:3982c0e9eda1 66 * you call the method.
akashvibhute 0:3982c0e9eda1 67 *
akashvibhute 0:3982c0e9eda1 68 * @return String representation of this object
akashvibhute 0:3982c0e9eda1 69 */
akashvibhute 0:3982c0e9eda1 70 const char* toString(void) const;
akashvibhute 0:3982c0e9eda1 71 };
akashvibhute 0:3982c0e9eda1 72
akashvibhute 0:3982c0e9eda1 73 /**
akashvibhute 0:3982c0e9eda1 74 * Network Layer for RF24 Radios
akashvibhute 0:3982c0e9eda1 75 *
akashvibhute 0:3982c0e9eda1 76 * This class implements an OSI Network Layer using nRF24L01(+) radios driven
akashvibhute 0:3982c0e9eda1 77 * by RF24 library.
akashvibhute 0:3982c0e9eda1 78 */
akashvibhute 0:3982c0e9eda1 79
akashvibhute 0:3982c0e9eda1 80 class RF24Network
akashvibhute 0:3982c0e9eda1 81 {
akashvibhute 0:3982c0e9eda1 82 public:
akashvibhute 0:3982c0e9eda1 83 /**
akashvibhute 0:3982c0e9eda1 84 * Construct the network
akashvibhute 0:3982c0e9eda1 85 *
akashvibhute 0:3982c0e9eda1 86 * @param _radio The underlying radio driver instance
akashvibhute 0:3982c0e9eda1 87 *
akashvibhute 0:3982c0e9eda1 88 */
akashvibhute 0:3982c0e9eda1 89 RF24Network( RF24& _radio );
akashvibhute 0:3982c0e9eda1 90
akashvibhute 0:3982c0e9eda1 91 /**
akashvibhute 0:3982c0e9eda1 92 * Bring up the network
akashvibhute 0:3982c0e9eda1 93 *
akashvibhute 0:3982c0e9eda1 94 * @warning Be sure to 'begin' the radio first.
akashvibhute 0:3982c0e9eda1 95 *
akashvibhute 0:3982c0e9eda1 96 * @param _channel The RF channel to operate on
akashvibhute 0:3982c0e9eda1 97 * @param _node_address The logical address of this node
akashvibhute 0:3982c0e9eda1 98 */
akashvibhute 0:3982c0e9eda1 99 void begin(uint8_t _channel, uint16_t _node_address );
akashvibhute 0:3982c0e9eda1 100
akashvibhute 0:3982c0e9eda1 101 /**
akashvibhute 0:3982c0e9eda1 102 * Main layer loop
akashvibhute 0:3982c0e9eda1 103 *
akashvibhute 0:3982c0e9eda1 104 * This function must be called regularly to keep the layer going. This is where all
akashvibhute 0:3982c0e9eda1 105 * the action happens!
akashvibhute 0:3982c0e9eda1 106 */
akashvibhute 0:3982c0e9eda1 107 void update(void);
akashvibhute 0:3982c0e9eda1 108
akashvibhute 0:3982c0e9eda1 109 /**
akashvibhute 0:3982c0e9eda1 110 * Test whether there is a message available for this node
akashvibhute 0:3982c0e9eda1 111 *
akashvibhute 0:3982c0e9eda1 112 * @return Whether there is a message available for this node
akashvibhute 0:3982c0e9eda1 113 */
akashvibhute 0:3982c0e9eda1 114 bool available(void);
akashvibhute 0:3982c0e9eda1 115
akashvibhute 0:3982c0e9eda1 116 /**
akashvibhute 0:3982c0e9eda1 117 * Read the next available header
akashvibhute 0:3982c0e9eda1 118 *
akashvibhute 0:3982c0e9eda1 119 * Reads the next available header without advancing to the next
akashvibhute 0:3982c0e9eda1 120 * incoming message. Useful for doing a switch on the message type
akashvibhute 0:3982c0e9eda1 121 *
akashvibhute 0:3982c0e9eda1 122 * If there is no message available, the header is not touched
akashvibhute 0:3982c0e9eda1 123 *
akashvibhute 0:3982c0e9eda1 124 * @param[out] header The header (envelope) of the next message
akashvibhute 0:3982c0e9eda1 125 */
akashvibhute 0:3982c0e9eda1 126 void peek(RF24NetworkHeader& header);
akashvibhute 0:3982c0e9eda1 127
akashvibhute 0:3982c0e9eda1 128 /**
akashvibhute 0:3982c0e9eda1 129 * Read a message
akashvibhute 0:3982c0e9eda1 130 *
akashvibhute 0:3982c0e9eda1 131 * @param[out] header The header (envelope) of this message
akashvibhute 0:3982c0e9eda1 132 * @param[out] message Pointer to memory where the message should be placed
akashvibhute 0:3982c0e9eda1 133 * @param maxlen The largest message size which can be held in @p message
akashvibhute 0:3982c0e9eda1 134 * @return The total number of bytes copied into @p message
akashvibhute 0:3982c0e9eda1 135 */
akashvibhute 0:3982c0e9eda1 136 size_t read(RF24NetworkHeader& header, void* message, size_t maxlen);
akashvibhute 0:3982c0e9eda1 137
akashvibhute 0:3982c0e9eda1 138 /**
akashvibhute 0:3982c0e9eda1 139 * Send a message
akashvibhute 0:3982c0e9eda1 140 *
akashvibhute 0:3982c0e9eda1 141 * @param[in,out] header The header (envelope) of this message. The critical
akashvibhute 0:3982c0e9eda1 142 * thing to fill in is the @p to_node field so we know where to send the
akashvibhute 0:3982c0e9eda1 143 * message. It is then updated with the details of the actual header sent.
akashvibhute 0:3982c0e9eda1 144 * @param message Pointer to memory where the message is located
akashvibhute 0:3982c0e9eda1 145 * @param len The size of the message
akashvibhute 0:3982c0e9eda1 146 * @return Whether the message was successfully received
akashvibhute 0:3982c0e9eda1 147 */
akashvibhute 0:3982c0e9eda1 148 bool write(RF24NetworkHeader& header,const void* message, size_t len);
akashvibhute 0:3982c0e9eda1 149
akashvibhute 0:3982c0e9eda1 150 protected:
akashvibhute 0:3982c0e9eda1 151 void open_pipes(void);
akashvibhute 0:3982c0e9eda1 152 uint16_t find_node( uint16_t current_node, uint16_t target_node );
akashvibhute 0:3982c0e9eda1 153 bool write(uint16_t);
akashvibhute 0:3982c0e9eda1 154 bool write_to_pipe( uint16_t node, uint8_t pipe );
akashvibhute 0:3982c0e9eda1 155 bool enqueue(void);
akashvibhute 0:3982c0e9eda1 156
akashvibhute 0:3982c0e9eda1 157 bool is_direct_child( uint16_t node );
akashvibhute 0:3982c0e9eda1 158 bool is_descendant( uint16_t node );
akashvibhute 0:3982c0e9eda1 159 uint16_t direct_child_route_to( uint16_t node );
akashvibhute 0:3982c0e9eda1 160 uint8_t pipe_to_descendant( uint16_t node );
akashvibhute 0:3982c0e9eda1 161 void setup_address(void);
akashvibhute 0:3982c0e9eda1 162
akashvibhute 0:3982c0e9eda1 163 private:
akashvibhute 0:3982c0e9eda1 164 RF24& radio; /**< Underlying radio driver, provides link/physical layers */
akashvibhute 0:3982c0e9eda1 165 uint16_t node_address; /**< Logical node address of this unit, 1 .. UINT_MAX */
akashvibhute 0:3982c0e9eda1 166 const static int frame_size = 32; /**< How large is each frame over the air */
akashvibhute 0:3982c0e9eda1 167 uint8_t frame_buffer[frame_size]; /**< Space to put the frame that will be sent/received over the air */
akashvibhute 0:3982c0e9eda1 168 uint8_t frame_queue[5*frame_size]; /**< Space for a small set of frames that need to be delivered to the app layer */
akashvibhute 0:3982c0e9eda1 169 uint8_t* next_frame; /**< Pointer into the @p frame_queue where we should place the next received frame */
akashvibhute 0:3982c0e9eda1 170
akashvibhute 0:3982c0e9eda1 171 uint16_t parent_node; /**< Our parent's node address */
akashvibhute 0:3982c0e9eda1 172 uint8_t parent_pipe; /**< The pipe our parent uses to listen to us */
akashvibhute 0:3982c0e9eda1 173 uint16_t node_mask; /**< The bits which contain signfificant node address information */
akashvibhute 0:3982c0e9eda1 174 uint8_t min(uint8_t, uint8_t);
akashvibhute 0:3982c0e9eda1 175 };
akashvibhute 0:3982c0e9eda1 176
akashvibhute 0:3982c0e9eda1 177 /**
akashvibhute 0:3982c0e9eda1 178 * @example helloworld_tx.pde
akashvibhute 0:3982c0e9eda1 179 *
akashvibhute 0:3982c0e9eda1 180 * Simplest possible example of using RF24Network. Put this sketch
akashvibhute 0:3982c0e9eda1 181 * on one node, and helloworld_rx.pde on the other. Tx will send
akashvibhute 0:3982c0e9eda1 182 * Rx a nice message every 2 seconds which rx will print out for us.
akashvibhute 0:3982c0e9eda1 183 */
akashvibhute 0:3982c0e9eda1 184
akashvibhute 0:3982c0e9eda1 185 /**
akashvibhute 0:3982c0e9eda1 186 * @example helloworld_rx.pde
akashvibhute 0:3982c0e9eda1 187 *
akashvibhute 0:3982c0e9eda1 188 * Simplest possible example of using RF24Network. Put this sketch
akashvibhute 0:3982c0e9eda1 189 * on one node, and helloworld_tx.pde on the other. Tx will send
akashvibhute 0:3982c0e9eda1 190 * Rx a nice message every 2 seconds which rx will print out for us.
akashvibhute 0:3982c0e9eda1 191 */
akashvibhute 0:3982c0e9eda1 192
akashvibhute 0:3982c0e9eda1 193 /**
akashvibhute 0:3982c0e9eda1 194 * @example meshping.pde
akashvibhute 0:3982c0e9eda1 195 *
akashvibhute 0:3982c0e9eda1 196 * Example of pinging across a mesh network
akashvibhute 0:3982c0e9eda1 197 * Using this sketch, each node will send a ping to the base every
akashvibhute 0:3982c0e9eda1 198 * few seconds. The RF24Network library will route the message across
akashvibhute 0:3982c0e9eda1 199 * the mesh to the correct node.
akashvibhute 0:3982c0e9eda1 200 */
akashvibhute 0:3982c0e9eda1 201
akashvibhute 0:3982c0e9eda1 202 /**
akashvibhute 0:3982c0e9eda1 203 * @example sensornet.pde
akashvibhute 0:3982c0e9eda1 204 *
akashvibhute 0:3982c0e9eda1 205 * Example of a sensor network.
akashvibhute 0:3982c0e9eda1 206 * This sketch demonstrates how to use the RF24Network library to
akashvibhute 0:3982c0e9eda1 207 * manage a set of low-power sensor nodes which mostly sleep but
akashvibhute 0:3982c0e9eda1 208 * awake regularly to send readings to the base.
akashvibhute 0:3982c0e9eda1 209 */
akashvibhute 0:3982c0e9eda1 210 /**
akashvibhute 0:3982c0e9eda1 211 * @mainpage Network Layer for RF24 Radios
akashvibhute 0:3982c0e9eda1 212 *
akashvibhute 0:3982c0e9eda1 213 * This class implements an <a href="http://en.wikipedia.org/wiki/Network_layer">OSI Network Layer</a> using nRF24L01(+) radios driven
akashvibhute 0:3982c0e9eda1 214 * by the <a href="http://maniacbug.github.com/RF24/">RF24</a> library.
akashvibhute 0:3982c0e9eda1 215 *
akashvibhute 0:3982c0e9eda1 216 * @section Purpose Purpose/Goal
akashvibhute 0:3982c0e9eda1 217 *
akashvibhute 0:3982c0e9eda1 218 * Create an alternative to ZigBee radios for Arduino communication.
akashvibhute 0:3982c0e9eda1 219 *
akashvibhute 0:3982c0e9eda1 220 * Xbees are excellent little radios, backed up by a mature and robust standard
akashvibhute 0:3982c0e9eda1 221 * protocol stack. They are also expensive.
akashvibhute 0:3982c0e9eda1 222 *
akashvibhute 0:3982c0e9eda1 223 * For many Arduino uses, they seem like overkill. So I am working to build
akashvibhute 0:3982c0e9eda1 224 * an alternative using nRF24L01 radios. Modules are available for less than
akashvibhute 0:3982c0e9eda1 225 * $6 from many sources. With the RF24Network layer, I hope to cover many
akashvibhute 0:3982c0e9eda1 226 * common communication scenarios.
akashvibhute 0:3982c0e9eda1 227 *
akashvibhute 0:3982c0e9eda1 228 * Please see the @ref Zigbee page for a comparison against the ZigBee protocols
akashvibhute 0:3982c0e9eda1 229 *
akashvibhute 0:3982c0e9eda1 230 * @section Features Features
akashvibhute 0:3982c0e9eda1 231 *
akashvibhute 0:3982c0e9eda1 232 * The layer provides:
akashvibhute 0:3982c0e9eda1 233 * @li Host Addressing. Each node has a logical address on the local network.
akashvibhute 0:3982c0e9eda1 234 * @li Message Forwarding. Messages can be sent from one node to any other, and
akashvibhute 0:3982c0e9eda1 235 * this layer will get them there no matter how many hops it takes.
akashvibhute 0:3982c0e9eda1 236 * @li Ad-hoc Joining. A node can join a network without any changes to any
akashvibhute 0:3982c0e9eda1 237 * existing nodes.
akashvibhute 0:3982c0e9eda1 238 *
akashvibhute 0:3982c0e9eda1 239 * The layer does not (yet) provide:
akashvibhute 0:3982c0e9eda1 240 * @li Fragmentation/reassembly. Ability to send longer messages and put them
akashvibhute 0:3982c0e9eda1 241 * all back together before exposing them up to the app.
akashvibhute 0:3982c0e9eda1 242 * @li Power-efficient listening. It would be useful for nodes who are listening
akashvibhute 0:3982c0e9eda1 243 * to sleep for extended periods of time if they could know that they would miss
akashvibhute 0:3982c0e9eda1 244 * no traffic.
akashvibhute 0:3982c0e9eda1 245 * @li Dynamic address assignment.
akashvibhute 0:3982c0e9eda1 246 *
akashvibhute 0:3982c0e9eda1 247 * @section More How to learn more
akashvibhute 0:3982c0e9eda1 248 *
akashvibhute 0:3982c0e9eda1 249 * @li <a href="http://maniacbug.github.com/RF24/">RF24: Underlying radio driver</a>
akashvibhute 0:3982c0e9eda1 250 * @li <a href="classRF24Network.html">RF24Network Class Documentation</a>
akashvibhute 0:3982c0e9eda1 251 * @li <a href="https://github.com/maniacbug/RF24Network/">Source Code</a>
akashvibhute 0:3982c0e9eda1 252 * @li <a href="https://github.com/maniacbug/RF24Network/archives/master">Downloads Page</a>
akashvibhute 0:3982c0e9eda1 253 * @li <a href="examples.html">Examples Page</a>. Start with <a href="helloworld_rx_8pde-example.html">helloworld_rx</a> and <a href="helloworld_tx_8pde-example.html">helloworld_tx</a>.
akashvibhute 0:3982c0e9eda1 254 *
akashvibhute 0:3982c0e9eda1 255 * @section Topology Topology for Mesh Networks using nRF24L01(+)
akashvibhute 0:3982c0e9eda1 256 *
akashvibhute 0:3982c0e9eda1 257 * This network layer takes advantage of the fundamental capability of the nRF24L01(+) radio to
akashvibhute 0:3982c0e9eda1 258 * listen actively to up to 6 other radios at once. The network is arranged in a
akashvibhute 0:3982c0e9eda1 259 * <a href="http://en.wikipedia.org/wiki/Network_Topology#Tree">Tree Topology</a>, where
akashvibhute 0:3982c0e9eda1 260 * one node is the base, and all other nodes are children either of that node, or of another.
akashvibhute 0:3982c0e9eda1 261 * Unlike a true mesh network, multiple nodes are not connected together, so there is only one
akashvibhute 0:3982c0e9eda1 262 * path to any given node.
akashvibhute 0:3982c0e9eda1 263 *
akashvibhute 0:3982c0e9eda1 264 * @section Octal Octal Addressing
akashvibhute 0:3982c0e9eda1 265 *
akashvibhute 0:3982c0e9eda1 266 * Each node must be assigned an 15-bit address by the administrator. This address exactly
akashvibhute 0:3982c0e9eda1 267 * describes the position of the node within the tree. The address is an octal number. Each
akashvibhute 0:3982c0e9eda1 268 * digit in the address represents a position in the tree further from the base.
akashvibhute 0:3982c0e9eda1 269 *
akashvibhute 0:3982c0e9eda1 270 * @li Node 00 is the base node.
akashvibhute 0:3982c0e9eda1 271 * @li Nodes 01-05 are nodes whose parent is the base.
akashvibhute 0:3982c0e9eda1 272 * @li Node 021 is the second child of node 01.
akashvibhute 0:3982c0e9eda1 273 * @li Node 0321 is the third child of node 021, an so on.
akashvibhute 0:3982c0e9eda1 274 * @li The largest node address is 05555, so 3,125 nodes are allowed on a single channel.
akashvibhute 0:3982c0e9eda1 275 *
akashvibhute 0:3982c0e9eda1 276 * @section Routing How routing is handled
akashvibhute 0:3982c0e9eda1 277 *
akashvibhute 0:3982c0e9eda1 278 * When sending a message using RF24Network::write(), you fill in the header with the logical
akashvibhute 0:3982c0e9eda1 279 * node address. The network layer figures out the right path to find that node, and sends
akashvibhute 0:3982c0e9eda1 280 * it through the system until it gets to the right place. This works even if the two nodes
akashvibhute 0:3982c0e9eda1 281 * are far separated, as it will send the message down to the base node, and then back out
akashvibhute 0:3982c0e9eda1 282 * to the final destination.
akashvibhute 0:3982c0e9eda1 283 *
akashvibhute 0:3982c0e9eda1 284 * All of this work is handled by the RF24Network::update() method, so be sure to call it
akashvibhute 0:3982c0e9eda1 285 * regularly or your network will miss packets.
akashvibhute 0:3982c0e9eda1 286 *
akashvibhute 0:3982c0e9eda1 287 * @section Startup Starting up a node
akashvibhute 0:3982c0e9eda1 288 *
akashvibhute 0:3982c0e9eda1 289 * When a node starts up, it only has to contact its parent to establish communication.
akashvibhute 0:3982c0e9eda1 290 * No direct connection to the Base node is needed. This is useful in situations where
akashvibhute 0:3982c0e9eda1 291 * relay nodes are being used to bridge the distance to the base, so leaf nodes are out
akashvibhute 0:3982c0e9eda1 292 * of range of the base.
akashvibhute 0:3982c0e9eda1 293 *
akashvibhute 0:3982c0e9eda1 294 * @section Directionality Directionality
akashvibhute 0:3982c0e9eda1 295 *
akashvibhute 0:3982c0e9eda1 296 * By default all nodes are always listening, so messages will quickly reach
akashvibhute 0:3982c0e9eda1 297 * their destination.
akashvibhute 0:3982c0e9eda1 298 *
akashvibhute 0:3982c0e9eda1 299 * You may choose to sleep any nodes which do not have any active children on the network
akashvibhute 0:3982c0e9eda1 300 * (i.e. leaf nodes). This is useful in a case where
akashvibhute 0:3982c0e9eda1 301 * the leaf nodes are operating on batteries and need to sleep.
akashvibhute 0:3982c0e9eda1 302 * This is useful for a sensor network. The leaf nodes can sleep most of the time, and wake
akashvibhute 0:3982c0e9eda1 303 * every few minutes to send in a reading. However, messages cannot be sent to these
akashvibhute 0:3982c0e9eda1 304 * sleeping nodes.
akashvibhute 0:3982c0e9eda1 305 *
akashvibhute 0:3982c0e9eda1 306 * In the future, I plan to write a system where messages can still be passed upward from
akashvibhute 0:3982c0e9eda1 307 * the base, and get delivered when a sleeping node is ready to receive them. The radio
akashvibhute 0:3982c0e9eda1 308 * and underlying driver support 'ack payloads', which will be a handy mechanism for this.
akashvibhute 0:3982c0e9eda1 309 *
akashvibhute 0:3982c0e9eda1 310 * @page Zigbee Comparison to ZigBee
akashvibhute 0:3982c0e9eda1 311 *
akashvibhute 0:3982c0e9eda1 312 * This network layer is influenced by the design of ZigBee, but does not implement it
akashvibhute 0:3982c0e9eda1 313 * directly.
akashvibhute 0:3982c0e9eda1 314 *
akashvibhute 0:3982c0e9eda1 315 * @section Advantage Which is better?
akashvibhute 0:3982c0e9eda1 316 *
akashvibhute 0:3982c0e9eda1 317 * ZigBee is a much more robust, feature-rich set of protocols, with many different vendors
akashvibhute 0:3982c0e9eda1 318 * providing compatible chips.
akashvibhute 0:3982c0e9eda1 319 *
akashvibhute 0:3982c0e9eda1 320 * RF24Network is cheap. While ZigBee radios are well over $20, nRF24L01 modules can be found
akashvibhute 0:3982c0e9eda1 321 * for under $6. My personal favorite is
akashvibhute 0:3982c0e9eda1 322 * <a href="http://www.mdfly.com/index.php?main_page=product_info&products_id=82">MDFly RF-IS2401</a>.
akashvibhute 0:3982c0e9eda1 323 *
akashvibhute 0:3982c0e9eda1 324 * @section Contrast Similiarities & Differences
akashvibhute 0:3982c0e9eda1 325 *
akashvibhute 0:3982c0e9eda1 326 * Here are some comparisons between RF24Network and ZigBee.
akashvibhute 0:3982c0e9eda1 327 *
akashvibhute 0:3982c0e9eda1 328 * @li Both networks support Star and Tree topologies. Only Zigbee supports a true mesh.
akashvibhute 0:3982c0e9eda1 329 * @li In both networks, only leaf nodes can sleep (see @ref NodeNames).
akashvibhute 0:3982c0e9eda1 330 * @li ZigBee nodes are configured using AT commands, or a separate Windows application.
akashvibhute 0:3982c0e9eda1 331 * RF24 nodes are configured by recompiliing the firmware or writing to EEPROM.
akashvibhute 0:3982c0e9eda1 332 *
akashvibhute 0:3982c0e9eda1 333 * @section NodeNames Node Naming
akashvibhute 0:3982c0e9eda1 334 *
akashvibhute 0:3982c0e9eda1 335 * @li Leaf node: A node at the outer edge of the network with no children. ZigBee calls it
akashvibhute 0:3982c0e9eda1 336 * an End Device node.
akashvibhute 0:3982c0e9eda1 337 * @li Relay node: A node which has both parents and children, and relays messages from one
akashvibhute 0:3982c0e9eda1 338 * to the other. ZigBee calls it a Router.
akashvibhute 0:3982c0e9eda1 339 * @li Base node. The top of the tree node with no parents, only children. Typically this node
akashvibhute 0:3982c0e9eda1 340 * will bridge to another kind of network like Ethernet. ZigBee calls it a Co-ordinator node.
akashvibhute 0:3982c0e9eda1 341 */
akashvibhute 0:3982c0e9eda1 342
akashvibhute 0:3982c0e9eda1 343 #endif // __RF24NETWORK_H__
akashvibhute 0:3982c0e9eda1 344 // vim:ai:cin:sts=2 sw=2 ft=cpp