-
Notifications
You must be signed in to change notification settings - Fork 4
(Event Binding) Event binding builder
The event file builder can be used to quickly copy and paste an event binding. Copy the code from chapter 1-4 to create an event binding.
Start with the outer frame of the event binding.
<EventBinding>
<!-- Add a description for the event binding here />-->
</EventBinding>
Add one event trigger of the following type. Read this for more details.
<Source xsi:type="opcUa.Event" refId="::Program:boolVariable" event="ValueChanged" />
The trigger creates the two internal variable newValue and oldValue. The values can be used later for conditions.
Variable
<Source xsi:type="session.Event" refId="variable1" event="ValueChanged"/>
Timer
<Source xsi:type="session.Timer.Event" refId="AutoLogOutTimer" event="Elapsed"/>
The trigger creates the two internal variable newValue and oldValue. The values can be used later for conditions.
- KeyBoard Events
<Source xsi:type="clientSystem.Event" event="KeyPress" />
<Source xsi:type="clientSystem.Event" event="KeyUp" />
<Source xsi:type="clientSystem.Event" event="KeyDown" />
The trigger creates the two variable keyASCII and key. The value can be used later for conditions.
<EventHandler condition="keyASCII = 97" >
<EventHandler condition="key = "ArrowLeft"" >
- Gesture Events
<Source xsi:type="clientSystem.Event" event="SystemSwipe" />
The trigger creates one variable direction. The value can be used later for conditions.
<EventHandler condition="direction="fromTop"">
- ContentLoaded Event
<Source xsi:type="clientSystem.Event" event="ContentLoaded" />
The trigger creates the two variables contentId and visuId. These values can be used later for conditions.
<EventHandler condition="contentId="Content1"">
- DisabledClick Event
<Source xsi:type="clientSystem.Event" event="DisabledClick" />
The trigger creates the three variables contentId, widgetId and hasPermission. These values can be used later for conditions.
<EventHandler condition="contentId="Content1"">
- DialogOpened Event
<Source xsi:type="clientSystem.Event" event="DialogOpened" />
The trigger creates one variable dialogId. This value can be used later for conditions.
<EventHandler condition="dialogId="Dialog1"">
- DialogClosed Event
<Source xsi:type="clientSystem.Event" event="DialogClosed" />
The trigger creates one variable dialogId. This value can be used later for conditions.
<EventHandler condition="dialogId="Dialog1"">
<Source xsi:type="widgets.brease.Button.Event" contentRefId="Content1" widgetRefId="Button1" event="Click"/>
Operands can be used to load additional variables into an event binding.
Data type of the operand can be BOOL, ANY_REAL, ANY_INT, ANY_STRING, BOOL_ARRAY, ANY_REAL_ARRAY, ANY_INT_ARRAY, ANY_STRING_ARRAY, DATE_AND_TIME
<!-- Read value from PLC />-->
<Operand name="ContentIsVisible1" datatype="BOOL">
<ReadTarget xsi:type="opcUa.NodeAction.Read" refId="::AsGlobalPV:Motor[1].IsVisible" >
<Method xsi:type="opcUa.NodeAction.GetValue" />
</ReadTarget>
</Operand>
<!-- Read session variable />-->
<Operand name="InputValue2" datatype="ANY_INT">
<ReadTarget xsi:type="session.VariableAction.Read" refId="InputValue2" >
<Method xsi:type="session.VariableAction.GetValue" />
</ReadTarget>
</Operand>
<!-- Read widget property />-->
<Operand name="contentid" datatype="ANY_STRING">
<ReadTarget xsi:type="widgets.brease.ContentControl.ReadAction" contentRefId="Content1" widgetRefId="ContentControl1" >
<Method xsi:type="widgets.brease.ContentControl.Action.GetContentId" />
</ReadTarget>
</Operand>
This is the part that gets executed when a trigger is fired. Pick 3.1 or 3.2 and add 3.3 if necessary.
When the action should be executed all the time use this frame for the handler.
<EventHandler>
</EventHandler>
In some cases it can be necessary to combine the event trigger with additional conditions. For details about comparison see this options. Boolean values use the notation "newValue" for true and "NOT newValue" for false.
<!-- New value smaller 20, old value greater 10 />-->
<EventHandler condition="newValue < 20 AND oldValue > 10" >
</EventHandler>
<!-- String value is not equal 'correct' />-->
<EventHandler condition="value <> "correct"">
</EventHandler>
If the event handler must execute multiple actions use a sequence frame.
<Sequence>
<Step order="0">
...
</Step>
<Step order="1">
...
</Step>
</Sequence>
Actions are executed when a trigger is fired. The following targets can be used for actions. Read this for more details. Use the following outer frame for the event action and then copy one of the targets below into it.
<Action>
</Action>
- SetValueBool
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.SetValueBool" value="true" />
</Target>
Use false to reset the variable
- ToggleValueBool
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.ToggleValueBool"/>
</Target>
- SetValueNumber
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.SetValueNumber" value="37.1" />
</Target>
- AddValue
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.AddValue" value="2" />
</Target>
- SetValueString
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.SetValueString" value="Hello World" />
</Target>
- SetValueDateAndTime
<Target xsi:type="opcUa.NodeAction" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.SetValueDateTime" value="2018-02-23T09:33:30Z" />
</Target>
- GetValue
<ReadTarget xsi:type="opcUa.NodeAction.Read" refId="::Program:Variable1" >
<Method xsi:type="opcUa.NodeAction.GetValue" />
</ReadTarget>
- GetServerStatus
<ReadTarget xsi:type="opcUa.SystemAction.Read" serverAlias="extern" >
<Method xsi:type="opcUa.SystemAction.GetServerStatus" />
</ReadTarget>
Session variables exist for each client connection as individual set of data.
- SetValueBool
<Target xsi:type="session.VariableAction" refId="Variable1" >
<Method xsi:type="session.VariableAction.SetValueBool" value="false" />
</Target>
Use false to reset the variable
- ToggleValueBool
<Target xsi:type="session.VariableAction" refId="Variable1" >
<Method xsi:type="session.VariableAction.ToggleValueBool" />
</Target>
- SetValueNumber
<Target xsi:type="session.VariableAction" refId="Variable1" >
<Method xsi:type="session.VariableAction.SetValueNumber" value="4.8" />
</Target>
- AddValue
<Target xsi:type="session.VariableAction" refId="Variable1" >
<Method xsi:type="session.VariableAction.AddValue" value="-4.8" />
</Target>
- SetValueString
<Target xsi:type="session.VariableAction" refId="Variable1" >
<Method xsi:type="session.VariableAction.SetValueString" value="Hello World" />
</Target>
- SetValueDateAndTime
<Target xsi:type="session.VariableAction" refId="Variable1" >
<Method xsi:type="session.VariableAction.SetValueDateTime" value="2018-02-23T09:33:30Z" />
</Target>
- GetValue
<ReadTarget xsi:type="session.VariableAction.Read" refId="Variable1" >
<Method xsi:type="session.VariableAction.GetValue" />
</ReadTarget>
- Start (Timer)
<Target xsi:type="session.TimerAction" refId="RepetitivTimer" >
<Method xsi:type="session.TimerAction.Start" interval="1000" />
</Target>
- Stop (Timer)
<Target xsi:type="session.TimerAction" refId="RepetitivTimer" >
<Method xsi:type="session.TimerAction.Stop" />
</Target>
- IsRunning (Timer)
<ReadTarget xsi:type="session.TimerAction.Read" refId="RepetitivTimer" >
<Method xsi:type="session.TimerAction.IsRunning" />
</ReadTarget>
- OpenDialog
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.OpenDialog" dialogId="dialog1" horizontalPos="left" verticalPos="top" />
</Target>
- CloseDialog
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.CloseDialog" dialogId="dialog1" />
</Target>
- ShowMessageBox
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.ShowMessageBox" type="OKCancel" message="$MachineStoppedText" header="Warning!" icon="Warning" />
</Target>
<Result>
<ResultHandler condition="result = 4">
...
</ResultHandler>
</Result>
- Action.Navigate
<Target xsi:type="clientSystem.Action"> <Method xsi:type="clientSystem.Action.Navigate" pageId="mainpage" /> </Target>
- LoadContentInArea
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.LoadContentInArea" contentId="Content3" areaId="A1" pageId="MainPage" />
</Target>
The action returns the result for load successful
- LoadContentInDialogArea
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.LoadContentInDialogArea" contentId="Content3" areaId="A1" dialogId="Dialog1" />
</Target>
The action returns the result for load successful
- ChangeTheme
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.ChangeTheme" theme="MyNewTheme" />
</Target>
- Login
<EventBinding>
<Source xsi:type="opcUa.Event" refId="::Program:startLogin" event="ValueChanged" />
<Operand name="user" datatype="ANY_STRING">
<ReadTarget xsi:type="opcUa.NodeAction.Read" refId="::Program:user">
<Method xsi:type="opcUa.NodeAction.GetValue" />
</ReadTarget>
</Operand>
<Operand name="pwd" datatype="ANY_STRING">
<ReadTarget xsi:type="opcUa.NodeAction.Read" refId="::Program:pwd">
<Method xsi:type="opcUa.NodeAction.GetValue" />
</ReadTarget>
</Operand>
<EventHandler condition="newValue = 1">
<Action>
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.Login" userName="=user" password="=pwd" />
</Target>
</Action>
</EventHandler>
</EventBinding>
- Logout
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.Logout"/>
</Target>
- SetLanguage
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.SetLanguage" value="en" />
</Target>
- SetMeasurementSystem
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.SetMeasurementSystem" value="imperial" />
</Target>
- ScrollContent
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.ScrollContent" contentId="Content2" position="top" duration="2000" />
</Target>
The action returns the result for load successful
- OpenDialogAtTarget
<Target xsi:type="clientSystem.Action">
<Method xsi:type="clientSystem.Action.OpenDialogAtTarget" dialogId="dialog1" horizontalPos="left" verticalPos="bottom" target="StartContent_Button1" horizontalDialogAlignment="left" verticalDialogAlignment="middle"/>
</Target>
These are actions that can be executed on widgets. See the Automation Studio help for details what events can be triggered by each widget.
<Target xsi:type="widgets.brease.Button.Action" contentRefId="Content1" widgetRefId="Button1" >
<Method xsi:type="widgets.brease.Button.Action.SetEnable" value="true"/>
</Target>
General Information
Direct binding
Event binding
Use cases
- General
- Widgets
- Styles
- Text
- Content