[−][src]Crate async_resol_vbus
async-resol-vbus.rs
A Rust library for processing RESOL VBus data asynchronously.
Features
- Allows discovery of VBus-over-TCP devices in a local network
- Connect to or provide VBus-over-TCP services
Planned, but not yet implemented features
- none (yet)
Examples
use std::fs::File; use async_std::{ net::{SocketAddr, TcpStream}, prelude::*, }; use resol_vbus::{DataSet, RecordingWriter}; use async_resol_vbus::{Result, LiveDataStream, TcpClientHandshake}; fn main() -> Result<()> { async_std::task::block_on(async { // Create an recording file and hand it to a `RecordingWriter` let file = File::create("test.vbus")?; let mut rw = RecordingWriter::new(file); // Parse the address of the DL2 to connect to let addr = "192.168.13.45:7053".parse::<SocketAddr>()?; let stream = TcpStream::connect(addr).await?; let mut hs = TcpClientHandshake::start(stream).await?; hs.send_pass_command("vbus").await?; let stream = hs.send_data_command().await?; let (reader, writer) = (&stream, &stream); let mut stream = LiveDataStream::new(reader, writer, 0, 0x0020); while let Some(data) = stream.receive_any_data(60000).await? { println!("{}", data.id_string()); // Add `Data` value into `DataSet` to be stored let mut data_set = DataSet::new(); data_set.timestamp = data.as_ref().timestamp; data_set.add_data(data); // Write the `DataSet` into the `RecordingWriter` for permanent storage rw.write_data_set(&data_set) .expect("Unable to write data set"); } Ok(()) }) }
Modules
chrono | Chrono: Date and Time for Rust |
live_data_decoder | Functions in this module can be used to decode byte slices of data conforming to the
VBus protocol specification into the respective |
live_data_encoder | Functions in the module can be used to convert a |
recording_decoder | Functions in this module allow to decode a byte stream conforming to the VBus Recording File Format. |
recording_encoder | Functions in the module can be used to convert a |
specification | This module provides the |
specification_file | A module that parses the contents of a VBus Specification File Version 1 (VSF1). |
utils | A module containing utitlities functions for processing VBus data. |
Structs
BlobBuffer | A size-adating buffer to store bytes in. The buffer grows when data is stored into it. The contents can then be consumed which results in the buffer dropping the consumed data before new data are appended. |
BlobReader | A buffering reader that allows to borrow the internal buffer. |
DataSet | A |
Datagram | The |
DeviceDiscovery | Allows discovery of VBus-over-TCP devices in a local network. |
DeviceInformation | A struct containing information about a VBus-over-TCP device. |
Error | A common error type. |
FileListReader | Chains multiple files together in a single |
Header | All VBus data types consist of a |
LiveDataBuffer | A size-adapting buffer that supports decoding VBus live data. See
|
LiveDataReader | Allows reading |
LiveDataRecordingReader | A |
LiveDataRecordingWriter | A |
LiveDataStream | A |
LiveDataWriter | Allows writing the live represenation of |
Packet | The |
PacketFieldId | A tuple of identification information about a field in a |
PacketId | A tuple of identification information about a |
RecordingReader | Allows reading |
RecordingWriter | Allows writing the recorded representation of |
Specification | The |
SpecificationFile | Contains the information from a VSF1 file. |
TcpClientHandshake | Handles the client-side of the VBus-over-TCP handshake. |
TcpServerHandshake | Handles the server-side of the VBus-over-TCP handshake. |
Telegram | The |
Enums
Data |
|
Language | Languages supported by VSF1 specification. |
StreamBlobLength | Provides information whether a slice of bytes contains a valid blob of data. |
Traits
IdHash | A trait to generate an identification hash for any of the VBus data types. |
ToPacketFieldId | A trait to get a |
ToPacketId | A trait to get a |
Functions
id_hash | Calculate the identification hash for a given VBus data value. |
Type Definitions
Result | A common result type. |
Result | A common result type. |