• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
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 
16 #ifndef OHOS_WIFI_INTER_SCAN_INFO_H
17 #define OHOS_WIFI_INTER_SCAN_INFO_H
18 
19 #include "wifi_scan_msg.h"
20 namespace OHOS {
21 namespace Wifi {
22 constexpr int WIFI_MODE_UNDEFINED = 0;
23 constexpr int WIFI_802_11A = 1;
24 constexpr int WIFI_802_11B = 2;
25 constexpr int WIFI_802_11G = 3;
26 constexpr int WIFI_802_11N = 4;
27 constexpr int WIFI_802_11AC = 5;
28 constexpr int WIFI_802_11AX = 6;
29 
30 enum class Ant {
31     NETWORK_PRIVATE = 0,
32     NETWORK_PRIVATEWITHGUEST = 1,
33     NETWORK_CHARGEABLEPUBLIC = 2,
34     NETWORK_FREEPUBLIC = 3,
35     NETWORK_PERSONAL = 4,
36     NETWORK_EMERGENCYONLY = 5,
37     NETWORK_RESVD6 = 6,
38     NETWORK_RESVD7 = 7,
39     NETWORK_RESVD8 = 8,
40     NETWORK_RESVD9 = 9,
41     NETWORK_RESVD10 = 10,
42     NETWORK_RESVD11 = 11,
43     NETWORK_RESVD12 = 12,
44     NETWORK_RESVD13 = 13,
45     NETWORK_TESTOREXPERIMENTAL = 14,
46     NETWORK_WILDCARD = 15,
47     NETWORK_ANT_INVALID = 16
48 };
49 
50 struct InterScanInfo {
51     std::string bssid;
52     std::string ssid;
53     // Original SSID, used to store the original SSID of different charts like GBK, UTF-8, etc.
54     std::string oriSsid;
55     /**
56      * Network performance, including authentication,
57      * key management, and encryption mechanisms
58      * supported by the access point
59      */
60     std::string capabilities;
61     int frequency;
62     int band;  /* ap band, 1: 2.4G, 2: 5G */
63     WifiChannelWidth channelWidth;
64     int centerFrequency0;
65     int centerFrequency1;
66     int rssi; /* signal level */
67     WifiSecurity securityType;
68     std::vector<WifiInfoElem> infoElems;
69     int64_t features;
70     int64_t timestamp;
71     Ant ant;
72     int wifiMode;
73     bool isVhtInfoExist;
74     bool isHtInfoExist;
75     bool isHeInfoExist;
76     bool isErpExist;
77     int maxRates;
78     int isHiLinkNetwork;
79     bool isHiLinkProNetwork;
80     WifiCategory supportedWifiCategory;
81 
InterScanInfoInterScanInfo82     InterScanInfo()
83         : frequency(0),
84           band(0),
85           channelWidth(WifiChannelWidth::WIDTH_INVALID),
86           centerFrequency0(0),
87           centerFrequency1(0),
88           rssi(0),
89           securityType(WifiSecurity::INVALID),
90           features(0),
91           timestamp(0),
92           ant(Ant::NETWORK_ANT_INVALID),
93           wifiMode(WIFI_MODE_UNDEFINED),
94           isVhtInfoExist(false),
95           isHtInfoExist(false),
96           isHeInfoExist(false),
97           isErpExist(false),
98           maxRates(0),
99           isHiLinkNetwork(0),
100           isHiLinkProNetwork(false),
101           supportedWifiCategory(WifiCategory::DEFAULT) {}
102 
~InterScanInfoInterScanInfo103     ~InterScanInfo() {}
104 
GetDeviceMgmtInterScanInfo105     void GetDeviceMgmt(std::string &mgmt) const
106     {
107         switch (securityType) {
108             case WifiSecurity::PSK:
109                 mgmt = "WPA-PSK";
110                 break;
111             case WifiSecurity::EAP:
112                 mgmt = "WPA-EAP";
113                 break;
114             case WifiSecurity::SAE:
115                 mgmt = "SAE";
116                 break;
117             case WifiSecurity::OWE:
118                 mgmt = "OWE";
119                 break;
120             case WifiSecurity::WEP:
121                 mgmt = "WEP";
122                 break;
123             case WifiSecurity::EAP_SUITE_B:
124                 mgmt = "WPA-EAP-SUITE-B-192";
125                 break;
126             case WifiSecurity::WAPI_CERT:
127                 mgmt = "WAPI-CERT";
128                 break;
129             case WifiSecurity::WAPI_PSK:
130                 mgmt = "WAPI-PSK";
131                 break;
132             case WifiSecurity::PSK_SAE:
133                 mgmt = "WPA-PSK+SAE";
134                 break;
135             default:
136                 mgmt = "NONE";
137                 break;
138         }
139     }
140 
GetWifiStandardInterScanInfo141     void GetWifiStandard(int &standard) const
142     {
143         standard = wifiMode;
144     }
145 
IsWifi11bModeInterScanInfo146     bool IsWifi11bMode() const
147     {
148         return wifiMode == WIFI_802_11B;
149     }
150 };
151 }
152 }
153 #endif
154