|
tobicore
7.0.0
|
TOBI platform generic interface. More...
#include <tobiplatform/TPInterface.hpp>
Inheritance diagram for TPInterface:
Collaboration diagram for TPInterface:Public Types | |
| enum | { AsServer = 0, AsClient } |
| Plugging mode. More... | |
| enum | { Unsuccessful = 0, Successful, ErrorSocket, ErrorEndpoint, ErrorBound, ErrorGeneric, ErrorNotSupported, ErrorProtocol, ErrorTimeout } |
| Status/error codes. More... | |
Public Member Functions | |
| TPInterface (void) | |
| Constructor. | |
| virtual | ~TPInterface (void) |
| Destructor. | |
| int | Plug (const std::string &ip, const std::string &port, int mode=TPInterface::AsServer) |
| Plug. | |
| void | Unplug (void) |
| Unplug. | |
| bool | IsPlugged (void) |
Protected Member Functions | |
| virtual int | ConfAsServer (const std::string &ip, const std::string &port) |
| virtual int | ConfAsClient (const std::string &ip, const std::string &port) |
Protected Attributes | |
| TPSocket * | _socket |
| Socket for TCP communication. | |
| TPSocket * | _endpoint |
| Reference to communication endpoint. | |
| TPSocket * | _com |
| Reference to _socket or _endpoint. | |
| TPStreamer | _stream |
| Data streamer. | |
| std::string | _cache |
TOBI platform generic interface.
This class provides all the methods to develop a TCP/IP TOBI platform component. It uses a TPSocket object to abstract communication as server or as client. For this reason, a TPInterface can be "plugged" to another. The TOBI platform iC and iD pluggable classes (TPiC and TPiD) derive directly from this class.
Definition at line 38 of file TPInterface.hpp.
| anonymous enum |
Plugging mode.
Definition at line 76 of file TPInterface.hpp.
| anonymous enum |
Status/error codes.
Definition at line 86 of file TPInterface.hpp.
| int TPInterface::Plug | ( | const std::string & | ip, |
| const std::string & | port, | ||
| int | mode = TPInterface::AsServer |
||
| ) |
Plug.
This method allows to bind a TCP socket or to connect to a remote one.
Definition at line 33 of file TPInterface.cpp.
| void TPInterface::Unplug | ( | void | ) |
Unplug.
Unbinds or disconnect.
Definition at line 45 of file TPInterface.cpp.
Here is the call graph for this function: