Skip to main content

ResourceMode

Struct ResourceMode 

Source
pub struct ResourceMode(/* private fields */);
Expand description

Bit set of XCP resources: which feature groups a slave offers (CONNECT response / GET_STATUS protection status) and which access is requested in the CONNECT mode byte.

Bit assignment per XCP part 1 (RESOURCE byte): bit 0 CAL/PAG, bit 2 DAQ, bit 3 STIM, bit 4 PGM, bit 5 DBG (XCP ≥ 1.5); bits 1, 6, 7 are reserved.

The CONNECT command’s mode byte is 0x00 (normal) or 0x01 (user-defined) per the spec; connect(mode) passes the bit set through so user-defined modes can be modeled. Use ResourceMode::CONNECT_NORMAL / ResourceMode::CONNECT_USER_DEFINED for the standard modes.

Implementations§

Source§

impl ResourceMode

Source

pub const CAL_PAGE: ResourceMode

Calibration and page switching (CAL/PAG) — bit 0.

Source

pub const DAQ: ResourceMode

Data acquisition (DAQ) — bit 2.

Source

pub const STIM: ResourceMode

Data stimulation (STIM) — bit 3.

Source

pub const PGM: ResourceMode

Flash programming (PGM) — bit 4.

Source

pub const DBG: ResourceMode

Debugging (DBG, XCP ≥ 1.5) — bit 5.

Source

pub const CAL_PAGE_OR_DAQ: ResourceMode

Composite: calibration or DAQ access (CAL/PAG | DAQ) — the common “measure or calibrate” session.

Source

pub const CONNECT_NORMAL: ResourceMode

CONNECT mode 0x00 — normal mode.

Source

pub const CONNECT_USER_DEFINED: ResourceMode

CONNECT mode 0x01 — user-defined mode.

Source

pub const fn from_raw(bits: u8) -> ResourceMode

Build from a raw resource byte. Total: unknown/reserved bits are preserved (slaves may set vendor bits).

Source

pub const fn bits(self) -> u8

The raw resource byte.

Source

pub const fn is_empty(self) -> bool

true when no bit is set (e.g. the slave reports no protected resources).

Source

pub const fn contains(self, other: ResourceMode) -> bool

true when every bit in other is also set in self.

Source

pub const fn cal_page(self) -> bool

true when the CAL/PAG resource is present.

Source

pub const fn daq(self) -> bool

true when the DAQ resource is present.

Source

pub const fn stim(self) -> bool

true when the STIM resource is present.

Source

pub const fn pgm(self) -> bool

true when the PGM resource is present.

Trait Implementations§

Source§

impl BitAnd for ResourceMode

Source§

type Output = ResourceMode

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: ResourceMode) -> ResourceMode

Performs the & operation. Read more
Source§

impl BitOr for ResourceMode

Source§

type Output = ResourceMode

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: ResourceMode) -> ResourceMode

Performs the | operation. Read more
Source§

impl Clone for ResourceMode

Source§

fn clone(&self) -> ResourceMode

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 ResourceMode

Source§

impl Debug for ResourceMode

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for ResourceMode

Source§

fn default() -> ResourceMode

Returns the “default value” for a type. Read more
Source§

impl Display for ResourceMode

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for ResourceMode

Source§

impl Hash for ResourceMode

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Not for ResourceMode

Source§

type Output = ResourceMode

The resulting type after applying the ! operator.
Source§

fn not(self) -> ResourceMode

Performs the unary ! operation using logical or bitwise negation. Read more
Source§

impl PartialEq for ResourceMode

Source§

fn eq(&self, other: &ResourceMode) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ResourceMode

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.