Skip to main content

ublox_cellular/command/control/
types.rs

1//! Argument and parameter types used by V24 control and V25ter Commands and Responses
2
3use atat::atat_derive::AtatEnum;
4
5/// Indicates the behavior of circuit 109
6#[derive(Clone, PartialEq, Eq, AtatEnum)]
7pub enum Circuit109Behaviour {
8    /// 0: DCE always presents ON condition on circuit 109
9    AlwaysPresent = 0,
10    /// 1 (default value and factory-programmed value): circuit 109 changes in
11    /// accordance with the Carrier detect status; ON if the Carrier is
12    /// detected, OFF otherwise
13    ChangesWithCarrier = 1,
14}
15
16#[derive(Clone, PartialEq, Eq, AtatEnum)]
17pub enum Echo {
18    /// 0: Echo off
19    Off = 0,
20    /// 1 (default value and factory-programmed value): Echo on
21    On = 1,
22}
23
24#[derive(Clone, PartialEq, Eq, AtatEnum)]
25pub enum ResultCodeSelection {
26    /// 0: CONNECT result code is given upon entering online data state;
27    ConnectOnly = 0,
28    /// 1-4: CONNECT <speed> result code is given upon entering online data state;
29    ConnectSpeed = 1,
30}
31
32/// Indicates the behavior of circuit 108
33#[derive(Clone, PartialEq, Eq, AtatEnum)]
34pub enum Circuit108Behaviour {
35    /// 0: the DCE ignores circuit 108/2
36    Ignore = 0,
37    /// 1 (default value and factory-programmed value): upon an ON-to-OFF
38    /// transition of circuit 108/2, the DCE enters online command state and
39    /// issues the final result code
40    OnlineCommandState = 1,
41    /// 2: upon an ON-to-OFF transition of circuit 108/2, the DCE performs an
42    /// orderly cleardown of the call. The automatic answer is disabled while
43    /// circuit 108/2 remains OFF
44    OrderlyCleardown = 2,
45}
46
47#[derive(Clone, PartialEq, Eq, AtatEnum)]
48pub enum FlowControl {
49    /// - 0: disable DTE flow control
50    Disabled = 0,
51    /// - 3 (**default and factory-programmed value**): enable the RTS/CTS DTE flow
52    ///   control
53    RtsCts = 3,
54    /// - 4: enable the XON/XOFF DTE flow control
55    /// - 5: enable the XON/XOFF DTE flow control
56    /// - 6: enable the XON/XOFF DTE flow control
57    XonXoff = 4,
58}
59
60#[derive(Clone, PartialEq, Eq, AtatEnum)]
61pub enum SoftwareFlowControl {
62    /// - 0: Software flow control off
63    None = 0,
64    /// - 1: DC1/DC3 on circuit 103 and 104 (XON/XOFF)
65    Circuit103_104 = 1,
66    /// - 3: (**default value**): DCE_by_DTE on circuit 105 (RTS) and DTE_by_DCE on circuit 106 (CTS)
67    Circuit105_106 = 3,
68}
69
70#[derive(Clone, Copy, Debug, PartialEq, Eq, AtatEnum)]
71#[cfg_attr(feature = "defmt", derive(defmt::Format))]
72#[at_enum(u32)]
73pub enum BaudRate {
74    #[cfg(any(
75        feature = "toby-l2",
76        feature = "mpci-l2",
77        feature = "sara-u2",
78        feature = "toby-r2",
79        feature = "lara-r2",
80        feature = "toby-l4",
81        feature = "leon-g1",
82        feature = "sara-g3",
83        feature = "sara-g4"
84    ))]
85    Auto = 0,
86    #[cfg(any(feature = "lisa-u1", feature = "lisa-u2", feature = "sara-u2",))]
87    B1200 = 1200,
88    #[cfg(any(
89        feature = "lisa-u1",
90        feature = "lisa-u2",
91        feature = "sara-u2",
92        feature = "leon-g1",
93        feature = "sara-g3",
94        feature = "sara-g4"
95    ))]
96    B2400 = 2400,
97    #[cfg(any(
98        feature = "lisa-u1",
99        feature = "lisa-u2",
100        feature = "sara-u2",
101        feature = "leon-g1",
102        feature = "sara-g3",
103        feature = "sara-g4"
104    ))]
105    B4800 = 4800,
106    B9600 = 9600,
107    B19200 = 19200,
108    B38400 = 38400,
109    B57600 = 57600,
110    B115200 = 115_200,
111
112    #[cfg(any(
113        feature = "toby-l2",
114        feature = "mpci-l2",
115        feature = "lisa-u1",
116        feature = "lisa-u2",
117        feature = "sara-u2",
118        feature = "toby-r2",
119        feature = "lara-r2",
120        feature = "lara-r6",
121        feature = "toby-l4",
122    ))]
123    B230400 = 230_400,
124    #[cfg(any(
125        feature = "toby-l2",
126        feature = "mpci-l2",
127        feature = "lisa-u1",
128        feature = "lisa-u2",
129        feature = "sara-u2",
130        feature = "toby-r2",
131        feature = "lara-r2",
132        feature = "lara-r6",
133        feature = "toby-l4",
134    ))]
135    B460800 = 460_800,
136    #[cfg(any(
137        feature = "toby-l2",
138        feature = "mpci-l2",
139        feature = "lisa-u1",
140        feature = "lisa-u2",
141        feature = "sara-u2",
142        feature = "toby-r2",
143        feature = "lara-r2",
144        feature = "lara-r6",
145        feature = "toby-l4",
146    ))]
147    B921600 = 921_600,
148    #[cfg(any(feature = "toby-r2", feature = "lara-r2", feature = "lara-r6"))]
149    B3000000 = 3_000_000,
150    #[cfg(any(feature = "toby-r2", feature = "lara-r2",))]
151    B3250000 = 3_250_000,
152    #[cfg(any(feature = "toby-r2", feature = "lara-r2",))]
153    B6000000 = 6_000_000,
154    #[cfg(any(feature = "toby-r2", feature = "lara-r2",))]
155    B6500000 = 6_500_000,
156}