diff --git a/components/esp_wifi_remote/include/esp_wifi_remote.h b/components/esp_wifi_remote/include/esp_wifi_remote.h index d04f468e2d8..a8a2aebb6cb 100644 --- a/components/esp_wifi_remote/include/esp_wifi_remote.h +++ b/components/esp_wifi_remote/include/esp_wifi_remote.h @@ -13,6 +13,7 @@ typedef struct esp_remote_channel *esp_remote_channel_t; typedef struct esp_remote_channel_config *esp_remote_channel_config_t; // Public API +#if 0 esp_err_t remote_esp_wifi_connect(void); esp_err_t remote_esp_wifi_disconnect(void); esp_err_t remote_esp_wifi_init(const wifi_init_config_t *config); @@ -50,7 +51,14 @@ esp_err_t remote_esp_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid); esp_err_t remote_esp_wifi_sta_get_rssi(int *rssi); esp_err_t remote_esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap); esp_err_t remote_esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap); +#endif +#define ESP_WIFI_REMOTE_WITH_HOSTED 1 +#if ESP_WIFI_REMOTE_WITH_HOSTED +#include "esp_wifi_remote_with_hosted.h" +#else +#include "esp_wifi_remote_api.h" +#endif // TODO: Move this to private include // Private API diff --git a/components/esp_wifi_remote/include/esp_wifi_remote_api.h b/components/esp_wifi_remote/include/esp_wifi_remote_api.h new file mode 100644 index 00000000000..5fe8806b9c5 --- /dev/null +++ b/components/esp_wifi_remote/include/esp_wifi_remote_api.h @@ -0,0 +1,81 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config); +esp_err_t esp_wifi_remote_deinit(void); +esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode); +esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode); +esp_err_t esp_wifi_remote_start(void); +esp_err_t esp_wifi_remote_stop(void); +esp_err_t esp_wifi_remote_restore(void); +esp_err_t esp_wifi_remote_connect(void); +esp_err_t esp_wifi_remote_disconnect(void); +esp_err_t esp_wifi_remote_clear_fast_connect(void); +esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid); +esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block); +esp_err_t esp_wifi_remote_scan_stop(void); +esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number); +esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records); +esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record); +esp_err_t esp_wifi_remote_clear_ap_list(void); +esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info); +esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type); +esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type); +esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap); +esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap); +esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw); +esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw); +esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second); +esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second); +esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country); +esp_err_t esp_wifi_remote_get_country(wifi_country_t *country); +esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]); +esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]); +esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); +esp_err_t esp_wifi_remote_set_promiscuous(_Bool en); +esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en); +esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter); +esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter); +esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter); +esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter); +esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf); +esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf); +esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta); +esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid); +esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage); +esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie); +esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx); +esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power); +esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power); +esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask); +esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask); +esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq); +esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx); +esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config); +esp_err_t esp_wifi_remote_set_csi(_Bool en); +esp_err_t esp_wifi_remote_set_ant_gpio(const wifi_ant_gpio_config_t *config); +esp_err_t esp_wifi_remote_get_ant_gpio(wifi_ant_gpio_config_t *config); +esp_err_t esp_wifi_remote_set_ant(const wifi_ant_config_t *config); +esp_err_t esp_wifi_remote_get_ant(wifi_ant_config_t *config); +int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface); +esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec); +esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec); +esp_err_t esp_wifi_remote_statis_dump(uint32_t modules); +esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi); +esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg); +esp_err_t esp_wifi_remote_ftm_end_session(void); +esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm); +esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable); +esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval); +esp_err_t esp_wifi_remote_force_wakeup_acquire(void); +esp_err_t esp_wifi_remote_force_wakeup_release(void); +esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled); +esp_err_t esp_wifi_remote_get_country_code(char *country); +esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate); +esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx); +esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid); +esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode); +esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled); +esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi); diff --git a/components/esp_wifi_remote/include/esp_wifi_remote_with_hosted.h b/components/esp_wifi_remote/include/esp_wifi_remote_with_hosted.h new file mode 100644 index 00000000000..6797138f10d --- /dev/null +++ b/components/esp_wifi_remote/include/esp_wifi_remote_with_hosted.h @@ -0,0 +1,386 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "esp_hosted_wifi_api.h" + +static inline esp_err_t esp_wifi_remote_init(const wifi_init_config_t *config) +{ + return esp_hosted_wifi_init(config); +} + +static inline esp_err_t esp_wifi_remote_deinit(void) +{ + return esp_hosted_wifi_deinit(); +} + +static inline esp_err_t esp_wifi_remote_set_mode(wifi_mode_t mode) +{ + return esp_hosted_wifi_set_mode(mode); +} + +static inline esp_err_t esp_wifi_remote_get_mode(wifi_mode_t *mode) +{ + return esp_hosted_wifi_get_mode(mode); +} + +static inline esp_err_t esp_wifi_remote_start(void) +{ + return esp_hosted_wifi_start(); +} + +static inline esp_err_t esp_wifi_remote_stop(void) +{ + return esp_hosted_wifi_stop(); +} + +static inline esp_err_t esp_wifi_remote_restore(void) +{ + return esp_hosted_wifi_restore(); +} + +static inline esp_err_t esp_wifi_remote_connect(void) +{ + return esp_hosted_wifi_connect(); +} + +static inline esp_err_t esp_wifi_remote_disconnect(void) +{ + return esp_hosted_wifi_disconnect(); +} + +static inline esp_err_t esp_wifi_remote_clear_fast_connect(void) +{ + return esp_hosted_wifi_clear_fast_connect(); +} + +static inline esp_err_t esp_wifi_remote_deauth_sta(uint16_t aid) +{ + return esp_hosted_wifi_deauth_sta(aid); +} + +static inline esp_err_t esp_wifi_remote_scan_start(const wifi_scan_config_t *config, _Bool block) +{ + return esp_hosted_wifi_scan_start(config, block); +} + +static inline esp_err_t esp_wifi_remote_scan_stop(void) +{ + return esp_hosted_wifi_scan_stop(); +} + +static inline esp_err_t esp_wifi_remote_scan_get_ap_num(uint16_t *number) +{ + return esp_hosted_wifi_scan_get_ap_num(number); +} + +static inline esp_err_t esp_wifi_remote_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) +{ + return esp_hosted_wifi_scan_get_ap_records(number, ap_records); +} + +static inline esp_err_t esp_wifi_remote_scan_get_ap_record(wifi_ap_record_t *ap_record) +{ + return esp_hosted_wifi_scan_get_ap_record(ap_record); +} + +static inline esp_err_t esp_wifi_remote_clear_ap_list(void) +{ + return esp_hosted_wifi_clear_ap_list(); +} + +static inline esp_err_t esp_wifi_remote_sta_get_ap_info(wifi_ap_record_t *ap_info) +{ + return esp_hosted_wifi_sta_get_ap_info(ap_info); +} + +static inline esp_err_t esp_wifi_remote_set_ps(wifi_ps_type_t type) +{ + return esp_hosted_wifi_set_ps(type); +} + +static inline esp_err_t esp_wifi_remote_get_ps(wifi_ps_type_t *type) +{ + return esp_hosted_wifi_get_ps(type); +} + +static inline esp_err_t esp_wifi_remote_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) +{ + return esp_hosted_wifi_set_protocol(ifx, protocol_bitmap); +} + +static inline esp_err_t esp_wifi_remote_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) +{ + return esp_hosted_wifi_get_protocol(ifx, protocol_bitmap); +} + +static inline esp_err_t esp_wifi_remote_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) +{ + return esp_hosted_wifi_set_bandwidth(ifx, bw); +} + +static inline esp_err_t esp_wifi_remote_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) +{ + return esp_hosted_wifi_get_bandwidth(ifx, bw); +} + +static inline esp_err_t esp_wifi_remote_set_channel(uint8_t primary, wifi_second_chan_t second) +{ + return esp_hosted_wifi_set_channel(primary, second); +} + +static inline esp_err_t esp_wifi_remote_get_channel(uint8_t *primary, wifi_second_chan_t *second) +{ + return esp_hosted_wifi_get_channel(primary, second); +} + +static inline esp_err_t esp_wifi_remote_set_country(const wifi_country_t *country) +{ + return esp_hosted_wifi_set_country(country); +} + +static inline esp_err_t esp_wifi_remote_get_country(wifi_country_t *country) +{ + return esp_hosted_wifi_get_country(country); +} + +static inline esp_err_t esp_wifi_remote_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) +{ + return esp_hosted_wifi_set_mac(ifx, mac); +} + +static inline esp_err_t esp_wifi_remote_get_mac(wifi_interface_t ifx, uint8_t mac[6]) +{ + return esp_hosted_wifi_get_mac(ifx, mac); +} + +static inline esp_err_t esp_wifi_remote_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb) +{ + return esp_hosted_wifi_set_promiscuous_rx_cb(cb); +} + +static inline esp_err_t esp_wifi_remote_set_promiscuous(_Bool en) +{ + return esp_hosted_wifi_set_promiscuous(en); +} + +static inline esp_err_t esp_wifi_remote_get_promiscuous(_Bool *en) +{ + return esp_hosted_wifi_get_promiscuous(en); +} + +static inline esp_err_t esp_wifi_remote_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter) +{ + return esp_hosted_wifi_set_promiscuous_filter(filter); +} + +static inline esp_err_t esp_wifi_remote_get_promiscuous_filter(wifi_promiscuous_filter_t *filter) +{ + return esp_hosted_wifi_get_promiscuous_filter(filter); +} + +static inline esp_err_t esp_wifi_remote_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter) +{ + return esp_hosted_wifi_set_promiscuous_ctrl_filter(filter); +} + +static inline esp_err_t esp_wifi_remote_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter) +{ + return esp_hosted_wifi_get_promiscuous_ctrl_filter(filter); +} + +static inline esp_err_t esp_wifi_remote_set_config(wifi_interface_t interface, wifi_config_t *conf) +{ + return esp_hosted_wifi_set_config(interface, conf); +} + +static inline esp_err_t esp_wifi_remote_get_config(wifi_interface_t interface, wifi_config_t *conf) +{ + return esp_hosted_wifi_get_config(interface, conf); +} + +static inline esp_err_t esp_wifi_remote_ap_get_sta_list(wifi_sta_list_t *sta) +{ + return esp_hosted_wifi_ap_get_sta_list(sta); +} + +static inline esp_err_t esp_wifi_remote_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) +{ + return esp_hosted_wifi_ap_get_sta_aid(mac, aid); +} + +static inline esp_err_t esp_wifi_remote_set_storage(wifi_storage_t storage) +{ + return esp_hosted_wifi_set_storage(storage); +} + +static inline esp_err_t esp_wifi_remote_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie) +{ + return esp_hosted_wifi_set_vendor_ie(enable, type, idx, vnd_ie); +} + +static inline esp_err_t esp_wifi_remote_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx) +{ + return esp_hosted_wifi_set_vendor_ie_cb(cb, ctx); +} + +static inline esp_err_t esp_wifi_remote_set_max_tx_power(int8_t power) +{ + return esp_hosted_wifi_set_max_tx_power(power); +} + +static inline esp_err_t esp_wifi_remote_get_max_tx_power(int8_t *power) +{ + return esp_hosted_wifi_get_max_tx_power(power); +} + +static inline esp_err_t esp_wifi_remote_set_event_mask(uint32_t mask) +{ + return esp_hosted_wifi_set_event_mask(mask); +} + +static inline esp_err_t esp_wifi_remote_get_event_mask(uint32_t *mask) +{ + return esp_hosted_wifi_get_event_mask(mask); +} + +static inline esp_err_t esp_wifi_remote_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq) +{ + return esp_hosted_wifi_80211_tx(ifx, buffer, len, en_sys_seq); +} + +static inline esp_err_t esp_wifi_remote_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx) +{ + return esp_hosted_wifi_set_csi_rx_cb(cb, ctx); +} + +static inline esp_err_t esp_wifi_remote_set_csi_config(const wifi_csi_config_t *config) +{ + return esp_hosted_wifi_set_csi_config(config); +} + +static inline esp_err_t esp_wifi_remote_set_csi(_Bool en) +{ + return esp_hosted_wifi_set_csi(en); +} + +static inline esp_err_t esp_wifi_remote_set_ant_gpio(const wifi_ant_gpio_config_t *config) +{ + return esp_hosted_wifi_set_ant_gpio(config); +} + +static inline esp_err_t esp_wifi_remote_get_ant_gpio(wifi_ant_gpio_config_t *config) +{ + return esp_hosted_wifi_get_ant_gpio(config); +} + +static inline esp_err_t esp_wifi_remote_set_ant(const wifi_ant_config_t *config) +{ + return esp_hosted_wifi_set_ant(config); +} + +static inline esp_err_t esp_wifi_remote_get_ant(wifi_ant_config_t *config) +{ + return esp_hosted_wifi_get_ant(config); +} + +static inline int64_t esp_wifi_remote_get_tsf_time(wifi_interface_t interface) +{ + return esp_hosted_wifi_get_tsf_time(interface); +} + +static inline esp_err_t esp_wifi_remote_set_inactive_time(wifi_interface_t ifx, uint16_t sec) +{ + return esp_hosted_wifi_set_inactive_time(ifx, sec); +} + +static inline esp_err_t esp_wifi_remote_get_inactive_time(wifi_interface_t ifx, uint16_t *sec) +{ + return esp_hosted_wifi_get_inactive_time(ifx, sec); +} + +static inline esp_err_t esp_wifi_remote_statis_dump(uint32_t modules) +{ + return esp_hosted_wifi_statis_dump(modules); +} + +static inline esp_err_t esp_wifi_remote_set_rssi_threshold(int32_t rssi) +{ + return esp_hosted_wifi_set_rssi_threshold(rssi); +} + +static inline esp_err_t esp_wifi_remote_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg) +{ + return esp_hosted_wifi_ftm_initiate_session(cfg); +} + +static inline esp_err_t esp_wifi_remote_ftm_end_session(void) +{ + return esp_hosted_wifi_ftm_end_session(); +} + +static inline esp_err_t esp_wifi_remote_ftm_resp_set_offset(int16_t offset_cm) +{ + return esp_hosted_wifi_ftm_resp_set_offset(offset_cm); +} + +static inline esp_err_t esp_wifi_remote_config_11b_rate(wifi_interface_t ifx, _Bool disable) +{ + return esp_hosted_wifi_config_11b_rate(ifx, disable); +} + +static inline esp_err_t esp_wifi_remote_connectionless_module_set_wake_interval(uint16_t wake_interval) +{ + return esp_hosted_wifi_connectionless_module_set_wake_interval(wake_interval); +} + +static inline esp_err_t esp_wifi_remote_force_wakeup_acquire(void) +{ + return esp_hosted_wifi_force_wakeup_acquire(); +} + +static inline esp_err_t esp_wifi_remote_force_wakeup_release(void) +{ + return esp_hosted_wifi_force_wakeup_release(); +} + +static inline esp_err_t esp_wifi_remote_set_country_code(const char *country, _Bool ieee80211d_enabled) +{ + return esp_hosted_wifi_set_country_code(country, ieee80211d_enabled); +} + +static inline esp_err_t esp_wifi_remote_get_country_code(char *country) +{ + return esp_hosted_wifi_get_country_code(country); +} + +static inline esp_err_t esp_wifi_remote_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate) +{ + return esp_hosted_wifi_config_80211_tx_rate(ifx, rate); +} + +static inline esp_err_t esp_wifi_remote_disable_pmf_config(wifi_interface_t ifx) +{ + return esp_hosted_wifi_disable_pmf_config(ifx); +} + +static inline esp_err_t esp_wifi_remote_sta_get_aid(uint16_t *aid) +{ + return esp_hosted_wifi_sta_get_aid(aid); +} + +static inline esp_err_t esp_wifi_remote_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode) +{ + return esp_hosted_wifi_sta_get_negotiated_phymode(phymode); +} + +static inline esp_err_t esp_wifi_remote_set_dynamic_cs(_Bool enabled) +{ + return esp_hosted_wifi_set_dynamic_cs(enabled); +} + +static inline esp_err_t esp_wifi_remote_sta_get_rssi(int *rssi) +{ + return esp_hosted_wifi_sta_get_rssi(rssi); +} diff --git a/components/esp_wifi_remote/scripts/generate.py b/components/esp_wifi_remote/scripts/generate.py deleted file mode 100644 index a8cea4faa2e..00000000000 --- a/components/esp_wifi_remote/scripts/generate.py +++ /dev/null @@ -1,243 +0,0 @@ -# SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD -# SPDX-License-Identifier: Unlicense OR CC0-1.0 -import json -import os -import queue -import re -import subprocess -import tempfile -from collections import namedtuple -from typing import List, Optional, Set, Tuple, Union - -from pycparser import c_ast, c_parser, preprocess_file - -# Define a named tuple for the simplified AST - - -# Function prototypes dictionary to store extracted prototypes -function_prototypes = {} - -# Define a visitor class to visit function declarations and extract prototypes -# class FunctionVisitor(c_ast.NodeVisitor): -# def visit_FuncDecl(self, node): -# if isinstance(node.type, c_ast.FuncDecl): - -# Preprocess the header file to remove preprocessing directives -class TypedefVisitor(c_ast.NodeVisitor): - def visit_TypeDecl(self, node): - print('visiing') - print(node) - - -Param = namedtuple('Param', ['ptr', 'array', 'qual', 'type', 'name']) - -class FunctionVisitor(c_ast.NodeVisitor): - def __init__(self, header): - self.function_prototypes = {} - self.ptr = 0 - self.array = 0 - self.content = open(header, 'r').read() - - def get_type(self, node, suffix='param'): - if suffix == 'param': - self.ptr = 0 - self.array = 0 - - if isinstance(node.type, c_ast.TypeDecl): - typename = node.type.declname - quals = '' - if node.type.quals: - quals = ' '.join(node.type.quals) - if node.type.type.names: - type = node.type.type.names[0] - if type != 'void' and suffix == 'param': - print('{} {} {}_{} = 0;'.format(quals, type, typename, suffix)) - return quals, type, typename - if isinstance(node.type, c_ast.PtrDecl): - local_suffix = 'storage' - quals, type, name = self.get_type(node.type, local_suffix) - print('{} *{}_{} = NULL;'.format(type, name, suffix, name, local_suffix)) - self.ptr += 1 - return quals, type, name - - if isinstance(node.type, c_ast.ArrayDecl): - quals, type, name = self.get_type(node.type, 'array') - self.array = int(node.type.dim.value) - print('{} {}_{}[{}] = {{}};'.format(type, name, suffix, node.type.dim.value)) - return quals, type, name - - # def visit_TypeDecl(self, node): - - - def visit_FuncDecl(self, node): - if isinstance(node.type, c_ast.TypeDecl): - func_name = node.type.declname - if func_name.startswith('esp_wifi') and func_name in self.content: - # for line in self.content.split('\n'): - # if func_name in line: - ret = node.type.type.names[0] - args = [] - print('\n{') - for param in node.args.params: - quals, type, name = self.get_type(param) - param = Param(ptr=self.ptr, array=self.array, qual=quals, type=type, name=name) - args.append(param) - # if name is not None: - print('(void)ret;') - print('}\n') - self.function_prototypes[func_name] = (ret, args) - # if isinstance(param, c_ast.Decl): - # if isinstance(param.type, c_ast.TypeDecl): - if func_name.startswith('esp_err_t'): - print(node.type) - -# Parse the header file and extract function prototypes -def extract_function_prototypes(header_code, header): - parser = c_parser.CParser() # Set debug parameter to False - ast = parser.parse(header_code) - visitor = FunctionVisitor(header) - visitor.visit(ast) - return visitor.function_prototypes - -def preprocess_header(header_file): - with open(header_file, 'r') as file: - preprocessed_code = preprocess_file(header_file) - return preprocessed_code - -# # Parse the preprocessed header file and extract function prototypes -# def extract_function_prototypes(header_code): - -# Generate test cases for each function -def generate_test_cases(): - test_cases = {} - for func_name, args in function_prototypes.items(): - test_args = [] - for arg_info in args: - if isinstance(arg_info, c_ast.TypeDecl): - print(arg_info.type.names[0]) - arg_name = arg_info.declname - arg_type = 'int' # Default to int type if type is missing - else: - arg_name, arg_type = arg_info - test_args.append((arg_name, generate_test_argument(arg_type))) - test_cases[func_name] = test_args - return test_cases - -# Generate test argument based on type -def generate_test_argument(arg_type): - if isinstance(arg_type, c_ast.TypeDecl): - return generate_test_argument(arg_type.type) - elif isinstance(arg_type, c_ast.PtrDecl): - return None # Placeholder for pointer argument handling - elif isinstance(arg_type, c_ast.IdentifierType): - if 'int' in arg_type.names: - return 1 # Example integer argument - elif 'float' in arg_type.names: - return 1.0 # Example float argument - # Add more cases as needed for other data types - return None # Unknown type - -def generate_forwarding_c_file(prefix): - with open('forwarding.c', 'w') as file: - # Write includes and any other necessary declarations - file.write('#include "example.h"\n\n') - - # Write forwarding function definitions - for func_name, args in function_prototypes.items(): - # Write the forwarding function declaration - file.write(f'{function_prototypes[func_name][0]} {prefix}_{func_name}(') - file.write(') {\n') - - # Write the forwarding call - file.write(f' return {func_name}(') - file.write(');\n}\n\n') - -# if __name__ == "__main__": -def exec_cmd(what: List, out_file: Union['tempfile._TemporaryFileWrapper[bytes]', int]=subprocess.PIPE) -> Tuple[int, str, str, str]: - p = subprocess.Popen(what, stdin=subprocess.PIPE, stdout=out_file, stderr=subprocess.PIPE) - output_b, err_b = p.communicate() - rc = p.returncode - output: str = output_b.decode('utf-8') if output_b is not None else '' - err: str = err_b.decode('utf-8') if err_b is not None else '' - return rc, output, err, ' '.join(what) - - -def preprocess(idf_path, header): - project_dir = os.path.join(idf_path, 'examples', 'get-started', 'blink') - build_dir = os.path.join(project_dir, 'build') - print(build_dir) - sdkconfig = os.path.join(build_dir, 'sdkconfig') - try: - os.unlink(os.path.join(project_dir, 'sdkconfig')) - except FileNotFoundError: - pass - build_commands_json = os.path.join(build_dir, 'compile_commands.json') - with open(build_commands_json, 'r', encoding='utf-8') as f: - build_command = json.load(f)[0]['command'].split() - include_dir_flags = [] - include_dirs = [] - # process compilation flags (includes and defines) - for item in build_command: - if item.startswith('-I'): - include_dir_flags.append(item) - if 'components' in item: - include_dirs.append(item[2:]) # Removing the leading "-I" - if item.startswith('-D'): - include_dir_flags.append(item.replace('\\','')) # removes escaped quotes, eg: -DMBEDTLS_CONFIG_FILE=\\\"mbedtls/esp_config.h\\\" - include_dir_flags.append('-I' + os.path.join(build_dir, 'config')) - include_dir_flags.append('-DCI_HEADER_CHECK') - sdkconfig_h = os.path.join(build_dir, 'config', 'sdkconfig.h') - # prepares a main_c file for easier sdkconfig checks and avoid compilers warning when compiling headers directly - with open(sdkconfig_h, 'a') as f: - f.write('#define IDF_SDKCONFIG_INCLUDED') - main_c = os.path.join(build_dir, 'compile.c') - with open(main_c, 'w') as f: - f.write('#if defined(IDF_CHECK_SDKCONFIG_INCLUDED) && ! defined(IDF_SDKCONFIG_INCLUDED)\n' - '#error CONFIG_VARS_USED_WHILE_SDKCONFIG_NOT_INCLUDED\n' - '#endif') - for i in include_dir_flags: - print(i) - with open('example.h', 'w') as f: - f.write('#define asm\n') - f.write('#define volatile\n') - f.write('#define __asm__\n') - f.write('#define __volatile__\n') - with open('example.h', 'a') as f: - rc, out, err, cmd = exec_cmd(['xtensa-esp32-elf-gcc', '-w', '-P', '-include', 'ignore_extensions.h', '-E', header] + include_dir_flags, f) - print(err) - # with open('example.h', 'w') as f: - # riscv32-esp-elf-gcc - -if __name__ == '__main__': - idf_path = os.getenv('IDF_PATH') - if idf_path is None: - raise RuntimeError("Environment variable 'IDF_PATH' wasn't set.") - header = os.path.join(idf_path, 'components', 'esp_wifi', 'include', 'esp_wifi.h') - preprocess(idf_path, header) - header_file = 'example.h' - preprocessed_code = preprocess_header(header_file) - print('Extracted function prototypes:') - function_prototypes = extract_function_prototypes(preprocessed_code, header) - for func_name, args in function_prototypes.items(): - params = [] - for param in args[1]: - typename=param.type - if typename == 'void': - params.append(f'{typename}') - continue - if param.qual is not '': - typename = f'{param.qual} '+ typename - declname = param.name - if param.ptr > 0: - declname = '*'*param.ptr + declname - if param.array > 0: - declname += f'[{param.array}]' - params.append(f'{typename} {declname}') - arguments = ', '.join(params) - # - print(f'\n{args[0]} {func_name}({arguments});') - - - # for func_name, args in test_cases.items(): - - # for func_name, args in test_cases.items(): diff --git a/components/esp_wifi_remote/scripts/ignore_extensions.h b/components/esp_wifi_remote/scripts/ignore_extensions.h index a7fd1f56364..1338b2564f8 100644 --- a/components/esp_wifi_remote/scripts/ignore_extensions.h +++ b/components/esp_wifi_remote/scripts/ignore_extensions.h @@ -1,7 +1,7 @@ /* * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD * - * SPDX-License-Identifier: Unlicense OR CC0-1.0 + * SPDX-License-Identifier: Apache-2.0 */ #define __attribute__(x) #define __asm__(x) diff --git a/components/esp_wifi_remote/scripts/parse_header.py b/components/esp_wifi_remote/scripts/parse_header.py index 49819a89b12..b45dfa32b6a 100644 --- a/components/esp_wifi_remote/scripts/parse_header.py +++ b/components/esp_wifi_remote/scripts/parse_header.py @@ -10,6 +10,7 @@ Param = namedtuple('Param', ['ptr', 'array', 'qual', 'type', 'name']) + class FunctionVisitor(c_ast.NodeVisitor): def __init__(self, header): self.function_prototypes = {} @@ -52,6 +53,7 @@ def visit_FuncDecl(self, node): args.append(param) self.function_prototypes[func_name] = (ret, args) + # Parse the header file and extract function prototypes def extract_function_prototypes(header_code, header): parser = c_parser.CParser() # Set debug parameter to False @@ -62,12 +64,11 @@ def extract_function_prototypes(header_code, header): # def preprocess_header(header_file): # with open(header_file, 'r') as file: -# preprocessed_code = preprocess_file(header_file) -# return preprocessed_code # # Parse the preprocessed header file and extract function prototypes # def extract_function_prototypes(header_code): + # Generate test cases for each function def generate_test_cases(): test_cases = {} @@ -84,6 +85,7 @@ def generate_test_cases(): test_cases[func_name] = test_args return test_cases + # Generate test argument based on type def generate_test_argument(arg_type): if isinstance(arg_type, c_ast.TypeDecl): @@ -98,6 +100,7 @@ def generate_test_argument(arg_type): # Add more cases as needed for other data types return None # Unknown type + def generate_forwarding_c_file(prefix): with open('forwarding.c', 'w') as file: # Write includes and any other necessary declarations @@ -113,6 +116,7 @@ def generate_forwarding_c_file(prefix): file.write(f' return {func_name}(') file.write(');\n}\n\n') + def exec_cmd(what, out_file): p = subprocess.Popen(what, stdin=subprocess.PIPE, stdout=out_file, stderr=subprocess.PIPE) output_b, err_b = p.communicate() @@ -124,7 +128,7 @@ def exec_cmd(what, out_file): def preprocess(idf_path, header): project_dir = os.path.join(idf_path, 'examples', 'get-started', 'blink') - build_dir = os.path.join(project_dir, 'build') + build_dir = os.path.join(project_dir, 'build') build_commands_json = os.path.join(build_dir, 'compile_commands.json') with open(build_commands_json, 'r', encoding='utf-8') as f: build_command = json.load(f)[0]['command'].split() @@ -153,22 +157,21 @@ def preprocess(idf_path, header): preprocessed_code = preprocess_file(temp_file) return preprocessed_code - # with open('example.h', 'w') as f: - # riscv32-esp-elf-gcc + def get_args(parameters): params = [] names = [] for param in parameters: - typename=param.type - if typename == 'void': + typename = param.type + if typename == 'void' and param.ptr == 0 and param.name is None: params.append(f'{typename}') continue if param.qual != '': - typename = f'{param.qual} '+ typename + typename = f'{param.qual} ' + typename declname = param.name names.append(f'{declname}') if param.ptr > 0: - declname = '*'*param.ptr + declname + declname = '*' * param.ptr + declname if param.array > 0: declname += f'[{param.array}]' params.append(f'{typename} {declname}') @@ -176,6 +179,7 @@ def get_args(parameters): comma_separated_names = ', '.join(names) return comma_separated_params, comma_separated_names + if __name__ == '__main__': idf_path = os.getenv('IDF_PATH') if idf_path is None: @@ -219,15 +223,14 @@ def get_args(parameters): f.write('}\n\n') h.write(f'{ret_type} {hosted_func_name}({params});\n') - with open('esp_wifi_remote_with_hosted.h', 'w') as f: f.write('#include "esp_hosted_wifi_api.h"\n\n') for func_name, args in function_prototypes.items(): remote_func_name = namespace.sub('esp_wifi_remote', func_name) - + hosted_func_name = namespace.sub('esp_hosted_wifi', func_name) + params, names = get_args(args[1]) f.write(f'static inline {args[0]} {remote_func_name}({params})\n') f.write('{\n') f.write(f' return {hosted_func_name}({names});\n') f.write('}\n\n') - diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/CMakeLists.txt b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/CMakeLists.txt new file mode 100644 index 00000000000..e49536173a0 --- /dev/null +++ b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/CMakeLists.txt @@ -0,0 +1,3 @@ +idf_component_register(SRCS "esp_hosted_mock.c" + INCLUDE_DIRS "include" + REQUIRES esp_wifi esp_wifi_remote) diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/esp_hosted_mock.c b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/esp_hosted_mock.c new file mode 100644 index 00000000000..10ae106ba2c --- /dev/null +++ b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/esp_hosted_mock.c @@ -0,0 +1,387 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ +#include "esp_wifi.h" +#include "esp_wifi_remote.h" + +esp_err_t esp_hosted_wifi_init(const wifi_init_config_t *config) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_deinit(void) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_mode(wifi_mode_t mode) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_mode(wifi_mode_t *mode) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_start(void) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_stop(void) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_restore(void) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_connect(void) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_disconnect(void) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_clear_fast_connect(void) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_deauth_sta(uint16_t aid) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_scan_start(const wifi_scan_config_t *config, _Bool block) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_scan_stop(void) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_scan_get_ap_num(uint16_t *number) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_scan_get_ap_record(wifi_ap_record_t *ap_record) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_clear_ap_list(void) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_ps(wifi_ps_type_t type) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_ps(wifi_ps_type_t *type) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_channel(uint8_t primary, wifi_second_chan_t second) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_country(const wifi_country_t *country) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_country(wifi_country_t *country) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_promiscuous(_Bool en) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_promiscuous(_Bool *en) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_ap_get_sta_list(wifi_sta_list_t *sta) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_storage(wifi_storage_t storage) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_max_tx_power(int8_t power) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_max_tx_power(int8_t *power) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_event_mask(uint32_t mask) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_event_mask(uint32_t *mask) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_csi_config(const wifi_csi_config_t *config) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_csi(_Bool en) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_ant_gpio(const wifi_ant_gpio_config_t *config) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_ant_gpio(wifi_ant_gpio_config_t *config) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_ant(const wifi_ant_config_t *config) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_ant(wifi_ant_config_t *config) +{ + return ESP_OK; +} + +int64_t esp_hosted_wifi_get_tsf_time(wifi_interface_t interface) +{ + return 0; +} + +esp_err_t esp_hosted_wifi_set_inactive_time(wifi_interface_t ifx, uint16_t sec) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_inactive_time(wifi_interface_t ifx, uint16_t *sec) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_statis_dump(uint32_t modules) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_rssi_threshold(int32_t rssi) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_ftm_end_session(void) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_ftm_resp_set_offset(int16_t offset_cm) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_config_11b_rate(wifi_interface_t ifx, _Bool disable) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_connectionless_module_set_wake_interval(uint16_t wake_interval) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_force_wakeup_acquire(void) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_force_wakeup_release(void) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_country_code(const char *country, _Bool ieee80211d_enabled) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_get_country_code(char *country) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_disable_pmf_config(wifi_interface_t ifx) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_sta_get_aid(uint16_t *aid) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_set_dynamic_cs(_Bool enabled) +{ + return ESP_OK; +} + +esp_err_t esp_hosted_wifi_sta_get_rssi(int *rssi) +{ + return ESP_OK; +} diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_api.h b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_api.h new file mode 100644 index 00000000000..e1efa1a93b6 --- /dev/null +++ b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_api.h @@ -0,0 +1,21 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ +#pragma once +#include "esp_wifi.h" +#include "esp_hosted_mock.h" +#include "esp_wifi_remote.h" + +#define ESP_HOSTED_CHANNEL_CONFIG_DEFAULT() {} +#define ESP_SERIAL_IF 0 +#define ESP_STA_IF 1 +#define ESP_AP_IF 2 + +struct esp_remote_channel_config { + int if_type; + bool secure; +}; + +esp_remote_channel_t esp_hosted_add_channel(struct esp_remote_channel_config *config, esp_remote_channel_tx_fn_t *tx_cb, esp_remote_channel_rx_fn_t rx_cb); diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_mock.h b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_mock.h new file mode 100644 index 00000000000..343b3d9cd4d --- /dev/null +++ b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_mock.h @@ -0,0 +1,82 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ + +esp_err_t esp_hosted_wifi_init(const wifi_init_config_t *config); +esp_err_t esp_hosted_wifi_deinit(void); +esp_err_t esp_hosted_wifi_set_mode(wifi_mode_t mode); +esp_err_t esp_hosted_wifi_get_mode(wifi_mode_t *mode); +esp_err_t esp_hosted_wifi_start(void); +esp_err_t esp_hosted_wifi_stop(void); +esp_err_t esp_hosted_wifi_restore(void); +esp_err_t esp_hosted_wifi_connect(void); +esp_err_t esp_hosted_wifi_disconnect(void); +esp_err_t esp_hosted_wifi_clear_fast_connect(void); +esp_err_t esp_hosted_wifi_deauth_sta(uint16_t aid); +esp_err_t esp_hosted_wifi_scan_start(const wifi_scan_config_t *config, _Bool block); +esp_err_t esp_hosted_wifi_scan_stop(void); +esp_err_t esp_hosted_wifi_scan_get_ap_num(uint16_t *number); +esp_err_t esp_hosted_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records); +esp_err_t esp_hosted_wifi_scan_get_ap_record(wifi_ap_record_t *ap_record); +esp_err_t esp_hosted_wifi_clear_ap_list(void); +esp_err_t esp_hosted_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info); +esp_err_t esp_hosted_wifi_set_ps(wifi_ps_type_t type); +esp_err_t esp_hosted_wifi_get_ps(wifi_ps_type_t *type); +esp_err_t esp_hosted_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap); +esp_err_t esp_hosted_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap); +esp_err_t esp_hosted_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw); +esp_err_t esp_hosted_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw); +esp_err_t esp_hosted_wifi_set_channel(uint8_t primary, wifi_second_chan_t second); +esp_err_t esp_hosted_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second); +esp_err_t esp_hosted_wifi_set_country(const wifi_country_t *country); +esp_err_t esp_hosted_wifi_get_country(wifi_country_t *country); +esp_err_t esp_hosted_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6]); +esp_err_t esp_hosted_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]); +esp_err_t esp_hosted_wifi_set_promiscuous_rx_cb(wifi_promiscuous_cb_t cb); +esp_err_t esp_hosted_wifi_set_promiscuous(_Bool en); +esp_err_t esp_hosted_wifi_get_promiscuous(_Bool *en); +esp_err_t esp_hosted_wifi_set_promiscuous_filter(const wifi_promiscuous_filter_t *filter); +esp_err_t esp_hosted_wifi_get_promiscuous_filter(wifi_promiscuous_filter_t *filter); +esp_err_t esp_hosted_wifi_set_promiscuous_ctrl_filter(const wifi_promiscuous_filter_t *filter); +esp_err_t esp_hosted_wifi_get_promiscuous_ctrl_filter(wifi_promiscuous_filter_t *filter); +esp_err_t esp_hosted_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf); +esp_err_t esp_hosted_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf); +esp_err_t esp_hosted_wifi_ap_get_sta_list(wifi_sta_list_t *sta); +esp_err_t esp_hosted_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid); +esp_err_t esp_hosted_wifi_set_storage(wifi_storage_t storage); +esp_err_t esp_hosted_wifi_set_vendor_ie(_Bool enable, wifi_vendor_ie_type_t type, wifi_vendor_ie_id_t idx, const void *vnd_ie); +esp_err_t esp_hosted_wifi_set_vendor_ie_cb(esp_vendor_ie_cb_t cb, void *ctx); +esp_err_t esp_hosted_wifi_set_max_tx_power(int8_t power); +esp_err_t esp_hosted_wifi_get_max_tx_power(int8_t *power); +esp_err_t esp_hosted_wifi_set_event_mask(uint32_t mask); +esp_err_t esp_hosted_wifi_get_event_mask(uint32_t *mask); +esp_err_t esp_hosted_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, _Bool en_sys_seq); +esp_err_t esp_hosted_wifi_set_csi_rx_cb(wifi_csi_cb_t cb, void *ctx); +esp_err_t esp_hosted_wifi_set_csi_config(const wifi_csi_config_t *config); +esp_err_t esp_hosted_wifi_set_csi(_Bool en); +esp_err_t esp_hosted_wifi_set_ant_gpio(const wifi_ant_gpio_config_t *config); +esp_err_t esp_hosted_wifi_get_ant_gpio(wifi_ant_gpio_config_t *config); +esp_err_t esp_hosted_wifi_set_ant(const wifi_ant_config_t *config); +esp_err_t esp_hosted_wifi_get_ant(wifi_ant_config_t *config); +int64_t esp_hosted_wifi_get_tsf_time(wifi_interface_t interface); +esp_err_t esp_hosted_wifi_set_inactive_time(wifi_interface_t ifx, uint16_t sec); +esp_err_t esp_hosted_wifi_get_inactive_time(wifi_interface_t ifx, uint16_t *sec); +esp_err_t esp_hosted_wifi_statis_dump(uint32_t modules); +esp_err_t esp_hosted_wifi_set_rssi_threshold(int32_t rssi); +esp_err_t esp_hosted_wifi_ftm_initiate_session(wifi_ftm_initiator_cfg_t *cfg); +esp_err_t esp_hosted_wifi_ftm_end_session(void); +esp_err_t esp_hosted_wifi_ftm_resp_set_offset(int16_t offset_cm); +esp_err_t esp_hosted_wifi_config_11b_rate(wifi_interface_t ifx, _Bool disable); +esp_err_t esp_hosted_wifi_connectionless_module_set_wake_interval(uint16_t wake_interval); +esp_err_t esp_hosted_wifi_force_wakeup_acquire(void); +esp_err_t esp_hosted_wifi_force_wakeup_release(void); +esp_err_t esp_hosted_wifi_set_country_code(const char *country, _Bool ieee80211d_enabled); +esp_err_t esp_hosted_wifi_get_country_code(char *country); +esp_err_t esp_hosted_wifi_config_80211_tx_rate(wifi_interface_t ifx, wifi_phy_rate_t rate); +esp_err_t esp_hosted_wifi_disable_pmf_config(wifi_interface_t ifx); +esp_err_t esp_hosted_wifi_sta_get_aid(uint16_t *aid); +esp_err_t esp_hosted_wifi_sta_get_negotiated_phymode(wifi_phy_mode_t *phymode); +esp_err_t esp_hosted_wifi_set_dynamic_cs(_Bool enabled); +esp_err_t esp_hosted_wifi_sta_get_rssi(int *rssi); diff --git a/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_wifi_api.h b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_wifi_api.h new file mode 100644 index 00000000000..7fd42fb0f00 --- /dev/null +++ b/components/esp_wifi_remote/test/smoke_test/components/esp_hosted/include/esp_hosted_wifi_api.h @@ -0,0 +1,8 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ +#pragma once +#include "esp_wifi.h" +#include "esp_hosted_api.h" diff --git a/components/esp_wifi_remote/test/smoke_test/main/smoke_test.c b/components/esp_wifi_remote/test/smoke_test/main/smoke_test.c index dbc2d8949b8..7a6acfff671 100644 --- a/components/esp_wifi_remote/test/smoke_test/main/smoke_test.c +++ b/components/esp_wifi_remote/test/smoke_test/main/smoke_test.c @@ -1,8 +1,13 @@ +/* + * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ #include -#include "esp_wifi.h" +#include "esp_wifi_remote.h" void app_main(void) { const wifi_init_config_t config = {}; - esp_wifi_init(&config); + esp_wifi_remote_init(&config); }