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:
Mon Sep 24 21:15:42 2012 +0000
Revision:
9:b5b5d0533fa6
Parent:
4:dbbf82c966c2
Child:
13:69ff47a83260
bho

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mariob 4:dbbf82c966c2 1 #ifndef __SHARED_SLOTTED_WIRELESS_HPP__
mariob 4:dbbf82c966c2 2 #define __SHARED_SLOTTED_WIRELESS_HPP__
mariob 4:dbbf82c966c2 3
mariob 4:dbbf82c966c2 4 #include "ssWiTypes.hpp"
mariob 4:dbbf82c966c2 5
mariob 9:b5b5d0533fa6 6
mariob 9:b5b5d0533fa6 7 #define START_0 255
mariob 9:b5b5d0533fa6 8 #define START_1 130
mariob 9:b5b5d0533fa6 9 #define START_2 255
mariob 9:b5b5d0533fa6 10
mariob 9:b5b5d0533fa6 11
mariob 4:dbbf82c966c2 12 /** \brief number of provided ports
mariob 4:dbbf82c966c2 13 *
mariob 4:dbbf82c966c2 14 */
mariob 4:dbbf82c966c2 15 #define N_PORTS 256
mariob 4:dbbf82c966c2 16
mariob 4:dbbf82c966c2 17 class ssWiChannel;
mariob 4:dbbf82c966c2 18
mariob 4:dbbf82c966c2 19 /** \brief Initialize the ssWi protocol
mariob 4:dbbf82c966c2 20 *
mariob 4:dbbf82c966c2 21 * It is not possible to have two instances of this protocol at the same time.
mariob 4:dbbf82c966c2 22 *
mariob 4:dbbf82c966c2 23 * \param c channel to be used for sending/receving data
mariob 4:dbbf82c966c2 24 * \param rateTX transmission rate
mariob 4:dbbf82c966c2 25 * \param rateRX receiving rate
mariob 4:dbbf82c966c2 26 * \return true if the network has been correctly initialized, false otherwise
mariob 4:dbbf82c966c2 27 */
mariob 4:dbbf82c966c2 28 bool ssWi_init (ssWiChannel* c, int rateTX, int rateRX);
mariob 4:dbbf82c966c2 29
mariob 4:dbbf82c966c2 30 void ssWi_stop ();
mariob 4:dbbf82c966c2 31
mariob 4:dbbf82c966c2 32 bool ssWi_isActive (PortID port);
mariob 4:dbbf82c966c2 33
mariob 4:dbbf82c966c2 34 bool ssWi_setPort (PortID port);
mariob 4:dbbf82c966c2 35
mariob 4:dbbf82c966c2 36 bool ssWi_unsetPort (PortID port);
mariob 4:dbbf82c966c2 37
mariob 4:dbbf82c966c2 38
mariob 4:dbbf82c966c2 39 #endif //__SHARED_SLOTTED_WIRELESS_HPP__