CAN DragonEmSA

C API Reference

Complete reference for EmSACAN.h. Each function, struct, and enum has its own page with prototype, parameter descriptions, return values, and code examples.

See also the C# wrapper reference and therecommended program flow.

Library Lifecycle

Enumeration and Connection

CAN Traffic

  • EmSACAN_GetTxQueueDepth — Returns the number of CAN frames currently queued in the hardware TX ring buffer for a port.
  • EmSACAN_Read — Reads one CAN message from the receive path for the specified port.
  • EmSACAN_SetCANEvents — Registers event handles signalled when new CAN data or bus errors occur on the specified port.
  • EmSACAN_Write — Transmits one CAN message on the specified port.

Parameters

Serial Number and Firmware

Channel Lifecycle

Status

Types and Enums

Constants

  • EMSACAN_MAX_CHANNELS — Maximum number of CAN ports per interface supported by this SDK release.
  • EMSACAN_MAX_DESCRIPTION_LEN — Maximum length (wchar_t units) for description fields in `emsacan_interface_t`.
  • EMSACAN_MAX_SERIAL_NUMBER_LEN — Pack a struct to 1-byte alignment (Clang/GCC). */ #define PACK(__Declaration__) __Declaration__ __attribute__((__packed__)) #endif #if defined(_MSC_VER) && !defined(__clang__) /*@brief Pack a struct to 1-byte alignment (MSVC, pragma-based). */ #define PACK(__Declaration__) \ __pragma(pack(push, 1)) __Declaration__ __pragma(pack(pop)) #endif /*@brief Maximum length (wchar_t units) for serial number fields in `emsacan_interface_t`.
  • EMSACAN_MSGSTAT_FORCEBL_BIT — Supported bits in the emsacan_msg_t stat field - the Force BL input pin (1 = high, 0 = low)
  • EMSACAN_MSGSTAT_GPI_BIT — Supported bits in the emsacan_msg_t stat field - the general purpose input pin (1 = high, 0 = low)
  • EMSACAN_PIPE_CAN_MESSAGE_BYTES — Function result codes.
  • EMSACAN_SERIAL_NUMBER_LEN — Maximum length of a serial number in characters (buffers for read APIs).