fix(esp_modem) Add example that reads GNSS info

This commit is contained in:
Franz Höpfinger
2022-08-23 14:13:10 +02:00
committed by David Cermak
parent 71a2388acb
commit 652314e73d
9 changed files with 634 additions and 12 deletions

View File

@ -10,6 +10,8 @@
#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"
namespace esp_modem::dce_commands {
@ -40,9 +42,9 @@ command_result generic_command(CommandableIf *t, const std::string &command,
}
static inline command_result generic_command(CommandableIf *t, const std::string &command,
const std::string &pass_phrase,
const std::string &fail_phrase, uint32_t timeout_ms)
command_result generic_command(CommandableIf *t, const std::string &command,
const std::string &pass_phrase,
const std::string &fail_phrase, uint32_t timeout_ms)
{
ESP_LOGV(TAG, "%s", __func__ );
const auto pass = std::list<std::string_view>({pass_phrase});
@ -50,7 +52,7 @@ static inline command_result generic_command(CommandableIf *t, const std::string
return generic_command(t, command, pass, fail, timeout_ms);
}
static inline command_result generic_get_string(CommandableIf *t, const std::string &command, std::string_view &output, uint32_t timeout_ms = 500)
command_result generic_get_string(CommandableIf *t, const std::string &command, std::string_view &output, uint32_t timeout_ms)
{
ESP_LOGV(TAG, "%s", __func__ );
return t->command(command, [&](uint8_t *data, size_t len) {
@ -77,7 +79,7 @@ static inline command_result generic_get_string(CommandableIf *t, const std::str
}, timeout_ms);
}
static inline command_result generic_get_string(CommandableIf *t, const std::string &command, std::string &output, uint32_t timeout_ms = 500)
command_result generic_get_string(CommandableIf *t, const std::string &command, std::string &output, uint32_t timeout_ms)
{
ESP_LOGV(TAG, "%s", __func__ );
std::string_view out;
@ -89,7 +91,7 @@ static inline command_result generic_get_string(CommandableIf *t, const std::str
}
static inline command_result generic_command_common(CommandableIf *t, const std::string &command, uint32_t timeout = 500)
command_result generic_command_common(CommandableIf *t, const std::string &command, uint32_t timeout)
{
ESP_LOGV(TAG, "%s", __func__ );
return generic_command(t, command, "OK", "ERROR", timeout);