-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wifi_remote): Move to esp-protocols
- Loading branch information
1 parent
943b683
commit edc3c2d
Showing
16 changed files
with
577 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 1 addition & 4 deletions
5
esp_wifi_remote/CMakeLists.txt → components/esp_wifi_remote/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
|
||
if(NOT CONFIG_ESP_WIFI_ENABLED) | ||
set(src_wifi_is_remote esp_wifi_remote.c) | ||
endif() | ||
|
||
idf_component_register(INCLUDE_DIRS include | ||
SRCS wifi_remote_rpc.c wifi_remote_net.c wifi_remote_init.c ${src_wifi_is_remote} | ||
${INTERNAL_SRCS} | ||
REQUIRES esp_event esp_netif | ||
PRIV_INCLUDE_DIRS ${INTERNAL_INCLUDE_DIRS} | ||
PRIV_REQUIRES esp_wifi esp_hosted_preview) | ||
PRIV_REQUIRES esp_wifi esp_hosted) |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,215 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "esp_wifi.h" | ||
#include "esp_log.h" | ||
#include "esp_wifi_remote.h" | ||
|
||
#define WEAK __attribute__((weak)) | ||
|
||
WEAK ESP_EVENT_DEFINE_BASE(WIFI_EVENT); | ||
|
||
WEAK wifi_osi_funcs_t g_wifi_osi_funcs; | ||
WEAK const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs; | ||
WEAK uint64_t g_wifi_feature_caps = | ||
#if CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE | ||
CONFIG_FEATURE_WPA3_SAE_BIT | | ||
#endif | ||
#if CONFIG_SPIRAM | ||
CONFIG_FEATURE_CACHE_TX_BUF_BIT | | ||
#endif | ||
#if CONFIG_ESP_WIFI_FTM_INITIATOR_SUPPORT | ||
CONFIG_FEATURE_FTM_INITIATOR_BIT | | ||
#endif | ||
#if CONFIG_ESP_WIFI_FTM_RESPONDER_SUPPORT | ||
CONFIG_FEATURE_FTM_RESPONDER_BIT | | ||
#endif | ||
0; | ||
|
||
WEAK esp_err_t esp_wifi_connect(void) | ||
{ | ||
return remote_esp_wifi_connect(); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_disconnect(void) | ||
{ | ||
return remote_esp_wifi_disconnect(); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_init(const wifi_init_config_t *config) | ||
{ | ||
return remote_esp_wifi_init(config); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_deinit(void) | ||
{ | ||
return remote_esp_wifi_deinit(); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_set_mode(wifi_mode_t mode) | ||
{ | ||
return remote_esp_wifi_set_mode(mode); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_get_mode(wifi_mode_t *mode) | ||
{ | ||
return remote_esp_wifi_get_mode(mode); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_set_config(wifi_interface_t interface, wifi_config_t *conf) | ||
{ | ||
return remote_esp_wifi_set_config(interface, conf); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf) | ||
{ | ||
return remote_esp_wifi_get_config(interface, conf); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_start(void) | ||
{ | ||
return remote_esp_wifi_start(); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_stop(void) | ||
{ | ||
return remote_esp_wifi_stop(); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]) | ||
{ | ||
return remote_esp_wifi_get_mac(ifx, mac); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6]) | ||
{ | ||
return remote_esp_wifi_set_mac(ifx, mac); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_scan_start(const wifi_scan_config_t *config, bool block) | ||
{ | ||
return remote_esp_wifi_scan_start(config, block); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_scan_stop(void) | ||
{ | ||
return remote_esp_wifi_scan_stop(); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_scan_get_ap_num(uint16_t *number) | ||
{ | ||
return remote_esp_wifi_scan_get_ap_num(number); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records) | ||
{ | ||
return remote_esp_wifi_scan_get_ap_records(number, ap_records); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_clear_ap_list(void) | ||
{ | ||
return remote_esp_wifi_clear_ap_list(); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_restore(void) | ||
{ | ||
return remote_esp_wifi_restore(); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_clear_fast_connect(void) | ||
{ | ||
return remote_esp_wifi_clear_fast_connect(); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_deauth_sta(uint16_t aid) | ||
{ | ||
return remote_esp_wifi_deauth_sta(aid); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info) | ||
{ | ||
return remote_esp_wifi_sta_get_ap_info(ap_info); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_set_ps(wifi_ps_type_t type) | ||
{ | ||
return remote_esp_wifi_set_ps(type); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_get_ps(wifi_ps_type_t *type) | ||
{ | ||
return remote_esp_wifi_get_ps(type); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_set_storage(wifi_storage_t storage) | ||
{ | ||
return remote_esp_wifi_set_storage(storage); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw) | ||
{ | ||
return remote_esp_wifi_set_bandwidth(ifx, bw); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw) | ||
{ | ||
return remote_esp_wifi_get_bandwidth(ifx, bw); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second) | ||
{ | ||
return remote_esp_wifi_set_channel(primary, second); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second) | ||
{ | ||
return remote_esp_wifi_get_channel(primary, second); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_set_country_code(const char *country, bool ieee80211d_enabled) | ||
{ | ||
return remote_esp_wifi_set_country_code(country, ieee80211d_enabled); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_get_country_code(char *country) | ||
{ | ||
return remote_esp_wifi_get_country_code(country); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_set_country(const wifi_country_t *country) | ||
{ | ||
return remote_esp_wifi_set_country(country); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_get_country(wifi_country_t *country) | ||
{ | ||
return remote_esp_wifi_get_country(country); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta) | ||
{ | ||
return remote_esp_wifi_ap_get_sta_list(sta); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_ap_get_sta_aid(const uint8_t mac[6], uint16_t *aid) | ||
{ | ||
return remote_esp_wifi_ap_get_sta_aid(mac, aid); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_sta_get_rssi(int *rssi) | ||
{ | ||
return remote_esp_wifi_sta_get_rssi(rssi); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_set_protocol(wifi_interface_t ifx, uint8_t protocol_bitmap) | ||
{ | ||
return remote_esp_wifi_set_protocol(ifx, protocol_bitmap); | ||
} | ||
|
||
WEAK esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap) | ||
{ | ||
return remote_esp_wifi_get_protocol(ifx, protocol_bitmap); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version: "1.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
#pragma once | ||
#include "esp_wifi.h" | ||
|
||
typedef esp_err_t (*esp_remote_channel_rx_fn_t)(void *h, void *buffer, void *buff_to_free, size_t len); | ||
typedef esp_err_t (*esp_remote_channel_tx_fn_t)(void *h, void *buffer, size_t len); | ||
|
||
typedef struct esp_remote_channel *esp_remote_channel_t; | ||
typedef struct esp_remote_channel_config *esp_remote_channel_config_t; | ||
|
||
// Public API | ||
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); | ||
esp_err_t remote_esp_wifi_deinit(void); | ||
esp_err_t remote_esp_wifi_set_mode(wifi_mode_t mode); | ||
esp_err_t remote_esp_wifi_get_mode(wifi_mode_t *mode); | ||
esp_err_t remote_esp_wifi_set_config(wifi_interface_t ifx, wifi_config_t *conf); | ||
esp_err_t remote_esp_wifi_get_config(wifi_interface_t interface, wifi_config_t *conf); | ||
esp_err_t remote_esp_wifi_start(void); | ||
esp_err_t remote_esp_wifi_stop(void); | ||
esp_err_t remote_esp_wifi_get_mac(wifi_interface_t ifx, uint8_t mac[6]); | ||
esp_err_t remote_esp_wifi_set_mac(wifi_interface_t ifx, const uint8_t mac[6]); | ||
esp_err_t remote_esp_wifi_scan_start(const wifi_scan_config_t *config, bool block); | ||
esp_err_t remote_esp_wifi_scan_stop(void); | ||
esp_err_t remote_esp_wifi_scan_get_ap_num(uint16_t *number); | ||
esp_err_t remote_esp_wifi_scan_get_ap_records(uint16_t *number, wifi_ap_record_t *ap_records); | ||
esp_err_t remote_esp_wifi_clear_ap_list(void); | ||
esp_err_t remote_esp_wifi_restore(void); | ||
esp_err_t remote_esp_wifi_clear_fast_connect(void); | ||
esp_err_t remote_esp_wifi_deauth_sta(uint16_t aid); | ||
esp_err_t remote_esp_wifi_sta_get_ap_info(wifi_ap_record_t *ap_info); | ||
esp_err_t remote_esp_wifi_set_ps(wifi_ps_type_t type); | ||
esp_err_t remote_esp_wifi_get_ps(wifi_ps_type_t *type); | ||
esp_err_t remote_esp_wifi_set_storage(wifi_storage_t storage); | ||
esp_err_t remote_esp_wifi_set_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t bw); | ||
esp_err_t remote_esp_wifi_get_bandwidth(wifi_interface_t ifx, wifi_bandwidth_t *bw); | ||
esp_err_t remote_esp_wifi_set_channel(uint8_t primary, wifi_second_chan_t second); | ||
esp_err_t remote_esp_wifi_get_channel(uint8_t *primary, wifi_second_chan_t *second); | ||
esp_err_t remote_esp_wifi_set_country_code(const char *country, bool ieee80211d_enabled); | ||
esp_err_t remote_esp_wifi_get_country_code(char *country); | ||
esp_err_t remote_esp_wifi_set_country(const wifi_country_t *country); | ||
esp_err_t remote_esp_wifi_get_country(wifi_country_t *country); | ||
esp_err_t remote_esp_wifi_ap_get_sta_list(wifi_sta_list_t *sta); | ||
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); | ||
|
||
|
||
// TODO: Move this to private include | ||
// Private API | ||
esp_err_t remote_esp_wifi_init_slave(void); | ||
|
||
// handling channels | ||
esp_err_t esp_wifi_remote_channel_rx(void *h, void *buffer, void *buff_to_free, size_t len); | ||
esp_err_t esp_wifi_remote_channel_set(wifi_interface_t ifx, void *h, esp_remote_channel_tx_fn_t tx_cb); | ||
esp_err_t esp_wifi_remote_rpc_channel_rx(void *h, void *buffer, size_t len); | ||
esp_err_t esp_wifi_remote_rpc_channel_set(void *h, esp_remote_channel_tx_fn_t tx_cb); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "esp_err.h" | ||
#include "esp_log.h" | ||
#include "esp_hosted_api.h" | ||
#include "esp_wifi_remote.h" | ||
const char *TAG = "esp_remote_wifi_init"; | ||
|
||
esp_err_t remote_esp_wifi_init_slave(void) | ||
{ | ||
ESP_LOGI(TAG, "** %s **", __func__); | ||
#if 0 | ||
if (esp_hosted_setup() != ESP_OK) { | ||
return ESP_FAIL; | ||
} | ||
#endif | ||
esp_remote_channel_tx_fn_t tx_cb; | ||
esp_remote_channel_t ch; | ||
|
||
// Add an RPC channel with default config (i.e. secure=true) | ||
struct esp_remote_channel_config config = ESP_HOSTED_CHANNEL_CONFIG_DEFAULT(); | ||
config.if_type = ESP_SERIAL_IF; | ||
//TODO: add rpc channel from here | ||
//ch = esp_hosted_add_channel(&config, &tx_cb, esp_wifi_remote_rpc_channel_rx); | ||
// esp_wifi_remote_rpc_channel_set(ch, tx_cb); | ||
|
||
// Add two other channels for the two WiFi interfaces (STA, softAP) in plain text | ||
config.secure = false; | ||
config.if_type = ESP_STA_IF; | ||
ch = esp_hosted_add_channel(&config, &tx_cb, esp_wifi_remote_channel_rx); | ||
esp_wifi_remote_channel_set(WIFI_IF_STA, ch, tx_cb); | ||
|
||
|
||
config.secure = false; | ||
config.if_type = ESP_AP_IF; | ||
ch = esp_hosted_add_channel(&config, &tx_cb, esp_wifi_remote_channel_rx); | ||
esp_wifi_remote_channel_set(WIFI_IF_AP, ch, tx_cb); | ||
|
||
return ESP_OK; | ||
} |
Oops, something went wrong.