-
Notifications
You must be signed in to change notification settings - Fork 21
Dynamic_Button
A Button gives you the ability to read or set a Parameter.
You can also communicate with the device read/write memory/property and set the progressbar in the ActionsView of the ETS.
Property | Description |
---|---|
Access |
|
Cell | Row and Column if ParameterBlock Layout is Grid/Table |
Conectiontype |
|
EventHandler Parameter | This is the 'context' parameter in the function. Encode as JSON. |
Icon | Select the Icon which will be displayed on the left |
Name | For internal use only. The function in the Script-Section will be named like this. |
Text | Displayed Text |
Text Parameter | Select a Parameter for the dynamic Text |
XML Example:
<Button Id="M-00FA_A-AF00-20-EC2E_B-1" Text="Parameter toggeln" EventHandler="buttonXXXX" Icon="no" />
The button will trigger the function which you can edit at the bottom.
The function has four parameters. With them you can access Parameters from the ETS or connect to the selected device.
function buttonXXXX(device, online, progress, context) {
//your code here
var para = device.getParameterById("P-1_R-1");
para.value = "1";
}
This object gives access to the device instance data.
It has following Methods:
Method | Description | Returns |
---|---|---|
getMessage(number) | Get a Message by it's Id | string |
getParameterById(string) | Get a ParameterRef by using it's id like P-1_R-1
|
ParameterObject |
getParameterbyName(string) | Get a ParameterRef by using it's Name Attribute | ParameterObject |
This object gives you access to the physical device. (Only if Conectiontype is not ConnectionLess)
You can read/write in Memory/Properties.
Method | Description | Returns |
---|---|---|
connect() | Connects to the device | - |
disconnect() | Disconnects from the device | - |
readDeviceDescriptor() | Read MaskVersion | Number |
readFunctionProperty(objidx, propid, data) | Reads the state of a function property | Byte Array |
invokeFunctionProperty(ibjidx, propid, data) | Execute a function property | Byte Array |
readProperty(objidx, propid, propType, startElement, count) | Reads the value of a data property | Byte Array |
writeProperty(objidx, propid, propType, startElement, count, data, verify) | Write the value of a data property | - |
readMemory(startaddr, size) | Read from the device memory | Byte Array |
writeMemory(startaddr, data, verify) | Write to the device memory | - |
readUserMemory(startaddr, size) | Read from the device user memoy | Byte Array |
writeUserMemory(startaddr, data, verify) | Write to the device user memory | - |
restart() | Restart the device | - |
This objects gives you access to the progress in the ActionView in the ETS. (Only if Conectiontype is not ConnectionLess)
You can set the progressbar and the text.
Method | Description | Returns |
---|---|---|
setProgress(percent) | 0 = hidden ; <0 = interminate;>= 0 = show progress | - |
setText(text) | Sets the displayed text with the progressbar | - |
isCanceled() | Returns true if the action is canceled by the user | Bool |
This object was defined by you with the EventHandler Parameter
.
The JSON will be parsed and is accessable as an object.
For example with { Factor = 2 }
:
var value = 15;
var doubled = value * context.Factor;
With the ParameterObject you can change the value of it or read some properties.
Property | Type | Description | Acces |
---|---|---|---|
isActive | bool | Gets the current activity state of the device parameter after evaluation of the choose/when conditions | read-only |
name | string | Gets the ParameterRef Name | read-only |
parameterRefId | string | Gets the full ParameterRef ID | read-only |
value | see list below | Gets or sets the current parameter value | read-write |
ParameterType | Value Type |
---|---|
Number | Number |
Restriction | Number/String |
Text | String |
Float | Number |
Time | Number |
Date | String (yyyy-mm-dd) |
IPAddress | String |
Color | Number (as RGB value) |
RawData | Array or Uint8Array |
None and Picture are not listed because they have no value.