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
//! Periodic message sending module.
//!
//! This module provides functionality for sending CAN messages at fixed time intervals.
//! It implements FR-001 to FR-006 from the 004 specification.
//!
//! # Features
//!
//! - Configure messages to send at fixed intervals (1ms - 10000ms)
//! - Dynamic data and interval updates without interrupting the send cycle
//! - Support for multiple concurrent periodic messages (at least 32)
//! - Statistics tracking (send count, actual intervals)
//! - Graceful error handling (skip on failure, continue next cycle)
//!
//! # Example
//!
//! ```rust,ignore
//! use canlink_hal::periodic::{PeriodicScheduler, PeriodicMessage};
//! use canlink_hal::{CanMessage, BackendConfig};
//! use canlink_mock::MockBackend;
//! use std::time::Duration;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let mut backend = MockBackend::new();
//! backend.initialize(&BackendConfig::new("mock"))?;
//! backend.open_channel(0)?;
//!
//! let scheduler = PeriodicScheduler::new(backend, 32).await?;
//!
//! let msg = CanMessage::new_standard(0x123, &[0x01, 0x02, 0x03, 0x04])?;
//! let periodic = PeriodicMessage::new(msg, Duration::from_millis(100))?;
//!
//! let id = scheduler.add(periodic).await?;
//!
//! // Let it run...
//! tokio::time::sleep(Duration::from_secs(1)).await;
//!
//! scheduler.shutdown().await?;
//! Ok(())
//! }
//! ```
pub use PeriodicMessage;
pub use ;
pub use PeriodicStats;