rusmpp_core/values/unsuccess_sme/
owned.rs1use rusmpp_macros::Rusmpp;
2
3use crate::{
4 CommandStatus,
5 types::owned::COctetString,
6 values::{npi::Npi, ton::Ton},
7};
8
9#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Rusmpp)]
10#[rusmpp(decode = owned)]
11#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
12#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
13#[cfg_attr(feature = "serde-deserialize-unchecked", derive(::serde::Deserialize))]
14pub struct UnsuccessSme {
15 pub dest_addr_ton: Ton,
17 pub dest_addr_npi: Npi,
19 pub destination_addr: COctetString<1, 21>,
21 pub error_status_code: CommandStatus,
23}
24
25impl Default for UnsuccessSme {
26 fn default() -> Self {
27 Self {
28 dest_addr_ton: Ton::default(),
29 dest_addr_npi: Npi::default(),
30 destination_addr: COctetString::default(),
31 error_status_code: CommandStatus::EsmeRunknownerr,
32 }
33 }
34}
35
36impl UnsuccessSme {
37 pub fn new(
38 dest_addr_ton: Ton,
39 dest_addr_npi: Npi,
40 destination_addr: COctetString<1, 21>,
41 error_status_code: CommandStatus,
42 ) -> Self {
43 Self {
44 dest_addr_ton,
45 dest_addr_npi,
46 destination_addr,
47 error_status_code,
48 }
49 }
50}
51
52#[cfg(test)]
53mod tests {
54 use super::*;
55
56 #[test]
57 fn encode_decode() {
58 crate::tests::owned::encode_decode_test_instances::<UnsuccessSme>();
59 }
60}