了解藍牙
經(jīng)典藍牙和低功耗藍牙差異
經(jīng)典藍牙(Bluetooth Classic):分為基本速率/增強數(shù)據(jù)速率(BR/EDR), 79個信道,在2.4GHz的(ISM)頻段。支持點對點設(shè)備通信,主要用于實現(xiàn)無線音頻流傳輸,已成為無線揚聲器、耳機和車載娛樂系統(tǒng)背后的標準無線電協(xié)議。經(jīng)典藍牙還支持數(shù)據(jù)傳輸程序,包括移動打印。
低功耗藍牙(Bluetooth Low Energy):為低功耗操作而設(shè)計的。工作在2.4GHz無授權(quán)ISM頻段,共40個信道傳輸數(shù)據(jù)。藍牙LE支持多種通信拓撲,點對點,廣播,Mesh。使藍牙能夠支持創(chuàng)建可靠的、大規(guī)模的網(wǎng)絡(luò)。LE也被廣泛用于設(shè)備定位技術(shù),滿足高精度室內(nèi)定位服務的需求。
經(jīng)典藍牙和低功耗藍牙差異 - 知乎
藍牙的配對和連接的建立過程
taodudu.cc/news/show-3161112.html?action=onClick
Qt藍牙模塊
支持的平臺
?Qt 5.14 adds a native Win32 port supporting Classic Bluetooth on Windows 7 or newer, and Bluetooth LE on Windows 8 or newer. It must be enabled at build time by configuration option -native-win32-bluetooth. The UWP backend is used by default if this option is not set and the Win32 target platform supports the required UWP APIs (minimal requirement is Windows 10 version 1507, with slightly improved service discovery since Windows 10 version 1607).
使用
環(huán)境
版本:Qt15.15.2
語言:c++
平臺:Android 11
藍牙類型:經(jīng)典藍牙(Bluetooth Classic)
代碼和說明
使用前在pro文件加載藍牙模塊
QT += bluetooth
大家都有使用藍牙的經(jīng)歷,一般步驟是:檢查藍牙狀態(tài)(是否打開)->查找附近的設(shè)備->配對->連接->數(shù)據(jù)的傳輸,下面就按照這個流程介紹代碼。
- 檢查藍牙狀態(tài)(是否打開)
QBluetoothLocalDevice提供了獲取和設(shè)置本地藍牙設(shè)備狀態(tài)的功能。?
可通過文章來源:http://www.zghlxwxcb.cn/news/detail-486960.html
QBluetoothLocalDevice::HostMode QB文章來源地址http://www.zghlxwxcb.cn/news/detail-486960.html
到了這里,關(guān)于藍牙客戶端QBluetoothSocket的使用——Qt For Android的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!