Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

CVSCloudManager

  • Last UpdatedFeb 19, 2025
  • 4 minute read

The CVSCloudManager node supports scripted behaviors that are based on 3DVS json-rpc commands received by the internal CVP 3DVS Message Broker in XR engine. When a json-rpc command is received, if the command is not directly handled by the engine, the broker forwards it to CVSCloudManager.

For more information on json-rpc commands, go to https://www.jsonrpc.org/specification.

How it works

The CVSCloudManager calls a Command node or Coroutine node that corresponds to the method field in the received json-rpc. The mapping between json-rpc method and Command or Coroutine is defined in the commandRoutes dictionary using method as key and Command/Coroutine as the corresponding value.

Upon receipt from the broker, if a json-rpc with a method is not mapped in the commandRoutes, the CVSCloudManager will call the Command/Coroutine defined as default, if present. If neither the method is mapped to a Command/Coroutine in the commandRoutes or the mapping of a default is present, an exception is thrown in the log and an error message is sent back to the broker.

The CVSCloudManager node is a singleton node, meaning that there must be only one node of this type defined in the included logic.

Note: For the backward compatibility, the project created with the former CVP3DVSManager node is also supported in XRStudio 4.0.15.

Platform support

This node is supported on all platforms.

XR-WIN

XR-P-WIN

XR-P-IOS

XR-P-AND

XR-P-WASM

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Full support

Code example

The following is an example of a default command mapping that sends back an error that says the method does not have a specific implemented behavior.

<CVSCloudManager name="myCVSCloudManager" commandRoutes="{default=cmd_default}" />

<Command name="cmd_default" args="command=sjson" >

<local name="response" type="sjson" value="{ &quot;error&quot;: { &quot;code&quot;: -32601, &quot;message&quot;: &quot;A specific Command was not implemented for this method!&quot; } }" />

<if condition="[@%command%.exists(|id)]">

<modify name="response" op="addValue" value="|,id,integer" />

<modify name="response" op="setValue" value="|id,[@%command%.getValue(|id)]" />

</if>

<set name="CVP3DVS_Manager.sendMessageResponse" value="[@%response%]" />

<log text="sent back: [@%response%]" />

</Command>

Fields

These are the fields for the CVSCloudManager node. Only the node-specific fields are indicated, not fields obtained by inheritance.

Field inheritance: NodeBase > CVSCloudManager

Fields

Type

Use

Default

Description

commandRoutes

dstring

Optional

Empty

Mappings of json-rpc method names and the corresponding Command/Coroutine nodes to be executed. The DSTRING must be created by assigning each method as a key and the corresponding Command/Coroutine name as its value. The default key is used to specify a Command/Coroutine that will be executed whenever a method is received, but a specific route for it is not found in the DSTRING.

Example {myMethod=cmd_myMethod}{default=cmd_notImplementedError}

enqueueMessage

sfunction

Optional

Empty

Enqueues json content into the broker input queue (as if an external listener sent it). This field is useful to emulate behaviors and for testing during development. The message must be a valid json-rpc command.

methodsHelpResponseField

sstring

Optional

Empty

Name of the field that describes the methods available to the client, with the name, expected parameters, given result and a description of the function of the method.

notificationsHelpResponseField

sstring

Optional

Empty

Name of the field that describes the notifications returned to the client, with the name, expected parameters and a description of content of the notification.

sendMessageResponse

Optional

Empty

Enqueues json content into the broker output queue. The content will be consumed by the broker listener and eventually sent back to clients. Based on the presence of an id, the message will be considered by the broker as a notification (no id) or a response (with id), as RPC specifications prescribe. The message must be a valid json-rpc command.

sendError

Optional

Empty

Sends an error message directly to the broker listener. The message is a simple string and is meant for notifying errors to the listener. This way the listener could implement behaviors to handle the errors before having to execute a json-rpc error to clients.

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in