#include <GyrosMoosCommsInterface.h>
Public Member Functions | |
const void * | GetCommObject (void) |
GyrosMoosCommsInterface (const labust::xml::Reader &reader, std::string configToUse="") | |
GyrosMoosCommsInterface (const std::string &configPath, std::string configToUse="") | |
bool | Iterate () |
bool | OnConnectToServer () |
bool | OnDisconnectFromServer () |
bool | OnNewMail (MOOSMSG_LIST &NewMail) |
bool | OnStartUp () |
COMMERRORS::CommError | Receive (std::vector< labust::xml::GyrosReader > &data, bool wait=false) |
virtual void | RegisterCallbackObject (CommEntity *entity) |
COMMERRORS::CommError | Send (const labust::xml::GyrosWriter &data, bool wait=false) |
COMMERRORS::CommError | Send (const std::vector< labust::xml::GyrosWriter > &data, bool wait=false) |
virtual void | UnRegisterCallbackObject () |
virtual | ~GyrosMoosCommsInterface () |
Private Member Functions | |
GyrosMoosCommsInterface (const GyrosMoosCommsInterface &orig) | |
GyrosMoosCommsInterface & | operator= (const GyrosMoosCommsInterface &) |
Private Attributes | |
boost::thread | commsThread |
MoosConfig | config |
boost::condition_variable | dataReceivedSignal |
boost::condition_variable | dataSentSignal |
boost::mutex | locker |
std::vector < labust::xml::GyrosReader > | messagesReceived |
std::vector < labust::xml::GyrosWriter > | messagesToSend |
Definition at line 24 of file GyrosMoosCommsInterface.h.
LABUST::COMMUNICATION::GyrosMoosCommsInterface::GyrosMoosCommsInterface | ( | const labust::xml::Reader & | reader, |
std::string | configToUse = "" |
||
) |
Constructor that reads MOOS configuration from a preloaded XML file /xmlreader) XML reader must be set to the right <config> node before
reader | XML reader with preloaded and preset config file, mandatory |
configToUse | name of configuration to use, if empty, the first one will be used |
Definition at line 19 of file GyrosMoosCommsInterface.cpp.
LABUST::COMMUNICATION::GyrosMoosCommsInterface::GyrosMoosCommsInterface | ( | const std::string & | configPath, |
std::string | configToUse = "" |
||
) |
Constructor that reads MOOS configuration from an XML file on disk finds the first element <commsConfig type="moos"> with the configToUse name (if provided)
configPath | path to config file, mandatory |
configToUse | name of configuration to use, if empty, the first one will be used |
Definition at line 59 of file GyrosMoosCommsInterface.cpp.
Definition at line 117 of file GyrosMoosCommsInterface.cpp.
LABUST::COMMUNICATION::GyrosMoosCommsInterface::GyrosMoosCommsInterface | ( | const GyrosMoosCommsInterface & | orig | ) | [private] |
Definition at line 113 of file GyrosMoosCommsInterface.cpp.
const void * LABUST::COMMUNICATION::GyrosMoosCommsInterface::GetCommObject | ( | void | ) | [virtual] |
Returns pointer to MOOS client
Reimplemented from LABUST::COMMUNICATION::GyrosCommsInterface.
Definition at line 179 of file GyrosMoosCommsInterface.cpp.
Definition at line 235 of file GyrosMoosCommsInterface.cpp.
Definition at line 258 of file GyrosMoosCommsInterface.cpp.
Definition at line 294 of file GyrosMoosCommsInterface.cpp.
bool LABUST::COMMUNICATION::GyrosMoosCommsInterface::OnNewMail | ( | MOOSMSG_LIST & | NewMail | ) |
Definition at line 276 of file GyrosMoosCommsInterface.cpp.
GyrosMoosCommsInterface& LABUST::COMMUNICATION::GyrosMoosCommsInterface::operator= | ( | const GyrosMoosCommsInterface & | ) | [private] |
COMMERRORS::CommError LABUST::COMMUNICATION::GyrosMoosCommsInterface::Receive | ( | std::vector< labust::xml::GyrosReader > & | data, |
bool | wait = false |
||
) | [virtual] |
PASSIVE This methods allows to receive data from the comms buffer. in case the system has to initiate communication Stores all received data in the GYROSreader vector as multiple objects If lock is set, the call blocks until data is available for receiving, otherwise exits with an empty vector NAme of variable data was received from is stored as label of the gyros object
data | vector of gyros objects to hold new data |
wait | true if the call should block until data is available, false to return error code |
Implements LABUST::COMMUNICATION::GyrosCommsInterface.
Definition at line 150 of file GyrosMoosCommsInterface.cpp.
void LABUST::COMMUNICATION::GyrosMoosCommsInterface::RegisterCallbackObject | ( | CommEntity * | entity | ) | [virtual] |
ACTIVE Allows registration of object which will handle incomming messages from MOOS
obj | pointer to object on which callbacks will be executed |
Reimplemented from LABUST::COMMUNICATION::GyrosCommsInterface.
Definition at line 184 of file GyrosMoosCommsInterface.cpp.
COMMERRORS::CommError LABUST::COMMUNICATION::GyrosMoosCommsInterface::Send | ( | const labust::xml::GyrosWriter & | data, |
bool | wait = false |
||
) | [virtual] |
PASSIVE or ACTIVE usage Sends data through MOOS data is passed as a GYROSWriter object
data | reference to GYrosWriter with data to send |
wait | true if function should block until the data is sent, false to return immediately |
Implements LABUST::COMMUNICATION::GyrosCommsInterface.
Definition at line 125 of file GyrosMoosCommsInterface.cpp.
COMMERRORS::CommError LABUST::COMMUNICATION::GyrosMoosCommsInterface::Send | ( | const std::vector< labust::xml::GyrosWriter > & | data, |
bool | wait = false |
||
) | [virtual] |
PASSIVE or ACTIVE usage Sends data through MOOS data is passed as a GYROSWriter object vector
data | reference to GYrosWriter vector with data to send |
wait | true if function should block until the data is sent, false to return immediately |
Implements LABUST::COMMUNICATION::GyrosCommsInterface.
Definition at line 136 of file GyrosMoosCommsInterface.cpp.
void LABUST::COMMUNICATION::GyrosMoosCommsInterface::UnRegisterCallbackObject | ( | ) | [virtual] |
sets callbackobject to NULL
Definition at line 189 of file GyrosMoosCommsInterface.cpp.
boost::thread LABUST::COMMUNICATION::GyrosMoosCommsInterface::commsThread [private] |
Definition at line 126 of file GyrosMoosCommsInterface.h.
Definition at line 122 of file GyrosMoosCommsInterface.h.
boost::condition_variable LABUST::COMMUNICATION::GyrosMoosCommsInterface::dataReceivedSignal [private] |
Definition at line 127 of file GyrosMoosCommsInterface.h.
boost::condition_variable LABUST::COMMUNICATION::GyrosMoosCommsInterface::dataSentSignal [private] |
Definition at line 127 of file GyrosMoosCommsInterface.h.
boost::mutex LABUST::COMMUNICATION::GyrosMoosCommsInterface::locker [private] |
Definition at line 128 of file GyrosMoosCommsInterface.h.
std::vector<labust::xml::GyrosReader> LABUST::COMMUNICATION::GyrosMoosCommsInterface::messagesReceived [private] |
Definition at line 124 of file GyrosMoosCommsInterface.h.
std::vector<labust::xml::GyrosWriter> LABUST::COMMUNICATION::GyrosMoosCommsInterface::messagesToSend [private] |
Definition at line 123 of file GyrosMoosCommsInterface.h.