程序员须知的蓝牙基础 -- 关键摘要参考

2021-12-25  本文已影响0人  打出了枫采

后文内容摘自于《Bluetooth Essentials for Programmers》一书。

0、蓝牙编程总体过程与IP网络编程类比

image.png
image.png

1、Discoverability and Connectability

发现能力与连接能力,即设备能否被扫描发现,能否进行连接

image.png
Inquiry Scan 表示设备能否被发现的;Page Scan表示设备会不会接受其它设备的连接请求
注意:蓝牙并不是主动广播自己的存在,然后被其它设备发现,而是要主动发起设备发现查询,收到其它设备的发现应答,才能找到周围的设备
Note: A common misconception is that when a Bluetooth device enters an area, it somehow “announces” its presence so that
other devices will know that it’s around. This never happens (even
though it’s not a bad idea), and the only way for one device to detect the presence of another is to conduct a device discovery.

2、蓝牙中涉及的各种传输协议简要说明

3、蓝牙编程中的端口

A port is used to allow multiple applications on the same device to simultaneously utilize the same 
transport protocol. Almost all Internet transport protocols in common usage are designed with the 
notion of port numbers.Bluetooth is no exception, but uses slightly different terminology. In L2CAP,
ports are called Protocol Service Multiplexers (PSM), and can take on oddnumbered values between 1 
and 32,767. Don’t ask why they have to be odd-numbered values, because you probably won’t get a 
convincing answer. In RFCOMM, channels 1–30 are available for use. Throughout the rest of
this book, the word port is used instead of protocol service multiplexer and
channel, mostly for clarity.

端口在不同的传输协议下有不同的含义,可能是指PSM 或者信道的ID编号
关于PSM 和 CID的理解区分,见 c - Bluetooth LE L2CAP CID vs. PSM - Stack Overflow

image.png

4、Service Discovery Protocol

更上层的协议,偏与实际应用相关


image.png
image.png

4、Bluetooth Profiles + RFCs

常见的profile,可在蓝牙技术官网查看更多细节 http://www.bluetooth.com/Bluetooth/Learn/Technology/Specifications/

image.png

5、Host Controller Interface

image.png

6、蓝牙协议栈

image.png image.png

蓝牙 参考资料:
链接:https://pan.baidu.com/s/1wKeFFJNI6TbZoUesqkby7g
提取码:f5ud

上一篇 下一篇

猜你喜欢

热点阅读