C++ API Documentation

Similar to the C API Documentation, the basic application workflow consist of

Create DTE and DCE

group ESP_MODEM_INIT_DTE

Create DTE’s.

Typedefs

using dce_config = ::esp_modem_dce_config
using dte_config = ::esp_modem_dte_config

Functions

std::shared_ptr<DTE> create_uart_dte(const dte_config *config)

Create UART DTE.

Parameters

configDTE configuration

Returns

shared ptr to DTE on success nullptr on failure (either due to insufficient memory or wrong dte configuration) if exceptions are disabled the API abort()’s on error

std::shared_ptr<DTE> create_vfs_dte(const dte_config *config)

Create VFS DTE.

Parameters

configDTE configuration

Returns

shared ptr to DTE on success nullptr on failure (either due to insufficient memory or wrong dte configuration) if exceptions are disabled the API abort()’s on error

group ESP_MODEM_INIT_DCE

ESP_MODEM Initialization API for DCE.

Functions

std::unique_ptr<DCE> create_SIM7600_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif)

Create DCE based on SIM7600 module.

Parameters
  • configDCE configuration

  • dte – reference to the communicating DTE

  • netif – reference to the network interface

Returns

unique ptr to the created DCE on success nullptr on failure if exceptions are disabled the API abort()’s on error

std::unique_ptr<DCE> create_SIM7070_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif)

Create DCE based on SIM7070 module.

std::unique_ptr<DCE> create_SIM7000_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif)

Create DCE based on SIM7000 module.

std::unique_ptr<DCE> create_SIM800_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif)

Create DCE based on SIM800 module.

std::unique_ptr<DCE> create_BG96_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif)

Create DCE based on BG96 module.

std::unique_ptr<DCE> create_generic_dce(const dce_config *config, std::shared_ptr<DTE> dte, esp_netif_t *netif)

Create generic DCE.

Mode switching commands

template<class SpecificModule>
class DCE_T

General DCE class templated on a specific module. It is responsible for all the necessary transactions related to switching modes and consequent synergy with aggregated objects of DTE, Netif and a specific Module.

Public Functions

inline void set_data()

Set data mode!

inline command_result pause_netif(bool do_pause, bool force = false, int delay = 1000)

Pauses/Unpauses network temporarily.

Parameters
  • do_pause – true to pause, false to unpause

  • force – true to ignore command failures and continue

Returns

command_result of the underlying commands

Modem commands

Destroy the DCE

The DCE object is created as std::unique_ptr by default and as such doesn’t have to be explicitly destroyed. It simply gets destroyed and cleaned-up automatically if the object goes out of the block scope.