Changes between Initial Version and Version 1 of Software/EventBenchConsole/MFCTranslationLayer


Ignore:
Timestamp:
10/05/11 21:09:12 (13 years ago)
Author:
sherbold
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Software/EventBenchConsole/MFCTranslationLayer

    v1 v1  
     1= Translating MFC Messages into Events = 
     2 
     3The messages are aggregated into events using a set of rules defined in XML. The order of the rules in the XML file defines their priority.  
     4 
     5== Single Messages and Sequences == 
     6 
     7There is a distinction between single messages and whole sequences of messages of the same type. The former may be used for, e.g., {{{WM_LBUTTONDOWN}}} and {{{WM_LBUTTONUP}}}: 
     8{{{ 
     9<msg type="&WM_LBUTTONDOWN;"/> 
     10<msg type="&WM_LBUTTONUP;"/> 
     11}}} 
     12 
     13Sequences of the same message occur, e.g., when scrolling: 
     14{{{ 
     15<msg type="&WM_LBUTTONDOWN;"/> 
     16<msg type="&WM_HSCROLL;" multiple=true/> 
     17<msg type="&WM_LBUTTONUP;"/> 
     18}}} 
     19 
     20The distinction is using the {{{multiple}}} attribute of the {{{msg}}} node, 
     21which is per default false. If it is true, it means ``at least one'', similar to 
     22``+'' in regular expressions.  
     23 
     24== Storage of messages == 
     25 
     26Each message or message sequence can be stored for later use, e.g., comparisons 
     27with other messages or generating replays. This is done using the {{{store}}} 
     28and {{{storeSeq}}} nodes: 
     29{{{ 
     30<msg type="&WM_LBUTTONDOWN;"> 
     31  <store var="clicked"/> 
     32</msg> 
     33<msg type=&WM_HSCROLL;" multiple=true> 
     34  <storeSeq varSeq="scrolls/> 
     35</msg> 
     36}}} 
     37 
     38When storing a message, the {{{window.hwnd}}} is automatically resolved and its 
     39target string is stored as an attribute of the message ({{{winParamType}}}). If 
     40other parameters contain HWNDs that need to be later on to address a target, 
     41they can be resolved manually and stored as a further parameter: 
     42{{{ 
     43<msg type=&WM_HSCROLL;" multiple=true> 
     44  <storeSeq varSeq="scrolls> 
     45    <resolveHwnd param="scrollBarHandle" storeParam="scrollBarTarget"/> 
     46  </storeSeq> 
     47</msg> 
     48}}} 
     49 
     50== Checking equalities == 
     51 
     52Only matching messages by their type is insufficient. Comparisons between their 
     53parameters are also required. This can be done using {{{equals}}} nodes: 
     54{{{ 
     55<msg type="&WM_LBUTTONDOWN;"> 
     56  <store var="clicked"/> 
     57</msg> 
     58<msg type="&WM_LBUTTONUP;"> 
     59  <equals> 
     60    <paramValue obj="this" param="window.hwnd"/> 
     61    <paramvalue obj="clicked" param="window.hwnd/> 
     62  </equals> 
     63</msg> 
     64}}} 
     65In the example above, the {{{equals}}} node compares whether the value of the 
     66parameter ``window.hwnd'' is equal for the stored variable ``clicked'' and the 
     67current message itself, i.e., ``this''.  
     68 
     69In general, each {{{equals}}} node has the same structure: 
     70{{{ 
     71<equals> 
     72  termNode1 
     73  termNode2 
     74</equals> 
     75}}} 
     76There are four types of term nodes: 
     77 1. {{{paramValue}}}: of the messages (example above) 
     78 1. {{{constValue}}}: constant value, e.g., {{{<constValue value="Button"/>}}} 
     79 1. {{{winInfoValue}}}: information about the target of the message. 
     80  - {{{<winInfoValue obj="this" winParam="class"/>}}} for the class of the target 
     81  - {{{<winInfoValue obj="this" winParam="hwnd"/>}}} for the HWND 
     82  - {{{<winInfoValue obj="this" winParam="resourceId"/>}}} for the resource Id. 
     83  - {{{<winInfoValue obj="this" winParam="parentTarget"/>}}} for the target of the GUI objects parent 
     84 1. {{{msgInfoValue}}}: information about the type and target of the message. 
     85  - {{{<msgInfoValue obj="this" msgParam="type"/>}}} for the type of the message (its integer) 
     86  - {{{<msgInfoValue obj="this" msgParam="target"/>}}} for the target of the message (its string representation) 
     87 
     88The comparison of sequence variables is not yet implemented! 
     89 
     90== Generation of replay sequences == 
     91If a message sequence has been successfully matched to a rule, a replay sequence 
     92is generated. This is done using {{{genMsg}}} and {{{genMsgSeq}}} nodes. 
     93 
     94The first way to generate a replay message is to directly replay a message that 
     95has been stored during the matching phase: 
     96{{{ 
     97<genMsg delay="100"> 
     98  <storedVar obj=clicked"/> 
     99</genMsg> 
     100}}} 
     101The delay attribute signifies that the replaying tool pauses for 100 ms after 
     102sending the message stored in the variable ``clicked''.  
     103 
     104The second way is to ``construct'' it: 
     105{{{ 
     106<genMsg delay="100"> 
     107  <type> 
     108    <msgInfoValue obj="cmd" msgParam="type"/> 
     109  </type> 
     110  <target> 
     111    <msgInfoValue obj="cmd" msgParam="target"/> 
     112  </target> 
     113  <LPARAM> 
     114    <paramValue obj="cmd" param="sourceDesc"/> 
     115  </LPARAM> 
     116  <WPARAM> 
     117    <paramValue obj="cmd" param="WPARAM"/> 
     118  </WPARAM> 
     119</genMsg> 
     120}}} 
     121The type needs to be an integer. The target needs to be a target string.  
     122The LPARAM and WPARAM are both optional, their default values are 0. They can be 
     123either numerical or target strings. Furthermore, it is possible to define the 
     124HI and LO word of them separatly: 
     125{{{ 
     126<LPARAM> 
     127  <LOWORD> 
     128    value 
     129  </LOWORD> 
     130  <HIWORD> 
     131    value 
     132  </HIWORD> 
     133</LPARAM> 
     134}}} 
     135 
     136The value types are the same that can be used as terms for {{{equals}}} nodes.  
     137 
     138To generate message sequences, the {{{genMsgSeq}}} node is used: 
     139{{{ 
     140<genMsgSeq delay="20"> 
     141  <type> 
     142    <constValue value="&TBM_SETPOS;"/> 
     143  </type> 
     144  <target> 
     145    <seqValue seqObj="scrolls" param="scrollBarTarget"/> 
     146  </target> 
     147  <LPARAM> 
     148    <constValue value="1"/> 
     149  </LPARAM> 
     150  <WPARAM> 
     151    <seqValue seqObj="scrolls" param="scrollPos"/> 
     152  </WPARAM> 
     153</genMsgSeq> 
     154}}} 
     155The three value types used for equals are allowed. However, either the 
     156type or the target must be of a {{{seqValue}}}, otherwise the 
     157creation will fail. In case more than one {{{seqValue}}} variable is used, 
     158e.g., a different one for the LPARAM than for the target, both sequences must 
     159have the same length.  
     160