CAN DragonEmSA
functionEnumeration and Connection

EmSACAN_EnumerateInterfaces

Prototype

emsacan_result_t EmSACAN_EnumerateInterfaces(
    emsacan_interface_t *pInterfaces,
    int *pNumInterfaces );

Description

Enumerates connected CAN interfaces.

Parameters

ParameterDirectionTypeDescription
pInterfacesoutemsacan_interface_tStorage for up to *pNumInterfaces (input) entries.
pNumInterfacesinint

Return value

EMSACAN_OK on success, or another emsacan_result_t code on failure.

Example

emsacan_interface_t ifaces[16];
int count = 16;
emsacan_result_t rc = EmSACAN_EnumerateInterfaces(ifaces, &count);
if (rc == EMSACAN_OK)
{
    for (int i = 0; i < count; i++)
        wprintf(L"Serial: %s  Ports: %u\n",
                ifaces[i].SerialNumber, ifaces[i].NumberofChannels);
}
else
{
    wchar_t err[256];
    EmSACAN_GetLastError(0, err, 256);
}

See also