esp-modem(DCE-Factory): Minor corrections per code review

This commit is contained in:
David Čermák
2021-06-01 15:52:39 +08:00
committed by David Cermak
parent 3332c27978
commit dc64f862c4
8 changed files with 131 additions and 83 deletions

View File

@ -9,6 +9,13 @@ The esp-modem actually implements the DCE class, which in turn aggregates these
- :ref:`Netif<netif_impl>` to provide the network connectivity
- :ref:`Module<module_impl>` to define the specific command library
Developers would typically have to
* Add support for a new module
* Implement a generic (common for all modules) AT command
This is explained in the :ref:`Module<module_impl>` section, as :ref:`Adding new module or command<module_addition>`
------------
.. doxygengroup:: ESP_MODEM_DCE
@ -63,6 +70,36 @@ Module abstraction
.. doxygengroup:: ESP_MODEM_MODULE
:members:
.. _module_addition:
Adding new devices
^^^^^^^^^^^^^^^^^^
To support a new module, developers would have to implement a new class derived from :cpp:class:`esp_modem::GenericModule` the same way
as it is described in the :ref:`Advanced user manual<create_custom_module>`. The only difference is that the new class (and factory extension)
would be available in the esp_modem code base.
Implement a new generic command
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Adding a generic command, i.e. the command that is shared for all modules and is included in the :cpp:class:`esp_modem::GenericModule`,
has to be declared first in the ``include/generate/esp_modem_command_declare.inc`` file, which is the single source
of supported command definitions, that is used in:
* public C API
* public CPP API
* generated documentation
* implementation of the command
Therefore, a care must be taken, to correctly specify all parameters and types, especially:
* Keep number of parameters low (<= 6, used in preprocessor's forwarding to the command library)
* Use macros to specify parameter types (as they are used both from C and C++ with different underlying types)
* Parameter names are used only for clarity and documentation, they get expanded to numbered arguments.
Please use the following pattern: ``INT_IN(p1, baud)``, meaning that the parameter is an input integer,
human readable argument name is ``baud``, it's the first argument, so expands to ``p1`` (second argument would be ``p2``, etc)
Command library
^^^^^^^^^^^^^^^