Skip to content

Commit e4e6ac5

Browse files
authored
Merge pull request #12008 from AriParkkila/cell-at-string-fix
Cellular: Fix ATHandler string handling
2 parents ad3647c + c22dd77 commit e4e6ac5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

features/cellular/framework/AT/ATHandler.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,9 @@ void ATHandler::skip_param(uint32_t count)
549549
}
550550
} else if (match_pos) {
551551
match_pos = 0;
552+
if (c == _stop_tag->tag[match_pos]) {
553+
match_pos++;
554+
}
552555
}
553556
}
554557
}
@@ -633,6 +636,9 @@ ssize_t ATHandler::read_string(char *buf, size_t size, bool read_even_stop_tag)
633636
}
634637
} else if (match_pos) {
635638
match_pos = 0;
639+
if (c == _stop_tag->tag[match_pos]) {
640+
match_pos++;
641+
}
636642
}
637643

638644
buf[len] = c;
@@ -717,6 +723,9 @@ ssize_t ATHandler::read_hex_string(char *buf, size_t size)
717723
}
718724
} else if (match_pos) {
719725
match_pos = 0;
726+
if (c == _stop_tag->tag[match_pos]) {
727+
match_pos++;
728+
}
720729
}
721730

722731
if (match_pos) {
@@ -1605,12 +1614,14 @@ void ATHandler::write_hex_string(char *str, size_t size)
16051614
return;
16061615
}
16071616

1617+
(void) write("\"", 1);
16081618
char hexbuf[2];
16091619
for (size_t i = 0; i < size; i++) {
16101620
hexbuf[0] = hex_values[((str[i]) >> 4) & 0x0F];
16111621
hexbuf[1] = hex_values[(str[i]) & 0x0F];
16121622
write(hexbuf, 2);
16131623
}
1624+
(void) write("\"", 1);
16141625
}
16151626

16161627
void ATHandler::set_baud(int baud_rate)

0 commit comments

Comments
 (0)