ServiceRuntimeDataRegistry¶
-
class
kanzi::connect
::
ServiceRuntimeDataRegistry
: public VirtualFileProvider¶ Encapsulates service runtime data.
Public Types
-
typedef shared_ptr<void>
ContentRegistrationToken
¶
-
typedef shared_ptr<void>
ContentSubscriptionToken
¶
-
typedef function<void(const string&, const string&)>
RuntimeContentUpdateCallback
¶
Public Functions
C++ constructor.
- Parameters
domain – the connect domain (optional)
diagnostics – diagnostics functionality for traffic logging etc.
-
RuntimeDataObjectSharedPtr
getRootObjectForRegistration
(ContentRegistrationToken token)¶ Retrieves the root object associated with the specific content registration token.
- Parameters
token – the content registration token
- Returns
shared pointer to root node. Should not ever be empty pointer.
-
RuntimeDataObjectSharedPtr
getRootObjectForSubscription
(ContentSubscriptionToken token)¶ Retrieves the root object associated with the specific content listener token.
- Parameters
token – the token to query
- Returns
shared pointer to root node. Can be empty pointer.
-
const string
getSchemaForSubscription
(ContentSubscriptionToken token)¶ Retrieve XML format schema for content subscription.
- Parameters
token – identifies the subscription
- Returns
XML format schema. Or empty string if unable to retrieve.
-
void
initializeHTTP
()¶ Initializes HTTP Functionality.
Must be called after HTTP Functionality itself has been initialized.
-
ContentSubscriptionToken
registerContentListener
(const string &path, RuntimeContentUpdateCallback callback)¶ Registers runtime content listener to a specific path.
- Parameters
path – where to register.
- Returns
handle that can later on be used to unregister content listener.
-
ContentRegistrationToken
registerContentProducer
(const string &servicename, const string &xml)¶ Registers a content producer from XML schema definition.
This is used with remote services.
- Parameters
servicename – name of the service
xml – xml contents
- Returns
handle to object that can later on be used to.
Registers a content producer, aka a service.
- Parameters
servicename – The name of the service.
dataRoot – The root object.
- Returns
handle to object that can later on be used to.
-
bool
renameContentProducer
(const string &oldname, const string &newname)¶ Renames a content producer.
Required for example by simulator when service models name is changed
- Parameters
oldname – the old name.
newname – the new name.
- Returns
true if succeeded, false otherwise.
-
void
uninitializeHTTP
()¶ Uninitialize HTTP Functionality.
-
void
unregisterContentListener
(ContentSubscriptionToken token)¶ Unregisters content listener.
- Parameters
token – what to unregister.
-
void
unregisterContentProducer
(ContentRegistrationToken handle)¶ Unregister content producer.
- Parameters
handle – the handle of operation
-
bool
updateData
(ContentRegistrationToken handle, const string &stream, const string &path)¶ Updates the data of a specific registration.
- Parameters
handle – identifies the updated, earlier returned by registerContentProducer
stream – the serialized update content.
path – the path that was reported to be changed.
- Returns
true if update took place.
-
bool
updateDataForPath
(ContentRegistrationToken handle, const string &path)¶ Updates the data of specific registration and especially a specified path within it.
- Parameters
handle – identifies the updated, earlier returned by registerContentProducer
path – the path that changed.
- Returns
true if update took place.
-
ServiceRuntimeDataRegistry::ContentRegistrationToken
updateSchema
(ContentRegistrationToken token, const string &schema)¶ Updates the schema at runtime.
- Parameters
token – identifies the content registration
schema – new xml definition of the data
- Returns
handle to new registration.
Changes the runtime data schema.
- Parameters
token – the token that identifies the previously registered content producer
dataRoot – the root object.
schema – the xml schema that defines the new structure.
Public Members
-
bool
m_active
¶ True if data should be distributed.
-
DiagnosticsManagerSharedPtr
m_diagnostics
¶ Diagnostics manager.
-
ConnectDomain *
m_domain
¶ The domain.
-
VirtualFileLocalClientSharedPtr
m_HTTPClient
¶ HTTP Client for HTTP Communications.
-
VirtualFileClient::RegistrationToken
m_HTTPSchemaToken
¶ HTTP Schema token.
-
VirtualFileClient::RegistrationToken
m_HTTPToken
¶ HTTP registration token.
-
typedef shared_ptr<void>