Kanzi Connect  1.1.10
Kanzi Connect C++ API
kanzi::connect::ExternalClientAdapter Class Reference

External client adapter that will represent a kanzi connect client on external language bindings. More...

#include <externalclientadapter.hpp>

Inheritance diagram for kanzi::connect::ExternalClientAdapter:
kanzi::connect::AbstractServiceClient kanzi::connect::InterfaceObserver

Public Member Functions

 ExternalClientAdapter (Client &client, const string &identifier)
 Constructor. More...
 
 ExternalClientAdapter (ClientConnector &connector, const string &identifier)
 Constructor. More...
 
bool hasSession () const
 Determines whether client is functional and has a session to be used in communication. More...
 
virtual void onMessageReceived (const MessagePackage &message)
 Notification that interface has received a message. More...
 
virtual void onSessionRunning ()
 Notification that interface/session entered running state. More...
 
virtual void onSessionStopped ()
 Notification that interface/session got stopped for a reason or another. More...
 
void sendMessage (MessagePackage &message)
 Sends a provided message to the corresponding service without expecting any returnvalues. More...
 
RPCResult< bool > sendMessageBool (MessagePackage &message)
 Sends a message that expects bool returnvalue. More...
 
RPCResult< float > sendMessageFloat (MessagePackage &message)
 Sends a message that expects float returnvalue. More...
 
RPCResult< int32_t > sendMessageInt (MessagePackage &message)
 Sends a message that expects integer returnvalue. More...
 
RPCResult< string > sendMessageString (MessagePackage &message)
 Sends a message that expects string returnvalue. More...
 
RPCResult< void > sendMessageVoid (MessagePackage &message)
 Sends a message that expects void returnvalue. More...
 
virtual ~ExternalClientAdapter ()
 Destructor. More...
 
- Public Member Functions inherited from kanzi::connect::AbstractServiceClient
 AbstractServiceClient ()
 Constructor. More...
 
AbstractSession::MessageSubscriptionToken addMessageSubscription (const string &messageType, AbstractSession::MessageReceivedFunction function)
 
SessionRunningSubscriptionToken addSessionRunningSubscription (SessionRunningFunction function)
 
SessionRunningSubscriptionToken addSessionStoppedSubscription (SessionStoppedFunction function)
 
optional< int > getActiveSessionIdentifier ()
 
optional< const AbstractSession::ServiceAttributesgetServiceAttributes ()
 
void removeMessageSubscription (const string &messageType, AbstractSession::MessageSubscriptionToken token)
 
void removeSessionRunningSubscription (SessionRunningSubscriptionToken token)
 
void removeSessionStoppedSubscription (SessionRunningSubscriptionToken token)
 
void setEnabledState (bool newEnabledState)
 Enable/disable the service by allowing or blocking traffic between client and server. More...
 
bool transmit (const MessagePackage &message)
 
virtual void work ()
 Carry out asynchronous work bound to Kanzi Connect client main thread. More...
 
virtual ~AbstractServiceClient ()
 Destructor. More...
 
- Public Member Functions inherited from kanzi::connect::InterfaceObserver
virtual ~InterfaceObserver ()
 Destructor. More...
 

Protected Member Functions

string getIdentifier () const
 Returns the type of the service. More...
 
- Protected Member Functions inherited from kanzi::connect::AbstractServiceClient
virtual AbstractSessionSharedPtr getSession ()
 

Additional Inherited Members

- Public Types inherited from kanzi::connect::AbstractServiceClient
typedef function< void(void)> SessionRunningFunction
 
typedef shared_ptr< void > SessionRunningSubscriptionToken
 
typedef function< void(void)> SessionStoppedFunction
 
- Protected Types inherited from kanzi::connect::AbstractServiceClient
enum  SessionState { INITIALIZED = 0, RUNNING = 1, STOPPED = 2 }
 
- Protected Attributes inherited from kanzi::connect::AbstractServiceClient
SessionState m_sessionState
 

Detailed Description

External client adapter that will represent a kanzi connect client on external language bindings.

Constructor & Destructor Documentation

◆ ExternalClientAdapter() [1/2]

kanzi::connect::ExternalClientAdapter::ExternalClientAdapter ( Client client,
const string &  identifier 
)

Constructor.

Parameters
clientthe client instance.
identifierservice identitifier this client connects to.

◆ ExternalClientAdapter() [2/2]

kanzi::connect::ExternalClientAdapter::ExternalClientAdapter ( ClientConnector connector,
const string &  identifier 
)

Constructor.

Parameters
connectorClient connector instance this client is connected to.
identifierservice identitifier this client connects to.

◆ ~ExternalClientAdapter()

virtual kanzi::connect::ExternalClientAdapter::~ExternalClientAdapter ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ getIdentifier()

string kanzi::connect::ExternalClientAdapter::getIdentifier ( ) const
protectedvirtual

Returns the type of the service.

Returns
Identifier of the service, as a string.

Implements kanzi::connect::AbstractServiceClient.

◆ hasSession()

bool kanzi::connect::ExternalClientAdapter::hasSession ( ) const

Determines whether client is functional and has a session to be used in communication.

Returns
true if session exists and communication is possible.

◆ onMessageReceived()

virtual void kanzi::connect::ExternalClientAdapter::onMessageReceived ( const MessagePackage )
virtual

Notification that interface has received a message.

Parameters
messageMessage that was received.

Reimplemented from kanzi::connect::InterfaceObserver.

◆ onSessionRunning()

virtual void kanzi::connect::ExternalClientAdapter::onSessionRunning ( )
virtual

Notification that interface/session entered running state.

Reimplemented from kanzi::connect::InterfaceObserver.

◆ onSessionStopped()

virtual void kanzi::connect::ExternalClientAdapter::onSessionStopped ( )
virtual

Notification that interface/session got stopped for a reason or another.

Reimplemented from kanzi::connect::InterfaceObserver.

◆ sendMessage()

void kanzi::connect::ExternalClientAdapter::sendMessage ( MessagePackage message)

Sends a provided message to the corresponding service without expecting any returnvalues.

Parameters
messagemessage to send. Might get modified along the way.

◆ sendMessageBool()

RPCResult<bool> kanzi::connect::ExternalClientAdapter::sendMessageBool ( MessagePackage message)

Sends a message that expects bool returnvalue.

Parameters
messagethe message to be sent
Returns
Waitable RPC result

◆ sendMessageFloat()

RPCResult<float> kanzi::connect::ExternalClientAdapter::sendMessageFloat ( MessagePackage message)

Sends a message that expects float returnvalue.

Parameters
messagethe message to be sent
Returns
Waitable RPC result

◆ sendMessageInt()

RPCResult<int32_t> kanzi::connect::ExternalClientAdapter::sendMessageInt ( MessagePackage message)

Sends a message that expects integer returnvalue.

Parameters
messagethe message to be sent
Returns
Waitable RPC result

◆ sendMessageString()

RPCResult<string> kanzi::connect::ExternalClientAdapter::sendMessageString ( MessagePackage message)

Sends a message that expects string returnvalue.

Parameters
messagethe message to be sent
Returns
Waitable RPC result

◆ sendMessageVoid()

RPCResult<void> kanzi::connect::ExternalClientAdapter::sendMessageVoid ( MessagePackage message)

Sends a message that expects void returnvalue.

Parameters
messagethe message to be sent
Returns
Waitable RPC result

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