Documentation
IPS_GetFunctionList
Require: IP-Symcon >= 2.6
array IPS_GetFunctionList (int $InstanceID)
Parameters
InstanceID | ID of the instance whose functions are returned, 0 for all functions |
Returns
An array of string values of all function names
Description
The function determines all available IPS functions that are available within the current configuration of IP Symcon. The names of the functions are listed in an array. The number of functions depend on the current configuration of IP Symcon. E.g., functions for TTS (Text-To-Speech) are listed if and only if an instance of the TTS module is configured within IP Symcon.
The parameter InstanceID can be used to specify a filter. In that case, only functions of the specified instance are shown in the arry. If the InstanceID is specified as 0, the filtering mechanism is not active and all available functions within IP Symcon will be returned.
Details about the individual features can be determined by IPS_GetFunction.
Example
$allFunctions = IPS_GetFunctionList(0);
print_r($allFunktions[48]); // return only function 48 (IPS_CreateScript)
/* returns:
Array
(
[FunctionName] => IPS_CreateScript
[Parameters] => Array
(
[0] => Array
(
[Description] => ScriptType
[Type_] => 1
)
)
[Result] => Array
(
[Description] => Result
[Type_] => 1
)
)
*/
//Export all IP Symcon functions with a parameter list
$instanceid = 0; //0 = All functions, otherwise filter on InstanceID
$fs = IPS_GetFunctionList($instanceid);
asort($fs);
$typestr = Array("boolean", "integer", "float", "string", "variant", "array");
foreach($fs as $f) {
$f = IPS_GetFunction($f);
echo sprintf("[%7s]", $typestr[$f['Result']['Type_']]) . " - ".$f['FunctionName']."(";
$a = Array();
foreach($f['Parameters'] as $p) {
if(isset($p['Enumeration']) && sizeof($p['Enumeration']) > 0) {
$b=Array();
foreach($p['Enumeration'] as $k => $v) {
$b[] = $k."=".$v;
}
$type = "integer/enum[".implode(", ", $b)."]";
} else {
$type = $typestr[$p['Type_']];
}
$a[]=$type." $".$p['Description'];
}
echo implode(", ", $a).");\n";
}