mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-16 03:52:13 +02:00
Merge pull request #72 from david-cermak/bugfix/modem_c_api_pdp_ctx
fix(esp-modem): Add missing set_pdp_context() to C-API
This commit is contained in:
@ -15,6 +15,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "esp_modem_config.h"
|
#include "esp_modem_config.h"
|
||||||
|
#include "esp_netif.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@ -22,7 +23,11 @@ extern "C" {
|
|||||||
|
|
||||||
typedef struct esp_modem_dce_wrap esp_modem_dce_t;
|
typedef struct esp_modem_dce_wrap esp_modem_dce_t;
|
||||||
|
|
||||||
struct PdpContext;
|
typedef struct esp_modem_PdpContext_t {
|
||||||
|
size_t context_id;
|
||||||
|
const char *protocol_type;
|
||||||
|
const char *apn;
|
||||||
|
} esp_modem_PdpContext_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup ESP_MODEM_C_API ESP_MODEM C API
|
* @defgroup ESP_MODEM_C_API ESP_MODEM C API
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#define BOOL_OUT(param, name) bool* _ARG(param, name)
|
#define BOOL_OUT(param, name) bool* _ARG(param, name)
|
||||||
#define INT_OUT(param, name) int* _ARG(param, name)
|
#define INT_OUT(param, name) int* _ARG(param, name)
|
||||||
#define INTEGER_LIST_IN(param, name) const int* _ARG(param, name)
|
#define INTEGER_LIST_IN(param, name) const int* _ARG(param, name)
|
||||||
#define STRUCT_OUT(struct_name, p1) struct struct_name* p1
|
#define STRUCT_OUT(struct_name, p1) esp_modem_ ## struct_name ## _t* p1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DECLARE_ALL_COMMAND_APIS(...) \
|
#define DECLARE_ALL_COMMAND_APIS(...) \
|
||||||
|
@ -393,3 +393,14 @@ extern "C" esp_err_t esp_modem_reset(esp_modem_dce_t *dce_wrap)
|
|||||||
{
|
{
|
||||||
return command_response_to_esp_err(dce_wrap->dce->reset());
|
return command_response_to_esp_err(dce_wrap->dce->reset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" esp_err_t esp_modem_set_pdp_context(esp_modem_dce_t *dce_wrap, esp_modem_PdpContext_t *c_api_pdp)
|
||||||
|
{
|
||||||
|
if (dce_wrap == nullptr || dce_wrap->dce == nullptr) {
|
||||||
|
return ESP_ERR_INVALID_ARG;
|
||||||
|
}
|
||||||
|
esp_modem::PdpContext pdp{c_api_pdp->apn};
|
||||||
|
pdp.context_id = c_api_pdp->context_id;
|
||||||
|
pdp.protocol_type = c_api_pdp->protocol_type;
|
||||||
|
return command_response_to_esp_err(dce_wrap->dce->set_pdp_context(pdp));
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user