1 Star 0 Fork 5.2K

vv_justdoit / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
wlanoverview.md 12.98 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

WLAN Overview

Introduction

The WLAN module is developed based on the OpenHarmony Driver Foundation. It supports cross-OS migration, component adaptation, and modular assembly and compilation. Based on the unified APIs provided by the WLAN module, driver developers of WLAN vendors can adapt their driver code and developers of the hardware abstraction layer (HAL) are capable of creating, disabling, scanning, and connecting to WLAN hotspots. The following figure shows the framework of the WLAN module:

Figure 1 WLAN framework

WLAN Driver API Architecture

The WLAN module provides the following three types of APIs:

  • APIs for HAL developers
  • APIs that can be called directly by driver developers
  • APIs for driver developers of different vendors to implement

This document provides guidelines on how to initialize a WLAN module.

Figure 2 Available APIs of the WLAN module

Available APIs

The WLAN driver module provides APIs for HAL developers, such as creating, disabling, scanning, connecting to or disconnecting from WLAN hotpots.

The WLAN driver module provides APIs that can be directly called by driver developers, such as creating/releasing a WifiModule, connecting to/disconnecting from a WLAN hotspot, applying for/releasing a network data buffer, and converting between the pbuf structure of Lightweight TCP/IP Stack (lwIP) and a network data buffer.

Table 1 describes some APIs.

Table 1 APIs that can be directly called by driver developers

File

Function

Description

wifi_module.h

struct WifiModule *WifiModuleCreate(const struct HdfConfigWifiModuleConfig *config);

Creates a WifiModule.

void WifiModuleDelete(struct WifiModule *module);

Deletes and releases data of a WifiModule.

int32_t DelFeature(struct WifiModule *module, uint16_t featureType);

Deletes a feature from a WifiModule.

int32_t AddFeature(struct WifiModule *module, uint16_t featureType, struct WifiFeature *featureData);

Adds a feature to a WifiModule.

wifi_mac80211_ops.h

int32_t (*startAp)(NetDevice *netDev);

Starts an AP.

int32_t (*stopAp)(NetDevice *netDev);

Stops an AP.

int32_t (*connect)(NetDevice *netDev, WifiConnectParams *param);

Starts a connection.

int32_t (*disconnect)(NetDevice *netDev, uint16_t reasonCode);

Cancels a connection.

hdf_netbuf.h

static inline void NetBufQueueInit(struct NetBufQueue *q);

Initializes a network data buffer queue.

struct NetBuf *NetBufAlloc(uint32_t size);

Applies for a network data buffer.

void NetBufFree(struct NetBuf *nb);

Releases a network data buffer.

struct NetBuf *Pbuf2NetBuf(const struct NetDevice *netdev, struct pbuf *lwipBuf);

Converts the pbuf structure of lwIP to a network data buffer.

struct pbuf *NetBuf2Pbuf(const struct NetBuf *nb);

Converts a network data buffer to the pbuf structure of lwIP.

The WLAN driver module provides APIs for driver developers to implement capabilities, such as initializing/deregistering, opening/stopping a network device, and obtaining the state of a network device.

Table 2 describes some APIs.

Table 2 APIs for driver developers of WLAN vendors to implement

File

Function

Description

net_device.h

int32_t (*init)(struct NetDevice *netDev);

Initializes a network device.

struct NetDevStats *(*getStats)(struct NetDevice *netDev);

Obtains the state of a network device.

int32_t (*setMacAddr)(struct NetDevice *netDev, void *addr);

Sets the MAC address.

void (*deInit)(struct NetDevice *netDev);

Deinitializes a network device.

int32_t (*open)(struct NetDevice *netDev);

Opens a network device.

int32_t (*stop)(struct NetDevice *netDev);

Stops a network device.

1
https://gitee.com/vv-justdoit/docs.git
git@gitee.com:vv-justdoit/docs.git
vv-justdoit
docs
docs
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891