Final cleanup of the docs and examples

This commit is contained in:
David Cermak
2021-05-18 19:10:32 +02:00
parent 6e9ddbef32
commit ac475f2560
30 changed files with 359 additions and 332 deletions

View File

@ -53,8 +53,8 @@ template<class SpecificModule>
class DCE_T {
static_assert(std::is_base_of<ModuleIf, SpecificModule>::value, "DCE must be instantiated with Module class only");
public:
explicit DCE_T(const std::shared_ptr<DTE>& dte, std::shared_ptr<SpecificModule> device, esp_netif_t * netif):
dte(dte), module(std::move(device)), netif(dte, netif)
explicit DCE_T(const std::shared_ptr<DTE>& dte, std::shared_ptr<SpecificModule> dev, esp_netif_t * netif):
dte(dte), device(std::move(dev)), netif(dte, netif)
{ }
~DCE_T() = default;
@ -68,21 +68,18 @@ public:
void set_cmux() { set_mode(modem_mode::CMUX_MODE); }
ModuleIf* get_module() { return module.get(); }
SpecificModule* get_module() { return device.get(); }
command_result command(const std::string& command, got_line_cb got_line, uint32_t time_ms)
{
return dte->command(command, std::move(got_line), time_ms);
}
bool set_mode(modem_mode m) { return mode.set(dte.get(), module.get(), netif, m); }
bool set_mode(modem_mode m) { return mode.set(dte.get(), device.get(), netif, m); }
protected:
std::shared_ptr<DTE> dte;
std::shared_ptr<SpecificModule> module;
std::shared_ptr<SpecificModule> device;
Netif netif;
DCE_Mode mode;
};
@ -99,7 +96,7 @@ public:
template <typename ...Agrs> \
return_type name(Agrs&&... args) \
{ \
return module->name(std::forward<Agrs>(args)...); \
return device->name(std::forward<Agrs>(args)...); \
}
DECLARE_ALL_COMMAND_APIS(forwards name(...) { device->name(...); } )