未验证 提交 160c0fe4 编写于 作者: O openharmony_ci 提交者: Gitee

!10480 [翻译完成】#I5OMW4

Merge pull request !10480 from Annie_wang/PR1001
...@@ -111,12 +111,12 @@ The WLAN module provides the following types of APIs: ...@@ -111,12 +111,12 @@ The WLAN module provides the following types of APIs:
| API| Description| | API| Description|
| -------- | -------- | | -------- | -------- |
| int32_t (\*init)(struct NetDevice \*netDev) | Initializes a network device. | | int32_t (\*init)(struct NetDevice \*netDev) | Initializes a network device.|
| struct NetDevStats \*(\*getStats)(struct NetDevice \*netDev) | Obtains the state of 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.| | int32_t (\*setMacAddr)(struct NetDevice \*netDev, void \*addr) | Sets the MAC address.|
| void (\*deInit)(struct NetDevice \*netDev) | Deinitializes a network device. | | void (\*deInit)(struct NetDevice \*netDev) | Deinitializes a network device.|
| int32_t (\*open)(struct NetDevice \*netDev) | Opens a network device. | | int32_t (\*open)(struct NetDevice \*netDev) | Opens a network device.|
| int32_t (\*stop)(struct NetDevice \*netDev) | Stops a network device. | | int32_t (\*stop)(struct NetDevice \*netDev) | Stops a network device.|
- The WLAN Driver module provides APIs that you can directly use to create or release a **WifiModule**, connect to or disconnect from a WLAN hotspot, request or release a **NetBuf**, and convert between the **pbuf** structure of Lightweight IP (lwIP) and a **NetBuf**. - The WLAN Driver module provides APIs that you can directly use to create or release a **WifiModule**, connect to or disconnect from a WLAN hotspot, request or release a **NetBuf**, and convert between the **pbuf** structure of Lightweight IP (lwIP) and a **NetBuf**.
...@@ -439,6 +439,7 @@ The following uses the Hi3881 WLAN chip as an example to describe how to initial ...@@ -439,6 +439,7 @@ The following uses the Hi3881 WLAN chip as an example to describe how to initial
} }
return wal_deinit_drv_wlan_netdev(netDevice); return wal_deinit_drv_wlan_netdev(netDevice);
} }
``` ```
During the chip initialization process, call **NetDeviceInit()** to initialize a network device, call **NetDeviceAdd()** to add the network device to a protocol stack, and hook function pointers of **netdev**. During the chip initialization process, call **NetDeviceInit()** to initialize a network device, call **NetDeviceAdd()** to add the network device to a protocol stack, and hook function pointers of **netdev**.
...@@ -511,12 +512,11 @@ The following uses the Hi3881 WLAN chip as an example to describe how to initial ...@@ -511,12 +512,11 @@ The following uses the Hi3881 WLAN chip as an example to describe how to initial
hi_u32 ret = NetDeviceAdd(netdev, (Protocol80211IfType)type); hi_u32 ret = NetDeviceAdd(netdev, (Protocol80211IfType)type);
... ...
return HI_SUCCESS; return HI_SUCCESS;
} }
``` ```
3. Bind the commands to be delivered, including setting the MAC address and transmit power, implement STA connection and scan, start APs, and setting the country code. 3. Bind the commands to be delivered, including setting the MAC address and transmit power, implement STA connection and scan, start APs, and setting the country code.
```c ```c
...@@ -580,7 +580,7 @@ The following uses the Hi3881 WLAN chip as an example to describe how to initial ...@@ -580,7 +580,7 @@ The following uses the Hi3881 WLAN chip as an example to describe how to initial
4. Invoke the event reporting APIs. 4. Invoke the event reporting APIs.
The WLAN framework provides the event reporting APIs. For example, call **HdfWiFiEventNewSta AP** to report information about the newly associated STA. For details, see **hdf_wifi_event.c**. The WLAN framework provides the event reporting APIs. For details, see hdf_wifi_event.c. For example, call **HdfWiFiEventNewSta AP** to report information about the newly associated STA.
```c ```c
hi_u32 oal_cfg80211_new_sta(oal_net_device_stru *net_device, const hi_u8 *mac_addr, hi_u8 addr_len, hi_u32 oal_cfg80211_new_sta(oal_net_device_stru *net_device, const hi_u8 *mac_addr, hi_u8 addr_len,
...@@ -678,7 +678,7 @@ Develop test cases in the WLAN module unit test to verify the basic features of ...@@ -678,7 +678,7 @@ Develop test cases in the WLAN module unit test to verify the basic features of
exit 0 exit 0
``` ```
- Create a **udhcpd.conf** file (used to start the **udhcpd**) and copy the following content to the file: - Create a **udhcpd.conf** file (used to start the **udhcpd**) and copy the following content to the file. In the following, **opt dns** *x.x.x.x* *x.x.x.x* indicates two DNS servers configured. You can configure DNS servers as required.
```text ```text
start 192.168.12.2 start 192.168.12.2
...@@ -692,7 +692,7 @@ Develop test cases in the WLAN module unit test to verify the basic features of ...@@ -692,7 +692,7 @@ Develop test cases in the WLAN module unit test to verify the basic features of
offer_time 60 #default: 60 (1 minute) offer_time 60 #default: 60 (1 minute)
min_lease 60 #defult: 60 min_lease 60 #defult: 60
lease_file /vendor/etc/udhcpd.leases lease_file /vendor/etc/udhcpd.leases
opt dns 10.221.0.11 8.8.8.8 opt dns x.x.x.x x.x.x.x
option subnet 255.255.255.0 option subnet 255.255.255.0
opt router 192.168.12.1 opt router 192.168.12.1
``` ```
...@@ -734,7 +734,7 @@ Develop test cases in the WLAN module unit test to verify the basic features of ...@@ -734,7 +734,7 @@ Develop test cases in the WLAN module unit test to verify the basic features of
4. On the mobile phone, select the network named **test** in the available Wi-Fi list and enter the password. 4. On the mobile phone, select the network named **test** in the available Wi-Fi list and enter the password.
The network name and password are configured in the **hostapd.conf** file. You can see the network name in the connected Wi-Fi list if the connection is successful. The network name and password are configured in the **hostapd.conf** file. You can see that network name in the connected Wi-Fi list if the connection is successful.
5. Ping the test terminal from the development board. 5. Ping the test terminal from the development board.
...@@ -742,7 +742,7 @@ Develop test cases in the WLAN module unit test to verify the basic features of ...@@ -742,7 +742,7 @@ Develop test cases in the WLAN module unit test to verify the basic features of
busybox ping xxx.xxx.xxx.xxx busybox ping xxx.xxx.xxx.xxx
``` ```
In the command, xxx.xxx.xxx.xxx indicates the IP address of the test terminal. If the test terminal can be pinged, the basic features of the WLAN driver are implemented successfully. In the command, xxx.xxx.xxx.xxx indicates the IP address of the test terminal. If the test terminal can be pinged, the WLAN driver provides basic features normally.
- Verify basic STA features. - Verify basic STA features.
...@@ -771,7 +771,7 @@ Develop test cases in the WLAN module unit test to verify the basic features of ...@@ -771,7 +771,7 @@ Develop test cases in the WLAN module unit test to verify the basic features of
busybox ping xxx.xxx.xxx.xxx busybox ping xxx.xxx.xxx.xxx
``` ```
In the command, xxx.xxx.xxx.xxx indicates the IP address of the test terminal. If the test terminal can be pinged, the basic features of the WLAN driver are implemented successfully. In the command, xxx.xxx.xxx.xxx indicates the IP address of the test terminal. If the test terminal can be pinged, the WLAN driver provides basic features normally.
3. Verify the unit test cases. 3. Verify the unit test cases.
...@@ -872,6 +872,8 @@ Develop test cases in the WLAN module unit test to verify the basic features of ...@@ -872,6 +872,8 @@ Develop test cases in the WLAN module unit test to verify the basic features of
#define MAC_LEN 6 #define MAC_LEN 6
#define HDF_SUCCESS 0 #define HDF_SUCCESS 0
#define HDF_FAILURE (-1) #define HDF_FAILURE (-1)
```
static int32_t hal_main() static int32_t hal_main()
{ {
...@@ -924,8 +926,6 @@ Develop test cases in the WLAN module unit test to verify the basic features of ...@@ -924,8 +926,6 @@ Develop test cases in the WLAN module unit test to verify the basic features of
} }
``` ```
4. Verify the test cases. 4. Verify the test cases.
1. Push the test cases to the development board. 1. Push the test cases to the development board.
...@@ -944,8 +944,12 @@ Develop test cases in the WLAN module unit test to verify the basic features of ...@@ -944,8 +944,12 @@ Develop test cases in the WLAN module unit test to verify the basic features of
./ Test case name. ./ Test case name.
``` ```
3. Check the test case execution result. 3. Check the test case execution result.
## Reference ## Reference
- Code repositories: - Code repositories:
...@@ -974,7 +978,9 @@ Develop test cases in the WLAN module unit test to verify the basic features of ...@@ -974,7 +978,9 @@ Develop test cases in the WLAN module unit test to verify the basic features of
**//drivers/hdf_core/framework/model/network/wifi** **//drivers/hdf_core/framework/model/network/wifi**
- External APIs of the WLAN module:**//drivers/hdf_core/framework/include/wifi** - External APIs of the WLAN module:
**//drivers/hdf_core/framework/include/wifi**
- HDF network model APIs: - HDF network model APIs:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册