pub struct IoData {
pub pins: HashMap<u8, Pin>,
pub i2c_data: Vec<I2CReply>,
pub digital_reported_pins: Vec<u8>,
pub analog_reported_channels: Vec<u8>,
pub protocol_version: String,
pub firmware_name: String,
pub firmware_version: String,
pub connected: bool,
}
Expand description
Represents the internal data that a IoProtocol
handles.
This struct is hidden behind an Arc<RwLock<IoData>>
to allow safe concurrent access
and modification through the IoData
type. It encapsulates data relevant
to the protocol, such as pins and I2C communication data.
Fields§
§pins: HashMap<u8, Pin>
All Pin
instances, representing the hardware’s pins.
i2c_data: Vec<I2CReply>
A vector of I2CReply
instances, representing I2C communication data.
digital_reported_pins: Vec<u8>
List pins with digital reporting activated.
analog_reported_channels: Vec<u8>
List pins with analog reporting activated.
protocol_version: String
A string indicating the version of the protocol.
firmware_name: String
A string representing the name of the firmware.
firmware_version: String
A string representing the version of the firmware.
connected: bool
A boolean indicating whether the IoProtocol is connected.
Implementations§
Source§impl IoData
impl IoData
Sourcepub fn get_pin<T: Into<PinIdOrName>>(&self, pin: T) -> Result<&Pin, Error>
pub fn get_pin<T: Into<PinIdOrName>>(&self, pin: T) -> Result<&Pin, Error>
Returns a reference to a pin by its id or name.
§Errors
UnknownPin
- AnError
returned if the pin index is out of bounds.
Sourcepub fn get_pin_mut<T: Into<PinIdOrName>>(
&mut self,
pin: T,
) -> Result<&mut Pin, Error>
pub fn get_pin_mut<T: Into<PinIdOrName>>( &mut self, pin: T, ) -> Result<&mut Pin, Error>
Returns a mutable reference to a pin by its id or name.
§Errors
UnknownPin
- AnError
returned if the pin index is out of bounds.