成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

跟著小白一起學鴻蒙# [十一] WiFi & 藍牙子系統

系統 OpenHarmony
Wi-Fi與IEEE 802.11常常被混淆,兩者的區別可以概述為IEEE 802.11是一種無線局域網標準,而Wi-Fi是IEEE 802.11標準的一種實現。

??想了解更多關于開源的內容,請訪問:??

??51CTO 開源基礎軟件社區??

??https://ost.51cto.com??

概述

名詞解釋

WiFi:Wi-Fi or WiFi(/?wa?fa?/?)[1][a]?, is a family of wireless network protocols?, based on the IEEE 802.11? family of standards, which are commonly used for local area networking? of devices and Internet? access, allowing nearby digital devices to exchange data by radio waves.

Wi?Fi is a trademark of the non-profit Wi-Fi Alliance?, which restricts the use of the term Wi-Fi Certified to products that successfully complete interoperability certification testing.

藍牙:Bluetooth is a short-range wireless? technology standard that is used for exchanging data between fixed and mobile devices over short distances using UHF radio waves? in the ISM bands?, from 2.402 GHz to 2.48 GHz, and building personal area networks (PANs).

Bluetooth is managed by the Bluetooth Special Interest Group? (SIG), which has more than 35,000 member companies in the areas of telecommunication, computing, networking, and consumer electronics. The IEEE? standardized Bluetooth as IEEE 802.15.1, but no longer maintains the standard. The Bluetooth SIG oversees development of the specification, manages the qualification program, and protects the trademarks.[4]? A manufacturer must meet Bluetooth SIG standards to market it as a Bluetooth device.

問題

  1. Wi-Fi是什么?
  2. 藍牙是什么?
  3. Wi-Fi和藍牙的最大區別是什么?

本章主要參考資料

  1. https://en.wikipedia.org/wiki/Wi-Fi。
  2. https://en.wikipedia.org/wiki/Bluetooth。

標準

Wi-Fi標準:IEEE 802.11(b/a/n/ac/ax/be,第一代至第七代)。

Wi-Fi與IEEE 802.11常常被混淆,兩者的區別可以概述為IEEE 802.11是一種無線局域網標準,而Wi-Fi是IEEE 802.11標準的一種實現。

藍牙標準:IEEE 802.15.1

運行機制

OSI:

#沖刺創作新星# #跟著小白一起學鴻蒙# [十一] WiFi & 藍牙子系統-開源基礎軟件社區

Wi-Fi:

  • Infrastructure:所有數據通過一個base station。典型應用就是電腦,路由,外設(電腦,NAS,打印機等);
  • Ad hoc and Wi-Fi direct:兩個設備直連。Ad hoc存在不同網絡類型,簡單網絡即兩個設備直連,負載類型可轉發數據包(帶路由能力),典型應用就是手機熱點;Wi-Fi direct則只應用在文件傳輸和多媒體文件分享;還有一種直連方式為TDLS(Tunneled Direct-Link Setup),指在相同Wi-Fi網絡內互相通信(不通過AP);
  • Multiple access points:通過配置SSID和安全設定使得其他設備可接入Wi-Fi網絡;

參考文檔:

https://wireless.wiki.kernel.org/en/users/documentation/modes。

Bluetooth:

#沖刺創作新星# #跟著小白一起學鴻蒙# [十一] WiFi & 藍牙子系統-開源基礎軟件社區

架構

鴻蒙架構

#沖刺創作新星# #跟著小白一起學鴻蒙# [十一] WiFi & 藍牙子系統-開源基礎軟件社區

Linux架構

#沖刺創作新星# #跟著小白一起學鴻蒙# [十一] WiFi & 藍牙子系統-開源基礎軟件社區

Android架構

WIFI

#沖刺創作新星# #跟著小白一起學鴻蒙# [十一] WiFi & 藍牙子系統-開源基礎軟件社區

結構

  • 鴻蒙

  • Linux

  • Android

  • 目錄架構
  1. 整體目錄
.
├── applications //*應用層(settings,photo等)
├── ark //ArkUI,為js和ts應用提供支持
├── base //*基礎子系統(應用引擎:賬號、位置、通知、電話…子系統)
├── build //編譯框架
├── build.py -> build/lite/build.py //編譯腳本
├── build.sh -> build/build_scripts/build.sh //編譯腳本
├── developtools //開發工具
├── device //適配設備
├── docs //文檔
├── domains //
├── drivers //驅動
├── foundation //*能力子系統,提供(ace,communication,graphic…)
├── interface //js API d.ts
├── kernel //kernel,如linux,liteOS
├── prebuilts //預編譯庫
├── productdefine //產品形態配置
├── qemu-run -> vendor/ohemu/common/qemu-run
├── test //測試集合
├── third_party //第三方庫
├── utils //公共基礎庫,
└── vendor //其他廠商
  1. Wi-Fi目錄
├── interfaces              //接口
│ ├── innerkits //接口實現
│ │ ├── native_c //lite的接口實現
│ │ └── native_cpp //標準系統的接口實現
│ └── kits
│ └── jskits //d.ts接口定義
├── services
│ └── wifi_standard //標準Wi-Fi實現
│ ├── etc //服務配置
│ ├── ipc_framework //ipc服務(client,server)
│ ├── sa_profile //服務配置(wifi_manager_service:libwifi_device_ability.z.so[1125], libwifi_scan_ability.z.so[1126],libwifi_hotspot_ability.z.so[[1127],libwifi_p2p_ability.z.so[[1128]])
│ ├── wifi_framework //wifi_system_ability(device,hotspot,p2p,scan),wifi_manager(ap,p2p,scan,sta),dhcp_manager(client,server,manager))
│ └── wifi_hal
├── tests
│ └── wifi_standard
│ ├── ipc_framework
│ ├── wifi_framework
│ └── wifi_hal
└── utils
├── inc
│ ├── wifi_common_util.h
│ └── wifi_hisysevent.h
└── src
├── BUILD.gn
├── wifi_common_util.cpp
└── wifi_hisysevent.cpp

機制

Title: Wifi Enabel 命令調用流程
wifi.ets ->WifiModel: enableWifi(開wifi)
Note right of WifiModel: foundation(接口,服務)
Note left of wifi.ets: Setting(頁面,組件)
WifiModel -> @ohos.wifi: enableWifi
@ohos.wifi -> WifiDeviceImpl: EnableWifi
WifiDeviceImpl-->WifiDeviceServiceImpl: EnableWifi(softbus)

注意

  • WiFi結構
.
├── figures //markdown的圖片
├── hisysevent.yaml //事件定義
├── interfaces //接口
│ ├── innerkits
│ │ ├── native_c //lite的接口
│ │ └── native_cpp //標準系統的接口
│ └── kits
│ └── jskits //js接口的定義文件d.ts
├── services //服務
│ └── wifi_standard //標準系統(主要用于對接softbus)
│ ├── etc //服務配置
│ ├── ipc_framework //ipc(rpc)框架
│ ├── sa_profile //動態服務拉起(wifi,scan,hotspot,p2p)
│ ├── wifi_framework //實現(dhcp,wifi)
│ └── wifi_hal //硬件接口適配層
├── tests //測試
│ └── wifi_standard
│ ├── ipc_framework
│ ├── wifi_framework
│ └── wifi_hal
└── utils
  • 服務、功能、狀態
/* -----------Feature service name-------------- */
#define WIFI_SERVICE_STA "StaService" /* STA */
#define WIFI_SERVICE_AP "ApService" /* AP */
#define WIFI_SERVICE_P2P "P2pService" /* P2P */
#define WIFI_SERVICE_SCAN "ScanService" /* SCAN */
/* ---------Feature service ability id */
#define WIFI_DEVICE_ABILITY_ID 1125
#define WIFI_SCAN_ABILITY_ID 1126
#define WIFI_HOTSPOT_ABILITY_ID 1127
#define WIFI_P2P_ABILITY_ID 1128
/* ---------Feature system status */
#define MODE_STATE_SCREEN (1)
#define MODE_STATE_AIR_PLANE (2)
#define MODE_STATE_APP_RUN (3)
#define MODE_STATE_POWER_SAVING (4)
#define MODE_STATE_FREEZE (5)
#define MODE_STATE_NO_CHARGER_PLUG (6)
/* ---------Feature wifi status */
#define MODE_STATE_OPEN (1)
#define MODE_STATE_CLOSE (2)
Title: Wifi Enabel 執行流程
WifiDeviceServiceImpl ->WifiConfigCenter: GetWifiMidState(狀態)
Note right of WifiConfigCenter: 狀態
Note left of WifiDeviceServiceImpl: 實現
WifiDeviceServiceImpl -> WifiP2pServiceImpl: EnableP2p
WifiDeviceServiceImpl->WifiConfigCenter: SetWifiMidState(OPENING)
WifiDeviceServiceImpl->IStaService:EnableWifi
IStaServie -> StaStateMachine: 發命令
WifiDeviceServiceImpl->WifiSettings:SyncWifiConfig

注意

  • WifiConfigCenter里的狀態:CLOSED/CLOSING/OPENING/RUNNING/UNKNOWN。
  • StaMachine里的狀態:
#define WIFI_SVR_CMD_STA_ENABLE_WIFI 0x2001
#define WIFI_SVR_CMD_STA_DISABLE_WIFI 0x2002
#define WIFI_SVR_CMD_STA_OPERATIONAL_MODE 0x2003
#define WIFI_SVR_CMD_STA_CONNECT_NETWORK 0x2004
#define WIFI_SVR_CMD_STA_CONNECT_SAVED_NETWORK 0x2005
#define WIFI_SVR_CMD_STA_RECONNECT_NETWORK 0x2006
#define WIFI_SVR_CMD_STA_REASSOCIATE_NETWORK 0x2007
#define WIFI_SVR_CMD_STA_DISCONNECT 0x2008
#define WIFI_SVR_CMD_STA_STARTWPS 0x2009
#define WIFI_SVR_CMD_STA_CANCELWPS 0x200A
#define WIFI_SVR_COM_STA_START_ROAM 0x200B
#define WIFI_SVR_CMD_STA_ERROR 0x3001
#define WIFI_SVR_CMD_STA_SUP_CONNECTION_EVENT 0x3002
#define WIFI_SVR_CMD_STA_SUP_DISCONNECTION_EVENT 0x3003
#define WIFI_SVR_CMD_STA_NETWORK_CONNECTION_EVENT 0x3004
#define WIFI_SVR_CMD_STA_NETWORK_DISCONNECTION_EVENT 0x3005
#define WIFI_SVR_CMD_STA_WPS_START_EVENT 0x3006
#define WIFI_SVR_CMD_STA_WPS_CANCEL_EVENT 0x3007
#define WIFI_SVR_CMD_STA_WPS_FAILED_EVENT 0x3008
#define WIFI_SVR_CMD_STA_WPS_OVERLAP_EVENT 0x3009
#define WIFI_SVR_CMD_STA_WPS_TIMEOUT_EVNET 0x300A
#define WIFI_SVR_CMD_STA_WPS_WEP_PROHIBITED 0x300B
#define WIFI_SVR_CMD_STA_WPS_TKIP_ONLY_PROHIBITED 0x300C
#define WIFI_SVR_CMD_STA_WPS_AUTH_FAILURE 0x300D
#define WIFI_SVR_CMD_STA_WPS_OVERLAP_ERROR 0x300E
#define WIFI_SVR_CMD_STA_SUP_REQUEST_IDENTITY 0x300F
#define WIFI_SVR_CMD_STA_SUP_REQUEST_SIM_AUTH 0x3010
#define WIFI_SVR_CMD_STA_AUTHENTICATION_FAILURE_EVENT 0x3011
#define WIFI_SVR_CMD_STA_REASON_TKIP_ONLY_PROHIBITED 0x3012
#define WIFI_SVR_CMD_STA_REASON_WEP_PROHIBITED 0x3013
#define WIFI_SVR_CMD_STA_CONFIG_AUTH_FAILURE 0x3014
#define WIFI_SVR_CMD_STA_CONFIG_MULTIPLE_PBC_DETECTED 0x3015
#define WIFI_SVR_CMD_STA_WPA_STATE_CHANGE_EVENT 0x3016
#define WIFI_SVR_CMD_STA_WPA_PASSWD_WRONG_EVENT 0x3017
#define WIFI_SVR_CMD_STA_WPA_FULL_CONNECT_EVENT 0x3018
#define WIFI_SVR_CMD_STA_WPA_ASSOC_REJECT_EVENT 0x3019
graph TD;
RootStat --> InitState;
RootStat --> WpaStartingState;
RootStat --> WpaStartedState;
RootStat --> WpaStoppingState;
WpaStartedState --> LinkState;
LinkState --> SeparatingState;
LinkState --> SeparatedState;
LinkState --> ApLinkedState;
ApLinkedState --> GetIpState;
ApLinkedState --> LinkedState;
ApLinkedState --> ApRoamingState;
LinkState --> pWpsState;

實現

#沖刺創作新星# #跟著小白一起學鴻蒙# [十一] WiFi & 藍牙子系統-開源基礎軟件社區

//drivers/pripheral/wlan
.
├── client
├── figures
├── hal
├── hdi_service
├── interfaces
└── test

藍牙

結構

  • 鴻蒙架構

#沖刺創作新星# #跟著小白一起學鴻蒙# [十一] WiFi & 藍牙子系統-開源基礎軟件社區

  • Linux架構

#沖刺創作新星# #跟著小白一起學鴻蒙# [十一] WiFi & 藍牙子系統-開源基礎軟件社區

  • Android架構

#沖刺創作新星# #跟著小白一起學鴻蒙# [十一] WiFi & 藍牙子系統-開源基礎軟件社區

  • 目錄架構
  1. 整體目錄
.
├── applications //*應用層(settings,photo等)
├── ark //ArkUI,為js和ts應用提供支持
├── base //*基礎子系統(應用引擎:賬號、位置、通知、電話…子系統)
├── build //編譯框架
├── build.py -> build/lite/build.py //編譯腳本
├── build.sh -> build/build_scripts/build.sh //編譯腳本
├── developtools //開發工具
├── device //適配設備
├── docs //文檔
├── domains //
├── drivers //驅動
├── foundation //*能力子系統,提供(ace,communication,graphic…)
├── interface //js API d.ts
├── kernel //kernel,如linux,liteOS
├── prebuilts //預編譯庫
├── productdefine //產品形態配置
├── qemu-run -> vendor/ohemu/common/qemu-run
├── test //測試集合
├── third_party //第三方庫
├── utils //公共基礎庫,
└── vendor //其他廠商
  1. Bluetooth目錄
.
├── interfaces //接口
│ ├── innerkits
│ │ ├── native_c //輕量級接口
│ │ └── native_cpp //標準版接口
│ └── kits
│ ├── js //d.ts接口功能定義
│ └── napi //接口實現
├── sa_profile
│ ├── 1130.xml //bluetooth_service
│ └── BUILD.gn
└── services
├── bluetooth
│ └── BUILD.gn //輕量級定義
└── bluetooth_standard
├── common //btcommon
├── etc //服務配置
├── external //dummy數據
├── hardware //硬件適配
├── ipc //ipc通信
├── server //藍牙服務
├── service //藍牙profile(a2dp[snk,src],acrcp[ct,tg],ble,classic,gatt,a2dp,hfp[ag,hf],map[mce,mse],obex,pbap[pce,pse]
└── stack //藍牙協議棧(hci,l2cap,rfcomm,sdp,smp,gap,btm,avdtp,acctp,att)

機制

Title: Bluetooth調用流程
bluetooth.ets ->deviceController: toggleValue(開關)
Note right of deviceController: 控制器(接口)
Note left of bluetooth.ets: Setting(頁面)
deviceController -> BluetoothModel: enableBluetooth
BluetoothModel->@ohos.bluetooth: enableBluetooth
@ohos.bluetooth->BluetoothHost: EnableBluetooth
Title: Bluetooth使能流程
napi_bluetooth_host ->BluetoothHost: EnableBt(開關)
napi_bluetooth_host ->BluetoothHost: EnableBle(開關)
BluetoothHost -> BluetoothHostProxy: enableBluetooth
BluetoothHostProxy -> BluetoothHostProxy: InnerTransact
BluetoothHostProxy -> IRemoteObject: SendRequest
  • Observer
SystemStateObserver
├── OnSystemStateChange
BTSystemState::ON:

AdapterStateObserver
AdapterClassicObserver
ClassicRemoteDeviceObserver
ClassicRemoteDeviceObserver
AdapterBleObserver
BlePeripheralCallback

實現

#沖刺創作新星# #跟著小白一起學鴻蒙# [十一] WiFi & 藍牙子系統-開源基礎軟件社區

  1. 協議棧

模塊

全稱

功能

對應模塊

HCI

Host Controller Interface

The HCI protocol provides a com- mand interface to the Bluetooth chipset。

L2CAP

Logical Link Control and Adaptation Protocal

The L2CAP protocol supports higher level protocol multiplexing and packet frag- mentation. It provides the base for the RFCOMM and BNEP protocols.

L2CAP LE

LE Connection-Oriented Channels with LE Credit-Based Flow-Control Mode

LE Data Channels are similar to Classic L2CAP Channels but also provide a credit-based flow control similar to RFCOMM Channels. Unless the LE Data Packet Extension of Bluetooth Core 4.2 specification is used, the maximum packet size for LE ACL packets is 27 bytes.

RFCOMM

Radio Frequency Communication Protocol

RFCOMM provides emulation of serial ports over the L2CAP protocol and reassembly. It is the base for the Serial Port Profile and other profiles used for telecommunication like Head-Set Profile, Hands-Free Profile, Object Exchange (OBEX) etc.

SDP

Service Discovery Protocol

The SDP protocol allows to an- nounce services and discover services provided by a remote Bluetooth device.

BNEP

Bluetooth Network Encapsulation Protocol

The BNEP protocol is used to transport control and data packets over standard network protocols such as TCP, IPv4 or IPv6. It is built on top of L2CAP, and it specifies a minimum L2CAP MTU of 1691 bytes。

ATT

Attribute Protocol

SMP

Security Manager Protocol

AVDTP

Audio/Video Distribution Transport Protocol

AVCTP

Audio/Video Control Transport Protocol

  1. Profile


模塊

全稱

功能

對應

GATT

Generic Attribute Profile

For every LE device defines how one device can interact with GATT Services on a remote device.

GAP

Generic Access Profile

For every Bluetooth device defines how devices find each other and how they establish a connection.

SPP

Serial Port Profile

SPP basically specifies that a compatible device should provide a Service Discovery Protocol (SDP) record containing an RFCOMM channel number, which will be used for the actual communication.

HSP

Headset Profile

The HSP profile defines how a Bluetooth- enabled headset should communicate with another Bluetooth enabled device.

HFP

Hands-Free Profile

The HFP profile defines how a Bluetooth- enabled device, e.g. a car kit or a headset, can be used to place and receive calls via a audio gateway device, typically a mobile phone.

HID

Human-Interface Device

The HID profile allows an HID Host to connect to one or more HID Devices and communicate with them.

MFi/iAP2

PBAP

Phone Book Access Profile

PBAP defines the protocols and procedures that shall be used by devices for the retrieval of phone book objects. It is based on a Client-Server interaction model where the Client device pulls phone book objects from the Server device.

SDAP

Service Discovery Application Profile

SDAP describes how an application should use SDP to discover services on a remote device. SDAP requires that any application be able to find out what services are available on any Bluetooth enabled device it connects to.

PAN

Personal Area Networking Profile

The PAN profile uses BNEP to provide on-demand networking capabilities between Bluetooth devices.

A2DP

Advanced Audio Distribution

The A2DP profile defines how to stream audio over a Bluetooth connection from one device, such as a mobile phone, to another device such as a headset.

MESH

Mesh networking

??想了解更多關于開源的內容,請訪問:??

??51CTO 開源基礎軟件社區??

??https://ost.51cto.com??。

責任編輯:jianghua 來源: 51CTO開源基礎軟件社區
相關推薦

2022-10-10 14:47:04

藍牙應用鴻蒙

2022-12-02 14:20:09

Tetris鴻蒙

2022-11-29 16:35:02

Tetris鴻蒙

2022-10-09 15:05:50

NAPI框架鴻蒙

2023-03-30 09:32:27

2022-11-14 17:01:34

游戲開發畫布功能

2022-11-22 15:15:46

Wi-Fi鴻蒙

2022-11-08 15:43:45

開源鴻蒙藍牙協議棧

2023-04-04 09:24:11

鴻蒙HiDumper

2023-02-27 16:30:32

鴻蒙開源協議分析

2022-08-19 19:02:20

開源鴻蒙操作系統

2023-03-30 09:19:54

SELinux安全子系統

2022-11-25 16:48:54

鴻蒙Stage HAP

2023-01-03 15:09:10

鴻蒙常用工具

2022-11-24 14:34:41

Hap程序鴻蒙

2022-12-06 15:39:16

鴻蒙主干代碼

2023-03-15 16:19:03

BinderIPC工具

2022-10-20 16:40:16

JS應用控制LED鴻蒙

2022-10-17 14:29:24

鴻蒙應用開發

2023-04-06 09:18:52

鴻蒙AVPlayerAVRecorder
點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 亚洲毛片在线观看 | 久久综合伊人 | 日韩二| 成人av免费网站 | 热久久免费视频 | 人人精品| 日本一区二区在线视频 | 免费在线观看黄视频 | 久久精品无码一区二区三区 | 久久久久久国产精品 | 国产99久久 | 久久久一区二区三区 | 网站黄色在线免费观看 | 成人av电影网 | 欧美自拍第一页 | 日本精品视频在线观看 | 亚洲精品久久久久久久久久久久久 | av毛片| 99re在线播放| 免费毛片网 | 久久久久久久久精 | 妞干网福利视频 | 日韩欧美在线观看视频网站 | 九一精品| 亚洲第一女人av | 色成人免费网站 | 日韩第1页 | 日本亚洲一区 | 国产日韩精品在线 | 日韩精品免费看 | 久久久久国产精品 | 伊人网在线综合 | 看片91| 综合精品在线 | 羞羞视频在线观免费观看 | 在线一区视频 | 国产一区二区三区免费视频 | 特级毛片www| 国产成人精品免高潮在线观看 | 97伦理电影| 日韩一区二区在线视频 |