GetModuleConfiguration
Gets the information of the configured device.
Syntax
KsError GetModuleConfiguration(
int ConfigurationIndex,
int* SlaveId,
int* ModuleId,
KsConfigurationType* ConfigurationType,
VOID* Configuration
);
Parameters
ConfigurationIndex: the index of the configured device.
SlaveId: the slave index. This index value is automatically assigned by the KINGSTAR master when the EtherCAT network starts, based on the physical connection order. The first device connected directly to the master is assigned Index 0, followed by Index 1, Index 2, and so on. These indexes remain consistent within the slave array even if devices are added, removed, or reconnected. Please refer to the use cases in HotConnect, Repair, and Restart for more details.
ModuleId: the module (devices linked to the coupler) ID. It can be slot ID, port ID, or CANopen slave ID.
ConfigurationType: the type of link between the device and the coupler. See the KsConfigurationType type.
Configuration: pointer to the configuration structure. It depends on what protocol you use. For example, if it's IO-Link, the configuration is the IoLinkSetting structure.
Return value
If the function succeeds, it returns errNoError, otherwise an error code. For more information about the error code, see the KsError list.
Usable EtherCAT states
ecatOffline, ecatInit, ecatBoot, ecatPreOP, ecatSafeOP, ecatOP
Example
int slaveId = 0, moduleId = 0;
void* Configuration = malloc(sizeof(CanOpenSetting));
KsConfigurationType type = KsConfigurationType::configEtherCAT;
nRet = GetModuleConfiguration(0, &slaveId, &moduleId, &type, Configuration);
// Cast Configuration to the pointer of setting structure based on the type value
if (type == configCANopen)
{
CanOpenSetting CanOpenConf = *(CanOpenSetting*)Configuration;
}
Requirements
| RT | Win32 | |
|---|---|---|
| Minimum supported version | 4.0 | 4.0 |
| Header | ksapi.h | ksapi.h |
| Library | KsApi_Rtss.lib | KsApi.lib |
See also