pub struct Cusd {
pub status: CusdStatus,
pub raw: Option<String>,
pub dcs: Option<u8>,
pub invalid_dcs: Option<String>,
}Expand description
One +CUSD: <m>[,<str>[,<dcs>]] line.
Fields§
§status: CusdStatus§raw: Option<String><str> as sent (quotes removed, \" and \\ unescaped), not decoded; see
Cusd::text, Cusd::text_as and Cusd::text_packed_hex.
dcs: Option<u8><dcs> when it is a number 0–255.
invalid_dcs: Option<String>A <dcs> that is present but not a number 0–255 (e.g. 300), as sent. dcs is
then None and the text is read with the default DCS 0.
Implementations§
Source§impl Cusd
impl Cusd
Sourcepub fn text(&self) -> Option<String>
pub fn text(&self) -> Option<String>
Decoded text with +CSCS="GSM" or "IRA" (the default): same as
text_as(Cscs::Gsm).
Sourcepub fn text_as(&self, cscs: Cscs) -> Option<String>
pub fn text_as(&self, cscs: Cscs) -> Option<String>
Decoded text per 27.007 §7.15 with the given TE character set.
- 8-bit / UCS2
<dcs>:<str>is the octets in hex whatever+CSCSis; they are decoded withdecode. A<str>that is not hex is returned as sent. - GSM 7-bit
<dcs>(or none: 27.007 default 0):<str>is incscs.Nonewhen it is not valid hex forCscs::Ucs2/Cscs::Hex.
None without <str> and for compressed data (23.042, not supported). Firmware
that sends packed septets in hex under a GSM 7-bit DCS needs
Cusd::text_packed_hex.
Sourcepub fn text_packed_hex(&self) -> Option<String>
pub fn text_packed_hex(&self) -> Option<String>
Not standard: some firmware (Huawei E160 and others, seen in gammu’s dumps) sends
the network’s packed 7-bit USSD octets in hex under a GSM 7-bit <dcs> instead of
converting them to the TE character set. Decode that ("AA58ACA6AA8D1A" →
"*115*5#"). None when <str> is not hex; with an 8-bit / UCS2 <dcs> this is
Cusd::text.