Documentation
SetForwardDataFilter
Require: IP-Symcon >= 4.1
boolean SetForwardDataFilter (string $RequiredRegexRule)
Parameters
RequiredRegexRule | RegexRule which should be used as a filter |
Returns
If the command succeeds, it returns TRUE, otherwise FALSE.
Description
Sets the filter using the RequiredRegexRule regular expression. ForwardData() is only called if the set filter is matching.
The page www.regex101.com can be used to test the RegEx-expression.
In certain special cases PHP json_encode() may change from upper to lower case. For example, the special character encoded JSON_string ""\u001D"" becomes ""\u001d"" after a json_decode.
Example
// Add filter for ForwardData
public function ApplyChanges(): void {
[...]
$this->SetForwardDataFilter(".*Hello.*");
[...]
}
// Only called if “Hello” is found in the $JSONString
public function ForwardData(string $JSONString): string {
return "OK";
}