ocra-recipes
Doxygen documentation for the ocra-recipes repository
|
#include <ClientCommunications.h>
Classes | |
class | InputCallback |
Public Member Functions | |
ClientCommunications () | |
virtual | ~ClientCommunications () |
bool | open (double timeout=20.0, bool connectToTasks=true) |
bool | close () |
void | close (const std::string &taskName) |
virtual bool | read (yarp::os::ConnectionReader &connection) |
void | parseMessage (yarp::os::Bottle &input) |
std::vector< std::string > | getTaskTypes () |
yarp::os::Bottle | queryController (yarp::os::Bottle &requestBottle) |
yarp::os::Bottle | queryController (const SERVER_COMMUNICATIONS_MESSAGE request) |
yarp::os::Bottle | queryController (const std::vector< SERVER_COMMUNICATIONS_MESSAGE > requestVector) |
std::vector< std::string > | getTaskPortNames () |
std::string | getTaskPortName (const std::string &taskName) |
std::vector< std::string > | getTaskNames () |
std::shared_ptr< yarp::os::RpcClient > | getTaskClient (const std::string &taskName) |
std::string | getClientPortName () |
bool | parseInput (yarp::os::Bottle &input) |
Definition at line 30 of file ClientCommunications.h.
ClientCommunications::ClientCommunications | ( | ) |
Definition at line 9 of file ClientCommunications.cpp.
|
virtual |
Definition at line 23 of file ClientCommunications.cpp.
bool ClientCommunications::close | ( | ) |
Closes the RPC and input ports opened by this client.
Definition at line 69 of file ClientCommunications.cpp.
void ClientCommunications::close | ( | const std::string & | taskName | ) |
Closes the task-specific RPC ports and deletes this task from the list of current clients.
taskName | Name of the task. |
Definition at line 82 of file ClientCommunications.cpp.
|
inline |
Definition at line 127 of file ClientCommunications.h.
std::shared_ptr< yarp::os::RpcClient > ClientCommunications::getTaskClient | ( | const std::string & | taskName | ) |
Definition at line 178 of file ClientCommunications.cpp.
std::vector< std::string > ClientCommunications::getTaskNames | ( | ) |
Definition at line 165 of file ClientCommunications.cpp.
std::string ClientCommunications::getTaskPortName | ( | const std::string & | taskName | ) |
Definition at line 151 of file ClientCommunications.cpp.
std::vector< std::string > ClientCommunications::getTaskPortNames | ( | ) |
Definition at line 138 of file ClientCommunications.cpp.
std::vector< std::string > ClientCommunications::getTaskTypes | ( | ) |
Queries the server for the task types as strings.
Definition at line 56 of file ClientCommunications.cpp.
bool ClientCommunications::open | ( | double | timeout = 20.0 , |
bool | connectToTasks = true |
||
) |
Opens an RPC port for the client with the format /ControllerClient/<client-number>/rpc:o and an input one with the format /ControllerClient/<client-number>/:i
[in] | connectToTasks | True to automatically connect to task RPC ports. True by default. |
Definition at line 29 of file ClientCommunications.cpp.
bool ClientCommunications::parseInput | ( | yarp::os::Bottle & | input | ) |
Definition at line 285 of file ClientCommunications.cpp.
void ClientCommunications::parseMessage | ( | yarp::os::Bottle & | input | ) |
The method that does the real parsing. The expected messages from the server are: REMOVE_TASK_PORT or HELP.
input | A bottle containing the message sent by the server. |
Definition at line 237 of file ClientCommunications.cpp.
yarp::os::Bottle ClientCommunications::queryController | ( | yarp::os::Bottle & | requestBottle | ) |
Takes a bottled query from the client and sends it to the server via RPC.
requestBottle | Bottled query to be sent to the server. |
Definition at line 189 of file ClientCommunications.cpp.
yarp::os::Bottle ClientCommunications::queryController | ( | const SERVER_COMMUNICATIONS_MESSAGE | request | ) |
Sends a request to the server among one of the predefined messages in ocra_recipes::SERVER_COMMUNICATIONS_MESSAGE.
request | These could be General indicators, controller requests, controller status indicators or task requests. See ocra_recipes::SERVER_COMMUNICATIONS_MESSAGE for more options. |
Definition at line 196 of file ClientCommunications.cpp.
yarp::os::Bottle ClientCommunications::queryController | ( | const std::vector< SERVER_COMMUNICATIONS_MESSAGE > | requestVector | ) |
Allows to send a series of messages from ocra_recipes::SERVER_COMMUNICATIONS_MESSAGE.
requestVector | Vector of communication messages to be sent to the server. |
Definition at line 204 of file ClientCommunications.cpp.
|
virtual |
Reads and parses (parseMessage()) a message sent by the server.
connection | Source of the message. |
Definition at line 91 of file ClientCommunications.cpp.