Skip to main content

osdp/reply/
rstat.rs

1//! `osdp_RSTATR` (`0x4B`) — reader (tamper) status report.
2//!
3//! # Spec: §7.9
4//!
5//! One byte per reader (`0` = normal, `1` = tamper, `2` = disconnected).
6
7use crate::error::Error;
8use alloc::vec::Vec;
9
10/// `osdp_RSTATR` body.
11#[derive(Debug, Clone, PartialEq, Eq)]
12pub struct RStatR {
13    /// Status of each reader.
14    pub readers: Vec<u8>,
15}
16
17impl RStatR {
18    /// Encode.
19    pub fn encode(&self) -> Result<Vec<u8>, Error> {
20        Ok(self.readers.clone())
21    }
22
23    /// Decode.
24    pub fn decode(data: &[u8]) -> Result<Self, Error> {
25        Ok(Self {
26            readers: data.to_vec(),
27        })
28    }
29}