Skip to content

Commit 33a4001

Browse files
Cruz Monrreal IICruz Monrreal II
authored andcommitted
Merge pull request ARMmbed#10084 from null
null
2 parents 7e6b890 + d12de2a commit 33a4001

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

UNITTESTS/features/cellular/framework/AT/athandler/athandlertest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ TEST_F(TestATHandler, test_ATHandler_info_resp)
10851085
filehandle_stub_table = NULL;
10861086

10871087
ATHandler at(&fh1, que, 0, ",");
1088-
EXPECT_TRUE(at.info_resp());
1088+
EXPECT_TRUE(!at.info_resp());
10891089

10901090
at.resp_start();
10911091
EXPECT_TRUE(!at.info_resp());

features/cellular/framework/AT/ATHandler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ void ATHandler::resp(const char *prefix, bool check_urc)
839839
return;
840840
}
841841

842-
if (prefix && match(prefix, strlen(prefix))) {
842+
if (prefix && strlen(prefix) && match(prefix, strlen(prefix))) {
843843
_prefix_matched = true;
844844
return;
845845
}
@@ -853,14 +853,14 @@ void ATHandler::resp(const char *prefix, bool check_urc)
853853
// If no match found, look for CRLF and consume everything up to and including CRLF
854854
if (mem_str(_recv_buff, _recv_len, CRLF, CRLF_LENGTH)) {
855855
// If no prefix, return on CRLF - means data to read
856-
if (!prefix) {
856+
if (!prefix || (prefix && !strlen(prefix))) {
857857
return;
858858
}
859859
consume_to_tag(CRLF, true);
860860
} else {
861861
// If no prefix, no CRLF and no more chance to match for OK, ERROR or URC(since max resp length is already in buffer)
862862
// return so data could be read
863-
if (!prefix && ((_recv_len - _recv_pos) >= _max_resp_length)) {
863+
if ((!prefix || (prefix && !strlen(prefix))) && ((_recv_len - _recv_pos) >= _max_resp_length)) {
864864
return;
865865
}
866866
if (!fill_buffer()) {

features/cellular/framework/AT/ATHandler.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ class ATHandler {
390390
* If needed, it ends the scope of a previous information response.
391391
* Sets the information response scope if new prefix is found and response scope if prefix is not found.
392392
*
393-
* @return true if new information response is found, false otherwise
393+
* @return true if prefix defined for information response is not empty string and is found,
394+
* false otherwise.
394395
*/
395396
bool info_resp();
396397

0 commit comments

Comments
 (0)