network type info

This commit is contained in:
oarcher 2024-08-02 02:05:46 +02:00
parent 62fb07e595
commit 83c6d8deb0
2 changed files with 29 additions and 0 deletions

View file

@ -9,6 +9,9 @@
#include <esp_idf_version.h> #include <esp_idf_version.h>
#include <esp_task_wdt.h> #include <esp_task_wdt.h>
#include <unordered_map>
#include <string>
namespace esphome { namespace esphome {
namespace modem { namespace modem {
@ -46,6 +49,30 @@ std::string state_to_string(ModemComponentState state) {
return str; return str;
} }
// Access Technology from AT+CNSMOD?
// see https://www.waveshare.com/w/upload/a/af/SIM7500_SIM7600_Series_AT_Command_Manual_V3.00.pdf, page 109
static const std::unordered_map<int, std::string> ACT_MAP = {{0, "No service"},
{1, "GSM"},
{2, "GPRS"},
{3, "EGPRS (EDGE)"},
{4, "WCDMA"},
{5, "HSDPA only (WCDMA)"},
{6, "HSUPA only (WCDMA)"},
{7, "HSPA (HSDPA and HSUPA, WCDMA)"},
{8, "LTE"},
{9, "TDS-CDMA"},
{10, "TDS-HSDPA only"},
{11, "TDS-HSUPA only"},
{12, "TDS-HSPA (HSDPA and HSUPA)"},
{13, "CDMA"},
{14, "EVDO"},
{15, "HYBRID (CDMA and EVDO)"},
{16, "1XLTE (CDMA and LTE)"},
{23, "EHRPD"},
{24, "HYBRID (CDMA and EHRPD)"}};
std::string get_network_type_name(int act) { return ACT_MAP.at(act); }
} // namespace modem } // namespace modem
} // namespace esphome } // namespace esphome
#endif // USE_ESP_IDF #endif // USE_ESP_IDF

View file

@ -13,6 +13,8 @@ std::string command_result_to_string(command_result err);
std::string state_to_string(ModemComponentState state); std::string state_to_string(ModemComponentState state);
std::string get_network_type_name(int act);
} // namespace modem } // namespace modem
} // namespace esphome } // namespace esphome
#endif // USE_ESP_IDF #endif // USE_ESP_IDF