Skip to main content

osdp/reply/
busy.rs

1//! `osdp_BUSY` (`0x79`) — PD is busy. Empty body. SQN must always be `0`.
2//!
3//! # Spec: §7.18
4
5use crate::error::Error;
6use alloc::vec::Vec;
7
8/// `osdp_BUSY` body.
9#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
10pub struct Busy;
11
12impl Busy {
13    /// Encode.
14    pub fn encode(&self) -> Result<Vec<u8>, Error> {
15        Ok(Vec::new())
16    }
17
18    /// Decode.
19    pub fn decode(data: &[u8]) -> Result<Self, Error> {
20        if !data.is_empty() {
21            return Err(Error::MalformedPayload {
22                code: 0x79,
23                reason: "BUSY has no payload",
24            });
25        }
26        Ok(Self)
27    }
28}