23 #ifndef _THEETHMANAGER_H_
24 #define _THEETHMANAGER_H_
38 #include <ace/config.h>
39 #include <ace/Thread.h>
40 #include <ace/SOCK_Dgram_Bcast.h>
41 #include "ace/OS_main.h"
42 #include "ace/OS_NS_string.h"
43 #include "ace/OS_NS_sys_socket.h"
46 #include <yarp/os/Bottle.h>
47 #include <yarp/os/Time.h>
48 #include <yarp/os/Port.h>
57 #include "EoProtocol.h"
61 #include <yarp/os/LogStream.h>
64 using namespace yarp::os;
90 enum { maxRXpacketsize = 1496, maxTXpacketsize = 1496 };
107 static bool killYourself();
111 double getLifeTime(
void);
113 bool verifyEthBoardInfo(yarp::os::Searchable &cfgtotal, eOipv4addr_t &boardipv4,
string boardipv4string,
string boardname);
120 const eOipv4addressing_t& getLocalIPV4addressing(
void);
122 bool Transmission(
void);
124 bool CheckPresence(
void);
126 bool Reception(eOipv4addr_t from, uint64_t*
data, ssize_t size);
130 IethResource* getInterface(eOipv4addr_t ipv4, eOprotID32_t id32);
134 int getNumberOfResources(
void);
136 const string & getName(eOipv4addr_t ipv4);
138 int sendPacket(
const void *udpframe,
size_t len,
const eOipv4addressing_t &toaddressing);
140 eOipv4addr_t toipv4addr(
const ACE_INET_Addr &aceinetaddr);
142 ACE_INET_Addr toaceinet(
const eOipv4addressing_t &ipv4addressing);
147 bool isCommunicationInitted(
void);
149 bool createCommunicationObjects(
const eOipv4addressing_t &localaddress,
int txrate,
int rxrate);
151 bool initCommunication(yarp::os::Searchable &cfgtotal);
153 bool stopCommunicationThreads(
void);
157 bool lockTX(
bool on);
158 bool lockRX(
bool on);
159 bool lockTXRX(
bool on);
164 void initEOYsystem(
void);
167 static std::mutex managerSem;
169 static std::mutex txSem;
170 static std::mutex rxSem;
177 eOipv4addressing_t ipv4local;
179 bool communicationIsInitted;
184 ACE_SOCK_Dgram* UDP_socket;
185 bool embBoardsConnected;
eth::EthBoards * ethBoards