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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! CAN bus integration for MDF4 files.
//!
//! This module provides utilities for logging and reading CAN bus data with MDF4 files.
//! It supports multiple modes:
//!
//! 1. **With DBC**: Use [`CanDbcLogger`] for full signal decoding with metadata
//! 2. **Without DBC**: Use [`RawCanLogger`] for raw frame capture
//! 3. **Post-processing**: Use [`DbcOverlayReader`] to decode raw captures with DBC
//!
//! # Features
//!
//! - Uses `Dbc::decode()` for full DBC support (multiplexing, value descriptions, etc.)
//! - Raw frame logging when no DBC is available
//! - Read-time DBC overlay for post-processing raw captures
//! - Batch processing for efficient logging
//! - Support for both Standard (11-bit) and Extended (29-bit) CAN IDs
//! - Full metadata preservation (units, conversions, limits)
//! - Raw value storage with conversion blocks for maximum precision
//! - **CAN FD support**: Up to 64 bytes per frame with BRS/ESI flags
//!
//! # Example with DBC
//!
//! ```ignore
//! use mdf4_rs::can::CanDbcLogger;
//!
//! // Parse DBC file
//! let dbc = dbc_rs::Dbc::parse(dbc_content)?;
//!
//! // Create logger with full metadata
//! let mut logger = CanDbcLogger::builder(&dbc)
//! .store_raw_values(true)
//! .build()?;
//!
//! // Log CAN frames
//! logger.log(0x100, timestamp_us, &frame_data);
//!
//! // Get MDF bytes
//! let mdf_bytes = logger.finalize()?;
//! ```
//!
//! # Example without DBC (Raw Logging)
//!
//! ```ignore
//! use mdf4_rs::can::RawCanLogger;
//!
//! // Create raw logger (no DBC needed)
//! let mut logger = RawCanLogger::new()?;
//!
//! // Log raw CAN frames
//! logger.log(0x100, timestamp_us, &frame_data);
//!
//! // Get MDF bytes
//! let mdf_bytes = logger.finalize()?;
//! ```
// CanDbcLogger uses FastDbc which requires std + dbc
pub use ;
pub use ;
// FD constants and flags are always available
pub use ;
// FD frame trait and implementation require embedded_can
pub use ;
pub use RawCanLogger;
pub use TimestampedFrame;
// Re-export commonly used dbc-rs types (requires dbc feature)
pub use ;