mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-06-25 17:31:33 +02:00
fix(modem): Added C-API to configure APN
Closes https://github.com/espressif/esp-protocols/issues/485
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -119,8 +119,27 @@ esp_err_t esp_modem_set_error_cb(esp_modem_dce_t *dce, esp_modem_terminal_error_
|
|||||||
*/
|
*/
|
||||||
esp_err_t esp_modem_set_mode(esp_modem_dce_t *dce, esp_modem_dce_mode_t mode);
|
esp_err_t esp_modem_set_mode(esp_modem_dce_t *dce, esp_modem_dce_mode_t mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Convenient function to run arbitrary commands from C-API
|
||||||
|
*
|
||||||
|
* @param dce Modem DCE handle
|
||||||
|
* @param command Command to send
|
||||||
|
* @param got_line_cb Callback function which is called whenever we receive a line
|
||||||
|
* @param timeout_ms Command timeout
|
||||||
|
* @return ESP_OK on success, ESP_FAIL on failure
|
||||||
|
*/
|
||||||
|
|
||||||
esp_err_t esp_modem_command(esp_modem_dce_t *dce, const char *command, esp_err_t(*got_line_cb)(uint8_t *data, size_t len), uint32_t timeout_ms);
|
esp_err_t esp_modem_command(esp_modem_dce_t *dce, const char *command, esp_err_t(*got_line_cb)(uint8_t *data, size_t len), uint32_t timeout_ms);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Sets the APN and configures it into the modem's PDP context
|
||||||
|
*
|
||||||
|
* @param dce Modem DCE handle
|
||||||
|
* @param apn Access Point Name
|
||||||
|
* @return ESP_OK on success
|
||||||
|
*/
|
||||||
|
esp_err_t esp_modem_set_apn(esp_modem_dce_t *dce, const char *apn);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
@ -448,3 +448,10 @@ extern "C" esp_err_t esp_modem_set_baud(esp_modem_dce_t *dce_wrap, int baud)
|
|||||||
{
|
{
|
||||||
return command_response_to_esp_err(dce_wrap->dce->set_baud(baud));
|
return command_response_to_esp_err(dce_wrap->dce->set_baud(baud));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" esp_err_t esp_modem_set_apn(esp_modem_dce_t *dce_wrap, const char *apn)
|
||||||
|
{
|
||||||
|
auto new_pdp = std::unique_ptr<PdpContext>(new PdpContext(apn));
|
||||||
|
dce_wrap->dce->get_module()->configure_pdp_context(std::move(new_pdp));
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user