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