Fork fix: the SDIO wedge is FIXED (esp-hosted-mcu #167)
Root cause (verified against our exact IDF tree, not the community guess): the "258" in "sdio_write_task: Failed to send data: 258" is NOT a timeout (that is 263). 258 = 0x102 = ESP_ERR_INVALID_ARG. On the ESP32-P4, block- mode CMD53 writes require the SOURCE buffer to be 64-byte (cache-line) aligned; the IDF sdmmc driver rejects a misaligned source with INVALID_ARG BEFORE any bus activity. esp_hosts write loop then declares "Unrecoverable host sdio state" and reboots the whole P4. The audio TX payload is not 64-aligned, so streaming mic audio wedged on the very FIRST frame (which is exactly what we saw: listening -> instant Failed to send -> reboot). This also explains why buffer/queue/clock/retry tuning all did nothing: the write never reached the bus. And why our symptom was instant, not after ~100 writes (the community block-mode-desync theory) — it is the first misaligned buffer, every time. Fix: vendored esp_hosted 2.12.11 as an editable local component (overrides the registry copy) and bounce a misaligned TX payload through one aligned DMA scratch buffer in hosted_sdio_write_block (port_esp_hosted_host_sdio.c). TX is serialized by the bus lock so a single static bounce buffer is safe; freed in hosted_sdio_deinit. Host-only change — no C6 reflash. VERIFIED ON HARDWARE (autonomous self-test): 40s of continuous mic-audio upstream streaming — the traffic that previously wedged on the first frame — ran clean, zero timeouts, zero reboots. A guarded SDIO_TX_SELFTEST harness is kept (compiled out) for future SDIO stress testing. Credit: root cause + patch designed via multi-agent investigation; the precise 258=INVALID_ARG decode (correcting the upstream community timeout assumption) came from checking our actual esp_err.h. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#ifndef __RPC_CORE_H
|
||||
#define __RPC_CORE_H
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include "transport_drv.h"
|
||||
#include "rpc_slave_if.h"
|
||||
#include "port_esp_hosted_host_log.h"
|
||||
#include "port_esp_hosted_host_config.h"
|
||||
|
||||
#ifndef BIT
|
||||
#define BIT(n) (1UL << (n))
|
||||
#endif
|
||||
|
||||
#define MAX_SSID_LENGTH 32
|
||||
#define MIN_PWD_LENGTH 8
|
||||
#define MAX_PWD_LENGTH 64
|
||||
#define MIN_CHNL_NO 1
|
||||
#define MAX_CHNL_NO 11
|
||||
#define MIN_CONN_NO 1
|
||||
#define MAX_CONN_NO 10
|
||||
|
||||
#define CLEANUP_APP_MSG(app_msg) do { \
|
||||
if (app_msg) { \
|
||||
if (app_msg->app_free_buff_hdl) { \
|
||||
if (app_msg->app_free_buff_func) { \
|
||||
app_msg->app_free_buff_func(app_msg->app_free_buff_hdl); \
|
||||
app_msg->app_free_buff_hdl = NULL; \
|
||||
} \
|
||||
} \
|
||||
HOSTED_FREE(app_msg); \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
#define RPC_FAIL_ON_NULL_PRINT(msGparaM, prinTmsG) \
|
||||
if (!msGparaM) { \
|
||||
ESP_LOGE(TAG, prinTmsG"\n"); \
|
||||
goto fail_parse_rpc_msg; \
|
||||
}
|
||||
|
||||
#define RPC_FAIL_ON_NULL(msGparaM) \
|
||||
if (!rpc_msg->msGparaM) { \
|
||||
ESP_LOGE(TAG, "Failed to process rx data\n"); \
|
||||
goto fail_parse_rpc_msg; \
|
||||
}
|
||||
|
||||
|
||||
#define RPC_FREE_BUFFS() { \
|
||||
uint8_t idx = 0; \
|
||||
for (idx=0;idx<app_req->n_rpc_free_buff_hdls; idx++) \
|
||||
HOSTED_FREE(app_req->rpc_free_buff_hdls[idx]); \
|
||||
}
|
||||
|
||||
typedef struct q_element {
|
||||
void *buf;
|
||||
int buf_len;
|
||||
} esp_queue_elem_t;
|
||||
|
||||
//g_h.funcs->_h_memcpy(DsT.data, SrC, len_to_cp);
|
||||
|
||||
#if 0
|
||||
#define RPC_REQ_COPY_BYTES(DsT,SrC,SizE) { \
|
||||
if (SizE && SrC) { \
|
||||
DsT.data = (uint8_t *) g_h.funcs->_h_calloc(1, SizE); \
|
||||
if (!DsT.data) { \
|
||||
hosted_log("Failed to allocate memory for req.%s\n",#DsT); \
|
||||
failure_status = RPC_ERR_MEMORY_FAILURE; \
|
||||
goto fail_req; \
|
||||
} \
|
||||
buff_to_free[num_buff_to_free++] = (uint8_t*)DsT.data; \
|
||||
g_h.funcs->_h_memcpy(DsT.data, SrC, SizE); \
|
||||
DsT.len = SizE; \
|
||||
} \
|
||||
}
|
||||
#endif
|
||||
#define RPC_REQ_COPY_BYTES(DsT,SrC,SizE) { \
|
||||
if (SizE && SrC) { \
|
||||
DsT.data = SrC; \
|
||||
DsT.len = SizE; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define RPC_REQ_COPY_STR(DsT,SrC,MaxSizE) { \
|
||||
if (SrC) { \
|
||||
RPC_REQ_COPY_BYTES(DsT, SrC, H_MIN(strlen((char*)SrC)+1,MaxSizE)); \
|
||||
} \
|
||||
}
|
||||
|
||||
int rpc_core_init(void);
|
||||
int rpc_core_start(void);
|
||||
int rpc_core_stop(void);
|
||||
int rpc_core_deinit(void);
|
||||
/*
|
||||
* Allows user app to create low level protobuf request
|
||||
* returns SUCCESS(0) or FAILURE(-1)
|
||||
*/
|
||||
int rpc_send_req(ctrl_cmd_t *app_req);
|
||||
|
||||
/* When request is sent without an async callback, this function will be called
|
||||
* It will wait for control response or timeout for control response
|
||||
* This is only used in synchrounous control path
|
||||
*
|
||||
* Input:
|
||||
* > req - control request from user
|
||||
*
|
||||
* Returns: control response or NULL in case of timeout
|
||||
*
|
||||
**/
|
||||
ctrl_cmd_t * rpc_wait_and_parse_sync_resp(ctrl_cmd_t *req);
|
||||
|
||||
|
||||
/* Checks if async control response callback is available
|
||||
* in argument passed of type control request
|
||||
*
|
||||
* Input:
|
||||
* > req - control request from user
|
||||
*
|
||||
* Returns:
|
||||
* > CALLBACK_AVAILABLE - if a non NULL asynchronous control response
|
||||
* callback is available
|
||||
* In case of failures -
|
||||
* > MSG_ID_OUT_OF_ORDER - if request msg id is unsupported
|
||||
* > CALLBACK_NOT_REGISTERED - if aync callback is not available
|
||||
**/
|
||||
int compose_rpc_req(Rpc *req, ctrl_cmd_t *app_req, int32_t *failure_status);
|
||||
|
||||
int is_event_callback_registered(int event);
|
||||
|
||||
int rpc_parse_evt(Rpc *rpc_msg, ctrl_cmd_t *app_ntfy);
|
||||
|
||||
int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp);
|
||||
|
||||
#if H_PEER_DATA_TRANSFER
|
||||
int rpc_evt_register_custom_callback(uint32_t msg_id_exp,
|
||||
void (*callback)(uint32_t msg_id_recvd, const uint8_t *data_recvd, size_t data_len_recvd, void *local_context),
|
||||
void *local_context);
|
||||
#endif
|
||||
|
||||
#endif /* __RPC_CORE_H */
|
||||
@@ -0,0 +1,505 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "rpc_core.h"
|
||||
#include "rpc_utils.h"
|
||||
#include "rpc_slave_if.h"
|
||||
#include "esp_hosted_transport.h"
|
||||
#include "port_esp_hosted_host_log.h"
|
||||
#include "port_esp_hosted_host_config.h"
|
||||
#include "port_esp_hosted_host_os.h"
|
||||
#include "esp_hosted_bitmasks.h"
|
||||
#include "esp_hosted_os_abstraction.h"
|
||||
|
||||
DEFINE_LOG_TAG(rpc_evt);
|
||||
|
||||
#ifdef H_PEER_DATA_TRANSFER
|
||||
#define MAX_CUSTOM_CALLBACKS H_MAX_CUSTOM_MSG_HANDLERS
|
||||
/* Callback slots (empty slot has callback = NULL, msg_id = -1 is invalid sentinel) */
|
||||
static struct {
|
||||
uint32_t msg_id;
|
||||
void (*callback)(uint32_t msg_id_recvd, const uint8_t *data_recvd, size_t data_len_recvd, void *local_context);
|
||||
void *local_context;
|
||||
} custom_callbacks[MAX_CUSTOM_CALLBACKS] = {
|
||||
[0 ... (MAX_CUSTOM_CALLBACKS - 1)] = {
|
||||
.msg_id = (uint32_t)-1,
|
||||
.callback = NULL
|
||||
}
|
||||
};
|
||||
|
||||
static void* custom_callbacks_mutex = NULL;
|
||||
|
||||
|
||||
/* Register callback for specific message ID */
|
||||
int rpc_evt_register_custom_callback(uint32_t msg_id_exp,
|
||||
void (*callback)(uint32_t msg_id_recvd, const uint8_t *data_recvd, size_t data_len_recvd, void *local_context),
|
||||
void *local_context)
|
||||
{
|
||||
/* Validate message ID (-1/0xFFFFFFFF is invalid) */
|
||||
if (msg_id_exp == (uint32_t)-1) {
|
||||
ESP_LOGE(TAG, "Invalid message ID 0xFFFFFFFF");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* Initialize mutex on first use */
|
||||
if (!custom_callbacks_mutex) {
|
||||
custom_callbacks_mutex = g_h.funcs->_h_create_mutex();
|
||||
if (!custom_callbacks_mutex) {
|
||||
ESP_LOGE(TAG, "Failed to create mutex");
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
g_h.funcs->_h_lock_mutex(custom_callbacks_mutex, HOSTED_BLOCK_MAX);
|
||||
|
||||
/* First, check if this msg_id_exp is already registered */
|
||||
for (int i = 0; i < MAX_CUSTOM_CALLBACKS; i++) {
|
||||
if (custom_callbacks[i].msg_id == msg_id_exp) {
|
||||
/* Found existing registration */
|
||||
if (callback == NULL) {
|
||||
/* Deregister: clean up this entry */
|
||||
custom_callbacks[i].msg_id = (uint32_t)-1; /* Mark as invalid */
|
||||
custom_callbacks[i].callback = NULL;
|
||||
custom_callbacks[i].local_context = NULL;
|
||||
ESP_LOGD(TAG, "Deregistered callback for msg_id %" PRIu32, msg_id_exp);
|
||||
g_h.funcs->_h_unlock_mutex(custom_callbacks_mutex);
|
||||
return SUCCESS;
|
||||
} else {
|
||||
/* Update existing callback */
|
||||
custom_callbacks[i].callback = callback;
|
||||
custom_callbacks[i].local_context = local_context;
|
||||
ESP_LOGD(TAG, "Updated callback for msg_id %" PRIu32, msg_id_exp);
|
||||
g_h.funcs->_h_unlock_mutex(custom_callbacks_mutex);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* msg_id_exp not found - need to register new */
|
||||
if (callback == NULL) {
|
||||
/* Cannot deregister what doesn't exist */
|
||||
ESP_LOGD(TAG, "Cannot deregister msg_id %" PRIu32 " - not registered", msg_id_exp);
|
||||
g_h.funcs->_h_unlock_mutex(custom_callbacks_mutex);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
/* Find empty slot for new registration */
|
||||
for (int i = 0; i < MAX_CUSTOM_CALLBACKS; i++) {
|
||||
if (custom_callbacks[i].callback == NULL) {
|
||||
custom_callbacks[i].msg_id = msg_id_exp;
|
||||
custom_callbacks[i].callback = callback;
|
||||
custom_callbacks[i].local_context = local_context;
|
||||
ESP_LOGD(TAG, "Registered callback for msg_id %" PRIu32, msg_id_exp);
|
||||
g_h.funcs->_h_unlock_mutex(custom_callbacks_mutex);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
ESP_LOGW(TAG, "No space for callback (max %d)", MAX_CUSTOM_CALLBACKS);
|
||||
g_h.funcs->_h_unlock_mutex(custom_callbacks_mutex);
|
||||
return FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* For new RPC event (from ESP to host), add up switch case for your message
|
||||
* In general, it is better to subscribe all events or notifications
|
||||
* at slave side & selective subscribe the events at host side.
|
||||
* This way, all the events reach at host and host will decide
|
||||
* if incoming event is expected to be entertained or dropped
|
||||
*
|
||||
* If you are concerned over battery usage, it is code further could be
|
||||
* optimized that only selective events are subscribed at slave and host both sides
|
||||
*
|
||||
* This function will copy rpc event from `Rpc` into
|
||||
* app structure `ctrl_cmd_t`
|
||||
* This function is called after
|
||||
* 1. Protobuf decoding is successful
|
||||
* 2. There is non NULL event callback is available
|
||||
**/
|
||||
int rpc_parse_evt(Rpc *rpc_msg, ctrl_cmd_t *app_ntfy)
|
||||
{
|
||||
if (!rpc_msg || !app_ntfy) {
|
||||
ESP_LOGE(TAG, "NULL rpc event or App struct\n");
|
||||
goto fail_parse_rpc_msg;
|
||||
}
|
||||
|
||||
app_ntfy->msg_type = RPC_TYPE__Event;
|
||||
app_ntfy->msg_id = rpc_msg->msg_id;
|
||||
app_ntfy->resp_event_status = SUCCESS;
|
||||
|
||||
switch (rpc_msg->msg_id) {
|
||||
|
||||
case RPC_ID__Event_ESPInit: {
|
||||
ESP_LOGI(TAG, "EVENT: ESP INIT\n");
|
||||
RPC_FAIL_ON_NULL(event_esp_init);
|
||||
app_ntfy->u.e_init.cp_reset_reason = rpc_msg->event_esp_init->cp_reset_reason;
|
||||
break;
|
||||
} case RPC_ID__Event_Heartbeat: {
|
||||
ESP_LOGD(TAG, "EVENT: Heartbeat\n");
|
||||
RPC_FAIL_ON_NULL(event_heartbeat);
|
||||
app_ntfy->u.e_heartbeat.hb_num = rpc_msg->event_heartbeat->hb_num;
|
||||
break;
|
||||
} case RPC_ID__Event_AP_StaConnected: {
|
||||
wifi_event_ap_staconnected_t * p_a = &(app_ntfy->u.e_wifi_ap_staconnected);
|
||||
RpcEventAPStaConnected * p_c = rpc_msg->event_ap_sta_connected;
|
||||
|
||||
RPC_FAIL_ON_NULL(event_ap_sta_connected);
|
||||
app_ntfy->resp_event_status = p_c->resp;
|
||||
|
||||
if(SUCCESS==app_ntfy->resp_event_status) {
|
||||
RPC_FAIL_ON_NULL_PRINT(p_c->mac.data, "NULL mac");
|
||||
g_h.funcs->_h_memcpy(p_a->mac, p_c->mac.data, p_c->mac.len);
|
||||
ESP_LOGI(TAG, "EVENT: AP -> sta connected mac[" MACSTR "] (len:%u)",
|
||||
MAC2STR(p_a->mac), p_c->mac.len);
|
||||
}
|
||||
p_a->aid = p_c->aid;
|
||||
p_a->is_mesh_child = p_c->is_mesh_child;
|
||||
|
||||
break;
|
||||
} case RPC_ID__Event_AP_StaDisconnected: {
|
||||
wifi_event_ap_stadisconnected_t * p_a = &(app_ntfy->u.e_wifi_ap_stadisconnected);
|
||||
RpcEventAPStaDisconnected * p_c = rpc_msg->event_ap_sta_disconnected;
|
||||
|
||||
ESP_LOGD(TAG, "EVENT: AP -> sta disconnected");
|
||||
RPC_FAIL_ON_NULL(event_ap_sta_disconnected);
|
||||
app_ntfy->resp_event_status = p_c->resp;
|
||||
|
||||
if(SUCCESS==app_ntfy->resp_event_status) {
|
||||
RPC_FAIL_ON_NULL_PRINT(p_c->mac.data, "NULL mac");
|
||||
g_h.funcs->_h_memcpy(p_a->mac, p_c->mac.data, p_c->mac.len);
|
||||
ESP_LOGI(TAG, "EVENT: AP -> sta DISconnected mac[" MACSTR "] (len:%u)",
|
||||
MAC2STR(p_a->mac), p_c->mac.len);
|
||||
}
|
||||
|
||||
p_a->aid = p_c->aid;
|
||||
p_a->is_mesh_child = p_c->is_mesh_child;
|
||||
p_a->reason = p_c->reason;
|
||||
|
||||
break;
|
||||
#if H_WIFI_HE_SUPPORT
|
||||
} case RPC_ID__Event_StaItwtSetup: {
|
||||
wifi_event_sta_itwt_setup_t * p_a = &(app_ntfy->u.e_wifi_sta_itwt_setup);
|
||||
RpcEventStaItwtSetup * p_c = rpc_msg->event_sta_itwt_setup;
|
||||
|
||||
ESP_LOGD(TAG, "EVENT: iTWT -> setup");
|
||||
RPC_FAIL_ON_NULL(event_sta_itwt_setup);
|
||||
app_ntfy->resp_event_status = p_c->resp;
|
||||
|
||||
p_a->config.setup_cmd = p_c->config->setup_cmd;
|
||||
p_a->config.trigger = H_GET_BIT(WIFI_ITWT_CONFIG_1_trigger_BIT, p_c->config->bitmask_1);
|
||||
p_a->config.flow_type = H_GET_BIT(WIFI_ITWT_CONFIG_1_flow_type_BIT, p_c->config->bitmask_1);
|
||||
// WIFI_ITWT_CONFIG_1_flow_id_BIT is three bits wide
|
||||
p_a->config.flow_id = (p_c->config->bitmask_1 >> WIFI_ITWT_CONFIG_1_flow_id_BIT) & 0x07;
|
||||
// WIFI_ITWT_CONFIG_1_wake_invl_expn_BIT is five bits wide
|
||||
p_a->config.wake_invl_expn = (p_c->config->bitmask_1 >> WIFI_ITWT_CONFIG_1_wake_invl_expn_BIT) & 0x1F;
|
||||
p_a->config.wake_duration_unit = H_GET_BIT(WIFI_ITWT_CONFIG_1_wake_duration_unit_BIT, p_c->config->bitmask_1);
|
||||
#if H_DECODE_WIFI_RESERVED_FIELD
|
||||
p_a->config.reserved = (p_c->config->bitmask_1 >> WIFI_ITWT_CONFIG_1_MAX_USED_BIT) & WIFI_ITWT_CONFIG_1_RESERVED_BITMASK;
|
||||
#endif
|
||||
p_a->config.min_wake_dura = p_c->config->min_wake_dura;
|
||||
p_a->config.wake_invl_mant = p_c->config->wake_invl_mant;
|
||||
p_a->config.twt_id = p_c->config->twt_id;
|
||||
p_a->config.timeout_time_ms = p_c->config->timeout_time_ms;
|
||||
p_a->status = p_c->status;
|
||||
p_a->reason = p_c->reason;
|
||||
p_a->target_wake_time = p_c->target_wake_time;
|
||||
|
||||
break;
|
||||
} case RPC_ID__Event_StaItwtTeardown: {
|
||||
wifi_event_sta_itwt_teardown_t * p_a = &(app_ntfy->u.e_wifi_sta_itwt_teardown);
|
||||
RpcEventStaItwtTeardown * p_c = rpc_msg->event_sta_itwt_teardown;
|
||||
|
||||
ESP_LOGD(TAG, "EVENT: iTWT -> teardown");
|
||||
RPC_FAIL_ON_NULL(event_sta_itwt_teardown);
|
||||
app_ntfy->resp_event_status = p_c->resp;
|
||||
|
||||
p_a->flow_id = p_c->flow_id;
|
||||
p_a->status = p_c->status;
|
||||
|
||||
break;
|
||||
} case RPC_ID__Event_StaItwtSuspend: {
|
||||
wifi_event_sta_itwt_suspend_t * p_a = &(app_ntfy->u.e_wifi_sta_itwt_suspend);
|
||||
RpcEventStaItwtSuspend * p_c = rpc_msg->event_sta_itwt_suspend;
|
||||
int num_elements = sizeof(p_a->actual_suspend_time_ms) / sizeof(p_a->actual_suspend_time_ms[0]);
|
||||
int i;
|
||||
|
||||
ESP_LOGD(TAG, "EVENT: iTWT -> suspend");
|
||||
RPC_FAIL_ON_NULL(event_sta_itwt_suspend);
|
||||
app_ntfy->resp_event_status = p_c->resp;
|
||||
|
||||
p_a->status = p_c->status;
|
||||
p_a->flow_id_bitmap = p_c->flow_id_bitmap;
|
||||
|
||||
memset(p_a->actual_suspend_time_ms, 0, sizeof(p_a->actual_suspend_time_ms));
|
||||
for (i = 0; i < H_MIN(num_elements, p_c->n_actual_suspend_time_ms); i++) {
|
||||
p_a->actual_suspend_time_ms[i] = p_c->actual_suspend_time_ms[i];
|
||||
}
|
||||
|
||||
break;
|
||||
} case RPC_ID__Event_StaItwtProbe: {
|
||||
wifi_event_sta_itwt_probe_t * p_a = &(app_ntfy->u.e_wifi_sta_itwt_probe);
|
||||
RpcEventStaItwtProbe * p_c = rpc_msg->event_sta_itwt_probe;
|
||||
|
||||
ESP_LOGD(TAG, "EVENT: iTWT -> probe");
|
||||
RPC_FAIL_ON_NULL(event_sta_itwt_probe);
|
||||
app_ntfy->resp_event_status = p_c->resp;
|
||||
|
||||
p_a->status = p_c->status;
|
||||
p_a->reason = p_c->reason;
|
||||
|
||||
break;
|
||||
#endif
|
||||
} case RPC_ID__Event_WifiEventNoArgs: {
|
||||
RPC_FAIL_ON_NULL(event_wifi_event_no_args);
|
||||
app_ntfy->resp_event_status = rpc_msg->event_wifi_event_no_args->resp;
|
||||
ESP_LOGI(TAG, "Event [0x%" PRIx32 "] received", rpc_msg->event_wifi_event_no_args->event_id);
|
||||
app_ntfy->u.e_wifi_simple.wifi_event_id = rpc_msg->event_wifi_event_no_args->event_id;
|
||||
|
||||
switch (rpc_msg->event_wifi_event_no_args->event_id) {
|
||||
/* basic events populated, not all */
|
||||
case WIFI_EVENT_WIFI_READY:
|
||||
ESP_LOGI(TAG, "EVT rcvd: Wi-Fi Ready");
|
||||
break;
|
||||
case WIFI_EVENT_SCAN_DONE:
|
||||
ESP_LOGI(TAG, "EVT rcvd: Wi-Fi scan done");
|
||||
break;
|
||||
case WIFI_EVENT_STA_START:
|
||||
ESP_LOGI(TAG, "EVT rcvd: Wi-Fi Start");
|
||||
break;
|
||||
case WIFI_EVENT_STA_STOP:
|
||||
ESP_LOGI(TAG, "EVT rcvd: Wi-Fi Stop");
|
||||
break;
|
||||
case WIFI_EVENT_STA_CONNECTED:
|
||||
ESP_LOGI(TAG, "EVT rcvd: Wi-Fi Connected");
|
||||
break;
|
||||
case WIFI_EVENT_STA_DISCONNECTED:
|
||||
ESP_LOGI(TAG, "EVT rcvd: Wi-Fi Disconnected");
|
||||
break;
|
||||
case WIFI_EVENT_STA_AUTHMODE_CHANGE:
|
||||
ESP_LOGI(TAG, "EVT rcvd: Wi-Fi AuthMode change");
|
||||
break;
|
||||
case WIFI_EVENT_AP_START:
|
||||
ESP_LOGI(TAG, "EVT rcvd: Wi-Fi AP Start");
|
||||
break;
|
||||
case WIFI_EVENT_AP_STOP:
|
||||
ESP_LOGI(TAG, "EVT rcvd: Wi-Fi AP stop");
|
||||
break;
|
||||
case WIFI_EVENT_HOME_CHANNEL_CHANGE:
|
||||
ESP_LOGI(TAG, "EVT rcvd: Wi-Fi Home channel change");
|
||||
break;
|
||||
default:
|
||||
ESP_LOGI(TAG, "EVT rcvd: Wi-Fi Event[%" PRId32 "] ignored", rpc_msg->event_wifi_event_no_args->event_id);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
} case RPC_ID__Event_StaScanDone: {
|
||||
RpcEventStaScanDone *p_c = rpc_msg->event_sta_scan_done;
|
||||
wifi_event_sta_scan_done_t *p_a = &app_ntfy->u.e_wifi_sta_scan_done;
|
||||
RPC_FAIL_ON_NULL(event_sta_scan_done);
|
||||
app_ntfy->resp_event_status = p_c->resp;
|
||||
ESP_LOGI(TAG, "Event Scan Done, %" PRIu32 " items", rpc_msg->event_sta_scan_done->scan_done->number);
|
||||
p_a->status = p_c->scan_done->status;
|
||||
p_a->number = p_c->scan_done->number;
|
||||
p_a->scan_id = p_c->scan_done->scan_id;
|
||||
break;
|
||||
} case RPC_ID__Event_StaConnected: {
|
||||
RPC_FAIL_ON_NULL(event_sta_connected);
|
||||
RPC_FAIL_ON_NULL(event_sta_connected->sta_connected);
|
||||
WifiEventStaConnected *p_c = rpc_msg->event_sta_connected->sta_connected;
|
||||
wifi_event_sta_connected_t *p_a = &app_ntfy->u.e_wifi_sta_connected;
|
||||
app_ntfy->resp_event_status = rpc_msg->event_sta_connected->resp;
|
||||
if (SUCCESS == app_ntfy->resp_event_status) {
|
||||
RPC_FAIL_ON_NULL_PRINT(p_c->ssid.data, "NULL SSID");
|
||||
g_h.funcs->_h_memcpy(p_a->ssid, p_c->ssid.data, p_c->ssid.len);
|
||||
p_a->ssid_len = p_c->ssid_len;
|
||||
RPC_FAIL_ON_NULL_PRINT(p_c->bssid.data, "NULL BSSID");
|
||||
g_h.funcs->_h_memcpy(p_a->bssid, p_c->bssid.data, p_c->bssid.len);
|
||||
p_a->channel = p_c->channel;
|
||||
p_a->authmode = p_c->authmode;
|
||||
p_a->aid = p_c->aid;
|
||||
}
|
||||
break;
|
||||
} case RPC_ID__Event_StaDisconnected: {
|
||||
RPC_FAIL_ON_NULL(event_sta_disconnected);
|
||||
RPC_FAIL_ON_NULL(event_sta_disconnected->sta_disconnected);
|
||||
WifiEventStaDisconnected *p_c = rpc_msg->event_sta_disconnected->sta_disconnected;
|
||||
wifi_event_sta_disconnected_t *p_a = &app_ntfy->u.e_wifi_sta_disconnected;
|
||||
app_ntfy->resp_event_status = rpc_msg->event_sta_connected->resp;
|
||||
if (SUCCESS == app_ntfy->resp_event_status) {
|
||||
RPC_FAIL_ON_NULL_PRINT(p_c->ssid.data, "NULL SSID");
|
||||
g_h.funcs->_h_memcpy(p_a->ssid, p_c->ssid.data, p_c->ssid.len);
|
||||
p_a->ssid_len = p_c->ssid_len;
|
||||
RPC_FAIL_ON_NULL_PRINT(p_c->bssid.data, "NULL BSSID");
|
||||
g_h.funcs->_h_memcpy(p_a->bssid, p_c->bssid.data, p_c->bssid.len);
|
||||
p_a->reason = p_c->reason;
|
||||
p_a->rssi = p_c->rssi;
|
||||
}
|
||||
break;
|
||||
} case RPC_ID__Event_DhcpDnsStatus: {
|
||||
RPC_FAIL_ON_NULL(event_dhcp_dns);
|
||||
RpcEventDhcpDnsStatus *p_c = rpc_msg->event_dhcp_dns;
|
||||
rpc_set_dhcp_dns_status_t* p_a = &app_ntfy->u.slave_dhcp_dns_status;
|
||||
app_ntfy->resp_event_status = rpc_msg->event_dhcp_dns->resp;
|
||||
|
||||
p_a->iface = p_c->iface;
|
||||
p_a->dhcp_up = p_c->dhcp_up;
|
||||
p_a->dns_up = p_c->dns_up;
|
||||
p_a->dns_type = p_c->dns_type;
|
||||
p_a->net_link_up = p_c->net_link_up;
|
||||
|
||||
g_h.funcs->_h_memcpy(p_a->dhcp_ip, p_c->dhcp_ip.data, p_c->dhcp_ip.len);
|
||||
g_h.funcs->_h_memcpy(p_a->dhcp_nm, p_c->dhcp_nm.data, p_c->dhcp_nm.len);
|
||||
g_h.funcs->_h_memcpy(p_a->dhcp_gw, p_c->dhcp_gw.data, p_c->dhcp_gw.len);
|
||||
g_h.funcs->_h_memcpy(p_a->dns_ip, p_c->dns_ip.data, p_c->dns_ip.len);
|
||||
|
||||
break;
|
||||
#if H_MEM_MONITOR
|
||||
} case RPC_ID__Event_MemMonitor: {
|
||||
RPC_FAIL_ON_NULL(event_mem_monitor);
|
||||
RPC_FAIL_ON_NULL(event_mem_monitor->curr_internal);
|
||||
RPC_FAIL_ON_NULL(event_mem_monitor->curr_internal->mem_dma);
|
||||
RPC_FAIL_ON_NULL(event_mem_monitor->curr_internal->mem_8bit);
|
||||
RPC_FAIL_ON_NULL(event_mem_monitor->curr_external);
|
||||
RPC_FAIL_ON_NULL(event_mem_monitor->curr_external->mem_dma);
|
||||
RPC_FAIL_ON_NULL(event_mem_monitor->curr_external->mem_8bit);
|
||||
|
||||
RpcEventMemMonitor *p_c = rpc_msg->event_mem_monitor;
|
||||
esp_hosted_event_mem_info_t *p_a = &app_ntfy->u.e_mem_info;
|
||||
|
||||
p_a->curr_total_free_heap_size = p_c->curr_total_free_heap_size;
|
||||
p_a->curr_min_free_heap_size = p_c->curr_min_free_heap_size;
|
||||
p_a->curr_internal.cap_dma.free_size = p_c->curr_internal->mem_dma->free_size;
|
||||
p_a->curr_internal.cap_dma.largest_free_block = p_c->curr_internal->mem_dma->largest_free_block;
|
||||
p_a->curr_internal.cap_8bit.free_size = p_c->curr_internal->mem_8bit->free_size;
|
||||
p_a->curr_internal.cap_8bit.largest_free_block = p_c->curr_internal->mem_8bit->largest_free_block;
|
||||
p_a->curr_external.cap_dma.free_size = p_c->curr_external->mem_dma->free_size;
|
||||
p_a->curr_external.cap_dma.largest_free_block = p_c->curr_external->mem_dma->largest_free_block;
|
||||
p_a->curr_external.cap_8bit.free_size = p_c->curr_external->mem_8bit->free_size;
|
||||
p_a->curr_external.cap_8bit.largest_free_block = p_c->curr_external->mem_8bit->largest_free_block;
|
||||
break;
|
||||
#endif
|
||||
#if H_SUPP_DPP_SUPPORT
|
||||
}
|
||||
case RPC_ID__Event_SuppDppUriReady: {
|
||||
RpcEventSuppDppUriReady *p_c = rpc_msg->event_supp_dpp_uri_ready;
|
||||
supp_wifi_event_dpp_uri_ready_t *p_a = &app_ntfy->u.e_dpp_uri_ready;
|
||||
app_ntfy->resp_event_status = rpc_msg->event_supp_dpp_uri_ready->resp;
|
||||
|
||||
g_h.funcs->_h_memset(p_a->uri, 0, DPP_URI_LEN_MAX);
|
||||
|
||||
p_a->uri_data_len = p_c->qrcode.len;
|
||||
if (p_a->uri_data_len <= DPP_URI_LEN_MAX) {
|
||||
g_h.funcs->_h_memcpy(p_a->uri, p_c->qrcode.data, p_a->uri_data_len);
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Incoming URI is too long (over %d bytes). Increase Kconfig ESP_HOSTED_DPP_URI_LEN_MAX for proper operation", DPP_URI_LEN_MAX - 1);
|
||||
p_a->uri_data_len = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RPC_ID__Event_SuppDppCfgRecvd: {
|
||||
RpcEventSuppDppCfgRecvd *p_c = rpc_msg->event_supp_dpp_cfg_recvd;
|
||||
supp_wifi_event_dpp_config_received_t *p_a = &app_ntfy->u.e_dpp_config_received;
|
||||
app_ntfy->resp_event_status = rpc_msg->event_supp_dpp_uri_ready->resp;
|
||||
|
||||
rpc_copy_wifi_sta_config(&p_a->wifi_cfg.sta, p_c->cfg->sta);
|
||||
break;
|
||||
}
|
||||
case RPC_ID__Event_SuppDppFail: {
|
||||
RpcEventSuppDppFail *p_c = rpc_msg->event_supp_dpp_fail;
|
||||
supp_wifi_event_dpp_failed_t *p_a = &app_ntfy->u.e_dpp_failed;
|
||||
app_ntfy->resp_event_status = rpc_msg->event_supp_dpp_fail->resp;
|
||||
|
||||
p_a->failure_reason = p_c->reason;
|
||||
break;
|
||||
#endif // H_SUPP_DPP_SUPPORT
|
||||
#if H_WIFI_DPP_SUPPORT
|
||||
}
|
||||
case RPC_ID__Event_WifiDppUriReady: {
|
||||
RpcEventWifiDppUriReady *p_c = rpc_msg->event_wifi_dpp_uri_ready;
|
||||
supp_wifi_event_dpp_uri_ready_t *p_a = &app_ntfy->u.e_dpp_uri_ready;
|
||||
app_ntfy->resp_event_status = rpc_msg->event_supp_dpp_uri_ready->resp;
|
||||
|
||||
g_h.funcs->_h_memset(p_a->uri, 0, DPP_URI_LEN_MAX);
|
||||
|
||||
p_a->uri_data_len = p_c->qrcode.len;
|
||||
if (p_a->uri_data_len <= DPP_URI_LEN_MAX) {
|
||||
g_h.funcs->_h_memcpy(p_a->uri, p_c->qrcode.data, p_a->uri_data_len);
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Incoming URI is too long (over %d bytes). Increase Kconfig ESP_HOSTED_DPP_URI_LEN_MAX for proper operation", DPP_URI_LEN_MAX - 1);
|
||||
p_a->uri_data_len = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case RPC_ID__Event_WifiDppCfgRecvd: {
|
||||
RpcEventWifiDppCfgRecvd *p_c = rpc_msg->event_wifi_dpp_cfg_recvd;
|
||||
supp_wifi_event_dpp_config_received_t *p_a = &app_ntfy->u.e_dpp_config_received;
|
||||
app_ntfy->resp_event_status = rpc_msg->event_supp_dpp_uri_ready->resp;
|
||||
|
||||
rpc_copy_wifi_sta_config(&p_a->wifi_cfg.sta, p_c->cfg->sta);
|
||||
break;
|
||||
}
|
||||
case RPC_ID__Event_WifiDppFail: {
|
||||
RpcEventWifiDppFail *p_c = rpc_msg->event_wifi_dpp_fail;
|
||||
supp_wifi_event_dpp_failed_t *p_a = &app_ntfy->u.e_dpp_failed;
|
||||
app_ntfy->resp_event_status = rpc_msg->event_supp_dpp_fail->resp;
|
||||
|
||||
p_a->failure_reason = p_c->reason;
|
||||
break;
|
||||
#endif // H_WIFI_DPP_SUPPORT
|
||||
#ifdef H_PEER_DATA_TRANSFER
|
||||
} case RPC_ID__Event_CustomRpc: {
|
||||
RpcEventCustomRpc *p_c = rpc_msg->event_custom_rpc;
|
||||
RPC_FAIL_ON_NULL(event_custom_rpc);
|
||||
app_ntfy->resp_event_status = p_c->resp;
|
||||
|
||||
/* Get message ID from protobuf field (not from data payload) */
|
||||
uint32_t msg_id = p_c->custom_event_id;
|
||||
|
||||
/* Route to callback with pure user data */
|
||||
const uint8_t *payload = p_c->data.data;
|
||||
size_t payload_len = p_c->data.len;
|
||||
|
||||
bool callback_found = false;
|
||||
void (*cb)(uint32_t, const uint8_t *, size_t, void *) = NULL;
|
||||
void *cb_local_context = NULL;
|
||||
|
||||
/* Find callback under mutex protection */
|
||||
if (custom_callbacks_mutex) {
|
||||
g_h.funcs->_h_lock_mutex(custom_callbacks_mutex, HOSTED_BLOCK_MAX);
|
||||
for (int i = 0; i < MAX_CUSTOM_CALLBACKS; i++) {
|
||||
if (custom_callbacks[i].msg_id == msg_id && custom_callbacks[i].callback) {
|
||||
cb = custom_callbacks[i].callback;
|
||||
cb_local_context = custom_callbacks[i].local_context;
|
||||
callback_found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_h.funcs->_h_unlock_mutex(custom_callbacks_mutex);
|
||||
}
|
||||
|
||||
/* Invoke callback outside mutex to avoid deadlock */
|
||||
if (callback_found && cb) {
|
||||
cb(msg_id, payload, payload_len, cb_local_context);
|
||||
} else {
|
||||
ESP_LOGI(TAG, "No callback registered for message ID %" PRIu32 ", ignore", msg_id);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
} default: {
|
||||
ESP_LOGE(TAG, "Invalid/unsupported event[%u] received\n",rpc_msg->msg_id);
|
||||
goto fail_parse_rpc_msg;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
fail_parse_rpc_msg:
|
||||
app_ntfy->resp_event_status = FAILURE;
|
||||
return FAILURE;
|
||||
}
|
||||
@@ -0,0 +1,993 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "rpc_core.h"
|
||||
#include "rpc_slave_if.h"
|
||||
#include "esp_hosted_rpc.h"
|
||||
#include "port_esp_hosted_host_wifi_config.h"
|
||||
#include "esp_hosted_transport.h"
|
||||
#include "esp_hosted_bitmasks.h"
|
||||
#include "esp_idf_version.h"
|
||||
#include "port_esp_hosted_host_log.h"
|
||||
#include "esp_hosted_os_abstraction.h"
|
||||
|
||||
DEFINE_LOG_TAG(rpc_req);
|
||||
|
||||
#define ADD_RPC_BUFF_TO_FREE_LATER(BuFf) { \
|
||||
assert((app_req->n_rpc_free_buff_hdls+1)<=MAX_FREE_BUFF_HANDLES); \
|
||||
app_req->rpc_free_buff_hdls[app_req->n_rpc_free_buff_hdls++] = BuFf; \
|
||||
}
|
||||
|
||||
#define RPC_ALLOC_ASSIGN(TyPe,MsG_StRuCt,InItFuNc) \
|
||||
TyPe *req_payload = (TyPe *) \
|
||||
g_h.funcs->_h_calloc(1, sizeof(TyPe)); \
|
||||
if (!req_payload) { \
|
||||
ESP_LOGE(TAG, "Failed to allocate memory for req->%s\n",#MsG_StRuCt); \
|
||||
*failure_status = RPC_ERR_MEMORY_FAILURE; \
|
||||
return FAILURE; \
|
||||
} \
|
||||
req->MsG_StRuCt = req_payload; \
|
||||
InItFuNc(req_payload); \
|
||||
ADD_RPC_BUFF_TO_FREE_LATER((uint8_t*)req_payload);
|
||||
|
||||
//TODO: How this is different in slave_control.c
|
||||
#define RPC_ALLOC_ELEMENT(TyPe,MsG_StRuCt,InIt_FuN) { \
|
||||
TyPe *NeW_AllocN = (TyPe *) g_h.funcs->_h_calloc(1, sizeof(TyPe)); \
|
||||
if (!NeW_AllocN) { \
|
||||
ESP_LOGE(TAG, "Failed to allocate memory for req->%s\n",#MsG_StRuCt); \
|
||||
*failure_status = RPC_ERR_MEMORY_FAILURE; \
|
||||
return FAILURE; \
|
||||
} \
|
||||
ADD_RPC_BUFF_TO_FREE_LATER((uint8_t*)NeW_AllocN); \
|
||||
MsG_StRuCt = NeW_AllocN; \
|
||||
InIt_FuN(MsG_StRuCt); \
|
||||
}
|
||||
|
||||
/* RPC request is simple remote function invocation at slave from host
|
||||
*
|
||||
* For new RPC request, add up switch case for your message
|
||||
* If the RPC function to be invoked does not carry any arguments, just add
|
||||
* case in the top with intentional fall through
|
||||
* If any arguments are needed, you may have to add union for your message
|
||||
* in Ctrl_cmd_t in rpc_api.h and fill the request in new case
|
||||
*
|
||||
* For altogether new RPC function addition, please check
|
||||
* esp_hosted_fg/common/proto/esp_hosted_config.proto
|
||||
*/
|
||||
int compose_rpc_req(Rpc *req, ctrl_cmd_t *app_req, int32_t *failure_status)
|
||||
{
|
||||
switch(req->msg_id) {
|
||||
|
||||
case RPC_ID__Req_GetWifiMode:
|
||||
//case RPC_ID__Req_GetAPConfig:
|
||||
//case RPC_ID__Req_DisconnectAP:
|
||||
//case RPC_ID__Req_GetSoftAPConfig:
|
||||
//case RPC_ID__Req_GetSoftAPConnectedSTAList:
|
||||
//case RPC_ID__Req_StopSoftAP:
|
||||
case RPC_ID__Req_WifiGetPs:
|
||||
case RPC_ID__Req_OTABegin:
|
||||
case RPC_ID__Req_OTAEnd:
|
||||
case RPC_ID__Req_OTAActivate:
|
||||
case RPC_ID__Req_WifiDeinit:
|
||||
case RPC_ID__Req_WifiStart:
|
||||
case RPC_ID__Req_WifiStop:
|
||||
case RPC_ID__Req_WifiConnect:
|
||||
case RPC_ID__Req_WifiDisconnect:
|
||||
case RPC_ID__Req_WifiScanStop:
|
||||
case RPC_ID__Req_WifiScanGetApNum:
|
||||
case RPC_ID__Req_WifiClearApList:
|
||||
case RPC_ID__Req_WifiRestore:
|
||||
case RPC_ID__Req_WifiClearFastConnect:
|
||||
case RPC_ID__Req_WifiStaGetApInfo:
|
||||
case RPC_ID__Req_WifiGetMaxTxPower:
|
||||
case RPC_ID__Req_WifiGetChannel:
|
||||
case RPC_ID__Req_WifiGetCountryCode:
|
||||
case RPC_ID__Req_WifiGetCountry:
|
||||
case RPC_ID__Req_WifiApGetStaList:
|
||||
case RPC_ID__Req_WifiStaGetRssi:
|
||||
case RPC_ID__Req_WifiStaGetNegotiatedPhymode:
|
||||
case RPC_ID__Req_WifiStaGetAid:
|
||||
case RPC_ID__Req_WifiGetBand:
|
||||
case RPC_ID__Req_WifiGetBandMode:
|
||||
case RPC_ID__Req_AppGetDesc:
|
||||
#if H_WIFI_ENTERPRISE_SUPPORT
|
||||
case RPC_ID__Req_WifiStaEnterpriseEnable:
|
||||
case RPC_ID__Req_WifiStaEnterpriseDisable:
|
||||
case RPC_ID__Req_EapClearIdentity:
|
||||
case RPC_ID__Req_EapClearUsername:
|
||||
case RPC_ID__Req_EapClearPassword:
|
||||
case RPC_ID__Req_EapClearNewPassword:
|
||||
case RPC_ID__Req_EapClearCaCert:
|
||||
case RPC_ID__Req_EapClearCertificateAndKey:
|
||||
#endif
|
||||
#if H_DPP_SUPPORT
|
||||
case RPC_ID__Req_SuppDppDeinit:
|
||||
case RPC_ID__Req_SuppDppStartListen:
|
||||
case RPC_ID__Req_SuppDppStopListen:
|
||||
#endif
|
||||
case RPC_ID__Req_WifiScanGetApRecord: {
|
||||
/* Intentional fallthrough & empty */
|
||||
break;
|
||||
} case RPC_ID__Req_GetMACAddress: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqGetMacAddress, req_get_mac_address,
|
||||
rpc__req__get_mac_address__init);
|
||||
|
||||
req_payload->mode = app_req->u.wifi_mac.mode;
|
||||
|
||||
break;
|
||||
} case RPC_ID__Req_SetMacAddress: {
|
||||
wifi_mac_t * p = &app_req->u.wifi_mac;
|
||||
RPC_ALLOC_ASSIGN(RpcReqSetMacAddress, req_set_mac_address,
|
||||
rpc__req__set_mac_address__init);
|
||||
|
||||
req_payload->mode = p->mode;
|
||||
RPC_REQ_COPY_BYTES(req_payload->mac, p->mac, BSSID_BYTES_SIZE);
|
||||
|
||||
break;
|
||||
} case RPC_ID__Req_SetWifiMode: {
|
||||
hosted_mode_t * p = &app_req->u.wifi_mode;
|
||||
RPC_ALLOC_ASSIGN(RpcReqSetMode, req_set_wifi_mode,
|
||||
rpc__req__set_mode__init);
|
||||
|
||||
if ((p->mode < WIFI_MODE_NULL) || (p->mode >= WIFI_MODE_MAX)) {
|
||||
ESP_LOGE(TAG, "Invalid wifi mode\n");
|
||||
*failure_status = RPC_ERR_INCORRECT_ARG;
|
||||
return FAILURE;
|
||||
}
|
||||
req_payload->mode = p->mode;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiSetPs: {
|
||||
wifi_power_save_t * p = &app_req->u.wifi_ps;
|
||||
RPC_ALLOC_ASSIGN(RpcReqSetPs, req_wifi_set_ps,
|
||||
rpc__req__set_ps__init);
|
||||
|
||||
req_payload->type = p->ps_mode;
|
||||
break;
|
||||
} case RPC_ID__Req_OTAWrite: {
|
||||
ota_write_t *p = & app_req->u.ota_write;
|
||||
RPC_ALLOC_ASSIGN(RpcReqOTAWrite, req_ota_write,
|
||||
rpc__req__otawrite__init);
|
||||
|
||||
if (!p->ota_data || (p->ota_data_len == 0)) {
|
||||
ESP_LOGE(TAG, "Invalid parameter\n");
|
||||
*failure_status = RPC_ERR_INCORRECT_ARG;
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
req_payload->ota_data.data = p->ota_data;
|
||||
req_payload->ota_data.len = p->ota_data_len;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiSetMaxTxPower: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetMaxTxPower,
|
||||
req_set_wifi_max_tx_power,
|
||||
rpc__req__wifi_set_max_tx_power__init);
|
||||
req_payload->power = app_req->u.wifi_tx_power.power;
|
||||
break;
|
||||
} case RPC_ID__Req_ConfigHeartbeat: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqConfigHeartbeat, req_config_heartbeat,
|
||||
rpc__req__config_heartbeat__init);
|
||||
req_payload->enable = app_req->u.e_heartbeat.enable;
|
||||
req_payload->duration = app_req->u.e_heartbeat.duration;
|
||||
if (req_payload->enable) {
|
||||
ESP_LOGD(TAG, "Enable heartbeat with duration %ld", (long int)req_payload->duration);
|
||||
if (CALLBACK_AVAILABLE != is_event_callback_registered(RPC_ID__Event_Heartbeat))
|
||||
ESP_LOGD(TAG, "Note: ** Subscribe heartbeat event to get notification **");
|
||||
} else {
|
||||
ESP_LOGD(TAG, "Disable Heartbeat");
|
||||
}
|
||||
break;
|
||||
} case RPC_ID__Req_WifiInit: {
|
||||
wifi_init_config_t * p_a = &app_req->u.wifi_init_config;
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiInit, req_wifi_init,
|
||||
rpc__req__wifi_init__init);
|
||||
RPC_ALLOC_ELEMENT(WifiInitConfig, req_payload->cfg, wifi_init_config__init);
|
||||
|
||||
req_payload->cfg->static_rx_buf_num = p_a->static_rx_buf_num ;
|
||||
req_payload->cfg->dynamic_rx_buf_num = p_a->dynamic_rx_buf_num ;
|
||||
req_payload->cfg->tx_buf_type = p_a->tx_buf_type ;
|
||||
req_payload->cfg->static_tx_buf_num = p_a->static_tx_buf_num ;
|
||||
req_payload->cfg->dynamic_tx_buf_num = p_a->dynamic_tx_buf_num ;
|
||||
req_payload->cfg->rx_mgmt_buf_type = p_a->rx_mgmt_buf_type ;
|
||||
req_payload->cfg->rx_mgmt_buf_num = p_a->rx_mgmt_buf_num ;
|
||||
req_payload->cfg->cache_tx_buf_num = p_a->cache_tx_buf_num ;
|
||||
req_payload->cfg->csi_enable = p_a->csi_enable ;
|
||||
req_payload->cfg->ampdu_rx_enable = p_a->ampdu_rx_enable ;
|
||||
req_payload->cfg->ampdu_tx_enable = p_a->ampdu_tx_enable ;
|
||||
req_payload->cfg->amsdu_tx_enable = p_a->amsdu_tx_enable ;
|
||||
req_payload->cfg->nvs_enable = p_a->nvs_enable ;
|
||||
req_payload->cfg->nano_enable = p_a->nano_enable ;
|
||||
req_payload->cfg->rx_ba_win = p_a->rx_ba_win ;
|
||||
req_payload->cfg->wifi_task_core_id = p_a->wifi_task_core_id ;
|
||||
req_payload->cfg->beacon_max_len = p_a->beacon_max_len ;
|
||||
req_payload->cfg->feature_caps = p_a->feature_caps ;
|
||||
req_payload->cfg->mgmt_sbuf_num = p_a->mgmt_sbuf_num ;
|
||||
req_payload->cfg->sta_disconnected_pm = p_a->sta_disconnected_pm ;
|
||||
req_payload->cfg->espnow_max_encrypt_num = p_a->espnow_max_encrypt_num ;
|
||||
req_payload->cfg->tx_hetb_queue_num = p_a->tx_hetb_queue_num ;
|
||||
req_payload->cfg->dump_hesigb_enable = p_a->dump_hesigb_enable ;
|
||||
req_payload->cfg->magic = p_a->magic ;
|
||||
|
||||
/* uint64 - TODO: portable? */
|
||||
req_payload->cfg->feature_caps = p_a->feature_caps ;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiGetConfig: {
|
||||
wifi_cfg_t * p_a = &app_req->u.wifi_config;
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiGetConfig, req_wifi_get_config,
|
||||
rpc__req__wifi_get_config__init);
|
||||
|
||||
req_payload->iface = p_a->iface;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiScanParams: {
|
||||
rpc_wifi_scan_params_t *p_a = &app_req->u.wifi_scan_params;
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiScanParams, req_wifi_scan_params,
|
||||
rpc__req__wifi_scan_params__init);
|
||||
|
||||
req_payload->cmd = p_a->cmd;
|
||||
if (!p_a->is_config_null) {
|
||||
RPC_ALLOC_ELEMENT(WifiScanDefaultParams, req_payload->config, wifi_scan_default_params__init);
|
||||
RPC_ALLOC_ELEMENT(WifiScanTime, req_payload->config->scan_time, wifi_scan_time__init);
|
||||
RPC_ALLOC_ELEMENT(WifiActiveScanTime, req_payload->config->scan_time->active, wifi_active_scan_time__init);
|
||||
|
||||
req_payload->config->scan_time->passive = p_a->config.scan_time.passive;
|
||||
req_payload->config->scan_time->active->min = p_a->config.scan_time.active.min;
|
||||
req_payload->config->scan_time->active->max = p_a->config.scan_time.active.max;
|
||||
req_payload->config->home_chan_dwell_time = p_a->config.home_chan_dwell_time;
|
||||
req_payload->is_config_null = false;
|
||||
} else {
|
||||
req_payload->is_config_null = true;
|
||||
}
|
||||
break;
|
||||
} case RPC_ID__Req_WifiSetConfig: {
|
||||
wifi_cfg_t * p_a = &app_req->u.wifi_config;
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetConfig, req_wifi_set_config,
|
||||
rpc__req__wifi_set_config__init);
|
||||
|
||||
req_payload->iface = p_a->iface;
|
||||
|
||||
RPC_ALLOC_ELEMENT(WifiConfig, req_payload->cfg, wifi_config__init);
|
||||
|
||||
switch(req_payload->iface) {
|
||||
|
||||
case WIFI_IF_STA: {
|
||||
req_payload->cfg->u_case = WIFI_CONFIG__U_STA;
|
||||
|
||||
wifi_sta_config_t *p_a_sta = &p_a->u.sta;
|
||||
RPC_ALLOC_ELEMENT(WifiStaConfig, req_payload->cfg->sta, wifi_sta_config__init);
|
||||
WifiStaConfig *p_c_sta = req_payload->cfg->sta;
|
||||
RPC_REQ_COPY_STR(p_c_sta->ssid, p_a_sta->ssid, SSID_LENGTH);
|
||||
|
||||
RPC_REQ_COPY_STR(p_c_sta->password, p_a_sta->password, PASSWORD_LENGTH);
|
||||
|
||||
p_c_sta->scan_method = p_a_sta->scan_method;
|
||||
p_c_sta->bssid_set = p_a_sta->bssid_set;
|
||||
|
||||
if (p_a_sta->bssid_set)
|
||||
RPC_REQ_COPY_BYTES(p_c_sta->bssid, p_a_sta->bssid, BSSID_BYTES_SIZE);
|
||||
|
||||
p_c_sta->channel = p_a_sta->channel;
|
||||
p_c_sta->listen_interval = p_a_sta->listen_interval;
|
||||
p_c_sta->sort_method = p_a_sta->sort_method;
|
||||
RPC_ALLOC_ELEMENT(WifiScanThreshold, p_c_sta->threshold, wifi_scan_threshold__init);
|
||||
p_c_sta->threshold->rssi = p_a_sta->threshold.rssi;
|
||||
p_c_sta->threshold->authmode = p_a_sta->threshold.authmode;
|
||||
#if H_PRESENT_IN_ESP_IDF_5_4_0
|
||||
p_c_sta->threshold->rssi_5g_adjustment = p_a_sta->threshold.rssi_5g_adjustment;
|
||||
#endif
|
||||
RPC_ALLOC_ELEMENT(WifiPmfConfig, p_c_sta->pmf_cfg, wifi_pmf_config__init);
|
||||
p_c_sta->pmf_cfg->capable = p_a_sta->pmf_cfg.capable;
|
||||
p_c_sta->pmf_cfg->required = p_a_sta->pmf_cfg.required;
|
||||
|
||||
if (p_a_sta->rm_enabled)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_1_rm_enabled, p_c_sta->bitmask);
|
||||
|
||||
if (p_a_sta->btm_enabled)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_1_btm_enabled, p_c_sta->bitmask);
|
||||
|
||||
if (p_a_sta->mbo_enabled)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_1_mbo_enabled, p_c_sta->bitmask);
|
||||
|
||||
if (p_a_sta->ft_enabled)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_1_ft_enabled, p_c_sta->bitmask);
|
||||
|
||||
if (p_a_sta->owe_enabled)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_1_owe_enabled, p_c_sta->bitmask);
|
||||
|
||||
if (p_a_sta->transition_disable)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_1_transition_disable, p_c_sta->bitmask);
|
||||
|
||||
#if H_DECODE_WIFI_RESERVED_FIELD
|
||||
#if H_WIFI_NEW_RESERVED_FIELD_NAMES
|
||||
WIFI_STA_CONFIG_2_SET_RESERVED_VAL(p_a_sta->reserved2, p_c_sta->he_bitmask);
|
||||
#else
|
||||
WIFI_STA_CONFIG_2_SET_RESERVED_VAL(p_a_sta->he_reserved, p_c_sta->he_bitmask);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
p_c_sta->sae_pwe_h2e = p_a_sta->sae_pwe_h2e;
|
||||
p_c_sta->sae_pk_mode = p_a_sta->sae_pk_mode;
|
||||
p_c_sta->failure_retry_cnt = p_a_sta->failure_retry_cnt;
|
||||
|
||||
if (p_a_sta->he_dcm_set)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_2_he_dcm_set_BIT, p_c_sta->he_bitmask);
|
||||
|
||||
// WIFI_HE_STA_CONFIG_he_dcm_max_constellation_tx is two bits wide
|
||||
if (p_a_sta->he_dcm_max_constellation_tx)
|
||||
p_c_sta->he_bitmask |= ((p_a_sta->he_dcm_max_constellation_tx & 0x03) << WIFI_STA_CONFIG_2_he_dcm_max_constellation_tx_BITS);
|
||||
|
||||
// WIFI_HE_STA_CONFIG_he_dcm_max_constellation_rx is two bits wide
|
||||
if (p_a_sta->he_dcm_max_constellation_rx)
|
||||
p_c_sta->he_bitmask |= ((p_a_sta->he_dcm_max_constellation_rx & 0x03) << WIFI_STA_CONFIG_2_he_dcm_max_constellation_rx_BITS);
|
||||
|
||||
if (p_a_sta->he_mcs9_enabled)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_2_he_mcs9_enabled_BIT, p_c_sta->he_bitmask);
|
||||
|
||||
if (p_a_sta->he_su_beamformee_disabled)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_2_he_su_beamformee_disabled_BIT, p_c_sta->he_bitmask);
|
||||
|
||||
if (p_a_sta->he_trig_su_bmforming_feedback_disabled)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_2_he_trig_su_bmforming_feedback_disabled_BIT, p_c_sta->he_bitmask);
|
||||
|
||||
if (p_a_sta->he_trig_mu_bmforming_partial_feedback_disabled)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_2_he_trig_mu_bmforming_partial_feedback_disabled_BIT, p_c_sta->he_bitmask);
|
||||
|
||||
if (p_a_sta->he_trig_cqi_feedback_disabled)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_2_he_trig_cqi_feedback_disabled_BIT, p_c_sta->he_bitmask);
|
||||
|
||||
#if H_PRESENT_IN_ESP_IDF_5_5_0
|
||||
if (p_a_sta->vht_su_beamformee_disabled)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_2_vht_su_beamformee_disabled, p_c_sta->he_bitmask);
|
||||
|
||||
if (p_a_sta->vht_mu_beamformee_disabled)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_2_vht_mu_beamformee_disabled, p_c_sta->he_bitmask);
|
||||
|
||||
if (p_a_sta->vht_mcs8_enabled)
|
||||
H_SET_BIT(WIFI_STA_CONFIG_2_vht_mcs8_enabled, p_c_sta->he_bitmask);
|
||||
#endif
|
||||
|
||||
#if H_DECODE_WIFI_RESERVED_FIELD
|
||||
#if H_WIFI_NEW_RESERVED_FIELD_NAMES
|
||||
WIFI_STA_CONFIG_2_SET_RESERVED_VAL(p_a_sta->reserved2, p_c_sta->he_bitmask);
|
||||
#else
|
||||
WIFI_STA_CONFIG_2_SET_RESERVED_VAL(p_a_sta->he_reserved, p_c_sta->he_bitmask);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
RPC_REQ_COPY_BYTES(p_c_sta->sae_h2e_identifier, p_a_sta->sae_h2e_identifier, SAE_H2E_IDENTIFIER_LEN);
|
||||
break;
|
||||
} case WIFI_IF_AP: {
|
||||
req_payload->cfg->u_case = WIFI_CONFIG__U_AP;
|
||||
|
||||
wifi_ap_config_t * p_a_ap = &p_a->u.ap;
|
||||
RPC_ALLOC_ELEMENT(WifiApConfig, req_payload->cfg->ap, wifi_ap_config__init);
|
||||
WifiApConfig * p_c_ap = req_payload->cfg->ap;
|
||||
|
||||
RPC_REQ_COPY_STR(p_c_ap->ssid, p_a_ap->ssid, SSID_LENGTH);
|
||||
RPC_REQ_COPY_STR(p_c_ap->password, p_a_ap->password, PASSWORD_LENGTH);
|
||||
p_c_ap->ssid_len = p_a_ap->ssid_len;
|
||||
p_c_ap->channel = p_a_ap->channel;
|
||||
p_c_ap->authmode = p_a_ap->authmode;
|
||||
p_c_ap->ssid_hidden = p_a_ap->ssid_hidden;
|
||||
p_c_ap->max_connection = p_a_ap->max_connection;
|
||||
p_c_ap->beacon_interval = p_a_ap->beacon_interval;
|
||||
p_c_ap->csa_count = p_a_ap->csa_count;
|
||||
p_c_ap->dtim_period = p_a_ap->dtim_period;
|
||||
p_c_ap->pairwise_cipher = p_a_ap->pairwise_cipher;
|
||||
p_c_ap->ftm_responder = p_a_ap->ftm_responder;
|
||||
RPC_ALLOC_ELEMENT(WifiPmfConfig, p_c_ap->pmf_cfg, wifi_pmf_config__init);
|
||||
p_c_ap->pmf_cfg->capable = p_a_ap->pmf_cfg.capable;
|
||||
p_c_ap->pmf_cfg->required = p_a_ap->pmf_cfg.required;
|
||||
p_c_ap->sae_pwe_h2e = p_a_ap->sae_pwe_h2e;
|
||||
#if H_GOT_AP_CONFIG_PARAM_TRANSITION_DISABLE
|
||||
p_c_ap->transition_disable = p_a_ap->transition_disable;
|
||||
#endif
|
||||
#if H_PRESENT_IN_ESP_IDF_5_5_0
|
||||
p_c_ap->sae_ext = p_a_ap->sae_ext;
|
||||
RPC_ALLOC_ELEMENT(WifiBssMaxIdleConfig, p_c_ap->bss_max_idle_cfg, wifi_bss_max_idle_config__init);
|
||||
p_c_ap->bss_max_idle_cfg->period = p_a_ap->bss_max_idle_cfg.period;
|
||||
p_c_ap->bss_max_idle_cfg->protected_keep_alive = p_a_ap->bss_max_idle_cfg.protected_keep_alive;
|
||||
p_c_ap->gtk_rekey_interval = p_a_ap->gtk_rekey_interval;
|
||||
#endif
|
||||
break;
|
||||
} default: {
|
||||
ESP_LOGE(TAG, "unexpected wifi iface [%u]\n", p_a->iface);
|
||||
break;
|
||||
}
|
||||
|
||||
} /* switch */
|
||||
break;
|
||||
|
||||
} case RPC_ID__Req_WifiScanStart: {
|
||||
wifi_scan_config_t * p_a = &app_req->u.wifi_scan_config.cfg;
|
||||
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiScanStart, req_wifi_scan_start,
|
||||
rpc__req__wifi_scan_start__init);
|
||||
|
||||
req_payload->block = app_req->u.wifi_scan_config.block;
|
||||
if (app_req->u.wifi_scan_config.cfg_set) {
|
||||
|
||||
RPC_ALLOC_ELEMENT(WifiScanConfig, req_payload->config, wifi_scan_config__init);
|
||||
|
||||
RPC_ALLOC_ELEMENT(WifiScanTime , req_payload->config->scan_time, wifi_scan_time__init);
|
||||
RPC_ALLOC_ELEMENT(WifiActiveScanTime, req_payload->config->scan_time->active, wifi_active_scan_time__init);
|
||||
ESP_LOGD(TAG, "scan start4\n");
|
||||
|
||||
WifiScanConfig *p_c = req_payload->config;
|
||||
WifiScanTime *p_c_st = NULL;
|
||||
wifi_scan_time_t *p_a_st = &p_a->scan_time;
|
||||
|
||||
RPC_REQ_COPY_STR(p_c->ssid, p_a->ssid, SSID_LENGTH);
|
||||
RPC_REQ_COPY_STR(p_c->bssid, p_a->bssid, MAC_SIZE_BYTES);
|
||||
p_c->channel = p_a->channel;
|
||||
p_c->show_hidden = p_a->show_hidden;
|
||||
p_c->scan_type = p_a->scan_type;
|
||||
|
||||
p_c_st = p_c->scan_time;
|
||||
|
||||
p_c_st->passive = p_a_st->passive;
|
||||
p_c_st->active->min = p_a_st->active.min ;
|
||||
p_c_st->active->max = p_a_st->active.max ;
|
||||
|
||||
p_c->home_chan_dwell_time = p_a->home_chan_dwell_time;
|
||||
|
||||
RPC_ALLOC_ELEMENT(WifiScanChannelBitmap, p_c->channel_bitmap, wifi_scan_channel_bitmap__init);
|
||||
p_c->channel_bitmap->ghz_2_channels = p_a->channel_bitmap.ghz_2_channels;
|
||||
p_c->channel_bitmap->ghz_5_channels = p_a->channel_bitmap.ghz_5_channels;
|
||||
|
||||
req_payload->config_set = 1;
|
||||
}
|
||||
ESP_LOGI(TAG, "Scan start Req\n");
|
||||
|
||||
break;
|
||||
|
||||
} case RPC_ID__Req_WifiScanGetApRecords: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiScanGetApRecords, req_wifi_scan_get_ap_records,
|
||||
rpc__req__wifi_scan_get_ap_records__init);
|
||||
req_payload->number = app_req->u.wifi_scan_ap_list.number;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiDeauthSta: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiDeauthSta, req_wifi_deauth_sta,
|
||||
rpc__req__wifi_deauth_sta__init);
|
||||
req_payload->aid = app_req->u.wifi_deauth_sta.aid;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiSetStorage: {
|
||||
wifi_storage_t * p = &app_req->u.wifi_storage;
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetStorage, req_wifi_set_storage,
|
||||
rpc__req__wifi_set_storage__init);
|
||||
req_payload->storage = *p;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiSetBandwidth: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetBandwidth, req_wifi_set_bandwidth,
|
||||
rpc__req__wifi_set_bandwidth__init);
|
||||
req_payload->ifx = app_req->u.wifi_bandwidth.ifx;
|
||||
req_payload->bw = app_req->u.wifi_bandwidth.bw;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiGetBandwidth: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiGetBandwidth, req_wifi_get_bandwidth,
|
||||
rpc__req__wifi_get_bandwidth__init);
|
||||
req_payload->ifx = app_req->u.wifi_bandwidth.ifx;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiSetChannel: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetChannel, req_wifi_set_channel,
|
||||
rpc__req__wifi_set_channel__init);
|
||||
req_payload->primary = app_req->u.wifi_channel.primary;
|
||||
req_payload->second = app_req->u.wifi_channel.second;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiSetCountryCode: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetCountryCode, req_wifi_set_country_code,
|
||||
rpc__req__wifi_set_country_code__init);
|
||||
RPC_REQ_COPY_BYTES(req_payload->country, (uint8_t *)&app_req->u.wifi_country_code.cc[0], sizeof(app_req->u.wifi_country_code.cc));
|
||||
req_payload->ieee80211d_enabled = app_req->u.wifi_country_code.ieee80211d_enabled;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiSetCountry: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetCountry, req_wifi_set_country,
|
||||
rpc__req__wifi_set_country__init);
|
||||
|
||||
RPC_ALLOC_ELEMENT(WifiCountry, req_payload->country, wifi_country__init);
|
||||
RPC_REQ_COPY_BYTES(req_payload->country->cc, (uint8_t *)&app_req->u.wifi_country.cc[0], sizeof(app_req->u.wifi_country.cc));
|
||||
req_payload->country->schan = app_req->u.wifi_country.schan;
|
||||
req_payload->country->nchan = app_req->u.wifi_country.nchan;
|
||||
req_payload->country->max_tx_power = app_req->u.wifi_country.max_tx_power;
|
||||
req_payload->country->policy = app_req->u.wifi_country.policy;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiApGetStaAid: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiApGetStaAid, req_wifi_ap_get_sta_aid,
|
||||
rpc__req__wifi_ap_get_sta_aid__init);
|
||||
|
||||
uint8_t * p = &app_req->u.wifi_ap_get_sta_aid.mac[0];
|
||||
RPC_REQ_COPY_BYTES(req_payload->mac, p, MAC_SIZE_BYTES);
|
||||
break;
|
||||
} case RPC_ID__Req_WifiSetProtocol: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetProtocol, req_wifi_set_protocol,
|
||||
rpc__req__wifi_set_protocol__init);
|
||||
req_payload->ifx = app_req->u.wifi_protocol.ifx;
|
||||
req_payload->protocol_bitmap = app_req->u.wifi_protocol.protocol_bitmap;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiGetProtocol: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiGetProtocol, req_wifi_get_protocol,
|
||||
rpc__req__wifi_get_protocol__init);
|
||||
req_payload->ifx = app_req->u.wifi_protocol.ifx;
|
||||
break;
|
||||
} case RPC_ID__Req_GetCoprocessorFwVersion: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqGetCoprocessorFwVersion, req_get_coprocessor_fwversion,
|
||||
rpc__req__get_coprocessor_fw_version__init);
|
||||
break;
|
||||
} case RPC_ID__Req_WifiSetInactiveTime: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetInactiveTime, req_wifi_set_inactive_time,
|
||||
rpc__req__wifi_set_inactive_time__init);
|
||||
req_payload->ifx = app_req->u.wifi_inactive_time.ifx;
|
||||
req_payload->sec = app_req->u.wifi_inactive_time.sec;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiGetInactiveTime: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiGetInactiveTime, req_wifi_get_inactive_time,
|
||||
rpc__req__wifi_get_inactive_time__init);
|
||||
req_payload->ifx = app_req->u.wifi_inactive_time.ifx;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiDisablePmfConfig: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiDisablePmfConfig, req_wifi_disable_pmf_config,
|
||||
rpc__req__wifi_disable_pmf_config__init);
|
||||
req_payload->ifx = app_req->u.wifi_disable_pmf_config.ifx;
|
||||
break;
|
||||
#if H_WIFI_HE_SUPPORT
|
||||
} case RPC_ID__Req_WifiStaTwtConfig: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiStaTwtConfig, req_wifi_sta_twt_config,
|
||||
rpc__req__wifi_sta_twt_config__init);
|
||||
RPC_ALLOC_ELEMENT(WifiTwtConfig, req_payload->config, wifi_twt_config__init);
|
||||
req_payload->config->post_wakeup_event = app_req->u.wifi_twt_config.post_wakeup_event;
|
||||
#if H_GOT_TWT_ENABLE_KEEP_ALIVE
|
||||
req_payload->config->twt_enable_keep_alive = app_req->u.wifi_twt_config.twt_enable_keep_alive;
|
||||
#endif
|
||||
break;
|
||||
} case RPC_ID__Req_WifiStaItwtSetup: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiStaItwtSetup, req_wifi_sta_itwt_setup,
|
||||
rpc__req__wifi_sta_itwt_setup__init);
|
||||
RPC_ALLOC_ELEMENT(WifiItwtSetupConfig, req_payload->setup_config, wifi_itwt_setup_config__init);
|
||||
#if H_WIFI_HE_GREATER_THAN_ESP_IDF_5_3
|
||||
wifi_itwt_setup_config_t * p_a_cfg = &app_req->u.wifi_itwt_setup_config;
|
||||
#else
|
||||
wifi_twt_setup_config_t * p_a_cfg = &app_req->u.wifi_twt_setup_config;
|
||||
#endif
|
||||
WifiItwtSetupConfig * p_c_cfg = req_payload->setup_config;
|
||||
|
||||
p_c_cfg->setup_cmd = p_a_cfg->setup_cmd;
|
||||
if (p_a_cfg->trigger)
|
||||
H_SET_BIT(WIFI_ITWT_CONFIG_1_trigger_BIT, p_c_cfg->bitmask_1);
|
||||
|
||||
if (p_a_cfg->flow_type)
|
||||
H_SET_BIT(WIFI_ITWT_CONFIG_1_flow_type_BIT, p_c_cfg->bitmask_1);
|
||||
|
||||
// WIFI_ITWT_CONFIG_1_flow_id_BIT is three bits wide
|
||||
if (p_a_cfg->flow_id)
|
||||
p_c_cfg->bitmask_1 |= ((p_a_cfg->flow_id & 0x07) << WIFI_ITWT_CONFIG_1_flow_id_BIT);
|
||||
|
||||
// WIFI_ITWT_CONFIG_1_wake_invl_expn_BIT is five bits wide
|
||||
if (p_a_cfg->wake_invl_expn)
|
||||
p_c_cfg->bitmask_1 |= ((p_a_cfg->wake_invl_expn & 0x1F) << WIFI_ITWT_CONFIG_1_wake_invl_expn_BIT);
|
||||
|
||||
if (p_a_cfg->wake_duration_unit)
|
||||
H_SET_BIT(WIFI_ITWT_CONFIG_1_wake_duration_unit_BIT, p_c_cfg->bitmask_1);
|
||||
|
||||
#if H_DECODE_WIFI_RESERVED_FIELD
|
||||
WIFI_ITWT_CONFIG_1_SET_RESERVED_VAL(p_a_cfg->reserved, p_c_cfg->bitmask_1);
|
||||
#endif
|
||||
p_c_cfg->min_wake_dura = p_a_cfg->min_wake_dura;
|
||||
p_c_cfg->wake_invl_mant = p_a_cfg->wake_invl_mant;
|
||||
p_c_cfg->twt_id = p_a_cfg->twt_id;
|
||||
p_c_cfg->timeout_time_ms = p_a_cfg->timeout_time_ms;
|
||||
|
||||
break;
|
||||
} case RPC_ID__Req_WifiStaItwtTeardown: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiStaItwtTeardown, req_wifi_sta_itwt_teardown,
|
||||
rpc__req__wifi_sta_itwt_teardown__init);
|
||||
|
||||
req_payload->flow_id = app_req->u.wifi_itwt_flow_id;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiStaItwtSuspend: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiStaItwtSuspend, req_wifi_sta_itwt_suspend,
|
||||
rpc__req__wifi_sta_itwt_suspend__init);
|
||||
|
||||
req_payload->flow_id = app_req->u.wifi_itwt_suspend.flow_id;
|
||||
req_payload->suspend_time_ms = app_req->u.wifi_itwt_suspend.suspend_time_ms;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiStaItwtGetFlowIdStatus: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiStaItwtGetFlowIdStatus, req_wifi_sta_itwt_get_flow_id_status,
|
||||
rpc__req__wifi_sta_itwt_get_flow_id_status__init);
|
||||
break;
|
||||
} case RPC_ID__Req_WifiStaItwtSendProbeReq: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiStaItwtSendProbeReq, req_wifi_sta_itwt_send_probe_req,
|
||||
rpc__req__wifi_sta_itwt_send_probe_req__init);
|
||||
req_payload->timeout_ms = app_req->u.wifi_itwt_probe_req_timeout_ms;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiStaItwtSetTargetWakeTimeOffset: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiStaItwtSetTargetWakeTimeOffset, req_wifi_sta_itwt_set_target_wake_time_offset,
|
||||
rpc__req__wifi_sta_itwt_set_target_wake_time_offset__init);
|
||||
req_payload->offset_us = app_req->u.wifi_itwt_set_target_wake_time_offset_us;
|
||||
break;
|
||||
#endif // H_WIFI_HE_SUPPORT
|
||||
#if H_WIFI_DUALBAND_SUPPORT
|
||||
} case RPC_ID__Req_WifiSetProtocols: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetProtocols, req_wifi_set_protocols,
|
||||
rpc__req__wifi_set_protocols__init);
|
||||
req_payload->ifx = app_req->u.wifi_protocols.ifx;
|
||||
|
||||
RPC_ALLOC_ELEMENT(WifiProtocols, req_payload->protocols, wifi_protocols__init);
|
||||
req_payload->protocols->ghz_2g = app_req->u.wifi_protocols.ghz_2g;
|
||||
req_payload->protocols->ghz_5g = app_req->u.wifi_protocols.ghz_5g;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiGetProtocols: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiGetProtocols, req_wifi_get_protocols,
|
||||
rpc__req__wifi_get_protocols__init);
|
||||
req_payload->ifx = app_req->u.wifi_protocols.ifx;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiSetBandwidths: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetBandwidths, req_wifi_set_bandwidths,
|
||||
rpc__req__wifi_set_bandwidths__init);
|
||||
req_payload->ifx = app_req->u.wifi_bandwidths.ifx;
|
||||
|
||||
RPC_ALLOC_ELEMENT(WifiBandwidths, req_payload->bandwidths, wifi_bandwidths__init);
|
||||
req_payload->bandwidths->ghz_2g = app_req->u.wifi_bandwidths.ghz_2g;
|
||||
req_payload->bandwidths->ghz_5g = app_req->u.wifi_bandwidths.ghz_5g;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiGetBandwidths: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiGetBandwidths, req_wifi_get_bandwidths,
|
||||
rpc__req__wifi_get_bandwidths__init);
|
||||
req_payload->ifx = app_req->u.wifi_bandwidths.ifx;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiSetBand: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetBand, req_wifi_set_band,
|
||||
rpc__req__wifi_set_band__init);
|
||||
req_payload->band = app_req->u.wifi_band;
|
||||
break;
|
||||
} case RPC_ID__Req_WifiSetBandMode: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetBandMode, req_wifi_set_bandmode,
|
||||
rpc__req__wifi_set_band_mode__init);
|
||||
req_payload->bandmode = app_req->u.wifi_band_mode;
|
||||
break;
|
||||
#endif // H_WIFI_DUALBAND_SUPPORT
|
||||
} case RPC_ID__Req_IfaceMacAddrSetGet: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqIfaceMacAddrSetGet, req_iface_mac_addr_set_get,
|
||||
rpc__req__iface_mac_addr_set_get__init);
|
||||
req_payload->set = app_req->u.iface_mac.set;
|
||||
req_payload->type = app_req->u.iface_mac.type;
|
||||
if (req_payload->set) {
|
||||
RPC_REQ_COPY_BYTES(req_payload->mac, app_req->u.iface_mac.mac,
|
||||
app_req->u.iface_mac.mac_len);
|
||||
}
|
||||
break;
|
||||
} case RPC_ID__Req_FeatureControl: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqFeatureControl, req_feature_control,
|
||||
rpc__req__feature_control__init);
|
||||
// convert from rpc_slave_if.h enums to proto enums
|
||||
switch (app_req->u.feature_control.feature) {
|
||||
case FEATURE_BT:
|
||||
req_payload->feature = RPC_FEATURE__Feature_Bluetooth;
|
||||
break;
|
||||
case FEATURE_OPENTHREAD_RCP:
|
||||
req_payload->feature = RPC_FEATURE__Feature_Openthread_Rcp;
|
||||
break;
|
||||
default:
|
||||
req_payload->feature = RPC_FEATURE__Feature_None;
|
||||
break;
|
||||
}
|
||||
switch (app_req->u.feature_control.command) {
|
||||
case FEATURE_COMMAND_BT_INIT:
|
||||
req_payload->command = RPC_FEATURE_COMMAND__Feature_Command_BT_Init;
|
||||
break;
|
||||
case FEATURE_COMMAND_BT_DEINIT:
|
||||
req_payload->command = RPC_FEATURE_COMMAND__Feature_Command_BT_Deinit;
|
||||
break;
|
||||
case FEATURE_COMMAND_BT_ENABLE:
|
||||
req_payload->command = RPC_FEATURE_COMMAND__Feature_Command_BT_Enable;
|
||||
break;
|
||||
case FEATURE_COMMAND_BT_DISABLE:
|
||||
req_payload->command = RPC_FEATURE_COMMAND__Feature_Command_BT_Disable;
|
||||
break;
|
||||
case FEATURE_COMMAND_INIT:
|
||||
req_payload->command = RPC_FEATURE_COMMAND__Feature_Command_Init;
|
||||
break;
|
||||
case FEATURE_COMMAND_DEINIT:
|
||||
req_payload->command = RPC_FEATURE_COMMAND__Feature_Command_Deinit;
|
||||
break;
|
||||
case FEATURE_COMMAND_ENABLE:
|
||||
req_payload->command = RPC_FEATURE_COMMAND__Feature_Command_Enable;
|
||||
break;
|
||||
case FEATURE_COMMAND_DISABLE:
|
||||
req_payload->command = RPC_FEATURE_COMMAND__Feature_Command_Disable;
|
||||
break;
|
||||
case FEATURE_COMMAND_QUERY:
|
||||
req_payload->command = RPC_FEATURE_COMMAND__Feature_Command_Query;
|
||||
break;
|
||||
default:
|
||||
req_payload->command = RPC_FEATURE_COMMAND__Feature_Command_None;
|
||||
break;
|
||||
}
|
||||
switch (app_req->u.feature_control.option) {
|
||||
case FEATURE_OPTION_BT_DEINIT_RELEASE_MEMORY:
|
||||
req_payload->option = RPC_FEATURE_OPTION__Feature_Option_BT_Deinit_Release_Memory;
|
||||
break;
|
||||
case FEATURE_OPTION_QUERY_CONFIGURED:
|
||||
req_payload->option = RPC_FEATURE_OPTION__Feature_Option_Query_Configured;
|
||||
break;
|
||||
case FEATURE_OPTION_QUERY_INITED:
|
||||
req_payload->option = RPC_FEATURE_OPTION__Feature_Option_Query_Inited;
|
||||
break;
|
||||
case FEATURE_OPTION_QUERY_ENABLED:
|
||||
req_payload->option = RPC_FEATURE_OPTION__Feature_Option_Query_Enabled;
|
||||
break;
|
||||
case FEATURE_OPTION_QUERY_READY:
|
||||
req_payload->option = RPC_FEATURE_OPTION__Feature_Option_Query_Ready;
|
||||
break;
|
||||
default:
|
||||
req_payload->option = RPC_FEATURE_OPTION__Feature_Option_None;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
} case RPC_ID__Req_IfaceMacAddrLenGet: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqIfaceMacAddrLenGet, req_iface_mac_addr_len_get,
|
||||
rpc__req__iface_mac_addr_len_get__init);
|
||||
req_payload->type = app_req->u.iface_mac_len.type;
|
||||
break;
|
||||
} case RPC_ID__Req_SetDhcpDnsStatus: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqSetDhcpDnsStatus, req_set_dhcp_dns,
|
||||
rpc__req__set_dhcp_dns_status__init);
|
||||
RpcReqSetDhcpDnsStatus *p_c = req_payload;
|
||||
rpc_set_dhcp_dns_status_t* p_a = &app_req->u.slave_dhcp_dns_status;
|
||||
|
||||
p_c->iface = p_a->iface;
|
||||
p_c->dhcp_up = p_a->dhcp_up;
|
||||
p_c->dns_up = p_a->dns_up;
|
||||
p_c->dns_type = p_a->dns_type;
|
||||
p_c->net_link_up = p_a->net_link_up;
|
||||
|
||||
RPC_REQ_COPY_STR(p_c->dhcp_ip, p_a->dhcp_ip, 64);
|
||||
RPC_REQ_COPY_STR(p_c->dhcp_nm, p_a->dhcp_nm, 64);
|
||||
RPC_REQ_COPY_STR(p_c->dhcp_gw, p_a->dhcp_gw, 64);
|
||||
RPC_REQ_COPY_STR(p_c->dns_ip, p_a->dns_ip, 64);
|
||||
break;
|
||||
#if H_MEM_MONITOR
|
||||
} case RPC_ID__Req_MemMonitor: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqMemMonitor, req_mem_monitor,
|
||||
rpc__req__mem_monitor__init);
|
||||
RPC_ALLOC_ELEMENT(HeapSizeThreshold, req_payload->internal, heap_size_threshold__init);
|
||||
RPC_ALLOC_ELEMENT(HeapSizeThreshold, req_payload->external, heap_size_threshold__init);
|
||||
|
||||
RpcReqMemMonitor *p_c = req_payload;
|
||||
esp_hosted_config_mem_monitor_t *p_a = &app_req->u.config_mem_monitor;
|
||||
|
||||
if (p_a->config == ESP_HOSTED_MEMMONITOR_NO_CHANGE) {
|
||||
p_c->config = RPC__MEM_MONITOR_CONFIG__MEMMONITOR_NO_CHANGE;
|
||||
} else if (p_a->config == ESP_HOSTED_MEMMONITOR_DISABLE) {
|
||||
p_c->config = RPC__MEM_MONITOR_CONFIG__MEMMONITOR_DISABLE;
|
||||
} else if (p_a->config == ESP_HOSTED_MEMMONITOR_ENABLE) {
|
||||
p_c->config = RPC__MEM_MONITOR_CONFIG__MEMMONITOR_ENABLE;
|
||||
}
|
||||
p_c->report_always = p_a->report_always;
|
||||
p_c->interval_sec = p_a->interval_sec;
|
||||
p_c->internal->threshold_mem_dma = p_a->internal_mem.threshold_mem_dma;
|
||||
p_c->internal->threshold_mem_8bit = p_a->internal_mem.threshold_mem_8bit;
|
||||
p_c->external->threshold_mem_dma = p_a->external_mem.threshold_mem_dma;
|
||||
p_c->external->threshold_mem_8bit = p_a->external_mem.threshold_mem_8bit;
|
||||
break;
|
||||
#endif
|
||||
#if H_WIFI_ENTERPRISE_SUPPORT
|
||||
} case RPC_ID__Req_EapSetIdentity: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapSetIdentity, req_eap_set_identity,
|
||||
rpc__req__eap_set_identity__init);
|
||||
RPC_REQ_COPY_BYTES(req_payload->identity, (uint8_t *)app_req->u.eap_identity.identity, app_req->u.eap_identity.len);
|
||||
req_payload->len = app_req->u.eap_identity.len;
|
||||
break;
|
||||
} case RPC_ID__Req_EapSetUsername: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapSetUsername, req_eap_set_username,
|
||||
rpc__req__eap_set_username__init);
|
||||
RPC_REQ_COPY_BYTES(req_payload->username, (uint8_t *)app_req->u.eap_username.username, app_req->u.eap_username.len);
|
||||
req_payload->len = app_req->u.eap_username.len;
|
||||
break;
|
||||
} case RPC_ID__Req_EapSetPassword: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapSetPassword, req_eap_set_password,
|
||||
rpc__req__eap_set_password__init);
|
||||
RPC_REQ_COPY_BYTES(req_payload->password, (uint8_t *)app_req->u.eap_password.password, app_req->u.eap_password.len);
|
||||
req_payload->len = app_req->u.eap_password.len;
|
||||
break;
|
||||
} case RPC_ID__Req_EapSetNewPassword: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapSetNewPassword, req_eap_set_new_password,
|
||||
rpc__req__eap_set_new_password__init);
|
||||
RPC_REQ_COPY_BYTES(req_payload->new_password, (uint8_t *)app_req->u.eap_password.password, app_req->u.eap_password.len);
|
||||
req_payload->len = app_req->u.eap_password.len;
|
||||
break;
|
||||
} case RPC_ID__Req_EapSetCaCert: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapSetCaCert, req_eap_set_ca_cert,
|
||||
rpc__req__eap_set_ca_cert__init);
|
||||
RPC_REQ_COPY_BYTES(req_payload->ca_cert, (uint8_t *)app_req->u.eap_ca_cert.ca_cert, app_req->u.eap_ca_cert.len);
|
||||
req_payload->ca_cert_len = app_req->u.eap_ca_cert.len;
|
||||
break;
|
||||
} case RPC_ID__Req_EapSetCertificateAndKey: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapSetCertificateAndKey, req_eap_set_certificate_and_key,
|
||||
rpc__req__eap_set_certificate_and_key__init);
|
||||
RPC_REQ_COPY_BYTES(req_payload->client_cert, (uint8_t *)app_req->u.eap_cert_key.client_cert, app_req->u.eap_cert_key.client_cert_len);
|
||||
req_payload->client_cert_len = app_req->u.eap_cert_key.client_cert_len;
|
||||
RPC_REQ_COPY_BYTES(req_payload->private_key, (uint8_t *)app_req->u.eap_cert_key.private_key, app_req->u.eap_cert_key.private_key_len);
|
||||
req_payload->private_key_len = app_req->u.eap_cert_key.private_key_len;
|
||||
RPC_REQ_COPY_BYTES(req_payload->private_key_password, (uint8_t *)app_req->u.eap_cert_key.private_key_password, app_req->u.eap_cert_key.private_key_passwd_len);
|
||||
req_payload->private_key_passwd_len = app_req->u.eap_cert_key.private_key_passwd_len;
|
||||
break;
|
||||
} case RPC_ID__Req_EapSetDisableTimeCheck: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapSetDisableTimeCheck, req_eap_set_disable_time_check,
|
||||
rpc__req__eap_set_disable_time_check__init);
|
||||
req_payload->disable = app_req->u.eap_disable_time_check.disable;
|
||||
break;
|
||||
} case RPC_ID__Req_EapSetTtlsPhase2Method: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapSetTtlsPhase2Method, req_eap_set_ttls_phase2_method,
|
||||
rpc__req__eap_set_ttls_phase2_method__init);
|
||||
req_payload->type = app_req->u.eap_ttls_phase2;
|
||||
break;
|
||||
} case RPC_ID__Req_EapSetSuitebCertification: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapSetSuiteb192bitCertification, req_eap_set_suiteb_certification,
|
||||
rpc__req__eap_set_suiteb192bit_certification__init);
|
||||
req_payload->enable = app_req->u.eap_suiteb_192bit.enable;
|
||||
break;
|
||||
} case RPC_ID__Req_EapSetPacFile: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapSetPacFile, req_eap_set_pac_file,
|
||||
rpc__req__eap_set_pac_file__init);
|
||||
RPC_REQ_COPY_BYTES(req_payload->pac_file, (uint8_t *)app_req->u.eap_pac_file.pac_file, app_req->u.eap_pac_file.len);
|
||||
req_payload->pac_file_len = app_req->u.eap_pac_file.len;
|
||||
break;
|
||||
} case RPC_ID__Req_EapSetFastParams: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapSetFastParams, req_eap_set_fast_params,
|
||||
rpc__req__eap_set_fast_params__init);
|
||||
RPC_ALLOC_ELEMENT(EapFastConfig, req_payload->eap_fast_config, eap_fast_config__init);
|
||||
req_payload->eap_fast_config->fast_provisioning = app_req->u.eap_fast_config.fast_provisioning;
|
||||
req_payload->eap_fast_config->fast_max_pac_list_len = app_req->u.eap_fast_config.fast_max_pac_list_len;
|
||||
req_payload->eap_fast_config->fast_pac_format_binary = app_req->u.eap_fast_config.fast_pac_format_binary;
|
||||
break;
|
||||
} case RPC_ID__Req_EapUseDefaultCertBundle: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapUseDefaultCertBundle, req_eap_use_default_cert_bundle,
|
||||
rpc__req__eap_use_default_cert_bundle__init);
|
||||
req_payload->use_default_bundle = app_req->u.eap_default_cert_bundle.use_default;
|
||||
break;
|
||||
#if H_GOT_EAP_OKC_SUPPORT
|
||||
} case RPC_ID__Req_WifiSetOkcSupport: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqWifiSetOkcSupport, req_wifi_set_okc_support,
|
||||
rpc__req__wifi_set_okc_support__init);
|
||||
req_payload->enable = app_req->u.wifi_okc_support.enable;
|
||||
break;
|
||||
#endif
|
||||
#if H_GOT_EAP_SET_DOMAIN_NAME
|
||||
} case RPC_ID__Req_EapSetDomainName: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapSetDomainName, req_eap_set_domain_name,
|
||||
rpc__req__eap_set_domain_name__init);
|
||||
|
||||
RPC_REQ_COPY_BYTES(req_payload->domain_name, (uint8_t *)app_req->u.eap_domain_name.domain_name, strlen(app_req->u.eap_domain_name.domain_name) + 1);
|
||||
break;
|
||||
#endif
|
||||
#if H_GOT_SET_EAP_METHODS_API
|
||||
} case RPC_ID__Req_EapSetEapMethods: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqEapSetEapMethods, req_eap_set_eap_methods,
|
||||
rpc__req__eap_set_eap_methods__init);
|
||||
req_payload->methods = app_req->u.methods;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#if H_DPP_SUPPORT
|
||||
} case RPC_ID__Req_SuppDppInit: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqSuppDppInit,req_supp_dpp_init,
|
||||
rpc__req__supp_dpp_init__init);
|
||||
req_payload->cb = app_req->u.dpp_enable_cb;
|
||||
break;
|
||||
} case RPC_ID__Req_SuppDppBootstrapGen: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqSuppDppBootstrapGen,req_supp_dpp_bootstrap_gen,
|
||||
rpc__req__supp_dpp_bootstrap_gen__init);
|
||||
int str_len;
|
||||
RpcReqSuppDppBootstrapGen *p_c = req_payload;
|
||||
rpc_supp_dpp_bootstrap_gen_t* p_a = &app_req->u.dpp_bootstrap_gen;
|
||||
|
||||
p_c->type = p_a->type;
|
||||
|
||||
// chan_list: copy terminating NULL
|
||||
str_len = strlen(p_a->chan_list);
|
||||
RPC_REQ_COPY_BYTES(p_c->chan_list, (uint8_t *)p_a->chan_list, str_len + 1);
|
||||
|
||||
// key is a fixed length (if provided)
|
||||
if (p_a->key) {
|
||||
RPC_REQ_COPY_BYTES(p_c->key, (uint8_t *)p_a->key, DPP_BOOTSTRAP_GEN_KEY_LEN);
|
||||
}
|
||||
|
||||
// info: copy terminating NULL
|
||||
if (p_a->info) {
|
||||
str_len = strlen(p_a->info);
|
||||
RPC_REQ_COPY_BYTES(p_c->info, (uint8_t *)p_a->info, str_len + 1);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifdef H_PEER_DATA_TRANSFER
|
||||
} case RPC_ID__Req_CustomRpc: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqCustomRpc, req_custom_rpc,
|
||||
rpc__req__custom_rpc__init);
|
||||
esp_hosted_rpc_data_t *custom_data = &app_req->u.custom_rpc;
|
||||
req_payload->custom_msg_id = custom_data->custom_msg_id;
|
||||
if (custom_data->data && custom_data->data_len > 0) {
|
||||
req_payload->data.data = custom_data->data;
|
||||
req_payload->data.len = custom_data->data_len;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if H_GPIO_EXPANDER_SUPPORT
|
||||
} case RPC_ID__Req_GpioConfig: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqGpioConfig, req_gpio_config,
|
||||
rpc__req__gpio_config__init);
|
||||
RPC_ALLOC_ELEMENT(RpcGpioConfig, req_payload->config, rpc__gpio_config__init);
|
||||
|
||||
req_payload->config->pin_bit_mask = app_req->u.gpio_config.pin_bit_mask;
|
||||
req_payload->config->intr_type = app_req->u.gpio_config.intr_type;
|
||||
req_payload->config->mode = app_req->u.gpio_config.mode;
|
||||
req_payload->config->pull_up_en = app_req->u.gpio_config.pull_up_en;
|
||||
req_payload->config->pull_down_en = app_req->u.gpio_config.pull_down_en;
|
||||
break;
|
||||
} case RPC_ID__Req_GpioResetPin: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqGpioResetPin, req_gpio_reset_pin,
|
||||
rpc__req__gpio_reset_pin__init);
|
||||
req_payload->gpio_num = app_req->u.gpio_num;
|
||||
break;
|
||||
} case RPC_ID__Req_GpioSetLevel: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqGpioSetLevel, req_gpio_set_level,
|
||||
rpc__req__gpio_set_level__init);
|
||||
|
||||
req_payload->gpio_num = app_req->u.gpio_set_level.gpio_num;
|
||||
req_payload->level = app_req->u.gpio_set_level.level;
|
||||
break;
|
||||
} case RPC_ID__Req_GpioGetLevel: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqGpioGetLevel, req_gpio_get_level,
|
||||
rpc__req__gpio_get_level__init);
|
||||
|
||||
req_payload->gpio_num = app_req->u.gpio_num;
|
||||
break;
|
||||
} case RPC_ID__Req_GpioSetDirection: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqGpioSetDirection, req_gpio_set_direction,
|
||||
rpc__req__gpio_set_direction__init);
|
||||
|
||||
req_payload->gpio_num = app_req->u.gpio_set_direction.gpio_num;
|
||||
req_payload->mode = app_req->u.gpio_set_direction.mode;
|
||||
break;
|
||||
} case RPC_ID__Req_GpioInputEnable: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqGpioInputEnable, req_gpio_input_enable,
|
||||
rpc__req__gpio_input_enable__init);
|
||||
|
||||
req_payload->gpio_num = app_req->u.gpio_num;
|
||||
break;
|
||||
} case RPC_ID__Req_GpioSetPullMode: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqGpioSetPullMode, req_gpio_set_pull_mode,
|
||||
rpc__req__gpio_set_pull_mode__init);
|
||||
|
||||
req_payload->gpio_num = app_req->u.gpio_set_pull_mode.gpio_num;
|
||||
req_payload->pull = app_req->u.gpio_set_pull_mode.pull_mode;
|
||||
break;
|
||||
#endif
|
||||
#if H_EXT_COEX_SUPPORT
|
||||
} case RPC_ID__Req_ExtCoex: {
|
||||
RPC_ALLOC_ASSIGN(RpcReqExtCoex, req_ext_coex,
|
||||
rpc__req__ext_coex__init);
|
||||
|
||||
req_payload->cmd = app_req->u.ext_coex.cmd;
|
||||
req_payload->set_gpio_wire_type = app_req->u.ext_coex.set_gpio_wire_type;
|
||||
req_payload->set_gpio_request_pin = app_req->u.ext_coex.set_gpio_request_pin;
|
||||
req_payload->set_gpio_priority_pin = app_req->u.ext_coex.set_gpio_priority_pin;
|
||||
req_payload->set_gpio_grant_pin = app_req->u.ext_coex.set_gpio_grant_pin;
|
||||
req_payload->set_gpio_tx_line_pin = app_req->u.ext_coex.set_gpio_tx_line_pin;
|
||||
req_payload->set_work_mode = app_req->u.ext_coex.set_work_mode;
|
||||
req_payload->set_grant_delay_us = app_req->u.ext_coex.set_grant_delay_us;
|
||||
req_payload->set_validate_high = app_req->u.ext_coex.set_validate_high;
|
||||
break;
|
||||
#endif
|
||||
} default: {
|
||||
*failure_status = RPC_ERR_UNSUPPORTED_MSG;
|
||||
ESP_LOGE(TAG, "Unsupported RPC Req[%u]",req->msg_id);
|
||||
return FAILURE;
|
||||
break;
|
||||
}
|
||||
|
||||
} /* switch */
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,918 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <inttypes.h>
|
||||
#include "rpc_core.h"
|
||||
#include "rpc_utils.h"
|
||||
#include "rpc_slave_if.h"
|
||||
#include "esp_hosted_transport.h"
|
||||
#include "esp_hosted_bitmasks.h"
|
||||
#include "esp_idf_version.h"
|
||||
#include "port_esp_hosted_host_config.h"
|
||||
#include "port_esp_hosted_host_wifi_config.h"
|
||||
#include "port_esp_hosted_host_log.h"
|
||||
#include "esp_hosted_os_abstraction.h"
|
||||
|
||||
DEFINE_LOG_TAG(rpc_rsp);
|
||||
|
||||
/* RPC response is result of remote function invocation at slave from host
|
||||
* The response will contain the return values of the RPC procedure
|
||||
* Return values typically will be simple integer return value of rpc call
|
||||
* for simple procedures. For function call with return value as a parameter,
|
||||
* RPC will contain full structure returned for that parameter and wrapper
|
||||
* level above will return these in expected pointer
|
||||
*
|
||||
* Responses will typically have two levels:
|
||||
* 1. protobuf level response received
|
||||
* 2. parse the response so that Ctrl_cmd_t app structure will be populated
|
||||
* or parsed from protobuf level response.
|
||||
*
|
||||
* For new RPC request, add up switch case for your message
|
||||
* For altogether new RPC function addition, please check
|
||||
* esp_hosted_fg/common/proto/esp_hosted_config.proto as a start point
|
||||
*/
|
||||
|
||||
#define RPC_ERR_IN_RESP(msGparaM) \
|
||||
if (rpc_msg->msGparaM->resp) { \
|
||||
app_resp->resp_event_status = rpc_msg->msGparaM->resp; \
|
||||
ESP_LOGW(TAG, "Hosted RPC_Resp [0x%"PRIx16"], uid [%"PRIu32"], resp code [%"PRIi32"]", \
|
||||
app_resp->msg_id, app_resp->uid, app_resp->resp_event_status); \
|
||||
goto fail_parse_rpc_msg; \
|
||||
}
|
||||
|
||||
#define RPC_RSP_COPY_BYTES(dst,src) { \
|
||||
if (src.data && src.len) { \
|
||||
g_h.funcs->_h_memcpy(dst, src.data, src.len); \
|
||||
} \
|
||||
}
|
||||
|
||||
// copy the rpc record info to the wifi record info
|
||||
static int rpc_copy_ap_record(wifi_ap_record_t *ap_record, WifiApRecord *rpc_ap_record)
|
||||
{
|
||||
RPC_RSP_COPY_BYTES(ap_record->ssid, rpc_ap_record->ssid);
|
||||
RPC_RSP_COPY_BYTES(ap_record->bssid, rpc_ap_record->bssid);
|
||||
|
||||
ap_record->primary = rpc_ap_record->primary;
|
||||
ap_record->second = rpc_ap_record->second;
|
||||
ap_record->rssi = rpc_ap_record->rssi;
|
||||
ap_record->authmode = rpc_ap_record->authmode;
|
||||
ap_record->pairwise_cipher = rpc_ap_record->pairwise_cipher;
|
||||
ap_record->group_cipher = rpc_ap_record->group_cipher;
|
||||
ap_record->ant = rpc_ap_record->ant;
|
||||
|
||||
ap_record->phy_11b = H_GET_BIT(WIFI_SCAN_AP_REC_phy_11b_BIT, rpc_ap_record->bitmask);
|
||||
ap_record->phy_11g = H_GET_BIT(WIFI_SCAN_AP_REC_phy_11g_BIT, rpc_ap_record->bitmask);
|
||||
ap_record->phy_11n = H_GET_BIT(WIFI_SCAN_AP_REC_phy_11n_BIT, rpc_ap_record->bitmask);
|
||||
ap_record->phy_lr = H_GET_BIT(WIFI_SCAN_AP_REC_phy_lr_BIT, rpc_ap_record->bitmask);
|
||||
ap_record->phy_11a = H_GET_BIT(WIFI_SCAN_AP_REC_phy_11a_BIT, rpc_ap_record->bitmask);
|
||||
ap_record->phy_11ac = H_GET_BIT(WIFI_SCAN_AP_REC_phy_11ac_BIT, rpc_ap_record->bitmask);
|
||||
ap_record->phy_11ax = H_GET_BIT(WIFI_SCAN_AP_REC_phy_11ax_BIT, rpc_ap_record->bitmask);
|
||||
ap_record->wps = H_GET_BIT(WIFI_SCAN_AP_REC_wps_BIT, rpc_ap_record->bitmask);
|
||||
ap_record->ftm_responder = H_GET_BIT(WIFI_SCAN_AP_REC_ftm_responder_BIT, rpc_ap_record->bitmask);
|
||||
ap_record->ftm_initiator = H_GET_BIT(WIFI_SCAN_AP_REC_ftm_initiator_BIT, rpc_ap_record->bitmask);
|
||||
ap_record->reserved = WIFI_SCAN_AP_GET_RESERVED_VAL(rpc_ap_record->bitmask);
|
||||
|
||||
RPC_RSP_COPY_BYTES(ap_record->country.cc, rpc_ap_record->country->cc);
|
||||
ap_record->country.schan = rpc_ap_record->country->schan;
|
||||
ap_record->country.nchan = rpc_ap_record->country->nchan;
|
||||
ap_record->country.max_tx_power = rpc_ap_record->country->max_tx_power;
|
||||
ap_record->country.policy = rpc_ap_record->country->policy;
|
||||
|
||||
ESP_LOGD(TAG, "SSID: %s BSSid: " MACSTR, ap_record->ssid, MAC2STR(ap_record->bssid));
|
||||
ESP_LOGD(TAG, "Primary: %u Second: %u RSSI: %d Authmode: %u",
|
||||
ap_record->primary, ap_record->second,
|
||||
ap_record->rssi, ap_record->authmode
|
||||
);
|
||||
ESP_LOGD(TAG, "PairwiseCipher: %u Groupcipher: %u Ant: %u",
|
||||
ap_record->pairwise_cipher, ap_record->group_cipher,
|
||||
ap_record->ant
|
||||
);
|
||||
ESP_LOGD(TAG, "Bitmask: 11b:%u g:%u n:%u ax: %u lr:%u wps:%u ftm_resp:%u ftm_ini:%u res: %u",
|
||||
ap_record->phy_11b, ap_record->phy_11g,
|
||||
ap_record->phy_11n, ap_record->phy_11ax, ap_record->phy_lr,
|
||||
ap_record->wps, ap_record->ftm_responder,
|
||||
ap_record->ftm_initiator, ap_record->reserved
|
||||
);
|
||||
ESP_LOGD(TAG, "Country cc:%c%c schan: %u nchan: %u max_tx_pow: %d policy: %u",
|
||||
ap_record->country.cc[0], ap_record->country.cc[1], ap_record->country.schan,
|
||||
ap_record->country.nchan, ap_record->country.max_tx_power,
|
||||
ap_record->country.policy);
|
||||
|
||||
WifiHeApInfo *p_c_he_ap = rpc_ap_record->he_ap;
|
||||
wifi_he_ap_info_t *p_a_he_ap = &ap_record->he_ap;
|
||||
// six bits
|
||||
p_a_he_ap->bss_color = p_c_he_ap->bitmask & 0x3F;
|
||||
p_a_he_ap->partial_bss_color = H_GET_BIT(WIFI_HE_AP_INFO_partial_bss_color_BIT, p_c_he_ap->bitmask);
|
||||
p_a_he_ap->bss_color_disabled = H_GET_BIT(WIFI_HE_AP_INFO_bss_color_disabled_BIT, p_c_he_ap->bitmask);
|
||||
|
||||
ESP_LOGD(TAG, "HE_AP: bss_color %d, partial_bss_color %d, bss_color_disabled %d",
|
||||
p_a_he_ap->bss_color, p_a_he_ap->bss_color_disabled, p_a_he_ap->bss_color_disabled);
|
||||
|
||||
ap_record->bandwidth = rpc_ap_record->bandwidth;
|
||||
ap_record->vht_ch_freq1 = rpc_ap_record->vht_ch_freq1;
|
||||
ap_record->vht_ch_freq2 = rpc_ap_record->vht_ch_freq2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This will copy rpc response from `Rpc` into
|
||||
* application structure `ctrl_cmd_t`
|
||||
* This function is called after protobuf decoding is successful
|
||||
**/
|
||||
int rpc_parse_rsp(Rpc *rpc_msg, ctrl_cmd_t *app_resp)
|
||||
{
|
||||
uint16_t i = 0;
|
||||
|
||||
/* 1. Check non NULL */
|
||||
if (!rpc_msg || !app_resp) {
|
||||
ESP_LOGE(TAG, "NULL rpc resp or NULL App Resp");
|
||||
goto fail_parse_rpc_msg;
|
||||
}
|
||||
|
||||
/* 2. update basic fields */
|
||||
app_resp->msg_type = RPC_TYPE__Resp;
|
||||
app_resp->msg_id = rpc_msg->msg_id;
|
||||
app_resp->uid = rpc_msg->uid;
|
||||
ESP_LOGI(TAG, " --> RPC_Resp [0x%x], uid %ld", app_resp->msg_id, app_resp->uid);
|
||||
|
||||
/* 3. parse Rpc into ctrl_cmd_t */
|
||||
switch (rpc_msg->msg_id) {
|
||||
case RPC_ID__Resp_Base : {
|
||||
// RPC Request not supported
|
||||
app_resp->resp_event_status = ESP_ERR_NOT_SUPPORTED;
|
||||
goto fail_parse_rpc_msg;
|
||||
}
|
||||
case RPC_ID__Resp_GetMACAddress : {
|
||||
RPC_FAIL_ON_NULL(resp_get_mac_address);
|
||||
RPC_ERR_IN_RESP(resp_get_mac_address);
|
||||
RPC_FAIL_ON_NULL(resp_get_mac_address->mac.data);
|
||||
|
||||
RPC_RSP_COPY_BYTES(app_resp->u.wifi_mac.mac, rpc_msg->resp_get_mac_address->mac);
|
||||
ESP_LOGD(TAG, "Mac addr: "MACSTR, MAC2STR(app_resp->u.wifi_mac.mac));
|
||||
break;
|
||||
} case RPC_ID__Resp_SetMacAddress : {
|
||||
RPC_FAIL_ON_NULL(resp_set_mac_address);
|
||||
RPC_ERR_IN_RESP(resp_set_mac_address);
|
||||
break;
|
||||
} case RPC_ID__Resp_GetWifiMode : {
|
||||
RPC_FAIL_ON_NULL(resp_get_wifi_mode);
|
||||
RPC_ERR_IN_RESP(resp_get_wifi_mode);
|
||||
|
||||
app_resp->u.wifi_mode.mode = rpc_msg->resp_get_wifi_mode->mode;
|
||||
break;
|
||||
} case RPC_ID__Resp_SetWifiMode : {
|
||||
RPC_FAIL_ON_NULL(resp_set_wifi_mode);
|
||||
RPC_ERR_IN_RESP(resp_set_wifi_mode);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetPs: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_ps);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_ps);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiGetPs : {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_get_ps);
|
||||
RPC_ERR_IN_RESP(resp_wifi_get_ps);
|
||||
app_resp->u.wifi_ps.ps_mode = rpc_msg->resp_wifi_get_ps->type;
|
||||
break;
|
||||
} case RPC_ID__Resp_OTABegin : {
|
||||
RPC_FAIL_ON_NULL(resp_ota_begin);
|
||||
RPC_ERR_IN_RESP(resp_ota_begin);
|
||||
break;
|
||||
} case RPC_ID__Resp_OTAWrite : {
|
||||
RPC_FAIL_ON_NULL(resp_ota_write);
|
||||
RPC_ERR_IN_RESP(resp_ota_write);
|
||||
break;
|
||||
} case RPC_ID__Resp_OTAEnd: {
|
||||
RPC_FAIL_ON_NULL(resp_ota_end);
|
||||
RPC_ERR_IN_RESP(resp_ota_end);
|
||||
break;
|
||||
} case RPC_ID__Resp_OTAActivate: {
|
||||
RPC_FAIL_ON_NULL(resp_ota_activate);
|
||||
RPC_ERR_IN_RESP(resp_ota_activate);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetMaxTxPower: {
|
||||
RPC_FAIL_ON_NULL(resp_set_wifi_max_tx_power);
|
||||
RPC_ERR_IN_RESP(resp_set_wifi_max_tx_power);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiGetMaxTxPower: {
|
||||
RPC_FAIL_ON_NULL(resp_get_wifi_max_tx_power);
|
||||
RPC_ERR_IN_RESP(resp_get_wifi_max_tx_power);
|
||||
app_resp->u.wifi_tx_power.power =
|
||||
rpc_msg->resp_get_wifi_max_tx_power->power;
|
||||
break;
|
||||
} case RPC_ID__Resp_ConfigHeartbeat: {
|
||||
RPC_FAIL_ON_NULL(resp_config_heartbeat);
|
||||
RPC_ERR_IN_RESP(resp_config_heartbeat);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiInit: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_init);
|
||||
RPC_ERR_IN_RESP(resp_wifi_init);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiDeinit: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_deinit);
|
||||
RPC_ERR_IN_RESP(resp_wifi_deinit);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiStart: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_start);
|
||||
RPC_ERR_IN_RESP(resp_wifi_start);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiStop: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_stop);
|
||||
RPC_ERR_IN_RESP(resp_wifi_stop);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiConnect: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_connect);
|
||||
RPC_ERR_IN_RESP(resp_wifi_connect);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiDisconnect: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_disconnect);
|
||||
RPC_ERR_IN_RESP(resp_wifi_disconnect);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetConfig: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_config);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_config);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiScanParams: {
|
||||
rpc_wifi_scan_params_t *p_a = &app_resp->u.wifi_scan_params;
|
||||
WifiScanDefaultParams *p_c = rpc_msg->resp_wifi_scan_params->config;
|
||||
|
||||
RPC_FAIL_ON_NULL(resp_wifi_scan_params);
|
||||
RPC_ERR_IN_RESP(resp_wifi_scan_params);
|
||||
|
||||
if (p_c) {
|
||||
p_a->config.scan_time.passive = p_c->scan_time->passive;
|
||||
p_a->config.scan_time.active.min = p_c->scan_time->active->min;
|
||||
p_a->config.scan_time.active.max = p_c->scan_time->active->max;
|
||||
p_a->config.home_chan_dwell_time = p_c->home_chan_dwell_time;
|
||||
}
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiGetConfig: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_config);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_config);
|
||||
|
||||
app_resp->u.wifi_config.iface = rpc_msg->resp_wifi_get_config->iface;
|
||||
|
||||
switch (app_resp->u.wifi_config.iface) {
|
||||
|
||||
case WIFI_IF_STA: {
|
||||
wifi_sta_config_t * p_a_sta = &(app_resp->u.wifi_config.u.sta);
|
||||
WifiStaConfig * p_c_sta = rpc_msg->resp_wifi_get_config->cfg->sta;
|
||||
rpc_copy_wifi_sta_config(p_a_sta, p_c_sta);
|
||||
break;
|
||||
}
|
||||
case WIFI_IF_AP: {
|
||||
wifi_ap_config_t * p_a_ap = &(app_resp->u.wifi_config.u.ap);
|
||||
WifiApConfig * p_c_ap = rpc_msg->resp_wifi_get_config->cfg->ap;
|
||||
|
||||
RPC_RSP_COPY_BYTES(p_a_ap->ssid, p_c_ap->ssid);
|
||||
RPC_RSP_COPY_BYTES(p_a_ap->password, p_c_ap->password);
|
||||
p_a_ap->ssid_len = p_c_ap->ssid_len;
|
||||
p_a_ap->channel = p_c_ap->channel;
|
||||
p_a_ap->authmode = p_c_ap->authmode;
|
||||
p_a_ap->ssid_hidden = p_c_ap->ssid_hidden;
|
||||
p_a_ap->max_connection = p_c_ap->max_connection;
|
||||
p_a_ap->beacon_interval = p_c_ap->beacon_interval;
|
||||
p_a_ap->csa_count = p_c_ap->csa_count;
|
||||
p_a_ap->dtim_period = p_c_ap->dtim_period;
|
||||
p_a_ap->pairwise_cipher = p_c_ap->pairwise_cipher;
|
||||
p_a_ap->ftm_responder = p_c_ap->ftm_responder;
|
||||
if (p_c_ap->pmf_cfg) {
|
||||
p_a_ap->pmf_cfg.capable = p_c_ap->pmf_cfg->capable;
|
||||
p_a_ap->pmf_cfg.required = p_c_ap->pmf_cfg->required;
|
||||
}
|
||||
p_a_ap->sae_pwe_h2e = p_c_ap->sae_pwe_h2e;
|
||||
#if H_GOT_AP_CONFIG_PARAM_TRANSITION_DISABLE
|
||||
p_a_ap->transition_disable = p_c_ap->transition_disable;
|
||||
#endif
|
||||
#if H_PRESENT_IN_ESP_IDF_5_5_0
|
||||
p_a_ap->sae_ext = p_c_ap->sae_ext;
|
||||
if (p_c_ap->bss_max_idle_cfg) {
|
||||
p_a_ap->bss_max_idle_cfg.period = p_c_ap->bss_max_idle_cfg->period;
|
||||
p_a_ap->bss_max_idle_cfg.protected_keep_alive = p_c_ap->bss_max_idle_cfg->protected_keep_alive;
|
||||
}
|
||||
p_a_ap->gtk_rekey_interval = p_c_ap->gtk_rekey_interval;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ESP_LOGE(TAG, "Unsupported WiFi interface[%u]", app_resp->u.wifi_config.iface);
|
||||
} //switch
|
||||
|
||||
break;
|
||||
|
||||
} case RPC_ID__Resp_WifiScanStart: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_scan_start);
|
||||
RPC_ERR_IN_RESP(resp_wifi_scan_start);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiScanStop: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_scan_stop);
|
||||
RPC_ERR_IN_RESP(resp_wifi_scan_stop);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiScanGetApNum: {
|
||||
wifi_scan_ap_list_t *p_a = &(app_resp->u.wifi_scan_ap_list);
|
||||
RPC_FAIL_ON_NULL(resp_wifi_scan_get_ap_num);
|
||||
RPC_ERR_IN_RESP(resp_wifi_scan_get_ap_num);
|
||||
|
||||
p_a->number = rpc_msg->resp_wifi_scan_get_ap_num->number;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiScanGetApRecord: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_scan_get_ap_records);
|
||||
RPC_ERR_IN_RESP(resp_wifi_scan_get_ap_records);
|
||||
|
||||
rpc_copy_ap_record(&(app_resp->u.wifi_ap_record),
|
||||
rpc_msg->resp_wifi_scan_get_ap_record->ap_record);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiScanGetApRecords: {
|
||||
wifi_scan_ap_list_t *p_a = &(app_resp->u.wifi_scan_ap_list);
|
||||
wifi_ap_record_t *list = NULL;
|
||||
WifiApRecord **p_c_list = NULL;
|
||||
|
||||
RPC_FAIL_ON_NULL(resp_wifi_scan_get_ap_records);
|
||||
RPC_ERR_IN_RESP(resp_wifi_scan_get_ap_records);
|
||||
p_c_list = rpc_msg->resp_wifi_scan_get_ap_records->ap_records;
|
||||
|
||||
p_a->number = rpc_msg->resp_wifi_scan_get_ap_records->number;
|
||||
|
||||
if (!p_a->number) {
|
||||
ESP_LOGI(TAG, "No AP found");
|
||||
goto fail_parse_rpc_msg;
|
||||
}
|
||||
ESP_LOGD(TAG, "Num AP records: %u",
|
||||
app_resp->u.wifi_scan_ap_list.number);
|
||||
|
||||
RPC_FAIL_ON_NULL(resp_wifi_scan_get_ap_records->ap_records);
|
||||
|
||||
list = (wifi_ap_record_t*)g_h.funcs->_h_calloc(p_a->number,
|
||||
sizeof(wifi_ap_record_t));
|
||||
p_a->out_list = list;
|
||||
|
||||
RPC_FAIL_ON_NULL_PRINT(list, "Malloc Failed");
|
||||
|
||||
app_resp->app_free_buff_func = g_h.funcs->_h_free;
|
||||
app_resp->app_free_buff_hdl = list;
|
||||
|
||||
ESP_LOGD(TAG, "Number of available APs is %d", p_a->number);
|
||||
for (i=0; i<p_a->number; i++) {
|
||||
rpc_copy_ap_record(&list[i], p_c_list[i]);
|
||||
}
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiStaGetApInfo: {
|
||||
WifiApRecord *p_c = NULL;
|
||||
wifi_ap_record_t *ap_info = NULL;
|
||||
wifi_scan_ap_list_t *p_a = &(app_resp->u.wifi_scan_ap_list);
|
||||
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_get_ap_info);
|
||||
RPC_ERR_IN_RESP(resp_wifi_sta_get_ap_info);
|
||||
p_c = rpc_msg->resp_wifi_sta_get_ap_info->ap_record;
|
||||
|
||||
p_a->number = 1;
|
||||
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_get_ap_info->ap_record);
|
||||
|
||||
ap_info = (wifi_ap_record_t*)g_h.funcs->_h_calloc(p_a->number,
|
||||
sizeof(wifi_ap_record_t));
|
||||
p_a->out_list = ap_info;
|
||||
|
||||
RPC_FAIL_ON_NULL_PRINT(ap_info, "Malloc Failed");
|
||||
|
||||
app_resp->app_free_buff_func = g_h.funcs->_h_free;
|
||||
app_resp->app_free_buff_hdl = ap_info;
|
||||
|
||||
rpc_copy_ap_record(ap_info, p_c);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiClearApList: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_clear_ap_list);
|
||||
RPC_ERR_IN_RESP(resp_wifi_clear_ap_list);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiRestore: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_restore);
|
||||
RPC_ERR_IN_RESP(resp_wifi_restore);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiClearFastConnect: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_clear_fast_connect);
|
||||
RPC_ERR_IN_RESP(resp_wifi_clear_fast_connect);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiDeauthSta: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_deauth_sta);
|
||||
RPC_ERR_IN_RESP(resp_wifi_deauth_sta);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetStorage: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_storage);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_storage);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetBandwidth: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_bandwidth);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_bandwidth);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiGetBandwidth: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_get_bandwidth);
|
||||
RPC_ERR_IN_RESP(resp_wifi_get_bandwidth);
|
||||
app_resp->u.wifi_bandwidth.bw =
|
||||
rpc_msg->resp_wifi_get_bandwidth->bw;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetChannel: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_channel);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_channel);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiGetChannel: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_get_channel);
|
||||
RPC_ERR_IN_RESP(resp_wifi_get_channel);
|
||||
app_resp->u.wifi_channel.primary =
|
||||
rpc_msg->resp_wifi_get_channel->primary;
|
||||
app_resp->u.wifi_channel.second =
|
||||
rpc_msg->resp_wifi_get_channel->second;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetCountryCode: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_country_code);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_country_code);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiGetCountryCode: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_get_country_code);
|
||||
RPC_ERR_IN_RESP(resp_wifi_get_country_code);
|
||||
|
||||
RPC_RSP_COPY_BYTES(&app_resp->u.wifi_country_code.cc[0],
|
||||
rpc_msg->resp_wifi_get_country_code->country);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetCountry: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_country);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_country);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiGetCountry: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_get_country);
|
||||
RPC_ERR_IN_RESP(resp_wifi_get_country);
|
||||
|
||||
RPC_RSP_COPY_BYTES(&app_resp->u.wifi_country.cc[0],
|
||||
rpc_msg->resp_wifi_get_country->country->cc);
|
||||
app_resp->u.wifi_country.schan = rpc_msg->resp_wifi_get_country->country->schan;
|
||||
app_resp->u.wifi_country.nchan = rpc_msg->resp_wifi_get_country->country->nchan;
|
||||
app_resp->u.wifi_country.max_tx_power = rpc_msg->resp_wifi_get_country->country->max_tx_power;
|
||||
app_resp->u.wifi_country.policy = rpc_msg->resp_wifi_get_country->country->policy;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiApGetStaList: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_ap_get_sta_list);
|
||||
RPC_ERR_IN_RESP(resp_wifi_ap_get_sta_list);
|
||||
|
||||
// handle case where slave's num is bigger than our ESP_WIFI_MAX_CONN_NUM
|
||||
uint32_t num_stations = rpc_msg->resp_wifi_ap_get_sta_list->sta_list->num;
|
||||
if (num_stations > ESP_WIFI_MAX_CONN_NUM) {
|
||||
ESP_LOGW(TAG, "Slave returned %ld connected stations, but we can only accept %d items", num_stations, ESP_WIFI_MAX_CONN_NUM);
|
||||
num_stations = ESP_WIFI_MAX_CONN_NUM;
|
||||
}
|
||||
|
||||
WifiStaInfo ** p_c_sta_list = rpc_msg->resp_wifi_ap_get_sta_list->sta_list->sta;
|
||||
|
||||
for (int i = 0; i < num_stations; i++) {
|
||||
wifi_sta_info_t * p_a_sta = &app_resp->u.wifi_ap_sta_list.sta[i];
|
||||
|
||||
RPC_RSP_COPY_BYTES(p_a_sta->mac, p_c_sta_list[i]->mac);
|
||||
p_a_sta->rssi = p_c_sta_list[i]->rssi;
|
||||
|
||||
p_a_sta->phy_11b = H_GET_BIT(WIFI_STA_INFO_phy_11b_BIT, p_c_sta_list[i]->bitmask);
|
||||
p_a_sta->phy_11g = H_GET_BIT(WIFI_STA_INFO_phy_11g_BIT, p_c_sta_list[i]->bitmask);
|
||||
p_a_sta->phy_11n = H_GET_BIT(WIFI_STA_INFO_phy_11n_BIT, p_c_sta_list[i]->bitmask);
|
||||
p_a_sta->phy_lr = H_GET_BIT(WIFI_STA_INFO_phy_lr_BIT, p_c_sta_list[i]->bitmask);
|
||||
p_a_sta->phy_11ax = H_GET_BIT(WIFI_STA_INFO_phy_11ax_BIT, p_c_sta_list[i]->bitmask);
|
||||
p_a_sta->is_mesh_child = H_GET_BIT(WIFI_STA_INFO_is_mesh_child_BIT, p_c_sta_list[i]->bitmask);
|
||||
p_a_sta->reserved = WIFI_STA_INFO_GET_RESERVED_VAL(p_c_sta_list[i]->bitmask);
|
||||
}
|
||||
|
||||
app_resp->u.wifi_ap_sta_list.num = rpc_msg->resp_wifi_ap_get_sta_list->sta_list->num;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiApGetStaAid: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_ap_get_sta_aid);
|
||||
RPC_ERR_IN_RESP(resp_wifi_ap_get_sta_aid);
|
||||
|
||||
app_resp->u.wifi_ap_get_sta_aid.aid = rpc_msg->resp_wifi_ap_get_sta_aid->aid;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiStaGetRssi: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_get_rssi);
|
||||
RPC_ERR_IN_RESP(resp_wifi_sta_get_rssi);
|
||||
|
||||
app_resp->u.wifi_sta_get_rssi.rssi = rpc_msg->resp_wifi_sta_get_rssi->rssi;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetProtocol: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_protocol);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_protocol);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiGetProtocol: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_get_protocol);
|
||||
RPC_ERR_IN_RESP(resp_wifi_get_protocol);
|
||||
app_resp->u.wifi_protocol.protocol_bitmap =
|
||||
rpc_msg->resp_wifi_get_protocol->protocol_bitmap;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiStaGetNegotiatedPhymode: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_get_negotiated_phymode);
|
||||
RPC_ERR_IN_RESP(resp_wifi_sta_get_negotiated_phymode);
|
||||
app_resp->u.wifi_sta_get_negotiated_phymode.phymode =
|
||||
rpc_msg->resp_wifi_sta_get_negotiated_phymode->phymode;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiStaGetAid: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_get_aid);
|
||||
RPC_ERR_IN_RESP(resp_wifi_sta_get_aid);
|
||||
app_resp->u.wifi_sta_get_aid.aid =
|
||||
rpc_msg->resp_wifi_sta_get_aid->aid;
|
||||
break;
|
||||
} case RPC_ID__Resp_GetCoprocessorFwVersion: {
|
||||
RPC_FAIL_ON_NULL(resp_get_coprocessor_fwversion);
|
||||
RPC_ERR_IN_RESP(resp_get_coprocessor_fwversion);
|
||||
app_resp->u.coprocessor_fwversion.major1 =
|
||||
rpc_msg->resp_get_coprocessor_fwversion->major1;
|
||||
app_resp->u.coprocessor_fwversion.minor1 =
|
||||
rpc_msg->resp_get_coprocessor_fwversion->minor1;
|
||||
app_resp->u.coprocessor_fwversion.patch1 =
|
||||
rpc_msg->resp_get_coprocessor_fwversion->patch1;
|
||||
|
||||
// ensure revision, prerelease and build are -1 if not found (0)
|
||||
app_resp->u.coprocessor_fwversion.revision =
|
||||
(rpc_msg->resp_get_coprocessor_fwversion->revision) ?
|
||||
rpc_msg->resp_get_coprocessor_fwversion->revision : -1;
|
||||
app_resp->u.coprocessor_fwversion.prerelease =
|
||||
(rpc_msg->resp_get_coprocessor_fwversion->prerelease) ?
|
||||
rpc_msg->resp_get_coprocessor_fwversion->prerelease : -1;
|
||||
app_resp->u.coprocessor_fwversion.build =
|
||||
(rpc_msg->resp_get_coprocessor_fwversion->build) ?
|
||||
rpc_msg->resp_get_coprocessor_fwversion->build : -1;
|
||||
|
||||
app_resp->u.coprocessor_fwversion.chip_id =
|
||||
rpc_msg->resp_get_coprocessor_fwversion->chip_id;
|
||||
int copy_size = H_MIN(rpc_msg->resp_get_coprocessor_fwversion->idf_target.len,
|
||||
(sizeof(app_resp->u.coprocessor_fwversion.idf_target) - 1));
|
||||
if (copy_size) {
|
||||
g_h.funcs->_h_memcpy(app_resp->u.coprocessor_fwversion.idf_target,
|
||||
rpc_msg->resp_get_coprocessor_fwversion->idf_target.data,
|
||||
copy_size);
|
||||
}
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetInactiveTime: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_inactive_time);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_inactive_time);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiGetInactiveTime: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_get_inactive_time);
|
||||
RPC_ERR_IN_RESP(resp_wifi_get_inactive_time);
|
||||
app_resp->u.wifi_inactive_time.sec =
|
||||
rpc_msg->resp_wifi_get_inactive_time->sec;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiDisablePmfConfig: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_disable_pmf_config);
|
||||
RPC_ERR_IN_RESP(resp_wifi_disable_pmf_config);
|
||||
app_resp->u.wifi_disable_pmf_config.ifx =
|
||||
rpc_msg->resp_wifi_disable_pmf_config->ifx;
|
||||
break;
|
||||
#if H_WIFI_HE_SUPPORT
|
||||
} case RPC_ID__Resp_WifiStaTwtConfig: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_twt_config);
|
||||
RPC_ERR_IN_RESP(resp_wifi_sta_twt_config);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiStaItwtSetup: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_itwt_setup);
|
||||
RPC_ERR_IN_RESP(resp_wifi_sta_itwt_setup);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiStaItwtTeardown: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_itwt_teardown);
|
||||
RPC_ERR_IN_RESP(resp_wifi_sta_itwt_teardown);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiStaItwtSuspend: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_itwt_suspend);
|
||||
RPC_ERR_IN_RESP(resp_wifi_sta_itwt_suspend);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiStaItwtGetFlowIdStatus: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_itwt_get_flow_id_status);
|
||||
RPC_ERR_IN_RESP(resp_wifi_sta_itwt_get_flow_id_status);
|
||||
app_resp->u.wifi_itwt_flow_id_bitmap =
|
||||
rpc_msg->resp_wifi_sta_itwt_get_flow_id_status->flow_id_bitmap;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiStaItwtSendProbeReq: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_itwt_suspend);
|
||||
RPC_ERR_IN_RESP(resp_wifi_sta_itwt_suspend);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiStaItwtSetTargetWakeTimeOffset: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_itwt_set_target_wake_time_offset);
|
||||
RPC_ERR_IN_RESP(resp_wifi_sta_itwt_set_target_wake_time_offset);
|
||||
break;
|
||||
#endif // H_WIFI_HE_SUPPORT
|
||||
#if H_WIFI_DUALBAND_SUPPORT
|
||||
} case RPC_ID__Resp_WifiSetProtocols: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_protocols);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_protocols);
|
||||
app_resp->u.wifi_protocols.ifx =
|
||||
rpc_msg->resp_wifi_set_protocols->ifx;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiGetProtocols: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_get_protocols);
|
||||
RPC_ERR_IN_RESP(resp_wifi_get_protocols);
|
||||
app_resp->u.wifi_protocols.ifx =
|
||||
rpc_msg->resp_wifi_get_protocols->ifx;
|
||||
app_resp->u.wifi_protocols.ghz_2g =
|
||||
rpc_msg->resp_wifi_get_protocols->protocols->ghz_2g;
|
||||
app_resp->u.wifi_protocols.ghz_5g =
|
||||
rpc_msg->resp_wifi_get_protocols->protocols->ghz_5g;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetBandwidths: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_bandwidths);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_bandwidths);
|
||||
app_resp->u.wifi_bandwidths.ifx =
|
||||
rpc_msg->resp_wifi_set_bandwidths->ifx;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiGetBandwidths: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_get_bandwidths);
|
||||
RPC_ERR_IN_RESP(resp_wifi_get_bandwidths);
|
||||
app_resp->u.wifi_bandwidths.ifx =
|
||||
rpc_msg->resp_wifi_get_bandwidths->ifx;
|
||||
app_resp->u.wifi_bandwidths.ghz_2g =
|
||||
rpc_msg->resp_wifi_get_bandwidths->bandwidths->ghz_2g;
|
||||
app_resp->u.wifi_bandwidths.ghz_5g =
|
||||
rpc_msg->resp_wifi_get_bandwidths->bandwidths->ghz_5g;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetBand: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_country_code);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_country_code);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiGetBand: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_get_band);
|
||||
RPC_ERR_IN_RESP(resp_wifi_get_band);
|
||||
app_resp->u.wifi_band =
|
||||
rpc_msg->resp_wifi_get_band->band;
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetBandMode: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_country_code);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_country_code);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiGetBandMode: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_get_bandmode);
|
||||
RPC_ERR_IN_RESP(resp_wifi_get_bandmode);
|
||||
app_resp->u.wifi_band_mode =
|
||||
rpc_msg->resp_wifi_get_bandmode->bandmode;
|
||||
break;
|
||||
#endif // H_WIFI_DUALBAND_SUPPORT
|
||||
} case RPC_ID__Resp_IfaceMacAddrSetGet: {
|
||||
RPC_FAIL_ON_NULL(resp_iface_mac_addr_set_get);
|
||||
RPC_ERR_IN_RESP(resp_iface_mac_addr_set_get);
|
||||
RPC_RSP_COPY_BYTES(app_resp->u.iface_mac.mac, rpc_msg->resp_iface_mac_addr_set_get->mac);
|
||||
break;
|
||||
} case RPC_ID__Resp_IfaceMacAddrLenGet: {
|
||||
RPC_FAIL_ON_NULL(resp_iface_mac_addr_len_get);
|
||||
RPC_ERR_IN_RESP(resp_iface_mac_addr_len_get);
|
||||
app_resp->u.iface_mac_len.type =
|
||||
rpc_msg->resp_iface_mac_addr_len_get->type;
|
||||
app_resp->u.iface_mac_len.len =
|
||||
rpc_msg->resp_iface_mac_addr_len_get->len;
|
||||
break;
|
||||
} case RPC_ID__Resp_FeatureControl: {
|
||||
RPC_FAIL_ON_NULL(resp_feature_control);
|
||||
RPC_ERR_IN_RESP(resp_feature_control);
|
||||
break;
|
||||
#ifdef H_PEER_DATA_TRANSFER
|
||||
} case RPC_ID__Resp_CustomRpc: {
|
||||
RPC_FAIL_ON_NULL(resp_custom_rpc);
|
||||
RPC_ERR_IN_RESP(resp_custom_rpc);
|
||||
ESP_LOGD(TAG, "Custom RPC response received: %zu bytes", rpc_msg->resp_custom_rpc->data.len);
|
||||
app_resp->u.custom_rpc.custom_msg_id = rpc_msg->resp_custom_rpc->custom_msg_id;
|
||||
if (rpc_msg->resp_custom_rpc->data.data && rpc_msg->resp_custom_rpc->data.len > 0) {
|
||||
/* Allocate memory for response data */
|
||||
app_resp->u.custom_rpc.data = (uint8_t *)g_h.funcs->_h_malloc(rpc_msg->resp_custom_rpc->data.len);
|
||||
|
||||
RPC_FAIL_ON_NULL_PRINT(app_resp->u.custom_rpc.data, "Malloc Failed");
|
||||
|
||||
if (app_resp->u.custom_rpc.data) {
|
||||
g_h.funcs->_h_memcpy(app_resp->u.custom_rpc.data, rpc_msg->resp_custom_rpc->data.data, rpc_msg->resp_custom_rpc->data.len);
|
||||
app_resp->u.custom_rpc.data_len = rpc_msg->resp_custom_rpc->data.len;
|
||||
app_resp->u.custom_rpc.free_func = g_h.funcs->_h_free; /* Default free function */
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
} case RPC_ID__Resp_AppGetDesc: {
|
||||
RPC_FAIL_ON_NULL(resp_app_get_desc);
|
||||
RPC_ERR_IN_RESP(resp_app_get_desc);
|
||||
RPC_FAIL_ON_NULL(resp_app_get_desc->app_desc);
|
||||
// copy over the app descriptor elements
|
||||
esp_hosted_app_desc_t *p_a = &app_resp->u.app_desc;
|
||||
EspAppDesc *p_c = rpc_msg->resp_app_get_desc->app_desc;
|
||||
p_a->magic_word = p_c->magic_word;
|
||||
p_a->secure_version = p_c->secure_version;
|
||||
RPC_RSP_COPY_BYTES(p_a->version, p_c->version);
|
||||
RPC_RSP_COPY_BYTES(p_a->project_name, p_c->project_name);
|
||||
RPC_RSP_COPY_BYTES(p_a->time, p_c->time);
|
||||
RPC_RSP_COPY_BYTES(p_a->date, p_c->date);
|
||||
RPC_RSP_COPY_BYTES(p_a->idf_ver, p_c->idf_ver);
|
||||
RPC_RSP_COPY_BYTES(p_a->app_elf_sha256, p_c->app_elf_sha256);
|
||||
p_a->min_efuse_blk_rev_full = p_c->min_efuse_blk_rev_full;
|
||||
p_a->max_efuse_blk_rev_full = p_c->max_efuse_blk_rev_full;
|
||||
p_a->mmu_page_size = p_c->mmu_page_size;
|
||||
break;
|
||||
} case RPC_ID__Resp_SetDhcpDnsStatus: {
|
||||
RPC_FAIL_ON_NULL(resp_set_dhcp_dns);
|
||||
RPC_ERR_IN_RESP(resp_set_dhcp_dns);
|
||||
break;
|
||||
#if H_MEM_MONITOR
|
||||
} case RPC_ID__Resp_MemMonitor: {
|
||||
RPC_FAIL_ON_NULL(resp_mem_monitor);
|
||||
RPC_ERR_IN_RESP(resp_mem_monitor);
|
||||
RPC_FAIL_ON_NULL(resp_mem_monitor->curr_internal);
|
||||
RPC_FAIL_ON_NULL(resp_mem_monitor->curr_internal->mem_dma);
|
||||
RPC_FAIL_ON_NULL(resp_mem_monitor->curr_internal->mem_8bit);
|
||||
RPC_FAIL_ON_NULL(resp_mem_monitor->curr_external);
|
||||
RPC_FAIL_ON_NULL(resp_mem_monitor->curr_external->mem_dma);
|
||||
RPC_FAIL_ON_NULL(resp_mem_monitor->curr_external->mem_8bit);
|
||||
|
||||
// copy over the response
|
||||
esp_hosted_curr_mem_info_t *p_a = &app_resp->u.curr_mem_info;
|
||||
RpcRespMemMonitor *p_c = rpc_msg->resp_mem_monitor;
|
||||
|
||||
if (p_c->config == RPC__MEM_MONITOR_CONFIG__MEMMONITOR_NO_CHANGE) {
|
||||
p_a->config = ESP_HOSTED_MEMMONITOR_NO_CHANGE;
|
||||
} else if (p_c->config == RPC__MEM_MONITOR_CONFIG__MEMMONITOR_DISABLE) {
|
||||
p_a->config = ESP_HOSTED_MEMMONITOR_DISABLE;
|
||||
} else if (p_c->config == RPC__MEM_MONITOR_CONFIG__MEMMONITOR_ENABLE) {
|
||||
p_a->config = ESP_HOSTED_MEMMONITOR_ENABLE;
|
||||
}
|
||||
p_a->report_always = p_c->report_always;
|
||||
p_a->interval_sec = p_c->interval_sec;
|
||||
p_a->curr_total_heap_size = p_c->curr_total_heap_size;
|
||||
p_a->curr_internal.cap_dma.free_size = p_c->curr_internal->mem_dma->free_size;
|
||||
p_a->curr_internal.cap_dma.largest_free_block = p_c->curr_internal->mem_dma->largest_free_block;
|
||||
p_a->curr_internal.cap_8bit.free_size = p_c->curr_internal->mem_8bit->free_size;
|
||||
p_a->curr_internal.cap_8bit.largest_free_block = p_c->curr_internal->mem_8bit->largest_free_block;
|
||||
p_a->curr_external.cap_dma.free_size = p_c->curr_external->mem_dma->free_size;
|
||||
p_a->curr_external.cap_dma.largest_free_block = p_c->curr_external->mem_dma->largest_free_block;
|
||||
p_a->curr_external.cap_8bit.free_size = p_c->curr_external->mem_8bit->free_size;
|
||||
p_a->curr_external.cap_8bit.largest_free_block = p_c->curr_external->mem_8bit->largest_free_block;
|
||||
break;
|
||||
#endif
|
||||
#if H_WIFI_ENTERPRISE_SUPPORT
|
||||
} case RPC_ID__Resp_WifiStaEnterpriseEnable: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_enterprise_enable);
|
||||
RPC_ERR_IN_RESP(resp_wifi_sta_enterprise_enable);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiStaEnterpriseDisable: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_sta_enterprise_disable);
|
||||
RPC_ERR_IN_RESP(resp_wifi_sta_enterprise_disable);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapSetIdentity: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_set_identity);
|
||||
RPC_ERR_IN_RESP(resp_eap_set_identity);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapClearIdentity: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_clear_identity);
|
||||
RPC_ERR_IN_RESP(resp_eap_clear_identity);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapSetUsername: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_set_username);
|
||||
RPC_ERR_IN_RESP(resp_eap_set_username);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapClearUsername: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_clear_username);
|
||||
RPC_ERR_IN_RESP(resp_eap_clear_username);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapSetPassword: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_set_password);
|
||||
RPC_ERR_IN_RESP(resp_eap_set_password);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapClearPassword: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_clear_password);
|
||||
RPC_ERR_IN_RESP(resp_eap_clear_password);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapSetNewPassword: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_set_new_password);
|
||||
RPC_ERR_IN_RESP(resp_eap_set_new_password);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapClearNewPassword: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_clear_new_password);
|
||||
RPC_ERR_IN_RESP(resp_eap_clear_new_password);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapSetCaCert: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_set_ca_cert);
|
||||
RPC_ERR_IN_RESP(resp_eap_set_ca_cert);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapClearCaCert: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_clear_ca_cert);
|
||||
RPC_ERR_IN_RESP(resp_eap_clear_ca_cert);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapSetCertificateAndKey: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_set_certificate_and_key);
|
||||
RPC_ERR_IN_RESP(resp_eap_set_certificate_and_key);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapClearCertificateAndKey: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_clear_certificate_and_key);
|
||||
RPC_ERR_IN_RESP(resp_eap_clear_certificate_and_key);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapGetDisableTimeCheck: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_get_disable_time_check);
|
||||
RPC_ERR_IN_RESP(resp_eap_get_disable_time_check);
|
||||
app_resp->u.eap_disable_time_check.disable = rpc_msg->resp_eap_get_disable_time_check->disable;
|
||||
break;
|
||||
} case RPC_ID__Resp_EapSetTtlsPhase2Method: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_set_ttls_phase2_method);
|
||||
RPC_ERR_IN_RESP(resp_eap_set_ttls_phase2_method);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapSetSuitebCertification: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_set_suiteb_certification);
|
||||
RPC_ERR_IN_RESP(resp_eap_set_suiteb_certification);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapSetPacFile: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_set_pac_file);
|
||||
RPC_ERR_IN_RESP(resp_eap_set_pac_file);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapSetFastParams: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_set_fast_params);
|
||||
RPC_ERR_IN_RESP(resp_eap_set_fast_params);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapUseDefaultCertBundle: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_use_default_cert_bundle);
|
||||
RPC_ERR_IN_RESP(resp_eap_use_default_cert_bundle);
|
||||
break;
|
||||
} case RPC_ID__Resp_WifiSetOkcSupport: {
|
||||
RPC_FAIL_ON_NULL(resp_wifi_set_okc_support);
|
||||
RPC_ERR_IN_RESP(resp_wifi_set_okc_support);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapSetDomainName: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_set_domain_name);
|
||||
RPC_ERR_IN_RESP(resp_eap_set_domain_name);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapSetDisableTimeCheck: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_set_disable_time_check);
|
||||
RPC_ERR_IN_RESP(resp_eap_set_disable_time_check);
|
||||
break;
|
||||
} case RPC_ID__Resp_EapSetEapMethods: {
|
||||
RPC_FAIL_ON_NULL(resp_eap_set_eap_methods);
|
||||
RPC_ERR_IN_RESP(resp_eap_set_eap_methods);
|
||||
break;
|
||||
#endif
|
||||
#if H_DPP_SUPPORT
|
||||
} case RPC_ID__Resp_SuppDppInit: {
|
||||
RPC_FAIL_ON_NULL(resp_supp_dpp_init);
|
||||
RPC_ERR_IN_RESP(resp_supp_dpp_init);
|
||||
break;
|
||||
} case RPC_ID__Resp_SuppDppDeinit: {
|
||||
RPC_FAIL_ON_NULL(resp_supp_dpp_deinit);
|
||||
RPC_ERR_IN_RESP(resp_supp_dpp_deinit);
|
||||
break;
|
||||
} case RPC_ID__Resp_SuppDppBootstrapGen: {
|
||||
RPC_FAIL_ON_NULL(resp_supp_dpp_bootstrap_gen);
|
||||
RPC_ERR_IN_RESP(resp_supp_dpp_bootstrap_gen);
|
||||
break;
|
||||
} case RPC_ID__Resp_SuppDppStartListen: {
|
||||
RPC_FAIL_ON_NULL(resp_supp_dpp_start_listen);
|
||||
RPC_ERR_IN_RESP(resp_supp_dpp_start_listen);
|
||||
break;
|
||||
} case RPC_ID__Resp_SuppDppStopListen: {
|
||||
RPC_FAIL_ON_NULL(resp_supp_dpp_stop_listen);
|
||||
RPC_ERR_IN_RESP(resp_supp_dpp_stop_listen);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if H_GPIO_EXPANDER_SUPPORT
|
||||
} case RPC_ID__Resp_GpioConfig: {
|
||||
RPC_FAIL_ON_NULL(resp_gpio_config);
|
||||
RPC_ERR_IN_RESP(resp_gpio_config);
|
||||
break;
|
||||
} case RPC_ID__Resp_GpioResetPin: {
|
||||
RPC_FAIL_ON_NULL(resp_gpio_reset);
|
||||
RPC_ERR_IN_RESP(resp_gpio_reset);
|
||||
break;
|
||||
} case RPC_ID__Resp_GpioSetLevel: {
|
||||
RPC_FAIL_ON_NULL(resp_gpio_set_level);
|
||||
RPC_ERR_IN_RESP(resp_gpio_set_level);
|
||||
break;
|
||||
} case RPC_ID__Resp_GpioGetLevel: {
|
||||
RPC_FAIL_ON_NULL(resp_gpio_get_level);
|
||||
RPC_ERR_IN_RESP(resp_gpio_get_level);
|
||||
app_resp->u.gpio_get_level = rpc_msg->resp_gpio_get_level->level;
|
||||
break;
|
||||
} case RPC_ID__Resp_GpioSetDirection: {
|
||||
RPC_FAIL_ON_NULL(resp_gpio_set_direction);
|
||||
RPC_ERR_IN_RESP(resp_gpio_set_direction);
|
||||
break;
|
||||
} case RPC_ID__Resp_GpioInputEnable: {
|
||||
RPC_FAIL_ON_NULL(resp_gpio_input_enable);
|
||||
RPC_ERR_IN_RESP(resp_gpio_input_enable);
|
||||
break;
|
||||
} case RPC_ID__Resp_GpioSetPullMode: {
|
||||
RPC_FAIL_ON_NULL(resp_gpio_set_pull_mode);
|
||||
RPC_ERR_IN_RESP(resp_gpio_set_pull_mode);
|
||||
break;
|
||||
#endif
|
||||
#if H_EXT_COEX_SUPPORT
|
||||
} case RPC_ID__Resp_ExtCoex: {
|
||||
RPC_FAIL_ON_NULL(resp_ext_coex);
|
||||
RPC_ERR_IN_RESP(resp_ext_coex);
|
||||
break;
|
||||
#endif
|
||||
} default: {
|
||||
ESP_LOGE(TAG, "Unsupported rpc Resp[%u]", rpc_msg->msg_id);
|
||||
goto fail_parse_rpc_msg;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
app_resp->resp_event_status = SUCCESS;
|
||||
return SUCCESS;
|
||||
|
||||
/* 5. Free up buffers in failure cases */
|
||||
fail_parse_rpc_msg:
|
||||
return SUCCESS;
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "rpc_utils.h"
|
||||
#include "rpc_core.h"
|
||||
#include "esp_hosted_bitmasks.h"
|
||||
#include "esp_hosted_os_abstraction.h"
|
||||
|
||||
#include "port_esp_hosted_host_wifi_config.h"
|
||||
#include "port_esp_hosted_host_log.h"
|
||||
|
||||
#include "esp_log.h"
|
||||
DEFINE_LOG_TAG(rpc_utils);
|
||||
|
||||
#define RPC_UTILS_COPY_BYTES(dst,src) { \
|
||||
if (src.data && src.len) { \
|
||||
g_h.funcs->_h_memcpy(dst, src.data, src.len); \
|
||||
} \
|
||||
}
|
||||
|
||||
esp_err_t rpc_copy_wifi_sta_config(wifi_sta_config_t *dst, WifiStaConfig *src)
|
||||
{
|
||||
wifi_sta_config_t * p_a_sta = dst;
|
||||
WifiStaConfig * p_c_sta = src;
|
||||
|
||||
ESP_LOGW(TAG, "Event: SSID %s", p_c_sta->ssid.data);
|
||||
RPC_UTILS_COPY_BYTES(p_a_sta->ssid, p_c_sta->ssid);
|
||||
RPC_UTILS_COPY_BYTES(p_a_sta->password, p_c_sta->password);
|
||||
p_a_sta->scan_method = p_c_sta->scan_method;
|
||||
p_a_sta->bssid_set = p_c_sta->bssid_set;
|
||||
RPC_UTILS_COPY_BYTES(p_a_sta->bssid, p_c_sta->bssid);
|
||||
p_a_sta->channel = p_c_sta->channel;
|
||||
p_a_sta->listen_interval = p_c_sta->listen_interval;
|
||||
p_a_sta->sort_method = p_c_sta->sort_method;
|
||||
if (p_c_sta->threshold) {
|
||||
p_a_sta->threshold.rssi = p_c_sta->threshold->rssi;
|
||||
p_a_sta->threshold.authmode = p_c_sta->threshold->authmode;
|
||||
#if H_PRESENT_IN_ESP_IDF_5_4_0
|
||||
p_a_sta->threshold.rssi_5g_adjustment = p_c_sta->threshold->rssi_5g_adjustment;
|
||||
#endif
|
||||
}
|
||||
//p_a_sta->ssid_hidden = p_c_sta->ssid_hidden;
|
||||
//p_a_sta->max_connections = p_c_sta->max_connections;
|
||||
if (p_c_sta->pmf_cfg) {
|
||||
p_a_sta->pmf_cfg.capable = p_c_sta->pmf_cfg->capable;
|
||||
p_a_sta->pmf_cfg.required = p_c_sta->pmf_cfg->required;
|
||||
}
|
||||
p_a_sta->rm_enabled = H_GET_BIT(WIFI_STA_CONFIG_1_rm_enabled, p_c_sta->bitmask);
|
||||
p_a_sta->btm_enabled = H_GET_BIT(WIFI_STA_CONFIG_1_btm_enabled, p_c_sta->bitmask);
|
||||
p_a_sta->mbo_enabled = H_GET_BIT(WIFI_STA_CONFIG_1_mbo_enabled, p_c_sta->bitmask);
|
||||
p_a_sta->ft_enabled = H_GET_BIT(WIFI_STA_CONFIG_1_ft_enabled, p_c_sta->bitmask);
|
||||
p_a_sta->owe_enabled = H_GET_BIT(WIFI_STA_CONFIG_1_owe_enabled, p_c_sta->bitmask);
|
||||
p_a_sta->transition_disable = H_GET_BIT(WIFI_STA_CONFIG_1_transition_disable, p_c_sta->bitmask);
|
||||
|
||||
#if H_DECODE_WIFI_RESERVED_FIELD
|
||||
#if H_WIFI_NEW_RESERVED_FIELD_NAMES
|
||||
p_a_sta->reserved1 = WIFI_STA_CONFIG_1_GET_RESERVED_VAL(p_c_sta->bitmask);
|
||||
#else
|
||||
p_a_sta->reserved = WIFI_STA_CONFIG_1_GET_RESERVED_VAL(p_c_sta->bitmask);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
p_a_sta->sae_pwe_h2e = p_c_sta->sae_pwe_h2e;
|
||||
p_a_sta->sae_pk_mode = p_c_sta->sae_pk_mode;
|
||||
p_a_sta->failure_retry_cnt = p_c_sta->failure_retry_cnt;
|
||||
|
||||
p_a_sta->he_dcm_set = H_GET_BIT(WIFI_STA_CONFIG_2_he_dcm_set_BIT, p_c_sta->he_bitmask);
|
||||
|
||||
// WIFI_HE_STA_CONFIG_he_dcm_max_constellation_tx is two bits wide
|
||||
p_a_sta->he_dcm_max_constellation_tx = (p_c_sta->he_bitmask >> WIFI_STA_CONFIG_2_he_dcm_max_constellation_tx_BITS) & 0x03;
|
||||
// WIFI_HE_STA_CONFIG_he_dcm_max_constellation_rx is two bits wide
|
||||
p_a_sta->he_dcm_max_constellation_rx = (p_c_sta->he_bitmask >> WIFI_STA_CONFIG_2_he_dcm_max_constellation_rx_BITS) & 0x03;
|
||||
p_a_sta->he_mcs9_enabled = H_GET_BIT(WIFI_STA_CONFIG_2_he_mcs9_enabled_BIT, p_c_sta->he_bitmask);
|
||||
p_a_sta->he_su_beamformee_disabled = H_GET_BIT(WIFI_STA_CONFIG_2_he_su_beamformee_disabled_BIT, p_c_sta->he_bitmask);
|
||||
p_a_sta->he_trig_su_bmforming_feedback_disabled = H_GET_BIT(WIFI_STA_CONFIG_2_he_trig_su_bmforming_feedback_disabled_BIT, p_c_sta->bitmask);
|
||||
p_a_sta->he_trig_mu_bmforming_partial_feedback_disabled = H_GET_BIT(WIFI_STA_CONFIG_2_he_trig_mu_bmforming_partial_feedback_disabled_BIT, p_c_sta->bitmask);
|
||||
p_a_sta->he_trig_cqi_feedback_disabled = H_GET_BIT(WIFI_STA_CONFIG_2_he_trig_cqi_feedback_disabled_BIT, p_c_sta->bitmask);
|
||||
|
||||
#if H_PRESENT_IN_ESP_IDF_5_5_0
|
||||
p_a_sta->vht_su_beamformee_disabled = H_GET_BIT(WIFI_STA_CONFIG_2_vht_su_beamformee_disabled, p_c_sta->he_bitmask);
|
||||
p_a_sta->vht_mu_beamformee_disabled = H_GET_BIT(WIFI_STA_CONFIG_2_vht_mu_beamformee_disabled, p_c_sta->he_bitmask);
|
||||
p_a_sta->vht_mcs8_enabled = H_GET_BIT(WIFI_STA_CONFIG_2_vht_mcs8_enabled, p_c_sta->he_bitmask);
|
||||
#endif
|
||||
|
||||
#if H_DECODE_WIFI_RESERVED_FIELD
|
||||
#if H_WIFI_NEW_RESERVED_FIELD_NAMES
|
||||
p_a_sta->reserved2 = WIFI_STA_CONFIG_2_GET_RESERVED_VAL(p_c_sta->he_bitmask);
|
||||
#else
|
||||
p_a_sta->he_reserved = WIFI_STA_CONFIG_2_GET_RESERVED_VAL(p_c_sta->he_bitmask);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return ESP_FAIL;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/* Common functions used by rpc code */
|
||||
|
||||
#ifndef __RPC_UTILS_H
|
||||
#define __RPC_UTILS_H
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_wifi.h"
|
||||
|
||||
#include "rpc_slave_if.h"
|
||||
|
||||
esp_err_t rpc_copy_wifi_sta_config(wifi_sta_config_t *dst, WifiStaConfig *src);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,744 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include "rpc_slave_if.h"
|
||||
#include "rpc_core.h"
|
||||
#include "port_esp_hosted_host_wifi_config.h"
|
||||
#include "port_esp_hosted_host_log.h"
|
||||
|
||||
DEFINE_LOG_TAG(rpc_api);
|
||||
|
||||
#define RPC_SEND_REQ(msGiD) do { \
|
||||
assert(req); \
|
||||
req->msg_id = msGiD; \
|
||||
if(SUCCESS != rpc_send_req(req)) { \
|
||||
ESP_LOGE(TAG,"Failed to send control req 0x%x\n", req->msg_id); \
|
||||
return NULL; \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
#define RPC_DECODE_RSP_IF_NOT_ASYNC() do { \
|
||||
if (req->rpc_rsp_cb) \
|
||||
return NULL; \
|
||||
return rpc_wait_and_parse_sync_resp(req); \
|
||||
} while(0);
|
||||
|
||||
|
||||
int rpc_slaveif_init(void)
|
||||
{
|
||||
ESP_LOGD(TAG, "%s", __func__);
|
||||
return rpc_core_init();
|
||||
}
|
||||
|
||||
int rpc_slaveif_start(void)
|
||||
{
|
||||
ESP_LOGD(TAG, "%s", __func__);
|
||||
return rpc_core_start();
|
||||
}
|
||||
|
||||
int rpc_slaveif_stop(void)
|
||||
{
|
||||
ESP_LOGD(TAG, "%s", __func__);
|
||||
return rpc_core_stop();
|
||||
}
|
||||
|
||||
int rpc_slaveif_deinit(void)
|
||||
{
|
||||
ESP_LOGD(TAG, "%s", __func__);
|
||||
return rpc_core_deinit();
|
||||
}
|
||||
|
||||
/** Control Req->Resp APIs **/
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_mac(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_GetMACAddress);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_mac(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_SetMacAddress);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_mode(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_GetWifiMode);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_mode(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_SetWifiMode);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_ps(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetPs);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_ps(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiGetPs);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_max_tx_power(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetMaxTxPower);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_max_tx_power(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiGetMaxTxPower);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_config_heartbeat(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_ConfigHeartbeat);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_ota_begin(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_OTABegin);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_ota_write(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_OTAWrite);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_ota_end(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_OTAEnd);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_ota_activate(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_OTAActivate);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_init(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiInit);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_deinit(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiDeinit);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_start(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStart);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_stop(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStop);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_connect(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiConnect);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_disconnect(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiDisconnect);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_config(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiGetConfig);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_config(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetConfig);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_scan_params(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiScanParams);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_scan_start(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiScanStart);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_scan_stop(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiScanStop);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_scan_get_ap_num(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiScanGetApNum);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_scan_get_ap_record(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiScanGetApRecord);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_scan_get_ap_records(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiScanGetApRecords);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_clear_ap_list(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiClearApList);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_restore(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiRestore);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_clear_fast_connect(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiClearFastConnect);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_deauth_sta(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiDeauthSta);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_get_ap_info(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStaGetApInfo);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_storage(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetStorage);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_bandwidth(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetBandwidth);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_bandwidth(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiGetBandwidth);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_channel(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetChannel);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_channel(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiGetChannel);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_country_code(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetCountryCode);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_country_code(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiGetCountryCode);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_country(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetCountry);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_country(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiGetCountry);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_ap_get_sta_list(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiApGetStaList);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_ap_get_sta_aid(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiApGetStaAid);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_get_rssi(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStaGetRssi);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_protocol(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetProtocol);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_protocol(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiGetProtocol);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_get_negotiated_phymode(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStaGetNegotiatedPhymode);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_get_aid(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStaGetAid);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_protocols(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetProtocols);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_inactive_time(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetInactiveTime);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_inactive_time(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiGetInactiveTime);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_disable_pmf_config(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiDisablePmfConfig);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
#if H_WIFI_HE_SUPPORT
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_twt_config(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStaTwtConfig);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_itwt_setup(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStaItwtSetup);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_itwt_teardown(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStaItwtTeardown);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_itwt_suspend(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStaItwtSuspend);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_itwt_get_flow_id_status(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStaItwtGetFlowIdStatus);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_itwt_send_probe_req(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStaItwtSendProbeReq);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_itwt_set_target_wake_time_offset(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStaItwtSetTargetWakeTimeOffset);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
#endif
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_get_coprocessor_fwversion(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_GetCoprocessorFwVersion);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_iface_mac_addr_set_get(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_IfaceMacAddrSetGet);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_feature_control(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_FeatureControl);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_get_coprocessor_app_desc(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_AppGetDesc);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_iface_mac_addr_len_get(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_IfaceMacAddrLenGet);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
#if H_WIFI_DUALBAND_SUPPORT
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_protocols(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiGetProtocols);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_bandwidths(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetBandwidths);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_bandwidths(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiGetBandwidths);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_band(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetBand);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_band(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiGetBand);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_band_mode(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetBandMode);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_band_mode(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiGetBandMode);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
#endif
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_set_slave_dhcp_dns_status(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_SetDhcpDnsStatus);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
|
||||
#if H_WIFI_ENTERPRISE_SUPPORT
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_enterprise_enable(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStaEnterpriseEnable);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_enterprise_disable(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiStaEnterpriseDisable);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_identity(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapSetIdentity);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_clear_identity(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapClearIdentity);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_username(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapSetUsername);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_clear_username(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapClearUsername);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_password(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapSetPassword);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_clear_password(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapClearPassword);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_new_password(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapSetNewPassword);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_clear_new_password(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapClearNewPassword);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_ca_cert(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapSetCaCert);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_clear_ca_cert(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapClearCaCert);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_certificate_and_key(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapSetCertificateAndKey);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_clear_certificate_and_key(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapClearCertificateAndKey);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_get_disable_time_check(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapGetDisableTimeCheck);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_ttls_phase2_method(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapSetTtlsPhase2Method);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_suiteb_certification(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapSetSuitebCertification);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_pac_file(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapSetPacFile);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_fast_params(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapSetFastParams);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_use_default_cert_bundle(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapUseDefaultCertBundle);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_okc_support(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_WifiSetOkcSupport);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_domain_name(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapSetDomainName);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_disable_time_check(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapSetDisableTimeCheck);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
#if H_GOT_SET_EAP_METHODS_API
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_eap_methods(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_EapSetEapMethods);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
#if H_DPP_SUPPORT
|
||||
ctrl_cmd_t * rpc_slaveif_supp_dpp_init(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_SuppDppInit);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_supp_dpp_deinit(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_SuppDppDeinit);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_supp_dpp_bootstrap_gen(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_SuppDppBootstrapGen);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_supp_dpp_start_listen(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_SuppDppStartListen);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_supp_dpp_stop_listen(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_SuppDppStopListen);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if H_MEM_MONITOR
|
||||
ctrl_cmd_t * rpc_slave_iface_set_mem_monitor(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_MemMonitor);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef H_PEER_DATA_TRANSFER
|
||||
int rpc_slaveif_register_custom_callback(uint32_t msg_id_exp,
|
||||
void (*callback)(uint32_t msg_id_recvd, const uint8_t *data_recvd, size_t data_len_recvd, void *local_context),
|
||||
void *local_context)
|
||||
{
|
||||
return rpc_evt_register_custom_callback(msg_id_exp, callback, local_context);
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_custom_rpc(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_CustomRpc);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if H_GPIO_EXPANDER_SUPPORT
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_config(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_GpioConfig);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_reset_pin(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_GpioResetPin);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_set_level(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_GpioSetLevel);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_get_level(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_GpioGetLevel);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_set_direction(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_GpioSetDirection);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_input_enable(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_GpioInputEnable);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_set_pull_mode(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_GpioSetPullMode);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if H_EXT_COEX_SUPPORT
|
||||
ctrl_cmd_t * rpc_slaveif_ext_coex(ctrl_cmd_t *req)
|
||||
{
|
||||
RPC_SEND_REQ(RPC_ID__Req_ExtCoex);
|
||||
RPC_DECODE_RSP_IF_NOT_ASYNC();
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,924 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2026 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/** prevent recursive inclusion **/
|
||||
#ifndef __RPC_SLAVE_IF_H
|
||||
#define __RPC_SLAVE_IF_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "esp_hosted_rpc.pb-c.h"
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_mac.h"
|
||||
#include "esp_wifi_types.h"
|
||||
#include "esp_hosted_misc.h"
|
||||
#include "esp_hosted_misc_types.h"
|
||||
#include "port_esp_hosted_host_config.h"
|
||||
#include "port_esp_hosted_host_wifi_config.h"
|
||||
|
||||
#if H_WIFI_ENTERPRISE_SUPPORT
|
||||
#include "esp_eap_client.h"
|
||||
#endif
|
||||
#if H_DPP_SUPPORT
|
||||
#include "esp_dpp.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SSID_LENGTH 32
|
||||
#define BSSID_BYTES_SIZE 6
|
||||
#define PASSWORD_LENGTH 64
|
||||
#define STATUS_LENGTH 14
|
||||
#define VENDOR_OUI_BUF 3
|
||||
|
||||
#define IFACE_MAC_SIZE 8 // 6 for MAC-48, 8 for EIU-64, 2 for EFUSE_EXT
|
||||
#define IDF_TARGET_SIZE 20 // increase as required if CONFIG_IDF_TARGET gets larger
|
||||
|
||||
/*
|
||||
#define SUCCESS 0
|
||||
#define FAILURE -1
|
||||
*/
|
||||
|
||||
#define CALLBACK_SET_SUCCESS 0
|
||||
#define CALLBACK_AVAILABLE 0
|
||||
#define CALLBACK_NOT_REGISTERED -1
|
||||
#define MSG_ID_OUT_OF_ORDER -2
|
||||
|
||||
#define MAX_FREE_BUFF_HANDLES 20
|
||||
|
||||
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
|
||||
|
||||
/* If request is already being served and
|
||||
* another request is pending, time period for
|
||||
* which new request will wait in seconds
|
||||
* */
|
||||
//#define WAIT_TIME_B2B_RPC_REQ 5
|
||||
#define DEFAULT_RPC_RSP_TIMEOUT 5
|
||||
#define DEFAULT_RPC_RSP_SCAN_TIMEOUT 30
|
||||
|
||||
#define SUCCESS_STR "success"
|
||||
#define FAILURE_STR "failure"
|
||||
#define NOT_CONNECTED_STR "not_connected"
|
||||
|
||||
#define RPC_RX_QUEUE_SIZE 3
|
||||
#define RPC_TX_QUEUE_SIZE 5
|
||||
|
||||
typedef enum {
|
||||
FEATURE_NONE,
|
||||
FEATURE_BT,
|
||||
FEATURE_OPENTHREAD_RCP,
|
||||
// add additional features here
|
||||
} rpc_feature;
|
||||
|
||||
typedef enum {
|
||||
FEATURE_COMMAND_NONE,
|
||||
FEATURE_COMMAND_BT_INIT,
|
||||
FEATURE_COMMAND_BT_DEINIT,
|
||||
FEATURE_COMMAND_BT_ENABLE,
|
||||
FEATURE_COMMAND_BT_DISABLE,
|
||||
// these can apply to any generic feature
|
||||
FEATURE_COMMAND_INIT,
|
||||
FEATURE_COMMAND_DEINIT,
|
||||
FEATURE_COMMAND_ENABLE,
|
||||
FEATURE_COMMAND_DISABLE,
|
||||
FEATURE_COMMAND_QUERY,
|
||||
// add additional feature commands here
|
||||
} rpc_feature_command;
|
||||
|
||||
typedef enum {
|
||||
FEATURE_OPTION_NONE,
|
||||
FEATURE_OPTION_BT_DEINIT_RELEASE_MEMORY,
|
||||
FEATURE_OPTION_QUERY_CONFIGURED,
|
||||
FEATURE_OPTION_QUERY_INITED,
|
||||
FEATURE_OPTION_QUERY_ENABLED,
|
||||
FEATURE_OPTION_QUERY_READY,
|
||||
// add additional feature options here
|
||||
} rpc_feature_option;
|
||||
|
||||
/*---- Control structures ----*/
|
||||
|
||||
typedef struct {
|
||||
rpc_feature feature;
|
||||
rpc_feature_command command;
|
||||
rpc_feature_option option;
|
||||
} rcp_feature_control_t;
|
||||
|
||||
typedef struct {
|
||||
int mode;
|
||||
uint8_t mac[BSSID_BYTES_SIZE];
|
||||
} wifi_mac_t;
|
||||
|
||||
typedef struct {
|
||||
int mode;
|
||||
} hosted_mode_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t iface;
|
||||
wifi_config_t u;
|
||||
} wifi_cfg_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
wifi_scan_time_t scan_time;
|
||||
uint8_t home_chan_dwell_time;
|
||||
} rpc_wifi_scan_default_params_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t cmd;
|
||||
rpc_wifi_scan_default_params_t config;
|
||||
bool is_config_null;
|
||||
} rpc_wifi_scan_params_t;
|
||||
|
||||
/** @brief Parameters for an SSID scan. */
|
||||
typedef struct {
|
||||
bool block;
|
||||
wifi_scan_config_t cfg;
|
||||
uint8_t cfg_set;
|
||||
} wifi_scan_cfg_t;
|
||||
|
||||
typedef struct {
|
||||
//int count;
|
||||
int number;
|
||||
/* dynamic size */
|
||||
//wifi_scanlist_t *out_list;
|
||||
wifi_ap_record_t *out_list;
|
||||
} wifi_scan_ap_list_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t aid;
|
||||
} wifi_deauth_sta_t;
|
||||
|
||||
typedef struct {
|
||||
int ps_mode;
|
||||
} wifi_power_save_t;
|
||||
|
||||
typedef struct {
|
||||
bool enable;
|
||||
wifi_vendor_ie_type_t type;
|
||||
wifi_vendor_ie_id_t idx;
|
||||
vendor_ie_data_t vnd_ie;
|
||||
} wifi_softap_vendor_ie_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t *ota_data;
|
||||
uint32_t ota_data_len;
|
||||
} ota_write_t;
|
||||
|
||||
typedef struct {
|
||||
int power;
|
||||
} wifi_tx_power_t;
|
||||
|
||||
typedef struct {
|
||||
wifi_interface_t ifx;
|
||||
wifi_bandwidth_t bw;
|
||||
} rpc_wifi_bandwidth_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t primary;
|
||||
wifi_second_chan_t second;
|
||||
} rpc_wifi_channel_t;
|
||||
|
||||
typedef struct {
|
||||
char cc[3];
|
||||
bool ieee80211d_enabled;
|
||||
} rpc_wifi_country_code;
|
||||
|
||||
typedef struct {
|
||||
wifi_interface_t ifx;
|
||||
uint8_t protocol_bitmap;
|
||||
} rpc_wifi_protocol;
|
||||
|
||||
typedef struct {
|
||||
uint8_t mac[6];
|
||||
uint16_t aid;
|
||||
} rpc_wifi_ap_get_sta_aid_t;
|
||||
|
||||
typedef struct {
|
||||
int rssi;
|
||||
} rpc_wifi_sta_get_rssi_t;
|
||||
|
||||
typedef struct {
|
||||
wifi_phy_mode_t phymode;
|
||||
} rpc_wifi_sta_get_negotiated_phymode_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t aid;
|
||||
} rpc_wifi_sta_get_aid_t;
|
||||
|
||||
typedef struct {
|
||||
wifi_interface_t ifx;
|
||||
uint16_t ghz_2g;
|
||||
uint16_t ghz_5g;
|
||||
} rpc_wifi_protocols_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t major1;
|
||||
uint32_t minor1;
|
||||
uint32_t patch1;
|
||||
int32_t revision;
|
||||
int32_t prerelease;
|
||||
int32_t build;
|
||||
uint32_t chip_id;
|
||||
char idf_target[IDF_TARGET_SIZE];
|
||||
} rpc_coprocessor_fwversion_t;
|
||||
|
||||
typedef struct {
|
||||
wifi_interface_t ifx;
|
||||
wifi_bandwidth_t ghz_2g;
|
||||
wifi_bandwidth_t ghz_5g;
|
||||
} rpc_wifi_bandwidths_t;
|
||||
|
||||
typedef struct {
|
||||
int iface;
|
||||
int net_link_up;
|
||||
int dhcp_up;
|
||||
uint8_t dhcp_ip[64];
|
||||
uint8_t dhcp_nm[64];
|
||||
uint8_t dhcp_gw[64];
|
||||
int dns_up;
|
||||
uint8_t dns_ip[64];
|
||||
int dns_type;
|
||||
} rpc_set_dhcp_dns_status_t;
|
||||
|
||||
typedef struct {
|
||||
bool set;
|
||||
esp_mac_type_t type;
|
||||
size_t mac_len;
|
||||
uint8_t mac[IFACE_MAC_SIZE];
|
||||
} rpc_iface_mac_t;
|
||||
|
||||
typedef struct {
|
||||
size_t len;
|
||||
esp_mac_type_t type;
|
||||
} rpc_iface_mac_len_t;
|
||||
|
||||
typedef struct {
|
||||
wifi_interface_t ifx;
|
||||
uint16_t sec;
|
||||
} rpc_wifi_inactive_time_t;
|
||||
|
||||
typedef struct {
|
||||
wifi_interface_t ifx;
|
||||
} rpc_wifi_disable_pmf_config_t;
|
||||
|
||||
#if H_WIFI_HE_SUPPORT
|
||||
typedef struct {
|
||||
int flow_id;
|
||||
int suspend_time_ms;
|
||||
} rpc_wifi_itwt_suspend_t;
|
||||
#endif
|
||||
|
||||
#if H_DPP_SUPPORT
|
||||
// current length of the optional bootstrap gen key length
|
||||
// see documentation for `esp_supp_dpp_bootstrap_gen()`
|
||||
#define DPP_BOOTSTRAP_GEN_KEY_LEN (32)
|
||||
|
||||
#define DPP_URI_LEN_MAX (H_DPP_URI_LEN_MAX + 1) // include NULL at end of string
|
||||
|
||||
typedef struct {
|
||||
const char *chan_list;
|
||||
esp_supp_dpp_bootstrap_t type;
|
||||
const char *key;
|
||||
const char *info;
|
||||
} rpc_supp_dpp_bootstrap_gen_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t uri_data_len; /**< URI data length including null termination */
|
||||
char uri[DPP_URI_LEN_MAX]; /**< URI data */
|
||||
} supp_wifi_event_dpp_uri_ready_t;
|
||||
|
||||
typedef struct {
|
||||
wifi_config_t wifi_cfg; /**< Received WIFI config in DPP */
|
||||
} supp_wifi_event_dpp_config_received_t;
|
||||
|
||||
typedef struct {
|
||||
int failure_reason; /**< Failure reason */
|
||||
} supp_wifi_event_dpp_failed_t;
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
uint32_t cp_reset_reason;
|
||||
} event_init_t;
|
||||
|
||||
typedef struct {
|
||||
/* event */
|
||||
uint32_t hb_num;
|
||||
/* Req */
|
||||
uint8_t enable;
|
||||
uint32_t duration;
|
||||
} event_heartbeat_t;
|
||||
|
||||
typedef struct {
|
||||
int32_t wifi_event_id;
|
||||
} event_wifi_simple_t;
|
||||
|
||||
|
||||
#if H_WIFI_ENTERPRISE_SUPPORT
|
||||
typedef struct {
|
||||
const unsigned char *identity;
|
||||
int len;
|
||||
} rpc_eap_identity_t;
|
||||
|
||||
typedef struct {
|
||||
const unsigned char *username;
|
||||
int len;
|
||||
} rpc_eap_username_t;
|
||||
|
||||
typedef struct {
|
||||
const unsigned char *password;
|
||||
int len;
|
||||
} rpc_eap_password_t;
|
||||
|
||||
typedef struct {
|
||||
const unsigned char *ca_cert;
|
||||
int len;
|
||||
} rpc_eap_ca_cert_t;
|
||||
|
||||
typedef struct {
|
||||
const unsigned char *client_cert;
|
||||
int client_cert_len;
|
||||
const unsigned char *private_key;
|
||||
int private_key_len;
|
||||
const unsigned char *private_key_password;
|
||||
int private_key_passwd_len;
|
||||
} rpc_eap_cert_key_t;
|
||||
|
||||
typedef struct {
|
||||
bool disable;
|
||||
} rpc_eap_disable_time_check_t;
|
||||
|
||||
typedef struct {
|
||||
bool enable;
|
||||
} rpc_eap_suiteb_192bit_t;
|
||||
|
||||
typedef struct {
|
||||
const unsigned char *pac_file;
|
||||
int len;
|
||||
} rpc_eap_pac_file_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
bool use_default;
|
||||
} rpc_eap_default_cert_bundle_t;
|
||||
|
||||
typedef struct {
|
||||
bool enable;
|
||||
} rpc_wifi_okc_support_t;
|
||||
|
||||
typedef struct {
|
||||
const char *domain_name;
|
||||
} rpc_eap_domain_name_t;
|
||||
#endif
|
||||
|
||||
#ifdef H_PEER_DATA_TRANSFER
|
||||
typedef struct {
|
||||
uint32_t custom_msg_id; /* Not used - kept for struct compatibility */
|
||||
uint8_t *data; /* Pointer to raw data */
|
||||
size_t data_len; /* Length of data */
|
||||
void (*free_func)(void *); /* Optional: function to free data after use */
|
||||
} esp_hosted_rpc_data_t;
|
||||
#endif
|
||||
|
||||
#if H_GPIO_EXPANDER_SUPPORT
|
||||
typedef struct {
|
||||
uint64_t pin_bit_mask; /*!< GPIO pin: set with bit mask, each bit maps to a GPIO */
|
||||
uint32_t mode; /*!< GPIO mode: set input/output mode */
|
||||
uint32_t pull_up_en; /*!< GPIO pull-up */
|
||||
uint32_t pull_down_en; /*!< GPIO pull-down */
|
||||
uint32_t intr_type; /*!< GPIO interrupt type */
|
||||
//#if SOC_GPIO_SUPPORT_PIN_HYS_FILTER
|
||||
// uint32_t hys_ctrl_mode; /*!< GPIO hysteresis: hysteresis filter on slope input */
|
||||
//#endif
|
||||
} rpc_gpio_config_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t gpio_num;
|
||||
uint32_t level;
|
||||
} rpc_gpio_set_level_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t gpio_num;
|
||||
uint32_t mode;
|
||||
} rpc_gpio_set_direction_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t gpio_num;
|
||||
uint32_t pull_mode;
|
||||
} rpc_gpio_set_pull_mode_t;
|
||||
#endif
|
||||
|
||||
#if H_EXT_COEX_SUPPORT
|
||||
typedef struct {
|
||||
uint32_t cmd;
|
||||
uint32_t set_gpio_wire_type;
|
||||
int32_t set_gpio_request_pin;
|
||||
int32_t set_gpio_priority_pin;
|
||||
int32_t set_gpio_grant_pin;
|
||||
int32_t set_gpio_tx_line_pin;
|
||||
uint32_t set_work_mode;
|
||||
uint32_t set_grant_delay_us;
|
||||
bool set_validate_high;
|
||||
} rpc_ext_coex_t;
|
||||
#endif
|
||||
|
||||
typedef struct Ctrl_cmd_t {
|
||||
/* msg type could be 1. req 2. resp 3. notification */
|
||||
uint8_t msg_type;
|
||||
|
||||
/* control path protobuf msg number */
|
||||
uint16_t msg_id;
|
||||
|
||||
/* uid of request / response */
|
||||
uint32_t uid;
|
||||
|
||||
/* statusof response or notification */
|
||||
int32_t resp_event_status;
|
||||
|
||||
void * rx_sem;
|
||||
|
||||
union {
|
||||
wifi_init_config_t wifi_init_config;
|
||||
wifi_cfg_t wifi_config;
|
||||
rpc_wifi_scan_params_t wifi_scan_params;
|
||||
wifi_mac_t wifi_mac;
|
||||
hosted_mode_t wifi_mode;
|
||||
|
||||
wifi_softap_vendor_ie_t wifi_softap_vendor_ie;
|
||||
//wifi_softap_conn_sta_list_t wifi_softap_con_sta;
|
||||
|
||||
wifi_power_save_t wifi_ps;
|
||||
|
||||
ota_write_t ota_write;
|
||||
|
||||
wifi_tx_power_t wifi_tx_power;
|
||||
|
||||
wifi_scan_cfg_t wifi_scan_config;
|
||||
|
||||
wifi_ap_record_t wifi_ap_record;
|
||||
|
||||
wifi_scan_ap_list_t wifi_scan_ap_list;
|
||||
|
||||
wifi_deauth_sta_t wifi_deauth_sta;
|
||||
|
||||
wifi_storage_t wifi_storage;
|
||||
|
||||
rpc_wifi_bandwidth_t wifi_bandwidth;
|
||||
|
||||
rpc_wifi_channel_t wifi_channel;
|
||||
|
||||
rpc_wifi_country_code wifi_country_code;
|
||||
|
||||
wifi_country_t wifi_country;
|
||||
|
||||
wifi_sta_list_t wifi_ap_sta_list;
|
||||
|
||||
rpc_wifi_ap_get_sta_aid_t wifi_ap_get_sta_aid;
|
||||
|
||||
rpc_wifi_sta_get_rssi_t wifi_sta_get_rssi;
|
||||
|
||||
rpc_wifi_protocol wifi_protocol;
|
||||
|
||||
rpc_wifi_sta_get_negotiated_phymode_t wifi_sta_get_negotiated_phymode;
|
||||
rpc_wifi_sta_get_aid_t wifi_sta_get_aid;
|
||||
|
||||
rpc_wifi_inactive_time_t wifi_inactive_time;
|
||||
|
||||
rpc_wifi_disable_pmf_config_t wifi_disable_pmf_config;
|
||||
|
||||
rpc_coprocessor_fwversion_t coprocessor_fwversion;
|
||||
|
||||
rpc_iface_mac_t iface_mac;
|
||||
|
||||
rpc_iface_mac_len_t iface_mac_len;
|
||||
|
||||
bool bt_mem_release;
|
||||
|
||||
rcp_feature_control_t feature_control;
|
||||
|
||||
#if H_MEM_MONITOR
|
||||
esp_hosted_config_mem_monitor_t config_mem_monitor;
|
||||
|
||||
esp_hosted_curr_mem_info_t curr_mem_info;
|
||||
#endif
|
||||
|
||||
#ifdef H_PEER_DATA_TRANSFER
|
||||
esp_hosted_rpc_data_t custom_rpc;
|
||||
#endif
|
||||
|
||||
esp_hosted_app_desc_t app_desc;
|
||||
#if H_WIFI_HE_SUPPORT
|
||||
wifi_twt_config_t wifi_twt_config;
|
||||
|
||||
#if H_WIFI_HE_GREATER_THAN_ESP_IDF_5_3
|
||||
wifi_itwt_setup_config_t wifi_itwt_setup_config;
|
||||
#else
|
||||
wifi_twt_setup_config_t wifi_twt_setup_config;
|
||||
#endif
|
||||
|
||||
int wifi_itwt_flow_id;
|
||||
|
||||
rpc_wifi_itwt_suspend_t wifi_itwt_suspend;
|
||||
|
||||
int wifi_itwt_flow_id_bitmap;
|
||||
|
||||
int wifi_itwt_probe_req_timeout_ms;
|
||||
|
||||
int wifi_itwt_set_target_wake_time_offset_us;
|
||||
#endif
|
||||
|
||||
#if H_WIFI_DUALBAND_SUPPORT
|
||||
rpc_wifi_protocols_t wifi_protocols;
|
||||
|
||||
rpc_wifi_bandwidths_t wifi_bandwidths;
|
||||
|
||||
wifi_band_t wifi_band;
|
||||
|
||||
wifi_band_mode_t wifi_band_mode;
|
||||
#endif
|
||||
|
||||
rpc_set_dhcp_dns_status_t slave_dhcp_dns_status;
|
||||
|
||||
#if H_DPP_SUPPORT
|
||||
bool dpp_enable_cb;
|
||||
|
||||
rpc_supp_dpp_bootstrap_gen_t dpp_bootstrap_gen;
|
||||
#endif
|
||||
|
||||
event_init_t e_init;
|
||||
|
||||
event_heartbeat_t e_heartbeat;
|
||||
|
||||
event_wifi_simple_t e_wifi_simple;
|
||||
|
||||
esp_hosted_event_mem_info_t e_mem_info;
|
||||
|
||||
wifi_event_ap_staconnected_t e_wifi_ap_staconnected;
|
||||
|
||||
wifi_event_ap_stadisconnected_t e_wifi_ap_stadisconnected;
|
||||
|
||||
wifi_event_sta_scan_done_t e_wifi_sta_scan_done;
|
||||
|
||||
wifi_event_sta_connected_t e_wifi_sta_connected;
|
||||
|
||||
wifi_event_sta_disconnected_t e_wifi_sta_disconnected;
|
||||
|
||||
#if H_WIFI_HE_SUPPORT
|
||||
wifi_event_sta_itwt_setup_t e_wifi_sta_itwt_setup;
|
||||
|
||||
wifi_event_sta_itwt_teardown_t e_wifi_sta_itwt_teardown;
|
||||
|
||||
wifi_event_sta_itwt_suspend_t e_wifi_sta_itwt_suspend;
|
||||
|
||||
wifi_event_sta_itwt_probe_t e_wifi_sta_itwt_probe;
|
||||
#endif
|
||||
#if H_WIFI_ENTERPRISE_SUPPORT
|
||||
rpc_eap_identity_t eap_identity;
|
||||
|
||||
rpc_eap_username_t eap_username;
|
||||
|
||||
rpc_eap_password_t eap_password;
|
||||
|
||||
rpc_eap_ca_cert_t eap_ca_cert;
|
||||
|
||||
rpc_eap_cert_key_t eap_cert_key;
|
||||
|
||||
rpc_eap_disable_time_check_t eap_disable_time_check;
|
||||
|
||||
esp_eap_ttls_phase2_types eap_ttls_phase2;
|
||||
|
||||
rpc_eap_suiteb_192bit_t eap_suiteb_192bit;
|
||||
|
||||
rpc_eap_pac_file_t eap_pac_file;
|
||||
|
||||
esp_eap_fast_config eap_fast_config;
|
||||
|
||||
rpc_eap_default_cert_bundle_t eap_default_cert_bundle;
|
||||
|
||||
rpc_wifi_okc_support_t wifi_okc_support;
|
||||
|
||||
rpc_eap_domain_name_t eap_domain_name;
|
||||
|
||||
#if H_GOT_SET_EAP_METHODS_API
|
||||
esp_eap_method_t methods;
|
||||
#endif
|
||||
#endif
|
||||
#if H_DPP_SUPPORT
|
||||
supp_wifi_event_dpp_uri_ready_t e_dpp_uri_ready;
|
||||
|
||||
supp_wifi_event_dpp_config_received_t e_dpp_config_received;
|
||||
|
||||
supp_wifi_event_dpp_failed_t e_dpp_failed;
|
||||
#endif
|
||||
|
||||
#if H_GPIO_EXPANDER_SUPPORT
|
||||
rpc_gpio_config_t gpio_config;
|
||||
|
||||
uint32_t gpio_num;
|
||||
|
||||
rpc_gpio_set_level_t gpio_set_level;
|
||||
|
||||
int gpio_get_level;
|
||||
|
||||
rpc_gpio_set_direction_t gpio_set_direction;
|
||||
|
||||
rpc_gpio_set_pull_mode_t gpio_set_pull_mode;
|
||||
#endif
|
||||
#if H_EXT_COEX_SUPPORT
|
||||
rpc_ext_coex_t ext_coex;
|
||||
#endif
|
||||
}u;
|
||||
|
||||
/* By default this callback is set to NULL.
|
||||
* When this callback is set by app while triggering request,
|
||||
* it will be automatically called asynchronously
|
||||
* by hosted control lib on receiving control response
|
||||
* in this case app will not be waiting for response.
|
||||
*
|
||||
* Whereas, when this is not set i.e. is NULL, it is understood
|
||||
* as synchronous response, and app after sending request,
|
||||
* will wait till getting a response
|
||||
*/
|
||||
int (*rpc_rsp_cb)(struct Ctrl_cmd_t *data);
|
||||
|
||||
/* Wait for timeout duration, if response not received,
|
||||
* it will send timeout response.
|
||||
* Default value for this time out is DEFAULT_RPC_RESP_TIMEOUT */
|
||||
int rsp_timeout_sec;
|
||||
|
||||
/* rpc takes only one request at a time.
|
||||
* If new request comes before previous command execution,
|
||||
* wait for previous command execution for these many seconds, else return failure.
|
||||
* Default: WAIT_TIME_B2B_RPC_REQ */
|
||||
int wait_prev_cmd_completion;
|
||||
|
||||
/* assign the data pointer to free by lower layer.
|
||||
* Ignored if assigned as NULL */
|
||||
void *app_free_buff_hdl;
|
||||
|
||||
/* free handle to be registered
|
||||
* Ignored if assigned as NULL */
|
||||
void (*app_free_buff_func)(void *app_free_buff_hdl);
|
||||
|
||||
void *rpc_free_buff_hdls[MAX_FREE_BUFF_HANDLES];
|
||||
uint8_t n_rpc_free_buff_hdls;
|
||||
} ctrl_cmd_t;
|
||||
|
||||
|
||||
/* resp callback */
|
||||
typedef int (*rpc_rsp_cb_t) (ctrl_cmd_t * resp);
|
||||
|
||||
/* event callback */
|
||||
typedef int (*rpc_evt_cb_t) (ctrl_cmd_t * event);
|
||||
|
||||
|
||||
/*---- Control API Function ----*/
|
||||
|
||||
|
||||
/* This file contains hosted control library exposed APIs.
|
||||
* For detailed documentation, Please refer `../../../docs/common/ctrl_apis.md`
|
||||
*
|
||||
* As important note, application using these APIs, should clean
|
||||
* 1. allocated buffer within library are saved in `app_resp->app_free_buff_hdl`
|
||||
* Please use `app_resp->app_free_buff_func` for freeing them.
|
||||
* 2. Response `ctrl_cmd_t *app_resp` is also allocated from library,
|
||||
* need to free using g_h.funcs->_h_free() function.
|
||||
**/
|
||||
|
||||
/* Set control event callback
|
||||
*
|
||||
* when user sets event callback, user provided function pointer
|
||||
* will be registered with user function
|
||||
* If user does not register event callback,
|
||||
* events received from ESP32 will be dropped
|
||||
*
|
||||
* Inputs:
|
||||
* > event - Control Event ID
|
||||
* > event_cb - NULL - resets event callback
|
||||
* Function pointer - Registers event callback
|
||||
* Returns:
|
||||
* > MSG_ID_OUT_OF_ORDER - If event is not registered with hosted control lib
|
||||
* > CALLBACK_SET_SUCCESS - Callback is set successful
|
||||
**/
|
||||
int set_event_callback(int event, rpc_rsp_cb_t event_cb);
|
||||
|
||||
/* Reset control event callback
|
||||
*
|
||||
* when user sets event callback, user provided function pointer
|
||||
* will be registered with user function
|
||||
* If user does not register event callback,
|
||||
* events received from ESP32 will be dropped
|
||||
*
|
||||
* Inputs:
|
||||
* > event - Control Event ID
|
||||
*
|
||||
* Returns:
|
||||
* > MSG_ID_OUT_OF_ORDER - If event is not registered with hosted control lib
|
||||
* > CALLBACK_SET_SUCCESS - Callback is set successful
|
||||
**/
|
||||
int reset_event_callback(int event);
|
||||
|
||||
|
||||
/* Initialize hosted control library
|
||||
*
|
||||
* This is first step for application while using control path
|
||||
* This will allocate and instantiate hosted control library
|
||||
*
|
||||
* Returns:
|
||||
* > SUCCESS - 0
|
||||
* > FAILURE - -1
|
||||
**/
|
||||
int rpc_slaveif_init(void);
|
||||
|
||||
/* De-initialize hosted control library
|
||||
*
|
||||
* This is last step for application while using control path
|
||||
* This will deallocate and cleanup hosted control library
|
||||
*
|
||||
* Returns:
|
||||
* > SUCCESS - 0
|
||||
* > FAILURE - -1
|
||||
**/
|
||||
int rpc_slaveif_deinit(void);
|
||||
|
||||
int rpc_slaveif_start(void);
|
||||
|
||||
int rpc_slaveif_stop(void);
|
||||
|
||||
/* Get the MAC address of station or softAP interface of ESP32 */
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_mac(ctrl_cmd_t *req);
|
||||
|
||||
/* Set MAC address of ESP32 interface for given wifi mode */
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_mac(ctrl_cmd_t *req);
|
||||
|
||||
/* Get Wi-Fi mode of ESP32 */
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_mode(ctrl_cmd_t *req);
|
||||
|
||||
/* Set the Wi-Fi mode of ESP32 */
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_mode(ctrl_cmd_t *req);
|
||||
|
||||
/* Sets maximum WiFi transmitting power at ESP32 */
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_max_tx_power(ctrl_cmd_t *req);
|
||||
|
||||
/* Gets maximum WiFi transmitting power at ESP32 */
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_max_tx_power(ctrl_cmd_t *req);
|
||||
|
||||
/* Configure heartbeat event. Be default heartbeat is not enabled.
|
||||
* To enable heartbeats, user need to use this API in addition
|
||||
* to setting event callback for heartbeat event */
|
||||
ctrl_cmd_t * rpc_slaveif_config_heartbeat(ctrl_cmd_t *req);
|
||||
|
||||
/* Performs an OTA begin operation for ESP32 which erases and
|
||||
* prepares existing flash partition for new flash writing */
|
||||
ctrl_cmd_t * rpc_slaveif_ota_begin(ctrl_cmd_t *req);
|
||||
|
||||
/* Performs an OTA write operation for ESP32, It writes bytes from `ota_data`
|
||||
* buffer with `ota_data_len` number of bytes to OTA partition in flash. Number
|
||||
* of bytes can be small than size of complete binary to be flashed. In that
|
||||
* case, this caller is expected to repeatedly call this function till
|
||||
* total size written equals size of complete binary */
|
||||
ctrl_cmd_t * rpc_slaveif_ota_write(ctrl_cmd_t *req);
|
||||
|
||||
/* Performs an OTA end operation for ESP32, It validates written OTA image,
|
||||
* sets newly written OTA partition as boot partition for next boot,
|
||||
* Creates timer which reset ESP32 after 5 sec */
|
||||
ctrl_cmd_t * rpc_slaveif_ota_end(ctrl_cmd_t *req);
|
||||
|
||||
/* Performs an OTA activate operation for ESP32, It reboots the ESP32
|
||||
* to activate the newly written OTA partition */
|
||||
ctrl_cmd_t * rpc_slaveif_ota_activate(ctrl_cmd_t *req);
|
||||
|
||||
/* Gets the co-processor FW Version */
|
||||
ctrl_cmd_t * rpc_slaveif_get_coprocessor_fwversion(ctrl_cmd_t *req);
|
||||
|
||||
/* TODO: add descriptions */
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_init(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_deinit(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_start(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_stop(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_connect(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_disconnect(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_config(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_config(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_scan_params(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_scan_start(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_scan_stop(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_scan_get_ap_num(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_scan_get_ap_record(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_scan_get_ap_records(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_clear_ap_list(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_restore(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_clear_fast_connect(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_deauth_sta(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_get_ap_info(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_ps(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_ps(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_storage(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_bandwidth(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_bandwidth(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_channel(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_channel(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_country_code(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_country_code(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_country(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_country(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_ap_get_sta_list(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_ap_get_sta_aid(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_get_rssi(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_protocol(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_protocol(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_get_negotiated_phymode(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_get_aid(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_protocols(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_protocols(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_bandwidths(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_bandwidths(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_band(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_band(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_band_mode(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_band_mode(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_set_slave_dhcp_dns_status(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_iface_mac_addr_set_get(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_feature_control(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_get_coprocessor_app_desc(ctrl_cmd_t *req);
|
||||
|
||||
#if H_MEM_MONITOR
|
||||
ctrl_cmd_t * rpc_slave_iface_set_mem_monitor(ctrl_cmd_t *req);
|
||||
#endif
|
||||
|
||||
ctrl_cmd_t * rpc_slaveif_iface_mac_addr_set_get(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slave_feature_command(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_iface_mac_addr_len_get(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_inactive_time(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_get_inactive_time(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_disable_pmf_config(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_twt_config(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_itwt_setup(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_itwt_teardown(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_itwt_suspend(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_itwt_get_flow_id_status(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_itwt_send_probe_req(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_itwt_set_target_wake_time_offset(ctrl_cmd_t *req);
|
||||
|
||||
#if H_WIFI_ENTERPRISE_SUPPORT
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_enterprise_enable(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_sta_enterprise_disable(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_identity(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_clear_identity(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_username(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_clear_username(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_password(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_clear_password(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_new_password(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_clear_new_password(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_ca_cert(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_clear_ca_cert(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_certificate_and_key(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_clear_certificate_and_key(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_disable_time_check(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_get_disable_time_check(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_ttls_phase2_method(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_suiteb_certification(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_pac_file(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_fast_params(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_use_default_cert_bundle(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_wifi_set_okc_support(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_domain_name(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_eap_set_eap_methods(ctrl_cmd_t *req);
|
||||
#endif
|
||||
#if H_DPP_SUPPORT
|
||||
ctrl_cmd_t * rpc_slaveif_supp_dpp_init(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_supp_dpp_deinit(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_supp_dpp_bootstrap_gen(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_supp_dpp_start_listen(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_supp_dpp_stop_listen(ctrl_cmd_t *req);
|
||||
#endif
|
||||
|
||||
#ifdef H_PEER_DATA_TRANSFER
|
||||
ctrl_cmd_t * rpc_slaveif_custom_rpc(ctrl_cmd_t *req);
|
||||
int rpc_slaveif_register_custom_callback(uint32_t msg_id_exp,
|
||||
void (*callback)(uint32_t msg_id_recvd, const uint8_t *data_recvd, size_t data_len_recvd, void *local_context),
|
||||
void *local_context);
|
||||
#endif
|
||||
|
||||
#if H_GPIO_EXPANDER_SUPPORT
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_config(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_reset_pin(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_set_level(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_get_level(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_set_direction(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_input_enable(ctrl_cmd_t *req);
|
||||
ctrl_cmd_t * rpc_slaveif_gpio_set_pull_mode(ctrl_cmd_t *req);
|
||||
#endif
|
||||
#if H_EXT_COEX_SUPPORT
|
||||
ctrl_cmd_t * rpc_slaveif_ext_coex(ctrl_cmd_t *req);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/** prevent recursive inclusion **/
|
||||
#ifndef __RPC_WRAP_H__
|
||||
#define __RPC_WRAP_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Includes **/
|
||||
#include "esp_wifi.h"
|
||||
#include "port_esp_hosted_host_wifi_config.h"
|
||||
#include "port_esp_hosted_host_config.h"
|
||||
#include "port_esp_hosted_host_openthread.h"
|
||||
#include "esp_mac.h"
|
||||
#include "esp_hosted_api_types.h"
|
||||
#include "esp_hosted_misc.h"
|
||||
#include "esp_hosted_misc_types.h"
|
||||
|
||||
#if H_WIFI_ENTERPRISE_SUPPORT
|
||||
#include "esp_eap_client.h"
|
||||
#endif
|
||||
#if H_DPP_SUPPORT
|
||||
#include "esp_dpp.h"
|
||||
#endif
|
||||
#if H_GPIO_EXPANDER_SUPPORT
|
||||
#include "esp_hosted_cp_gpio.h"
|
||||
#endif
|
||||
#if H_EXT_COEX_SUPPORT
|
||||
#include "esp_hosted_cp_ext_coex.h"
|
||||
#endif
|
||||
#if H_HOST_OT_ENABLE
|
||||
#include "esp_hosted_openthread.h"
|
||||
#endif
|
||||
/** Exported variables **/
|
||||
|
||||
/** Inline functions **/
|
||||
|
||||
/** Exported Functions **/
|
||||
esp_err_t rpc_init(void);
|
||||
esp_err_t rpc_start(void);
|
||||
esp_err_t rpc_stop(void);
|
||||
esp_err_t rpc_deinit(void);
|
||||
esp_err_t rpc_unregister_event_callbacks(void);
|
||||
esp_err_t rpc_register_event_callbacks(void);
|
||||
|
||||
esp_err_t rpc_wifi_init(const wifi_init_config_t *arg);
|
||||
esp_err_t rpc_wifi_deinit(void);
|
||||
esp_err_t rpc_wifi_set_mode(wifi_mode_t mode);
|
||||
esp_err_t rpc_wifi_get_mode(wifi_mode_t* mode);
|
||||
esp_err_t rpc_wifi_start(void);
|
||||
esp_err_t rpc_wifi_stop(void);
|
||||
esp_err_t rpc_wifi_connect(void);
|
||||
esp_err_t rpc_wifi_disconnect(void);
|
||||
esp_err_t rpc_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf);
|
||||
esp_err_t rpc_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf);
|
||||
esp_err_t rpc_wifi_get_mac(wifi_interface_t mode, uint8_t mac[6]);
|
||||
esp_err_t rpc_wifi_set_mac(wifi_interface_t mode, const uint8_t mac[6]);
|
||||
esp_err_t rpc_wifi_set_scan_parameters(const wifi_scan_default_params_t *config);
|
||||
esp_err_t rpc_wifi_get_scan_parameters(wifi_scan_default_params_t *config);
|
||||
|
||||
esp_err_t rpc_wifi_scan_start(const wifi_scan_config_t *config, bool block);
|
||||
esp_err_t rpc_wifi_scan_stop(void);
|
||||
esp_err_t rpc_wifi_scan_get_ap_num(uint16_t *number);
|
||||
esp_err_t rpc_wifi_scan_get_ap_record(wifi_ap_record_t *ap_record);
|
||||
esp_err_t rpc_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records);
|
||||
esp_err_t rpc_wifi_clear_ap_list(void);
|
||||
esp_err_t rpc_wifi_restore(void);
|
||||
esp_err_t rpc_wifi_clear_fast_connect(void);
|
||||
esp_err_t rpc_wifi_deauth_sta(uint16_t aid);
|
||||
esp_err_t rpc_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info);
|
||||
esp_err_t rpc_wifi_set_ps(wifi_ps_type_t type);
|
||||
esp_err_t rpc_wifi_get_ps(wifi_ps_type_t *type);
|
||||
esp_err_t rpc_wifi_set_storage(wifi_storage_t storage);
|
||||
esp_err_t rpc_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw);
|
||||
esp_err_t rpc_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw);
|
||||
esp_err_t rpc_wifi_set_channel(uint8_t primary, wifi_second_chan_t second);
|
||||
esp_err_t rpc_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second);
|
||||
esp_err_t rpc_wifi_set_country_code(const char *country, bool ieee80211d_enabled);
|
||||
esp_err_t rpc_wifi_get_country_code(char *country);
|
||||
esp_err_t rpc_wifi_set_country(const wifi_country_t *country);
|
||||
esp_err_t rpc_wifi_get_country(wifi_country_t *country);
|
||||
esp_err_t rpc_wifi_ap_get_sta_list(wifi_sta_list_t *sta);
|
||||
esp_err_t rpc_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid);
|
||||
esp_err_t rpc_wifi_sta_get_rssi(int *rssi);
|
||||
esp_err_t rpc_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap);
|
||||
esp_err_t rpc_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);
|
||||
esp_err_t rpc_wifi_set_max_tx_power(int8_t power);
|
||||
esp_err_t rpc_wifi_get_max_tx_power(int8_t *power);
|
||||
esp_err_t rpc_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode);
|
||||
esp_err_t rpc_wifi_sta_get_aid(uint16_t *aid);
|
||||
esp_err_t rpc_wifi_set_inactive_time(wifi_interface_t ifx, uint16_t sec);
|
||||
esp_err_t rpc_wifi_get_inactive_time(wifi_interface_t ifx, uint16_t *sec);
|
||||
esp_err_t rpc_wifi_disable_pmf_config(wifi_interface_t ifx);
|
||||
esp_err_t rpc_get_coprocessor_fwversion(esp_hosted_coprocessor_fwver_t *ver_info);
|
||||
esp_err_t rpc_get_cp_info(uint32_t *cp_chip_id, char *cp_target_name, size_t cp_target_name_len);
|
||||
|
||||
esp_err_t rpc_bt_controller_init(void);
|
||||
esp_err_t rpc_bt_controller_deinit(bool mem_release);
|
||||
esp_err_t rpc_bt_controller_enable(void);
|
||||
esp_err_t rpc_bt_controller_disable(void);
|
||||
|
||||
esp_err_t rpc_iface_mac_addr_set_get(bool set, uint8_t *mac, size_t mac_len, esp_mac_type_t type);
|
||||
esp_err_t rpc_iface_mac_addr_len_get(size_t *len, esp_mac_type_t type);
|
||||
|
||||
esp_err_t rpc_iface_get_coprocessor_app_desc(esp_hosted_app_desc_t *app_desc);
|
||||
esp_err_t rpc_iface_configure_heartbeat(bool enable, int duration_sec);
|
||||
|
||||
#if H_MEM_MONITOR
|
||||
esp_err_t rpc_iface_set_mem_monitor(esp_hosted_config_mem_monitor_t *config, esp_hosted_curr_mem_info_t *curr_mem_info);
|
||||
#endif
|
||||
|
||||
#if H_HOST_OT_ENABLE
|
||||
esp_err_t rpc_iface_openthread_rcp_init(void);
|
||||
esp_err_t rpc_iface_openthread_rcp_deinit(void);
|
||||
esp_err_t rpc_iface_openthread_rcp_start(void);
|
||||
esp_err_t rpc_iface_openthread_rcp_stop(void);
|
||||
esp_err_t rpc_iface_openthread_rcp_query(esp_hosted_openthread_query_t query);
|
||||
#endif
|
||||
|
||||
esp_err_t rpc_ota_begin(void);
|
||||
esp_err_t rpc_ota_write(uint8_t* ota_data, uint32_t ota_data_len);
|
||||
esp_err_t rpc_ota_end(void);
|
||||
esp_err_t rpc_ota_activate(void);
|
||||
|
||||
#if H_WIFI_HE_SUPPORT
|
||||
esp_err_t rpc_wifi_sta_twt_config(wifi_twt_config_t *config);
|
||||
#if H_WIFI_HE_GREATER_THAN_ESP_IDF_5_3
|
||||
esp_err_t rpc_wifi_sta_itwt_setup(wifi_itwt_setup_config_t *setup_config);
|
||||
#else
|
||||
esp_err_t rpc_wifi_sta_itwt_setup(wifi_twt_setup_config_t *setup_config);
|
||||
#endif
|
||||
esp_err_t rpc_wifi_sta_itwt_teardown(int flow_id);
|
||||
esp_err_t rpc_wifi_sta_itwt_suspend(int flow_id, int suspend_time_ms);
|
||||
esp_err_t rpc_wifi_sta_itwt_get_flow_id_status(int *flow_id_bitmap);
|
||||
esp_err_t rpc_wifi_sta_itwt_send_probe_req(int timeout_ms);
|
||||
esp_err_t rpc_wifi_sta_itwt_set_target_wake_time_offset(int offset_us);
|
||||
#endif
|
||||
|
||||
#if H_WIFI_DUALBAND_SUPPORT
|
||||
esp_err_t rpc_wifi_set_band(wifi_band_t band);
|
||||
esp_err_t rpc_wifi_get_band(wifi_band_t *band);
|
||||
esp_err_t rpc_wifi_set_band_mode(wifi_band_mode_t band_mode);
|
||||
esp_err_t rpc_wifi_get_band_mode(wifi_band_mode_t *band_mode);
|
||||
esp_err_t rpc_wifi_set_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols);
|
||||
esp_err_t rpc_wifi_get_protocols(wifi_interface_t ifx, wifi_protocols_t *protocols);
|
||||
esp_err_t rpc_wifi_set_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw);
|
||||
esp_err_t rpc_wifi_get_bandwidths(wifi_interface_t ifx, wifi_bandwidths_t *bw);
|
||||
#endif
|
||||
|
||||
esp_err_t rpc_set_dhcp_dns_status(wifi_interface_t interface, uint8_t link_up,
|
||||
uint8_t dhcp_up, char *dhcp_ip, char *dhcp_nm, char *dhcp_gw,
|
||||
uint8_t dns_up, char *dns_ip, uint8_t dns_type);
|
||||
|
||||
#if H_WIFI_ENTERPRISE_SUPPORT
|
||||
esp_err_t rpc_wifi_sta_enterprise_enable(void);
|
||||
esp_err_t rpc_wifi_sta_enterprise_disable(void);
|
||||
esp_err_t rpc_eap_client_set_identity(const unsigned char *identity, int len);
|
||||
esp_err_t rpc_eap_client_clear_identity(void);
|
||||
esp_err_t rpc_eap_client_set_username(const unsigned char *username, int len);
|
||||
esp_err_t rpc_eap_client_clear_username(void);
|
||||
esp_err_t rpc_eap_client_set_password(const unsigned char *password, int len);
|
||||
esp_err_t rpc_eap_client_clear_password(void);
|
||||
esp_err_t rpc_eap_client_set_new_password(const unsigned char *new_password, int len);
|
||||
esp_err_t rpc_eap_client_clear_new_password(void);
|
||||
esp_err_t rpc_eap_client_set_ca_cert(const unsigned char *ca_cert, int ca_cert_len);
|
||||
esp_err_t rpc_eap_client_clear_ca_cert(void);
|
||||
|
||||
esp_err_t rpc_eap_client_set_certificate_and_key(const unsigned char *client_cert, int client_cert_len,
|
||||
const unsigned char *private_key, int private_key_len,
|
||||
const unsigned char *private_key_password, int private_key_passwd_len);
|
||||
esp_err_t rpc_eap_client_clear_certificate_and_key(void);
|
||||
esp_err_t rpc_eap_client_set_disable_time_check(bool disable);
|
||||
esp_err_t rpc_eap_client_get_disable_time_check(bool *disable);
|
||||
esp_err_t rpc_eap_client_set_ttls_phase2_method(esp_eap_ttls_phase2_types type);
|
||||
esp_err_t rpc_eap_client_set_suiteb_192bit_certification(bool enable);
|
||||
esp_err_t rpc_eap_client_set_pac_file(const unsigned char *pac_file, int pac_file_len);
|
||||
esp_err_t rpc_eap_client_set_fast_params(esp_eap_fast_config config);
|
||||
esp_err_t rpc_eap_client_use_default_cert_bundle(bool use_default_bundle);
|
||||
esp_err_t rpc_wifi_set_okc_support(bool enable);
|
||||
esp_err_t rpc_eap_client_set_domain_name(const char *domain_name);
|
||||
#if H_GOT_SET_EAP_METHODS_API
|
||||
esp_err_t rpc_eap_client_set_eap_methods(esp_eap_method_t methods);
|
||||
#endif
|
||||
#endif
|
||||
#if H_DPP_SUPPORT
|
||||
#if H_SUPP_DPP_SUPPORT
|
||||
esp_err_t rpc_supp_dpp_init(esp_supp_dpp_event_cb_t evt_cb);
|
||||
#else
|
||||
esp_err_t rpc_supp_dpp_init(void);
|
||||
#endif
|
||||
esp_err_t rpc_supp_dpp_deinit(void);
|
||||
esp_err_t rpc_supp_dpp_bootstrap_gen(const char *chan_list,
|
||||
esp_supp_dpp_bootstrap_t type,
|
||||
const char *key, const char *info);
|
||||
esp_err_t rpc_supp_dpp_start_listen(void);
|
||||
esp_err_t rpc_supp_dpp_stop_listen(void);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user