Skip to main content

StandardObjects

Struct StandardObjects 

Source
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: u32

Object 0x1000 — device type (profile and type information).

§identity: LssAddress

Object 0x1018 — the identity record (vendor / product / revision / serial), the same value an LSS master matches.

§producer_heartbeat_ms: u16

Object 0x1017 — producer heartbeat time, in milliseconds (0 disables).

§error_history_len: u8

Number 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

Source

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.

Source

pub fn with_heartbeat(self, ms: u16) -> Self

Set the producer heartbeat time (0x1017), in milliseconds.

Source

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.

Source

pub fn with_device_name(self, name: &str) -> Self

Set the device name (0x1008, a VISIBLE_STRING), truncated to MAX_STRING_LEN bytes.

Source

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

Source§

fn clone(&self) -> StandardObjects

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for StandardObjects

Source§

impl Debug for StandardObjects

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.