[−][src]Struct async_resol_vbus::Specification
The Specification
type contains information about known devices and packets.
Examples
use resol_vbus::{SpecificationFile, Specification, Language}; let spec = Specification::from_file(SpecificationFile::new_default(), Language::De); let device_spec = spec.get_device_spec(0x00, 0x7E11, 0x0010); assert_eq!("00_7E11", device_spec.device_id); assert_eq!(0, device_spec.channel); assert_eq!(0x7E11, device_spec.self_address); assert_eq!(None, device_spec.peer_address); assert_eq!("DeltaSol MX [Regler]", device_spec.name);
Methods
impl Specification
[src]
pub fn from_file(file: SpecificationFile, language: Language) -> Specification
[src]
Construct a Specification
from a SpecificationFile
and a Language
.
Examples
use resol_vbus::{SpecificationFile, Specification, Language}; let spec = Specification::from_file(SpecificationFile::new_default(), Language::De); // work with the spec...
pub fn get_device_spec(
&self,
channel: u8,
self_address: u16,
peer_address: u16
) -> Rc<DeviceSpec>
[src]
&self,
channel: u8,
self_address: u16,
peer_address: u16
) -> Rc<DeviceSpec>
Get a DeviceSpec
.
Examples
use resol_vbus::{SpecificationFile, Specification, Language}; let spec = Specification::from_file(SpecificationFile::new_default(), Language::De); let device_spec = spec.get_device_spec(0x00, 0x7E11, 0x0010); assert_eq!("00_7E11", device_spec.device_id); assert_eq!(0, device_spec.channel); assert_eq!(0x7E11, device_spec.self_address); assert_eq!(None, device_spec.peer_address); assert_eq!("DeltaSol MX [Regler]", device_spec.name);
pub fn get_packet_spec(
&self,
channel: u8,
destination_address: u16,
source_address: u16,
command: u16
) -> Rc<PacketSpec>
[src]
&self,
channel: u8,
destination_address: u16,
source_address: u16,
command: u16
) -> Rc<PacketSpec>
Get a PacketSpec
.
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);
pub fn get_packet_spec_by_id(&self, packet_id: PacketId) -> Rc<PacketSpec>
[src]
Get a PacketSpec
.
Examples
use resol_vbus::{SpecificationFile, Specification, Language, PacketId}; let spec = Specification::from_file(SpecificationFile::new_default(), Language::De); let packet_spec = spec.get_packet_spec_by_id(PacketId(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);
pub fn fields_in_data_set<'a, T>(
&'a self,
data_set: &'a T
) -> DataSetPacketFieldIterator<'a, T> where
T: 'a + AsRef<[Data]>,
[src]
&'a self,
data_set: &'a T
) -> DataSetPacketFieldIterator<'a, T> where
T: 'a + AsRef<[Data]>,
Returns an iterator that iterates over all known packet fields in the data set.
Examples
use resol_vbus::{Specification, DataSet}; fn print_fields(spec: &Specification, data_set: &DataSet) { let mut last_data_index = None; for field in spec.fields_in_data_set(data_set) { let current_data_index = Some(field.data_index()); if last_data_index != current_data_index { last_data_index = current_data_index; println!("- {}: {}", field.packet_spec().packet_id, field.packet_spec().name); } println!(" - {}: {}", field.field_spec().field_id, field.field_spec().name); } }
pub fn fmt_timestamp<Tz>(&self, timestamp: &DateTime<Tz>) -> RawValueFormatter where
Tz: TimeZone,
[src]
Tz: TimeZone,
Format a timestamp.
Examples
use resol_vbus::{SpecificationFile, Specification, Language}; use resol_vbus::utils::utc_timestamp; let fmt_localized_timestamp = |language| { let spec = Specification::from_file(SpecificationFile::new_default(), language); format!("{}", spec.fmt_timestamp(&utc_timestamp(1485688933))) }; assert_eq!("29/01/2017 11:22:13", fmt_localized_timestamp(Language::En)); assert_eq!("29.01.2017 11:22:13", fmt_localized_timestamp(Language::De)); assert_eq!("29/01/2017 11:22:13", fmt_localized_timestamp(Language::Fr));
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Specification
impl !Send for Specification
impl !Sync for Specification
impl Unpin for Specification
impl !UnwindSafe for Specification
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,