Documentation
GetCompatibleParents
Require: IP-Symcon >= 8.2
string GetCompatibleParents ()
Returns
Required connection type and description of compatible instances
Description
The function returns a JSON-encoded object that describes compatible physical parent instances. The management console uses this information to suggest the appropriate parent instances when creating or adapting the instance.
If the function is not implemented, all modules that are compatible according to the data flow are returned. For the module type Splitter, Discovery and Configurators, a new instance or an instance without connections is required (type = require); for the module type Device, existing instances with other connections are also suggested (type = connect). All other module types do not require any further connection. In most cases, this heuristic is sufficient. However, if it is not sufficient, the function can be overwritten.
Parameter
| Name | Description |
|---|---|
| type | If "require", only newly created instances and instances without other physically child instances are offered. If "connect" is selected, newly created instances and all existing compatible instances are suggested. |
| moduleIDs | A list of moduleIDs of compatible parent instances. If moduleIDs is used, no extended parameters can be used. Either moduleIDs or modules must be set, but not both. |
| modules | A description of possible compatible parent instances. For the possible parameters, see modules. Either moduleIDs or modules must be set, but not both. |
modules
| Name | Description |
|---|---|
| moduleID | The moduleID of instances that are compatible |
| configuration (optional) | (default: {}) An object that describes the required configuration of the instance. Existing instances that do not have the specified configuration are not displayed as compatible. If a new instance is created, this configuration is enforced and cannot be changed by the user. |
| initial (optional) | (default: {}) An object that contains suggested configuration parameters. If a new instance is created, these parameters are initially filled in, but can be adjusted by the user. The object has no effect on existing instances. |
| formOverride (optional) | (default: {}) An object that describes adjustments to the configuration form of the new instance, which are applied in a similar way to UpdateFormField. The keys of the object are the names of the configuration elements. The values are in turn objects that contain the names of the fields as keys and the updated parameter as values. The object has no effect on existing instances. |
Example
// Require a new instance, a serial port
public function GetCompatibleParents() {
return '{"type": "require", "moduleIDs": ["{6DC3D946-0D31-450F-A8C6-C42DB8D7D4F1}"]}';
}
// Require an MQTT Client with a specific Client ID
// When creating a new gateway, the initial value for the keep alive interval is 10 seconds, different from the usual default value. However, it can be adjusted
public function GetCompatibleParents() {
return '{"type": "connect", "modules": [{
"moduleID": "{F7A0DD2E-7684-95C0-64C2-D2A9DC47577B}",
"configuration": {
"ClientID": "b10c75459d64cafb5d78"
},
"initial": {
"KeepAliveInterval": 10
}
}]}';
}
// Require a new instance, a serial port with Baud Rate 2400 or 9600
public function GetCompatibleParents() {
return '{"type": "require", "modules": [{
"moduleID": "{6DC3D946-0D31-450F-A8C6-C42DB8D7D4F1}",
"formOverride": {
"Baudrate": {
"options": [
{
"value": "2400",
"caption": "2400"
},
{
"value": "9600",
"caption": "9600"
}
]
}
}
}]}';
}