Class CServiceClient

Class Documentation

class eCAL::CServiceClient

Service client wrapper class.

Public Functions

CServiceClient()

Constructor.

CServiceClient(const std::string &service_name_)

Constructor.

Parameters

service_name_ – Unique service name.

virtual ~CServiceClient()

Destructor.

CServiceClient(const CServiceClient&) = delete

CServiceClients are non-copyable.

CServiceClient &operator=(const CServiceClient&) = delete

CServiceClients are non-copyable.

bool Create(const std::string &service_name_)

Creates this object.

Parameters

service_name_ – Unique service name.

Returns

True if successful.

bool Destroy()

Destroys this object.

Returns

True if successful.

bool SetHostName(const std::string &host_name_)

Change the host name filter for that client instance.

Parameters

host_name_ – Host name filter (empty == all hosts)

Returns

True if successful.

bool Call(const std::string &method_name_, const std::string &request_, int timeout_ = -1)

Call a method of this service, responses will be returned by callback.

Parameters
  • method_name_ – Method name.

  • request_ – Request string.

  • timeout_ – Maximum time before operation returns (in milliseconds, -1 means infinite).

Returns

True if successful.

bool Call(const std::string &method_name_, const std::string &request_, int timeout_, ServiceResponseVecT *service_response_vec_)

Call a method of this service, all responses will be returned in service_response_vec_.

Parameters
  • method_name_ – Method name.

  • request_ – Request string.

  • timeout_ – Maximum time before operation returns (in milliseconds, -1 means infinite).

  • service_response_vec_[out] Response vector containing service responses from every called service (null pointer == no response).

Returns

True if successful.

bool Call(const std::string &host_name_, const std::string &method_name_, const std::string &request_, struct SServiceResponse &service_info_, std::string &response_)

Call method of this service, for specific host (deprecated).

Parameters
  • host_name_ – Host name.

  • method_name_ – Method name.

  • request_ – Request string.

  • service_info_[out] Service response struct for detailed informations.

  • response_[out] Response string.

Returns

True if successful.

bool CallAsync(const std::string &method_name_, const std::string &request_, int timeout_ = -1)

Call a method of this service asynchronously, responses will be returned by callback.

Parameters
  • method_name_ – Method name.

  • request_ – Request string.

  • timeout_ – Maximum time before operation returns (in milliseconds, -1 means infinite) - NOT SUPPORTED YET.

Returns

True if successful.

bool AddResponseCallback(const ResponseCallbackT &callback_)

Add server response callback.

Parameters

callback_ – Callback function for server response.

Returns

True if successful.

bool RemResponseCallback()

Remove server response callback.

Returns

True if successful.

bool AddEventCallback(eCAL_Client_Event type_, ClientEventCallbackT callback_)

Add client event callback function.

Parameters
  • type_ – The event type to react on.

  • callback_ – The callback function to add.

Returns

True if succeeded, false if not.

bool RemEventCallback(eCAL_Client_Event type_)

Remove client event callback function.

Parameters

type_ – The event type to remove.

Returns

True if succeeded, false if not.

std::string GetServiceName()

Retrieve service name.

Returns

The service name.

bool IsConnected()

Check connection state.

Returns

True if connected, false if not.