• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef WIFI_CONFIG_H_
16 #define WIFI_CONFIG_H_
17 
18 #include "rtos_ohos_al.h"
19 #include "los_list.h"
20 #include "wifi_device.h"
21 #include "wifi_hotspot_config.h"
22 #include "wifi_host_api.h"
23 
24 #define PARAM_CHECK(para) do {          \
25     if (para == NULL) {                 \
26         return ERROR_WIFI_UNKNOWN; \
27     }                                   \
28 } while(0)
29 
30 typedef struct {
31     uint16_t eventId;
32     uint32_t payLoad;
33 } ChipseaWifiMsg;
34 
35 typedef enum {
36     WIFI_START_SCAN = 0,
37     WIFI_START_ADVANCE_SCAN = 1,
38 } WifiEventIdList;
39 
40 typedef enum {
41     WIFI_INACTIVE = 0,
42     WIFI_ACTIVE = 1,
43     WIFI_CONNECT = 2,
44 } WifiStaState;
45 
46 typedef struct {
47     uint8_t used;
48     WifiDeviceConfig devConf;
49 } WifiConnectDevice;
50 
51 typedef struct {
52     uint8_t networkId;
53     WifiLinkedInfo linkinfo;
54 } WifiConnectedInfo;
55 
56 typedef struct {
57     WifiEvent *event;
58     LOS_DL_LIST node;
59 } WifiEventNode;
60 
61 typedef struct {
62     WifiStaState state;
63     rtos_queue wifiQueue;
64     rtos_task_handle wifiTask;
65     int32_t scanSize;
66     struct fhost_cntrl_link *consoleCntrlLink;
67     WifiConnectedInfo connectedInfo;
68     WifiConnectDevice deviceTab[WIFI_MAX_CONFIG_SIZE];
69     uint8_t eventCnt;
70 } ChipseaWifiStaData;
71 
72 typedef struct {
73     StationInfo station;
74     LOS_DL_LIST node;
75 } WifiStationNode;
76 
77 typedef struct {
78     uint8_t state;
79     rtos_mutex mutex;
80     struct fhost_vif_ap_cfg vifApCfg;
81     HotspotConfig hostpotCfg;
82     LOS_DL_LIST stationHead;
83     uint8_t stationCnt;
84 } ChipseaWifiApData;
85 
86 void DoScanCallBack(int state, uint8_t size);
87 void DoStaConnectCallBack(int state, WifiLinkedInfo *info);
88 void DoStaJoinCallBack(StationInfo *info);
89 void DoStaLeaveCallBack(StationInfo *info);
90 void DoApStateCallBack(int state);
91 void DoApStateCallBack(int state);
92 int32_t WifiLock();
93 int32_t WifiUnlock();
94 void SecureHm2Chipsea(int hmType, uint32_t *akm);
95 void SecureChipsea2Hm(int *hmType, uint32_t akm);
96 #endif