Low-Level C++ SDK  v1.1
Loading...
Searching...
No Matches
WeArtClient Class Reference

Weart client, used to connect to the Weart middleware, perform operations and receive messages. More...

#include <WeArtClient.h>

Public Types

enum  ErrorType { ConnectionError , SendMessageError , ReceiveMessageError }
 

Public Member Functions

 WeArtClient (PCSTR ip_address, PCSTR port)
 
void Start (TrackingType trackType=TrackingType::WEART_HAND)
 Send a start command to the middleware.
 
void Stop ()
 Send a stop command to the middleware.
 
void Run ()
 Starts and runs the network connection thread.
 
bool IsConnected ()
 Tells whether the client is connected to the Weart middleware.
 
void Close ()
 Close the network connection.
 
void StartCalibration ()
 Starts the device calibration procedure.
 
void StopCalibration ()
 Stops the device calibration procedure.
 
void SendMessage (WeArtMessage *message)
 Sends a message to the Weart middleware.
 
void AddThimbleTracking (WeArtThimbleTrackingObject *trackingObjects)
 Adds a thimble tracking object to the client, allowing it to receive messages.
 
int SizeThimbles ()
 
void AddMessageListener (WeArtMessageListener *listener)
 Adds a message listener object to the client, allowing it to receive messages.
 
void RemoveMessageListener (WeArtMessageListener *listener)
 Removes the given listener from the client. From now on the listener will not receive messages.
 
void AddConnectionStatusCallback (std::function< void(bool)> callback)
 Adds a callback for the connection status (true = connected, false = disconnected)
 
void AddErrorCallback (std::function< void(ErrorType)> callback)
 Adds a callback for errors (connection, send or receive errors)
 

Protected Member Functions

void OnReceive ()
 

Protected Attributes

WeArtMessageSerializer messageSerializer
 

Detailed Description

Weart client, used to connect to the Weart middleware, perform operations and receive messages.

WEART - Common TCP Client https://www.weart.it/

Member Enumeration Documentation

◆ ErrorType

Enumerator
ConnectionError 
SendMessageError 
ReceiveMessageError 

Constructor & Destructor Documentation

◆ WeArtClient()

WeArtClient::WeArtClient ( PCSTR  ip_address,
PCSTR  port 
)

Member Function Documentation

◆ AddConnectionStatusCallback()

void WeArtClient::AddConnectionStatusCallback ( std::function< void(bool)>  callback)

Adds a callback for the connection status (true = connected, false = disconnected)

Parameters
callbackThe callback to be called whenever the connection status changes

◆ AddErrorCallback()

void WeArtClient::AddErrorCallback ( std::function< void(ErrorType)>  callback)

Adds a callback for errors (connection, send or receive errors)

Parameters
callbackThe callback to be called whenever an error occurs

◆ AddMessageListener()

void WeArtClient::AddMessageListener ( WeArtMessageListener listener)

Adds a message listener object to the client, allowing it to receive messages.

Parameters
listenerThe listener to add

◆ AddThimbleTracking()

void WeArtClient::AddThimbleTracking ( WeArtThimbleTrackingObject trackingObjects)

Adds a thimble tracking object to the client, allowing it to receive messages.

Parameters
trackingObjectsThimble tracking object to add

◆ Close()

void WeArtClient::Close ( )

Close the network connection.

◆ IsConnected()

bool WeArtClient::IsConnected ( )

Tells whether the client is connected to the Weart middleware.

Returns
true if the client is connected, false otherwise

◆ OnReceive()

void WeArtClient::OnReceive ( )
protected

◆ RemoveMessageListener()

void WeArtClient::RemoveMessageListener ( WeArtMessageListener listener)

Removes the given listener from the client. From now on the listener will not receive messages.

Parameters
listenerThe listener to remove from the client

◆ Run()

void WeArtClient::Run ( )

Starts and runs the network connection thread.

◆ SendMessage()

void WeArtClient::SendMessage ( WeArtMessage *  message)

Sends a message to the Weart middleware.

Parameters
messageMessage to send

◆ SizeThimbles()

int WeArtClient::SizeThimbles ( )
Returns
The number of thimbles added to the connection

◆ Start()

void WeArtClient::Start ( TrackingType  trackType = TrackingType::WEART_HAND)

Send a start command to the middleware.

◆ StartCalibration()

void WeArtClient::StartCalibration ( )

Starts the device calibration procedure.

◆ Stop()

void WeArtClient::Stop ( )

Send a stop command to the middleware.

◆ StopCalibration()

void WeArtClient::StopCalibration ( )

Stops the device calibration procedure.

Member Data Documentation

◆ messageSerializer

WeArtMessageSerializer WeArtClient::messageSerializer
protected

The documentation for this class was generated from the following files: