diff --git a/.gitmodules b/.gitmodules index 10e5d28f..062b2a8b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,4 +6,4 @@ url = https://github.com/espressif/esp-idf.git [submodule "deps/Arduino-CMake-Toolchain"] path = deps/Arduino-CMake-Toolchain - url = https://github.com/a9183756-gh/Arduino-CMake-Toolchain + url = https://github.com/a9183756-gh/Arduino-CMake-Toolchain.git diff --git a/include/at_client/at_logger.h b/include/at_client/at_logger.h new file mode 100644 index 00000000..c6be04fc --- /dev/null +++ b/include/at_client/at_logger.h @@ -0,0 +1,9 @@ +#ifndef ATLOGGER_H +#define ATLOGGER_H + +#include + +int atlogger_log(const char *title, const char *message); +int atlogger_logx(const char *title, const unsigned char *bytes, size_t byteslen); + +#endif // ATLOGGER_H diff --git a/src/at_client/at_logger.c b/src/at_client/at_logger.c new file mode 100644 index 00000000..c4994ef8 --- /dev/null +++ b/src/at_client/at_logger.c @@ -0,0 +1,20 @@ +#include "at_client/at_logger.h" +#include + +void printx(const unsigned char *bytes, size_t byteslen) { + for (size_t i = 0; i < byteslen; i++) { + printf("%02x ", bytes[i]); + } + printf("\n"); +} + +int atlogger_log(const char *title, const char *message) { + printf("%s | %s:\n", title, message); + return 0; +} + +int atlogger_logx(const char *title, const unsigned char *bytes, size_t byteslen) { + printf("%s | ", title); + printx(bytes, byteslen); + return 0; +}