ScriptContextInterface¶
-
class
kanzi::connect::ScriptContextInterface: public MetaObject¶ Public Functions
-
~ScriptContextInterface()¶
-
optional<int>
createServiceSession(const string &interfaceName, string fullyQualifiedServiceName = string())¶ Creates a session to a service.
- Return
session identifier if session was succesfully created.
- Parameters
interfaceName: name of the interface to create session, E.g. “Input”fullyQualifiedServiceName: fully qualilified service name implementing the interface, E.g. “Connect.CoreService.Input”. Optional.
-
ConnectedClientProxySharedPtr
getCommunicationInterface()¶ Retrieves the associated communication interface.
- Return
communication interface.
Initialize the context.
- Return
true on success.
-
void
registerService(const string &identifier, int sessionId)¶ Register a service to be used within a script.
Registering a service to script context allows accessing its methods, events and runtime-data on a script using notation [ServiceIdentifier]:[method|event|runtimedata-name], e.g. “System:demo.range”.
- Parameters
identifier: An identifier of a service to be registered.sessionId: Session identifier on SimpleConnectedClientSharedPtr
-
void
releaseServiceSession(int sessionId)¶ Releases a previously acquired service session.
- Parameters
sessionId: session identifier.
-
void
reset() = 0¶ Release resources and context.
Run a script.
- Return
true if there is more work to do and script should keep running on further iterations.
- Parameters
script: ECMAScript E5/E5.1 as a string.service: A service to host the script.
Execute a script.
- Return
Reply message according to method description or null pointer.
- Parameters
description: Description of method arguments and return value.message: Arguments for the method.service: Attached service.
-
void
unregisterService(const string &identifier)¶ Unregister a service.
- Parameters
identifier: An identifier of a service to be unregistered.
-