mirror of https://github.com/ARMmbed/mbed-os.git
Cellular: ATHandler debugging relieved
parent
f95ec957dd
commit
5aaf42c418
|
|
@ -37,7 +37,8 @@ using namespace mbed_cellular_util;
|
|||
#define PROCESS_URC_TIME 20
|
||||
|
||||
// Suppress logging of very big packet payloads, maxlen is approximate due to write/read are cached
|
||||
#define DEBUG_MAXLEN 80
|
||||
#define DEBUG_MAXLEN 60
|
||||
#define DEBUG_END_MARK "..\r"
|
||||
|
||||
const char *mbed::OK = "OK\r\n";
|
||||
const uint8_t OK_LENGTH = 4;
|
||||
|
|
@ -463,7 +464,7 @@ ssize_t ATHandler::read_bytes(uint8_t *buf, size_t len)
|
|||
}
|
||||
buf[read_len] = c;
|
||||
if (_debug_on && read_len >= DEBUG_MAXLEN) {
|
||||
debug_print("..", sizeof(".."));
|
||||
debug_print(DEBUG_END_MARK, sizeof(DEBUG_END_MARK) - 1);
|
||||
_debug_on = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -555,9 +556,15 @@ ssize_t ATHandler::read_hex_string(char *buf, size_t size)
|
|||
size_t buf_idx = 0;
|
||||
char hexbuf[2];
|
||||
|
||||
bool debug_on = _debug_on;
|
||||
for (; read_idx < size * 2 + match_pos; read_idx++) {
|
||||
int c = get_char();
|
||||
|
||||
if (_debug_on && read_idx >= DEBUG_MAXLEN) {
|
||||
debug_print(DEBUG_END_MARK, sizeof(DEBUG_END_MARK) - 1);
|
||||
_debug_on = false;
|
||||
}
|
||||
|
||||
if (match_pos) {
|
||||
buf_idx++;
|
||||
} else {
|
||||
|
|
@ -595,6 +602,7 @@ ssize_t ATHandler::read_hex_string(char *buf, size_t size)
|
|||
}
|
||||
}
|
||||
}
|
||||
_debug_on = debug_on;
|
||||
|
||||
if (read_idx && (read_idx == size * 2 + match_pos)) {
|
||||
buf_idx++;
|
||||
|
|
@ -1168,7 +1176,7 @@ size_t ATHandler::write(const void *data, size_t len)
|
|||
if (write_len + ret < DEBUG_MAXLEN) {
|
||||
debug_print((char *)data + write_len, ret);
|
||||
} else {
|
||||
debug_print("..", sizeof(".."));
|
||||
debug_print(DEBUG_END_MARK, sizeof(DEBUG_END_MARK) - 1);
|
||||
_debug_on = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1228,7 +1236,7 @@ void ATHandler::debug_print(const char *p, int len)
|
|||
debug("\n");
|
||||
} else if (c == '\n') {
|
||||
} else {
|
||||
debug("[%d]", c);
|
||||
debug("#%02x", c);
|
||||
}
|
||||
} else {
|
||||
debug("%c", c);
|
||||
|
|
|
|||
Loading…
Reference in New Issue