Kanzi Connect  3.9.9
Kanzi Connect C++ API
kanzi::connect::VirtualFileRemoteClient Class Reference

Remote access to VirtualFile service that resides in kanziconnect server. More...

#include <virtualfileremoteclient.hpp>

Inheritance diagram for kanzi::connect::VirtualFileRemoteClient:
kanzi::connect::VirtualFileClient kanzi::connect::AbstractServiceClient

Public Member Functions

string getPath (RegistrationToken token) const
 Retrieve the path associated with the registration. More...
 
RegistrationToken registerPath (const string &scheme, const string &path, VirtualFileProvider *provider)
 Registers a path to HTTP Server. More...
 
void registerRegistrationStatusChangeCallback (RegistrationToken token, RegistrationStatusChangeCallback *callback)
 Register registration status change callback. More...
 
RegistrationStatus registrationStatus (RegistrationToken token)
 Checks the registration status. More...
 
void unregisterPath (RegistrationToken token)
 Unregisters previously registered path. More...
 
void unregisterRegistrationStatusChangeCallback (RegistrationToken token)
 Clears previously registered status change callback. More...
 
- Public Member Functions inherited from kanzi::connect::VirtualFileClient
virtual string getIdentifier () const
 Returns the type of the service. More...
 
virtual ~VirtualFileClient ()
 C++ destructor - performs cleanup. 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 ()
 
virtual void onSessionRunning ()
 
virtual void onSessionStopped ()
 
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...
 

Static Public Member Functions

static VirtualFileRemoteClientSharedPtr create (ClientSharedPtr client)
 Factory method to create object. More...
 
- Static Public Member Functions inherited from kanzi::connect::VirtualFileClient
static string Type ()
 Type of the client. More...
 

Protected Member Functions

void onConnectionStateChanged (Connection::State state)
 Invoked when ever connection state changes. More...
 
 VirtualFileRemoteClient (ClientSharedPtr client)
 c++ constructor - initializes the object More...
 
- Protected Member Functions inherited from kanzi::connect::AbstractServiceClient
virtual AbstractSessionSharedPtr getSession ()
 

Additional Inherited Members

- Public Types inherited from kanzi::connect::VirtualFileClient
enum  RegistrationStatus { NotRegistered, RegistrationInProgress, RegistrationFailed, Registered }
 
typedef enum kanzi::connect::VirtualFileClient::RegistrationStatus RegistrationStatus
 
typedef shared_ptr< void > RegistrationToken
 Token used to identify registration. More...
 
- 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

Remote access to VirtualFile service that resides in kanziconnect server.

Constructor & Destructor Documentation

◆ VirtualFileRemoteClient()

kanzi::connect::VirtualFileRemoteClient::VirtualFileRemoteClient ( ClientSharedPtr  client)
protected

c++ constructor - initializes the object

Parameters
client

Member Function Documentation

◆ create()

static VirtualFileRemoteClientSharedPtr kanzi::connect::VirtualFileRemoteClient::create ( ClientSharedPtr  client)
static

Factory method to create object.

Parameters
clientpointer to client
Returns
newly allocated remote client instance.

◆ getPath()

string kanzi::connect::VirtualFileRemoteClient::getPath ( RegistrationToken  token) const
virtual

Retrieve the path associated with the registration.

Parameters
tokenThe token that identifies the registration.
Returns
full path in form: http://<server>:8080/somepath/ empty string is returned if registration has failed, or it is still in progress.

Implements kanzi::connect::VirtualFileClient.

◆ onConnectionStateChanged()

void kanzi::connect::VirtualFileRemoteClient::onConnectionStateChanged ( Connection::State  state)
protected

Invoked when ever connection state changes.

Parameters
statenew state.

◆ registerPath()

RegistrationToken kanzi::connect::VirtualFileRemoteClient::registerPath ( const string &  scheme,
const string &  pathProposal,
VirtualFileProvider provider 
)
virtual

Registers a path to HTTP Server.

Registration is an asynchronous operation for remote clients.

Parameters
schemeRequested protocol. Either HTTP or HTTPS expected. If you do not set a value, uses HTTP.
pathProposalclients proposal of the path where the serving is to be done.
providerpointer to callback interface that is, if successfully registered, invoked for every file request made under the registered path. Caller must guarantee that the provided callback interface remains valid until corresponding unregisterPath call is made.
Returns
Opaque token that identifies this registration.

Implements kanzi::connect::VirtualFileClient.

◆ registerRegistrationStatusChangeCallback()

void kanzi::connect::VirtualFileRemoteClient::registerRegistrationStatusChangeCallback ( RegistrationToken  token,
RegistrationStatusChangeCallback callback 
)
virtual

Register registration status change callback.

Registration is meaningful only for remote clients since status does not change for local clients.

Parameters
tokenidentification token.
callbackinterface to be invoked when registration status changes.

Reimplemented from kanzi::connect::VirtualFileClient.

◆ registrationStatus()

RegistrationStatus kanzi::connect::VirtualFileRemoteClient::registrationStatus ( RegistrationToken  token)
virtual

Checks the registration status.

For remote operations registration is asynchronous and thus it is not complete until this method returns either Registered or RegistrationFailed. Also, if for example connection is lost, then the registration status changes even if it has been completed earlier.

Parameters
tokenThe token that identifies the registration.
Returns
enumerated status.

Implements kanzi::connect::VirtualFileClient.

◆ unregisterPath()

void kanzi::connect::VirtualFileRemoteClient::unregisterPath ( RegistrationToken  token)
virtual

Unregisters previously registered path.

Parameters
tokenopaque handle got using the registerPath

Implements kanzi::connect::VirtualFileClient.

◆ unregisterRegistrationStatusChangeCallback()

void kanzi::connect::VirtualFileRemoteClient::unregisterRegistrationStatusChangeCallback ( RegistrationToken  token)
virtual

Clears previously registered status change callback.

Parameters
tokenpath registration token.

Reimplemented from kanzi::connect::VirtualFileClient.


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