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
//! J1939 / NMEA 2000 source and destination addresses.
//!
//! | Range | Purpose |
//! |-----------|------------------------------------------|
//! | 0..=251 | Claimable source addresses |
//! | 252..=253 | Reserved |
//! | 254 | NULL, no address claimed |
//! | 255 | GLOBAL, broadcast |
//!
//! # Why the whole `0..=251` range is claimable
//!
//! J1939-81 reserves `0..=127` for preferred addresses assigned by the SAE and
//! keeps `128..=247` for self-configurable nodes. **NMEA 2000 does not inherit
//! that split**: the SAE assignments describe the on-road industry groups, not
//! the marine one. A marine node may claim anywhere in `0..=251`.
//!
//! This is not a reading of the standard alone. The reference C++ stack defines
//! `N2kMaxCanBusAddress` as `251`, and its documentation states that "each
//! device will get device source address (0-251)". A 28-minute capture of an
//! 18-device bus shows every node sitting between 0 and 43. All of them are
//! flagged Arbitrary Address Capable.
//!
//! Restricting claims to `128..=207` would therefore park a node in an empty
//! part of the bus, where no arbitration ever happens.
//==================================================================================SPECIAL_VALUES
/// Broadcast address: the frame targets every node on the bus.
///
/// Mandatory destination for an Address Claim (PGN 60928).
pub const GLOBAL: u8 = 255;
/// Null address ("Cannot Claim").
///
/// Sent as the source address by a node that lost arbitration and has no
/// claimable address left.
pub const NULL_ADDR_254: u8 = 254;
//==================================================================================CLAIMABLE_RANGE
/// Lowest address a node may claim.
pub const MIN_CLAIMABLE: u8 = 0;
/// Highest address a node may claim, whatever the strategy
/// (`Fixed`, `SelfConfigurable`, `Arbitrary`).
pub const MAX_CLAIMABLE: u8 = 251;
/// Number of distinct claimable addresses.
pub const CLAIMABLE_COUNT: usize = + 1;
//==================================================================================PREDICATES
/// Returns `true` when a node may claim this address.
pub const