rusmpp_core/values/
data_coding.rs

1use rusmpp_macros::Rusmpp;
2
3/// Defines the encoding scheme of the short
4/// message user data.
5#[repr(u8)]
6#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Default, Rusmpp)]
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 DataCoding {
11    /// GSM 7-bit default alphabet
12    #[default]
13    McSpecific = 0b00000000,
14    /// IA5 (CCITT T.50)/ASCII (ANSI X3.4).
15    Ia5 = 0b00000001,
16    /// Octet unspecified (8-bit binary).
17    OctetUnspecified = 0b00000010,
18    /// Latin 1 (ISO-8859-1).
19    Latin1 = 0b00000011,
20    /// Octet unspecified (8-bit binary) 2.
21    OctetUnspecified2 = 0b00000100,
22    /// JIS (X 0208-1990).
23    Jis = 0b00000101,
24    /// Cyrillic (ISO-8859-5).
25    Cyrillic = 0b00000110,
26    /// Latin/Hebrew (ISO-8859-8).
27    LatinHebrew = 0b00000111,
28    /// UCS2 (ISO/IEC-10646).
29    Ucs2 = 0b00001000,
30    /// Pictogram Encoding.
31    PictogramEncoding = 0b00001001,
32    /// ISO-2022-JP (Music Codes).
33    Iso2022JpMusicCodes = 0b00001010,
34    /// Extended Kanji JIS (X 0212-1990).
35    ExtendedKanjiJis = 0b00001101,
36    /// KS C 5601.
37    Ksc5601 = 0b00001110,
38    /// GSM MWI control - see [GSM 03.38].
39    GsmMwiControl = 0b11000000,
40    /// GSM MWI control 2- see [GSM 03.38].
41    GsmMwiControl2 = 0b11010000,
42    /// GSM message class control - see [GSM 03.38].
43    GsmMessageClassControl = 0b11100000,
44    Other(u8),
45}
46
47#[cfg(test)]
48mod tests {
49    use super::*;
50
51    #[test]
52    fn encode_decode() {
53        #[cfg(feature = "alloc")]
54        crate::tests::owned::encode_decode_test_instances::<DataCoding>();
55        crate::tests::borrowed::encode_decode_test_instances::<DataCoding>();
56    }
57}