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.
- Return
shared pointer to root node. Should not ever be empty pointer.
- Parameters
token: the content registration token
-
RuntimeDataObjectSharedPtr
getRootObjectForSubscription(ContentSubscriptionToken token)¶ Retrieves the root object associated with the specific content listener token.
- Return
shared pointer to root node. Can be empty pointer.
- Parameters
token: the token to query
-
const string
getSchemaForSubscription(ContentSubscriptionToken token)¶ Retrieve XML format schema for content subscription.
- Return
XML format schema. Or empty string if unable to retrieve.
- Parameters
token: identifies the subscription
-
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.
- Return
handle that can later on be used to unregister content listener.
- Parameters
path: where to register.
Registers a content producer, aka a service.
- Return
handle to object that can later on be used to.
- Parameters
servicename: The name of the service.dataRoot: The root object.
-
ContentRegistrationToken
registerContentProducer(const string &servicename, const string &xml)¶ Registers a content producer from XML schema definition.
This is used with remote services.
- Return
handle to object that can later on be used to.
- Parameters
servicename: name of the servicexml: xml contents
-
bool
renameContentProducer(const string &oldname, const string &newname)¶ Renames a content producer.
Required for example by simulator when service models name is changed
- Return
true if succeeded, false otherwise.
- Parameters
oldname: the old name.newname: the new name.
-
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.
- Return
true if update took place.
- Parameters
handle: identifies the updated, earlier returned by registerContentProducerstream: the serialized update content.path: the path that was reported to be changed.
-
bool
updateDataForPath(ContentRegistrationToken handle, const string &path)¶ Updates the data of specific registration and especially a specified path within it.
- Return
true if update took place.
- Parameters
handle: identifies the updated, earlier returned by registerContentProducerpath: the path that changed.
Changes the runtime data schema.
- Parameters
token: the token that identifies the previously registered content producerdataRoot: the root object.schema: the xml schema that defines the new structure.
-
ServiceRuntimeDataRegistry::ContentRegistrationToken
updateSchema(ContentRegistrationToken token, const string &schema)¶ Updates the schema at runtime.
- Return
handle to new registration.
- Parameters
token: identifies the content registrationschema: new xml definition of the data
Public Members
-
bool
m_active¶ True if data should be distributed.
-
DiagnosticsManagerSharedPtr
m_diagnostics¶ Diagnostics manager.
-
ConnectDomainSharedPtr
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>