From 44541ae1082af9855cb49a4725f92557de599908 Mon Sep 17 00:00:00 2001 From: David Cermak Date: Tue, 30 Mar 2021 08:36:04 +0200 Subject: [PATCH] Updated internal design document --- esp_modem/docs/internal_desing.md | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/esp_modem/docs/internal_desing.md b/esp_modem/docs/internal_desing.md index d74afaf5c..32bee6526 100644 --- a/esp_modem/docs/internal_desing.md +++ b/esp_modem/docs/internal_desing.md @@ -2,7 +2,7 @@ ## Design decisions -* Use C++ (lambdas, templates) with additional C API +* Use C++ with additional C API | esp-modem in C | esp-modem in C++ | |----------------|---------------| @@ -11,7 +11,8 @@ -3908 ``` -* Use exceptions (implement nothrow? possibly using `assert()`) +* Use exceptions + - Use macro wrapper over `try-catch` blocks when exceptions off (use `abort()` if `THROW()`) | exceptions off | exceptions on | |----------------|---------------| @@ -40,21 +41,11 @@ Total image size:~ 879812 bytes (.bin may be padded larger) 8 ``` * Initializes and allocates in the constructor (might throw) - easier code with exceptions ON, with exceptions OFF alloc/init failures are not treated as runtime error (program aborts) -* Implements different devices with template specialization - - Specific device abstraction overrides methods, but does not use virtual function dispatch (modeled as `DCE`) - - Use cases: Implement a minimal device (ModuleIf), add new AT commands (oOnly in compile time). - - Possibly use Module with DTE only (no DCE, no Netif) for sending AT commands without network + - break down long initialization in constructor into more private methods +* Implements different devices using inheritance from `GenericModule`, which is the most general implementation of a common modem + - Internally uses templates with device specialization (modeled as `DCE`) which could be used as well for some special cases, + such as implantation of a minimal device (ModuleIf), add new AT commands (oOnly in compile time), or using the Module with DTE only (no DCE, no Netif) for sending AT commands without network -Example: -``` -class SIM7600: public GenericModule { - using GenericModule::GenericModule; -public: - command_result get_module_name(std::string& name); // overrides, but is no virtual -}; -``` -method `get_module_name()` reimplements the *same* method in `GenericModule` - ## DCE collaboration model The diagram describes how the DCE class collaborates with DTE, PPP and the device abstraction