use core::fmt::Debug;
use le_stream::{FromLeStream, ToLeStream};
use crate::ezsp::StackVersion;
use crate::frame::Parameter;
use crate::frame::responds_with::RespondsWith;
const ID: u16 = 0x0000;
#[derive(Clone, Debug, Eq, PartialEq, ToLeStream)]
pub(crate) struct Command {
desired_protocol_version: u8,
}
impl Command {
#[must_use]
pub const fn new(desired_protocol_version: u8) -> Self {
Self {
desired_protocol_version,
}
}
}
impl Parameter for Command {
const ID: u16 = ID;
}
impl RespondsWith for Command {
type Response = Response;
}
#[derive(Clone, Debug, Eq, PartialEq, FromLeStream)]
pub struct Response {
protocol_version: u8,
stack_type: u8,
stack_version: u16,
}
impl Response {
#[must_use]
pub const fn protocol_version(&self) -> u8 {
self.protocol_version
}
#[must_use]
pub const fn stack_type(&self) -> u8 {
self.stack_type
}
#[must_use]
pub const fn stack_version(&self) -> StackVersion {
StackVersion(self.stack_version)
}
}
impl Parameter for Response {
const ID: u16 = ID;
}