Implement perfect forwarding for command lib

This commit is contained in:
David Cermak
2021-03-07 19:43:45 +01:00
parent 031bbc14ff
commit 904cf94648
29 changed files with 586 additions and 338 deletions

View File

@ -0,0 +1,21 @@
#include <functional>
#include "cxx_include/esp_modem_types.hpp"
#include "cxx_include/esp_modem_dte.hpp"
#include "cxx_include/esp_modem_dce_module.hpp"
template<typename T>
std::shared_ptr<T> create_device(const std::shared_ptr<DTE>& dte, std::string &apn)
{
auto pdp = std::make_unique<PdpContext>(apn);
return std::make_shared<T>(dte, std::move(pdp));
}
std::shared_ptr<GenericModule> create_generic_module(const std::shared_ptr<DTE>& dte, std::string &apn)
{
return create_device<GenericModule>(dte, apn);
}
std::shared_ptr<SIM7600> create_SIM7600_module(const std::shared_ptr<DTE>& dte, std::string &apn)
{
return create_device<SIM7600>(dte, apn);
}