@@ -72,7 +72,7 @@ ATHandler::ATHandler(FileHandle *fh, EventQueue &queue, int timeout, const char
72
72
_previous_at_timeout(timeout),
73
73
_at_send_delay(send_delay),
74
74
_last_response_stop(0 ),
75
- _processing (false ),
75
+ _oob_queued (false ),
76
76
_ref_count(1 ),
77
77
_is_fh_usable(true ),
78
78
_stop_tag(NULL ),
@@ -223,9 +223,8 @@ bool ATHandler::find_urc_handler(const char *prefix)
223
223
224
224
void ATHandler::event ()
225
225
{
226
- // _processing must be set before filehandle write/read to avoid repetitive sigio events
227
- if (!_processing) {
228
- _processing = true ;
226
+ if (!_oob_queued) {
227
+ _oob_queued = true ;
229
228
(void ) _queue.call (Callback<void (void )>(this , &ATHandler::process_oob));
230
229
}
231
230
}
@@ -235,14 +234,12 @@ void ATHandler::lock()
235
234
#ifdef AT_HANDLER_MUTEX
236
235
_fileHandleMutex.lock ();
237
236
#endif
238
- _processing = true ;
239
237
clear_error ();
240
238
_start_time = rtos::Kernel::get_ms_count ();
241
239
}
242
240
243
241
void ATHandler::unlock ()
244
242
{
245
- _processing = false ;
246
243
#ifdef AT_HANDLER_MUTEX
247
244
_fileHandleMutex.unlock ();
248
245
#endif
@@ -283,19 +280,22 @@ void ATHandler::process_oob()
283
280
return ;
284
281
}
285
282
lock ();
283
+ _oob_queued = false ;
286
284
if (_fileHandle->readable () || (_recv_pos < _recv_len)) {
287
285
tr_debug (" AT OoB readable %d, len %u" , _fileHandle->readable (), _recv_len - _recv_pos);
288
286
_current_scope = NotSet;
289
287
uint32_t timeout = _at_timeout;
290
- _at_timeout = PROCESS_URC_TIME;
291
288
while (true ) {
289
+ _at_timeout = timeout;
292
290
if (match_urc ()) {
293
291
if (!(_fileHandle->readable () || (_recv_pos < _recv_len))) {
294
292
break ; // we have nothing to read anymore
295
293
}
296
294
} else if (mem_str (_recv_buff, _recv_len, CRLF, CRLF_LENGTH)) { // If no match found, look for CRLF and consume everything up to CRLF
295
+ _at_timeout = PROCESS_URC_TIME;
297
296
consume_to_tag (CRLF, true );
298
297
} else {
298
+ _at_timeout = PROCESS_URC_TIME;
299
299
if (!fill_buffer ()) {
300
300
reset_buffer (); // consume anything that could not be handled
301
301
break ;
0 commit comments