ServerState

class kanzi::connect::ServerState

Class that represents, and maintains, a service state.

Public Types

typedef function<void(State)> ServerStateChangeCallback
enum State

Values:

enumerator Unknown

Not defined yet. Used as initial value.

enumerator Initializing

Server is initializing itself.

enumerator Stopping

Server is transitioning from Running to Stopped.

enumerator Stopped

Server is stopped.

enumerator Starting

Server is transitioning from Stopped to Running.

enumerator Running

Server is running.

typedef enum kanzi::connect::ServerState::State State
typedef shared_ptr<void> StateListenerSubscriptionToken

Public Functions

ServerState()

C++ constructor. initialize object.

State getServerState()

Retrieve the current state.

Returns

state

StateListenerSubscriptionToken registerServerStateListener(ServerStateChangeCallback callback)

Add callback to listen service states.

Parameters

callback – the method to invoke on changes.

Returns

token that can be used for unregistration.

void setServerState(State state)

Configure the server state.

Parameters

state – the new server state.

void unregisterServerStateListener(StateListenerSubscriptionToken token)

Remove callback that listened server state changes.

Parameters

token