• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# IWlanInterface
2
3
4## 概述
5
6WLAN模块向上层WLAN服务提供了统一接口。
7
8上层服务调用相关的接口,可以建立/关闭WLAN热点,扫描/关联/去关联WLAN热点,设置国家码,管理网络设备等。
9
10**起始版本:** 3.2
11
12**相关模块:**[WLAN](_w_l_a_n_v10.md)
13
14
15## 汇总
16
17
18### Public 成员函数
19
20| 名称 | 描述 |
21| -------- | -------- |
22| [Start](#start) () | 创建HAL和驱动之间的通道及获取驱动网卡信息,该函数调用在创建IWiFi实体后进行。  |
23| [Stop](#stop) () | 销毁HAL和驱动之间的通道,该函数调用在销毁IWiFi实体前进行。  |
24| [CreateFeature](#createfeature) ([in] int type, [out] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature) | 根据输入类型创建对应的feature对象。  |
25| [DestroyFeature](#destroyfeature) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature) | 销毁feature对象。  |
26| [GetAsscociatedStas](#getasscociatedstas) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature, [out] struct [HdfStaInfo](_hdf_sta_info_v10.md)[] staInfo, [out] unsigned int num) | 获取与AP连接的所有STA的信息(目前只包含MAC地址)。  |
27| [GetChipId](#getchipid) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature, [out] unsigned char chipId) | 获得当前驱动的芯片ID。  |
28| [GetDeviceMacAddress](#getdevicemacaddress) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature, [out] unsigned char[] mac, [in] unsigned char len) | 获取设备的MAC地址。  |
29| [GetFeatureByIfName](#getfeaturebyifname) ([in] String ifName, [out] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature) | 通过网卡名称获取对应的feature对象。  |
30| [GetFeatureType](#getfeaturetype) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature, [out] int featureType) | 获取feature对象的类型。  |
31| [GetFreqsWithBand](#getfreqswithband) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature, [in] struct [HdfWifiInfo](_hdf_wifi_info_v10.md) wifiInfo, [out] int[] freq) | 获取指定频段(2.4G或者5G)下支持的频率。  |
32| [GetIfNamesByChipId](#getifnamesbychipid) ([in] unsigned char chipId, [out] String ifName, [out] unsigned int num) | 通过芯片ID获得当前芯片所有的网卡名称。  |
33| [GetNetworkIfaceName](#getnetworkifacename) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature, [out] String ifName) | 根据feature对象获取网卡名称。  |
34| [GetSupportCombo](#getsupportcombo) ([out] unsigned long combo) | 获取多网卡共存情况。  |
35| [GetSupportFeature](#getsupportfeature) ([out] unsigned char[] supType) | 获取该设备支持的WLAN特性(不考虑当前的使用状态)。  |
36| [RegisterEventCallback](#registereventcallback) ([in] [IWlanCallback](interface_i_wlan_callback_v10.md) cbFunc, [in] String ifName) | 注册IWiFi的回调函数,监听异步事件。  |
37| [UnregisterEventCallback](#unregistereventcallback) ([in] [IWlanCallback](interface_i_wlan_callback_v10.md) cbFunc, [in] String ifName) | 去注册IWiFi的回调函数。  |
38| [ResetDriver](#resetdriver) ([in] unsigned char chipId, [in] String ifName) | 重启指定芯片ID的WLAN驱动程序。  |
39| [SetCountryCode](#setcountrycode) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature, [in] String code, [in] unsigned int len) | 设置国家码(表示AP射频所在的国家,规定了AP射频特性,包括AP的发送功率、支持的信道等。其目的是为了使AP的射频特性符合不同国家或区域的法律法规要求)。  |
40| [SetMacAddress](#setmacaddress) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature, [in] unsigned char[] mac) | 根据传入参数设置对应网卡的MAC地址。  |
41| [SetScanningMacAddress](#setscanningmacaddress) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature, [in] unsigned char[] scanMac) | 设置扫描单个MAC地址。  |
42| [SetTxPower](#settxpower) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature, [in] int power) | 设置发射功率。  |
43| [GetNetDevInfo](#getnetdevinfo) ([out] struct [HdfNetDeviceInfoResult](_hdf_net_device_info_result_v10.md) netDeviceInfoResult) | 获取网络设备信息(设备索引、网卡名字、MAC等信息)。  |
44| [StartScan](#startscan) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature, [in] struct [HdfWifiScan](_hdf_wifi_scan_v10.md) scan) | 启动扫描。  |
45| [GetPowerMode](#getpowermode) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature, [out] unsigned char mode) | 获取正在使用的功率模式。  |
46| [SetPowerMode](#setpowermode) ([in] struct [HdfFeatureInfo](_hdf_feature_info_v10.md) ifeature, [in] unsigned char mode) | 设置功率模式。  |
47| [StartChannelMeas](#startchannelmeas) ([in] String ifName, [in] struct [MeasChannelParam](_meas_channel_param_v10.md) measChannelParam) | 启动信道测量。  |
48| [GetChannelMeasResult](#getchannelmeasresult) ([in] String ifName, [out] struct [MeasChannelResult](_meas_channel_result_v10.md) measChannelResult) | 获取信道测量结果。  |
49| [SetProjectionScreenParam](#setprojectionscreenparam) ([in] String ifName, [in] struct [ProjectionScreenCmdParam](_projection_screen_cmd_param_v10.md) param) | 设置投屏参数。  |
50| [WifiSendCmdIoctl](#wifisendcmdioctl) ([in] String ifName, [in] int cmdId, [in] byte[] paramBuf) | 向驱动发送IO控制命令。  |
51| [GetStaInfo](#getstainfo) ([in] String ifName, [out] struct [WifiStationInfo](_wifi_station_info_v10.md) info, [in] unsigned char[] mac) | 获取指定网卡的STA的信息。  |
52
53
54## 成员函数说明
55
56
57### CreateFeature()
58
59```
60IWlanInterface::CreateFeature ([in] int type, [out] struct HdfFeatureInfo ifeature )
61```
62**描述**
63根据输入类型创建对应的feature对象。
64
65**起始版本:** 3.2
66
67**参数:**
68
69| 名称 | 描述 |
70| -------- | -------- |
71| type | 创建的feature类型。  |
72| ifeature | 获取创建的feature对象。 |
73
74**返回:**
75
76如果操作成功,则返回0。
77
78如果操作失败,则返回负值。
79
80
81### DestroyFeature()
82
83```
84IWlanInterface::DestroyFeature ([in] struct HdfFeatureInfo ifeature)
85```
86**描述**
87销毁feature对象。
88
89**起始版本:** 3.2
90
91**参数:**
92
93| 名称 | 描述 |
94| -------- | -------- |
95| ifeature | 销毁的feature对象。 |
96
97**返回:**
98
99如果操作成功,则返回0。
100
101如果操作失败,则返回负值。
102
103
104### GetAsscociatedStas()
105
106```
107IWlanInterface::GetAsscociatedStas ([in] struct HdfFeatureInfo ifeature, [out] struct HdfStaInfo[] staInfo, [out] unsigned int num )
108```
109**描述**
110获取与AP连接的所有STA的信息(目前只包含MAC地址)。
111
112**起始版本:** 3.2
113
114**参数:**
115
116| 名称 | 描述 |
117| -------- | -------- |
118| ifeature | feature对象。  |
119| staInfo | 保存与AP连接的STA的基本信息。  |
120| num | 实际连接的STA的个数。 |
121
122**返回:**
123
124如果操作成功,则返回0。
125
126如果操作失败,则返回负值。
127
128
129### GetChannelMeasResult()
130
131```
132IWlanInterface::GetChannelMeasResult ([in] String ifName, [out] struct MeasChannelResult measChannelResult )
133```
134**描述**
135获取信道测量结果。
136
137**起始版本:** 3.2
138
139**参数:**
140
141| 名称 | 描述 |
142| -------- | -------- |
143| ifName | 网卡名称。  |
144| measChannelResult | 信道测量结果(信道号、信道负载、信道噪声)。 |
145
146**返回:**
147
148如果操作成功,则返回0。
149
150如果操作失败,则返回负值。
151
152
153### GetChipId()
154
155```
156IWlanInterface::GetChipId ([in] struct HdfFeatureInfo ifeature, [out] unsigned char chipId )
157```
158**描述**
159获得当前驱动的芯片ID。
160
161**起始版本:** 3.2
162
163**参数:**
164
165| 名称 | 描述 |
166| -------- | -------- |
167| ifeature | feature对象。  |
168| chipId | 获得的芯片ID。 |
169
170**返回:**
171
172如果操作成功,则返回0。
173
174如果操作失败,则返回负值。
175
176
177### GetDeviceMacAddress()
178
179```
180IWlanInterface::GetDeviceMacAddress ([in] struct HdfFeatureInfo ifeature, [out] unsigned char[] mac, [in] unsigned char len )
181```
182**描述**
183获取设备的MAC地址。
184
185**起始版本:** 3.2
186
187**参数:**
188
189| 名称 | 描述 |
190| -------- | -------- |
191| ifeature | feature对象。  |
192| mac | 获得的MAC地址。  |
193| len | mac数组的长度。 |
194
195**返回:**
196
197如果操作成功,则返回0。
198
199如果操作失败,则返回负值。
200
201
202### GetFeatureByIfName()
203
204```
205IWlanInterface::GetFeatureByIfName ([in] String ifName, [out] struct HdfFeatureInfo ifeature )
206```
207**描述**
208通过网卡名称获取对应的feature对象。
209
210**起始版本:** 3.2
211
212**参数:**
213
214| 名称 | 描述 |
215| -------- | -------- |
216| ifName | 网卡名称。  |
217| ifeature | 获取该网卡的feature对象。 |
218
219**返回:**
220
221如果操作成功,则返回0。
222
223如果操作失败,则返回负值。
224
225
226### GetFeatureType()
227
228```
229IWlanInterface::GetFeatureType ([in] struct HdfFeatureInfo ifeature, [out] int featureType )
230```
231**描述**
232获取feature对象的类型。
233
234**起始版本:** 3.2
235
236**参数:**
237
238| 名称 | 描述 |
239| -------- | -------- |
240| ifeature | feature对象。  |
241| featureType | feature对象的类型。 |
242
243**返回:**
244
245如果操作成功,则返回0。
246
247如果操作失败,则返回负值。
248
249
250### GetFreqsWithBand()
251
252```
253IWlanInterface::GetFreqsWithBand ([in] struct HdfFeatureInfo ifeature, [in] struct HdfWifiInfo wifiInfo, [out] int[] freq )
254```
255**描述**
256获取指定频段(2.4G或者5G)下支持的频率。
257
258**起始版本:** 3.2
259
260**参数:**
261
262| 名称 | 描述 |
263| -------- | -------- |
264| ifeature | feature对象。  |
265| wifiInfo | 频段信息。  |
266| freq | 保存支持的频率。 |
267
268**返回:**
269
270如果操作成功,则返回0。
271
272如果操作失败,则返回负值。
273
274
275### GetIfNamesByChipId()
276
277```
278IWlanInterface::GetIfNamesByChipId ([in] unsigned char chipId, [out] String ifName, [out] unsigned int num )
279```
280**描述**
281通过芯片ID获得当前芯片所有的网卡名称。
282
283**起始版本:** 3.2
284
285**参数:**
286
287| 名称 | 描述 |
288| -------- | -------- |
289| chipId | 需要获取网卡名称的芯片ID。  |
290| ifNames | 网卡名称。  |
291| num | 网卡的数量。 |
292
293**返回:**
294
295如果操作成功,则返回0。
296
297如果操作失败,则返回负值。
298
299
300### GetNetDevInfo()
301
302```
303IWlanInterface::GetNetDevInfo ([out] struct HdfNetDeviceInfoResult netDeviceInfoResult)
304```
305**描述**
306获取网络设备信息(设备索引、网卡名字、MAC等信息)。
307
308**起始版本:** 3.2
309
310**参数:**
311
312| 名称 | 描述 |
313| -------- | -------- |
314| netDeviceInfoResult | 输出参数,得到的网络设备信息。 |
315
316**返回:**
317
318如果操作成功,则返回0。
319
320如果操作失败,则返回负值。
321
322
323### GetNetworkIfaceName()
324
325```
326IWlanInterface::GetNetworkIfaceName ([in] struct HdfFeatureInfo ifeature, [out] String ifName )
327```
328**描述**
329根据feature对象获取网卡名称。
330
331**起始版本:** 3.2
332
333**参数:**
334
335| 名称 | 描述 |
336| -------- | -------- |
337| ifeature | feature对象。  |
338| ifName | 网卡名称。 |
339
340**返回:**
341
342如果操作成功,则返回0。
343
344如果操作失败,则返回负值。
345
346
347### GetPowerMode()
348
349```
350IWlanInterface::GetPowerMode ([in] struct HdfFeatureInfo ifeature, [out] unsigned char mode )
351```
352**描述**
353获取正在使用的功率模式。
354
355**起始版本:** 3.2
356
357**参数:**
358
359| 名称 | 描述 |
360| -------- | -------- |
361| ifeature | feature对象。  |
362| mode | 功率模式,包括睡眠模式(待机状态运行)、一般模式(正常额定功率运行)、穿墙模式(最大功率运行,提高信号强度和覆盖面积)。 |
363
364**返回:**
365
366如果操作成功,则返回0。
367
368如果操作失败,则返回负值。
369
370
371### GetStaInfo()
372
373```
374IWlanInterface::GetStaInfo ([in] String ifName, [out] struct WifiStationInfo info, [in] unsigned char[] mac )
375```
376**描述**
377获取指定网卡的STA的信息。
378
379**起始版本:** 3.2
380
381**参数:**
382
383| 名称 | 描述 |
384| -------- | -------- |
385| ifName | 网卡名称。  |
386| info | 获取的STA的信息,详情请参考[WifiStationInfo](_wifi_station_info_v10.md)。  |
387| mac | STA的MAC地址。 |
388
389**返回:**
390
391如果操作成功,则返回0。
392
393如果操作失败,则返回负值。
394
395
396### GetSupportCombo()
397
398```
399IWlanInterface::GetSupportCombo ([out] unsigned long combo)
400```
401**描述**
402获取多网卡共存情况。
403
404**起始版本:** 3.2
405
406**参数:**
407
408| 名称 | 描述 |
409| -------- | -------- |
410| combo | 基于芯片的能力保存当前所有支持的多网卡共存情况(比如支持AP、STA、P2P等不同组合的共存)。 |
411
412**返回:**
413
414如果操作成功,则返回0。
415
416如果操作失败,则返回负值。
417
418
419### GetSupportFeature()
420
421```
422IWlanInterface::GetSupportFeature ([out] unsigned char[] supType)
423```
424**描述**
425获取该设备支持的WLAN特性(不考虑当前的使用状态)。
426
427**起始版本:** 3.2
428
429**参数:**
430
431| 名称 | 描述 |
432| -------- | -------- |
433| supType | 保存当前设备支持的特性。 |
434
435**返回:**
436
437如果操作成功,则返回0。
438
439如果操作失败,则返回负值。
440
441
442### RegisterEventCallback()
443
444```
445IWlanInterface::RegisterEventCallback ([in] IWlanCallback cbFunc, [in] String ifName )
446```
447**描述**
448注册IWiFi的回调函数,监听异步事件。
449
450**起始版本:** 3.2
451
452**参数:**
453
454| 名称 | 描述 |
455| -------- | -------- |
456| cbFunc | 注册的回调函数。  |
457| ifName | 网卡名称。 |
458
459**返回:**
460
461如果操作成功,则返回0。
462
463如果操作失败,则返回负值。
464
465
466### ResetDriver()
467
468```
469IWlanInterface::ResetDriver ([in] unsigned char chipId, [in] String ifName )
470```
471**描述**
472重启指定芯片ID的WLAN驱动程序。
473
474**起始版本:** 3.2
475
476**参数:**
477
478| 名称 | 描述 |
479| -------- | -------- |
480| chipId | 需要进行重启驱动的芯片ID。  |
481| ifName | 网卡名称。 |
482
483**返回:**
484
485如果操作成功,则返回0。
486
487如果操作失败,则返回负值。
488
489
490### SetCountryCode()
491
492```
493IWlanInterface::SetCountryCode ([in] struct HdfFeatureInfo ifeature, [in] String code, [in] unsigned int len )
494```
495**描述**
496设置国家码(表示AP射频所在的国家,规定了AP射频特性,包括AP的发送功率、支持的信道等。其目的是为了使AP的射频特性符合不同国家或区域的法律法规要求)。
497
498**起始版本:** 3.2
499
500**参数:**
501
502| 名称 | 描述 |
503| -------- | -------- |
504| ifeature | feature对象。  |
505| code | 设置的国家码。  |
506| len | 国家码长度。 |
507
508**返回:**
509
510如果操作成功,则返回0。
511
512如果操作失败,则返回负值。
513
514
515### SetMacAddress()
516
517```
518IWlanInterface::SetMacAddress ([in] struct HdfFeatureInfo ifeature, [in] unsigned char[] mac )
519```
520**描述**
521根据传入参数设置对应网卡的MAC地址。
522
523**起始版本:** 3.2
524
525**参数:**
526
527| 名称 | 描述 |
528| -------- | -------- |
529| ifeature | feature对象。  |
530| mac | 设置的MAC地址。 |
531
532**返回:**
533
534如果操作成功,则返回0。
535
536如果操作失败,则返回负值。
537
538
539### SetPowerMode()
540
541```
542IWlanInterface::SetPowerMode ([in] struct HdfFeatureInfo ifeature, [in] unsigned char mode )
543```
544**描述**
545设置功率模式。
546
547**起始版本:** 3.2
548
549**参数:**
550
551| 名称 | 描述 |
552| -------- | -------- |
553| ifeature | feature对象。  |
554| mode | 功率模式,包括睡眠模式(待机状态运行)、一般模式(正常额定功率运行)、穿墙模式(最大功率运行,提高信号强度和覆盖面积)。 |
555
556**返回:**
557
558如果操作成功,则返回0。
559
560如果操作失败,则返回负值。
561
562
563### SetProjectionScreenParam()
564
565```
566IWlanInterface::SetProjectionScreenParam ([in] String ifName, [in] struct ProjectionScreenCmdParam param )
567```
568**描述**
569设置投屏参数。
570
571**起始版本:** 3.2
572
573**参数:**
574
575| 名称 | 描述 |
576| -------- | -------- |
577| ifName | 网卡名称。  |
578| param | 投屏参数。 |
579
580**返回:**
581
582如果操作成功,则返回0。
583
584如果操作失败,则返回负值。
585
586
587### SetScanningMacAddress()
588
589```
590IWlanInterface::SetScanningMacAddress ([in] struct HdfFeatureInfo ifeature, [in] unsigned char[] scanMac )
591```
592**描述**
593设置扫描单个MAC地址。
594
595**起始版本:** 3.2
596
597**参数:**
598
599| 名称 | 描述 |
600| -------- | -------- |
601| ifeature | feature对象。  |
602| scanMac | 设置STA扫描的MAC地址。 |
603
604**返回:**
605
606如果操作成功,则返回0。
607
608如果操作失败,则返回负值。
609
610
611### SetTxPower()
612
613```
614IWlanInterface::SetTxPower ([in] struct HdfFeatureInfo ifeature, [in] int power )
615```
616**描述**
617设置发射功率。
618
619**起始版本:** 3.2
620
621**参数:**
622
623| 名称 | 描述 |
624| -------- | -------- |
625| ifeature | feature对象。  |
626| power | 设置的发射功率。 |
627
628**返回:**
629
630如果操作成功,则返回0。
631
632如果操作失败,则返回负值。
633
634
635### Start()
636
637```
638IWlanInterface::Start ()
639```
640**描述**
641创建HAL和驱动之间的通道及获取驱动网卡信息,该函数调用在创建IWiFi实体后进行。
642
643**起始版本:** 3.2
644
645**返回:**
646
647如果操作成功,则返回0。
648
649如果操作失败,则返回负值。
650
651
652### StartChannelMeas()
653
654```
655IWlanInterface::StartChannelMeas ([in] String ifName, [in] struct MeasChannelParam measChannelParam )
656```
657**描述**
658启动信道测量。
659
660**起始版本:** 3.2
661
662**参数:**
663
664| 名称 | 描述 |
665| -------- | -------- |
666| ifName | 网卡名称。  |
667| measChannelParam | 信道测量参数(信道号、测量时间)。 |
668
669**返回:**
670
671如果操作成功,则返回0。
672
673如果操作失败,则返回负值。
674
675
676### StartScan()
677
678```
679IWlanInterface::StartScan ([in] struct HdfFeatureInfo ifeature, [in] struct HdfWifiScan scan )
680```
681**描述**
682启动扫描。
683
684**起始版本:** 3.2
685
686**参数:**
687
688| 名称 | 描述 |
689| -------- | -------- |
690| ifeature | feature对象。  |
691| scan | 扫描参数。 |
692
693**返回:**
694
695如果操作成功,则返回0。
696
697如果操作失败,则返回负值。
698
699
700### Stop()
701
702```
703IWlanInterface::Stop ()
704```
705**描述**
706销毁HAL和驱动之间的通道,该函数调用在销毁IWiFi实体前进行。
707
708**起始版本:** 3.2
709
710**返回:**
711
712如果操作成功,则返回0。
713
714如果操作失败,则返回负值。
715
716
717### UnregisterEventCallback()
718
719```
720IWlanInterface::UnregisterEventCallback ([in] IWlanCallback cbFunc, [in] String ifName )
721```
722**描述**
723去注册IWiFi的回调函数。
724
725**起始版本:** 3.2
726
727**参数:**
728
729| 名称 | 描述 |
730| -------- | -------- |
731| cbFunc | 去注册的回调函数。  |
732| ifName | 网卡名称。 |
733
734**返回:**
735
736如果操作成功,则返回0。
737
738如果操作失败,则返回负值。
739
740
741### WifiSendCmdIoctl()
742
743```
744IWlanInterface::WifiSendCmdIoctl ([in] String ifName, [in] int cmdId, [in] byte[] paramBuf )
745```
746**描述**
747向驱动发送IO控制命令。
748
749**起始版本:** 3.2
750
751**参数:**
752
753| 名称 | 描述 |
754| -------- | -------- |
755| ifName | 网卡名称。  |
756| cmdId | 命令ID。  |
757| paramBuf | 命令内容。 |
758
759**返回:**
760
761如果操作成功,则返回0。
762
763如果操作失败,则返回负值。
764