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