mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #10084 from mirelachirica/info_resp_issue_8829
Cellular: AT information response to return false on empty prefixpull/10081/head
commit
6c4b4a5212
|
@ -1085,7 +1085,7 @@ TEST_F(TestATHandler, test_ATHandler_info_resp)
|
||||||
filehandle_stub_table = NULL;
|
filehandle_stub_table = NULL;
|
||||||
|
|
||||||
ATHandler at(&fh1, que, 0, ",");
|
ATHandler at(&fh1, que, 0, ",");
|
||||||
EXPECT_TRUE(at.info_resp());
|
EXPECT_TRUE(!at.info_resp());
|
||||||
|
|
||||||
at.resp_start();
|
at.resp_start();
|
||||||
EXPECT_TRUE(!at.info_resp());
|
EXPECT_TRUE(!at.info_resp());
|
||||||
|
|
|
@ -839,7 +839,7 @@ void ATHandler::resp(const char *prefix, bool check_urc)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefix && match(prefix, strlen(prefix))) {
|
if (prefix && strlen(prefix) && match(prefix, strlen(prefix))) {
|
||||||
_prefix_matched = true;
|
_prefix_matched = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -853,14 +853,14 @@ void ATHandler::resp(const char *prefix, bool check_urc)
|
||||||
// If no match found, look for CRLF and consume everything up to and including CRLF
|
// If no match found, look for CRLF and consume everything up to and including CRLF
|
||||||
if (mem_str(_recv_buff, _recv_len, CRLF, CRLF_LENGTH)) {
|
if (mem_str(_recv_buff, _recv_len, CRLF, CRLF_LENGTH)) {
|
||||||
// If no prefix, return on CRLF - means data to read
|
// If no prefix, return on CRLF - means data to read
|
||||||
if (!prefix) {
|
if (!prefix || (prefix && !strlen(prefix))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
consume_to_tag(CRLF, true);
|
consume_to_tag(CRLF, true);
|
||||||
} else {
|
} else {
|
||||||
// If no prefix, no CRLF and no more chance to match for OK, ERROR or URC(since max resp length is already in buffer)
|
// If no prefix, no CRLF and no more chance to match for OK, ERROR or URC(since max resp length is already in buffer)
|
||||||
// return so data could be read
|
// return so data could be read
|
||||||
if (!prefix && ((_recv_len - _recv_pos) >= _max_resp_length)) {
|
if ((!prefix || (prefix && !strlen(prefix))) && ((_recv_len - _recv_pos) >= _max_resp_length)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!fill_buffer()) {
|
if (!fill_buffer()) {
|
||||||
|
|
|
@ -390,7 +390,8 @@ public:
|
||||||
* If needed, it ends the scope of a previous information response.
|
* If needed, it ends the scope of a previous information response.
|
||||||
* Sets the information response scope if new prefix is found and response scope if prefix is not found.
|
* Sets the information response scope if new prefix is found and response scope if prefix is not found.
|
||||||
*
|
*
|
||||||
* @return true if new information response is found, false otherwise
|
* @return true if prefix defined for information response is not empty string and is found,
|
||||||
|
* false otherwise.
|
||||||
*/
|
*/
|
||||||
bool info_resp();
|
bool info_resp();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue