pub struct StandardObjects {
pub device_type: u32,
pub identity: LssAddress,
pub producer_heartbeat_ms: u16,
pub error_history_len: u8,
pub device_name: Option<ByteString>,
}Expand description
Builder for the mandatory CiA 301 communication-profile objects.
The objects it inserts are all node-id-independent, so it can populate a
dictionary before a node-id is known (e.g. an LSS-unconfigured node). COB-ID
objects that depend on the node-id (0x1014 EMCY, 0x1005 SYNC) are left to
the application, which knows the assigned id.
Fields§
§device_type: u32Object 0x1000 — device type (profile and type information).
identity: LssAddressObject 0x1018 — the identity record (vendor / product / revision /
serial), the same value an LSS master matches.
producer_heartbeat_ms: u16Object 0x1017 — producer heartbeat time, in milliseconds (0 disables).
error_history_len: u8Number of 0x1003 pre-defined-error-field sub-entries to pre-allocate
(0 omits the object entirely).
device_name: Option<ByteString>Object 0x1008 — the manufacturer device name (a VISIBLE_STRING), or
None to omit it.
Implementations§
Source§impl StandardObjects
impl StandardObjects
Sourcepub const fn new(device_type: u32, identity: LssAddress) -> Self
pub const fn new(device_type: u32, identity: LssAddress) -> Self
A baseline with the given device type and identity, no heartbeat, and no
pre-defined error field. Refine with with_heartbeat
and with_error_history.
Sourcepub fn with_heartbeat(self, ms: u16) -> Self
pub fn with_heartbeat(self, ms: u16) -> Self
Set the producer heartbeat time (0x1017), in milliseconds.
Sourcepub fn with_error_history(self, entries: u8) -> Self
pub fn with_error_history(self, entries: u8) -> Self
Pre-allocate entries sub-entries of the pre-defined error field
(0x1003) so Node::raise_emergency
can mirror the error history into the dictionary.
Sourcepub fn with_device_name(self, name: &str) -> Self
pub fn with_device_name(self, name: &str) -> Self
Set the device name (0x1008, a VISIBLE_STRING), truncated to
MAX_STRING_LEN bytes.
Sourcepub fn insert_into<const N: usize>(
&self,
od: &mut ObjectDictionary<N>,
) -> Result<()>
pub fn insert_into<const N: usize>( &self, od: &mut ObjectDictionary<N>, ) -> Result<()>
Insert the objects into od.
Returns Error::DictionaryFull if the
dictionary lacks capacity — it needs room for the 9 base objects, the
optional device name, and the error-history entries plus their count
sub-index. Existing objects at these addresses are overwritten.
Trait Implementations§
Source§impl Clone for StandardObjects
impl Clone for StandardObjects
Source§fn clone(&self) -> StandardObjects
fn clone(&self) -> StandardObjects
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more