Given the range of tasks for which the OpenSCADA system may be used, it is necessary to provide a tool for management of interactive user events. This is due to the fact that in dealing with individual tasks of embedded systems, input and control devices can greatly vary. But it is enough to look at the regular office keyboard and notebook one, that would remove any doubt about the necessity for the manager of events.
The events manager must work using the maps of events. Map of the events — is the list of named events, indicating their origin. The origin of the events can be a keyboard, mouse, paddle, joystick, etc. At an event emerge the events manager is looking for it in the active map and compares with the name of the event. A comparison name of the event is placed in the queue for processing. Widgets in this case must process the given queue of events.
The active map of events is specified in the profile of each user or it is set by default (
in planes).
In general, four types of events are provided:
- events of the shapes-primitives of VCA (prefix: ws_), for example, pressing of the display button event — "ws_BtPress";
- keyboard events (prefix: key_) — all events from mouse and keyboard in the form of — "key_presAlt1";
- user events (prefix: usr_) are generated by the user in the procedures of the calculation of widgets;
- mapping of the event (prefix: map_) — events from the map of events, in planes.
Event itself represents deficiently information, especially if its processing occurs at higher level. For the unequivocal identification of the event and its source in the whole the event is recorded as follows: "ws_BtPress:/curtime". Where:
ws_BtPress — same event;
/curtime — the path to the child element that has generated the event.
Table 3.5 provides a list of standard events, the support of which should be provided in visualizers of VCA.
Table 3.5. Standard events
Id | Description |
Keyboard events: key_[pres|rels][Ctrl|Alt|Shift]{Key} |
*SC#3b | Scan-code of the key. |
*#2cd5 | Code of the unnamed key. |
*Esc | "Esc". |
*BackSpace | Removing of the previous character — "<--". |
*Return, *Enter | Enter — "Enter". |
*Insert | Insertion — "Insert". |
*Delete | Deleting — "Delete". |
*Pause | Pause — "Pause". |
*Print | Print of the screen — "Print Screen". |
*Home | Home — "Home". |
*End | End — "End". |
*Left | Left — "<-". |
*Up | Up — '^'. |
*Right | Right — "->". |
*Down | Down — '\/'. |
*PageUp | Page up — "PageUp". |
*PageDown | Page down — "PageDown". |
*F1 ... *F35 | Function key from "F1" to "F35". |
*Space | Space — ' '. |
*Apostrophe | Apostrophe — '`'. |
*Asterisk | Asterisk on an additional field of the keyboard — '*'. |
*Plus | Plus on an additional field of the keyboard — '+'. |
*Comma | Comma — ','. |
*Minus | Minus — '-'. |
*Period | Period — '.'. |
*Slash | Slash — '\'. |
*0 ... *9 | Number from '0' to '9'. |
*Semicolon | Semicolon — ';'. |
*Equal | Equal — '='. |
*A ... *Z | Keys of Latin alphabet from 'A' to 'Z'. |
*BracketLeft | Left square bracket - '['. |
*BackSlash | Backslash — '/'. |
*BracketRight | Right square bracket — ']'. |
*QuoteLeft | Left quote — '''. |
Keyboard focus events. |
ws_FocusIn | Focus is obtained by a widget. |
ws_FocusOut | Focus is lost by a widget. |
Mouse events: |
key_mouse[Pres|Rels][Left|Right|Midle] | Pressed/released the mouse button. |
key_mouseDblClick | Double-click the left mouse button. |
Events of quittance on the side of the visualizer. |
ws_alarmLev | Quittance of all violations by all notices methods and types. |
ws_alarmNtf{N} | Quittance of all violations by the type {N} (0...7). |
Events of the primitive of elemental figure ElFigure: |
ws_Fig[Left|Right|Midle|DblClick] | Activating of the figures (fills) by the mouse button. |
ws_Fig{N}[Left|Right|Midle|DblClick] | Activating of the figure (fill) N by the mouse button. |
Events of the primitive of form elements FormEl: |
ws_LnAccept | A new value in the input line is set. |
ws_TxtAccept | The value of the text editor is changed. |
ws_ChkChange | The state of the flag is changed. |
ws_BtPress | The button is pressed. |
ws_BtRelease | The button is released. |
ws_BtToggleChange | The button toggle is changed. |
ws_BtMenu={Item} | Selection of the menu Item. |
ws_BtLoad | The selected file loaded. |
ws_CombChange | The value of the combo box is changed. |
ws_ListChange | The current list item is changed. |
ws_TreeChange | The current tree item is changed. |
ws_TableChangeSel | The table's item selection changed. |
ws_TableEdit_{colN}_{rowN} | The table's cell ({colN}:{rowN}) edited. |
ws_SliderChange | The slider position changed. |
Events of the primitive of media content Media: |
ws_MapAct{N}[Left|Right|Midle] | Media area with the number N is activated by the mouse button. |
ws_MediaFinished | Media-stream play is finished. |
Events are the main mechanism of notification and is actively used for user interaction. For the event processing there are two mechanisms:
- Primary — the script uses to control the opening of the pages.
- Secondary — the computational procedure of the widget.
The mechanism "Scripts for the control the opening of pages" based on the basic attribute of the widget "evProc", which can be used for switching, opening, substitution and navigation through the pages. The scenario of this attribute is stored as a list of commands with the syntax: "
{event}:{evSrc}:{com}:{prm}". Where:
- event — the expected event;
- evSrc — the path of the nested widget-source of the event;
- com — the session command;
- prm — the parameter of the command.
The following commands are implemented:
- open — opening page; page to open is specified in the parameter prm both in direct way and as a template (example: /pg_so/1/*/*);
- next — opening of the next page; page to open is specified in the parameter prm as a template (example: /pg_so/*/*/$);
- prev — opening of the previous page; page to open is specified in the parameter prm as a template (example: /pg_so/*/*/$).
Special characters of the template are deciphered as follows:
- pg_so — direct name of the desired-static page (with the prefix), requires the compulsory accordance and is used to identify the last open page;
- 1 — name of a new page in a general way (without a prefix);
- * — the page is taken from the name of a previous opened page or the first available page is substituted, if the previous opened page is missing;
- $ — points the place of the opened page relative to which you are to go to the next or to the previous one.
To more and true the mechanism of the templates understanding lets cite some real examples:
- Changing the signal object:
Initially: /pg_so/pg_1/pg_mn/pg_1
Command: open:/pg_so/2/*/*
Result: /pg_so/pg_2/pg_mn/pg_1
- Switching of the type:
Initially: /pg_so/pg_1/pg_mn/pg_1
Command: open:/pg_so/*/gkadr/*
Result: /pg_so/pg_1/pg_gkadr/pg_1
- Next/previous page of the type:
Initially: /pg_so/pg_1/pg_mn/pg_1
Command: next:/pg_so/*/*/$
Result: /pg_so/pg_1/pg_mn/pg_2
As an example lets cite the scenario of operation of the main page of the user interface:
ws_BtPress:/prev:prev:/pg_so/*/*/$
ws_BtPress:/next:next:/pg_so/*/*/$
ws_BtPress:/go_mn:open:/pg_so/*/mn/*
ws_BtPress:/go_graph:open:/pg_so/*/ggraph/*
ws_BtPress:/go_cadr:open:/pg_so/*/gcadr/*
ws_BtPress:/go_view:open:/pg_so/*/gview/*
ws_BtPress:/go_doc:open:/pg_so/*/doc/*
ws_BtPress:/go_resg:open:/pg_so/rg/rg/*
ws_BtPress:/so1:open:/pg_so/1/*/*
ws_BtPress:/so2:open:/pg_so/2/*/*
ws_BtPress:/so3:open:/pg_so/3/*/*
ws_BtPress:/so4:open:/pg_so/4/*/*
ws_BtPress:/so5:open:/pg_so/5/*/*
ws_BtPress:/so6:open:/pg_so/6/*/*
ws_BtPress:/so7:open:/pg_so/7/*/*
ws_BtPress:/so8:open:/pg_so/8/*/*
ws_BtPress:/so9:open:/pg_so/9/*/*
ws_BtPress:*:open:/pg_control/pg_terminator
The mechanism "Processing the events with the help of computational procedure of the widget" is based on the attribute "event" and the user procedure of calculating written with the help of the programming language of OpenSCADA. The events, in process of receipt, are accumulated in the attribute "event" till the moment of call of the computational procedure. The computational procedure is called with the specified frequency of calculating the widget and receives a value for the attribute "event" as the list of events. In the calculation procedure the user can: analyze, process and delete the processed events from the list, and add to the list new events. The remaining, after the procedure execution, and new events are analyzed for compliance with the conditions of the call by means of script of the primary mechanism, after which the remaining events are transmitted to the upper by the hierarchy widget to be processed by it, with the correction of the path of events in accordance with the hierarchy of the penetration of the event.
The content of the attribute "event" is a list of events in the format "
{event}:{evSrc}", with the event on the separate line. Here is an example of processing events in the Java-like programming language of the OpenSCADA: