ssp/hold/
command.rs

1use crate::{
2    impl_command_display, impl_command_ops, impl_default, impl_message_from_buf, impl_message_ops,
3    len, CommandOps, MessageOps, MessageType,
4};
5
6/// Hold - Command (0x18)
7///
8/// Single byte command causes the validator to hold the current accepted note if the
9/// developer does not wish to accept or reject the note with the next command. This also
10/// resets the 5 second escrow timer. (Normally after 5 seconds a note is automatically
11/// rejected).
12#[repr(C)]
13#[derive(Clone, Copy, Debug, PartialEq)]
14pub struct HoldCommand {
15    buf: [u8; len::HOLD_COMMAND],
16}
17
18impl HoldCommand {
19    /// Creates a new [HoldCommand] message.
20    pub fn new() -> Self {
21        let mut msg = Self {
22            buf: [0u8; len::HOLD_COMMAND],
23        };
24
25        msg.init();
26        msg.set_command(MessageType::Hold);
27
28        msg
29    }
30}
31
32impl_default!(HoldCommand);
33impl_command_display!(HoldCommand);
34impl_message_from_buf!(HoldCommand);
35impl_message_ops!(HoldCommand);
36impl_command_ops!(HoldCommand);