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>,
}
Expand description
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.
Implementations§
Source§impl PacketSpec
impl PacketSpec
Sourcepub fn get_field_spec_position(&self, id: &str) -> Option<usize>
pub fn get_field_spec_position(&self, id: &str) -> Option<usize>
Get the position of a PacketFieldSpec
by its field ID.
Sourcepub fn get_field_spec_by_position(&self, pos: usize) -> &PacketFieldSpec
pub fn get_field_spec_by_position(&self, pos: usize) -> &PacketFieldSpec
Get a PacketFieldSpec
by its position.
Sourcepub fn get_field_spec(&self, id: &str) -> Option<&PacketFieldSpec>
pub fn get_field_spec(&self, id: &str) -> Option<&PacketFieldSpec>
Get a PacketFieldSpec
by its field ID.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PacketSpec
impl RefUnwindSafe for PacketSpec
impl !Send for PacketSpec
impl !Sync for PacketSpec
impl Unpin for PacketSpec
impl UnwindSafe for PacketSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more