2021-03-07 19:43:45 +01:00
|
|
|
//
|
|
|
|
// Created by david on 3/8/21.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "cxx_include/esp_modem_dce_module.hpp"
|
2021-03-24 21:06:27 +01:00
|
|
|
#include "generate/esp_modem_command_declare.inc"
|
2021-03-07 19:43:45 +01:00
|
|
|
|
2021-03-28 20:22:44 +02:00
|
|
|
GenericModule::GenericModule(std::shared_ptr<DTE> dte, const esp_modem_dce_config *config):
|
2021-03-28 13:38:20 +02:00
|
|
|
dte(std::move(dte)), pdp(std::make_unique<PdpContext>(config->apn)) {}
|
|
|
|
|
|
|
|
|
2021-03-24 21:06:27 +01:00
|
|
|
#define ARGS0
|
|
|
|
#define ARGS1 , x
|
|
|
|
#define _ARGS(x) ARGS ## x
|
|
|
|
#define ARGS(x) _ARGS(x)
|
|
|
|
#define TEMPLATE_ARG
|
|
|
|
#define ESP_MODEM_DECLARE_DCE_COMMAND(name, return_type, arg_nr, MUX_ARG, ...) \
|
|
|
|
return_type GenericModule::name(__VA_ARGS__) { return esp_modem::dce_commands::name(dte.get() ARGS(arg_nr) ); }
|
|
|
|
|
|
|
|
DECLARE_ALL_COMMAND_APIS(return_type name(...) { forwards to esp_modem::dce_commands::name(...) } )
|
|
|
|
|
|
|
|
#undef ESP_MODEM_DECLARE_DCE_COMMAND
|
|
|
|
|
|
|
|
|
2021-03-28 13:38:20 +02:00
|
|
|
|
2021-03-28 20:22:44 +02:00
|
|
|
command_result SIM7600::get_module_name(std::string& name)
|
|
|
|
{
|
|
|
|
name = "7600";
|
|
|
|
return command_result::OK;
|
|
|
|
}
|
2021-03-07 19:43:45 +01:00
|
|
|
|
|
|
|
command_result SIM800::get_module_name(std::string& name)
|
|
|
|
{
|
|
|
|
name = "800L";
|
|
|
|
return command_result::OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
command_result BG96::get_module_name(std::string& name)
|
|
|
|
{
|
|
|
|
name = "BG96";
|
|
|
|
return command_result::OK;
|
|
|
|
}
|