10
10
#include " cxx_include/esp_modem_dce_module.hpp"
11
11
#include " cxx_include/esp_modem_types.hpp"
12
12
13
- // --- ESP-MODEM command module starts here ---
14
13
namespace esp_modem {
15
14
namespace dce_commands {
16
-
17
15
/* *
18
16
* @defgroup ESP_MODEM_DCE_COMMAND ESP_MODEM DCE command library
19
17
* @brief Library of the most useful DCE commands
20
18
*/
21
19
/* * @addtogroup ESP_MODEM_DCE_COMMAND
22
20
* @{
23
21
*/
24
-
25
22
/* *
26
23
* @brief Generic AT command to be send with pass and fail phrases
27
24
*
@@ -34,72 +31,32 @@ namespace dce_commands {
34
31
command_result generic_command (CommandableIf *t, const std::string &command,
35
32
const std::string &pass_phrase,
36
33
const std::string &fail_phrase, uint32_t timeout_ms);
37
-
38
34
/* *
39
35
* @brief Declaration of all commands is generated from esp_modem_command_declare.inc
40
36
*/
41
-
42
-
43
- //
44
- // #define INT_IN(name) int name
45
- // #ifdef __cplusplus
46
- // #define STRING_IN(name) const std::string& name
47
- // #define STRING_OUT(name) std::string& name
48
- // #define BOOL_IN(name) const bool name
49
- // #define BOOL_OUT(name) bool& name
50
- // #define INT_OUT(name) int& name
51
- // #define INTEGER_LIST_IN(name) const int* name
52
- // #define STRUCT_OUT(struct_name, name) struct_name& name
53
- // #else
54
- // #define STRING_IN(name) const char* name
55
- // #define STRING_OUT(name) char* name
56
- // #define BOOL_IN(name) const bool name
57
- // #define BOOL_OUT(name) bool* name
58
- // #define INT_OUT(name) int* name
59
- // #define INTEGER_LIST_IN(name) const int* name
60
- // #define STRUCT_OUT(struct_name, name) esp_modem_ ## struct_name ## _t* name
61
- // #endif
62
- //
63
- // #define FORWARD_INT_IN(name) name
64
- // #define FORWARD_STRING_IN(name) name
65
- // #define FORWARD_STRING_OUT(name) name
66
- // #define FORWARD_BOOL_IN(name) name
67
- // #define FORWARD_BOOL_OUT(name) name
68
- // #define FORWARD_INT_OUT(name) name
69
- // #define FORWARD_INTEGER_LIST_IN(name) name
70
- // #define FORWARD_STRUCT_OUT(struct_name, name) name
71
-
72
- // Utility to count arguments (works for up to two parameters here)
73
-
74
-
75
-
76
37
/* *
77
38
* @brief Sends the initial AT sequence to sync up with the device
78
39
* @return OK, FAIL or TIMEOUT
79
40
*/
80
41
command_result sync (CommandableIf *t );
81
-
82
42
/* *
83
43
* @brief Reads the operator name
84
44
* @param[out] name operator name
85
45
* @param[out] act access technology
86
46
* @return OK, FAIL or TIMEOUT
87
47
*/
88
48
command_result get_operator_name (CommandableIf *t, std::string &name, int &act );
89
-
90
49
/* *
91
50
* @brief Stores current user profile
92
51
* @return OK, FAIL or TIMEOUT
93
52
*/
94
53
command_result store_profile (CommandableIf *t );
95
-
96
54
/* *
97
55
* @brief Sets the supplied PIN code
98
56
* @param[in] pin Pin
99
57
* @return OK, FAIL or TIMEOUT
100
58
*/
101
59
command_result set_pin (CommandableIf *t, const std::string &pin );
102
-
103
60
/* *
104
61
* @brief Execute the supplied AT command in raw mode (doesn't append '\r' to command, returns everything)
105
62
* @param[in] cmd String command that's send to DTE
@@ -110,7 +67,6 @@ command_result set_pin(CommandableIf *t, const std::string &pin );
110
67
* @return OK, FAIL or TIMEOUT
111
68
*/
112
69
command_result at_raw (CommandableIf *t, const std::string &cmd, std::string &out, const std::string &pass, const std::string &fail, int timeout );
113
-
114
70
/* *
115
71
* @brief Execute the supplied AT command
116
72
* @param[in] cmd AT command
@@ -119,116 +75,99 @@ command_result at_raw(CommandableIf *t, const std::string &cmd, std::string &out
119
75
* @return OK, FAIL or TIMEOUT
120
76
*/
121
77
command_result at (CommandableIf *t, const std::string &cmd, std::string &out, int timeout );
122
-
123
78
/* *
124
79
* @brief Checks if the SIM needs a PIN
125
80
* @param[out] pin_ok true if the SIM card doesn't need a PIN to unlock
126
81
* @return OK, FAIL or TIMEOUT
127
82
*/
128
83
command_result read_pin (CommandableIf *t, bool &pin_ok );
129
-
130
84
/* *
131
85
* @brief Sets echo mode
132
86
* @param[in] echo_on true if echo mode on (repeats the commands)
133
87
* @return OK, FAIL or TIMEOUT
134
88
*/
135
89
command_result set_echo (CommandableIf *t, const bool echo_on );
136
-
137
90
/* *
138
91
* @brief Sets the Txt or Pdu mode for SMS (only txt is supported)
139
92
* @param[in] txt true if txt mode
140
93
* @return OK, FAIL or TIMEOUT
141
94
*/
142
95
command_result sms_txt_mode (CommandableIf *t, const bool txt );
143
-
144
96
/* *
145
97
* @brief Sets the default (GSM) character set
146
98
* @return OK, FAIL or TIMEOUT
147
99
*/
148
100
command_result sms_character_set (CommandableIf *t );
149
-
150
101
/* *
151
102
* @brief Sends SMS message in txt mode
152
103
* @param[in] number Phone number to send the message to
153
104
* @param[in] message Text message to be sent
154
105
* @return OK, FAIL or TIMEOUT
155
106
*/
156
107
command_result send_sms (CommandableIf *t, const std::string &number, const std::string &message );
157
-
158
108
/* *
159
109
* @brief Resumes data mode (Switches back to the data mode, which was temporarily suspended)
160
110
* @return OK, FAIL or TIMEOUT
161
111
*/
162
112
command_result resume_data_mode (CommandableIf *t );
163
-
164
113
/* *
165
114
* @brief Sets php context
166
115
* @param[in] p1 PdP context struct to setup modem cellular connection
167
116
* @return OK, FAIL or TIMEOUT
168
117
*/
169
118
command_result set_pdp_context (CommandableIf *t, PdpContext &pdp );
170
-
171
119
/* *
172
120
* @brief Switches to the command mode
173
121
* @return OK, FAIL or TIMEOUT
174
122
*/
175
123
command_result set_command_mode (CommandableIf *t );
176
-
177
124
/* *
178
125
* @brief Switches to the CMUX mode
179
126
* @return OK, FAIL or TIMEOUT
180
127
*/
181
128
command_result set_cmux (CommandableIf *t );
182
-
183
129
/* *
184
130
* @brief Reads the IMSI number
185
131
* @param[out] imsi Module's IMSI number
186
132
* @return OK, FAIL or TIMEOUT
187
133
*/
188
134
command_result get_imsi (CommandableIf *t, std::string &imsi );
189
-
190
135
/* *
191
136
* @brief Reads the IMEI number
192
137
* @param[out] imei Module's IMEI number
193
138
* @return OK, FAIL or TIMEOUT
194
139
*/
195
140
command_result get_imei (CommandableIf *t, std::string &imei );
196
-
197
141
/* *
198
142
* @brief Reads the module name
199
143
* @param[out] name module name
200
144
* @return OK, FAIL or TIMEOUT
201
145
*/
202
146
command_result get_module_name (CommandableIf *t, std::string &name );
203
-
204
147
/* *
205
148
* @brief Sets the modem to data mode
206
149
* @return OK, FAIL or TIMEOUT
207
150
*/
208
151
command_result set_data_mode (CommandableIf *t );
209
-
210
152
/* *
211
153
* @brief Get Signal quality
212
154
* @param[out] rssi signal strength indication
213
155
* @param[out] ber channel bit error rate
214
156
* @return OK, FAIL or TIMEOUT
215
157
*/
216
158
command_result get_signal_quality (CommandableIf *t, int &rssi, int &ber );
217
-
218
159
/* *
219
160
* @brief Sets HW control flow
220
161
* @param[in] dce_flow 0=none, 2=RTS hw flow control of DCE
221
162
* @param[in] dte_flow 0=none, 2=CTS hw flow control of DTE
222
163
* @return OK, FAIL or TIMEOUT
223
164
*/
224
165
command_result set_flow_control (CommandableIf *t, int dce_flow, int dte_flow );
225
-
226
166
/* *
227
167
* @brief Hangs up current data call
228
168
* @return OK, FAIL or TIMEOUT
229
169
*/
230
170
command_result hang_up (CommandableIf *t );
231
-
232
171
/* *
233
172
* @brief Get voltage levels of modem power up circuitry
234
173
* @param[out] voltage Current status in mV
@@ -237,26 +176,22 @@ command_result hang_up(CommandableIf *t );
237
176
* @return OK, FAIL or TIMEOUT
238
177
*/
239
178
command_result get_battery_status (CommandableIf *t, int &voltage, int &bcs, int &bcl );
240
-
241
179
/* *
242
180
* @brief Power down the module
243
181
* @return OK, FAIL or TIMEOUT
244
182
*/
245
183
command_result power_down (CommandableIf *t );
246
-
247
184
/* *
248
185
* @brief Reset the module
249
186
* @return OK, FAIL or TIMEOUT
250
187
*/
251
188
command_result reset (CommandableIf *t );
252
-
253
189
/* *
254
190
* @brief Configures the baudrate
255
191
* @param[in] baud Desired baud rate of the DTE
256
192
* @return OK, FAIL or TIMEOUT
257
193
*/
258
194
command_result set_baud (CommandableIf *t, int baud );
259
-
260
195
/* *
261
196
* @brief Force an attempt to connect to a specific operator
262
197
* @param[in] mode mode of attempt
@@ -273,49 +208,42 @@ command_result set_baud(CommandableIf *t, int baud );
273
208
* @return OK, FAIL or TIMEOUT
274
209
*/
275
210
command_result set_operator (CommandableIf *t, int mode, int format, const std::string &oper );
276
-
277
211
/* *
278
212
* @brief Attach or detach from the GPRS service
279
213
* @param[in] state 1-attach 0-detach
280
214
* @return OK, FAIL or TIMEOUT
281
215
*/
282
216
command_result set_network_attachment_state (CommandableIf *t, int state );
283
-
284
217
/* *
285
218
* @brief Get network attachment state
286
219
* @param[out] state 1-attached 0-detached
287
220
* @return OK, FAIL or TIMEOUT
288
221
*/
289
222
command_result get_network_attachment_state (CommandableIf *t, int &state );
290
-
291
223
/* *
292
224
* @brief What mode the radio should be set to
293
225
* @param[in] state state 1-full 0-minimum ...
294
226
* @return OK, FAIL or TIMEOUT
295
227
*/
296
228
command_result set_radio_state (CommandableIf *t, int state );
297
-
298
229
/* *
299
230
* @brief Get current radio state
300
231
* @param[out] state 1-full 0-minimum ...
301
232
* @return OK, FAIL or TIMEOUT
302
233
*/
303
234
command_result get_radio_state (CommandableIf *t, int &state );
304
-
305
235
/* *
306
236
* @brief Set network mode
307
237
* @param[in] mode preferred mode
308
238
* @return OK, FAIL or TIMEOUT
309
239
*/
310
240
command_result set_network_mode (CommandableIf *t, int mode );
311
-
312
241
/* *
313
242
* @brief Preferred network mode (CAT-M and/or NB-IoT)
314
243
* @param[in] mode preferred selection
315
244
* @return OK, FAIL or TIMEOUT
316
245
*/
317
246
command_result set_preferred_mode (CommandableIf *t, int mode );
318
-
319
247
/* *
320
248
* @brief Set network bands for CAT-M or NB-IoT
321
249
* @param[in] mode CAT-M or NB-IoT
@@ -324,30 +252,24 @@ command_result set_preferred_mode(CommandableIf *t, int mode );
324
252
* @return OK, FAIL or TIMEOUT
325
253
*/
326
254
command_result set_network_bands (CommandableIf *t, const std::string &mode, const int *bands, int size );
327
-
328
255
/* *
329
256
* @brief Show network system mode
330
257
* @param[out] mode current network mode
331
258
* @return OK, FAIL or TIMEOUT
332
259
*/
333
260
command_result get_network_system_mode (CommandableIf *t, int &mode );
334
-
335
261
/* *
336
262
* @brief GNSS power control
337
263
* @param[out] mode power mode (0 - off, 1 - on)
338
264
* @return OK, FAIL or TIMEOUT
339
265
*/
340
266
command_result set_gnss_power_mode (CommandableIf *t, int mode );
341
-
342
267
/* *
343
268
* @brief GNSS power control
344
269
* @param[out] mode power mode (0 - off, 1 - on)
345
270
* @return OK, FAIL or TIMEOUT
346
271
*/
347
272
command_result get_gnss_power_mode (CommandableIf *t, int &mode );
348
-
349
-
350
-
351
273
/* *
352
274
* @brief Following commands that are different for some specific modules
353
275
*/
@@ -359,10 +281,8 @@ command_result set_network_bands_sim76xx(CommandableIf *t, const std::string &mo
359
281
command_result power_down_sim8xx (CommandableIf *t);
360
282
command_result set_data_mode_alt (CommandableIf *t);
361
283
command_result set_pdp_context (CommandableIf *t, PdpContext &pdp, uint32_t timeout_ms);
362
-
363
284
/* *
364
285
* @}
365
286
*/
366
-
367
287
} // dce_commands
368
288
} // esp_modem
0 commit comments