pub struct NodeInfo {
pub manufacturer: String,
pub model: String,
pub hardware_version: String,
pub software_version: String,
pub user_name: String,
pub user_description: String,
}Expand description
Simple Node Information, reported to configuration tools such as JMRI.
The Simple Node Information Standard (SNIP) lets a tool ask any node
for six human-readable strings without reading its configuration memory.
The first four are fixed by the manufacturer; the last two are set by the
user (JMRI shows them as the node’s name and description).
Node answers SNIP requests from its NodeInfo automatically.
Wire format of the reply payload:
0x04 manufacturer section version
manufacturer \0 max 41 bytes incl. NUL
model \0 max 41
hardware_version \0 max 21
software_version \0 max 21
0x02 user section version
user_name \0 max 63
user_description \0 max 64use rolcb::NodeInfo;
let info = NodeInfo {
manufacturer: "Uncommon Models".into(),
model: "Dispatch Panel".into(),
software_version: "0.1.0".into(),
user_name: "Yard tower".into(),
..Default::default()
};
let bytes = info.snip_payload();
assert_eq!(bytes[0], 4);
assert_eq!(NodeInfo::from_snip(&bytes), info);Fields§
§manufacturer: StringManufacturer name (truncated to 40 bytes on the wire).
model: StringModel name (truncated to 40 bytes).
hardware_version: StringHardware version (truncated to 20 bytes).
software_version: StringSoftware version (truncated to 20 bytes).
user_name: StringUser-assigned node name (truncated to 62 bytes).
user_description: StringUser-assigned description (truncated to 63 bytes).
Implementations§
Trait Implementations§
impl Eq for NodeInfo
impl StructuralPartialEq for NodeInfo
Auto Trait Implementations§
impl Freeze for NodeInfo
impl RefUnwindSafe for NodeInfo
impl Send for NodeInfo
impl Sync for NodeInfo
impl Unpin for NodeInfo
impl UnsafeUnpin for NodeInfo
impl UnwindSafe for NodeInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more