fix(esp_modem): Cleanup custom lib-commands and factory

This commit is contained in:
David Cermak
2022-10-18 16:57:42 +02:00
parent 652314e73d
commit 65c0e0e195
9 changed files with 113 additions and 94 deletions

View File

@ -10,17 +10,16 @@
#include "cxx_include/esp_modem_dte.hpp"
#include "cxx_include/esp_modem_dce_module.hpp"
#include "cxx_include/esp_modem_command_library.hpp"
#include "cxx_include/command_library.hpp"
#include "cxx_include/esp_modem_command_library_utils.hpp"
namespace esp_modem::dce_commands {
static const char *TAG = "command_lib";
command_result generic_command(CommandableIf *t, const std::string &command,
const std::list<std::string_view> &pass_phrase,
const std::list<std::string_view> &fail_phrase,
uint32_t timeout_ms)
static command_result generic_command(CommandableIf *t, const std::string &command,
const std::list<std::string_view> &pass_phrase,
const std::list<std::string_view> &fail_phrase,
uint32_t timeout_ms)
{
ESP_LOGD(TAG, "%s command %s\n", __func__, command.c_str());
return t->command(command, [&](uint8_t *data, size_t len) {
@ -52,7 +51,7 @@ command_result generic_command(CommandableIf *t, const std::string &command,
return generic_command(t, command, pass, fail, timeout_ms);
}
command_result generic_get_string(CommandableIf *t, const std::string &command, std::string_view &output, uint32_t timeout_ms)
static command_result generic_get_string(CommandableIf *t, const std::string &command, std::string_view &output, uint32_t timeout_ms = 500)
{
ESP_LOGV(TAG, "%s", __func__ );
return t->command(command, [&](uint8_t *data, size_t len) {
@ -91,10 +90,10 @@ command_result generic_get_string(CommandableIf *t, const std::string &command,
}
command_result generic_command_common(CommandableIf *t, const std::string &command, uint32_t timeout)
command_result generic_command_common(CommandableIf *t, const std::string &command, uint32_t timeout_ms)
{
ESP_LOGV(TAG, "%s", __func__ );
return generic_command(t, command, "OK", "ERROR", timeout);
return generic_command(t, command, "OK", "ERROR", timeout_ms);
}
command_result sync(CommandableIf *t)