TOBI Interface A
0.1
|
The TiAClient class implements a client for the SignalServer The client does not need much of configuration - the only thing that a user has to know is the server address and the control connection port of the TOBI SignalServer. More...
#include <tia_client.h>
Public Member Functions | |
TiAClient (bool use_new_tia) | |
Default Constructor Call connect() to establish a connection to a TOBI SignalServer. | |
virtual | ~TiAClient () |
Destructor. | |
virtual void | connect (const std::string &address, short unsigned port) |
Establish a connection to a TOBI SignalServer The caller will be blocked until the connection has been made or an error has occurred. | |
virtual bool | connected () const |
Tells if the client is connected to the server, i.e. if the control connection has been established. | |
virtual void | disconnect () |
Disconnects from the server, i.e. stops receiving and closes the control connection. | |
virtual void | requestConfig () |
Requests the meta data information from the server The caller will be blocked until the request has been processed or an error has occurred. | |
virtual SSConfig | config () const |
Returns the meta data information requested from the server. | |
virtual void | startReceiving (bool use_udp_bc) |
Turns the client into receiving state The caller will be blocked until the client is ready to receive or an error has occurred. | |
virtual bool | receiving () const |
Tell if the client if is in receiving state. | |
virtual void | stopReceiving () |
Stops receiving, i.e. calling getDataPacket() will fail afterwards. | |
virtual DataPacket * | getEmptyDataPacket () |
Gets a packet from the server. The caller will be blocked until a packet has been received or an error has occurred. | |
virtual void | getDataPacket (DataPacket &packet) |
virtual void | setBufferSize (size_t size) |
Sets the client's data input buffer size to the given value. | |
Protected Attributes | |
TiAClientImplBase * | impl_ |
Pointer to implementation. |
The TiAClient class implements a client for the SignalServer The client does not need much of configuration - the only thing that a user has to know is the server address and the control connection port of the TOBI SignalServer.
Most of the functions are blocking, which means that the call will not end until the function has completed (time consuming) or resulted in an error.
The PIMPL (Pointer to Implementation) idiom is used to achieve binary compatibility.
This class is reentrant but not thread-safe.
Code Example:
TiAClient client; try { client.connect("127.0.0.1", 9000); client.requestConfig(); } catch (std::exception& e) { // error handling } SSConfig config = client.config(); // Read data packet try { DataPacket packet; // Get a packet from the server. Blocks the caller until a packet has been received. client.getDataPacket(packet); } catch (std::exception& e) { // error handling }
Definition at line 101 of file tia_client.h.