[][src]Struct async_resol_vbus::specification::PacketFieldSpec

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

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.

Methods

impl PacketFieldSpec[src]

pub fn raw_value_i64(&self, buf: &[u8]) -> Option<i64>[src]

Construct an i64 raw value from a slice of bytes.

pub fn raw_value_f64(&self, buf: &[u8]) -> Option<f64>[src]

Construct a f64 raw value from a slice of bytes.

pub fn fmt_raw_value(
    &self,
    raw_value: Option<i64>,
    append_unit: bool
) -> PacketFieldFormatter
[src]

Format a raw value into its textual representation.

Trait Implementations

impl Debug for PacketFieldSpec[src]

impl PartialEq<PacketFieldSpec> for PacketFieldSpec[src]

impl StructuralPartialEq for PacketFieldSpec[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.