iso14229_1/response/
write_mem_by_addr.rs1use std::collections::HashSet;
5use lazy_static::lazy_static;
6use crate::{Configuration, error::Error, MemoryLocation, Placeholder, response::Code, ResponseData};
7
8lazy_static!(
9 pub static ref WRITE_MEM_BY_ADDR_NEGATIVES: HashSet<Code> = HashSet::from([
10 Code::IncorrectMessageLengthOrInvalidFormat,
11 Code::ConditionsNotCorrect,
12 Code::RequestOutOfRange,
13 Code::SecurityAccessDenied,
14 Code::AuthenticationRequired,
15 Code::GeneralProgrammingFailure,
16 ]);
17);
18
19pub struct WriteMemByAddr(pub MemoryLocation);
20
21impl ResponseData for WriteMemByAddr {
22 type SubFunc = Placeholder;
23 #[inline]
24 fn try_parse(data: &[u8], _: Option<Self::SubFunc>, cfg: &Configuration) -> Result<Self, Error> {
25 Ok(Self(MemoryLocation::from_slice(data, cfg)?))
26 }
27 #[inline]
28 fn to_vec(self, cfg: &Configuration) -> Vec<u8> {
29 self.0.to_vec(cfg)
30 }
31}