mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-29 18:27:31 +02:00
Updated internal design document
This commit is contained in:
@ -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<SpecificModule>`)
|
||||
- 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<SpecificModule>`) 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
|
||||
|
Reference in New Issue
Block a user