Mario Bambagini / ssWi

Dependents:   rover_car rover_pc supervisor watering_unit ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ssWiSocket.hpp Source File

ssWiSocket.hpp

Go to the documentation of this file.
00001 /** \file ssWiSocket.hpp
00002  *
00003  *  \brief Header for the communication socket
00004  *
00005  */
00006 
00007 #ifndef __SHARED_SLOTTED_WIRELESS_SOCKET_HPP__
00008 #define __SHARED_SLOTTED_WIRELESS_SOCKET_HPP__
00009 
00010 
00011 #include "ssWiTypes.hpp"
00012 
00013 
00014 /** \brief Socket to communciate through ssWi
00015  *
00016  * It is not possible to instanciate directly a ssWiSocket, use the static
00017  * method createSocket
00018  */
00019 class ssWiSocket
00020 {
00021     /** \brief Port identifier */
00022     PortID _id;
00023 
00024     /** \brief Hidden constructor */
00025     ssWiSocket(PortID id) : _id(id) {}
00026 
00027 public:
00028 
00029     /** \brief create a new socket
00030      * 
00031      * If the network is not inizialized yet, the method returns false
00032      *
00033      * \param id port identifier to connect the socket with
00034      * \return the created socket
00035      */
00036     static ssWiSocket* createSocket(PortID id);
00037 
00038     /** \brief read the last value read through the network on such socket
00039      *
00040      * \return the read value
00041      */
00042     PortValue read ();
00043 
00044     /** \brief write a new value to be sent through the socket
00045      *
00046      * \param value value to be sent
00047      */
00048     void write (PortValue value);
00049 
00050 };
00051 
00052 
00053 #endif //__SHARED_SLOTTED_WIRELESS_SOCKET_HPP__