TuyaOS
wifi_netcfg_frame_transporter.h
1#ifndef __WIFI_NETCFG_FRAME_TRANSPORTER_H__
2#define __WIFI_NETCFG_FRAME_TRANSPORTER_H__
3#include "tal_network.h"
4#include "tal_wifi.h"
5#include <stdint.h>
6#include <stdbool.h>
7#include <string.h>
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13/*
14 wifi_netcfg_frame_transporter组件是wifi相关配网组件的公共服务模块,原来是ez配网中的
15 cc_t(chanChannel_timer)的工作,由于ez+ap共存配网,ffs配网,无感配网等配网的引入,因此
16 把wifi 802.11 frame发送部分的功能独立出来,取名wifi_netcfg_frame_transporter,希望能
17 更换的为ez+ap共存配网,ffs配网,无感配网,以及后续可能加入的其他wifi配网方式服务;
18
19
20 角色逻辑:
21 1个transporter <-----> n个transportee
22 用户获取:唯一的transporter
23 用户通过transporter的接口register,unregister,注册/销毁对应于netcfg_type的Transportee,
24 通过start,stop,isRun来开始,停止和判断是否允许该Transportee;
25*/
26
27typedef int (*fnProbeRequestTransportCallBack_t)(void* ptrArgs, BYTE_T channel);
28typedef int (*fnAuthTransportCallBack_t)(void* ptrArgs, BYTE_T channel);
29typedef int (*fnBeaconTransportCallBack_t)(void* ptrArgs, BYTE_T channel);
30
32 fnProbeRequestTransportCallBack_t fnProbeRequestTransport;
33 fnAuthTransportCallBack_t fnAuthTransport;
34 fnBeaconTransportCallBack_t fnBeaconTransport;
35 void* ptrArgs;
37
38/*
39 transportee:
40 register->start->ungister
41 isRun
42 transporter:
43 transporter is inited and started in WifiNetcfgFrameTransporterSessionInit
44 and will be:
45 lock->stop
46 getApInfo
47 in transportee.
48*/
49typedef int (*fnRegister)(int netcfg_type, ptrTransporteeParameters_t pParam);
50typedef int (*fnStart)(int netcfg_type);
51typedef bool (*fnIsRun)(int netcfg_type);
52typedef int (*fnUnregister)(int netcfg_type);
53
54typedef int (*fnLock)(bool lockState);
55typedef int (*fnStartTransporter)(void);
56typedef int (*fnStopTransporter)(void);
57typedef int (*fnGetApInfo)(AP_IF_S **ppApArray, uint32_t * pApNum);
58
59
61 fnRegister registerTransporteeFn;
62 fnStart startTransporteeFn;
63 fnIsRun isRunTransporteeFn;
64 fnUnregister unregisterTransporteeFn;
65
66 fnLock lockTransporterChannelFn;
67 fnStartTransporter startTransporterFn;
68 fnStopTransporter stopTransporterFn;
69 fnGetApInfo getApInfoFn;
71
72/*配网开始时,执行信道初始化*/
73int wifiNetcfgFrameTransporterChannelInitAndStart(void);
74
75
76/*
77 获取或创建wifi_netcfg_frame_transporter的实例,线程安全
78*/
79ptrWifiNetcfgFrameTransporter_t getWifiNetcfgFrameTransporter(void);
80/*
81 销毁wifi_netcfg_frame_transporter实例,释放内存
82*/
83void destroyWifiNetcfgFrameTransporter(void);
84
85/*配网模块全局初始化,创建并初始化TransporterSession,必须在getTransporter之前调用*/
86int WifiNetcfgFrameTransporterSessionInit(void);
87/*配网模块全局销毁,在配网活动结束之后调用*/
88int WifiNetcfgFrameTransporterSessionUninit(void);
89uint8_t wifiNetcfgGetChannelOnce(char *ssid);
90
91#ifdef __cplusplus
92}
93#endif
94#endif
Definition: wifi_netcfg_frame_transporter.h:31
Definition: wifi_netcfg_frame_transporter.h:60
Common process - Initialization
Common process