Low-Level C++ SDK  v1.2.0
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 }
 
using MessageCallback = std::function< void(WeArtMessage *)>
 

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 StartRawData ()
 Ask the middleware to send raw sensors data to the sdk.
 
void StopRawData ()
 Ask the middleware to stop sending raw sensors data to the sdk.
 
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.
 
void AddThimbleRawSensors (WeArtTrackingRawData *rawSensorData)
 Adds a raw data sensors observer to the client, allowing it to receive messages.
 
void AddThimbleAnalogRawSensor (WeArtAnalogSensorData *analogRawSensorData)
 Adds a analog raw data sensors observer 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 AddMessageCallback (MessageCallback callback)
 Adds a message callback called when a message is received.
 
void RemoveMessageListener (WeArtMessageListener *listener)
 Removes the given listener from the client. From now on the listener will not receive messages.
 
void RemoveMessageCallback (MessageCallback callback)
 Remove a given callback from the client.
 
void AddConnectionStatusCallback (std::function< void(bool)> callback)
 Adds a callback for the connection status (true = connected, false = disconnected)
 
void AddErrorCallback (std::function< void(WeArtClient::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 Typedef Documentation

◆ MessageCallback

using WeArtClient::MessageCallback = std::function<void(WeArtMessage*)>

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(WeArtClient::ErrorType)>  callback)

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

Parameters
callbackThe callback to be called whenever an error occurs

◆ AddMessageCallback()

void WeArtClient::AddMessageCallback ( WeArtClient::MessageCallback  callback)

Adds a message callback called when a message is received.

Parameters
callbackCallback to add

◆ AddMessageListener()

void WeArtClient::AddMessageListener ( WeArtMessageListener listener)

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

Parameters
listenerThe listener to add

◆ AddThimbleAnalogRawSensor()

void WeArtClient::AddThimbleAnalogRawSensor ( WeArtAnalogSensorData analogRawSensorData)

Adds a analog raw data sensors observer to the client, allowing it to receive messages.

Parameters
analogSensorDataRaw sensors data object to add

◆ AddThimbleRawSensors()

void WeArtClient::AddThimbleRawSensors ( WeArtTrackingRawData rawSensorData)

Adds a raw data sensors observer to the client, allowing it to receive messages.

Parameters
trackingObjectsRaw sensors data object 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

◆ RemoveMessageCallback()

void WeArtClient::RemoveMessageCallback ( WeArtClient::MessageCallback  callback)

Remove a given callback from the client.

Parameters
callbackCallback to remove

◆ 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.

Parameters
trackTypeType of tracking requested

◆ StartCalibration()

void WeArtClient::StartCalibration ( )

Starts the device calibration procedure.

◆ StartRawData()

void WeArtClient::StartRawData ( )

Ask the middleware to send raw sensors data to the sdk.

◆ Stop()

void WeArtClient::Stop ( )

Send a stop command to the middleware.

◆ StopCalibration()

void WeArtClient::StopCalibration ( )

Stops the device calibration procedure.

◆ StopRawData()

void WeArtClient::StopRawData ( )

Ask the middleware to stop sending raw sensors data to the sdk.

Member Data Documentation

◆ messageSerializer

WeArtMessageSerializer WeArtClient::messageSerializer
protected

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