mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-18 04:52:18 +02:00
Final cleanup of the docs and examples
This commit is contained in:
@ -43,10 +43,20 @@ struct PdpContext;
|
||||
*/
|
||||
class GenericModule: public ModuleIf {
|
||||
public:
|
||||
/**
|
||||
* @brief We can construct a generic device with an existent DTE and it's configuration
|
||||
* The configuration could be either the dce-config struct or just a pdp context
|
||||
*/
|
||||
explicit GenericModule(std::shared_ptr<DTE> dte, std::unique_ptr<PdpContext> pdp):
|
||||
dte(std::move(dte)), pdp(std::move(pdp)) {}
|
||||
explicit GenericModule(std::shared_ptr<DTE> dte, const esp_modem_dce_config* config);
|
||||
|
||||
/**
|
||||
* @brief This is a mandatory method for ModuleIf class, which sets up the device
|
||||
* to be able to connect to the network. This typically consists of setting basic
|
||||
* communication parameters and setting the PDP (defining logical access point
|
||||
* to cellular network)
|
||||
*/
|
||||
bool setup_data_mode() override
|
||||
{
|
||||
if (set_echo(false) != command_result::OK)
|
||||
@ -56,6 +66,10 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This is a mandatory method of ModuleIf class, which defines
|
||||
* basic commands for switching between DATA, COMMAND and CMUX modes
|
||||
*/
|
||||
bool set_mode(modem_mode mode) override
|
||||
{
|
||||
if (mode == modem_mode::DATA_MODE) {
|
||||
@ -70,7 +84,17 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Additional method providing runtime configuration of PDP context
|
||||
*/
|
||||
void configure_pdp_context(std::unique_ptr<PdpContext> new_pdp)
|
||||
{
|
||||
pdp = std::move(new_pdp);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Common DCE commands generated from the API AT list
|
||||
*/
|
||||
#define ESP_MODEM_DECLARE_DCE_COMMAND(name, return_type, num, ...) \
|
||||
virtual return_type name(__VA_ARGS__);
|
||||
|
||||
@ -80,8 +104,8 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
std::shared_ptr<DTE> dte;
|
||||
std::unique_ptr<PdpContext> pdp;
|
||||
std::shared_ptr<DTE> dte; /*!< Generic device needs the DTE as a channel talk to the module using AT commands */
|
||||
std::unique_ptr<PdpContext> pdp; /*!< It also needs a PDP data, const information used for setting up cellular network */
|
||||
};
|
||||
|
||||
// Definitions of other supported modules with some specific commands overwritten
|
||||
|
Reference in New Issue
Block a user