mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-16 12:02:11 +02:00
Add: Sim7600 extended support
This commit is contained in:
@ -44,8 +44,10 @@ DECLARE_ALL_COMMAND_APIS(declare name(Commandable *p, ...);)
|
||||
* @brief Following commands that are different for some specific modules
|
||||
*/
|
||||
command_result get_battery_status_sim7xxx(CommandableIf *t, int &voltage, int &bcs, int &bcl);
|
||||
command_result set_gnss_power_mode_sim76xx(CommandableIf *t, int mode);
|
||||
command_result power_down_sim76xx(CommandableIf *t);
|
||||
command_result power_down_sim70xx(CommandableIf *t);
|
||||
command_result set_network_bands_sim76xx(CommandableIf *t, const std::string& mode, const int* bands, int size);
|
||||
command_result power_down_sim8xx(CommandableIf *t);
|
||||
command_result set_data_mode_sim8xx(CommandableIf *t);
|
||||
|
||||
|
@ -121,6 +121,8 @@ class SIM7600: public GenericModule {
|
||||
public:
|
||||
command_result get_battery_status(int &voltage, int &bcs, int &bcl) override;
|
||||
command_result power_down() override;
|
||||
command_result set_gnss_power_mode(int mode) override;
|
||||
command_result set_network_bands(const std::string& mode, const int* bands, int size) override;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "cxx_include/esp_modem_dte.hpp"
|
||||
#include "cxx_include/esp_modem_dce_module.hpp"
|
||||
#include "cxx_include/esp_modem_command_library.hpp"
|
||||
#include <iomanip>
|
||||
|
||||
namespace esp_modem::dce_commands {
|
||||
|
||||
@ -489,6 +490,21 @@ command_result set_network_bands(CommandableIf *t, const std::string& mode, cons
|
||||
return generic_command_common(t, "AT+CBANDCFG=\"" + mode + "\"," + band_string + "\r");
|
||||
}
|
||||
|
||||
command_result set_network_bands_sim76xx(CommandableIf *t, const std::string& mode, const int* bands, int size)
|
||||
{
|
||||
ESP_LOGV(TAG, "%s", __func__ );
|
||||
std::string any_mode = "0xFFFFFFFF7FFFFFFF";
|
||||
uint64_t band_bits = 0;
|
||||
for (int i = 0; i<size; ++i) {
|
||||
// OR-operation to add bands
|
||||
band_bits |= 1 << bands[i];
|
||||
}
|
||||
std::stringstream stream;
|
||||
stream << "0x" << std::setfill('0') << std::setw(16) << std::hex << band_bits;
|
||||
std::string band_string = stream.str();
|
||||
return generic_command_common(t, "AT+CNBP=" + any_mode + "," + band_string + "\r");
|
||||
}
|
||||
|
||||
command_result get_network_system_mode(CommandableIf *t, int &mode)
|
||||
{
|
||||
ESP_LOGV(TAG, "%s", __func__ );
|
||||
@ -517,4 +533,10 @@ command_result set_gnss_power_mode(CommandableIf *t, int mode)
|
||||
return generic_command_common(t, "AT+CGNSPWR=" + std::to_string(mode) + "\r");
|
||||
}
|
||||
|
||||
command_result set_gnss_power_mode_sim76xx(CommandableIf *t, int mode)
|
||||
{
|
||||
ESP_LOGV(TAG, "%s", __func__ );
|
||||
return generic_command_common(t, "AT+CGPS=" + std::to_string(mode) + "\r");
|
||||
}
|
||||
|
||||
} // esp_modem::dce_commands
|
@ -60,6 +60,16 @@ command_result SIM7600::power_down()
|
||||
return dce_commands::power_down_sim76xx(dte.get());
|
||||
}
|
||||
|
||||
command_result SIM7600::set_network_bands(const std::string& mode, const int* bands, int size)
|
||||
{
|
||||
return dce_commands::set_network_bands_sim76xx(dte.get(), mode, bands, size);
|
||||
}
|
||||
|
||||
command_result SIM7600::power_down()
|
||||
{
|
||||
return dce_commands::power_down_sim76xx(dte.get());
|
||||
}
|
||||
|
||||
command_result SIM7070::power_down()
|
||||
{
|
||||
return dce_commands::power_down_sim70xx(dte.get());
|
||||
|
Reference in New Issue
Block a user