Skip to main content

ublox_cellular/command/mobile_control/
responses.rs

1//! Responses for Mobile equipment control and status Commands
2use super::types::{PowerMode, ReportMobileTerminationErrorStatus, STKMode};
3use atat::atat_derive::AtatResp;
4
5/// 5.3 Set module functionality +CFUN
6/// Selects the level of functionality <fun> in the MT.
7#[derive(Clone, AtatResp)]
8pub struct ModuleFunctionality {
9    #[at_arg(position = 0)]
10    pub power_mode: PowerMode,
11    #[at_arg(position = 1)]
12    pub stk_mode: Option<STKMode>,
13}
14
15/// 5.4 Indicator control +CIND
16///
17/// Provides indication states related to network status, battery information and so on.
18/// The set command does not allow setting the values for those indications which are set according to module
19/// state (see <descr> parameter).
20/// The list of indications for set and read commands follows the indexes reported in the <descr> parameter, so
21/// that the first <ind> corresponds to "battchg" and so on
22#[derive(Clone, Debug, AtatResp)]
23pub struct IndicatorControl {
24    /// "battchg": battery charge level (0-5)
25    #[at_arg(position = 0)]
26    pub battchg: u8,
27    /// "signal": signal level. See mapping in the Notes below
28    #[at_arg(position = 1)]
29    pub signal: u8,
30    /// "service": network service availability
31    /// o 0: not registered to any network
32    /// o 1: registered to the network
33    /// o 65535: indication not available
34    #[at_arg(position = 2)]
35    pub service: u16,
36    /// • "sounder": sounder activity, indicating when the module is generating a sound
37    /// o 0: no sound
38    /// o 1: sound is generated
39    #[at_arg(position = 3)]
40    pub sounder: u8,
41    /// • "message": unread message available in <mem1> storage
42    /// o 0: no messages
43    /// o 1: unread message available
44    #[at_arg(position = 4)]
45    pub message: u8,
46    /// • "call": call in progress
47    /// o 0: no call in progress
48    /// o 1: call in progress
49    #[at_arg(position = 5)]
50    pub call: u8,
51    /// • "roam": registration on a roaming network
52    /// o 0: not in roaming or not registered
53    /// o 1: roaming
54    /// o 65535: indication not available
55    #[at_arg(position = 6)]
56    pub roam: u16,
57    /// • "smsfull": indication that an SMS has been rejected with the cause of SMS storage
58    /// full
59    /// o 0: SMS storage not full
60    /// o 1: SMS storage full
61    #[at_arg(position = 7)]
62    pub smsfull: u8,
63    /// • "gprs": PS indication status:
64    /// o 0: no PS available in the network
65    /// o 1: PS available in the network but not registered
66    /// o 2: registered to PS
67    /// o 65535: indication not available
68    #[at_arg(position = 8)]
69    pub gprs: u16,
70    /// • "callsetup": call set-up:
71    /// o 0: no call set-up
72    /// o 1: incoming call not accepted or rejected
73    /// o 2: outgoing call in dialling state
74    /// o 3: outgoing call in remote party alerting state
75    #[at_arg(position = 9)]
76    pub callsetup: u8,
77    /// • "callheld": call on hold:
78    /// o 0: no calls on hold
79    /// o 1: at least one call on hold
80    #[at_arg(position = 10)]
81    pub callheld: u8,
82    /// • "simind": SIM detection
83    /// o 0: no SIM detected
84    /// o 1: SIM detected
85    /// o 2: not available
86    #[at_arg(position = 11)]
87    pub simind: u8,
88}
89
90/// 5.7 Clock +CCLK
91///
92/// Reads the real-time clock of the MT
93#[derive(Clone, Debug, AtatResp)]
94pub struct DateTime {
95    pub time: heapless::String<20>,
96}
97
98/// 5.19 Report mobile termination error +CMEE
99///
100/// Configures the formatting of the result code +CME ERROR: <err> as an indication of an error relating to the
101/// functionality of the MT. When enabled, MT related errors cause +CME ERROR: <err> final result code instead
102/// of the regular ERROR final result code. The error result code is returned normally when an error is related to
103/// syntax, invalid parameters or MT functionality
104#[derive(Clone, AtatResp)]
105pub struct ReportMobileTerminationError {
106    #[at_arg(position = 0)]
107    pub status: ReportMobileTerminationErrorStatus,
108}
109
110/// 5.20 Extended error report +CEER
111///
112/// Causes the MT to return one or more lines of the information text response
113/// which offer an extended report of the reason for:
114/// - the failure in the last unsuccessful call setup or in-call modification,
115/// - the last call release,
116/// - the last unsuccessful GPRS attach / EPS bearer establishment or
117///   unsuccessful PDP context activation,
118/// - the last GPRS / EPS bearer detach or PDP context deactivation.
119///
120/// **NOTES:**
121///
122/// - TOBY-L4 / TOBY-L2 / MPCI-L2 / LARA-R2 / TOBY-R2 / SARA-U2 / LISA-U2 /
123/// LISA-U1 / SARA-G3 / LEON-G1 The total number of characters in the
124/// information text response shall not exceed 2041 characters (including line
125/// terminators). The textual report is the failure cause according to 3GPP TS
126/// 24.008 [69].
127/// - SARA-G4 / SARA-G3 The command also provides an extended report about the
128/// reason for the last SM STATUS message sent to the network. When <type>="SM
129/// STATUS msg sent" is reported, it is suggested to reset the PS data
130/// connection.
131#[derive(Clone, AtatResp)]
132pub struct ExtendedErrorReport {
133    #[at_arg(position = 0)]
134    pub r#type: heapless::String<32>,
135    #[at_arg(position = 1)]
136    pub cause: u32,
137    #[at_arg(position = 2)]
138    pub description: heapless::String<64>,
139}