OpenSCADAWiki: Home Page En/Doc/VC Aconcept/part4/part7 ...

Home | Index | Changes | Comments | Users | Registration | Login  Password:  
 
This is an old revision of HomePageEn/Doc/VCAconcept/part4/part7 from 2010-04-20 09:43:00..

4.6. Events, their processing and the events' maps

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.


Event 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. If you have any event manager of the events 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 is set by default.


In general, four types of events are provided:


Event itself represents little 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 - event;
/curtime - the path to the child element that has generated the event.

Table 4.5 provides a list of standard events, the support of which should be provided in visualizers of VCA.


Table 4.6. Standard events

IdDescription
Keyboard events: key_[pres|rels][Ctrl|Alt|Shift]{Key}
*SC#3b Scan code of the kye.
*#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 the primitive of elemental figure ElFigure:
ws_Fig{n}[Left|Right|Midle] 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 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 Button toggle is changed.
ws_CombChange The value of the combo box is changed.
ws_ListChange The current list item is changed.
ws_SliderChange Changing of the the slider position.
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.

Events are the main mechanism of notification and is actively used for user interaction. For the event processing there are two mechanisms: the scriptû used to control the opening of the pages and the computational procedure of the widget.


The mechanism "Scenario of the opening pages control" is based on the core attribute of the widget "evProc", which contains the list of scenarios of operations of the opening pages with the following syntax:<event>:<evSrc>:<com>:<prm>. Where:


The following commands are implemented:


Special characters of the template are deciphered as follows:


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 event 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 language of the user programming of OpenSCADA. Events, in process of receipt, are accumulated in the attribute "event" till the moment of call of computational procedure. 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, events are analyzed for compliance with the conditions of the call by means of script of the first 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 contents 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:

using Special.FLibSYS;
ev_rez = "";
off = 0;
while(true)
{
  sval = strParse(event,0,"\n",off);
  if( sval == "" ) break;
  else if( sval == "ws_BtPress:/cvt_light" ) alarmSt = 0x1000001;
  else if( sval == "ws_BtPress:/cvt_alarm" ) alarmSt = 0x1000002;
  else if( sval == "ws_BtPress:/cvt_sound" ) alarmSt = 0x1000004;
  else ev_rez+=sval+"\n";
}
event=ev_rez;



 
There are no files on this page.[Display files/form]
There is no comment on this page. [Display comments/form]