mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-23 15:27:28 +02:00
esp-modem(DCE-Factory): Minor corrections per code review
This commit is contained in:
committed by
David Cermak
parent
3332c27978
commit
dc64f862c4
@ -46,7 +46,7 @@ std::shared_ptr<DTE> create_vfs_dte(const dte_config *config) {
|
||||
|
||||
|
||||
static inline std::unique_ptr<DCE>
|
||||
create_modem_dce(dce_factory::Modem m, const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif) {
|
||||
create_modem_dce(dce_factory::ModemType m, const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif) {
|
||||
dce_factory::Factory f(m);
|
||||
TRY_CATCH_RET_NULL(
|
||||
return f.build_unique(config, std::move(dte), netif);
|
||||
@ -54,19 +54,19 @@ create_modem_dce(dce_factory::Modem m, const dce_config *config, std::shared_ptr
|
||||
}
|
||||
|
||||
std::unique_ptr<DCE> create_SIM7600_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif) {
|
||||
return create_modem_dce(dce_factory::Modem::SIM7600, config, std::move(dte), netif);
|
||||
return create_modem_dce(dce_factory::ModemType::SIM7600, 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) {
|
||||
return create_modem_dce(dce_factory::Modem::SIM800, config, std::move(dte), netif);
|
||||
return create_modem_dce(dce_factory::ModemType::SIM800, config, std::move(dte), netif);
|
||||
}
|
||||
|
||||
std::unique_ptr<DCE> create_BG96_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif) {
|
||||
return create_modem_dce(dce_factory::Modem::BG96, config, std::move(dte), netif);
|
||||
return create_modem_dce(dce_factory::ModemType::BG96, config, std::move(dte), netif);
|
||||
}
|
||||
|
||||
std::unique_ptr<DCE> create_generic_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif) {
|
||||
return create_modem_dce(dce_factory::Modem::GenericModule, config, std::move(dte), netif);
|
||||
return create_modem_dce(dce_factory::ModemType::GenericModule, config, std::move(dte), netif);
|
||||
}
|
||||
|
||||
} // namespace esp_modem
|
||||
|
@ -30,7 +30,7 @@ using namespace esp_modem;
|
||||
struct esp_modem_dce_wrap // need to mimic the polymorphic dispatch as CPP uses templated dispatch
|
||||
{
|
||||
enum class modem_wrap_dte_type { UART, } dte_type;
|
||||
dce_factory::Modem modem_type;
|
||||
dce_factory::ModemType modem_type;
|
||||
DCE* dce;
|
||||
};
|
||||
|
||||
@ -47,18 +47,18 @@ static inline esp_err_t command_response_to_esp_err(command_result res)
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
static inline dce_factory::Modem convert_modem_enum(esp_modem_dce_device_t module)
|
||||
static inline dce_factory::ModemType convert_modem_enum(esp_modem_dce_device_t module)
|
||||
{
|
||||
switch (module) {
|
||||
case ESP_MODEM_DCE_SIM7600:
|
||||
return esp_modem::dce_factory::Modem::SIM7600;
|
||||
return esp_modem::dce_factory::ModemType::SIM7600;
|
||||
case ESP_MODEM_DCE_BG96:
|
||||
return esp_modem::dce_factory::Modem::BG96;
|
||||
return esp_modem::dce_factory::ModemType::BG96;
|
||||
case ESP_MODEM_DCE_SIM800:
|
||||
return esp_modem::dce_factory::Modem::SIM800;
|
||||
return esp_modem::dce_factory::ModemType::SIM800;
|
||||
default:
|
||||
case ESP_MODEM_DCE_GENETIC:
|
||||
return esp_modem::dce_factory::Modem::GenericModule;
|
||||
return esp_modem::dce_factory::ModemType::GenericModule;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,9 +27,13 @@ GenericModule::GenericModule(std::shared_ptr<DTE> dte, const dce_config *config)
|
||||
|
||||
// Helper macros to handle multiple arguments of declared API
|
||||
#define ARGS0
|
||||
#define ARGS1 , x
|
||||
#define ARGS2 , x , y
|
||||
#define ARGS3 , x , y , z
|
||||
#define ARGS1 , p1
|
||||
#define ARGS2 , p1 , p2
|
||||
#define ARGS3 , p1 , p2 , p3
|
||||
#define ARGS4 , p1 , p2 , p3, p4
|
||||
#define ARGS5 , p1 , p2 , p3, p4, p5
|
||||
#define ARGS6 , p1 , p2 , p3, p4, p5, p6
|
||||
|
||||
#define _ARGS(x) ARGS ## x
|
||||
#define ARGS(x) _ARGS(x)
|
||||
|
||||
|
Reference in New Issue
Block a user