mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-18 04:52:18 +02:00
Add: sim7070 support
This commit is contained in:
@ -82,6 +82,11 @@ std::shared_ptr<DTE> create_vfs_dte(const dte_config *config);
|
|||||||
*/
|
*/
|
||||||
std::unique_ptr<DCE> create_SIM7600_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif);
|
std::unique_ptr<DCE> create_SIM7600_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create DCE based on SIM7070 module
|
||||||
|
*/
|
||||||
|
std::unique_ptr<DCE> create_SIM7070_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create DCE based on SIM800 module
|
* @brief Create DCE based on SIM800 module
|
||||||
*/
|
*/
|
||||||
|
@ -44,7 +44,8 @@ DECLARE_ALL_COMMAND_APIS(declare name(Commandable *p, ...);)
|
|||||||
* @brief Following commands that are different for some specific modules
|
* @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 get_battery_status_sim7xxx(CommandableIf *t, int &voltage, int &bcs, int &bcl);
|
||||||
command_result power_down_sim7xxx(CommandableIf *t);
|
command_result power_down_sim7600(CommandableIf *t);
|
||||||
|
command_result power_down_sim7070(CommandableIf *t);
|
||||||
command_result power_down_sim8xx(CommandableIf *t);
|
command_result power_down_sim8xx(CommandableIf *t);
|
||||||
command_result set_data_mode_sim8xx(CommandableIf *t);
|
command_result set_data_mode_sim8xx(CommandableIf *t);
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ private:
|
|||||||
enum class ModemType {
|
enum class ModemType {
|
||||||
GenericModule, /*!< Default generic module with the most common commands */
|
GenericModule, /*!< Default generic module with the most common commands */
|
||||||
SIM7600, /*!< Derived from the GenericModule, specifics applied to SIM7600 model */
|
SIM7600, /*!< Derived from the GenericModule, specifics applied to SIM7600 model */
|
||||||
|
SIM7070, /*!< Derived from the GenericModule, specifics applied to SIM7070 model */
|
||||||
BG96, /*!< Derived from the GenericModule, specifics applied to BG69 model */
|
BG96, /*!< Derived from the GenericModule, specifics applied to BG69 model */
|
||||||
SIM800, /*!< Derived from the GenericModule with specifics applied to SIM800 model */
|
SIM800, /*!< Derived from the GenericModule with specifics applied to SIM800 model */
|
||||||
};
|
};
|
||||||
@ -173,6 +174,8 @@ public:
|
|||||||
return build_shared_module<SIM800>(cfg, std::forward<Args>(args)...);
|
return build_shared_module<SIM800>(cfg, std::forward<Args>(args)...);
|
||||||
case ModemType::SIM7600:
|
case ModemType::SIM7600:
|
||||||
return build_shared_module<SIM7600>(cfg, std::forward<Args>(args)...);
|
return build_shared_module<SIM7600>(cfg, std::forward<Args>(args)...);
|
||||||
|
case ModemType::SIM7070:
|
||||||
|
return build_shared_module<SIM7070>(cfg, std::forward<Args>(args)...);
|
||||||
case ModemType::BG96:
|
case ModemType::BG96:
|
||||||
return build_shared_module<BG96>(cfg, std::forward<Args>(args)...);
|
return build_shared_module<BG96>(cfg, std::forward<Args>(args)...);
|
||||||
case ModemType::GenericModule:
|
case ModemType::GenericModule:
|
||||||
@ -198,6 +201,8 @@ public:
|
|||||||
return build_unique<SIM800>(cfg, std::forward<Args>(args)...);
|
return build_unique<SIM800>(cfg, std::forward<Args>(args)...);
|
||||||
case ModemType::SIM7600:
|
case ModemType::SIM7600:
|
||||||
return build_unique<SIM7600>(cfg, std::forward<Args>(args)...);
|
return build_unique<SIM7600>(cfg, std::forward<Args>(args)...);
|
||||||
|
case ModemType::SIM7070:
|
||||||
|
return build_unique<SIM7070>(cfg, std::forward<Args>(args)...);
|
||||||
case ModemType::BG96:
|
case ModemType::BG96:
|
||||||
return build_unique<BG96>(cfg, std::forward<Args>(args)...);
|
return build_unique<BG96>(cfg, std::forward<Args>(args)...);
|
||||||
case ModemType::GenericModule:
|
case ModemType::GenericModule:
|
||||||
@ -216,6 +221,8 @@ public:
|
|||||||
return build<SIM800>(cfg, std::forward<Args>(args)...);
|
return build<SIM800>(cfg, std::forward<Args>(args)...);
|
||||||
case ModemType::SIM7600:
|
case ModemType::SIM7600:
|
||||||
return build<SIM7600>(cfg, std::forward<Args>(args)...);
|
return build<SIM7600>(cfg, std::forward<Args>(args)...);
|
||||||
|
case ModemType::SIM7070:
|
||||||
|
return build<SIM7070>(cfg, std::forward<Args>(args)...);
|
||||||
case ModemType::BG96:
|
case ModemType::BG96:
|
||||||
return build<BG96>(cfg, std::forward<Args>(args)...);
|
return build<BG96>(cfg, std::forward<Args>(args)...);
|
||||||
case ModemType::GenericModule:
|
case ModemType::GenericModule:
|
||||||
|
@ -123,6 +123,15 @@ public:
|
|||||||
command_result power_down() override;
|
command_result power_down() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Specific definition of the SIM7070 module
|
||||||
|
*/
|
||||||
|
class SIM7070: public GenericModule {
|
||||||
|
using GenericModule::GenericModule;
|
||||||
|
public:
|
||||||
|
command_result power_down() override;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Specific definition of the SIM800 module
|
* @brief Specific definition of the SIM800 module
|
||||||
*/
|
*/
|
||||||
|
@ -47,6 +47,7 @@ typedef enum esp_modem_dce_mode
|
|||||||
typedef enum esp_modem_dce_device
|
typedef enum esp_modem_dce_device
|
||||||
{
|
{
|
||||||
ESP_MODEM_DCE_GENETIC, /**< The most generic device */
|
ESP_MODEM_DCE_GENETIC, /**< The most generic device */
|
||||||
|
ESP_MODEM_DCE_SIM7070,
|
||||||
ESP_MODEM_DCE_SIM7600,
|
ESP_MODEM_DCE_SIM7600,
|
||||||
ESP_MODEM_DCE_BG96,
|
ESP_MODEM_DCE_BG96,
|
||||||
ESP_MODEM_DCE_SIM800,
|
ESP_MODEM_DCE_SIM800,
|
||||||
|
@ -54,6 +54,11 @@ std::unique_ptr<DCE> create_SIM7600_dce(const dce_config *config, std::shared_pt
|
|||||||
return create_modem_dce(dce_factory::ModemType::SIM7600, config, std::move(dte), netif);
|
return create_modem_dce(dce_factory::ModemType::SIM7600, config, std::move(dte), netif);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<DCE> create_SIM7070_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif)
|
||||||
|
{
|
||||||
|
return create_modem_dce(dce_factory::ModemType::SIM7070, config, std::move(dte), netif);
|
||||||
|
}
|
||||||
|
|
||||||
std::unique_ptr<DCE> create_SIM800_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif)
|
std::unique_ptr<DCE> create_SIM800_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif)
|
||||||
{
|
{
|
||||||
return create_modem_dce(dce_factory::ModemType::SIM800, config, std::move(dte), netif);
|
return create_modem_dce(dce_factory::ModemType::SIM800, config, std::move(dte), netif);
|
||||||
|
@ -59,6 +59,8 @@ static inline dce_factory::ModemType convert_modem_enum(esp_modem_dce_device_t m
|
|||||||
switch (module) {
|
switch (module) {
|
||||||
case ESP_MODEM_DCE_SIM7600:
|
case ESP_MODEM_DCE_SIM7600:
|
||||||
return esp_modem::dce_factory::ModemType::SIM7600;
|
return esp_modem::dce_factory::ModemType::SIM7600;
|
||||||
|
case ESP_MODEM_DCE_SIM7070:
|
||||||
|
return esp_modem::dce_factory::ModemType::SIM7070;
|
||||||
case ESP_MODEM_DCE_BG96:
|
case ESP_MODEM_DCE_BG96:
|
||||||
return esp_modem::dce_factory::ModemType::BG96;
|
return esp_modem::dce_factory::ModemType::BG96;
|
||||||
case ESP_MODEM_DCE_SIM800:
|
case ESP_MODEM_DCE_SIM800:
|
||||||
|
@ -121,12 +121,18 @@ command_result power_down(CommandableIf *t)
|
|||||||
return generic_command(t, "AT+QPOWD=1\r", "POWERED DOWN", "ERROR", 1000);
|
return generic_command(t, "AT+QPOWD=1\r", "POWERED DOWN", "ERROR", 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
command_result power_down_sim7xxx(CommandableIf *t)
|
command_result power_down_sim7600(CommandableIf *t)
|
||||||
{
|
{
|
||||||
ESP_LOGV(TAG, "%s", __func__ );
|
ESP_LOGV(TAG, "%s", __func__ );
|
||||||
return generic_command_common(t, "AT+CPOF\r", 1000);
|
return generic_command_common(t, "AT+CPOF\r", 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
command_result power_down_sim7070(CommandableIf *t)
|
||||||
|
{
|
||||||
|
ESP_LOGV(TAG, "%s", __func__ );
|
||||||
|
return generic_command(t, "AT+CPOWD=1\r", "POWER DOWN", "ERROR", 1000);
|
||||||
|
}
|
||||||
|
|
||||||
command_result power_down_sim8xx(CommandableIf *t)
|
command_result power_down_sim8xx(CommandableIf *t)
|
||||||
{
|
{
|
||||||
ESP_LOGV(TAG, "%s", __func__ );
|
ESP_LOGV(TAG, "%s", __func__ );
|
||||||
|
@ -57,7 +57,12 @@ command_result SIM7600::get_battery_status(int &voltage, int &bcs, int &bcl)
|
|||||||
|
|
||||||
command_result SIM7600::power_down()
|
command_result SIM7600::power_down()
|
||||||
{
|
{
|
||||||
return dce_commands::power_down_sim7xxx(dte.get());
|
return dce_commands::power_down_sim7600(dte.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
command_result SIM7070::power_down()
|
||||||
|
{
|
||||||
|
return dce_commands::power_down_sim7070(dte.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
command_result SIM800::power_down()
|
command_result SIM800::power_down()
|
||||||
|
Reference in New Issue
Block a user