Kanzi Connect 3.9.10
kanzi::connect::Worker Class Reference

A class that integrates Kanzi Connect client to Kanzi UI event loop. More...

#include <worker.hpp>

Inheritance diagram for kanzi::connect::Worker:
kanzi::connect::WorkerBase kanzi::connect::Connection::WorkNotifyCallback

Public Member Functions

const string & getIdentity ()
 Returns the identity of this client, usually describing the owner of the device (ie.
 
const string & getName ()
 Returns the name of this client (ie.
 
 Worker (ClientSharedPtr client)
 Constructor.
 
virtual ~Worker ()
 Destructor.
 
- Public Member Functions inherited from kanzi::connect::WorkerBase
void configure (Domain &domain, ConnectionConfigurationParser &parser, const ConnectionConfigurationReadIf::Configuration &config, const string &serverName)
 Configure the worker with parsed connection configuration.
 
const string getActiveAddress ()
 Retrieve the IP Address of the host that is to be connected next.
 
string getFileServerAddress () const
 Retrieve file server address.
 
const string & getIdentity ()
 Returns the identity of this client, usually describing the owner of the device (ie.
 
const string & getName ()
 Returns the name of this client (ie.
 
const string getServerName ()
 Retrieve the IP Address of the host that is to be connected next.
 
void start ()
 Starts the worker, connects to server and starts operation.
 
void stop ()
 Stops the worker, disconnects from server and stops operation.
 
 WorkerBase (ClientSharedPtr client, const string filename)
 Constructor.
 
virtual ~WorkerBase ()
 Destructor.
 
- Public Member Functions inherited from kanzi::connect::Connection::WorkNotifyCallback
virtual ~WorkNotifyCallback ()
 Virtual destructor for cleanup.
 

Protected Member Functions

virtual void onConnectionStateChanged (Connection::State state)
 Virtual method - inherited classes must invoke the base class method.
 
- Protected Member Functions inherited from kanzi::connect::WorkerBase
string buildFilenameFromAttribute (const string attributeName)
 Constructs a filename from a defined attribute.
 
bool cacheReferredFile (const string attributeName)
 Check whether specific attribute points to a valid path.
 
bool connect ()
 
void disconnect ()
 
string getSSLAttributeValue (const string name)
 Retrieve SSL attribute with specific name.
 
bool hasSSLAttribute (const string &name, map< string, string > &map)
 Checks whether there is SSL attribute with specific name.
 
bool hasSSLAttribute (const string &name, unordered_map< string, string > &map)
 Checks whether there is SSL attribute with specific name.
 
bool readAndStoreFile (const string filename, const string filenameBase)
 Reads specific file and stores contents into local variable.
 
string readReferredFile (const string attributeName)
 Read the referred attribute value.
 
void seekToNextAddress ()
 In case multiple addresses configured, advances to the next address after a unsuccessful connect.
 
void setPollTimerState (bool running, int interval=0)
 Controls the poll timer state and interval.
 
void taskWork (int interval)
 
void workAvailable ()
 Invoked to notify that work is available.
 

Additional Inherited Members

- Protected Types inherited from kanzi::connect::WorkerBase
enum  TaskState { Startup , Connect , Connecting , Running }
 
- Protected Attributes inherited from kanzi::connect::WorkerBase
DiagnosticsServiceClient::DiagnosticsSubscriptionToken m_addLinkLatencyMeasureRequestSubscriptionToken
 
vector< string > m_addresses
 List of addresses to try sequentially.
 
size_t m_addressIndex
 Index of address to be used next.
 
string m_bearer
 
ClientSharedPtr m_client
 Connection to a server.
 
ConnectionConfigurationReadIf::Configuration m_config
 
string m_configurationFilename
 The configuration file.
 
shared_ptr< ConnectionInterfaceClient > m_connectionInterface
 
ClientConnectionObserverm_connectionObserver
 
shared_ptr< ClientConnectionSession > m_connectionSession
 
Connection::ConnectionStateSubscriptionToken m_connectionSubscription
 
int m_connectionTimeout
 
DiagnosticsServiceClientSharedPtr m_diagnostics
 
Domain * m_domain
 
unordered_map< string, unique_ptr< char[]> > m_fileContents
 Map that caches file contents.
 
string m_fileServerAddress
 Remote file server IP address.
 
string m_identity
 
MainLoopTimerToken m_mainloopTimerToken
 Handle for timer registration.
 
string m_name
 
string m_resourcePath
 
string m_serverName
 
RPCResult< int > m_serverWatchdog
 
RPCTypes::CallbackFunctionSubscriptionToken m_serverWatchdogCallbackToken
 
unordered_map< string, string > m_sslAttributes
 map holding SSL attributes.
 
TaskState m_state
 
unsigned int m_watchdogTimeout = 5000
 

Detailed Description

A class that integrates Kanzi Connect client to Kanzi UI event loop.

Constructor & Destructor Documentation

◆ Worker()

kanzi::connect::Worker::Worker ( ClientSharedPtr client)

Constructor.

Parameters
clientKanzi Connect client instance that is managed by this worker.

◆ ~Worker()

virtual kanzi::connect::Worker::~Worker ( )
virtual

Destructor.

Member Function Documentation

◆ getIdentity()

const string & kanzi::connect::Worker::getIdentity ( )
inline

Returns the identity of this client, usually describing the owner of the device (ie.

'John').

Returns
Identity of this client.

◆ getName()

const string & kanzi::connect::Worker::getName ( )
inline

Returns the name of this client (ie.

'Cluster', 'HUD').

Returns
Name of this client.

◆ onConnectionStateChanged()

virtual void kanzi::connect::Worker::onConnectionStateChanged ( Connection::State state)
protectedvirtual

Virtual method - inherited classes must invoke the base class method.

Parameters
statenew state.

Reimplemented from kanzi::connect::WorkerBase.


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