CAN DragonEmSA
functionEnumeration and Connection

EmSACAN_Connect

Prototype

emsacan_result_t EmSACAN_Connect(
    wchar_t *SerialNumber,
    uint8_t DisableRTCUpdate,
    const char *ClientName,
    emsacan_handle_t *pHandle );

Description

Connects to a CAN interface by serial number.

Parameters

ParameterDirectionTypeDescription
SerialNumberinwchar_tWide string serial number of the device to open.
DisableRTCUpdateinuint8_tNon-zero to skip sending current date/time to the device.
ClientNameinconst charOptional UTF-8 display name for this client (NULL = anonymous). In CDNet-mediated mode this name appears as
pHandleoutemsacan_handle_tReceives the session handle on success.

Return value

EMSACAN_OK on success, or another emsacan_result_t code on failure.

Example

emsacan_handle_t handle = 0;
emsacan_result_t rc = EmSACAN_Connect(L"A1B2C3D4", 0, &handle);
if (rc != EMSACAN_OK)
{
    wchar_t err[256];
    EmSACAN_GetLastError(0, err, 256);
}
/* use handle for subsequent calls */

See also