diff --git a/components/esp_modem/idf_component.yml b/components/esp_modem/idf_component.yml index 798dd7d17..3ec8477f1 100644 --- a/components/esp_modem/idf_component.yml +++ b/components/esp_modem/idf_component.yml @@ -1,4 +1,4 @@ -version: "0.1.19" +version: "0.1.20" description: esp modem url: https://github.com/espressif/esp-protocols/tree/master/components/esp_modem dependencies: diff --git a/components/esp_modem/include/cxx_include/esp_modem_dte.hpp b/components/esp_modem/include/cxx_include/esp_modem_dte.hpp index 17b48f51e..2b8ab5f5a 100644 --- a/components/esp_modem/include/cxx_include/esp_modem_dte.hpp +++ b/components/esp_modem/include/cxx_include/esp_modem_dte.hpp @@ -75,6 +75,12 @@ public: */ void set_read_cb(std::function f); + /** + * @brief Sets DTE error callback + * @param f Function to be called on DTE error + */ + void set_error_cb(std::function f); + /** * @brief Sets the DTE to desired mode (Command/Data/Cmux) * @param m Desired operation mode diff --git a/components/esp_modem/include/cxx_include/esp_modem_terminal.hpp b/components/esp_modem/include/cxx_include/esp_modem_terminal.hpp index d3ccb9e9b..24bcd7d1c 100644 --- a/components/esp_modem/include/cxx_include/esp_modem_terminal.hpp +++ b/components/esp_modem/include/cxx_include/esp_modem_terminal.hpp @@ -41,6 +41,7 @@ enum class terminal_error { BUFFER_OVERFLOW, CHECKSUM_ERROR, UNEXPECTED_CONTROL_FLOW, + DEVICE_GONE, }; /** diff --git a/components/esp_modem/src/esp_modem_dte.cpp b/components/esp_modem/src/esp_modem_dte.cpp index 55e940978..0bbe83b1b 100644 --- a/components/esp_modem/src/esp_modem_dte.cpp +++ b/components/esp_modem/src/esp_modem_dte.cpp @@ -155,6 +155,12 @@ void DTE::set_read_cb(std::function f) }); } +void DTE::set_error_cb(std::function f) +{ + data_term->set_error_cb(f); + command_term->set_error_cb(f); +} + int DTE::read(uint8_t **d, size_t len) { auto data_to_read = std::min(len, buffer.size);