1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! A library for talking to CAN adapters on different platforms
//! (MacOS via PCANBasic and Linux via socketcan currently).
//!
//! **NOTE: this is an early development version and APIs are
//! not yet stabilized.**
//!
//! # Platforms and Adapters
//! * **MacOS**
//! * Install PCUSB library from [https://www.mac-can.com](https://www.mac-can.com)
//! * PCAN-USB is the only adapter supported currently
//! * **Linux**
//! * Uses SocketCAN interface, all adapters with kernel drivers supported
//! * **Windows (PRELIMINARY)**
//! * Install PCAN-Basic library from [https://www.peak-system.com](https://www.peak-system.com/fileadmin/media/files/PCAN-Basic.zip)
//! * Note that using `Adapter::recv()` with a timeout will consume excess CPU cycles
//!
//! # Usage
//! Add `host-can` to your project, specifying the `pcan` (MacOS) or `socketcan`
//! (Linux) feature:
//!
//! ```shell
//! cargo add host-can --features=<pcan | socketcan>
//! ```
//! See the `tests/` directory for example code.
//!
//! # TODO
//! * Async APIs
//! * CanFD support
//! * Timestamp support
//! * Adapter-specific APIs for device control/queries
//! * Handle adapter disconnect/reconnect
//! * Optimize windows adapter read timeout logic
//! * More tests / docs / examples
compile_error!;