[][src]Struct async_resol_vbus::specification::PacketSpec

pub struct PacketSpec {
    pub packet_id: String,
    pub channel: u8,
    pub destination_address: u16,
    pub source_address: u16,
    pub command: u16,
    pub destination_device: Rc<DeviceSpec>,
    pub source_device: Rc<DeviceSpec>,
    pub name: String,
    pub fields: Vec<PacketFieldSpec>,
}

Contains information about a VBus packet and its fields.

Examples

use resol_vbus::{SpecificationFile, Specification, Language};

let spec = Specification::from_file(SpecificationFile::new_default(), Language::De);

let packet_spec = spec.get_packet_spec(0x00, 0x0010, 0x7E11, 0x0100);
assert_eq!("00_0010_7E11_10_0100", packet_spec.packet_id);
assert_eq!(0, packet_spec.channel);
assert_eq!(0x0010, packet_spec.destination_address);
assert_eq!(0x7E11, packet_spec.source_address);
assert_eq!(0x0100, packet_spec.command);
assert_eq!("DFA", packet_spec.destination_device.name);
assert_eq!("DeltaSol MX [Regler]", packet_spec.source_device.name);
assert_eq!("DeltaSol MX [Regler]", packet_spec.name);

Fields

packet_id: String

A packet identifier.

channel: u8

The VBus channel to packet was sent to.

destination_address: u16

The destination VBus address the packet was sent to.

source_address: u16

The source VBus address to packet was send from.

command: u16

The VBus command of the packet.

destination_device: Rc<DeviceSpec>

The DeviceSpec containing information about the destination VBus device.

source_device: Rc<DeviceSpec>

The DeviceSpec containing information about the source VBus device.

name: String

The name of the packet, containing channel, source and optionally destination names.

fields: Vec<PacketFieldSpec>

The fields contained in the frame payload of the VBus packet.

Methods

impl PacketSpec[src]

pub fn get_field_spec_position(&self, id: &str) -> Option<usize>[src]

Get the position of a PacketFieldSpec by its field ID.

pub fn get_field_spec_by_position(&self, pos: usize) -> &PacketFieldSpec[src]

Get a PacketFieldSpec by its position.

pub fn get_field_spec(&self, id: &str) -> Option<&PacketFieldSpec>[src]

Get a PacketFieldSpec by its field ID.

Trait Implementations

impl Debug for PacketSpec[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.