同步操作将从 OpenHarmony/drivers_peripheral 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
This repository defines and implements the WLAN-related Hardware Driver Interfaces (HDIs) which provide the following functionalities:
Figure 1 WLAN driver module architecture
The directory structure of the WLAN repository is as follows:
/drivers/peripheral/wlan
├── client # Client that implements the communication between the user space and kernel space
│ └── include # Client header files
│ └── src # Client code
├── hal # HAL code
│ └── include # HAL header files
│ └── src # HAL code implementation
├── interfaces # APIs exposed externally
│ └── include # Header files containing APIs exposed externally
The WLAN HAL module provides APIs for the Wi-Fi service, such as creating and destroying an IWiFi object and setting the MAC address. The following table lists the APIs.
Table 1 APIs provided by the WLAN HAL module
The following describes how to use the WLAN HAL module.
The sample code is as follows:
#include "wifi_hal.h"
#include "wifi_hal_sta_feature.h"
#include "wifi_hal_ap_feature.h"
#include "wifi_hal_cmd.h"
#include "wifi_hal_event.h"
#define MAC_LEN 6
static void *hal_main()
{
int ret;
struct IWiFi *wifi;
/* Create an IWiFi object. */
ret = WifiConstruct(&wifi);
if (ret != 0 || wifi == NULL) {
return;
}
/* Create a channel between the HAL and the driver. */
ret = wifi->start(wifi);
if (ret != 0) {
return;
}
/* Create an AP feature. */
ret = wifi->createFeature(PROTOCOL_80211_IFTYPE_AP, (struct IWiFiBaseFeature **)&apFeature);
if (ret != 0) {
return;
}
/* Obtain the device MAC address. */
unsigned char mac[MAC_LEN] = {0};
ret = apFeature->baseFeature.getDeviceMacAddress((struct IWiFiBaseFeature *)apFeature, mac, MAC_LEN);
if (ret != 0) {
return;
}
/* Destroy the created AP feature. */
ret = wifi->destroyFeature((struct IWiFiBaseFeature *)apFeature);
if (ret != 0) {
return;
}
/* Stop the created channel. */
ret = wifi->stop(wifi);
if (ret != 0) {
return;
}
/* Destroy the created IWiFi object. */
ret = WifiDestruct(&wifi);
if (ret != 0) {
return;
}
return;
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。