Skip to main content

ezsp/frame/parameters/configuration/
version.rs

1//! The command allows the Host to specify the desired `EZSP` version
2//! and must be sent before any other command.
3//!
4//! The response provides information about the firmware running on the NCP.
5
6use core::fmt::Debug;
7
8use crate::ezsp::StackVersion;
9
10crate::frame::parameters::frame!(
11    0x0000,
12    { desired_protocol_version: u8 },
13    impl {
14        impl Command {
15            /// Creates command parameters.
16            #[must_use]
17            pub const fn new(desired_protocol_version: u8) -> Self {
18                Self {
19                    desired_protocol_version,
20                }
21            }
22        }
23    },
24    { protocol_version: u8, stack_type: u8, stack_version: u16 } => Configuration(configuration)::Version,
25    impl {
26        impl Response {
27            /// The EZSP version the NCP is using.
28            #[must_use]
29            pub const fn protocol_version(&self) -> u8 {
30                self.protocol_version
31            }
32
33            /// The type of stack running on the NCP (2).
34            #[must_use]
35            pub const fn stack_type(&self) -> u8 {
36                self.stack_type
37            }
38
39            /// The version number of the stack.
40            #[must_use]
41            pub const fn stack_version(&self) -> StackVersion {
42                StackVersion(self.stack_version)
43            }
44        }
45    }
46);