Mario Bambagini / ssWi

Dependents:   rover_car rover_pc supervisor watering_unit ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ssWiSocket.cpp Source File

ssWiSocket.cpp

Go to the documentation of this file.
00001 /** \file ssWiSocket.cpp
00002  *  \brief Implementation of the communication socket
00003  *
00004  */
00005  
00006 #include "ssWiSocket.hpp"
00007 #include "ssWiPort.hpp"
00008 #include "ssWi.hpp"
00009 
00010 #include <map>
00011 
00012 
00013 extern std::map<int, ssWiPort> ports;
00014 
00015 
00016 PortValue ssWiSocket::read () {
00017     return ports[_id].getRXValue();
00018 }
00019 
00020 void ssWiSocket::write (PortValue value) {
00021     ports[_id].setTXValue(value);
00022 }
00023 
00024 ssWiSocket* ssWiSocket::createSocket(PortID id)
00025 {
00026     if (!ssWi_setPort(id))
00027         return NULL;
00028         
00029     return new ssWiSocket(id);
00030 }