pub struct PacketFieldSpec {
pub field_id: String,
pub packet_field_id: String,
pub name: String,
pub unit_id: UnitId,
pub unit_family: UnitFamily,
pub unit_code: String,
pub unit_text: String,
pub precision: i32,
pub typ: Type,
pub parts: Vec<PacketTemplateFieldPart>,
pub language: Language,
}
Expand description
Contains information about a VBus packet field.
§Examples
use resol_vbus::{SpecificationFile, Specification, Language};
use resol_vbus::specification_file::{UnitFamily, Type};
let spec = Specification::from_file(SpecificationFile::new_default(), Language::De);
let packet_spec = spec.get_packet_spec(0x00, 0x0010, 0x7E11, 0x0100);
let packet_field_spec = &packet_spec.fields [0];
assert_eq!("000_2_0", packet_field_spec.field_id);
assert_eq!("00_0010_7E11_10_0100_000_2_0", packet_field_spec.packet_field_id);
assert_eq!("Temperatur Sensor 1", packet_field_spec.name);
assert_eq!(62, packet_field_spec.unit_id.0);
assert_eq!(UnitFamily::Temperature, packet_field_spec.unit_family);
assert_eq!("DegreesCelsius", packet_field_spec.unit_code);
assert_eq!(" °C", packet_field_spec.unit_text);
assert_eq!(1, packet_field_spec.precision);
assert_eq!(Type::Number, packet_field_spec.typ);
Fields§
§field_id: String
A field identifier.
packet_field_id: String
A packet-field identifier.
name: String
The name of the field.
unit_id: UnitId
The UnitId
of the field.
unit_family: UnitFamily
The UnitFamily
of the field.
unit_code: String
The unit code of the field.
unit_text: String
The unit text of the field.
precision: i32
The precision of the field.
typ: Type
The Type
of the field.
parts: Vec<PacketTemplateFieldPart>
The parts the field consists of.
language: Language
The language used for the specification.
Implementations§
Source§impl PacketFieldSpec
impl PacketFieldSpec
Sourcepub fn raw_value_i64(&self, buf: &[u8]) -> Option<i64>
pub fn raw_value_i64(&self, buf: &[u8]) -> Option<i64>
Construct an i64
raw value from a slice of bytes.
Sourcepub fn raw_value_f64(&self, buf: &[u8]) -> Option<f64>
pub fn raw_value_f64(&self, buf: &[u8]) -> Option<f64>
Construct a f64
raw value from a slice of bytes.
Sourcepub fn fmt_raw_value(
&self,
raw_value: Option<i64>,
append_unit: bool,
) -> PacketFieldFormatter<'_>
pub fn fmt_raw_value( &self, raw_value: Option<i64>, append_unit: bool, ) -> PacketFieldFormatter<'_>
Format a raw value into its textual representation.
Trait Implementations§
Source§impl Debug for PacketFieldSpec
impl Debug for PacketFieldSpec
Source§impl PartialEq for PacketFieldSpec
impl PartialEq for PacketFieldSpec
impl StructuralPartialEq for PacketFieldSpec
Auto Trait Implementations§
impl Freeze for PacketFieldSpec
impl RefUnwindSafe for PacketFieldSpec
impl Send for PacketFieldSpec
impl Sync for PacketFieldSpec
impl Unpin for PacketFieldSpec
impl UnwindSafe for PacketFieldSpec
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