CommandFusion Wiki

Documentation Resources

User Tools

Site Tools


software:gui-designer:system-manager:feedback-parsing:regex-examples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

software:gui-designer:system-manager:feedback-parsing:regex-examples [2012/08/16 06:38]
aaron created
software:gui-designer:system-manager:feedback-parsing:regex-examples [2013/07/01 12:39] (current)
terrylau [Regex Tester]
Line 14: Line 14:
 Each line is a different message the Opus system would send back depending on which source was selected (1 to 8).\\ Each line is a different message the Opus system would send back depending on which source was selected (1 to 8).\\
 \\ \\
-Now, we need to parse this into 8 separate join numbers ​so that only one of the 8 source select buttons is active at any one time. This is done by using the following regex syntax:+Now, we need to parse this source selection ​so that only one of the 8 source select buttons is active at any one time. This is done by using the following regex syntax:
 <​code>​ <​code>​
-#11U010(1)?​(2)?​(3)?​(4)?​(5)?​(6)?​(7)?​(8)?​!+#11U010(\d)!
 </​code>​ </​code>​
  
-Notice the question marks after each capture group - this means the group can appear once or never in the actual ​message ​from Opus. Even if the group doesnt have a match, it will still report a capture group with no data. This is a key point in ensuring only one of the 8 source select buttons is active at a time.+Notice the round brackets and digit specifier ​- this means '​capture a single digit character'​ at the position of the message ​before ​the exclamation mark.
  
 ===== Regex Tester ===== ===== Regex Tester =====
  
-You can use the Regex Tester in guiDesigner to test your regex pattern and ensure the correct ​capture groups are set when any of the 8 different messages from Opus come through the feedback system.+You can use the [[software:​gui-designer:​regex-tester|Regex Tester]] in guiDesigner to test your regex pattern and ensure the correct ​data is captured ​when any of the 8 different messages from Opus come through the feedback system.
  
-{{:​software:​gui-designer:​system-manager:​feedback-parsing:​01_regex_example_tester.png?​nolink|}} +{{ :​software:​gui-designer:​system-manager:​feedback-parsing:​01_regex_example_tester.png?​nolink |}}
- +
-Note the 8 capture groups found, and only one is reporting a value.+
  
 ===== Feedback Properties ===== ===== Feedback Properties =====
  
 Once you have this regex perfectly written, you need to assign a [[software:​gui-designer:​system-manager:​feedback-parsing|Feedback Parsing]] item in the [[software:​gui-designer:​system-manager|System Manager]] to use this regex and assign the capture groups to join numbers.\\ Once you have this regex perfectly written, you need to assign a [[software:​gui-designer:​system-manager:​feedback-parsing|Feedback Parsing]] item in the [[software:​gui-designer:​system-manager|System Manager]] to use this regex and assign the capture groups to join numbers.\\
-To do this, you click on the 'Add Feedback'​ button in the System Manager toolbar. This will bring up the New [[software:​gui-designer:​system-manager:​feedback-parsing:​new-feedback-wizard|Feedback Wizard]] which you can then skip and enter the details manually.+To do this, you click on the 'Add Feedback'​ button in the System Manager toolbar.
  
 {{:​software:​gui-designer:​system-manager:​feedback-parsing:​01_regex_example_feedback_properties.png?​nolink|}} {{:​software:​gui-designer:​system-manager:​feedback-parsing:​01_regex_example_feedback_properties.png?​nolink|}}
  
-Notice the 'Off Value' is always left empty - this ensures when there is an empty capture for that group that the assigned digital join will go low.\\ +Add a capture group for each expected source selection value that could be returned by the device. In this example there are 8 possible sources, so we have created 8 capture groups, all referencing '​capture index' 1. This means '​reference the data captured by the first set of round brackets in the regex'​. 
-Also notice the 'On Value' is assigned the actual value that will be captured by the regex when we want to set the assigned digital join high. If this was left empty as well, then the assigned digital join is set to either low or high depending if the captured value results in a 0 or 1 by forcing the captured value to return a boolean (0 or 1) value. So in this example leaving the 'On Value' empty would also work, as the numbers 1 through 8 all result in a boolean value of 1 (basically any number above 0 will result in a boolean 1), yet the empty capture values would result in a boolean 0.+ 
 +Notice the 'Off Value' is always left empty - this ensures when there is any value other than the 'On Value' captured, ​the assigned digital join will go low (inactive button state).\\ 
 +Also notice the 'On Value' is assigned the actual value that will be captured by the regex when we want to set the assigned digital join high (active button state). 
 +If this was left empty as well, then the assigned digital join is set to either low or high depending if the captured value results in a 0 or 1 by forcing the captured value to return a boolean (0 or 1) value.
  
 ===== Assigning Join Numbers ===== ===== Assigning Join Numbers =====
  
 In the above Feedback Properties example, notice the join numbers 1 through 8 are assigned, and they are set to '​Digital'​ type. These join numbers can then be assigned to a button in your GUI to change the state of the button when the feedback is processed from the system.\\ In the above Feedback Properties example, notice the join numbers 1 through 8 are assigned, and they are set to '​Digital'​ type. These join numbers can then be assigned to a button in your GUI to change the state of the button when the feedback is processed from the system.\\
-Simply create 8 buttons on a page and assign then join numbers 1 through 8 using the 'Click assign digital join' tool in the main toolbar (much quicker than editing ​each buttons ​properties manually).+Simply create 8 buttons on a page and assign then join numbers 1 through 8 using the 'Click assign digital join' tool in the main toolbar (much quicker than editing ​all button ​properties manually).
  
 {{:​software:​gui-designer:​system-manager:​feedback-parsing:​01_regex_example_page.png?​nolink|}} {{:​software:​gui-designer:​system-manager:​feedback-parsing:​01_regex_example_page.png?​nolink|}}
software/gui-designer/system-manager/feedback-parsing/regex-examples.1345099100.txt.gz · Last modified: 2012/08/16 06:38 by aaron