@@ -36,8 +36,8 @@ class FileHandle;
36
36
/* *
37
37
* If application calls associated FileHandle only from single thread context
38
38
* then locking between AT command and response is not needed. However,
39
- * note that many cellular functions are called indirectly e.g. via socket API.
40
- * If you are unsure then AT_HANDLER_MUTEX must be defined.
39
+ * note that many cellular functions are called indirectly, for example with the socket API.
40
+ * If you are unsure, then AT_HANDLER_MUTEX must be defined.
41
41
*/
42
42
#define AT_HANDLER_MUTEX
43
43
@@ -84,7 +84,7 @@ class ATHandler
84
84
*/
85
85
FileHandle *get_file_handle ();
86
86
87
- /* * Set file handle which is used for reading AT responses and writing AT commands
87
+ /* * Set file handle, which is used for reading AT responses and writing AT commands
88
88
*
89
89
* @param fh file handle used for reading AT responses and writing AT commands
90
90
*/
@@ -100,14 +100,14 @@ class ATHandler
100
100
101
101
/* * Locks the mutex for file handle if AT_HANDLER_MUTEX is defined and returns the last error.
102
102
*
103
- * @return last error which happened when parsing AT responses
103
+ * @return last error that happened when parsing AT responses
104
104
*/
105
105
nsapi_error_t unlock_return_error ();
106
106
107
- /* * Set the urc callback for urc. If urc is found when parsing AT responses then call if called.
107
+ /* * Set the urc callback for urc. If urc is found when parsing AT responses, then call if called.
108
108
*
109
109
* @param prefix Register urc prefix for callback. Urc could be for example "+CMTI: "
110
- * @param callback Callback which is called if urc is found in AT response
110
+ * @param callback Callback, which is called if urc is found in AT response
111
111
*/
112
112
void set_urc_handler (const char *prefix, mbed::Callback<void ()> callback);
113
113
@@ -150,7 +150,7 @@ class ATHandler
150
150
*/
151
151
void restore_at_timeout ();
152
152
153
- /* * Clear pending error flag. By default error is cleared only in lock().
153
+ /* * Clear pending error flag. By default, error is cleared only in lock().
154
154
*/
155
155
void clear_error ();
156
156
@@ -205,34 +205,34 @@ class ATHandler
205
205
public:
206
206
207
207
/* * Starts the command writing by clearing the last error and writing the given command.
208
- * In case of failure when writing the last error is set to NSAPI_ERROR_DEVICE_ERROR.
208
+ * In case of failure when writing, the last error is set to NSAPI_ERROR_DEVICE_ERROR.
209
209
*
210
210
* @param cmd AT command to be written to modem
211
211
*/
212
212
void cmd_start (const char * cmd);
213
213
214
214
/* * Writes integer type AT command subparameter. Starts with the delimiter if not the first param after cmd_start.
215
- * In case of failure when writing the last error is set to NSAPI_ERROR_DEVICE_ERROR.
215
+ * In case of failure when writing, the last error is set to NSAPI_ERROR_DEVICE_ERROR.
216
216
*
217
217
* @param param int to be written to modem as AT command subparameter
218
218
*/
219
219
void write_int (int32_t param);
220
220
221
221
/* * Writes string type AT command subparamater. Quotes are added to surround the given string.
222
222
* Starts with the delimiter if not the first param after cmd_start.
223
- * In case of failure when writing the last error is set to NSAPI_ERROR_DEVICE_ERROR.
223
+ * In case of failure when writing, the last error is set to NSAPI_ERROR_DEVICE_ERROR.
224
224
*
225
225
* @param param string to be written to modem as AT command subparameter
226
- * @param useQuotations flag indicating if the string should be or not included in quotation marks
226
+ * @param useQuotations flag indicating whether the string should be included in quotation marks
227
227
*/
228
228
void write_string (const char * param, bool useQuotations = true );
229
229
230
- /* * Stops the AT command by writing command line terminator CR to mark command as finished.
230
+ /* * Stops the AT command by writing command- line terminator CR to mark command as finished.
231
231
*/
232
232
void cmd_stop ();
233
233
234
234
/* * Write bytes without any subparameter delimiters, such as comma.
235
- * In case of failure when writing the last error is set to NSAPI_ERROR_DEVICE_ERROR.
235
+ * In case of failure when writing, the last error is set to NSAPI_ERROR_DEVICE_ERROR.
236
236
*
237
237
* @param data bytes to be written to modem
238
238
* @param len length of data string
@@ -241,7 +241,7 @@ class ATHandler
241
241
*/
242
242
size_t write_bytes (const uint8_t *data, size_t len);
243
243
244
- /* * Sets the stop tag for the current scope(response/information response/element)
244
+ /* * Sets the stop tag for the current scope (response/information response/element)
245
245
* Parameter's reading routines will stop the reading when such tag is found and will set the found flag.
246
246
* Consume routines will read everything until such tag is found.
247
247
*
@@ -286,7 +286,7 @@ class ATHandler
286
286
*
287
287
* @param str output buffer for the read
288
288
* @param size maximum number of chars to output
289
- * @param read_even_stop_tag if true then try to read even the stop tag was found previously
289
+ * @param read_even_stop_tag if true then try to read even if the stop tag was found previously
290
290
* @return length of output string or -1 in case of read timeout before delimiter or stop tag is found
291
291
*/
292
292
ssize_t read_string (char *str, size_t size, bool read_even_stop_tag = false );
@@ -309,22 +309,22 @@ class ATHandler
309
309
310
310
/* * Ends all scopes starting from current scope.
311
311
* Consumes everything until the scope's stop tag is found, then
312
- * goes to next scope, until response scope is ending.
312
+ * goes to next scope until response scope is ending.
313
313
* Possible sequence:
314
314
* element scope -> information response scope -> response scope
315
315
*/
316
316
void resp_stop ();
317
317
318
318
/* * Looks for matching the prefix given to resp_start() call.
319
- * If needed it ends the scope of a previous information response.
319
+ * If needed, it ends the scope of a previous information response.
320
320
* Sets the information response scope if new prefix is found and response scope if prefix is not found.
321
321
*
322
322
* @return true if new information response is found, false otherwise
323
323
*/
324
324
bool info_resp ();
325
325
326
326
/* * Looks for matching the start tag.
327
- * If needed it ends the scope of a previous element.
327
+ * If needed, it ends the scope of a previous element.
328
328
* Sets the element scope if start tag is found and information response scope if start tag is not found.
329
329
*
330
330
* @param start_tag tag to be matched to begin parsing an element of an information response
@@ -358,10 +358,10 @@ class ATHandler
358
358
// reading length
359
359
size_t _recv_pos;
360
360
361
- // resp_type: the part of the response that doesn't include the information response(+CMD1,+CMD2..)
361
+ // resp_type: the part of the response that doesn't include the information response (+CMD1,+CMD2..)
362
362
// ends with OK or (CME)(CMS)ERROR
363
363
// info_type: the information response part of the response: starts with +CMD1 and ends with CRLF
364
- // information response contains parameters or subsets of parameters(elements), both separated by comma
364
+ // information response contains parameters or subsets of parameters (elements), both separated by comma
365
365
// elem_type: subsets of parameters that are part of information response, its parameters are separated by comma
366
366
enum ScopeType {RespType, InfoType, ElemType, NotSet};
367
367
void set_scope (ScopeType scope_type);
@@ -379,7 +379,7 @@ class ATHandler
379
379
tag_t _info_stop;
380
380
// tag to stop element scope
381
381
tag_t _elem_stop;
382
- // reference to the stop tag of current scope(resp/info/elem)
382
+ // reference to the stop tag of current scope (resp/info/elem)
383
383
tag_t *_stop_tag;
384
384
385
385
// delimiter between parameters and also used for delimiting elements of information response
@@ -413,13 +413,13 @@ class ATHandler
413
413
414
414
// Rewinds the receiving buffer and compares it against given str.
415
415
bool match (const char * str, size_t size);
416
- // Iterates URCs and check if they match the receiving buffer content.
416
+ // Iterates URCs and checks if they match the receiving buffer content.
417
417
// If URC match sets the scope to information response and after urc's cb returns
418
418
// finishes the information response scope(consumes to CRLF).
419
419
bool match_urc ();
420
420
// Checks if any of the error strings are matching the receiving buffer content.
421
421
bool match_error ();
422
- // Checks is current char in buffer matches ch and consumes it,
422
+ // Checks if current char in buffer matches ch and consumes it,
423
423
// if no match lets the buffer unchanged.
424
424
bool consume_char (char ch);
425
425
// Consumes the received content until tag is found.
@@ -457,7 +457,7 @@ class ATHandler
457
457
*/
458
458
void set_string (char *dest, const char *src, size_t src_len);
459
459
460
- /* * Finds occurence of one char buffer inside another char buffer.
460
+ /* * Finds occurrence of one char buffer inside another char buffer.
461
461
*
462
462
* @param dest destination char buffer
463
463
* @param dest_len length of dest
0 commit comments