[][src]Module cantact::c

Implementation of C/C++ bindings.

All functions are unsafe since they dereference a context pointer provided from C.

TODO: put a simple example here.

Structs

CFrame

A CAN frame in a C representation

CInterface

Interface state. A pointer to this struct is provided when initializing the library. All other functions require a pointer to this struct as the first argument.

Functions

cantact_close

Close the device. After closing, no interaction with the device can be performed.

cantact_deinit

Clean up a CANtact interface. After calling, the pointer is no longer valid.

cantact_get_channel_count

Get the number of CAN channels the device has.

cantact_init

Create a new CANtact interface, returning a pointer to the interface. This pointer must be provided as the first argument to all other calls in this library.

cantact_open

Open the device. This must be called before any interaction with the device (changing settings, starting communication).

cantact_set_bitrate

Sets the bitrate for a chanel to the given value in bits per second.

cantact_set_enabled

Enable or disable a channel.

cantact_set_hw_loopback

Enable or disable hardware loopback for a channel. This will cause sent frames to be received. This mode is mostly intended for device testing.

cantact_set_monitor

Enable or disable bus monitoring mode for a channel. When enabled, channel will not transmit frames or acknoweldgements.

cantact_set_rx_callback

Set the receive callback function. This function will be called when a frame is received.

cantact_start

Start CAN communication. This will enable all configured CAN channels.

cantact_stop

Stop CAN communication. This will stop all configured CAN channels.

cantact_transmit

Transmit a frame. Can only be called if the device is running.