|
Equivalent WoT TD definition |
ActionAffordance |
|
Description |
In OPC UA methods are “lightweight” functions, whose scope is bounded by an owning (see Note) Object, similar to the methods of a class in object-oriented programming or an owning ObjectType, similar to static methods of a class. Methods are invoked by a client, proceed to completion on server and return the result to the client. The lifetime of the Method’s invocation instance begins when the client calls the Method and ends when the result is returned. Similary, in a TD an action affordance is a function or an action that can be invoked on a Thing. A TD action must contain the uav:componentOf term to express in which object the UA method is defined. The input and output terms reflect the InputArguments and OutputArguments data structure of the corresponding UA Variables. Thereby, the argument definitions within the UA Variables are mapped to the JSON Schema type=object structure where each argument is a member of the type=object definition. |
|
Snippet example in OPC UA (e.g., as nodeset) |
<UAMethod NodeId="ns=1;s=RunCalibration" BrowseName="1:Calibrate" ParentNodeId ="ns=1;s=CalibrationObject"> <DisplayName>Run calibration</DisplayName> <References> <Reference ReferenceType="HasComponent" IsForward="false">ns=1;s=CalibrationObject</Reference> <Reference ReferenceType="HasProperty">ns=1;s=RunCalibration_InputArguments</Reference> <Reference ReferenceType="HasProperty">ns=1;s=RunCalibration_OutputArguments</Reference> </References></UAMethod> ... <UAVariable NodeId="ns=1;s=RunCalibration_InputArguments" BrowseName="InputArguments" DataType="Argument" ValueRank="1" TypeDefinition="PropertyType"> <DisplayName>InputArguments</DisplayName> <Description>Input parameter for the Run calibration method.</Description> <Value> <ListOfExtensionObject xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd"> <ExtensionObject> <TypeId> <Identifier>i=297</Identifier> </TypeId> <Body> <Argument xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd"> <Name>CalibrationFactor</Name> <DataType> <Identifier>i=6</Identifier> <!-- Integer --> </DataType> <ValueRank>Scalar</ValueRank> <Description>Factor used to adjust the calibration process.</Description> </Argument> </Body> </ExtensionObject> </ListOfExtensionObject> </Value> </UAVariable> … <UAVariable NodeId="ns=1;s=RunCalibration_OutputArguments" BrowseName="OutputArguments" DataType="Argument" ValueRank="1" TypeDefinition="PropertyType"> <DisplayName>OutputArguments</DisplayName> <Description>Output parameter of the Run calibration method.</Description> <Value> <ListOfExtensionObject xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd"> <ExtensionObject> <TypeId> <Identifier>i=297</Identifier> </TypeId> <Body> <Argument xmlns="http://opcfoundation.org/UA/2008/02/Types.xsd"> <Name>CalibrationStatus</Name> <DataType> <Identifier>i=6</Identifier> <!-- Integer --> </DataType> <ValueRank>Scalar</ValueRank> <ArrayDimensions/> <Description>Status resulting from the calibration process.</Description> </Argument> </Body> </ExtensionObject> </ListOfExtensionObject> </Value> </UAVariable> … |
|
Transformed usage in a TD definition (as snippet) |
"actions": { "1:Calibrate": { "title": "Run calibration", "uav:componentOf": ["ns=1;s=CalibrationObject"], "input": { "type": "object", "properties": { "CalibrationFactor": { "type": "integer", "description": "Factor used to adjust the calibration process." }}}, "output": { "type": "object", "properties": { "CalibrationStatus": { "type": "integer", "description": "Status resulting from the calibration process." }}}, "forms": [ { "href": "/?id=ns=1;s=RunCalibration", "contentType": "application/octet-stream" } ] …
|