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
//! Transport layer implementations for automotive protocols.
//!
//! This module provides implementations for transport layer protocols, primarily:
//! - ISO-TP (ISO 15765-2) - Transport Protocol for diagnostic communication
//!
//! The transport layer is responsible for:
//! - Segmentation and reassembly of large messages
//! - Flow control
//! - Error recovery
//! - End-to-end message delivery
//!
//! ISO-TP is widely used in automotive diagnostics and provides:
//! - Single Frame (SF) for messages up to 7 bytes
//! - First Frame (FF) and Consecutive Frames (CF) for longer messages
//! - Flow Control (FC) frames for managing message transmission
//! - Support for normal and extended addressing
//!
//! # Examples
//!
//! ```text
//! # Example usage of the transport layer (conceptual, not actual code)
//! # ISO-TP configuration example:
//! let isotp_config = isotp::CustomConfig {
//! tx_id: 0x7E0, // Transmit CAN ID
//! rx_id: 0x7E8, // Receive CAN ID
//! block_size: 8, // Number of frames before flow control
//! st_min: 10, // Minimum separation time between frames (10ms)
//! use_extended_addressing: false
//! };
//!
//! # Create an ISO-TP instance with the config
//! let mut isotp = isotp::CustomInterface::new(isotp_config);
//!
//! # Open the connection
//! isotp.open();
//!
//! # Send a diagnostic message (UDS request)
//! let request_data = [0x22, 0xF1, 0x90]; // UDS read data by ID (VIN)
//! isotp.send(&request_data);
//!
//! # Receive response
//! let response = isotp.receive();
//! ```
use crateResult;
use crate;
/// Base transport layer trait