EmSACAN_ConfigureCanPipeForwarder
Prototype
emsacan_result_t EmSACAN_ConfigureCanPipeForwarder(
uint8_t Enable );
Description
EmSA CAN Interface — public API for the CAN Dragon DLL.
Details
Declares the DLL import/export surface (EMSACAN_API), limits, configuration and message types, and the functions used to enumerate interfaces, connect, exchange CAN traffic, read/write device parameters, and (on Windows) optional named-pipe forwarding and firmware update. ### Threading and concurrency **Multiple devices:More than one CAN Dragon may be connected at the same time. Each successful EmSACAN_Connect returns a distinct emsacan_handle_t — use a separate handle per device. **Supported:- Using EmSACAN_Read, EmSACAN_Write, EmSACAN_GetStatus, EmSACAN_OpenChannel, EmSACAN_CloseChannel, and EmSACAN_ResetChannel on **differenthandles from **differentthreads at the same time. - Assigning one application thread (or owner) per connected handle for ongoing CAN I/O. - Calling EmSACAN_CalculateTiming from any thread (it does not use a session handle). **Not supported:- Calling any EmSACAN function on the **samehandle from more than one thread at the same time without your own mutual exclusion. - Calling EmSACAN_Startup, EmSACAN_Shutdown, EmSACAN_EnumerateInterfaces, EmSACAN_Connect, or EmSACAN_Disconnect from multiple threads at the same time without your own coordination. - Having a firmware update in progress on more than one handle at the same time. - Calling EmSACAN functions on a handle from that handle’s firmware-update callback. - Calling EmSACAN functions on a handle from that handle’s port connection callback (EmSACAN_OpenChannel). **Per-handle limitations:*- While a firmware update is active on a handle, other calls on that handle may fail (for example EMSACAN_ERR_FWUPDATE_ACTIVE or EMSACAN_ERR_BUSY). - Do not overlap EmSACAN_ReadParameter and EmSACAN_WriteParameter on the same handle unless your application serializes them. - EmSACAN_GetLastError with a NULL handle reports the last process-wide error; with a non-NULL handle it reports the last error for that session only. @defgroup emsacan_public EmSA CAN public API @{
Parameters
| Parameter | Direction | Type | Description |
|---|---|---|---|
Enable | in | uint8_t | Non-zero to enable forwarding; 0 to disable. |
Return value
EMSACAN_OK on success, or another emsacan_result_t code on failure.
Example
/* See [Quick Start](/docs/quick-start) and [Program Flow](/docs/program-flow) for a full session example. */
emsacan_result_t rc = EmSACAN_ConfigureCanPipeForwarder(/* ... */);
if (rc != EMSACAN_OK) {
wchar_t err[256];
EmSACAN_GetLastError(handle, err, 256);
}