mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-17 04:22:14 +02:00
Add: Support for SIM7000 modules
This commit is contained in:
@ -87,6 +87,12 @@ std::unique_ptr<DCE> create_SIM7600_dce(const dce_config *config, std::shared_pt
|
|||||||
*/
|
*/
|
||||||
std::unique_ptr<DCE> create_SIM7070_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif);
|
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 SIM7000 module
|
||||||
|
*/
|
||||||
|
std::unique_ptr<DCE> create_SIM7000_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,8 +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_sim7600(CommandableIf *t);
|
command_result power_down_sim76xx(CommandableIf *t);
|
||||||
command_result power_down_sim7070(CommandableIf *t);
|
command_result power_down_sim70xx(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);
|
||||||
|
|
||||||
|
@ -118,6 +118,7 @@ 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 */
|
SIM7070, /*!< Derived from the GenericModule, specifics applied to SIM7070 model */
|
||||||
|
SIM7000, /*!< Derived from the GenericModule, specifics applied to SIM7000 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 */
|
||||||
};
|
};
|
||||||
@ -176,6 +177,8 @@ public:
|
|||||||
return build_shared_module<SIM7600>(cfg, std::forward<Args>(args)...);
|
return build_shared_module<SIM7600>(cfg, std::forward<Args>(args)...);
|
||||||
case ModemType::SIM7070:
|
case ModemType::SIM7070:
|
||||||
return build_shared_module<SIM7070>(cfg, std::forward<Args>(args)...);
|
return build_shared_module<SIM7070>(cfg, std::forward<Args>(args)...);
|
||||||
|
case ModemType::SIM7000:
|
||||||
|
return build_shared_module<SIM7000>(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:
|
||||||
@ -203,6 +206,8 @@ public:
|
|||||||
return build_unique<SIM7600>(cfg, std::forward<Args>(args)...);
|
return build_unique<SIM7600>(cfg, std::forward<Args>(args)...);
|
||||||
case ModemType::SIM7070:
|
case ModemType::SIM7070:
|
||||||
return build_unique<SIM7070>(cfg, std::forward<Args>(args)...);
|
return build_unique<SIM7070>(cfg, std::forward<Args>(args)...);
|
||||||
|
case ModemType::SIM7000:
|
||||||
|
return build_unique<SIM7000>(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:
|
||||||
@ -223,6 +228,8 @@ public:
|
|||||||
return build<SIM7600>(cfg, std::forward<Args>(args)...);
|
return build<SIM7600>(cfg, std::forward<Args>(args)...);
|
||||||
case ModemType::SIM7070:
|
case ModemType::SIM7070:
|
||||||
return build<SIM7070>(cfg, std::forward<Args>(args)...);
|
return build<SIM7070>(cfg, std::forward<Args>(args)...);
|
||||||
|
case ModemType::SIM7000:
|
||||||
|
return build<SIM7000>(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:
|
||||||
|
@ -132,6 +132,15 @@ public:
|
|||||||
command_result power_down() override;
|
command_result power_down() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Specific definition of the SIM7000 module
|
||||||
|
*/
|
||||||
|
class SIM7000: 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,8 +47,9 @@ 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_SIM7070,
|
||||||
|
ESP_MODEM_DCE_SIM7000,
|
||||||
ESP_MODEM_DCE_BG96,
|
ESP_MODEM_DCE_BG96,
|
||||||
ESP_MODEM_DCE_SIM800,
|
ESP_MODEM_DCE_SIM800,
|
||||||
} esp_modem_dce_device_t;
|
} esp_modem_dce_device_t;
|
||||||
|
@ -59,6 +59,11 @@ std::unique_ptr<DCE> create_SIM7070_dce(const dce_config *config, std::shared_pt
|
|||||||
return create_modem_dce(dce_factory::ModemType::SIM7070, config, std::move(dte), netif);
|
return create_modem_dce(dce_factory::ModemType::SIM7070, config, std::move(dte), netif);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<DCE> create_SIM7000_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif)
|
||||||
|
{
|
||||||
|
return create_modem_dce(dce_factory::ModemType::SIM7000, 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);
|
||||||
|
@ -61,6 +61,8 @@ static inline dce_factory::ModemType convert_modem_enum(esp_modem_dce_device_t m
|
|||||||
return esp_modem::dce_factory::ModemType::SIM7600;
|
return esp_modem::dce_factory::ModemType::SIM7600;
|
||||||
case ESP_MODEM_DCE_SIM7070:
|
case ESP_MODEM_DCE_SIM7070:
|
||||||
return esp_modem::dce_factory::ModemType::SIM7070;
|
return esp_modem::dce_factory::ModemType::SIM7070;
|
||||||
|
case ESP_MODEM_DCE_SIM7000:
|
||||||
|
return esp_modem::dce_factory::ModemType::SIM7000;
|
||||||
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,13 +121,13 @@ 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_sim7600(CommandableIf *t)
|
command_result power_down_sim76xx(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)
|
command_result power_down_sim70xx(CommandableIf *t)
|
||||||
{
|
{
|
||||||
ESP_LOGV(TAG, "%s", __func__ );
|
ESP_LOGV(TAG, "%s", __func__ );
|
||||||
return generic_command(t, "AT+CPOWD=1\r", "POWER DOWN", "ERROR", 1000);
|
return generic_command(t, "AT+CPOWD=1\r", "POWER DOWN", "ERROR", 1000);
|
||||||
|
@ -57,12 +57,17 @@ 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_sim7600(dte.get());
|
return dce_commands::power_down_sim76xx(dte.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
command_result SIM7070::power_down()
|
command_result SIM7070::power_down()
|
||||||
{
|
{
|
||||||
return dce_commands::power_down_sim7070(dte.get());
|
return dce_commands::power_down_sim70xx(dte.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
command_result SIM7000::power_down()
|
||||||
|
{
|
||||||
|
return dce_commands::power_down_sim70xx(dte.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
command_result SIM800::power_down()
|
command_result SIM800::power_down()
|
||||||
|
Reference in New Issue
Block a user