2-Way Feedback
As well as sending commands to devices to control them, it is also possible for the iOS / Android app, and/or a Centro-8/8M to listen to data coming back from a device, in order to display that data, or act upon it.
Each device in the software has a 2-way feedback section where you can specify the data that you are interested in responding to, or displaying:
Depending on whether the device is linked to a Centro-8/8M or not, you will either use the App feedback section, or the processor feedback section to determine where the feedback is processed.
Response Terminator
In order for the feedback operations to work, TCP devices must send data which terminates with one or more known constant characters or bytes. This is so that the app / Centro knows that the data coming in has finished transmitting and the data is ready to be processed. Commonly, devices send data which ends with a carriage return character '\x0D' which is the default response terminator. If your device sends data which ends with something else, enter it here. UDP devices do not use the response terminator, as all data is received as a single data packet.
Feedback Conditions
This is where you specify the data that you are interested in responding to. You can enter as many conditions as you wish, and export those conditions for use in other projects using the 'Export to File' option. Each condition has a name, and the data which the system attempts to match up against. There are 2 types of data matching:
1. Feedback Matches Specific Data
This is where the incoming data must include the characters or bytes entered, eg if the condition data was 'PWR' then it would match any feedback data which contained those characters, eg 'PWR ON' or 'PWR OFF' etc.
Specific data matching is convenient where there is fixed known data coming in.
2. Feedback Matches a Pattern
This is where you can specify a 'regular expression' to match textual strings for a pattern, and capture some or all of that data into a label or number variable. Regular Expressions, or 'regex'
entered must include a capture group enclosed in brackets. An example would be:
VOL=([0-9]*)
This condition would match if the feedback data contained 'VOL=' followed by any number '*' of numeric characters 0-9 '[0-9]'. For example, if the feedback data was: 'VOL=53' then '53' would be captured and assigned to a label or number variable. If the incoming data was 'VOL=-5db' then it would not match, because '-' is not a numeric character.
Another example would be:
Artist=(.*)
This condition would match if the feedback data was, for example: 'Artist=Some Great Band' because it matches any character '.' and any number of those characters '*'. In this case, 'Some Great Band' would be captured and assigned to a label variable.
There are lots of regex examples on the internet, and this is a powerful way of extracting textual information from feedback data.
Note regex will not work on byte based data, only text.
- Number Custom Actions - if assigning a regex value to a number variable, the custom number actions for that variable will NOT fire. This is to prevent an infinite loop of commands being sent because the number changed, resulting in feedback from a device, which results in the same command being sent etc. If you want the number actions to fire, add an action which is to set the number equal to itself - this will then fire the custom number actions.
Feedback Condition Actions
Once you have specified a feedback condition, you can double click the entry to be presented with the standard Action Editor - where you can specify actions to occur when the data matches the condition. You can perform any action here, sending commands, setting variables etc.
Connect and View Data
This allows you to establish a connection to the device, send data, and see any feedback data coming from the device - which is useful for debugging feedback conditions. Both text data and the hex byte equivalent is shown. Note the 'Send' function does not automatically include the device command suffix, which is always added to pre-defined commands.
Auto Assign Commands (pro software only)
It is possible to automatically assign commands to feedback conditions using the 'Auto Assign Filter' option for each condition. This operates in the same way as Auto Assigning commands to buttons, where you select a command file & the software attempts to add a command to each condition.