A simple wireless protocol to let my examples communicate each other. ssWi stands for Shared Slotted Wireless protocol

Dependents:   rover_car rover_pc supervisor watering_unit ... more

This library aims at implementing a simple communication protocol among nodes, abstracting from the hardware. The name ssWi stands for Shared Slotted Wireless. Wireless is part of the name, even though the library abstracts from the hardware, as the first version was entirely focused on the XBee modules and then the name has not been changed.

The communication channel is represented by ssWiChannel, an abstract class which models the channel that the transceivers access to. The concrete classes must implement the functions: init, read and write. The protocol automatically sends and receives data through the selected channel, exploiting the operting system timers. Addresses are not considered as the communication lays on broadcast transmissions.

The protocol provides the ssWiPort abstraction which is like memory areas shared among all the connected nodes. Reading from one port lets the node retrieve the last written value from the other nodes. Writing on one port means sending such value to other nodes.

Objects instantiated from ssWiSocket are the interface for allowing nodes to access the protocol ports.

/media/uploads/mariob/scheme.png

TODO:

  • improve the parsing of the received messages
  • communication tests with many nodes (so far, only 2 nodes have been tested)
Committer:
mariob
Date:
Thu Sep 06 12:11:52 2012 +0000
Revision:
3:1adc077d4906
Parent:
2:5228774a6b99
Child:
4:dbbf82c966c2
doc

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mariob 0:cc7218c5e5f7 1 #ifndef __SHARED_SLOTTED_WIRELESS_PORT_HPP__
mariob 0:cc7218c5e5f7 2 #define __SHARED_SLOTTED_WIRELESS_PORT_HPP__
mariob 0:cc7218c5e5f7 3
mariob 0:cc7218c5e5f7 4 #include "ssWiTypes.hpp"
mariob 0:cc7218c5e5f7 5
mariob 0:cc7218c5e5f7 6 #include "rtos.h"
mariob 0:cc7218c5e5f7 7
mariob 2:5228774a6b99 8
mariob 2:5228774a6b99 9 /** \brief Internal type which represents a logical flow
mariob 2:5228774a6b99 10 *
mariob 3:1adc077d4906 11 * Ports are used internally to model a virtual memory are of the network.
mariob 3:1adc077d4906 12 * Note that a port is a dual gate memory area which means that if you write
mariob 3:1adc077d4906 13 * on it, the reading operation does not read that value but the one received
mariob 3:1adc077d4906 14 * though the network
mariob 2:5228774a6b99 15 */
mariob 0:cc7218c5e5f7 16 class ssWiPort
mariob 0:cc7218c5e5f7 17 {
mariob 3:1adc077d4906 18 /** receiving buffer */
mariob 0:cc7218c5e5f7 19 PortValue valueRX;
mariob 0:cc7218c5e5f7 20 Mutex mutexRX;
mariob 0:cc7218c5e5f7 21
mariob 3:1adc077d4906 22 /** transmission buffer */
mariob 0:cc7218c5e5f7 23 PortValue valueTX;
mariob 0:cc7218c5e5f7 24 Mutex mutexTX;
mariob 3:1adc077d4906 25
mariob 3:1adc077d4906 26 /** modification flag (true: someone has write a new value to be sent */
mariob 0:cc7218c5e5f7 27 bool modified;
mariob 0:cc7218c5e5f7 28
mariob 0:cc7218c5e5f7 29
mariob 0:cc7218c5e5f7 30 public:
mariob 0:cc7218c5e5f7 31
mariob 0:cc7218c5e5f7 32 ssWiPort () {
mariob 0:cc7218c5e5f7 33 modified = false;
mariob 0:cc7218c5e5f7 34 valueTX = 0;
mariob 0:cc7218c5e5f7 35 valueRX = 0;
mariob 0:cc7218c5e5f7 36 }
mariob 0:cc7218c5e5f7 37
mariob 0:cc7218c5e5f7 38 //transmission
mariob 0:cc7218c5e5f7 39 PortValue getTXValue();
mariob 0:cc7218c5e5f7 40 void setTXValue(PortValue tmp);
mariob 0:cc7218c5e5f7 41 bool isModified();
mariob 0:cc7218c5e5f7 42
mariob 0:cc7218c5e5f7 43 //reception
mariob 0:cc7218c5e5f7 44 PortValue getRXValue();
mariob 0:cc7218c5e5f7 45 void setRXValue(PortValue tmp);
mariob 0:cc7218c5e5f7 46
mariob 0:cc7218c5e5f7 47 };
mariob 0:cc7218c5e5f7 48
mariob 0:cc7218c5e5f7 49 #endif //__SHARED_SLOTTED_WIRELESS_PORT_HPP__