Skip to main content

ublox_cellular/command/mobile_control/
mod.rs

1//! ### 5 - Mobile equipment control and status Commands
2//!
3
4pub mod responses;
5pub mod types;
6use atat::atat_derive::AtatCmd;
7use responses::{
8    DateTime, ExtendedErrorReport, IndicatorControl, ModuleFunctionality,
9    ReportMobileTerminationError,
10};
11use types::{AutomaticTimezone, Functionality, ResetMode, TerminationErrorMode};
12
13use super::NoResponse;
14
15/// 5.2 Module switch off +CPWROFF
16///
17/// Switches off the MT. During shut-down current settings are saved in module's
18/// non-volatile memory
19///
20/// **Notes:**
21/// - Using this command can result in the following command line being ignored.
22/// - See the corresponding System Integration Manual for the timing and the
23///   electrical details of the module power-off sequence via the +CPWROFF
24///   command.
25#[derive(Clone, AtatCmd)]
26#[at_cmd("+CPWROFF", NoResponse, attempts = 1, timeout_ms = 40000)]
27pub struct ModuleSwitchOff;
28
29/// 5.3 Set module functionality +CFUN
30///
31/// Selects the level of functionality <fun> in the MT.
32#[derive(Clone, AtatCmd)]
33#[at_cmd("+CFUN", NoResponse, attempts = 1, timeout_ms = 180000)]
34pub struct SetModuleFunctionality {
35    #[at_arg(position = 0)]
36    pub fun: Functionality,
37    #[at_arg(position = 1)]
38    pub rst: Option<ResetMode>,
39}
40
41/// 5.3 Set module functionality +CFUN
42///
43/// Selects the level of functionality <fun> in the MT.
44#[derive(Clone, AtatCmd)]
45#[at_cmd("+CFUN?", ModuleFunctionality, attempts = 1, timeout_ms = 8000)]
46pub struct GetModuleFunctionality;
47
48/// 5.4 Indicator control +CIND
49///
50/// Provides indication states related to network status, battery information
51/// and so on. The set command does not allow setting the values for those
52/// indications which are set according to module state (see <descr> parameter).
53/// The list of indications for set and read commands follows the indexes
54/// reported in the <descr> parameter, so that the first <ind> corresponds to
55/// "battchg" and so on
56#[derive(Clone, AtatCmd)]
57#[at_cmd("+CIND?", IndicatorControl)]
58pub struct GetIndicatorControl;
59
60/// 5.7 Clock +CCLK
61///
62/// Sets the real-time clock of the MT
63#[derive(Clone, AtatCmd)]
64#[at_cmd("+CCLK", NoResponse)]
65pub struct SetClock<'a> {
66    pub time: &'a str,
67}
68
69/// 5.7 Clock +CCLK
70///
71/// Reads the real-time clock of the MT
72///
73/// **Notes:**
74/// - If the parameter value is out of range, then the "+CME ERROR: operation
75///   not supported" or "+CME ERROR: 4" will be provided (depending on the +CMEE
76///   AT command setting).
77/// - "TZ": The Time Zone information is represented by two digits. The value is
78///   updated during the registration procedure when the automatic time zone
79///   update is enabled (using +CTZU command) and the network supports the time
80///   zone information.
81/// - The Time Zone information is expressed in steps of 15 minutes and it can
82///   assume a value in the range that goes from -96 to +96.
83#[derive(Clone, AtatCmd)]
84#[at_cmd("+CCLK?", DateTime)]
85pub struct GetClock;
86
87/// 5.15 Automatic time zone update +CTZU
88///
89/// Configures the automatic time zone update via NITZ.
90///
91/// **Notes:**
92/// - The Time Zone information is provided after the network registration (if
93///   the network supports the time zone information).
94#[derive(Clone, AtatCmd)]
95#[at_cmd("+CTZU", NoResponse)]
96pub struct SetAutomaticTimezoneUpdate {
97    #[at_arg(position = 0)]
98    pub on_off: AutomaticTimezone,
99}
100
101/// 5.19 Report mobile termination error +CMEE
102///
103/// Configures the formatting of the result code +CME ERROR: <err> as an
104/// indication of an error relating to the functionality of the MT. When
105/// enabled, MT related errors cause +CME ERROR: <err> final result code instead
106/// of the regular ERROR final result code. The error result code is returned
107/// normally when an error is related to syntax, invalid parameters or MT
108/// functionality
109#[derive(Clone, AtatCmd)]
110#[at_cmd("+CMEE", NoResponse)]
111pub struct SetReportMobileTerminationError {
112    #[at_arg(position = 0)]
113    pub n: TerminationErrorMode,
114}
115
116#[derive(Clone, AtatCmd)]
117#[at_cmd("+CMEE?", ReportMobileTerminationError)]
118pub struct GetReportMobileTerminationError;
119
120/// 5.20 Extended error report +CEER
121///
122/// Causes the MT to return one or more lines of the information text response
123/// which offer an extended report of the reason for:
124/// - the failure in the last unsuccessful call setup or in-call modification,
125/// - the last call release,
126/// - the last unsuccessful GPRS attach / EPS bearer establishment or
127///   unsuccessful PDP context activation,
128/// - the last GPRS / EPS bearer detach or PDP context deactivation.
129///
130/// **NOTES:**
131///
132/// - TOBY-L4 / TOBY-L2 / MPCI-L2 / LARA-R2 / TOBY-R2 / SARA-U2 / LISA-U2 /
133/// LISA-U1 / SARA-G3 / LEON-G1 The total number of characters in the
134/// information text response shall not exceed 2041 characters (including line
135/// terminators). The textual report is the failure cause according to 3GPP TS
136/// 24.008 [69].
137/// - SARA-G4 / SARA-G3 The command also provides an extended report about the
138/// reason for the last SM STATUS message sent to the network. When <type>="SM
139/// STATUS msg sent" is reported, it is suggested to reset the PS data
140/// connection.
141#[derive(Clone, AtatCmd)]
142#[at_cmd("+CEER", ExtendedErrorReport)]
143pub struct GetExtendedErrorReport;