Skip to main content

GroupTelegram

Struct GroupTelegram 

Source
pub struct GroupTelegram { /* private fields */ }
Expand description

A single group service, addressed and carrying its data: the device it came from, the group it is addressed to, the service, and the payload in the form it travels in.

Every route to a value of this type ends at Self::new, decoding included, so a telegram that exists is one whose service and payload agree: a read carrying data, or a write carrying none, is refused rather than held.

Implementations§

Source§

impl GroupTelegram

Source

pub fn new( source: IndividualAddress, destination: GroupAddress, apci: Apci, payload: GroupPayload, ) -> Result<Self>

Builds a validated group telegram.

Payload rules:

  • GroupValueRead carries GroupPayload::None and nothing else.
  • GroupValueWrite / GroupValueResponse must carry data: either the optimized form or a non-empty octet sequence.
  • An optimized value above six bits is rejected: it does not fit the service octet.
  • Octet sequences longer than GroupPayload::MAX_OCTETS are rejected.
Source

pub const fn source(&self) -> IndividualAddress

The individual address in the frame’s source field: for a decoded telegram, the device that sent it; for one being built, the address the sender stamps on its own traffic.

Source

pub const fn destination(&self) -> GroupAddress

The group this telegram is addressed to.

Source

pub const fn apci(&self) -> Apci

The group service this telegram carries.

Source

pub const fn payload(&self) -> &GroupPayload

The payload in the transmitted form it was built or decoded with. The form is reported as held, never re-derived from the values.

Source

pub fn npdu_len(&self) -> u8

The NPDU length this telegram states: the APDU octet count less the one octet the length field does not count.

The constructor bounds an octet payload at GroupPayload::MAX_OCTETS, so the result always fits; the fallback states the corrected maximum length value rather than assuming the bound - never 0xFF, the standard’s reserved escape.

Trait Implementations§

Source§

impl Clone for GroupTelegram

Source§

fn clone(&self) -> GroupTelegram

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 Debug for GroupTelegram

Source§

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

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

impl Eq for GroupTelegram

Source§

impl PartialEq for GroupTelegram

Source§

fn eq(&self, other: &GroupTelegram) -> 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 GroupTelegram

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, 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.