rusmpp_core/values/message_state.rs
1use rusmpp_macros::Rusmpp;
2
3/// This field indicates the current status of the broadcast message.
4
5#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default, Rusmpp)]
6#[repr(u8)]
7#[cfg_attr(feature = "arbitrary", derive(::arbitrary::Arbitrary))]
8#[cfg_attr(feature = "serde", derive(::serde::Serialize))]
9#[cfg_attr(feature = "serde-deserialize-unchecked", derive(::serde::Deserialize))]
10pub enum MessageState {
11 /// The message is scheduled. Delivery has not
12 /// yet been initiated.
13 ///
14 /// A message submitted with a scheduled
15 /// delivery time may return this state when
16 /// queried. This value was added for V5.0 of
17 /// `SMPP` and V3.4 and earlier MCs are likely to
18 /// return ENROUTE for scheduled messages.
19 #[default]
20 Scheduled = 0,
21 /// The message is in enroute state.
22 ///
23 /// This is a general state used to describe a
24 /// message as being active within the MC. The
25 /// message may be in retry or dispatched to a
26 /// mobile network for delivery to the mobile.
27 Enroute = 1,
28 /// Message is delivered to destination
29 ///
30 /// The message has been delivered to the
31 /// destination. No further deliveries will occur.
32 Delivered = 2,
33 /// Message validity period has expired.
34 ///
35 /// The message has failed to be delivered within
36 /// its validity period and/or retry period. No
37 /// further delivery attempts will be made.
38 Expired = 3,
39 /// Message has been deleted.
40 ///
41 /// The message has been cancelled or deleted
42 /// from the MC. No further delivery attempts will
43 /// take place.
44 Deleted = 4,
45 /// Message is undeliverable.
46 ///
47 /// The message has encountered a delivery error
48 /// and is deemed permanently undeliverable. No
49 /// further delivery attempts will be made.
50 ///
51 /// Certain network or MC internal errors result in
52 /// the permanent non-delivery of a message.
53 /// Examples of such errors would be an unknown
54 /// subscriber or network error that indicated that
55 /// the given destination mobile was denied SMS
56 /// service or could not support SMS.
57 Undeliverable = 5,
58 /// Message is in accepted state (i.e. has been
59 /// manually read on behalf of the subscriber by
60 /// customer service)
61 ///
62 /// This state is used to depict intervention on the
63 /// MC side. Sometimes a malformed message
64 /// can cause a mobile to power-off or experience
65 /// problems. The result is that all messages to
66 /// that mobile may remain queued until the
67 /// problem message is removed or expires.
68 ///
69 /// In certain circumstances, a mobile network
70 /// support service or administrator may manually
71 /// accept a message to prevent further deliveries
72 /// and allow other queued messages to be
73 /// delivered.
74 Accepted = 6,
75 /// Message is in invalid state.
76 ///
77 /// The message state is unknown. This may be
78 /// due to some internal MC problem which may
79 /// be intermediate or a permanent.
80 /// This state should never be returned. A MC
81 /// experiencing difficulties that prevents it from
82 /// returning a message state, would use this
83 /// state.
84 Unknown = 7,
85 /// Message is in a rejected state.
86 ///
87 /// The message has been rejected by a delivery
88 /// interface. The reasons for this rejection are
89 /// vendor and network specific. No further
90 /// delivery attempts will be made
91 Rejected = 8,
92 /// The message was accepted but not.
93 ///
94 /// transmitted or broadcast on the network.
95 /// A skipped message is one that was
96 /// deliberately ignored according to vendor or
97 /// network-specific rules. No further delivery
98 /// attempts will be made.
99 Skipped = 9,
100 Other(u8),
101}
102
103#[cfg(test)]
104mod tests {
105 use super::*;
106
107 #[test]
108 fn encode_decode() {
109 #[cfg(feature = "alloc")]
110 crate::tests::owned::encode_decode_test_instances::<MessageState>();
111 crate::tests::borrowed::encode_decode_test_instances::<MessageState>();
112 }
113}