ConnectionManager¶
-
class
kanzi::connect
::
ConnectionManager
: public ConnectionServiceConcept, private NetworkListener::Observer, public ConnectionManagerMessageHookInterface¶ A service class to manage clients on server side. Implements Connection Interface on server.
Public Types
-
typedef map<int, ConnectedClientSharedPtr>
ClientContainer
¶ Container for connected clients.
Public Functions
Constructor.
- Parameters
connectDomain – The connect domain.
messageRouterInterface – Interface to object that will handle incoming messages.
diagManager – The diagnostics manager, used to deliver diagnostics related data.
objectFactory – Factory interface to create connection adapters.
-
virtual ~ConnectionManager () KZ_OVERRIDE
Destructor.
-
void
addMessageHook
(ConnectionManagerMessageHookInterface *messageInterface)¶ Installs new message hook processor.
- Parameters
messageInterface – the message interface
-
void
addObserver
(Observer *observer)¶ Adds observer to listen for notifications on this service.
- Parameters
observer – Observer to add.
-
ClientContainer::const_iterator
beginClients
() const¶ Return iterator to container for all connected clients (begin).
- Returns
Iterator that points the beginning of the container.
-
ClientContainer::const_iterator
endClients
() const¶ Return iterator to container for all connected clients (end).
- Returns
Iterator that points the end of the container.
-
ClientIdManager &
getClientIdManager
()¶ Retrieve the client id manager class.
- Returns
reference to ClientIdManager instance.
-
ConnectionAdapter *
getConnectionAdapter
(const int clientId) const¶ Find the connection adapter that handles the connection for the given client.
- Parameters
clientId – Identifies the client
- Returns
Pointer to the connection adapter, null pointer if not found
-
inline ConnectionAdapterObjectFactorySharedPtr
getConnectionAdapterObjectFactory
()¶ Retrieve the Connection adapter factory.
-
NetworkListenerSharedPtr
getNetworkListener
(const int clientId) const¶ Find the network listener that handlers the particular client.
- Parameters
clientId – the client identifier
- Returns
shared pointer to network listener object
-
virtual void initialize (InterfaceDomainBase *domain, ContentClientSharedPtr contentClient, WorkQueueInterface *workQueue) KZ_OVERRIDE
See AbstractService::initialize.
-
void
removeMessageHook
(ConnectionManagerMessageHookInterface *messageInterface)¶ Removes existing message hook processor.
- Parameters
messageInterface – the message interface
-
void
removeObserver
(Observer *observer)¶ Remove observer to stop listening for notifications on this service.
- Parameters
observer – Observer to remove.
Set HTTP server to handle HTTP requests.
- Parameters
httpServer – HTTP server to handle HTTP requests.
-
virtual void uninitialize () KZ_OVERRIDE
See AbstractService::uninitialize.
-
class
Observer
¶ Observer for client connections.
Subclassed by ServiceManager
Public Functions
-
virtual void
onClientConnected
(ConnectedClient *client) = 0¶ Notification about newly connected client.
- Parameters
client – The client that connected.
-
virtual void
onClientDisconnected
(ConnectedClient *client) = 0¶ Notification about disconnected client.
- Parameters
client – The client that disconnected.
-
virtual void
onClientIdentified
(ConnectedClient *client) = 0¶ Notification about client being identified (name assigned).
- Parameters
client – The client that had its name assigned.
-
virtual void
-
typedef map<int, ConnectedClientSharedPtr>