Documentation
SetReceiveDataFilter
Require: IP-Symcon >= 4.1
void SetReceiveDataFilter (string $RequiredRegexRule)
Parameters
RequiredRegexRule | Regexrule which should be used as a filter |
Returns
No Return
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() {
[...]
//Apply filter
$this->SetReceiveDataFilter(".*Hello.*");
}
//Only called if “Hello” is found in the $JSONString
public function ReceiveData($JSONString) {
$data = json_decode($JSONString);
//Your Code here
[...]
}