use std::sync::{Arc, Mutex};
use psdk_father::{
args::{ArgContext, PsdkArgBase, PsdkEasyArg},
command::{CommandClause, PsdkBinaryCommand},
errors::PsdkFatherResult,
};
#[derive(Clone, Debug)]
pub struct CSN {
ctx: Arc<Mutex<ArgContext>>,
}
impl Default for CSN {
fn default() -> Self {
Self::new()
}
}
impl CSN {
pub fn new() -> Self {
Self {
ctx: Default::default(),
}
}
}
impl PsdkEasyArg<Vec<u8>> for CSN {
fn context(&self) -> Arc<Mutex<ArgContext>> {
self.ctx.clone()
}
}
impl PsdkArgBase<Vec<u8>> for CSN {
fn header(&self) -> Vec<u8> {
vec![0x10, 0xff, 0xef, 0xf2]
}
fn clause(&self) -> PsdkFatherResult<CommandClause> {
let pbc = PsdkBinaryCommand::with_header(&self.header());
Ok(pbc.clause())
}
}
psdk_father::impl_psdk_arg_to_easy_arg!(Vec<u8>, CSN, false);