1094332d3Sopenharmony_ci/*
2094332d3Sopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License.
5094332d3Sopenharmony_ci * You may obtain a copy of the License at
6094332d3Sopenharmony_ci *
7094332d3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
8094332d3Sopenharmony_ci *
9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and
13094332d3Sopenharmony_ci * limitations under the License.
14094332d3Sopenharmony_ci */
15094332d3Sopenharmony_ci
16094332d3Sopenharmony_ci#include <gtest/gtest.h>
17094332d3Sopenharmony_ci#include <osal_mem.h>
18094332d3Sopenharmony_ci#include "hdf_base.h"
19094332d3Sopenharmony_ci#include "hdf_sbuf.h"
20094332d3Sopenharmony_ci#include "wifi_hal.h"
21094332d3Sopenharmony_ci#include "wifi_hal_ap_feature.h"
22094332d3Sopenharmony_ci#include "wifi_hal_base_feature.h"
23094332d3Sopenharmony_ci#include "wifi_hal_sta_feature.h"
24094332d3Sopenharmony_ci#include "securec.h"
25094332d3Sopenharmony_ci
26094332d3Sopenharmony_cistruct ElementHeader {
27094332d3Sopenharmony_ci    uint8_t id;
28094332d3Sopenharmony_ci    uint8_t datalen;
29094332d3Sopenharmony_ci};
30094332d3Sopenharmony_ci
31094332d3Sopenharmony_ciusing namespace testing::ext;
32094332d3Sopenharmony_ci
33094332d3Sopenharmony_cinamespace HalTest {
34094332d3Sopenharmony_cistruct IWiFi *g_wifi = nullptr;
35094332d3Sopenharmony_ciconst int32_t WLAN_TX_POWER = 160;
36094332d3Sopenharmony_ciconst uint32_t IFNAME_MIN_NUM = 0;
37094332d3Sopenharmony_ciconst uint32_t IFNAME_MAX_NUM = 32;
38094332d3Sopenharmony_ciconst uint32_t MAX_IF_NAME_LENGTH = 16;
39094332d3Sopenharmony_ciconst uint32_t TEST_PARAM_BUF_SIZE = 64;
40094332d3Sopenharmony_ciconst uint32_t SIZE = 4;
41094332d3Sopenharmony_ciconst int32_t TEST_CMD = 123;
42094332d3Sopenharmony_ciconst uint32_t RESET_TIME = 3;
43094332d3Sopenharmony_ciconst uint32_t SCAN_TIME = 3;
44094332d3Sopenharmony_ciconst uint32_t TEST_BUF_SIZE = 64;
45094332d3Sopenharmony_ciconst uint32_t WLAN_EID_SSID = 0;
46094332d3Sopenharmony_ci
47094332d3Sopenharmony_ciclass WifiHalTest : public testing::Test {
48094332d3Sopenharmony_cipublic:
49094332d3Sopenharmony_ci    static void SetUpTestCase();
50094332d3Sopenharmony_ci    static void TearDownTestCase();
51094332d3Sopenharmony_ci    void SetUp();
52094332d3Sopenharmony_ci    void TearDown();
53094332d3Sopenharmony_ci};
54094332d3Sopenharmony_ci
55094332d3Sopenharmony_civoid WifiHalTest::SetUpTestCase()
56094332d3Sopenharmony_ci{
57094332d3Sopenharmony_ci    int ret;
58094332d3Sopenharmony_ci
59094332d3Sopenharmony_ci    ret = WifiConstruct(&g_wifi);
60094332d3Sopenharmony_ci    ASSERT_EQ(HDF_SUCCESS, ret);
61094332d3Sopenharmony_ci}
62094332d3Sopenharmony_ci
63094332d3Sopenharmony_civoid WifiHalTest::TearDownTestCase()
64094332d3Sopenharmony_ci{
65094332d3Sopenharmony_ci    int ret;
66094332d3Sopenharmony_ci
67094332d3Sopenharmony_ci    ret = WifiDestruct(&g_wifi);
68094332d3Sopenharmony_ci    ASSERT_EQ(HDF_SUCCESS, ret);
69094332d3Sopenharmony_ci}
70094332d3Sopenharmony_ci
71094332d3Sopenharmony_civoid WifiHalTest::SetUp()
72094332d3Sopenharmony_ci{
73094332d3Sopenharmony_ci    int ret;
74094332d3Sopenharmony_ci
75094332d3Sopenharmony_ci    ret = g_wifi->start(nullptr);
76094332d3Sopenharmony_ci    ASSERT_EQ(HDF_ERR_INVALID_PARAM, ret);
77094332d3Sopenharmony_ci    ret = g_wifi->start(g_wifi);
78094332d3Sopenharmony_ci    ASSERT_EQ(HDF_SUCCESS, ret);
79094332d3Sopenharmony_ci}
80094332d3Sopenharmony_ci
81094332d3Sopenharmony_civoid WifiHalTest::TearDown()
82094332d3Sopenharmony_ci{
83094332d3Sopenharmony_ci    int ret;
84094332d3Sopenharmony_ci
85094332d3Sopenharmony_ci    ret = g_wifi->stop(nullptr);
86094332d3Sopenharmony_ci    ASSERT_EQ(HDF_ERR_INVALID_PARAM, ret);
87094332d3Sopenharmony_ci    ret = g_wifi->stop(g_wifi);
88094332d3Sopenharmony_ci    ASSERT_EQ(HDF_SUCCESS, ret);
89094332d3Sopenharmony_ci}
90094332d3Sopenharmony_ci
91094332d3Sopenharmony_cistatic void PrintSsid(const uint8_t *ie, uint32_t len)
92094332d3Sopenharmony_ci{
93094332d3Sopenharmony_ci    char ssid[MAX_SSID_LEN] = {0};
94094332d3Sopenharmony_ci    uint8_t *pos = NULL;
95094332d3Sopenharmony_ci    struct ElementHeader *hdr = (struct ElementHeader *)ie;
96094332d3Sopenharmony_ci
97094332d3Sopenharmony_ci    if (ie == NULL || len < sizeof(struct ElementHeader)) {
98094332d3Sopenharmony_ci        return;
99094332d3Sopenharmony_ci    }
100094332d3Sopenharmony_ci    while (ie + len >= ((uint8_t *)hdr + sizeof(*hdr) + hdr->datalen)) {
101094332d3Sopenharmony_ci        pos = (uint8_t *)hdr + sizeof(*hdr);
102094332d3Sopenharmony_ci        if (hdr->id == WLAN_EID_SSID) {
103094332d3Sopenharmony_ci            if (hdr->datalen < MAX_SSID_LEN && memcpy_s(ssid, MAX_SSID_LEN, pos, hdr->datalen) == EOK) {
104094332d3Sopenharmony_ci                printf("ssid: %s\n", ssid);
105094332d3Sopenharmony_ci            }
106094332d3Sopenharmony_ci            return;
107094332d3Sopenharmony_ci        }
108094332d3Sopenharmony_ci        hdr = (struct ElementHeader *)(pos + hdr->datalen);
109094332d3Sopenharmony_ci    }
110094332d3Sopenharmony_ci}
111094332d3Sopenharmony_ci
112094332d3Sopenharmony_cistatic void ParseScanResult(WifiScanResult *scanResult)
113094332d3Sopenharmony_ci{
114094332d3Sopenharmony_ci    printf("ParseScanResult: flags=%d, caps=%d, freq=%d, beaconInt=%d,\n", scanResult->flags, scanResult->caps,
115094332d3Sopenharmony_ci        scanResult->freq, scanResult->beaconInt);
116094332d3Sopenharmony_ci    printf("ParseScanResult: qual=%d, beaconIeLen=%d, level=%d, age=%d, ieLen=%d,\n", scanResult->qual,
117094332d3Sopenharmony_ci        scanResult->beaconIeLen, scanResult->level, scanResult->age, scanResult->ieLen);
118094332d3Sopenharmony_ci    PrintSsid(scanResult->ie, scanResult->ieLen);
119094332d3Sopenharmony_ci}
120094332d3Sopenharmony_ci
121094332d3Sopenharmony_cistatic void ParseScanResults(WifiScanResults *scanResults)
122094332d3Sopenharmony_ci{
123094332d3Sopenharmony_ci    uint32_t i;
124094332d3Sopenharmony_ci    printf("Receive %u scan results\n", scanResults->num);
125094332d3Sopenharmony_ci    for (i = 0 ; i < scanResults->num; i++) {
126094332d3Sopenharmony_ci        ParseScanResult(&scanResults->scanResult[i]);
127094332d3Sopenharmony_ci    }
128094332d3Sopenharmony_ci}
129094332d3Sopenharmony_ci
130094332d3Sopenharmony_cistatic int32_t Hid2dFunCb(const uint8_t *recvMsg, uint32_t recvMsgLen)
131094332d3Sopenharmony_ci{
132094332d3Sopenharmony_ci    (void)recvMsg;
133094332d3Sopenharmony_ci    (void)recvMsgLen;
134094332d3Sopenharmony_ci    return HDF_SUCCESS;
135094332d3Sopenharmony_ci}
136094332d3Sopenharmony_ci
137094332d3Sopenharmony_ci/**
138094332d3Sopenharmony_ci * @tc.name: WifiHalCreateAndDestroyFeature001
139094332d3Sopenharmony_ci * @tc.desc: Wifi hal create and destroy feature function test
140094332d3Sopenharmony_ci * @tc.type: FUNC
141094332d3Sopenharmony_ci * @tc.require: AR000F869G
142094332d3Sopenharmony_ci */
143094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalCreateAndDestroyFeature001, TestSize.Level1)
144094332d3Sopenharmony_ci{
145094332d3Sopenharmony_ci    int ret;
146094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
147094332d3Sopenharmony_ci
148094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
149094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
150094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
151094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature(nullptr);
152094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
153094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
154094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
155094332d3Sopenharmony_ci    }
156094332d3Sopenharmony_ci}
157094332d3Sopenharmony_ci
158094332d3Sopenharmony_ci/**
159094332d3Sopenharmony_ci * @tc.name: WifiHalCreateAndDestroyFeature002
160094332d3Sopenharmony_ci * @tc.desc: Wifi hal create and destroy feature function test
161094332d3Sopenharmony_ci * @tc.type: FUNC
162094332d3Sopenharmony_ci * @tc.require: AR000F869E
163094332d3Sopenharmony_ci */
164094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalCreateAndDestroyFeature002, TestSize.Level1)
165094332d3Sopenharmony_ci{
166094332d3Sopenharmony_ci    int ret;
167094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
168094332d3Sopenharmony_ci
169094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
170094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
171094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
172094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature(nullptr);
173094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
174094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
175094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
176094332d3Sopenharmony_ci    }
177094332d3Sopenharmony_ci}
178094332d3Sopenharmony_ci
179094332d3Sopenharmony_ci/**
180094332d3Sopenharmony_ci * @tc.name: WifiHalGetFeatureByIfName001
181094332d3Sopenharmony_ci * @tc.desc: Wifi hal get feature by ifname function test
182094332d3Sopenharmony_ci * @tc.type: FUNC
183094332d3Sopenharmony_ci * @tc.require: AR000F869G
184094332d3Sopenharmony_ci */
185094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalGetFeatureByIfName001, TestSize.Level1)
186094332d3Sopenharmony_ci{
187094332d3Sopenharmony_ci    int ret;
188094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
189094332d3Sopenharmony_ci    struct IWiFiAp *apFeatureGet = nullptr;
190094332d3Sopenharmony_ci    const char *ifName0 = "wlanTest";
191094332d3Sopenharmony_ci
192094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
193094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
194094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
195094332d3Sopenharmony_ci        ret = g_wifi->getFeatureByIfName(nullptr, (struct IWiFiBaseFeature **)&apFeatureGet);
196094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
197094332d3Sopenharmony_ci        ret = g_wifi->getFeatureByIfName(ifName0, (struct IWiFiBaseFeature **)&apFeatureGet);
198094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
199094332d3Sopenharmony_ci        ret = g_wifi->getFeatureByIfName(apFeature->baseFeature.ifName, (struct IWiFiBaseFeature **)&apFeatureGet);
200094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
201094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeatureGet);
202094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
203094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
204094332d3Sopenharmony_ci    }
205094332d3Sopenharmony_ci}
206094332d3Sopenharmony_ci
207094332d3Sopenharmony_cistatic int32_t HalCallbackEvent(uint32_t event, void *respData, const char *ifName)
208094332d3Sopenharmony_ci{
209094332d3Sopenharmony_ci    (void)event;
210094332d3Sopenharmony_ci    if (respData == nullptr) {
211094332d3Sopenharmony_ci        return HDF_FAILURE;
212094332d3Sopenharmony_ci    }
213094332d3Sopenharmony_ci    printf("HalCallbackEvent ifName = %s, event = %d\n", ifName, event);
214094332d3Sopenharmony_ci    switch (event) {
215094332d3Sopenharmony_ci        case WIFI_EVENT_SCAN_DONE:
216094332d3Sopenharmony_ci            printf("HalCallbackEvent WIFI_EVENT_SCAN_DONE Process\n");
217094332d3Sopenharmony_ci            break;
218094332d3Sopenharmony_ci        case WIFI_EVENT_SCAN_RESULT:
219094332d3Sopenharmony_ci            ParseScanResult((WifiScanResult *)respData);
220094332d3Sopenharmony_ci            break;
221094332d3Sopenharmony_ci        case WIFI_EVENT_SCAN_RESULTS:
222094332d3Sopenharmony_ci            ParseScanResults((WifiScanResults *)respData);
223094332d3Sopenharmony_ci            break;
224094332d3Sopenharmony_ci        default:
225094332d3Sopenharmony_ci            printf("HalCallbackEvent: Invalid event\n");
226094332d3Sopenharmony_ci    }
227094332d3Sopenharmony_ci    return HDF_SUCCESS;
228094332d3Sopenharmony_ci}
229094332d3Sopenharmony_ci
230094332d3Sopenharmony_ci/**
231094332d3Sopenharmony_ci * @tc.name: WifiHalRegisterEventCallback001
232094332d3Sopenharmony_ci * @tc.desc: Wifi hal register callback function test
233094332d3Sopenharmony_ci * @tc.type: FUNC
234094332d3Sopenharmony_ci * @tc.require: AR000F869G
235094332d3Sopenharmony_ci */
236094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalRegisterEventCallback001, TestSize.Level1)
237094332d3Sopenharmony_ci{
238094332d3Sopenharmony_ci    int ret;
239094332d3Sopenharmony_ci
240094332d3Sopenharmony_ci    ret = g_wifi->registerEventCallback(HalCallbackEvent, "wlan0");
241094332d3Sopenharmony_ci    EXPECT_EQ(HDF_SUCCESS, ret);
242094332d3Sopenharmony_ci}
243094332d3Sopenharmony_ci
244094332d3Sopenharmony_ci/**
245094332d3Sopenharmony_ci * @tc.name: WifiHalUnRegisterEventCallback001
246094332d3Sopenharmony_ci * @tc.desc: Wifi hal unregister callback function test
247094332d3Sopenharmony_ci * @tc.type: FUNC
248094332d3Sopenharmony_ci * @tc.require: AR000F869G
249094332d3Sopenharmony_ci */
250094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalUnRegisterEventCallback001, TestSize.Level1)
251094332d3Sopenharmony_ci{
252094332d3Sopenharmony_ci    int ret;
253094332d3Sopenharmony_ci
254094332d3Sopenharmony_ci    ret = g_wifi->unregisterEventCallback(HalCallbackEvent, "wlan0");
255094332d3Sopenharmony_ci    EXPECT_EQ(HDF_SUCCESS, ret);
256094332d3Sopenharmony_ci}
257094332d3Sopenharmony_ci
258094332d3Sopenharmony_ci/**
259094332d3Sopenharmony_ci * @tc.name: WifiHalGetNetworkIfaceName001
260094332d3Sopenharmony_ci * @tc.desc: Wifi hal get network iface name function test
261094332d3Sopenharmony_ci * @tc.type: FUNC
262094332d3Sopenharmony_ci * @tc.require: AR000F869G
263094332d3Sopenharmony_ci */
264094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalGetNetworkIfaceName001, TestSize.Level1)
265094332d3Sopenharmony_ci{
266094332d3Sopenharmony_ci    int ret;
267094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
268094332d3Sopenharmony_ci
269094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
270094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
271094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
272094332d3Sopenharmony_ci        const char *ifnameTest = apFeature->baseFeature.getNetworkIfaceName(nullptr);
273094332d3Sopenharmony_ci        EXPECT_EQ(nullptr, ifnameTest);
274094332d3Sopenharmony_ci        const char *ifName = apFeature->baseFeature.getNetworkIfaceName((const struct IWiFiBaseFeature *)apFeature);
275094332d3Sopenharmony_ci        EXPECT_NE(nullptr, ifName);
276094332d3Sopenharmony_ci        if (strncmp(ifName, "wlan", 4) == 0 || strncmp(ifName, "nan", 3) == 0 || strncmp(ifName, "p2p", 3) == 0) {
277094332d3Sopenharmony_ci            ret = 0;
278094332d3Sopenharmony_ci        } else {
279094332d3Sopenharmony_ci            ret = -1;
280094332d3Sopenharmony_ci        }
281094332d3Sopenharmony_ci        EXPECT_EQ(0, ret);
282094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
283094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
284094332d3Sopenharmony_ci    }
285094332d3Sopenharmony_ci}
286094332d3Sopenharmony_ci
287094332d3Sopenharmony_ci/**
288094332d3Sopenharmony_ci * @tc.name: WifiHalGetGetFeatureType001
289094332d3Sopenharmony_ci * @tc.desc: Wifi hal get feature type function test
290094332d3Sopenharmony_ci * @tc.type: FUNC
291094332d3Sopenharmony_ci * @tc.require: AR000F869G
292094332d3Sopenharmony_ci */
293094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalGetGetFeatureType001, TestSize.Level1)
294094332d3Sopenharmony_ci{
295094332d3Sopenharmony_ci    int ret;
296094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
297094332d3Sopenharmony_ci    int32_t type;
298094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
299094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
300094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
301094332d3Sopenharmony_ci        type = apFeature->baseFeature.getFeatureType(nullptr);
302094332d3Sopenharmony_ci        EXPECT_EQ(HDF_FAILURE, type);
303094332d3Sopenharmony_ci        type = apFeature->baseFeature.getFeatureType((struct IWiFiBaseFeature *)apFeature);
304094332d3Sopenharmony_ci        EXPECT_EQ(PROTOCOL_80211_IFTYPE_AP, type);
305094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
306094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
307094332d3Sopenharmony_ci    }
308094332d3Sopenharmony_ci}
309094332d3Sopenharmony_ci
310094332d3Sopenharmony_ci/**
311094332d3Sopenharmony_ci * @tc.name: WifiHalSetMacAddress001
312094332d3Sopenharmony_ci * @tc.desc: Wifi hal set Mac address function test
313094332d3Sopenharmony_ci * @tc.type: FUNC
314094332d3Sopenharmony_ci * @tc.require: AR000F869G
315094332d3Sopenharmony_ci */
316094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalSetMacAddress001, TestSize.Level1)
317094332d3Sopenharmony_ci{
318094332d3Sopenharmony_ci    int ret;
319094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
320094332d3Sopenharmony_ci    unsigned char errorMac[ETH_ADDR_LEN] = {0x11, 0x34, 0x56, 0x78, 0xab, 0xcd};
321094332d3Sopenharmony_ci    unsigned char mac[ETH_ADDR_LEN] = {0x12, 0x34, 0x56, 0x78, 0xab, 0xcd};
322094332d3Sopenharmony_ci
323094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
324094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
325094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
326094332d3Sopenharmony_ci        ret = apFeature->baseFeature.setMacAddress(nullptr, mac, ETH_ADDR_LEN);
327094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
328094332d3Sopenharmony_ci        ret = apFeature->baseFeature.setMacAddress((struct IWiFiBaseFeature *)apFeature, nullptr, ETH_ADDR_LEN);
329094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
330094332d3Sopenharmony_ci        ret = apFeature->baseFeature.setMacAddress((struct IWiFiBaseFeature *)apFeature, mac, 0);
331094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
332094332d3Sopenharmony_ci        ret = apFeature->baseFeature.setMacAddress((struct IWiFiBaseFeature *)apFeature, errorMac, ETH_ADDR_LEN);
333094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
334094332d3Sopenharmony_ci        ret = apFeature->baseFeature.setMacAddress((struct IWiFiBaseFeature *)apFeature, mac, ETH_ADDR_LEN);
335094332d3Sopenharmony_ci        printf("%s: ret = %d\n", __func__, ret);
336094332d3Sopenharmony_ci        bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_ERR_DEVICE_BUSY);
337094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
338094332d3Sopenharmony_ci
339094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
340094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
341094332d3Sopenharmony_ci    }
342094332d3Sopenharmony_ci}
343094332d3Sopenharmony_ci
344094332d3Sopenharmony_ci/**
345094332d3Sopenharmony_ci * @tc.name: WifiHalSetMacAddress002
346094332d3Sopenharmony_ci * @tc.desc: Wifi hal set Mac address function test
347094332d3Sopenharmony_ci * @tc.type: FUNC
348094332d3Sopenharmony_ci * @tc.require: AR000F869E
349094332d3Sopenharmony_ci */
350094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalSetMacAddress002, TestSize.Level1)
351094332d3Sopenharmony_ci{
352094332d3Sopenharmony_ci    int ret;
353094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
354094332d3Sopenharmony_ci    unsigned char mac[ETH_ADDR_LEN] = {0x12, 0x34, 0x56, 0x78, 0xab, 0xcd};
355094332d3Sopenharmony_ci    unsigned char errorMac[ETH_ADDR_LEN] = {0x11, 0x34, 0x56, 0x78, 0xab, 0xcd};
356094332d3Sopenharmony_ci
357094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
358094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
359094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
360094332d3Sopenharmony_ci        ret = staFeature->baseFeature.setMacAddress(nullptr, mac, ETH_ADDR_LEN);
361094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
362094332d3Sopenharmony_ci        ret = staFeature->baseFeature.setMacAddress((struct IWiFiBaseFeature *)staFeature, nullptr, ETH_ADDR_LEN);
363094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
364094332d3Sopenharmony_ci        ret = staFeature->baseFeature.setMacAddress((struct IWiFiBaseFeature *)staFeature, mac, 0);
365094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
366094332d3Sopenharmony_ci        ret = staFeature->baseFeature.setMacAddress((struct IWiFiBaseFeature *)staFeature, errorMac, ETH_ADDR_LEN);
367094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
368094332d3Sopenharmony_ci        ret = staFeature->baseFeature.setMacAddress((struct IWiFiBaseFeature *)staFeature, mac, ETH_ADDR_LEN);
369094332d3Sopenharmony_ci        printf("%s: ret = %d\n", __func__, ret);
370094332d3Sopenharmony_ci        bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_ERR_DEVICE_BUSY);
371094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
372094332d3Sopenharmony_ci
373094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
374094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
375094332d3Sopenharmony_ci    }
376094332d3Sopenharmony_ci}
377094332d3Sopenharmony_ci
378094332d3Sopenharmony_ci/**
379094332d3Sopenharmony_ci * @tc.name: WifiHalSetTxPower001
380094332d3Sopenharmony_ci * @tc.desc: Wifi hal set transmit power function test
381094332d3Sopenharmony_ci * @tc.type: FUNC
382094332d3Sopenharmony_ci * @tc.require: AR000F869G
383094332d3Sopenharmony_ci */
384094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalSetTxPower001, TestSize.Level1)
385094332d3Sopenharmony_ci{
386094332d3Sopenharmony_ci    int ret;
387094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
388094332d3Sopenharmony_ci
389094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
390094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
391094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
392094332d3Sopenharmony_ci        ret = apFeature->baseFeature.setTxPower(nullptr, WLAN_TX_POWER);
393094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
394094332d3Sopenharmony_ci        ret = apFeature->baseFeature.setTxPower((struct IWiFiBaseFeature *)apFeature, 0);
395094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
396094332d3Sopenharmony_ci        ret = apFeature->baseFeature.setTxPower((struct IWiFiBaseFeature *)apFeature, WLAN_TX_POWER);
397094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
398094332d3Sopenharmony_ci
399094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
400094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
401094332d3Sopenharmony_ci    }
402094332d3Sopenharmony_ci}
403094332d3Sopenharmony_ci
404094332d3Sopenharmony_ci/**
405094332d3Sopenharmony_ci * @tc.name: ResetDriver001
406094332d3Sopenharmony_ci * @tc.desc: wifi hal reset driver function test
407094332d3Sopenharmony_ci * @tc.type: FUNC
408094332d3Sopenharmony_ci * @tc.require:
409094332d3Sopenharmony_ci */
410094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, ResetDriver001, TestSize.Level1)
411094332d3Sopenharmony_ci{
412094332d3Sopenharmony_ci    int32_t ret;
413094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
414094332d3Sopenharmony_ci    uint8_t chipId = 0;
415094332d3Sopenharmony_ci    uint8_t chipIdInvalid = 20;
416094332d3Sopenharmony_ci
417094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
418094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
419094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
420094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getChipId((struct IWiFiBaseFeature *)staFeature, &chipId);
421094332d3Sopenharmony_ci        ASSERT_TRUE(chipId < MAX_WLAN_DEVICE);
422094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
423094332d3Sopenharmony_ci
424094332d3Sopenharmony_ci        ret = g_wifi->resetDriver(chipIdInvalid, "wlan0");
425094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
426094332d3Sopenharmony_ci        ret = g_wifi->resetDriver(chipId, nullptr);
427094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
428094332d3Sopenharmony_ci        ret = g_wifi->resetDriver(chipId, staFeature->baseFeature.ifName);
429094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
430094332d3Sopenharmony_ci        sleep(RESET_TIME);
431094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
432094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
433094332d3Sopenharmony_ci    }
434094332d3Sopenharmony_ci}
435094332d3Sopenharmony_ci
436094332d3Sopenharmony_ci/**
437094332d3Sopenharmony_ci * @tc.name: ResetDriver002
438094332d3Sopenharmony_ci * @tc.desc: wifi hal reset driver function test
439094332d3Sopenharmony_ci * @tc.type: FUNC
440094332d3Sopenharmony_ci * @tc.require:
441094332d3Sopenharmony_ci */
442094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, ResetDriver002, TestSize.Level1)
443094332d3Sopenharmony_ci{
444094332d3Sopenharmony_ci    int32_t ret;
445094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
446094332d3Sopenharmony_ci    uint8_t chipId = 0;
447094332d3Sopenharmony_ci    uint8_t chipIdInvalid = 20;
448094332d3Sopenharmony_ci
449094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
450094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
451094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
452094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getChipId((struct IWiFiBaseFeature *)apFeature, &chipId);
453094332d3Sopenharmony_ci        ASSERT_TRUE(chipId < MAX_WLAN_DEVICE);
454094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
455094332d3Sopenharmony_ci
456094332d3Sopenharmony_ci        ret = g_wifi->resetDriver(chipIdInvalid, "wlan0");
457094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
458094332d3Sopenharmony_ci        ret = g_wifi->resetDriver(chipId, nullptr);
459094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
460094332d3Sopenharmony_ci        ret = g_wifi->resetDriver(chipId, apFeature->baseFeature.ifName);
461094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
462094332d3Sopenharmony_ci        sleep(RESET_TIME);
463094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
464094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
465094332d3Sopenharmony_ci    }
466094332d3Sopenharmony_ci}
467094332d3Sopenharmony_ci
468094332d3Sopenharmony_ci/**
469094332d3Sopenharmony_ci * @tc.name: WifiHalSetCountryCode001
470094332d3Sopenharmony_ci * @tc.desc: Wifi hal set country code function test
471094332d3Sopenharmony_ci * @tc.type: FUNC
472094332d3Sopenharmony_ci * @tc.require: AR000F869K
473094332d3Sopenharmony_ci */
474094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalSetCountryCode001, TestSize.Level1)
475094332d3Sopenharmony_ci{
476094332d3Sopenharmony_ci    int ret;
477094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
478094332d3Sopenharmony_ci
479094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
480094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
481094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
482094332d3Sopenharmony_ci        ret = apFeature->setCountryCode(apFeature, nullptr, 0);
483094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
484094332d3Sopenharmony_ci        ret = apFeature->setCountryCode(nullptr, "CN", 2);
485094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
486094332d3Sopenharmony_ci        ret = apFeature->setCountryCode(apFeature, "CN", 3);
487094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
488094332d3Sopenharmony_ci        ret = apFeature->setCountryCode(apFeature, "99", 2);
489094332d3Sopenharmony_ci        bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_TIMEOUT || ret == HDF_FAILURE);
490094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
491094332d3Sopenharmony_ci        ret = apFeature->setCountryCode(apFeature, "CN", 2);
492094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
493094332d3Sopenharmony_ci
494094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
495094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
496094332d3Sopenharmony_ci    }
497094332d3Sopenharmony_ci}
498094332d3Sopenharmony_ci
499094332d3Sopenharmony_ci/**
500094332d3Sopenharmony_ci * @tc.name: WifiHalGetIfNamesByChipId001
501094332d3Sopenharmony_ci * @tc.desc: Obtain all ifNames and the number of the current chip
502094332d3Sopenharmony_ci * @tc.type: FUNC
503094332d3Sopenharmony_ci * @tc.require: AR000F869G
504094332d3Sopenharmony_ci */
505094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalGetIfNamesByChipId001, TestSize.Level1)
506094332d3Sopenharmony_ci{
507094332d3Sopenharmony_ci    int ret;
508094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
509094332d3Sopenharmony_ci    char *ifNames = nullptr;
510094332d3Sopenharmony_ci    unsigned int num = 0;
511094332d3Sopenharmony_ci    unsigned char chipId = 0;
512094332d3Sopenharmony_ci    uint8_t i;
513094332d3Sopenharmony_ci
514094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
515094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
516094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
517094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getChipId((struct IWiFiBaseFeature *)staFeature, &chipId);
518094332d3Sopenharmony_ci        ASSERT_TRUE(chipId < MAX_WLAN_DEVICE);
519094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
520094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getIfNamesByChipId(chipId, nullptr, nullptr);
521094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
522094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getIfNamesByChipId(100, &ifNames, &num);
523094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
524094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getIfNamesByChipId(chipId, &ifNames, &num);
525094332d3Sopenharmony_ci        EXPECT_NE(nullptr, ifNames);
526094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
527094332d3Sopenharmony_ci        ASSERT_TRUE(num <= IFNAME_MAX_NUM && num >= IFNAME_MIN_NUM);
528094332d3Sopenharmony_ci        for (i = 0; i < num; i++) {
529094332d3Sopenharmony_ci            EXPECT_EQ(0, strncmp("wlan", ifNames + i * MAX_IF_NAME_LENGTH, SIZE));
530094332d3Sopenharmony_ci        }
531094332d3Sopenharmony_ci        free(ifNames);
532094332d3Sopenharmony_ci
533094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
534094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
535094332d3Sopenharmony_ci    }
536094332d3Sopenharmony_ci}
537094332d3Sopenharmony_ci
538094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, GetNetDevInfo001, TestSize.Level1)
539094332d3Sopenharmony_ci{
540094332d3Sopenharmony_ci    int ret;
541094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
542094332d3Sopenharmony_ci    struct NetDeviceInfoResult netDeviceInfoResult;
543094332d3Sopenharmony_ci
544094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
545094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
546094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
547094332d3Sopenharmony_ci        ret = g_wifi->getNetDevInfo(nullptr);
548094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
549094332d3Sopenharmony_ci        ret = g_wifi->getNetDevInfo(&netDeviceInfoResult);
550094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
551094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
552094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
553094332d3Sopenharmony_ci    }
554094332d3Sopenharmony_ci}
555094332d3Sopenharmony_ci
556094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, GetNetDevInfo002, TestSize.Level1)
557094332d3Sopenharmony_ci{
558094332d3Sopenharmony_ci    int ret;
559094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
560094332d3Sopenharmony_ci    struct NetDeviceInfoResult netDeviceInfoResult;
561094332d3Sopenharmony_ci
562094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
563094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
564094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
565094332d3Sopenharmony_ci        ret = g_wifi->getNetDevInfo(nullptr);
566094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
567094332d3Sopenharmony_ci        ret = g_wifi->getNetDevInfo(&netDeviceInfoResult);
568094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
569094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
570094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
571094332d3Sopenharmony_ci    }
572094332d3Sopenharmony_ci}
573094332d3Sopenharmony_ci
574094332d3Sopenharmony_ci/**
575094332d3Sopenharmony_ci * @tc.name: GetPowerModeTest_001
576094332d3Sopenharmony_ci * @tc.desc: Wifi hdi get power mode function test
577094332d3Sopenharmony_ci * @tc.type: FUNC
578094332d3Sopenharmony_ci * @tc.require: AR000H60O7
579094332d3Sopenharmony_ci */
580094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, GetPowerMode001, TestSize.Level1)
581094332d3Sopenharmony_ci{
582094332d3Sopenharmony_ci    int32_t ret;
583094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
584094332d3Sopenharmony_ci    const char *ifName = "eth0";
585094332d3Sopenharmony_ci    uint8_t mode;
586094332d3Sopenharmony_ci
587094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
588094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
589094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
590094332d3Sopenharmony_ci        printf("GetPowerMode001: ifname is %s\n", apFeature->baseFeature.ifName);
591094332d3Sopenharmony_ci        ret = g_wifi->getPowerMode(nullptr, &mode);
592094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
593094332d3Sopenharmony_ci        ret = g_wifi->getPowerMode(ifName, nullptr);
594094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
595094332d3Sopenharmony_ci        ret = g_wifi->getPowerMode(ifName, &mode);
596094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
597094332d3Sopenharmony_ci        ret = g_wifi->getPowerMode(apFeature->baseFeature.ifName, nullptr);
598094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
599094332d3Sopenharmony_ci        ret = g_wifi->getPowerMode(apFeature->baseFeature.ifName, &mode);
600094332d3Sopenharmony_ci        printf("%s: ret = %d\n", __func__, ret);
601094332d3Sopenharmony_ci        bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
602094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
603094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
604094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
605094332d3Sopenharmony_ci    }
606094332d3Sopenharmony_ci}
607094332d3Sopenharmony_ci
608094332d3Sopenharmony_ci/**
609094332d3Sopenharmony_ci * @tc.name: GetPowerModeTest_002
610094332d3Sopenharmony_ci * @tc.desc: Wifi hdi get power mode function test
611094332d3Sopenharmony_ci * @tc.type: FUNC
612094332d3Sopenharmony_ci * @tc.require: AR000H60O7
613094332d3Sopenharmony_ci */
614094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, GetPowerMode002, TestSize.Level1)
615094332d3Sopenharmony_ci{
616094332d3Sopenharmony_ci    int32_t ret;
617094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
618094332d3Sopenharmony_ci    const char *ifName = "eth0";
619094332d3Sopenharmony_ci    uint8_t mode;
620094332d3Sopenharmony_ci
621094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
622094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
623094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
624094332d3Sopenharmony_ci        printf("GetPowerMode002: ifname is %s\n", staFeature->baseFeature.ifName);
625094332d3Sopenharmony_ci        ret = g_wifi->getPowerMode(nullptr, &mode);
626094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
627094332d3Sopenharmony_ci        ret = g_wifi->getPowerMode(ifName, nullptr);
628094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
629094332d3Sopenharmony_ci        ret = g_wifi->getPowerMode(ifName, &mode);
630094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
631094332d3Sopenharmony_ci        ret = g_wifi->getPowerMode(staFeature->baseFeature.ifName, nullptr);
632094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
633094332d3Sopenharmony_ci        ret = g_wifi->getPowerMode(staFeature->baseFeature.ifName, &mode);
634094332d3Sopenharmony_ci        printf("%s: ret = %d\n", __func__, ret);
635094332d3Sopenharmony_ci        bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
636094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
637094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
638094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
639094332d3Sopenharmony_ci    }
640094332d3Sopenharmony_ci}
641094332d3Sopenharmony_ci
642094332d3Sopenharmony_ci/**
643094332d3Sopenharmony_ci * @tc.name: SetPowerMode001
644094332d3Sopenharmony_ci * @tc.desc: Wifi hdi set power mode function test
645094332d3Sopenharmony_ci * @tc.type: FUNC
646094332d3Sopenharmony_ci * @tc.require: AR000H60O7
647094332d3Sopenharmony_ci */
648094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetPowerMode001, TestSize.Level1)
649094332d3Sopenharmony_ci{
650094332d3Sopenharmony_ci    int32_t ret;
651094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
652094332d3Sopenharmony_ci    const char *ifName = "eth0";
653094332d3Sopenharmony_ci
654094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
655094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
656094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
657094332d3Sopenharmony_ci        printf("SetPowerMode001: ifname is %s\n", apFeature->baseFeature.ifName);
658094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(nullptr, WIFI_POWER_MODE_NUM);
659094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
660094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(ifName, WIFI_POWER_MODE_NUM);
661094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
662094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(apFeature->baseFeature.ifName, WIFI_POWER_MODE_NUM);
663094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
664094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
665094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
666094332d3Sopenharmony_ci    }
667094332d3Sopenharmony_ci}
668094332d3Sopenharmony_ci
669094332d3Sopenharmony_ci/**
670094332d3Sopenharmony_ci * @tc.name: SetPowerMode002
671094332d3Sopenharmony_ci * @tc.desc: Wifi hdi set power mode function test
672094332d3Sopenharmony_ci * @tc.type: FUNC
673094332d3Sopenharmony_ci * @tc.require: AR000H60O7
674094332d3Sopenharmony_ci */
675094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetPowerMode002, TestSize.Level1)
676094332d3Sopenharmony_ci{
677094332d3Sopenharmony_ci    int32_t ret;
678094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
679094332d3Sopenharmony_ci    const char *ifName = "eth0";
680094332d3Sopenharmony_ci
681094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
682094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
683094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
684094332d3Sopenharmony_ci        printf("SetPowerMode002: ifname is %s\n", apFeature->baseFeature.ifName);
685094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(nullptr, WIFI_POWER_MODE_SLEEPING);
686094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
687094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(ifName, WIFI_POWER_MODE_SLEEPING);
688094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
689094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(apFeature->baseFeature.ifName, WIFI_POWER_MODE_SLEEPING);
690094332d3Sopenharmony_ci        bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
691094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
692094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
693094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
694094332d3Sopenharmony_ci    }
695094332d3Sopenharmony_ci}
696094332d3Sopenharmony_ci
697094332d3Sopenharmony_ci/**
698094332d3Sopenharmony_ci * @tc.name: SetPowerMode003
699094332d3Sopenharmony_ci * @tc.desc: Wifi hdi set power mode function test
700094332d3Sopenharmony_ci * @tc.type: FUNC
701094332d3Sopenharmony_ci * @tc.require: AR000H60O7
702094332d3Sopenharmony_ci */
703094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetPowerMode003, TestSize.Level1)
704094332d3Sopenharmony_ci{
705094332d3Sopenharmony_ci    int32_t ret;
706094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
707094332d3Sopenharmony_ci    const char *ifName = "eth0";
708094332d3Sopenharmony_ci
709094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
710094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
711094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
712094332d3Sopenharmony_ci        printf("SetPowerMode003: ifname is %s\n", apFeature->baseFeature.ifName);
713094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(nullptr, WIFI_POWER_MODE_GENERAL);
714094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
715094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(ifName, WIFI_POWER_MODE_GENERAL);
716094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
717094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(apFeature->baseFeature.ifName, WIFI_POWER_MODE_GENERAL);
718094332d3Sopenharmony_ci        bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
719094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
720094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
721094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
722094332d3Sopenharmony_ci    }
723094332d3Sopenharmony_ci}
724094332d3Sopenharmony_ci
725094332d3Sopenharmony_ci/**
726094332d3Sopenharmony_ci * @tc.name: SetPowerMode004
727094332d3Sopenharmony_ci * @tc.desc: Wifi hdi set power mode function test
728094332d3Sopenharmony_ci * @tc.type: FUNC
729094332d3Sopenharmony_ci * @tc.require: AR000H60O7
730094332d3Sopenharmony_ci */
731094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetPowerMode004, TestSize.Level1)
732094332d3Sopenharmony_ci{
733094332d3Sopenharmony_ci    int32_t ret;
734094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
735094332d3Sopenharmony_ci    const char *ifName = "eth0";
736094332d3Sopenharmony_ci
737094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
738094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
739094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
740094332d3Sopenharmony_ci        printf("SetPowerMode004: ifname is %s\n", apFeature->baseFeature.ifName);
741094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(nullptr, WIFI_POWER_MODE_THROUGH_WALL);
742094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
743094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(ifName, WIFI_POWER_MODE_THROUGH_WALL);
744094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
745094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(apFeature->baseFeature.ifName, WIFI_POWER_MODE_THROUGH_WALL);
746094332d3Sopenharmony_ci        bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
747094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
748094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
749094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
750094332d3Sopenharmony_ci    }
751094332d3Sopenharmony_ci}
752094332d3Sopenharmony_ci
753094332d3Sopenharmony_ci/**
754094332d3Sopenharmony_ci * @tc.name: SetPowerMode005
755094332d3Sopenharmony_ci * @tc.desc: Wifi hdi set power mode function test
756094332d3Sopenharmony_ci * @tc.type: FUNC
757094332d3Sopenharmony_ci * @tc.require: AR000H60O7
758094332d3Sopenharmony_ci */
759094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetPowerMode005, TestSize.Level1)
760094332d3Sopenharmony_ci{
761094332d3Sopenharmony_ci    int32_t ret;
762094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
763094332d3Sopenharmony_ci    const char *ifName = "eth0";
764094332d3Sopenharmony_ci
765094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
766094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
767094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
768094332d3Sopenharmony_ci        printf("SetPowerMode005: ifname is %s\n", staFeature->baseFeature.ifName);
769094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(nullptr, WIFI_POWER_MODE_NUM);
770094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
771094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(ifName, WIFI_POWER_MODE_NUM);
772094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
773094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(staFeature->baseFeature.ifName, WIFI_POWER_MODE_NUM);
774094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
775094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
776094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
777094332d3Sopenharmony_ci    }
778094332d3Sopenharmony_ci}
779094332d3Sopenharmony_ci
780094332d3Sopenharmony_ci/**
781094332d3Sopenharmony_ci * @tc.name: SetPowerMode006
782094332d3Sopenharmony_ci * @tc.desc: Wifi hdi set power mode function test
783094332d3Sopenharmony_ci * @tc.type: FUNC
784094332d3Sopenharmony_ci * @tc.require: AR000H60O7
785094332d3Sopenharmony_ci */
786094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetPowerMode006, TestSize.Level1)
787094332d3Sopenharmony_ci{
788094332d3Sopenharmony_ci    int32_t ret;
789094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
790094332d3Sopenharmony_ci    const char *ifName = "eth0";
791094332d3Sopenharmony_ci
792094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
793094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
794094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
795094332d3Sopenharmony_ci        printf("SetPowerMode005: ifname is %s\n", staFeature->baseFeature.ifName);
796094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(nullptr, WIFI_POWER_MODE_SLEEPING);
797094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
798094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(ifName, WIFI_POWER_MODE_SLEEPING);
799094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
800094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(staFeature->baseFeature.ifName, WIFI_POWER_MODE_SLEEPING);
801094332d3Sopenharmony_ci        bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
802094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
803094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
804094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
805094332d3Sopenharmony_ci    }
806094332d3Sopenharmony_ci}
807094332d3Sopenharmony_ci
808094332d3Sopenharmony_ci/**
809094332d3Sopenharmony_ci * @tc.name: SetPowerMode007
810094332d3Sopenharmony_ci * @tc.desc: Wifi hdi set power mode function test
811094332d3Sopenharmony_ci * @tc.type: FUNC
812094332d3Sopenharmony_ci * @tc.require: AR000H60O7
813094332d3Sopenharmony_ci */
814094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetPowerMode007, TestSize.Level1)
815094332d3Sopenharmony_ci{
816094332d3Sopenharmony_ci    int32_t ret;
817094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
818094332d3Sopenharmony_ci    const char *ifName = "eth0";
819094332d3Sopenharmony_ci
820094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
821094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
822094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
823094332d3Sopenharmony_ci        printf("SetPowerMode005: ifname is %s\n", staFeature->baseFeature.ifName);
824094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(nullptr, WIFI_POWER_MODE_GENERAL);
825094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
826094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(ifName, WIFI_POWER_MODE_GENERAL);
827094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
828094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(staFeature->baseFeature.ifName, WIFI_POWER_MODE_GENERAL);
829094332d3Sopenharmony_ci        bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
830094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
831094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
832094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
833094332d3Sopenharmony_ci    }
834094332d3Sopenharmony_ci}
835094332d3Sopenharmony_ci
836094332d3Sopenharmony_ci/**
837094332d3Sopenharmony_ci * @tc.name: SetPowerMode008
838094332d3Sopenharmony_ci * @tc.desc: Wifi hdi set power mode function test
839094332d3Sopenharmony_ci * @tc.type: FUNC
840094332d3Sopenharmony_ci * @tc.require: AR000H60O7
841094332d3Sopenharmony_ci */
842094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetPowerMode008, TestSize.Level1)
843094332d3Sopenharmony_ci{
844094332d3Sopenharmony_ci    int32_t ret;
845094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
846094332d3Sopenharmony_ci    const char *ifName = "eth0";
847094332d3Sopenharmony_ci
848094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
849094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
850094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
851094332d3Sopenharmony_ci        printf("SetPowerMode005: ifname is %s\n", staFeature->baseFeature.ifName);
852094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(nullptr, WIFI_POWER_MODE_THROUGH_WALL);
853094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
854094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(ifName, WIFI_POWER_MODE_THROUGH_WALL);
855094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
856094332d3Sopenharmony_ci        ret = g_wifi->setPowerMode(staFeature->baseFeature.ifName, WIFI_POWER_MODE_THROUGH_WALL);
857094332d3Sopenharmony_ci        bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
858094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
859094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
860094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
861094332d3Sopenharmony_ci    }
862094332d3Sopenharmony_ci}
863094332d3Sopenharmony_ci
864094332d3Sopenharmony_ci/**
865094332d3Sopenharmony_ci * @tc.name: WifiHalStartScan001
866094332d3Sopenharmony_ci * @tc.desc: Wifi hdi Start Scan function test
867094332d3Sopenharmony_ci * @tc.type: FUNC
868094332d3Sopenharmony_ci * @tc.require: AR000H60O7
869094332d3Sopenharmony_ci */
870094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalStartScan001, TestSize.Level1)
871094332d3Sopenharmony_ci{
872094332d3Sopenharmony_ci    int ret;
873094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
874094332d3Sopenharmony_ci    const char *ifName = "wlan0";
875094332d3Sopenharmony_ci    const char *ifNameInvalid = "wlanTest";
876094332d3Sopenharmony_ci    WifiScan scan = {0};
877094332d3Sopenharmony_ci
878094332d3Sopenharmony_ci    ret = g_wifi->registerEventCallback(HalCallbackEvent, ifName);
879094332d3Sopenharmony_ci    EXPECT_EQ(HDF_SUCCESS, ret);
880094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
881094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
882094332d3Sopenharmony_ci        EXPECT_NE(staFeature, nullptr);
883094332d3Sopenharmony_ci        ret = staFeature->startScan(nullptr, &scan);
884094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
885094332d3Sopenharmony_ci        ret = staFeature->startScan(ifName, nullptr);
886094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
887094332d3Sopenharmony_ci        ret = staFeature->startScan(ifNameInvalid, &scan);
888094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
889094332d3Sopenharmony_ci        ret = staFeature->startScan(ifName, &scan);
890094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
891094332d3Sopenharmony_ci        sleep(SCAN_TIME);
892094332d3Sopenharmony_ci    }
893094332d3Sopenharmony_ci}
894094332d3Sopenharmony_ci
895094332d3Sopenharmony_ci/**
896094332d3Sopenharmony_ci * @tc.name: WifiHalCreateFeature003
897094332d3Sopenharmony_ci * @tc.desc: Wifi hal create feature function test
898094332d3Sopenharmony_ci * @tc.type: FUNC
899094332d3Sopenharmony_ci * @tc.require: AR000H603L
900094332d3Sopenharmony_ci */
901094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalCreateFeature003, TestSize.Level1)
902094332d3Sopenharmony_ci{
903094332d3Sopenharmony_ci    int32_t ret;
904094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
905094332d3Sopenharmony_ci
906094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, nullptr);
907094332d3Sopenharmony_ci    EXPECT_EQ(ret, HDF_FAILURE);
908094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, nullptr);
909094332d3Sopenharmony_ci    EXPECT_EQ(ret, HDF_FAILURE);
910094332d3Sopenharmony_ci
911094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_NUM, (struct IWiFiBaseFeature **)&staFeature);
912094332d3Sopenharmony_ci    EXPECT_NE(HDF_SUCCESS, ret);
913094332d3Sopenharmony_ci    ret = g_wifi->createFeature(-1, (struct IWiFiBaseFeature **)&staFeature);
914094332d3Sopenharmony_ci    EXPECT_NE(HDF_SUCCESS, ret);
915094332d3Sopenharmony_ci}
916094332d3Sopenharmony_ci
917094332d3Sopenharmony_ci/**
918094332d3Sopenharmony_ci * @tc.name: WifiHalGetFeatureByIfName002
919094332d3Sopenharmony_ci * @tc.desc: Wifi hal get feature by ifname function test
920094332d3Sopenharmony_ci * @tc.type: FUNC
921094332d3Sopenharmony_ci * @tc.require: AR000H603L
922094332d3Sopenharmony_ci */
923094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalGetFeatureByIfName002, TestSize.Level1)
924094332d3Sopenharmony_ci{
925094332d3Sopenharmony_ci    int32_t ret;
926094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
927094332d3Sopenharmony_ci    struct IWiFiSta *staFeatureGet = nullptr;
928094332d3Sopenharmony_ci    const char *ifName0 = "wlanTest";
929094332d3Sopenharmony_ci
930094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
931094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
932094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
933094332d3Sopenharmony_ci        ret = g_wifi->getFeatureByIfName(nullptr, (struct IWiFiBaseFeature **)&staFeature);
934094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
935094332d3Sopenharmony_ci        ret = g_wifi->getFeatureByIfName(ifName0, (struct IWiFiBaseFeature **)&staFeature);
936094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
937094332d3Sopenharmony_ci        ret = g_wifi->getFeatureByIfName(staFeature->baseFeature.ifName, (struct IWiFiBaseFeature **)&staFeatureGet);
938094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
939094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeatureGet);
940094332d3Sopenharmony_ci
941094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
942094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
943094332d3Sopenharmony_ci    }
944094332d3Sopenharmony_ci}
945094332d3Sopenharmony_ci
946094332d3Sopenharmony_ci/**
947094332d3Sopenharmony_ci * @tc.name: WifiHalRegisterEventCallback002
948094332d3Sopenharmony_ci * @tc.desc: Wifi hal register event callback test
949094332d3Sopenharmony_ci * @tc.type: FUNC
950094332d3Sopenharmony_ci * @tc.require: AR000H603L
951094332d3Sopenharmony_ci */
952094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalRegisterEventCallback002, TestSize.Level1)
953094332d3Sopenharmony_ci{
954094332d3Sopenharmony_ci    int32_t ret;
955094332d3Sopenharmony_ci
956094332d3Sopenharmony_ci    ret = g_wifi->registerEventCallback(nullptr, "wlan0");
957094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
958094332d3Sopenharmony_ci    ret = g_wifi->registerEventCallback(HalCallbackEvent, nullptr);
959094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
960094332d3Sopenharmony_ci}
961094332d3Sopenharmony_ci
962094332d3Sopenharmony_ci/**
963094332d3Sopenharmony_ci * @tc.name: WifiHalUnRegisterEventCallback002
964094332d3Sopenharmony_ci * @tc.desc: Wifi hal unregister event callback test
965094332d3Sopenharmony_ci * @tc.type: FUNC
966094332d3Sopenharmony_ci * @tc.require: AR000H603L
967094332d3Sopenharmony_ci */
968094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalUnRegisterEventCallback002, TestSize.Level1)
969094332d3Sopenharmony_ci{
970094332d3Sopenharmony_ci    int32_t ret;
971094332d3Sopenharmony_ci
972094332d3Sopenharmony_ci    ret = g_wifi->unregisterEventCallback(nullptr, "wlan0");
973094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
974094332d3Sopenharmony_ci    ret = g_wifi->unregisterEventCallback(HalCallbackEvent, nullptr);
975094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
976094332d3Sopenharmony_ci}
977094332d3Sopenharmony_ci
978094332d3Sopenharmony_ci/**
979094332d3Sopenharmony_ci * @tc.name: GetSupportFeature001
980094332d3Sopenharmony_ci * @tc.desc: Wifi hal get supported feature test
981094332d3Sopenharmony_ci * @tc.type: FUNC
982094332d3Sopenharmony_ci * @tc.require: AR000H603L
983094332d3Sopenharmony_ci */
984094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, GetSupportFeature001, TestSize.Level1)
985094332d3Sopenharmony_ci{
986094332d3Sopenharmony_ci    int32_t ret;
987094332d3Sopenharmony_ci    uint8_t supType[PROTOCOL_80211_IFTYPE_NUM + 1] = {0};
988094332d3Sopenharmony_ci
989094332d3Sopenharmony_ci    ret = g_wifi->getSupportFeature(nullptr, PROTOCOL_80211_IFTYPE_NUM + 1);
990094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
991094332d3Sopenharmony_ci    ret = g_wifi->getSupportFeature(supType, PROTOCOL_80211_IFTYPE_NUM);
992094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
993094332d3Sopenharmony_ci
994094332d3Sopenharmony_ci    ret = g_wifi->getSupportFeature(supType, PROTOCOL_80211_IFTYPE_NUM + 1);
995094332d3Sopenharmony_ci    EXPECT_EQ(RET_CODE_SUCCESS, ret);
996094332d3Sopenharmony_ci}
997094332d3Sopenharmony_ci
998094332d3Sopenharmony_ci/**
999094332d3Sopenharmony_ci * @tc.name: WifiHalGetNetworkIfaceName002
1000094332d3Sopenharmony_ci * @tc.desc: Wifi hal get network iface name function test
1001094332d3Sopenharmony_ci * @tc.type: FUNC
1002094332d3Sopenharmony_ci * @tc.require: AR000H603L
1003094332d3Sopenharmony_ci */
1004094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalGetNetworkIfaceName002, TestSize.Level1)
1005094332d3Sopenharmony_ci{
1006094332d3Sopenharmony_ci    int32_t ret;
1007094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1008094332d3Sopenharmony_ci
1009094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1010094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1011094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
1012094332d3Sopenharmony_ci        const char *ifnameTest = staFeature->baseFeature.getNetworkIfaceName(nullptr);
1013094332d3Sopenharmony_ci        EXPECT_EQ(nullptr, ifnameTest);
1014094332d3Sopenharmony_ci        const char *ifName = staFeature->baseFeature.getNetworkIfaceName((const struct IWiFiBaseFeature *)staFeature);
1015094332d3Sopenharmony_ci        EXPECT_NE(nullptr, ifName);
1016094332d3Sopenharmony_ci        if (strncmp(ifName, "wlan", 4) == 0 || strncmp(ifName, "nan", 3) == 0 || strncmp(ifName, "p2p", 3) == 0) {
1017094332d3Sopenharmony_ci            ret = 0;
1018094332d3Sopenharmony_ci        } else {
1019094332d3Sopenharmony_ci            ret = -1;
1020094332d3Sopenharmony_ci        }
1021094332d3Sopenharmony_ci        EXPECT_EQ(0, ret);
1022094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1023094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1024094332d3Sopenharmony_ci    }
1025094332d3Sopenharmony_ci}
1026094332d3Sopenharmony_ci
1027094332d3Sopenharmony_ci/**
1028094332d3Sopenharmony_ci * @tc.name: WifiHalGetGetFeatureType002
1029094332d3Sopenharmony_ci * @tc.desc: Wifi hal get feature type function test
1030094332d3Sopenharmony_ci * @tc.type: FUNC
1031094332d3Sopenharmony_ci * @tc.require: AR000H603L
1032094332d3Sopenharmony_ci */
1033094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalGetGetFeatureType002, TestSize.Level1)
1034094332d3Sopenharmony_ci{
1035094332d3Sopenharmony_ci    int32_t ret;
1036094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1037094332d3Sopenharmony_ci    int32_t type;
1038094332d3Sopenharmony_ci
1039094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1040094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1041094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
1042094332d3Sopenharmony_ci        type = staFeature->baseFeature.getFeatureType(nullptr);
1043094332d3Sopenharmony_ci        EXPECT_EQ(HDF_FAILURE, type);
1044094332d3Sopenharmony_ci        type = staFeature->baseFeature.getFeatureType((struct IWiFiBaseFeature *)staFeature);
1045094332d3Sopenharmony_ci        EXPECT_EQ(PROTOCOL_80211_IFTYPE_STATION, type);
1046094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1047094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1048094332d3Sopenharmony_ci    }
1049094332d3Sopenharmony_ci}
1050094332d3Sopenharmony_ci
1051094332d3Sopenharmony_ci/**
1052094332d3Sopenharmony_ci * @tc.name: GetDeviceMacAddress001
1053094332d3Sopenharmony_ci * @tc.desc: Wifi hal get device's MAC address test
1054094332d3Sopenharmony_ci * @tc.type: FUNC
1055094332d3Sopenharmony_ci * @tc.require: AR000H603L
1056094332d3Sopenharmony_ci */
1057094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, GetDeviceMacAddress001, TestSize.Level1)
1058094332d3Sopenharmony_ci{
1059094332d3Sopenharmony_ci    int32_t ret;
1060094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1061094332d3Sopenharmony_ci
1062094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1063094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1064094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
1065094332d3Sopenharmony_ci        unsigned char readMac[ETH_ADDR_LEN] = {0};
1066094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getDeviceMacAddress(nullptr, readMac, ETH_ADDR_LEN);
1067094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1068094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getDeviceMacAddress((struct IWiFiBaseFeature *)apFeature, nullptr, 0);
1069094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1070094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getDeviceMacAddress((struct IWiFiBaseFeature *)apFeature, readMac, 0);
1071094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1072094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getDeviceMacAddress((struct IWiFiBaseFeature *)apFeature, readMac, ETH_ADDR_LEN);
1073094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1074094332d3Sopenharmony_ci
1075094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1076094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1077094332d3Sopenharmony_ci    }
1078094332d3Sopenharmony_ci}
1079094332d3Sopenharmony_ci
1080094332d3Sopenharmony_ci/**
1081094332d3Sopenharmony_ci * @tc.name: GetDeviceMacAddress002
1082094332d3Sopenharmony_ci * @tc.desc: Wifi hal get device's MAC address test
1083094332d3Sopenharmony_ci * @tc.type: FUNC
1084094332d3Sopenharmony_ci * @tc.require: AR000H603L
1085094332d3Sopenharmony_ci */
1086094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, GetDeviceMacAddress002, TestSize.Level1)
1087094332d3Sopenharmony_ci{
1088094332d3Sopenharmony_ci    int32_t ret;
1089094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1090094332d3Sopenharmony_ci
1091094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1092094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1093094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
1094094332d3Sopenharmony_ci        unsigned char readMac[ETH_ADDR_LEN] = {0};
1095094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getDeviceMacAddress(nullptr, readMac, ETH_ADDR_LEN);
1096094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1097094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getDeviceMacAddress((struct IWiFiBaseFeature *)staFeature, nullptr, 0);
1098094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1099094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getDeviceMacAddress((struct IWiFiBaseFeature *)staFeature, readMac, 0);
1100094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1101094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getDeviceMacAddress((struct IWiFiBaseFeature *)staFeature, readMac, ETH_ADDR_LEN);
1102094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1103094332d3Sopenharmony_ci
1104094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1105094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1106094332d3Sopenharmony_ci    }
1107094332d3Sopenharmony_ci}
1108094332d3Sopenharmony_ci
1109094332d3Sopenharmony_ci/**
1110094332d3Sopenharmony_ci * @tc.name: GetValidFreqsWithBand001
1111094332d3Sopenharmony_ci * @tc.desc: Wifi hal get valid frequency with specific band test
1112094332d3Sopenharmony_ci * @tc.type: FUNC
1113094332d3Sopenharmony_ci * @tc.require: AR000H603L
1114094332d3Sopenharmony_ci */
1115094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, GetValidFreqsWithBand001, TestSize.Level1)
1116094332d3Sopenharmony_ci{
1117094332d3Sopenharmony_ci    int32_t ret;
1118094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1119094332d3Sopenharmony_ci    int32_t band = IEEE80211_BAND_2GHZ;
1120094332d3Sopenharmony_ci    int32_t bandNotSupport = IEEE80211_NUM_BANDS;
1121094332d3Sopenharmony_ci    int32_t freqs[MAX_CHANNEL_NUM] = {0};
1122094332d3Sopenharmony_ci    uint32_t size = MAX_CHANNEL_NUM;
1123094332d3Sopenharmony_ci    uint32_t num = 0;
1124094332d3Sopenharmony_ci
1125094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1126094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1127094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
1128094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getValidFreqsWithBand(nullptr, band, freqs, size, &num);
1129094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1130094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getValidFreqsWithBand((struct IWiFiBaseFeature *)staFeature,
1131094332d3Sopenharmony_ci                                                            band, nullptr, size, &num);
1132094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1133094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getValidFreqsWithBand((struct IWiFiBaseFeature *)staFeature,
1134094332d3Sopenharmony_ci                                                            band, freqs, 10, &num);
1135094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1136094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getValidFreqsWithBand((struct IWiFiBaseFeature *)staFeature,
1137094332d3Sopenharmony_ci                                                            band, freqs, size, nullptr);
1138094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1139094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getValidFreqsWithBand((struct IWiFiBaseFeature *)staFeature,
1140094332d3Sopenharmony_ci                                                            bandNotSupport, freqs, size, &num);
1141094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1142094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getValidFreqsWithBand((struct IWiFiBaseFeature *)staFeature,
1143094332d3Sopenharmony_ci                                                            band, freqs, size, &num);
1144094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1145094332d3Sopenharmony_ci
1146094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1147094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1148094332d3Sopenharmony_ci    }
1149094332d3Sopenharmony_ci}
1150094332d3Sopenharmony_ci
1151094332d3Sopenharmony_ci/**
1152094332d3Sopenharmony_ci * @tc.name: GetValidFreqsWithBand002
1153094332d3Sopenharmony_ci * @tc.desc: Wifi hal get valid frequency with specific band test
1154094332d3Sopenharmony_ci * @tc.type: FUNC
1155094332d3Sopenharmony_ci * @tc.require: AR000H603L
1156094332d3Sopenharmony_ci */
1157094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, GetValidFreqsWithBand002, TestSize.Level1)
1158094332d3Sopenharmony_ci{
1159094332d3Sopenharmony_ci    int32_t ret;
1160094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1161094332d3Sopenharmony_ci    int32_t band = IEEE80211_BAND_2GHZ;
1162094332d3Sopenharmony_ci    int32_t bandNotSupport = IEEE80211_NUM_BANDS;
1163094332d3Sopenharmony_ci    int32_t freqs[MAX_CHANNEL_NUM] = {0};
1164094332d3Sopenharmony_ci    uint32_t size = MAX_CHANNEL_NUM;
1165094332d3Sopenharmony_ci    uint32_t num = 0;
1166094332d3Sopenharmony_ci
1167094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1168094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1169094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
1170094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getValidFreqsWithBand(nullptr, band, freqs, size, &num);
1171094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1172094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getValidFreqsWithBand((struct IWiFiBaseFeature *)apFeature,
1173094332d3Sopenharmony_ci                                                           band, nullptr, size, &num);
1174094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1175094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getValidFreqsWithBand((struct IWiFiBaseFeature *)apFeature, band, freqs, 10, &num);
1176094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1177094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getValidFreqsWithBand((struct IWiFiBaseFeature *)apFeature,
1178094332d3Sopenharmony_ci                                                           band, freqs, size, nullptr);
1179094332d3Sopenharmony_ci        EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
1180094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getValidFreqsWithBand((struct IWiFiBaseFeature *)apFeature,
1181094332d3Sopenharmony_ci                                                           bandNotSupport, freqs, size, &num);
1182094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1183094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getValidFreqsWithBand((struct IWiFiBaseFeature *)apFeature,
1184094332d3Sopenharmony_ci                                                           band, freqs, size, &num);
1185094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1186094332d3Sopenharmony_ci
1187094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1188094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1189094332d3Sopenharmony_ci    }
1190094332d3Sopenharmony_ci}
1191094332d3Sopenharmony_ci
1192094332d3Sopenharmony_ci/**
1193094332d3Sopenharmony_ci * @tc.name: WifiHalSetTxPower002
1194094332d3Sopenharmony_ci * @tc.desc: Wifi hal set transmit power function test
1195094332d3Sopenharmony_ci * @tc.type: FUNC
1196094332d3Sopenharmony_ci * @tc.require: AR000H603L
1197094332d3Sopenharmony_ci */
1198094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalSetTxPower002, TestSize.Level1)
1199094332d3Sopenharmony_ci{
1200094332d3Sopenharmony_ci    int32_t ret;
1201094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1202094332d3Sopenharmony_ci
1203094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1204094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1205094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
1206094332d3Sopenharmony_ci        ret = staFeature->baseFeature.setTxPower(nullptr, WLAN_TX_POWER);
1207094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1208094332d3Sopenharmony_ci        ret = staFeature->baseFeature.setTxPower((struct IWiFiBaseFeature *)staFeature, -1);
1209094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1210094332d3Sopenharmony_ci        ret = staFeature->baseFeature.setTxPower((struct IWiFiBaseFeature *)staFeature, WLAN_TX_POWER);
1211094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1212094332d3Sopenharmony_ci
1213094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1214094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1215094332d3Sopenharmony_ci    }
1216094332d3Sopenharmony_ci}
1217094332d3Sopenharmony_ci
1218094332d3Sopenharmony_ci/**
1219094332d3Sopenharmony_ci * @tc.name: WifiHalGetIfNamesByChipId002
1220094332d3Sopenharmony_ci * @tc.desc: Obtain all ifNames and the number of the current chip
1221094332d3Sopenharmony_ci * @tc.type: FUNC
1222094332d3Sopenharmony_ci * @tc.require: AR000H603L
1223094332d3Sopenharmony_ci */
1224094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalGetIfNamesByChipId002, TestSize.Level1)
1225094332d3Sopenharmony_ci{
1226094332d3Sopenharmony_ci    int32_t ret;
1227094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1228094332d3Sopenharmony_ci    char *ifNames = nullptr;
1229094332d3Sopenharmony_ci    unsigned int num = 0;
1230094332d3Sopenharmony_ci    unsigned char chipId = 0;
1231094332d3Sopenharmony_ci    uint8_t i;
1232094332d3Sopenharmony_ci
1233094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1234094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1235094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
1236094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getChipId((struct IWiFiBaseFeature *)apFeature, &chipId);
1237094332d3Sopenharmony_ci        ASSERT_TRUE(chipId < MAX_WLAN_DEVICE);
1238094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1239094332d3Sopenharmony_ci
1240094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getIfNamesByChipId(chipId, nullptr, nullptr);
1241094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1242094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getIfNamesByChipId(100, &ifNames, &num);
1243094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1244094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getIfNamesByChipId(chipId, &ifNames, &num);
1245094332d3Sopenharmony_ci        EXPECT_NE(nullptr, ifNames);
1246094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1247094332d3Sopenharmony_ci        bool flag = (num <= IFNAME_MAX_NUM && num >= IFNAME_MIN_NUM);
1248094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1249094332d3Sopenharmony_ci        for (i = 0; i < num; i++) {
1250094332d3Sopenharmony_ci            EXPECT_EQ(0, strncmp("wlan", ifNames + i * MAX_IF_NAME_LENGTH, SIZE));
1251094332d3Sopenharmony_ci        }
1252094332d3Sopenharmony_ci        free(ifNames);
1253094332d3Sopenharmony_ci
1254094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1255094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1256094332d3Sopenharmony_ci    }
1257094332d3Sopenharmony_ci}
1258094332d3Sopenharmony_ci
1259094332d3Sopenharmony_ci/**
1260094332d3Sopenharmony_ci * @tc.name: HalGetChipId001
1261094332d3Sopenharmony_ci * @tc.desc: wifi hal get chip ID function test
1262094332d3Sopenharmony_ci * @tc.type: FUNC
1263094332d3Sopenharmony_ci * @tc.require: AR000H603L
1264094332d3Sopenharmony_ci */
1265094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, HalGetChipId001, TestSize.Level1)
1266094332d3Sopenharmony_ci{
1267094332d3Sopenharmony_ci    int32_t ret;
1268094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1269094332d3Sopenharmony_ci    unsigned char chipId = 0;
1270094332d3Sopenharmony_ci
1271094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1272094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1273094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
1274094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getChipId(nullptr, &chipId);
1275094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1276094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getChipId((struct IWiFiBaseFeature *)staFeature, nullptr);
1277094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1278094332d3Sopenharmony_ci        ret = staFeature->baseFeature.getChipId((struct IWiFiBaseFeature *)staFeature, &chipId);
1279094332d3Sopenharmony_ci        ASSERT_TRUE(chipId < MAX_WLAN_DEVICE);
1280094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1281094332d3Sopenharmony_ci
1282094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1283094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1284094332d3Sopenharmony_ci    }
1285094332d3Sopenharmony_ci}
1286094332d3Sopenharmony_ci
1287094332d3Sopenharmony_ci/**
1288094332d3Sopenharmony_ci * @tc.name: HalGetChipId002
1289094332d3Sopenharmony_ci * @tc.desc: wifi hal get chip ID function test
1290094332d3Sopenharmony_ci * @tc.type: FUNC
1291094332d3Sopenharmony_ci * @tc.require: AR000H603L
1292094332d3Sopenharmony_ci */
1293094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, HalGetChipId002, TestSize.Level1)
1294094332d3Sopenharmony_ci{
1295094332d3Sopenharmony_ci    int32_t ret;
1296094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1297094332d3Sopenharmony_ci    unsigned char chipId = 0;
1298094332d3Sopenharmony_ci
1299094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1300094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1301094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
1302094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getChipId(nullptr, &chipId);
1303094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1304094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getChipId((struct IWiFiBaseFeature *)apFeature, nullptr);
1305094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1306094332d3Sopenharmony_ci        ret = apFeature->baseFeature.getChipId((struct IWiFiBaseFeature *)apFeature, &chipId);
1307094332d3Sopenharmony_ci        ASSERT_TRUE(chipId < MAX_WLAN_DEVICE);
1308094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1309094332d3Sopenharmony_ci
1310094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1311094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1312094332d3Sopenharmony_ci    }
1313094332d3Sopenharmony_ci}
1314094332d3Sopenharmony_ci
1315094332d3Sopenharmony_ci/**
1316094332d3Sopenharmony_ci * @tc.name: GetAssociatedStas001
1317094332d3Sopenharmony_ci * @tc.desc: wifi hal get association state function test
1318094332d3Sopenharmony_ci * @tc.type: FUNC
1319094332d3Sopenharmony_ci * @tc.require: AR000H603L
1320094332d3Sopenharmony_ci */
1321094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, GetAssociatedStas001, TestSize.Level1)
1322094332d3Sopenharmony_ci{
1323094332d3Sopenharmony_ci    int32_t ret;
1324094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1325094332d3Sopenharmony_ci    struct StaInfo staInfo[MAX_ASSOC_STA_NUM];
1326094332d3Sopenharmony_ci    (void)memset_s(staInfo, sizeof(StaInfo) * MAX_ASSOC_STA_NUM, 0, sizeof(StaInfo) * MAX_ASSOC_STA_NUM);
1327094332d3Sopenharmony_ci    uint32_t num = 0;
1328094332d3Sopenharmony_ci
1329094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1330094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1331094332d3Sopenharmony_ci        EXPECT_NE(nullptr, apFeature);
1332094332d3Sopenharmony_ci        ret = apFeature->getAssociatedStas(nullptr, staInfo, MAX_ASSOC_STA_NUM, &num);
1333094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1334094332d3Sopenharmony_ci        ret = apFeature->getAssociatedStas(apFeature, nullptr, MAX_ASSOC_STA_NUM, &num);
1335094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1336094332d3Sopenharmony_ci        ret = apFeature->getAssociatedStas(apFeature, staInfo, 0, &num);
1337094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1338094332d3Sopenharmony_ci        ret = apFeature->getAssociatedStas(apFeature, staInfo, MAX_ASSOC_STA_NUM, nullptr);
1339094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1340094332d3Sopenharmony_ci        ret = apFeature->getAssociatedStas(apFeature, staInfo, MAX_ASSOC_STA_NUM, &num);
1341094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1342094332d3Sopenharmony_ci
1343094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1344094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1345094332d3Sopenharmony_ci    }
1346094332d3Sopenharmony_ci}
1347094332d3Sopenharmony_ci
1348094332d3Sopenharmony_ci/**
1349094332d3Sopenharmony_ci * @tc.name: SetScanningMacAddress001
1350094332d3Sopenharmony_ci * @tc.desc: wifi hal set scanning MAC address function test
1351094332d3Sopenharmony_ci * @tc.type: FUNC
1352094332d3Sopenharmony_ci * @tc.require: AR000H603L
1353094332d3Sopenharmony_ci */
1354094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetScanningMacAddress001, TestSize.Level1)
1355094332d3Sopenharmony_ci{
1356094332d3Sopenharmony_ci    int32_t ret;
1357094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1358094332d3Sopenharmony_ci    unsigned char scanMac[WIFI_MAC_ADDR_LENGTH] = {0x12, 0x34, 0x56, 0x78, 0xab, 0xcd};
1359094332d3Sopenharmony_ci
1360094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1361094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1362094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
1363094332d3Sopenharmony_ci        ret = staFeature->setScanningMacAddress(nullptr, scanMac, WIFI_MAC_ADDR_LENGTH);
1364094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1365094332d3Sopenharmony_ci        ret = staFeature->setScanningMacAddress(staFeature, nullptr, WIFI_MAC_ADDR_LENGTH);
1366094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1367094332d3Sopenharmony_ci        ret = staFeature->setScanningMacAddress(staFeature, scanMac, 0);
1368094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
1369094332d3Sopenharmony_ci        ret = staFeature->setScanningMacAddress(staFeature, scanMac, WIFI_MAC_ADDR_LENGTH);
1370094332d3Sopenharmony_ci        bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
1371094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1372094332d3Sopenharmony_ci
1373094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1374094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
1375094332d3Sopenharmony_ci    }
1376094332d3Sopenharmony_ci}
1377094332d3Sopenharmony_ci
1378094332d3Sopenharmony_ci/**
1379094332d3Sopenharmony_ci * @tc.name: SetProjectionScreenParam001
1380094332d3Sopenharmony_ci * @tc.desc: wifi hal config projection screen function test
1381094332d3Sopenharmony_ci * @tc.type: FUNC
1382094332d3Sopenharmony_ci * @tc.require: AR000HDUEE
1383094332d3Sopenharmony_ci */
1384094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetProjectionScreenParam001, TestSize.Level1)
1385094332d3Sopenharmony_ci{
1386094332d3Sopenharmony_ci    int32_t ret;
1387094332d3Sopenharmony_ci    bool flag;
1388094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1389094332d3Sopenharmony_ci    ProjectionScreenParam *param;
1390094332d3Sopenharmony_ci
1391094332d3Sopenharmony_ci    param = (ProjectionScreenParam *)OsalMemCalloc(sizeof(ProjectionScreenParam) + TEST_PARAM_BUF_SIZE);
1392094332d3Sopenharmony_ci    EXPECT_NE(nullptr, param);
1393094332d3Sopenharmony_ci    param->cmdId = TEST_CMD;
1394094332d3Sopenharmony_ci    param->bufLen = 1;
1395094332d3Sopenharmony_ci    param->buf[0] = 0;
1396094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1397094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1398094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(nullptr, nullptr);
1399094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1400094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(apFeature->baseFeature.ifName, nullptr);
1401094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1402094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(nullptr, param);
1403094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1404094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(apFeature->baseFeature.ifName, param);
1405094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1406094332d3Sopenharmony_ci
1407094332d3Sopenharmony_ci        param->cmdId = CMD_CLOSE_GO_CAC;
1408094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(apFeature->baseFeature.ifName, param);
1409094332d3Sopenharmony_ci        printf("SetProjectionScreenParam_%d: ret = %d\n", __LINE__, ret);
1410094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
1411094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1412094332d3Sopenharmony_ci
1413094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1414094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1415094332d3Sopenharmony_ci    }
1416094332d3Sopenharmony_ci    OsalMemFree(param);
1417094332d3Sopenharmony_ci}
1418094332d3Sopenharmony_ci
1419094332d3Sopenharmony_ci/**
1420094332d3Sopenharmony_ci * @tc.name: SetProjectionScreenParam002
1421094332d3Sopenharmony_ci * @tc.desc: wifi hal config projection screen function test
1422094332d3Sopenharmony_ci * @tc.type: FUNC
1423094332d3Sopenharmony_ci * @tc.require:
1424094332d3Sopenharmony_ci */
1425094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetProjectionScreenParam002, TestSize.Level1)
1426094332d3Sopenharmony_ci{
1427094332d3Sopenharmony_ci    int32_t ret;
1428094332d3Sopenharmony_ci    bool flag;
1429094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1430094332d3Sopenharmony_ci    ProjectionScreenParam *param;
1431094332d3Sopenharmony_ci
1432094332d3Sopenharmony_ci    param = (ProjectionScreenParam *)OsalMemCalloc(sizeof(ProjectionScreenParam) + TEST_PARAM_BUF_SIZE);
1433094332d3Sopenharmony_ci    EXPECT_NE(nullptr, param);
1434094332d3Sopenharmony_ci    param->bufLen = 1;
1435094332d3Sopenharmony_ci    param->buf[0] = 0;
1436094332d3Sopenharmony_ci    param->cmdId = CMD_SET_GO_CSA_CHANNEL;
1437094332d3Sopenharmony_ci
1438094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1439094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1440094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(apFeature->baseFeature.ifName, param);
1441094332d3Sopenharmony_ci        printf("SetProjectionScreenParam_%d: ret = %d\n", __LINE__, ret);
1442094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_DEV_ERR_NETDOWN);
1443094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1444094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1445094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1446094332d3Sopenharmony_ci    }
1447094332d3Sopenharmony_ci    OsalMemFree(param);
1448094332d3Sopenharmony_ci}
1449094332d3Sopenharmony_ci
1450094332d3Sopenharmony_ci/**
1451094332d3Sopenharmony_ci * @tc.name: SetProjectionScreenParam003
1452094332d3Sopenharmony_ci * @tc.desc: wifi hal config projection screen function test
1453094332d3Sopenharmony_ci * @tc.type: FUNC
1454094332d3Sopenharmony_ci * @tc.require:
1455094332d3Sopenharmony_ci */
1456094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetProjectionScreenParam003, TestSize.Level1)
1457094332d3Sopenharmony_ci{
1458094332d3Sopenharmony_ci    int32_t ret;
1459094332d3Sopenharmony_ci    bool flag;
1460094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1461094332d3Sopenharmony_ci    ProjectionScreenParam *param;
1462094332d3Sopenharmony_ci
1463094332d3Sopenharmony_ci    param = (ProjectionScreenParam *)OsalMemCalloc(sizeof(ProjectionScreenParam) + TEST_PARAM_BUF_SIZE);
1464094332d3Sopenharmony_ci    EXPECT_NE(nullptr, param);
1465094332d3Sopenharmony_ci    param->bufLen = 1;
1466094332d3Sopenharmony_ci    param->buf[0] = 0;
1467094332d3Sopenharmony_ci    param->cmdId = CMD_SET_GO_RADAR_DETECT;
1468094332d3Sopenharmony_ci
1469094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1470094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1471094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(apFeature->baseFeature.ifName, param);
1472094332d3Sopenharmony_ci        printf("SetProjectionScreenParam_%d: ret = %d\n", __LINE__, ret);
1473094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_DEV_ERR_NETDOWN);
1474094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1475094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1476094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1477094332d3Sopenharmony_ci    }
1478094332d3Sopenharmony_ci    OsalMemFree(param);
1479094332d3Sopenharmony_ci}
1480094332d3Sopenharmony_ci
1481094332d3Sopenharmony_ci/**
1482094332d3Sopenharmony_ci * @tc.name: SetProjectionScreenParam004
1483094332d3Sopenharmony_ci * @tc.desc: wifi hal config projection screen function test
1484094332d3Sopenharmony_ci * @tc.type: FUNC
1485094332d3Sopenharmony_ci * @tc.require:
1486094332d3Sopenharmony_ci */
1487094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetProjectionScreenParam004, TestSize.Level1)
1488094332d3Sopenharmony_ci{
1489094332d3Sopenharmony_ci    int32_t ret;
1490094332d3Sopenharmony_ci    bool flag;
1491094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1492094332d3Sopenharmony_ci    ProjectionScreenParam *param;
1493094332d3Sopenharmony_ci
1494094332d3Sopenharmony_ci    param = (ProjectionScreenParam *)OsalMemCalloc(sizeof(ProjectionScreenParam) + TEST_PARAM_BUF_SIZE);
1495094332d3Sopenharmony_ci    EXPECT_NE(nullptr, param);
1496094332d3Sopenharmony_ci    param->bufLen = 1;
1497094332d3Sopenharmony_ci    param->buf[0] = 0;
1498094332d3Sopenharmony_ci    param->cmdId = CMD_ID_MCC_STA_P2P_QUOTA_TIME;
1499094332d3Sopenharmony_ci
1500094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1501094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1502094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(apFeature->baseFeature.ifName, param);
1503094332d3Sopenharmony_ci        printf("SetProjectionScreenParam_%d: ret = %d\n", __LINE__, ret);
1504094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_DEV_ERR_NETDOWN);
1505094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1506094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1507094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1508094332d3Sopenharmony_ci    }
1509094332d3Sopenharmony_ci    OsalMemFree(param);
1510094332d3Sopenharmony_ci}
1511094332d3Sopenharmony_ci
1512094332d3Sopenharmony_ci/**
1513094332d3Sopenharmony_ci * @tc.name: SetProjectionScreenParam005
1514094332d3Sopenharmony_ci * @tc.desc: wifi hal config projection screen function test
1515094332d3Sopenharmony_ci * @tc.type: FUNC
1516094332d3Sopenharmony_ci * @tc.require:
1517094332d3Sopenharmony_ci */
1518094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetProjectionScreenParam005, TestSize.Level1)
1519094332d3Sopenharmony_ci{
1520094332d3Sopenharmony_ci    int32_t ret;
1521094332d3Sopenharmony_ci    bool flag;
1522094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1523094332d3Sopenharmony_ci    ProjectionScreenParam *param;
1524094332d3Sopenharmony_ci
1525094332d3Sopenharmony_ci    param = (ProjectionScreenParam *)OsalMemCalloc(sizeof(ProjectionScreenParam) + TEST_PARAM_BUF_SIZE);
1526094332d3Sopenharmony_ci    EXPECT_NE(nullptr, param);
1527094332d3Sopenharmony_ci    param->bufLen = 1;
1528094332d3Sopenharmony_ci    param->buf[0] = 0;
1529094332d3Sopenharmony_ci    param->cmdId = CMD_ID_CTRL_ROAM_CHANNEL;
1530094332d3Sopenharmony_ci
1531094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1532094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1533094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(apFeature->baseFeature.ifName, param);
1534094332d3Sopenharmony_ci        printf("SetProjectionScreenParam_%d: ret = %d\n", __LINE__, ret);
1535094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_DEV_ERR_NETDOWN);
1536094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1537094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1538094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1539094332d3Sopenharmony_ci    }
1540094332d3Sopenharmony_ci    OsalMemFree(param);
1541094332d3Sopenharmony_ci}
1542094332d3Sopenharmony_ci
1543094332d3Sopenharmony_ci/**
1544094332d3Sopenharmony_ci * @tc.name: SetProjectionScreenParam006
1545094332d3Sopenharmony_ci * @tc.desc: wifi hal config projection screen function test
1546094332d3Sopenharmony_ci * @tc.type: FUNC
1547094332d3Sopenharmony_ci * @tc.require:
1548094332d3Sopenharmony_ci */
1549094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetProjectionScreenParam006, TestSize.Level1)
1550094332d3Sopenharmony_ci{
1551094332d3Sopenharmony_ci    int32_t ret;
1552094332d3Sopenharmony_ci    bool flag;
1553094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1554094332d3Sopenharmony_ci    ProjectionScreenParam *param;
1555094332d3Sopenharmony_ci
1556094332d3Sopenharmony_ci    param = (ProjectionScreenParam *)OsalMemCalloc(sizeof(ProjectionScreenParam) + TEST_PARAM_BUF_SIZE);
1557094332d3Sopenharmony_ci    EXPECT_NE(nullptr, param);
1558094332d3Sopenharmony_ci    param->cmdId = TEST_CMD;
1559094332d3Sopenharmony_ci    param->bufLen = 1;
1560094332d3Sopenharmony_ci    param->buf[0] = 0;
1561094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1562094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1563094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(nullptr, nullptr);
1564094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1565094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(staFeature->baseFeature.ifName, nullptr);
1566094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1567094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(nullptr, param);
1568094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1569094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(staFeature->baseFeature.ifName, param);
1570094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1571094332d3Sopenharmony_ci
1572094332d3Sopenharmony_ci        param->cmdId = CMD_CLOSE_GO_CAC;
1573094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(staFeature->baseFeature.ifName, param);
1574094332d3Sopenharmony_ci        printf("SetProjectionScreenParam_%d: ret = %d\n", __LINE__, ret);
1575094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
1576094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1577094332d3Sopenharmony_ci
1578094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1579094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1580094332d3Sopenharmony_ci    }
1581094332d3Sopenharmony_ci    OsalMemFree(param);
1582094332d3Sopenharmony_ci}
1583094332d3Sopenharmony_ci
1584094332d3Sopenharmony_ci/**
1585094332d3Sopenharmony_ci * @tc.name: SetProjectionScreenParam007
1586094332d3Sopenharmony_ci * @tc.desc: wifi hal config projection screen function test
1587094332d3Sopenharmony_ci * @tc.type: FUNC
1588094332d3Sopenharmony_ci * @tc.require:
1589094332d3Sopenharmony_ci */
1590094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetProjectionScreenParam007, TestSize.Level1)
1591094332d3Sopenharmony_ci{
1592094332d3Sopenharmony_ci    int32_t ret;
1593094332d3Sopenharmony_ci    bool flag;
1594094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1595094332d3Sopenharmony_ci    ProjectionScreenParam *param;
1596094332d3Sopenharmony_ci
1597094332d3Sopenharmony_ci    param = (ProjectionScreenParam *)OsalMemCalloc(sizeof(ProjectionScreenParam) + TEST_PARAM_BUF_SIZE);
1598094332d3Sopenharmony_ci    EXPECT_NE(nullptr, param);
1599094332d3Sopenharmony_ci    param->bufLen = 1;
1600094332d3Sopenharmony_ci    param->buf[0] = 0;
1601094332d3Sopenharmony_ci    param->cmdId = CMD_SET_GO_CSA_CHANNEL;
1602094332d3Sopenharmony_ci
1603094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1604094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1605094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(staFeature->baseFeature.ifName, param);
1606094332d3Sopenharmony_ci        printf("SetProjectionScreenParam_%d: ret = %d\n", __LINE__, ret);
1607094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_DEV_ERR_NETDOWN);
1608094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1609094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1610094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1611094332d3Sopenharmony_ci    }
1612094332d3Sopenharmony_ci    OsalMemFree(param);
1613094332d3Sopenharmony_ci}
1614094332d3Sopenharmony_ci
1615094332d3Sopenharmony_ci/**
1616094332d3Sopenharmony_ci * @tc.name: SetProjectionScreenParam008
1617094332d3Sopenharmony_ci * @tc.desc: wifi hal config projection screen function test
1618094332d3Sopenharmony_ci * @tc.type: FUNC
1619094332d3Sopenharmony_ci * @tc.require:
1620094332d3Sopenharmony_ci */
1621094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetProjectionScreenParam008, TestSize.Level1)
1622094332d3Sopenharmony_ci{
1623094332d3Sopenharmony_ci    int32_t ret;
1624094332d3Sopenharmony_ci    bool flag;
1625094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1626094332d3Sopenharmony_ci    ProjectionScreenParam *param;
1627094332d3Sopenharmony_ci
1628094332d3Sopenharmony_ci    param = (ProjectionScreenParam *)OsalMemCalloc(sizeof(ProjectionScreenParam) + TEST_PARAM_BUF_SIZE);
1629094332d3Sopenharmony_ci    EXPECT_NE(nullptr, param);
1630094332d3Sopenharmony_ci    param->bufLen = 1;
1631094332d3Sopenharmony_ci    param->buf[0] = 0;
1632094332d3Sopenharmony_ci    param->cmdId = CMD_SET_GO_RADAR_DETECT;
1633094332d3Sopenharmony_ci
1634094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1635094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1636094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(staFeature->baseFeature.ifName, param);
1637094332d3Sopenharmony_ci        printf("SetProjectionScreenParam_%d: ret = %d\n", __LINE__, ret);
1638094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_DEV_ERR_NETDOWN);
1639094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1640094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1641094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1642094332d3Sopenharmony_ci    }
1643094332d3Sopenharmony_ci    OsalMemFree(param);
1644094332d3Sopenharmony_ci}
1645094332d3Sopenharmony_ci
1646094332d3Sopenharmony_ci/**
1647094332d3Sopenharmony_ci * @tc.name: SetProjectionScreenParam009
1648094332d3Sopenharmony_ci * @tc.desc: wifi hal config projection screen function test
1649094332d3Sopenharmony_ci * @tc.type: FUNC
1650094332d3Sopenharmony_ci * @tc.require:
1651094332d3Sopenharmony_ci */
1652094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetProjectionScreenParam009, TestSize.Level1)
1653094332d3Sopenharmony_ci{
1654094332d3Sopenharmony_ci    int32_t ret;
1655094332d3Sopenharmony_ci    bool flag;
1656094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1657094332d3Sopenharmony_ci    ProjectionScreenParam *param;
1658094332d3Sopenharmony_ci
1659094332d3Sopenharmony_ci    param = (ProjectionScreenParam *)OsalMemCalloc(sizeof(ProjectionScreenParam) + TEST_PARAM_BUF_SIZE);
1660094332d3Sopenharmony_ci    EXPECT_NE(nullptr, param);
1661094332d3Sopenharmony_ci    param->bufLen = 1;
1662094332d3Sopenharmony_ci    param->buf[0] = 0;
1663094332d3Sopenharmony_ci    param->cmdId = CMD_ID_MCC_STA_P2P_QUOTA_TIME;
1664094332d3Sopenharmony_ci
1665094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1666094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1667094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(staFeature->baseFeature.ifName, param);
1668094332d3Sopenharmony_ci        printf("SetProjectionScreenParam_%d: ret = %d\n", __LINE__, ret);
1669094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_DEV_ERR_NETDOWN);
1670094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1671094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1672094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1673094332d3Sopenharmony_ci    }
1674094332d3Sopenharmony_ci    OsalMemFree(param);
1675094332d3Sopenharmony_ci}
1676094332d3Sopenharmony_ci
1677094332d3Sopenharmony_ci/**
1678094332d3Sopenharmony_ci * @tc.name: SetProjectionScreenParam010
1679094332d3Sopenharmony_ci * @tc.desc: wifi hal config projection screen function test
1680094332d3Sopenharmony_ci * @tc.type: FUNC
1681094332d3Sopenharmony_ci * @tc.require:
1682094332d3Sopenharmony_ci */
1683094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SetProjectionScreenParam010, TestSize.Level1)
1684094332d3Sopenharmony_ci{
1685094332d3Sopenharmony_ci    int32_t ret;
1686094332d3Sopenharmony_ci    bool flag;
1687094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1688094332d3Sopenharmony_ci    ProjectionScreenParam *param;
1689094332d3Sopenharmony_ci
1690094332d3Sopenharmony_ci    param = (ProjectionScreenParam *)OsalMemCalloc(sizeof(ProjectionScreenParam) + TEST_PARAM_BUF_SIZE);
1691094332d3Sopenharmony_ci    EXPECT_NE(nullptr, param);
1692094332d3Sopenharmony_ci    param->bufLen = 1;
1693094332d3Sopenharmony_ci    param->buf[0] = 0;
1694094332d3Sopenharmony_ci    param->cmdId = CMD_ID_CTRL_ROAM_CHANNEL;
1695094332d3Sopenharmony_ci
1696094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1697094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1698094332d3Sopenharmony_ci        ret = g_wifi->setProjectionScreenParam(staFeature->baseFeature.ifName, param);
1699094332d3Sopenharmony_ci        printf("SetProjectionScreenParam_%d: ret = %d\n", __LINE__, ret);
1700094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_DEV_ERR_NETDOWN);
1701094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1702094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1703094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1704094332d3Sopenharmony_ci    }
1705094332d3Sopenharmony_ci    OsalMemFree(param);
1706094332d3Sopenharmony_ci}
1707094332d3Sopenharmony_ci
1708094332d3Sopenharmony_ci/**
1709094332d3Sopenharmony_ci * @tc.name: SendCmdIoctl001
1710094332d3Sopenharmony_ci * @tc.desc: wifi hal send ioctl command function test
1711094332d3Sopenharmony_ci * @tc.type: FUNC
1712094332d3Sopenharmony_ci * @tc.require: AR000HDUEE
1713094332d3Sopenharmony_ci */
1714094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SendCmdIoctl001, TestSize.Level1)
1715094332d3Sopenharmony_ci{
1716094332d3Sopenharmony_ci    int32_t cmdId = 0;
1717094332d3Sopenharmony_ci    int32_t ret;
1718094332d3Sopenharmony_ci    bool flag;
1719094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1720094332d3Sopenharmony_ci    int8_t data[TEST_BUF_SIZE] = {0};
1721094332d3Sopenharmony_ci    const char *ifName = "wlan0";
1722094332d3Sopenharmony_ci
1723094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1724094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1725094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(nullptr, cmdId, nullptr, TEST_BUF_SIZE);
1726094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1727094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(ifName, cmdId, nullptr, TEST_BUF_SIZE);
1728094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1729094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(nullptr, cmdId, data, TEST_BUF_SIZE);
1730094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1731094332d3Sopenharmony_ci        cmdId = CMD_HID2D_MODULE_INIT;
1732094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(ifName, cmdId, data, TEST_BUF_SIZE);
1733094332d3Sopenharmony_ci        printf("sendCmdIoctl_%d: ret = %d\n", __LINE__, ret);
1734094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
1735094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1736094332d3Sopenharmony_ci
1737094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1738094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1739094332d3Sopenharmony_ci    }
1740094332d3Sopenharmony_ci}
1741094332d3Sopenharmony_ci
1742094332d3Sopenharmony_ci/**
1743094332d3Sopenharmony_ci * @tc.name: SendCmdIoctl002
1744094332d3Sopenharmony_ci * @tc.desc: wifi hal send ioctl command function test
1745094332d3Sopenharmony_ci * @tc.type: FUNC
1746094332d3Sopenharmony_ci * @tc.require: AR000HDUEE
1747094332d3Sopenharmony_ci */
1748094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SendCmdIoctl002, TestSize.Level1)
1749094332d3Sopenharmony_ci{
1750094332d3Sopenharmony_ci    int32_t cmdId = 0;
1751094332d3Sopenharmony_ci    int32_t ret;
1752094332d3Sopenharmony_ci    bool flag;
1753094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1754094332d3Sopenharmony_ci    int8_t data[TEST_BUF_SIZE] = {0};
1755094332d3Sopenharmony_ci    const char *ifName = "wlan0";
1756094332d3Sopenharmony_ci
1757094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1758094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1759094332d3Sopenharmony_ci        cmdId = CMD_SET_BATTERY_LEVEL;
1760094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(ifName, cmdId, data, TEST_BUF_SIZE);
1761094332d3Sopenharmony_ci        printf("sendCmdIoctl_%d: ret = %d\n", __LINE__, ret);
1762094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
1763094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1764094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1765094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1766094332d3Sopenharmony_ci    }
1767094332d3Sopenharmony_ci}
1768094332d3Sopenharmony_ci
1769094332d3Sopenharmony_ci/**
1770094332d3Sopenharmony_ci * @tc.name: SendCmdIoctl003
1771094332d3Sopenharmony_ci * @tc.desc: wifi hal send ioctl command function test
1772094332d3Sopenharmony_ci * @tc.type: FUNC
1773094332d3Sopenharmony_ci * @tc.require:
1774094332d3Sopenharmony_ci */
1775094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SendCmdIoctl003, TestSize.Level1)
1776094332d3Sopenharmony_ci{
1777094332d3Sopenharmony_ci    int32_t cmdId = 0;
1778094332d3Sopenharmony_ci    int32_t ret;
1779094332d3Sopenharmony_ci    bool flag;
1780094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1781094332d3Sopenharmony_ci    int8_t data[TEST_BUF_SIZE] = {0};
1782094332d3Sopenharmony_ci    const char *ifName = "wlan0";
1783094332d3Sopenharmony_ci
1784094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1785094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1786094332d3Sopenharmony_ci        cmdId = CMD_SET_SUPP_COEX_CHAN_LIST;
1787094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(ifName, cmdId, data, TEST_BUF_SIZE);
1788094332d3Sopenharmony_ci        printf("sendCmdIoctl_%d: ret = %d\n", __LINE__, ret);
1789094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_DEV_ERR_NETDOWN);
1790094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1791094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1792094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1793094332d3Sopenharmony_ci    }
1794094332d3Sopenharmony_ci}
1795094332d3Sopenharmony_ci
1796094332d3Sopenharmony_ci/**
1797094332d3Sopenharmony_ci * @tc.name: SendCmdIoctl004
1798094332d3Sopenharmony_ci * @tc.desc: wifi hal send ioctl command function test
1799094332d3Sopenharmony_ci * @tc.type: FUNC
1800094332d3Sopenharmony_ci * @tc.require:
1801094332d3Sopenharmony_ci */
1802094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SendCmdIoctl004, TestSize.Level1)
1803094332d3Sopenharmony_ci{
1804094332d3Sopenharmony_ci    int32_t cmdId = 0;
1805094332d3Sopenharmony_ci    int32_t ret;
1806094332d3Sopenharmony_ci    bool flag;
1807094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1808094332d3Sopenharmony_ci    int8_t data[TEST_BUF_SIZE] = {0};
1809094332d3Sopenharmony_ci    const char *ifName = "wlan0";
1810094332d3Sopenharmony_ci
1811094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1812094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1813094332d3Sopenharmony_ci        cmdId = CMD_SET_CHAN_ADJUST;
1814094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(ifName, cmdId, data, TEST_BUF_SIZE);
1815094332d3Sopenharmony_ci        printf("sendCmdIoctl_%d: ret = %d\n", __LINE__, ret);
1816094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_DEV_ERR_NETDOWN);
1817094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1818094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1819094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1820094332d3Sopenharmony_ci    }
1821094332d3Sopenharmony_ci}
1822094332d3Sopenharmony_ci
1823094332d3Sopenharmony_ci/**
1824094332d3Sopenharmony_ci * @tc.name: SendCmdIoctl005
1825094332d3Sopenharmony_ci * @tc.desc: wifi hal send ioctl command function test
1826094332d3Sopenharmony_ci * @tc.type: FUNC
1827094332d3Sopenharmony_ci * @tc.require:
1828094332d3Sopenharmony_ci */
1829094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SendCmdIoctl005, TestSize.Level1)
1830094332d3Sopenharmony_ci{
1831094332d3Sopenharmony_ci    int32_t cmdId = 0;
1832094332d3Sopenharmony_ci    int32_t ret;
1833094332d3Sopenharmony_ci    bool flag;
1834094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1835094332d3Sopenharmony_ci    int8_t data[TEST_BUF_SIZE] = {0};
1836094332d3Sopenharmony_ci    const char *ifName = "wlan0";
1837094332d3Sopenharmony_ci
1838094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1839094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1840094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(nullptr, cmdId, nullptr, TEST_BUF_SIZE);
1841094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1842094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(ifName, cmdId, nullptr, TEST_BUF_SIZE);
1843094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1844094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(nullptr, cmdId, data, TEST_BUF_SIZE);
1845094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1846094332d3Sopenharmony_ci
1847094332d3Sopenharmony_ci        cmdId = CMD_HID2D_MODULE_INIT;
1848094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(ifName, cmdId, data, TEST_BUF_SIZE);
1849094332d3Sopenharmony_ci        printf("sendCmdIoctl_%d: ret = %d\n", __LINE__, ret);
1850094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
1851094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1852094332d3Sopenharmony_ci
1853094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1854094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1855094332d3Sopenharmony_ci    }
1856094332d3Sopenharmony_ci}
1857094332d3Sopenharmony_ci
1858094332d3Sopenharmony_ci/**
1859094332d3Sopenharmony_ci * @tc.name: SendCmdIoctl006
1860094332d3Sopenharmony_ci * @tc.desc: wifi hal send ioctl command function test
1861094332d3Sopenharmony_ci * @tc.type: FUNC
1862094332d3Sopenharmony_ci * @tc.require:
1863094332d3Sopenharmony_ci */
1864094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SendCmdIoctl006, TestSize.Level1)
1865094332d3Sopenharmony_ci{
1866094332d3Sopenharmony_ci    int32_t cmdId = 0;
1867094332d3Sopenharmony_ci    int32_t ret;
1868094332d3Sopenharmony_ci    bool flag;
1869094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1870094332d3Sopenharmony_ci    int8_t data[TEST_BUF_SIZE] = {0};
1871094332d3Sopenharmony_ci    const char *ifName = "wlan0";
1872094332d3Sopenharmony_ci
1873094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1874094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1875094332d3Sopenharmony_ci        cmdId = CMD_SET_BATTERY_LEVEL;
1876094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(ifName, cmdId, data, TEST_BUF_SIZE);
1877094332d3Sopenharmony_ci        printf("sendCmdIoctl_%d: ret = %d\n", __LINE__, ret);
1878094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
1879094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1880094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1881094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1882094332d3Sopenharmony_ci    }
1883094332d3Sopenharmony_ci}
1884094332d3Sopenharmony_ci
1885094332d3Sopenharmony_ci/**
1886094332d3Sopenharmony_ci * @tc.name: SendCmdIoctl007
1887094332d3Sopenharmony_ci * @tc.desc: wifi hal send ioctl command function test
1888094332d3Sopenharmony_ci * @tc.type: FUNC
1889094332d3Sopenharmony_ci * @tc.require:
1890094332d3Sopenharmony_ci */
1891094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SendCmdIoctl007, TestSize.Level1)
1892094332d3Sopenharmony_ci{
1893094332d3Sopenharmony_ci    int32_t cmdId = 0;
1894094332d3Sopenharmony_ci    int32_t ret;
1895094332d3Sopenharmony_ci    bool flag;
1896094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1897094332d3Sopenharmony_ci    int8_t data[TEST_BUF_SIZE] = {0};
1898094332d3Sopenharmony_ci    const char *ifName = "wlan0";
1899094332d3Sopenharmony_ci
1900094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1901094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1902094332d3Sopenharmony_ci        cmdId = CMD_SET_SUPP_COEX_CHAN_LIST;
1903094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(ifName, cmdId, data, TEST_BUF_SIZE);
1904094332d3Sopenharmony_ci        printf("sendCmdIoctl_%d: ret = %d\n", __LINE__, ret);
1905094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_DEV_ERR_NETDOWN);
1906094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1907094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1908094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1909094332d3Sopenharmony_ci    }
1910094332d3Sopenharmony_ci}
1911094332d3Sopenharmony_ci
1912094332d3Sopenharmony_ci/**
1913094332d3Sopenharmony_ci * @tc.name: SendCmdIoctl008
1914094332d3Sopenharmony_ci * @tc.desc: wifi hal send ioctl command function test
1915094332d3Sopenharmony_ci * @tc.type: FUNC
1916094332d3Sopenharmony_ci * @tc.require:
1917094332d3Sopenharmony_ci */
1918094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, SendCmdIoctl008, TestSize.Level1)
1919094332d3Sopenharmony_ci{
1920094332d3Sopenharmony_ci    int32_t cmdId = 0;
1921094332d3Sopenharmony_ci    int32_t ret;
1922094332d3Sopenharmony_ci    bool flag;
1923094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1924094332d3Sopenharmony_ci    int8_t data[TEST_BUF_SIZE] = {0};
1925094332d3Sopenharmony_ci    const char *ifName = "wlan0";
1926094332d3Sopenharmony_ci
1927094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
1928094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1929094332d3Sopenharmony_ci        cmdId = CMD_SET_CHAN_ADJUST;
1930094332d3Sopenharmony_ci        ret = g_wifi->sendCmdIoctl(ifName, cmdId, data, TEST_BUF_SIZE);
1931094332d3Sopenharmony_ci        printf("sendCmdIoctl_%d: ret = %d\n", __LINE__, ret);
1932094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_DEV_ERR_NETDOWN);
1933094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1934094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
1935094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1936094332d3Sopenharmony_ci    }
1937094332d3Sopenharmony_ci}
1938094332d3Sopenharmony_ci
1939094332d3Sopenharmony_ci/**
1940094332d3Sopenharmony_ci * @tc.name: GetStationInfo001
1941094332d3Sopenharmony_ci * @tc.desc: Wifi hdi get station information function test
1942094332d3Sopenharmony_ci * @tc.type: FUNC
1943094332d3Sopenharmony_ci * @tc.require:
1944094332d3Sopenharmony_ci */
1945094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, GetStationInfo001, TestSize.Level1)
1946094332d3Sopenharmony_ci{
1947094332d3Sopenharmony_ci    int32_t ret;
1948094332d3Sopenharmony_ci    StationInfo info;
1949094332d3Sopenharmony_ci    bool flag;
1950094332d3Sopenharmony_ci    uint8_t mac[ETH_ADDR_LEN] = {0};
1951094332d3Sopenharmony_ci    struct IWiFiAp *apFeature = nullptr;
1952094332d3Sopenharmony_ci    const char *ifName = "wlan0";
1953094332d3Sopenharmony_ci    const char *ifNameInvalid = "wlanTest";
1954094332d3Sopenharmony_ci
1955094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
1956094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1957094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(nullptr, nullptr, nullptr, ETH_ADDR_LEN);
1958094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1959094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(ifName, nullptr, nullptr, ETH_ADDR_LEN);
1960094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1961094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(nullptr, &info, nullptr, ETH_ADDR_LEN);
1962094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1963094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(nullptr, nullptr, mac, ETH_ADDR_LEN);
1964094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1965094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(ifName, &info, nullptr, ETH_ADDR_LEN);
1966094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1967094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(nullptr, &info, mac, ETH_ADDR_LEN);
1968094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1969094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(ifName, nullptr, mac, ETH_ADDR_LEN);
1970094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1971094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(ifNameInvalid, &info, mac, ETH_ADDR_LEN);
1972094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
1973094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(ifName, &info, mac, ETH_ADDR_LEN);
1974094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
1975094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
1976094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
1977094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
1978094332d3Sopenharmony_ci    }
1979094332d3Sopenharmony_ci}
1980094332d3Sopenharmony_ci
1981094332d3Sopenharmony_ci/**
1982094332d3Sopenharmony_ci * @tc.name: GetStationInfo002
1983094332d3Sopenharmony_ci * @tc.desc: Wifi hdi get station information function test
1984094332d3Sopenharmony_ci * @tc.type: FUNC
1985094332d3Sopenharmony_ci * @tc.require:
1986094332d3Sopenharmony_ci */
1987094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, GetStationInfo002, TestSize.Level1)
1988094332d3Sopenharmony_ci{
1989094332d3Sopenharmony_ci    int32_t ret;
1990094332d3Sopenharmony_ci    StationInfo info;
1991094332d3Sopenharmony_ci    bool flag;
1992094332d3Sopenharmony_ci    uint8_t mac[ETH_ADDR_LEN] = {0};
1993094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
1994094332d3Sopenharmony_ci    const char *ifName = "wlan0";
1995094332d3Sopenharmony_ci
1996094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&staFeature);
1997094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
1998094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(nullptr, nullptr, nullptr, ETH_ADDR_LEN);
1999094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
2000094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(ifName, nullptr, nullptr, ETH_ADDR_LEN);
2001094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
2002094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(nullptr, &info, nullptr, ETH_ADDR_LEN);
2003094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
2004094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(nullptr, nullptr, mac, ETH_ADDR_LEN);
2005094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
2006094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(ifName, &info, nullptr, ETH_ADDR_LEN);
2007094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
2008094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(nullptr, &info, mac, ETH_ADDR_LEN);
2009094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
2010094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(ifName, nullptr, mac, ETH_ADDR_LEN);
2011094332d3Sopenharmony_ci        EXPECT_NE(ret, HDF_SUCCESS);
2012094332d3Sopenharmony_ci        ret = g_wifi->getStationInfo(ifName, &info, mac, ETH_ADDR_LEN);
2013094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
2014094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
2015094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
2016094332d3Sopenharmony_ci        EXPECT_EQ(ret, HDF_SUCCESS);
2017094332d3Sopenharmony_ci    }
2018094332d3Sopenharmony_ci}
2019094332d3Sopenharmony_ci
2020094332d3Sopenharmony_ci/**
2021094332d3Sopenharmony_ci * @tc.name: GetSignalPollInfo001
2022094332d3Sopenharmony_ci * @tc.desc: wifi hal get signal information function test
2023094332d3Sopenharmony_ci * @tc.type: FUNC
2024094332d3Sopenharmony_ci * @tc.require:
2025094332d3Sopenharmony_ci */
2026094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, GetSignalPollInfo001, TestSize.Level1)
2027094332d3Sopenharmony_ci{
2028094332d3Sopenharmony_ci    int32_t ret;
2029094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
2030094332d3Sopenharmony_ci    const char *interfaceName = "wlan0";
2031094332d3Sopenharmony_ci    struct SignalResult signalResult;
2032094332d3Sopenharmony_ci    (void)memset_s(&signalResult, sizeof(signalResult), 0, sizeof(signalResult));
2033094332d3Sopenharmony_ci
2034094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
2035094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
2036094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
2037094332d3Sopenharmony_ci        ret = staFeature->getSignalPollInfo(interfaceName, &signalResult);
2038094332d3Sopenharmony_ci        printf("getSignalPollInfo ret = %d.\n", ret);
2039094332d3Sopenharmony_ci        bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
2040094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
2041094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
2042094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
2043094332d3Sopenharmony_ci    }
2044094332d3Sopenharmony_ci}
2045094332d3Sopenharmony_ci
2046094332d3Sopenharmony_ci/**
2047094332d3Sopenharmony_ci * @tc.name: WifiStartChannelMeas001
2048094332d3Sopenharmony_ci * @tc.desc: Wifi start channel meas and get meas result test
2049094332d3Sopenharmony_ci * @tc.type: FUNC
2050094332d3Sopenharmony_ci * @tc.require:
2051094332d3Sopenharmony_ci */
2052094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, StartChannelMeasTest001, TestSize.Level1)
2053094332d3Sopenharmony_ci{
2054094332d3Sopenharmony_ci    int32_t ret;
2055094332d3Sopenharmony_ci    const char *ifName = "wlan0";
2056094332d3Sopenharmony_ci    struct MeasParam measChannelParam;
2057094332d3Sopenharmony_ci    struct MeasResult measChannelResult = {0};
2058094332d3Sopenharmony_ci    measChannelParam.channelId = 1;
2059094332d3Sopenharmony_ci    measChannelParam.measTime = 15;
2060094332d3Sopenharmony_ci
2061094332d3Sopenharmony_ci    ret = g_wifi->startChannelMeas(nullptr, &measChannelParam);
2062094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
2063094332d3Sopenharmony_ci    ret = g_wifi->startChannelMeas(ifName, nullptr);
2064094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
2065094332d3Sopenharmony_ci    ret = g_wifi->startChannelMeas(ifName, &measChannelParam);
2066094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_NOT_SUPPORT, ret);
2067094332d3Sopenharmony_ci
2068094332d3Sopenharmony_ci    ret = g_wifi->getChannelMeasResult(nullptr, &measChannelResult);
2069094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
2070094332d3Sopenharmony_ci    ret = g_wifi->getChannelMeasResult(ifName, nullptr);
2071094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
2072094332d3Sopenharmony_ci    ret = g_wifi->getChannelMeasResult(ifName, &measChannelResult);
2073094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_NOT_SUPPORT, ret);
2074094332d3Sopenharmony_ci}
2075094332d3Sopenharmony_ci
2076094332d3Sopenharmony_ci/**
2077094332d3Sopenharmony_ci * @tc.name: HalRegisterHid2dCallback001
2078094332d3Sopenharmony_ci * @tc.desc: Hal register hid2d callback test
2079094332d3Sopenharmony_ci * @tc.type: FUNC
2080094332d3Sopenharmony_ci * @tc.require:
2081094332d3Sopenharmony_ci */
2082094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, HalRegisterHid2dCallback001, TestSize.Level1)
2083094332d3Sopenharmony_ci{
2084094332d3Sopenharmony_ci    int32_t ret;
2085094332d3Sopenharmony_ci    const char *ifName = "wlan0";
2086094332d3Sopenharmony_ci
2087094332d3Sopenharmony_ci    ret = g_wifi->registerHid2dCallback(nullptr, ifName);
2088094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
2089094332d3Sopenharmony_ci    ret = g_wifi->registerHid2dCallback(Hid2dFunCb, nullptr);
2090094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
2091094332d3Sopenharmony_ci    ret = g_wifi->registerHid2dCallback(Hid2dFunCb, ifName);
2092094332d3Sopenharmony_ci    EXPECT_EQ(HDF_SUCCESS, ret);
2093094332d3Sopenharmony_ci}
2094094332d3Sopenharmony_ci
2095094332d3Sopenharmony_ci/**
2096094332d3Sopenharmony_ci * @tc.name: HalUnregisterHid2dCallback001
2097094332d3Sopenharmony_ci * @tc.desc: Hal unregister hid2d callback test
2098094332d3Sopenharmony_ci * @tc.type: FUNC
2099094332d3Sopenharmony_ci * @tc.require:
2100094332d3Sopenharmony_ci */
2101094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, HalUnregisterHid2dCallback001, TestSize.Level1)
2102094332d3Sopenharmony_ci{
2103094332d3Sopenharmony_ci    int32_t ret;
2104094332d3Sopenharmony_ci    const char *ifName = "wlan0";
2105094332d3Sopenharmony_ci
2106094332d3Sopenharmony_ci    ret = g_wifi->unregisterHid2dCallback(nullptr, ifName);
2107094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
2108094332d3Sopenharmony_ci    ret = g_wifi->unregisterHid2dCallback(Hid2dFunCb, nullptr);
2109094332d3Sopenharmony_ci    EXPECT_EQ(HDF_ERR_INVALID_PARAM, ret);
2110094332d3Sopenharmony_ci    ret = g_wifi->unregisterHid2dCallback(Hid2dFunCb, ifName);
2111094332d3Sopenharmony_ci    EXPECT_EQ(HDF_SUCCESS, ret);
2112094332d3Sopenharmony_ci}
2113094332d3Sopenharmony_ci
2114094332d3Sopenharmony_ci/**
2115094332d3Sopenharmony_ci * @tc.name: WifiHalStartPnoScan001
2116094332d3Sopenharmony_ci * @tc.desc: Wifi hal Start Scan function test
2117094332d3Sopenharmony_ci * @tc.type: FUNC
2118094332d3Sopenharmony_ci * @tc.require:
2119094332d3Sopenharmony_ci */
2120094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalStartPnoScan001, TestSize.Level1)
2121094332d3Sopenharmony_ci{
2122094332d3Sopenharmony_ci    int32_t ret;
2123094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
2124094332d3Sopenharmony_ci    const char *ifName = "wlan0";
2125094332d3Sopenharmony_ci    WifiPnoSettings pnoSettings;
2126094332d3Sopenharmony_ci    (void)memset_s(&pnoSettings, sizeof(pnoSettings), 0, sizeof(pnoSettings));
2127094332d3Sopenharmony_ci
2128094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
2129094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
2130094332d3Sopenharmony_ci        EXPECT_NE(staFeature, nullptr);
2131094332d3Sopenharmony_ci        ret = staFeature->startPnoScan(nullptr, &pnoSettings);
2132094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
2133094332d3Sopenharmony_ci        ret = staFeature->startPnoScan(ifName, nullptr);
2134094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
2135094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
2136094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
2137094332d3Sopenharmony_ci    }
2138094332d3Sopenharmony_ci}
2139094332d3Sopenharmony_ci/**
2140094332d3Sopenharmony_ci * @tc.name: WifiHalStartPnoScan002
2141094332d3Sopenharmony_ci * @tc.desc: Wifi hal Start Scan function test
2142094332d3Sopenharmony_ci * @tc.type: FUNC
2143094332d3Sopenharmony_ci * @tc.require:
2144094332d3Sopenharmony_ci */
2145094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalStartPnoScan002, TestSize.Level1)
2146094332d3Sopenharmony_ci{
2147094332d3Sopenharmony_ci    int32_t ret;
2148094332d3Sopenharmony_ci    bool flag;
2149094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
2150094332d3Sopenharmony_ci    const char *ifName = "wlan0";
2151094332d3Sopenharmony_ci    string ssid1 = "xa-hw";
2152094332d3Sopenharmony_ci    string ssid2 = "xa-hw-03";
2153094332d3Sopenharmony_ci    WifiPnoSettings pnoSettings;
2154094332d3Sopenharmony_ci    (void)memset_s(&pnoSettings, sizeof(pnoSettings), 0, sizeof(pnoSettings));
2155094332d3Sopenharmony_ci    pnoSettings.min2gRssi = -120;
2156094332d3Sopenharmony_ci    pnoSettings.min5gRssi = -130;
2157094332d3Sopenharmony_ci    pnoSettings.scanIntervalMs = 60000;
2158094332d3Sopenharmony_ci    pnoSettings.scanIterations = 3;
2159094332d3Sopenharmony_ci
2160094332d3Sopenharmony_ci    pnoSettings.pnoNetworksLen = 2;
2161094332d3Sopenharmony_ci    pnoSettings.pnoNetworks = (WifiPnoNetwork *)OsalMemCalloc(sizeof(WifiPnoNetwork) * 2);
2162094332d3Sopenharmony_ci    pnoSettings.pnoNetworks[0].isHidden = 1;
2163094332d3Sopenharmony_ci    memcpy_s(pnoSettings.pnoNetworks[0].ssid.ssid, MAX_SSID_LEN, ssid1.c_str(), ssid1.length());
2164094332d3Sopenharmony_ci    pnoSettings.pnoNetworks[0].ssid.ssidLen = ssid1.length();
2165094332d3Sopenharmony_ci    pnoSettings.pnoNetworks[1].isHidden = 0;
2166094332d3Sopenharmony_ci    memcpy_s(pnoSettings.pnoNetworks[1].ssid.ssid, MAX_SSID_LEN, ssid2.c_str(), ssid2.length());
2167094332d3Sopenharmony_ci    pnoSettings.pnoNetworks[1].ssid.ssidLen = ssid2.length();
2168094332d3Sopenharmony_ci
2169094332d3Sopenharmony_ci    ret = g_wifi->registerEventCallback(HalCallbackEvent, ifName);
2170094332d3Sopenharmony_ci    EXPECT_EQ(HDF_SUCCESS, ret);
2171094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
2172094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
2173094332d3Sopenharmony_ci        EXPECT_NE(staFeature, nullptr);
2174094332d3Sopenharmony_ci        ret = staFeature->startPnoScan(ifName, &pnoSettings);
2175094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
2176094332d3Sopenharmony_ci        printf("ret = %d.\n", ret);
2177094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
2178094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
2179094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
2180094332d3Sopenharmony_ci    }
2181094332d3Sopenharmony_ci    ret = g_wifi->unregisterEventCallback(HalCallbackEvent, ifName);
2182094332d3Sopenharmony_ci    EXPECT_EQ(HDF_SUCCESS, ret);
2183094332d3Sopenharmony_ci    OsalMemFree(pnoSettings.pnoNetworks);
2184094332d3Sopenharmony_ci}
2185094332d3Sopenharmony_ci
2186094332d3Sopenharmony_ci/**
2187094332d3Sopenharmony_ci * @tc.name: WifiHalStopPnoScan001
2188094332d3Sopenharmony_ci * @tc.desc: Wifi hal stop pno scan
2189094332d3Sopenharmony_ci * @tc.type: FUNC
2190094332d3Sopenharmony_ci * @tc.require:
2191094332d3Sopenharmony_ci */
2192094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiHalStopPnoScan001, TestSize.Level1)
2193094332d3Sopenharmony_ci{
2194094332d3Sopenharmony_ci    int32_t ret;
2195094332d3Sopenharmony_ci    bool flag;
2196094332d3Sopenharmony_ci    struct IWiFiSta *staFeature = nullptr;
2197094332d3Sopenharmony_ci    const char *ifName = "wlan0";
2198094332d3Sopenharmony_ci
2199094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_STATION, (struct IWiFiBaseFeature **)&staFeature);
2200094332d3Sopenharmony_ci    if (ret == HDF_SUCCESS) {
2201094332d3Sopenharmony_ci        EXPECT_NE(nullptr, staFeature);
2202094332d3Sopenharmony_ci        ret = staFeature->stopPnoScan(nullptr);
2203094332d3Sopenharmony_ci        EXPECT_NE(HDF_SUCCESS, ret);
2204094332d3Sopenharmony_ci        ret = staFeature->stopPnoScan(ifName);
2205094332d3Sopenharmony_ci        flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
2206094332d3Sopenharmony_ci        ASSERT_TRUE(flag);
2207094332d3Sopenharmony_ci        ret = g_wifi->destroyFeature((struct IWiFiBaseFeature *)staFeature);
2208094332d3Sopenharmony_ci        EXPECT_EQ(HDF_SUCCESS, ret);
2209094332d3Sopenharmony_ci    }
2210094332d3Sopenharmony_ci}
2211094332d3Sopenharmony_ci
2212094332d3Sopenharmony_ci/**
2213094332d3Sopenharmony_ci * @tc.name: WifiSendActionFrame001
2214094332d3Sopenharmony_ci * @tc.desc: Wifi send action frame factiom test
2215094332d3Sopenharmony_ci * @tc.type: FUNC
2216094332d3Sopenharmony_ci * @tc.require:
2217094332d3Sopenharmony_ci */
2218094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, WifiSendActionFrame001, TestSize.Level1)
2219094332d3Sopenharmony_ci{
2220094332d3Sopenharmony_ci    int32_t freq = WLAN_TX_POWER;
2221094332d3Sopenharmony_ci    uint8_t frameData[IFNAME_MAX_NUM - 1] = {0x12, 0x34, 0x56, 0x78, 0xab, 0xcd};
2222094332d3Sopenharmony_ci    uint32_t frameDataLen = IFNAME_MAX_NUM;
2223094332d3Sopenharmony_ci    const char *ifName = "wlan0";
2224094332d3Sopenharmony_ci
2225094332d3Sopenharmony_ci    int32_t rc = g_wifi->sendActionFrame(nullptr, freq, frameData, frameDataLen);
2226094332d3Sopenharmony_ci    ASSERT_EQ(rc, HDF_ERR_INVALID_PARAM);
2227094332d3Sopenharmony_ci    rc = g_wifi->sendActionFrame(ifName, 0, frameData, frameDataLen);
2228094332d3Sopenharmony_ci    ASSERT_EQ(rc, HDF_ERR_INVALID_PARAM);
2229094332d3Sopenharmony_ci    rc = g_wifi->sendActionFrame(ifName, freq, nullptr, frameDataLen);
2230094332d3Sopenharmony_ci    ASSERT_EQ(rc, HDF_ERR_INVALID_PARAM);
2231094332d3Sopenharmony_ci    rc = g_wifi->sendActionFrame(ifName, freq, frameData, 0);
2232094332d3Sopenharmony_ci    ASSERT_EQ(rc, HDF_ERR_INVALID_PARAM);
2233094332d3Sopenharmony_ci    g_wifi->sendActionFrame(ifName, freq, frameData, frameDataLen);
2234094332d3Sopenharmony_ci}
2235094332d3Sopenharmony_ci
2236094332d3Sopenharmony_ci/**
2237094332d3Sopenharmony_ci * @tc.name: RegisterActionFrameReceiver001
2238094332d3Sopenharmony_ci * @tc.desc: Wifi send action frame factiom test
2239094332d3Sopenharmony_ci * @tc.type: FUNC
2240094332d3Sopenharmony_ci * @tc.require:
2241094332d3Sopenharmony_ci */
2242094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, RegisterActionFrameReceiver001, TestSize.Level1)
2243094332d3Sopenharmony_ci{
2244094332d3Sopenharmony_ci    uint8_t match[IFNAME_MAX_NUM - 1] = {0x12, 0x34, 0x56, 0x78, 0xab, 0xcd};
2245094332d3Sopenharmony_ci    uint32_t matchLen = IFNAME_MAX_NUM;
2246094332d3Sopenharmony_ci    const char *ifName = "wlan0";
2247094332d3Sopenharmony_ci
2248094332d3Sopenharmony_ci    int32_t rc = g_wifi->registerActionFrameReceiver(nullptr, match, matchLen);
2249094332d3Sopenharmony_ci    ASSERT_EQ(rc, HDF_ERR_INVALID_PARAM);
2250094332d3Sopenharmony_ci    rc = g_wifi->registerActionFrameReceiver(ifName, nullptr, matchLen);
2251094332d3Sopenharmony_ci    ASSERT_EQ(rc, HDF_ERR_INVALID_PARAM);
2252094332d3Sopenharmony_ci    rc = g_wifi->registerActionFrameReceiver(ifName, match, 0);
2253094332d3Sopenharmony_ci    ASSERT_EQ(rc, HDF_ERR_INVALID_PARAM);
2254094332d3Sopenharmony_ci    g_wifi->registerActionFrameReceiver(ifName, match, matchLen);
2255094332d3Sopenharmony_ci}
2256094332d3Sopenharmony_ci
2257094332d3Sopenharmony_ci/**
2258094332d3Sopenharmony_ci * @tc.name: WifiHalGetGetFeatureType001
2259094332d3Sopenharmony_ci * @tc.desc: Wifi hal get feature type function test
2260094332d3Sopenharmony_ci * @tc.type: FUNC
2261094332d3Sopenharmony_ci * @tc.require: AR000F869G
2262094332d3Sopenharmony_ci */
2263094332d3Sopenharmony_ciHWTEST_F(WifiHalTest, InitFeatureByType001, TestSize.Level1)
2264094332d3Sopenharmony_ci{
2265094332d3Sopenharmony_ci    int ret;
2266094332d3Sopenharmony_ci    struct IWiFiP2p *p2pFeature = nullptr;
2267094332d3Sopenharmony_ci    ret = g_wifi->createFeature(PROTOCOL_80211_IFTYPE_P2P_DEVICE, nullptr);
2268094332d3Sopenharmony_ci    EXPECT_EQ(ret, HDF_FAILURE);
2269094332d3Sopenharmony_ci    g_wifi->createFeature(PROTOCOL_80211_IFTYPE_P2P_DEVICE, (struct IWiFiBaseFeature **)&p2pFeature);
2270094332d3Sopenharmony_ci}
2271094332d3Sopenharmony_ci}; // namespace HalTest
2272