Assumptions
-----------
* Using ContikiOS
* One single gateway, communicating with a central server
* Gateway sends information to central server regularly
* Up to 2^N^ nodes, each with up to 2^S^ sensors, of up to 2^T^ types
* Each node has IC (internal clock) and sufficient memory to store a few variables
* Each node has to enter idle mode as much as necessary
* Each node does regular checking of sensor reading modifications
* Gateway observes all modifications to sensor readings only when they occur, and receives the sensor readings
* The gateway can subscribe itself to all nodes and listen only to a certain type of sensor readings
* Nodes have sensors that read data as a F-bit floating value (if type is not float, it is automatically converted)
* Nodes know which sensors are of which type
* Node timestamp (IC) is not synchronized with gateway timestamp (IC)
* If one or two more gateways are close, there is no physical way to determine which sensors subscribe to which gateway (unless using a GPS)
* Each node has a way of measuring its battery power level
Reliable protocol
-----------------
* Needs to be implemented on top of Contiki (e.g. http://www.sics.se/~adam/pt/examples.html)
* Solution: use uIP (http://www.sics.se/~adam/download/uip-1.0-refman.pdf)
Node discovery
--------------
* Using uIP protocol
* DNS support is included
Packet layouts
--------------
* When node initializes, or when (IC - LST) > X (LST = Last Signup Time with gateway, X = nr. of seconds after which node needs to renew IP), try to obtain new IP address from gateway
* Timer that triggers once every X seconds
* If not successful, try again on next timer trigger
* If succesful, set LST to IC
* Set timer on node for Y seconds (X could be equal to Y) and read sensors each Y seconds; if modifications occur from the previous reading, record timestamp and new sensor value and send it to listener (gateway)
* Sensor readings sent to listener:
[ [ Unique_Sensor_ID (SizeOf(IP_Address) + S bits = IP address + sensor ID) | IC_Timestamp (I bits) | Sensor_Data (F bits) ] ... ]
* When gateway initializes, record itself as listener to all available nodes (all subscribed nodes)
* Gateway registering as listener to node:
[ Sensor_reading_types (T bits, Interested/NotInterested) ]
* When new connection arrives, record as listener to the node that triggered it
* Receive data from sensor whenever a change occurs; store timestamp as Old_Time_stamp_value + (Sensor_Time_stamp - Sensor_old_Time_stamp)
* Timer triggering once every N seconds that sends data to central server