ActionArgument
ActionArgument is automatically passed argument to the action of a ThingModel or AppModel (instance) by A-Stack at the action trigger step.
- ActionArgument contains both internal and user-defined attributes of the ThingModel / AppModel instance that triggered the action.
- ActionArgument is local and transient - any changes made to the ActionArgument does not get reflected in the original copy of ThingModel / AppModel.
Example: Here is the ThingModel and ThingFacet (Partial Action) Definition for a Phidget Servo Motor
TempFacetSerial attributes
# ThingFacet(Name: "PhidgetServoFacet"): String(Name: "ServoProtocolURL", Default: "phid://") String(Name: "DeviceInterfaceIndex") String(Name: "PhidgetDeviceType") Integer(Name: "ServoAngle", KnownBy: "PhidgetServoAction") Action(Name: "PhidgetServoAction", Documentation: "Control Servo Motor"): Workflow Limit: "1", Live: "1", Timeout: "-1"): Task(Name: "Main", while: "true"): Event(Name: "Argument", as: "ActionArgument") #... ThingModel(Name: "PhidgetServoModel", Combines: "PhidgetServoFacet"): Sid(Name: "PhidServoId")
Here is the Phidget Servo Motor Instance creation TQL Query that triggers an Action
PhidgetServo Motor Instance Creation
# Query: DeleteAll: PhidgetServoModel: PhidServoId(ne: "") Create: PhidgetServoModel: ServoProtocolURL: phid:// PhidgetDeviceType: PhidgetAdvancedServo DeviceInterfaceIndex: 0 ServoAngle: 110
Here is the ActionArgument Structure that is passed by A-Stack
ActionArgument Value of Phidget Servo Motor
# Event: Argument: PhidServoId: KNI5JYVPAAAAUAABA4ONNHF2 QName: Atomiton.PhidgetServos.PhidgetServoModel $Guid: "#f3guorsmvr4qhomryacl5m3dha3ctaoe" $sid: KNI5JYVPAAAAUAABA4ONNHF2 PhidgetDeviceType(Value: "PhidgetAdvancedServo", Known: "PhidgetAdvancedServo", Order: "", Version: "1", Timestamp: "1457366819505", DateTime: "2016-03-07 08:06:59.505" QName: "Atomiton.PhidgetServos.PhidgetServoModel.PhidgetDeviceType", FName: "PhidgetDeviceType") ServoAngle(Value: "110", Known: "110", Order: "", Version: "1", Timestamp: "1457366819505", DateTime: "2016-03-07 08:06:59.505", QName: "Atomiton.PhidgetServos.PhidgetServoModel.ServoAngle" FName: "ServoAngle") DeviceInterfaceIndex(Value: "0", Known: "0", Order: "", Version: "1", Timestamp: "1457366819505", DateTime: "2016-03-07 08:06:59.505" QName: "Atomiton.PhidgetServos.PhidgetServoModel.DeviceInterfaceIndex", FName: "DeviceInterfaceIndex") ServoProtocolURL(Value: "phid://", Known: "phid://", Order: "", Version: "1", Timestamp: "1457366819503", DateTime: "2016-03-07 08:06:59.503" QName: "Atomiton.PhidgetServos.PhidgetServoModel.ServoProtocolURL", FName: "ServoProtocolURL")
$Guid here is a global unique identifier of this model definition
$Sid is a unique Identifier of this Model Instance. Note that this value will be same as PhidServoId that is defined by PhidgetServoModel Thing Model using type Sid.
Accessing ActionArgument:
ActionArgument values can be accessed using standard Template Processor (TP) Notation. For example:
Access to PhidgetDeviceType Value
[%:Event.Argument.PhidgetDeviceType.Value:%]