A class implements basis related to integrating of Kanzi workloop into kanziconnect workloop.
More...
#include <workerbase.hpp>
A class implements basis related to integrating of Kanzi workloop into kanziconnect workloop.
◆ TaskState
Enumerator |
---|
Startup | |
Connect | |
Connecting | |
Running | |
◆ WorkerBase()
kanzi::connect::WorkerBase::WorkerBase |
( |
ClientSharedPtr |
client, |
|
|
const string |
filename |
|
) |
| |
Constructor.
- Parameters
-
client | Kanzi Connect client instance that is managed by this worker. |
◆ ~WorkerBase()
virtual kanzi::connect::WorkerBase::~WorkerBase |
( |
| ) |
|
|
virtual |
◆ buildFilenameFromAttribute()
string kanzi::connect::WorkerBase::buildFilenameFromAttribute |
( |
const string |
attributeName | ) |
|
|
protected |
Constructs a filename from a defined attribute.
Adds optional path information
- Parameters
-
attributeName | the name of the attribute |
- Returns
- filename with possible path
◆ cacheReferredFile()
bool kanzi::connect::WorkerBase::cacheReferredFile |
( |
const string |
attributeName | ) |
|
|
protected |
Check whether specific attribute points to a valid path.
- Parameters
-
attributeName | name of the attribute where to read the filename of the file to check |
- Returns
- true if referred file exists and is readable
◆ configure()
Configure the worker with parsed connection configuration.
- Parameters
-
domain | The UI domain |
parser | configuration parser holding all the configurations. |
config | Contains the connection configuration to use |
◆ connect()
bool kanzi::connect::WorkerBase::connect |
( |
| ) |
|
|
protected |
- Returns
- true if connection establishment started ( does not mean connection estabilished already ).
◆ disconnect()
void kanzi::connect::WorkerBase::disconnect |
( |
| ) |
|
|
protected |
◆ getActiveAddress()
const string kanzi::connect::WorkerBase::getActiveAddress |
( |
| ) |
|
Retrieve the IP Address of the host that is to be connected next.
- Returns
- IP address
◆ getFileServerAddress()
string kanzi::connect::WorkerBase::getFileServerAddress |
( |
| ) |
const |
Retrieve file server address.
- Returns
- the address
◆ getIdentity()
const string& kanzi::connect::WorkerBase::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::WorkerBase::getName |
( |
| ) |
|
|
inline |
Returns the name of this client (ie.
'Cluster', 'HUD').
- Returns
- Name of this client.
◆ getServerName()
const string kanzi::connect::WorkerBase::getServerName |
( |
| ) |
|
|
inline |
Retrieve the IP Address of the host that is to be connected next.
- Returns
- IP address
◆ getSSLAttributeValue()
string kanzi::connect::WorkerBase::getSSLAttributeValue |
( |
const string |
name | ) |
|
|
protected |
Retrieve SSL attribute with specific name.
- Parameters
-
name | the name of the attribute to retrieve. |
- Returns
- attribute value
◆ hasSSLAttribute() [1/2]
bool kanzi::connect::WorkerBase::hasSSLAttribute |
( |
const string & |
name, |
|
|
unordered_map< string, string > & |
map |
|
) |
| |
|
protected |
Checks whether there is SSL attribute with specific name.
- Parameters
-
name | the name of the attribute to check. |
map | the map where to inspect the attribute. |
- Returns
- true attribute value
◆ hasSSLAttribute() [2/2]
bool kanzi::connect::WorkerBase::hasSSLAttribute |
( |
const string & |
name, |
|
|
map< string, string > & |
map |
|
) |
| |
|
protected |
Checks whether there is SSL attribute with specific name.
- Parameters
-
name | the name of the attribute to check. |
map | the map where to inspect the attribute. |
- Returns
- true attribute value
◆ onConnectionStateChanged()
virtual void kanzi::connect::WorkerBase::onConnectionStateChanged |
( |
Connection::State |
state | ) |
|
|
protectedvirtual |
Virtual method - inherited classes must invoke the base class method.
- Parameters
-
Reimplemented in kanzi::connect::Worker.
◆ readAndStoreFile()
bool kanzi::connect::WorkerBase::readAndStoreFile |
( |
const string |
filename, |
|
|
const string |
filenameBase |
|
) |
| |
|
protected |
Reads specific file and stores contents into local variable.
- Parameters
-
filename | the filename |
filenameBase | base name for file (i.e. without path). this is used as key to cache the file. |
- Returns
- true if file got cached.
◆ readReferredFile()
string kanzi::connect::WorkerBase::readReferredFile |
( |
const string |
attributeName | ) |
|
|
protected |
Read the referred attribute value.
- Parameters
-
attributeName | the name of the attribute where to read from |
- Returns
- contents of the file.
◆ seekToNextAddress()
void kanzi::connect::WorkerBase::seekToNextAddress |
( |
| ) |
|
|
protected |
In case multiple addresses configured, advances to the next address after a unsuccessful connect.
◆ setPollTimerState()
void kanzi::connect::WorkerBase::setPollTimerState |
( |
bool |
running, |
|
|
int |
interval = 0 |
|
) |
| |
|
protected |
Controls the poll timer state and interval.
- Parameters
-
running | if true then ensures timer is running. With false stops the timer. |
interval | when should the timer to trigger. Value relevant only when starting a timer. |
◆ start()
void kanzi::connect::WorkerBase::start |
( |
| ) |
|
Starts the worker, connects to server and starts operation.
◆ stop()
void kanzi::connect::WorkerBase::stop |
( |
| ) |
|
Stops the worker, disconnects from server and stops operation.
◆ taskWork()
void kanzi::connect::WorkerBase::taskWork |
( |
int |
interval | ) |
|
|
protected |
◆ workAvailable()
void kanzi::connect::WorkerBase::workAvailable |
( |
| ) |
|
|
protectedvirtual |
◆ ClientConnectionObserver
friend class ClientConnectionObserver |
|
friend |
◆ m_addLinkLatencyMeasureRequestSubscriptionToken
DiagnosticsServiceClient::DiagnosticsSubscriptionToken kanzi::connect::WorkerBase::m_addLinkLatencyMeasureRequestSubscriptionToken |
|
protected |
◆ m_addresses
vector<string> kanzi::connect::WorkerBase::m_addresses |
|
protected |
List of addresses to try sequentially.
◆ m_addressIndex
size_t kanzi::connect::WorkerBase::m_addressIndex |
|
protected |
Index of address to be used next.
◆ m_bearer
string kanzi::connect::WorkerBase::m_bearer |
|
protected |
◆ m_client
◆ m_config
◆ m_configurationFilename
string kanzi::connect::WorkerBase::m_configurationFilename |
|
protected |
◆ m_connectionInterface
shared_ptr<ConnectionInterfaceClient> kanzi::connect::WorkerBase::m_connectionInterface |
|
protected |
◆ m_connectionObserver
◆ m_connectionSession
shared_ptr<ClientConnectionSession> kanzi::connect::WorkerBase::m_connectionSession |
|
protected |
◆ m_connectionSubscription
◆ m_connectionTimeout
int kanzi::connect::WorkerBase::m_connectionTimeout |
|
protected |
◆ m_diagnostics
◆ m_domain
Domain* kanzi::connect::WorkerBase::m_domain |
|
protected |
◆ m_fileContents
unordered_map<string, unique_ptr<char[]> > kanzi::connect::WorkerBase::m_fileContents |
|
protected |
Map that caches file contents.
◆ m_fileServerAddress
string kanzi::connect::WorkerBase::m_fileServerAddress |
|
protected |
Remote file server IP address.
◆ m_identity
string kanzi::connect::WorkerBase::m_identity |
|
protected |
◆ m_mainloopTimerToken
MainLoopTimerToken kanzi::connect::WorkerBase::m_mainloopTimerToken |
|
protected |
Handle for timer registration.
◆ m_name
string kanzi::connect::WorkerBase::m_name |
|
protected |
◆ m_resourcePath
string kanzi::connect::WorkerBase::m_resourcePath |
|
protected |
◆ m_serverName
string kanzi::connect::WorkerBase::m_serverName |
|
protected |
◆ m_serverWatchdog
RPCResult<int> kanzi::connect::WorkerBase::m_serverWatchdog |
|
protected |
◆ m_serverWatchdogCallbackToken
◆ m_sslAttributes
unordered_map<string, string> kanzi::connect::WorkerBase::m_sslAttributes |
|
protected |
map holding SSL attributes.
◆ m_state
TaskState kanzi::connect::WorkerBase::m_state |
|
protected |
◆ m_watchdogTimeout
unsigned int kanzi::connect::WorkerBase::m_watchdogTimeout = 5000 |
|
protected |
The documentation for this class was generated from the following file:
- connect/kanzi_adaptation/workerbase.hpp