添加 USB 主机、BLE 和 Socket 数据端口驱动程序:
- 支持大容量存储类(MSC)的 USB 主机驱动程序 - BLE SPP(串行端口配置文件)客户端和服务器实现 - Socket(UDP/TCP)数据端口驱动程序 - 相关的 shell 接口用于配置和测试
This commit is contained in:
78
app/drivers/data_port/socket_inet/wifi.h
Normal file
78
app/drivers/data_port/socket_inet/wifi.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @file wifi.h
|
||||
* @author LokLiang
|
||||
* @brief 操作 ESP32 WIFI 的两种基本模式的开关
|
||||
* @version 0.1
|
||||
* @date 2023-11-24
|
||||
*
|
||||
* @copyright Copyright (c) 2023
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "esp_wifi_ap_get_sta_list.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WIFI_AP_CONNECT_STOPED,
|
||||
WIFI_AP_CONNECT_GOT_STA,
|
||||
} wifi_ap_connect_status_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WIFI_STA_CONNECT_STOPED,
|
||||
WIFI_STA_CONNECT_CONNECTING,
|
||||
WIFI_STA_CONNECT_GOT_IP,
|
||||
} wifi_sta_connect_status_t;
|
||||
|
||||
/**
|
||||
* @brief AP 模式下的连接状态回调函数。
|
||||
* 提示:可使用 wifi_get_sta_list() 读出所有已连接的客户端信息
|
||||
*/
|
||||
typedef void (*wifi_ap_connect_cb)(wifi_ap_connect_status_t status, uint8_t connect_cnt);
|
||||
|
||||
/**
|
||||
* @brief STA 模式下的连接状态回调函数。
|
||||
*/
|
||||
typedef void (*wifi_sta_connect_cb)(wifi_sta_connect_status_t status, uint8_t ip_v4[4]);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
char ssid[33]; /**< SSID of soft-AP. If ssid_len field is 0, this must be a Null terminated string. Otherwise, length is set according to ssid_len. */
|
||||
char password[65]; /**< Password of soft-AP. */
|
||||
uint8_t ip_v4[4];
|
||||
uint8_t gw_v4[4];
|
||||
uint8_t mask_v4[4];
|
||||
uint8_t max_connection; // 最大连接数
|
||||
wifi_ap_connect_cb connect_cb;
|
||||
} ap;
|
||||
struct
|
||||
{
|
||||
char ssid[33];
|
||||
char password[65];
|
||||
wifi_sta_connect_cb connect_cb;
|
||||
} sta;
|
||||
} wifi_init_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
WIFI_NETIF_MODE_AP,
|
||||
WIFI_NETIF_MODE_STA,
|
||||
} wifi_netif_mode_t;
|
||||
|
||||
void wifi_netif_init(wifi_init_t *init_struct);
|
||||
|
||||
void wifi_set_mode(wifi_netif_mode_t mode);
|
||||
|
||||
void wifi_start(void);
|
||||
void wifi_stop(void);
|
||||
|
||||
int wifi_get_sta_list(wifi_sta_mac_ip_list_t *netif_sta_list);
|
||||
|
||||
int wifi_get_ap_info(esp_netif_ip_info_t *netif_ap);
|
||||
|
||||
void get_wifi_mac(uint8_t *mac);
|
||||
Reference in New Issue
Block a user