Documentation
SetReceiveDataFilter
Require: IP-Symcon >= 4.1
boolean SetReceiveDataFilter (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. RecieveData() is only called if the set filter is true.
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 filters for ReceiveData
public function ApplyChanges(): void {
[...]
$this->SetReceiveDataFilter(".*Hello.*");
[...]
}
// Only called if “Hello” is found in the $JSONString
public function ReceiveData(string $JSONString): string {
return "";
}