mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-29 02:07:27 +02:00
esp-modem(VFS): Reworked decouple resources from the file system
This commit is contained in:
@ -16,20 +16,27 @@
|
||||
#define _EXCEPTION_STUB_HPP_
|
||||
|
||||
#ifdef CONFIG_COMPILER_CXX_EXCEPTIONS
|
||||
#define TRY_CATCH_RET_NULL(block) \
|
||||
#define TRY_CATCH_OR_DO(block, action) \
|
||||
try { block \
|
||||
} catch (std::bad_alloc& e) { \
|
||||
ESP_LOGE(TAG, "Out of memory"); \
|
||||
return nullptr; \
|
||||
} catch (esp_err_exception& e) { \
|
||||
action; \
|
||||
} catch (::esp_modem::esp_err_exception& e) { \
|
||||
esp_err_t err = e.get_err_t(); \
|
||||
ESP_LOGE(TAG, "%s: Exception caught with ESP err_code=%d", __func__, err); \
|
||||
ESP_LOGE(TAG, "%s", e.what()); \
|
||||
return nullptr; \
|
||||
action; \
|
||||
}
|
||||
|
||||
#define TRY_CATCH_RET_NULL(block) TRY_CATCH_OR_DO(block, return nullptr)
|
||||
#else
|
||||
|
||||
#define TRY_CATCH_OR_DO(block, action) \
|
||||
block
|
||||
|
||||
#define TRY_CATCH_RET_NULL(block) \
|
||||
block
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "cxx_include/esp_modem_dte.hpp"
|
||||
#include "esp_modem_config.h"
|
||||
|
||||
struct esp_modem_dte_config;
|
||||
struct esp_modem_uart_term_config;
|
||||
|
||||
namespace esp_modem {
|
||||
|
||||
@ -26,14 +26,13 @@ namespace esp_modem {
|
||||
* @brief Uart Resource is a platform specific struct which is implemented separately for ESP_PLATFORM and linux target
|
||||
*/
|
||||
struct uart_resource {
|
||||
explicit uart_resource(const esp_modem_dte_config *config, QueueHandle_t* event_queue, int fd);
|
||||
explicit uart_resource(const esp_modem_uart_term_config *config, QueueHandle_t* event_queue, int fd);
|
||||
|
||||
~uart_resource();
|
||||
|
||||
uart_port_t port{};
|
||||
};
|
||||
|
||||
std::unique_ptr<Terminal> create_vfs_terminal(const esp_modem_dte_config *config);
|
||||
|
||||
} // namespace esp_modem
|
||||
|
||||
|
Reference in New Issue
Block a user