打印
[技术讨论]

全志R128基础组件开发指南-WiFi Manager

[复制链接]
941|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
神棍地海棠|  楼主 | 2024-1-24 10:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Wi-Fi 简介
[color=rgba(0, 0, 0, 0.87)]FreeRTOS 上的网络,驱动部分源码没有开源,用户实际使用时也无需关系具体实现,更多的是做网络管理的逻辑接口开发,所以我们提供了网络中间件 Wi-Fi Manager,Wi-Fi Manager 支持sta, ap, monitor 等多种网络工作模式的管理,本文档重点介绍 Wi-Fi Manager 中间件的使用,配置,框架,接口。
Wi‑Fi 工作的几种模式
[color=rgba(0, 0, 0, 0.87)]目前R128 平台上的Wi‑Fi 一般可处于3 种工作模式,分别是STATION,AP,MONITOR。
  • STATION:连接无线网络的终端,大部分无线网卡默认都处于该模式,也是常用的一种模式。
  • AP:无线接入点,常称热点,比如路由器功能。
  • MONITOR:也称为混杂设备监听模式,所有数据包无过滤传输到主机。
代码路径
[color=rgba(0, 0, 0, 0.87)]FreeRTOS 中wlan 相关代码主要分布在四个地方:
code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">1)驱动部分:lichee/rtos/drivers/drv/wireless/xradio2)协议栈部分:lichee/rtos‑components/thirdparty/network/lwip‑2.1.23)应用协议部分:lichee/rtos‑components/aw/network/service4)中间件部分:lichee/rtos‑components/aw/wireless/Wi-Fi Manager配置介绍
[color=rgba(0, 0, 0, 0.87)]FreeRTOS 中 wlan 相关配置分为 c906 和 m33:
C906 配置
  • Wi-Fi Manager demo 配置
code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">> System components > aw components > wireless
  • wireless common
  • Wi-Fi Manager‑v2.0 ‑‑‑>    Wi-Fi Manager‑v2.0 Configuration ‑‑‑>    [ ] CONFIG_WMG_PROTOCOL_SOFTAP    [ ] CONFIG_WMG_PROTOCOL_BLE    [ ] CONFIG_WMG_PROTOCOL_XCONFIG    [ ] CONFIG_WMG_PROTOCOL_SOUNDWAVE        Wi-Fi Manager support platform (FREERTOS PLATFORM OS) ‑‑‑>            (X) FREERTOS PLATFORM OS        
  • Wi-Fi Manager unregister callback function        
  • Wi-Fi Manager support send expand cmd            Wi-Fi Manager support mode Configuration ‑‑‑>               
  • Wi-Fi Manager support sta mode enable               
  • Wi-Fi Manager support ap mode enable                [ ] Wi-Fi Manager support monitor mode enable                [ ] Wi-Fi Manager support p2p mode enable                Wi-Fi Manager set default debug level (default debug level: to info) ‑‑‑>                    (X) default debug level: to info
    • driver 配置
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">> Drivers Options > other drivers   
  • rfkill drivers> Drivers Options > other drivers > wireless devices   
  • XRADIO driver ‑‑‑>   
  • Enable xradio test cmd        Xradio chip (Enable r128 driver) ‑‑‑>   
  • Wi‑Fi Certification of WFA   
  • wlan station mode    [ ] wlan station mode with wps support   
  • wlan monitor mode   
  • wlan ap mode        select the source of frequency offset (SDD file) ‑‑‑>    [ ] wlan ETF test
    • 应用协议配置
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">> System components > aw components > aw network   
  • tcp ip adapter    [ ] loop interface test demo    [ ] wifi test demo    [ ] wifi fast connect test demo    [ ] get mac_addr test demo    [ ] set/get country code optional    service ‑‑‑>        [ ] udhcpd demo        [ ] sntp demo        
  • iperf demo        
  • ping demo        [ ] nopoll demo        [ ] mqtt demo        [ ] shttpd demo        [ ] mbedtls demo        [ ] httpc demo        [ ] mini_wget        [ ] telnet
    • AMP 网络配置
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">> System components > aw components > AMP Components Support   
  • AMP Network Stub Functions   
  • AMP Network Service
    • 协议配置
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">> System components > thirdparty components > network    ‑*‑ lwip ‑‑‑>        lwip version (lwip‑2.1.2) ‑‑‑>    ‑*‑ udhcpd (DHCP Server)   
  • ping    ‑*‑ mbedtls ‑‑‑>        mbedtls version (mbedtls‑2.16.0) ‑‑‑>    [ ] httpclient    [ ] websocket    [ ] nghttp2    [ ] sntp    [ ] nopoll    [ ] shttpd    [ ] mqttM33 配置
    • driver 配置
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">> Drivers Options > other drivers   
  • rfkill drivers> Drivers Options > other drivers > wireless devices   
  • XRADIO driver ‑‑‑>   
  • Enable xradio test cmd        Xradio chip (Enable r128 driver) ‑‑‑>   
  • Wi‑Fi Certification of WFA   
  • wlan station mode    [ ] wlan station mode with wps support   
  • wlan monitor mode   
  • wlan ap mode        select the source of frequency offset (SDD file) ‑‑‑>    [ ] wlan ETF test
    • AMP 网络配置
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">> System components > aw components > AMP Components Support   
  • AMP Network Stub Functions   
  • AMP Network Service
    • 协议配置
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">> System components > thirdparty components > network    [ ] lwip ‑‑‑‑    [ ] udhcpd (DHCP Server)    [ ] ping    ‑*‑ mbedtls ‑‑‑>        mbedtls version (mbedtls‑2.16.0) ‑‑‑>    [ ] httpclient    [ ] nghttp2    [ ] sntp    [ ] nopoll    [ ] shttpd    [ ] mqttWi-Fi Manager 简介
    [color=rgba(0, 0, 0, 0.87)]Wi-Fi Manager 用于wifi 的连接管理,通信以及wifi 的一些额外功能。支持sta、ap、monitor、p2p 模式,并且集成了配网模式以及其他功能。屏蔽了底层系统的具体实现,能对接各种差异化系统平台例如 linux,rtos,xrlink(linux 系统mcu 模组)。用户如果需要进行独自的2 次开发(把对应的wifi 功能集成到各自的应用里),请重点查阅 Wi-Fi Manager 框架,Wi-Fi Manager 代码目录结构,核心层代码章节。用户如果不需要独自的2 次开发,可以直接使用 Wi-Fi Manager 提供的命令行demo,仅需查看Wi-Fi Manager demo 介绍章节。
    Wi-Fi Manager 框架
    [color=rgba(0, 0, 0, 0.87)][color=var(--md-typeset-a-color)]
    [color=rgba(0, 0, 0, 0.87)]Wi-Fi Manager: 兼容linux,xrlink,freertos 等系统。支持sta,ap,monitor 和p2p 等模式,集成了softap,ble,xconfig,soundwave 等配网功能。提供了完善的api 接口方便用户调用,同时提供了一个基本完整功能的demo,方便用户直接使用和测试。上图是Wi-Fi Manager 的软件结构,整体分为3 部分:应用层,lib 层(接口抽象层,模式抽象层,os 抽象层),os 具体实现层。
    • 应用层:主要提供一个基本完整功能的demo,方便用户直接使用,用户也可以不使用该 demo,直接调用lib 库提供的api 接口。把具体功能集成到自己的应用。
    • lib 层:包含了接口层,模式抽象层,os 抽象层,对上提供统一的api 接口(wifimg.h),处理各种模式的逻辑以及共存功能,对下屏蔽os 的具体模式功能。
    • 具体 os 实现层:该层主要是不同系统对 wifi 功能的具体功能。
    Wi-Fi Manager 代码目录结构
    [color=rgba(0, 0, 0, 0.87)]wifimager 开发包在FreeRTOS SDK 里的路径如下:
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">rtos/lichee/rtos‑components/aw/wireless/Wi-Fi Manager
    [color=rgba(0, 0, 0, 0.87)]Wi-Fi Manager 的主要目录结构如下:
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">├── app                   // 用于保存配网时使用的一些配网工具。├── core                  // 核心代码│ ├── include             // 存放核心代码相关头文件│ │ └── wifimg.h          // 对上提供的api接口头文件│ └── src                 // 核心代码具体实现│ ├── linkd.c             // 配网抽象层代码│ ├── wifimg.c            // 对上提供的api接口实现代码│ ├── wmg_common.c        // 模式切换共存逻辑处理层实现代码│ ├── wmg_sta.c           // sta模式抽象层代码│ ├── wmg_ap.c            // ap模式抽象层代码│ ├── wmg_monitor.c       // monitor模式抽象层代码│ ├── wmg_p2p.c           // p2p模式抽象层代码│ ├── expand_cmd.c        // 扩展命令(与模组或系统特殊功能有关,例如获取或设置mac地址,设置特殊模组的ioct等)│ └── os                  // 具体os(linux,xrlink,freertos)模式功能实现代码├── demo                  // 比较完整功能的demo实例│ ├── wifi.c│ └── wifi_daemon.c├── files                 // 相关的配置文件
    • app 目录:存放用于配网测试的apk 安装包。
    • core 目录:存放Wi-Fi Manager 核心代码的目录,会编译出libwifimg‑v2.0 库
    • demo 目录:存放一个使用libwifimg‑v2.0 接口的demo,用户可以直接使用该demo,也可以 参考该demo 对libwifimg‑v2.0 库api 的使用方式,把功能集成到自己的应用中去。
    • files:存放相关的配置文件
    Wi-Fi Manager 核心代码Wi-Fi Manager 核心代码目录结构 code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">.├── include│ ├── linkd.h│ ├── os│ ├── wifi_log.h│ ├── wifimg.h│ ├── wmg_ap.h│ ├── wmg_common.h│ ├── wmg_monitor.h│ ├── wmg_p2p.h│ ├── expand_cmd.h│ └── wmg_sta.h└── src├── linkd.c├── log├── os│ ├── linux      // (在非linux系统该目录不存在)│ ├── xrlink     // (在非xrlink系统该目录不存在)│ └── freertos   // (在非freertos系统该目录不存在)├── wifimg.c├── wmg_ap.c├── wmg_common.c├── wmg_monitor.c├── wmg_p2p.c├── expand_cmd.c└── wmg_sta.c
    • include: 保存核心代码相关头文件目录
    • src : 保存核心代码源码文件目录
    • src/log:打印相关代码
    • src/wifimg.c : 用户接口对接口层文件(提供用户对接层API 接口文件,对接api 请查看 wifimg.h)
    • src/wmg_common.c:wifi 模式抽象层(各种模式的抽象层,处理切换和共存逻辑)
    • src/wmg_sta.c:station 模式抽象层
    • src/wmg_ap.c:ap 模式抽象层
    • src/wmg_monitor.c: monitor 模式抽象层。
    • src/expand_cmd.c:特殊额外功能抽象层。
    • src/os : 对应的系统模式实现层代码。
    • src/os/linux:linux 平台wifi 模式功能具体实现代码存放目录(在非linux 系统该目录不存在)
    • src/os/xrlink:xrlink 平台wifi 模式功能具体实现代码存放目录(在非xrlink 系统该目录不存在)
    • src/os/freertos:freertos 平台wifi 模式功能具体实现代码存放目录(在非freertos 系统该目录不存在)
    [color=rgba(0, 0, 0, 0.87)]核心代码里各文件调用关系图如下:
    [color=rgba(0, 0, 0, 0.87)][color=var(--md-typeset-a-color)]
    • 用户会调用wifimg.c 提供的接口函数
    • wifimg.c 的接口函数会调用到模式抽象层wmg_common.c 里的函数
    • wmg_common.c 里的函数会根据不同的模式调用到wmg_sta.c(sta 模式抽象层),wmg_ap.c(ap 模式抽象层)wmg_monitor.c(monitor 模式抽象层)wmg_p2p.c(p2p 模式抽象层) 里的函数
    • wmg_sta.c(sta 模式抽象层) 会根据不同的平台调用到linux_sta.c(linux 平台具体实现文件),xrlink_sta.c(xrlink 平台具体实现文件),freertos_sta.c(rtos 平台具体实现文件)。
    • wmg_ap.c(ap 模式抽象层) 会根据不同的平台调用到freertos_ap.c(linux 平台具体实现文件),xrlink_ap.c(xrlink 平台具体实现文件),freertos_ap.c(rtos 平台具体实现文件)。
    • wmg_monitor.c(monitor 模式抽象层) 会根据不同的平台调用到linux_monitor.c(linux 平台具体实现文件),xrlink_monitor.c(xrlink 平台具体实现文件),freertos_monitor.c(rtos 平台具体实现文件)。
    • wmg_p2p.c(p2p 模式抽象层) 会根据不同的平台调用到linux_p2p.c(linux 平台具体实现文件)。
    • 自定义扩展(expand_cmd.c) 与系统或模组特殊功能有关,例如设置或获取mac 地址,特殊ioct等功能。
    Wi-Fi Manager 核心代码关键结构体说明
    [color=rgba(0, 0, 0, 0.87)]该章节主要用于描述核心代码中使用到的一些关键的结构体。不需要单独阅读该章节,该章节属于查询性质,当在其他章节中查看到需要查询的结构体时再查询该章节即可。该章节的关键结构体都在 Wi-Fi Manager/core/include/wifimg.h 文件里定义。
    定义Wi-Fi Manager 的错误码
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于定义Wi-Fi Manager 各函数执行后的返回码
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef enum {    WMG_STATUS_SUCCESS = 0,    WMG_STATUS_FAIL =1,    WMG_STATUS_NOT_READY =2,    WMG_STATUS_NOMEM =3,    WMG_STATUS_BUSY =4,    WMG_STATUS_UNSUPPORTED =5,    WMG_STATUS_INVALID =6,    WMG_STATUS_TIMEOUT =7,    WMG_STATUS_UNHANDLED =8,} wmg_status_t;
    • WMG_STATUS_SUCCESS:函数执行成功
    • WMG_STATUS_FAIL:函数执行失败
    • WMG_STATUS_NOT_READY:函数没有准备好
    • WMG_STATUS_NOMEM:函数无法申请到需要的内存
    • WMG_STATUS_BUSY:函数处于忙状态
    • WMG_STATUS_UNSUPPORTED:函数不支持该功能
    • WMG_STATUS_INVALID:函数收到无效数据
    • WMG_STATUS_TIMEOUT:函数执行超时
    • WMG_STATUS_UNHANDLED:函数不处理该次调用
    定义Wi-Fi Manager 支持的模式
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于定义Wi-Fi Manager 的模式
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef enum {    WIFI_MODE_UNKNOWN = 0b0,    WIFI_STATION = 0b1,    WIFI_AP = 0b10,    WIFI_MONITOR = 0b100,    WIFI_P2P = 0b1000,} wifi_mode_t;
    • WIFI_STATION:station 模式
    • WIFI_AP:ap 模式
    • WIFI_MONITOR:monitor 模式
    • WIFI_P2P:p2p 模式
    • WIFI_MODE_UNKNOWN:未定义模式
    定义Wi-Fi Manager 网络接口状态
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于定义Wi-Fi Manager 对网卡设备状态的识别
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef enum {    WLAN_STATUS_DOWN,    WLAN_STATUS_UP,} wifi_dev_status_t;
    • WLAN_STATUS_DOWN:网卡设备关闭
    • WLAN_STATUS_UP:网卡设备启动
    定义Wi-Fi Manager 收到的消息类型
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于定义Wi-Fi Manager 收到的回调消息的类型
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef enum {    WIFI_MSG_ID_DEV_STATUS,    WIFI_MSG_ID_STA_CN_EVENT,    WIFI_MSG_ID_STA_STATE_CHANGE,    WIFI_MSG_ID_AP_CN_EVENT,    WIFI_MSG_ID_P2P_CN_EVENT,    WIFI_MSG_ID_P2P_STATE_CHANGE,    WIFI_MSG_ID_MONITOR,    WIFI_MSG_ID_MAX,} wifi_msg_id_t;
    • WIFI_MSG_ID_DEV_STATUS:设备状态发生了改变的消息
    • WIFI_MSG_ID_STA_CN_EVENT:sta 模式在连接过程中事件发生改变的消息
    • WIFI_MSG_ID_STA_STATE_CHANGE:sta 模式状态发生改变的消息
    • WIFI_MSG_ID_AP_CN_EVENT:ap 模式在连接过程中事件发生改变的消息
    • WIFI_MSG_ID_P2P_CN_EVENT:p2p 模式在连接过程中事件发生改变的消息
    • WIFI_MSG_ID_P2P_STATE_CHANGE:p2p 模式状态发生改变的消息
    • WIFI_MSG_ID_MONITOR:monitor 模式的消息
    • WIFI_MSG_ID_MAX:无意义消息类型,界限结构体用
    定义Wi-Fi Manager 的加密方式
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于定义Wi-Fi Manager 的加密方式
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef enum {    WIFI_SEC_NONE,    WIFI_SEC_WEP,    WIFI_SEC_WPA_PSK,    WIFI_SEC_WPA2_PSK,    WIFI_SEC_WPA3_PSK,} wifi_secure_t;
    • WIFI_SEC_NONE:没有加密
    • WIFI_SEC_WEP:wep 加密方式
    • WIFI_SEC_WPA_PSK:wpa 加密方式
    • WIFI_SEC_WPA2_PSK:wpa2 加密方式
    • WIFI_SEC_WPA3_PSK:wpa3 加密方式
    定义Wi-Fi Manager station 模式的状态
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于定义Wi-Fi Manager 的station 模式状态
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef enum {    WIFI_STA_IDLE,    WIFI_STA_CONNECTING,    WIFI_STA_CONNECTED,    WIFI_STA_OBTAINING_IP,    WIFI_STA_NET_CONNECTED,    WIFI_STA_DHCP_TIMEOUT,    WIFI_STA_DISCONNECTING,    WIFI_STA_DISCONNECTED,} wifi_sta_state_t;
    • WIFI_STA_IDLE:station 模式处于空闲状态
    • WIFI_STA_CONNECTING:station 模式处于正在连接ap 状态
    • WIFI_STA_CONNECTED:station 模式处于已连接上ap 状态
    • WIFI_STA_OBTAINING_IP:station 模式处于正在获取IP 状态
    • WIFI_STA_NET_CONNECTED:station 模式处于网络连接已完成状态
    • WIFI_STA_DHCP_TIMEOUT:station 模式处于DHCP 超时状态
    • WIFI_STA_DISCONNECTING:station 模式处于正在取消连接状态
    • WIFI_STA_DISCONNECTED:station 模式处于已取消连接状态
    定义Wi-Fi Manager station 模式在连接过程中的事件
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于定义Wi-Fi Manager 的station 模式在连接ap 过程中的事件
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef enum {    WIFI_DISCONNECTED,    WIFI_SCAN_STARTED,    WIFI_SCAN_FAILED,    WIFI_SCAN_RESULTS,    WIFI_NETWORK_NOT_FOUND,    WIFI_PASSWORD_INCORRECT,    WIFI_AUTHENTIACATION,    WIFI_AUTH_REJECT,    WIFI_ASSOCIATING,    WIFI_ASSOC_REJECT,    WIFI_ASSOCIATED,    WIFI_4WAY_HANDSHAKE,    WIFI_GROUNP_HANDSHAKE,    WIFI_GROUNP_HANDSHAKE_DONE,    WIFI_CONNECTED,    WIFI_CONNECT_TIMEOUT,    WIFI_DEAUTH,    WIFI_DHCP_START,    WIFI_DHCP_TIMEOUT,    WIFI_DHCP_SUCCESS,    WIFI_TERMINATING,    WIFI_UNKNOWN,} wifi_sta_event_t;
    • WIFI_DISCONNECTED:已取消连接
    • WIFI_SCAN_STARTED:扫描开始
    • WIFI_SCAN_FAILED:扫描失败
    • WIFI_SCAN_RESULTS:获取到扫描结果
    • WIFI_NETWORK_NOT_FOUND:没有找到对应的network
    • WIFI_PASSWORD_INCORRECT:密码不正确
    • WIFI_AUTHENTIACATION:认证
    • WIFI_AUTH_REJECT:认证被拒绝
    • WIFI_ASSOCIATING:关联
    • WIFI_ASSOC_REJECT:关联被拒绝
    • WIFI_ASSOCIATED:关联完成
    • WIFI_4WAY_HANDSHAKE:4 次握手
    • WIFI_GROUNP_HANDSHAKE:交换组密钥
    • WIFI_GROUNP_HANDSHAKE_DONE:交换组密钥完成
    • WIFI_CONNECTED:连接完成
    • WIFI_CONNECT_TIMEOUT:连接超时
    • WIFI_DEAUTH:取消认证
    • WIFI_DHCP_START:DHCP 开始
    • WIFI_DHCP_TIMEOUT:DHCP 超时
    • WIFI_DHCP_SUCCESS:DHCP 成功
    • WIFI_TERMINATING:终止
    • WIFI_UNKNOWN:未知
    定义 Wi-Fi Manager station 模式的一些信息
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于定义Wi-Fi Manager 的station 模式的一些信息
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef struct {    int id;    int freq;    int rssi;    uint8_t bssid[6];    char ssid[SSID_MAX_LEN + 1];    uint8_t mac_addr[6];    uint8_t ip_addr[4];    uint8_t gw_addr[4];    wifi_secure_t sec;} wifi_sta_info_t;
    • id:wpa_supplicant 里保存的network id 号
    • freq:频率(指的是信道频率,2412 = channel 1)
    • rssi:信号强度
    • bssid[6]:连接的ap 的bssid
    • ssid[SSID_MAX_LEN]:连接的ap 的ssid
    • mac_addr[6]:本地mac 地址
    • ip_addr[4]:本地ip 地址
    • gw_addr[4]:网关地址
    • sec:加密方式
    定义Wi-Fi Manager station 模式保存的ap 信息
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于定义Wi-Fi Manager station 模式时曾经连接过的一条ap 信息
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef struct {    int id;    char ssid[SSID_MAX_LEN + 1;    uint8_t bssid[6;    char flags[16;} wifi_sta_list_nod_t;
    • id:wpa_supplicant 里保存的network id 号,某些系统不会使用到,用户可以不用关心
    • ssid[SSID_MAX_LEN]:连接过的ap 的ssid
    • bssid[BSSID_MAX_LEN]:连接过的ap 的bssid
    • flags[16]:一些状态码,用户可以不用关心
    定义Wi-Fi Manager station 模式时要进行连接的ap 的配置信息
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于描述Wi-Fi Manager station 模式时要连接过的ap 的配置信息,在连接某个特定ap 时,用户需要填充这个结构体。
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef struct {    const char * ssid;    const char * password;    wifi_secure_t sec;    bool fast_connect;} wifi_sta_cn_para_t;
    • ssid:要连接的ap 的ssid
    • password:要连接的ap 的password
    • sec:要连接的ap 的加密方式
    • fast_connect:该参数暂时没有作用,扩展用,用户可以不用关心
    定义Wi-Fi Manager station 模式时扫描到的一条 ap 结果
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于定义Wi-Fi Manager station 模式时扫描到的一条ap 结果包含什么内容
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef struct {    uint8_t bssid[6;    char ssid[SSID_MAX_LEN + 1;    uint32_t freq;    int rssi;    wifi_secure_t key_mgmt;} wifi_scan_result_t;
    • bssid:扫描到的ap 的bssid
    • ssid:扫描到的ap 的ssid
    • freq:扫描到的ap 的频率(指的是信道频率,2412 = channel 1)
    • rssi:扫描到的ap 的信号强度
    • key_mgmt:扫描到的ap 的加密方式
    定义Wi-Fi Manager ap 模式的状态
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于描述Wi-Fi Manager ap 模式时的状态
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef enum {    WIFI_AP_DISABLE,    WIFI_AP_ENABLE,} wifi_ap_state_t;
    • WIFI_AP_DISABLE:ap 模式处于非使能状态
    • WIFI_AP_ENABLE:ap 模式处于使能状态
    定义Wi-Fi Manager ap 模式时的事件
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于描述Wi-Fi Manager ap 模式时的状态
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef enum {    WIFI_AP_ENABLED = 1,    WIFI_AP_DISABLED,    WIFI_AP_STA_DISCONNECTED,    WIFI_AP_STA_CONNECTED,    WIFI_AP_UNKNOWN,} wifi_ap_event_t;
    • WIFI_AP_ENABLED:ap 模式已使能
    • WIFI_AP_DISABLED:ap 模式未使能
    • WIFI_AP_STA_DISCONNECTED:ap 模式触发了有sta 取消连接事件
    • WIFI_AP_STA_CONNECTED:ap 模式触发了有sta 进行连接事件
    • WIFI_AP_UNKNOWN:ap 模式下未定义事件
    定义Wi-Fi Manager ap 模式时开启的ap 热点的配置信息
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于定义Wi-Fi Manager ap 模式时开启的ap 热点的配置信息
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef struct {    char *ssid;    char *psk;    wifi_secure_t sec;    uint8_t channel;    int key_mgmt;    uint8_t mac_addr[6;    uint8_t ip_addr[4;    uint8_t gw_addr[4;    char *dev_list[STA_MAX_NUM;    uint8_t sta_num;} wifi_ap_config_t;
    • ssid:要开启的ap 热点的ssid
    • psk:要开启的ap 热点的密码
    • sec:要开启的ap 热点的加密方式
    • channel:要开启的ap 热点的信道
    • key_mgmt:加密类型
    • mac_addr:开启的ap 地址(信息获取非设置)
    • ip_addr:开启的ap 的ip 地址(信息获取非设置)
    • gw_addr:开启的ap 的网关(信息获取非设置)
    • dev_list:连接到ap 热点的sta 设备(信息获取非设置)
    • sta_num:连接到ap 热点的sta 设备的个数(信息获取非设置)
    定义Wi-Fi Manager monitor 模式的状态
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于定义Wi-Fi Manager monitor 模式的状态
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef enum {    WIFI_MONITOR_DISABLE,    WIFI_MONITOR_ENABLE,} wifi_monitor_state_t;
    • WIFI_MONITOR_DISABLE:使能状态的monitor 模式
    • WIFI_MONITOR_ENABLE:使能状态的monitor 模式
    定义Wi-Fi Manager monitor 模式时收到的数据帧
    [color=rgba(0, 0, 0, 0.87)]结构体描述:该结构体主要用于描述Wi-Fi Manager monitor 模式时收到的帧的内容
    code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef struct {    uint8_t *data;    uint32_t len;    uint8_t channel;    void *info;} wifi_monitor_data_t;
    • data:monitor 模式时收到的帧数据
    • len:monitor 模式时收到的帧的长度
    • channel:monitor 模式时从什么信道收到的帧
    • info:monitor 模式时收到帧的扩展信息(目前暂时没有意义)
    定义Wi-Fi Manager p2p 模式时开启p2p 热点的配置信息 code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef struct {    char *dev_name;    int listen_time;    int p2p_go_intent;    bool auto_connect;} wifi_p2p_config_t;
    • dev_name:p2p 设备名
    • listen_time:启动p2p 模式时进行监听多少秒
    • p2p_go_intent:启动p2p 模式是go intent 值设置多少(0 ~ 15 会影响到gc go 的协商)
    • auto_connect:是否支持被动连接
    定义Wi-Fi Manager p2p 模式时p2p 连接成功后的信息 code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef struct {    uint8_t bssid[6;    int mode;    int freq;    char ssid[SSID_MAX_LEN + 1;} wifi_p2p_info_t;
    • bssid:p2p 的bssid
    • mode:连接成功后协助的模式go/gc
    • freq:连接成功后的频率(信道)
    • ssid:连接成功后的ssid
    定义Wi-Fi Manager p2p 模式时的状态 code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef enum {    WIFI_P2P_ENABLE,    WIFI_P2P_DISABLE,    WIFI_P2P_CONNECTD_GC,    WIFI_P2P_CONNECTD_GO,    WIFI_P2P_DISCONNECTD,} wifi_p2p_state_t;
    • WIFI_P2P_ENABLE:使能状态的p2p 模式
    • WIFI_P2P_DISABLE:不使能状态的p2p 模式
    • WIFI_P2P_CONNECTD_GC:连接状态,协商模式为gc
    • WIFI_P2P_CONNECTD_GO:连接状态,协商模式未go
    • WIFI_P2P_DISCONNECTD:未连接状态
    定义Wi-Fi Manager p2p 模式时的事件 code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef enum {    WIFI_P2P_DEV_FOUND,    WIFI_P2P_DEV_LOST,    WIFI_P2P_PBC_REQ,    WIFI_P2P_GO_NEG_RQ,    WIFI_P2P_GO_NEG_SUCCESS,    WIFI_P2P_GO_NEG_FAILURE,    WIFI_P2P_GROUP_FOR_SUCCESS,    WIFI_P2P_GROUP_FOR_FAILURE,    WIFI_P2P_GROUP_STARTED,    WIFI_P2P_GROUP_REMOVED,    WIFI_P2P_CROSS_CONNECT_ENABLE,    WIFI_P2P_CROSS_CONNECT_DISABLE,    /*Wi-Fi Manager self‑defined state*/    WIFI_P2P_SCAN_RESULTS,    WIFI_P2P_GROUP_DHCP_DNS_FAILURE,    WIFI_P2P_GROUP_DHCP_SUCCESS,    WIFI_P2P_GROUP_DHCP_FAILURE,    WIFI_P2P_GROUP_DNS_SUCCESS,    WIFI_P2P_GROUP_DNS_FAILURE,    WIFI_P2P_UNKNOWN,} wifi_p2p_event_t;
    • WIFI_P2P_DEV_FOUND:寻找p2p 设备事件
    • WIFI_P2P_DEV_LOST:p2p 设备丢失事件
    • WIFI_P2P_PBC_REQ:以pbc 方式连接请求事件
    • WIFI_P2P_GO_NEG_RQ:go 模式协商请求事件
    • WIFI_P2P_GO_NEG_SUCCESS:go 模式协商成功事件
    • WIFI_P2P_GO_NEG_FAILURE:go 模式协商失败事件
    • WIFI_P2P_GROUP_FOR_SUCCESS:p2p 组创建成功事件
    • WIFI_P2P_GROUP_FOR_FAILURE:p2p 组创建失败事件
    • WIFI_P2P_GROUP_STARTED:p2p 组创建开始事件
    • WIFI_P2P_GROUP_REMOVED:p2p 移除组事件
    • WIFI_P2P_CROSS_CONNECT_ENABLE
    • WIFI_P2P_CROSS_CONNECT_DISABLE
    • /Wi-Fi Manager self‑defined state/ –> Wi-Fi Manager 自定义事件
    • WIFI_P2P_SCAN_RESULTS:p2p 扫描完成事件
    • WIFI_P2P_GROUP_DHCP_DNS_FAILURE:p2p 组dhcp/dns 启动失败事件
    • WIFI_P2P_GROUP_DHCP_SUCCESS:p2p dhcp 成功事件(gc 模式下获取到了ip 地址)
    • WIFI_P2P_GROUP_DHCP_FAILURE:p2p dhcp 失败事件
    • WIFI_P2P_GROUP_DNS_SUCCESS:p2p dns 服务启动成功事件(go 模式下dns 服务成功)
    • WIFI_P2P_GROUP_DNS_FAILURE:p2p dns 服务启动失败事件
    • WIFI_P2P_UNKNOWN:未知p2p 事件
    定义Wi-Fi Manager 收到的回调事件 code" style="box-sizing: inherit; -webkit-tap-highlight-color: transparent; font-size: inherit; font-family: inherit; background-image: initial; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; border-width: 0px; border-style: initial; border-color: initial; position: absolute; top: 0.5em; right: 0.5em; z-index: 1; width: 1.5em; height: 1.5em; border-radius: 0.1rem; outline: none; outline-offset: 0.1rem; cursor: pointer; transition: color 0.25s ease 0s;">typedef struct {wifi_msg_id_t id;    union {        wifi_dev_status_t d_status;        wifi_sta_event_t event;        wifi_sta_state_t state;        wifi_ap_event_t ap_event;        wifi_ap_state_t ap_state;        wifi_monitor_state_t mon_state;        wifi_monitor_data_t *frame;        wifi_p2p_event_t p2p_event;        wifi_p2p_state_t p2p_state;    } data;} wifi_msg_data_t;
    • id:回调事件的数据类型,根据这个id 好确定data 里的数据是什么类型的data:数据类型
    • d_status:回调事件数据类型是设备状态变化信息
    • even:回调事件数据类型是sta 模式连接ap 过程中状态变化信息
    • state:回调事件数据类型是sta 模式状态信息
    • ap_event:回调事件数据类型是ap 模式连接过程中状态变化信息
    • ap_state:回调事件数据类型是ap 模式状态信息
    • mon_state:回调事件数据类型是monitor 模式状态信息
    • p2p_event:回调事件数据类型是p2p 模式连接过程中状态变化信息
    • p2p_state:回调事件数据类型是p2p 模式状态信息
    • frame:回调事件数据类型是monitor 模式收到的数据帧


  • 使用特权

    评论回复

    相关帖子

    发新帖 我要提问
    您需要登录后才可以回帖 登录 | 注册

    本版积分规则

    192

    主题

    200

    帖子

    0

    粉丝