开始使用蓝牙是高中的时候,传图片传mp3,需要配对什么的。当时诺基亚手机很少支持,不像现在那么普及,所有智能手机都有。
大学的时候瞎折腾,蓝牙小车经典蓝牙模块型号是HC-05主从一体串口透传模块
,当时是想做个蓝牙开关,从CSDN上找到了蓝牙的app源码于是有了这样的想法。
只是大概记住了有下面一些特性,没去注意蓝牙芯片型号、厂商。
AT指令操作它,有效范围10米;
点对点,主从切换;
经典蓝牙2.0
很幸运参加了2018蓝牙亚洲大会,会议日程安排有重叠,作为开发者主要参加了蓝牙实践课程培训:定制蓝牙外围设备开发、蓝牙beacon、蓝牙mesh组网。
蓝牙联盟成员共33.793个,2017年发货4亿件。应用领域:楼宇、工业生产、音频、室内定位导航、车载等。
ARM指出蓝牙或者Iot面临的四大障碍 : 功耗、成本、安全、云连接
序号 | 版本 | 时间 | 说明 |
---|---|---|---|
1 | 起源 | 1998 | 起源于RS-232有线转无线,使用2.4GHz ISM band |
2 | 经典蓝牙(4.0之前) | 2004 | 2.1就开始引入安全机制,3.0允许选用合适的RF |
3 | 双模 | 2010 | 4.0 ~ 4.1(低功耗+经典)双模 ;4.0~4.2引入了新功能 |
4 | 5.0 | 2016 | 数据带宽+广播机制 |
PhyLayer
controls transmission/receiving of the 2.4Ghz radio with bluetooth communication channels . BR/EDR provides more channels withe narrower bandwidth,while LE uses fewer channels but broder bandwidth .
Linklayer
Defines packet structure/channels, discovery/connection procedure and sends/receives data .
Direct Test Mode
Allows testers to instruct the packets, submitting commands to it either via the HCI or via a 2-wire UART interface .
Attribute (ATT) - Defines the client/server protocol for data exchange once a connection is established .Attributes are grouped together into meaningful services using the Generic Attribute Profile(GATT) . ATT is used in LE implementations and occasionally is BR/EDR implementations .
Security Manager - 设备鉴权、加密
Defines the protocol and behavior that manages pairing integrity, authentication and encryption between Bluetooth devices, and provides a toolbox of security funcations that other components use to support almost any level of security needed by diverse applications .
Host to Controller Interface(HCI) - 针对手机等带操作系统的主机
Optional standard interface between the Bluetooth controller subsystem(bottom three layers) and the Bluetooth host .
Logical Link Control and Adaptation Protocol (L2CAP) Layer - 多条逻辑链路复用一条物理链路
A packet-based protocol that transmits packets to the HCI or directly to the Link Layer in a hostless system . Supports higher-level protocol multiplexing, packet segmentation and reassembly , and the conveying of quality of service information to higher layers.
Generic Access Profile(GAP)
Works in conjunction with GATT in Bluetooth LE implementations to define the procedures and roles related to the discovery of Bluetooth devices and sharing information, and link management aspects of connecting to Bluetooth devices.
Generic Attribute Profile (GATT) - 服务框架
Using the Attribute Protocol, GATT groups services that encapsulate the behavior of part of a device and describes a use case, roles and general behaviors based on the GATT functionality. its service framework defines procedures and formats if services and their characteristics, including discovering , reading ,writing , notifying and indicating characteristics , as well as configuring the broadcast of characteristics . GATT is used only in Bluetooth LE implementations .
根据香农定理,如何去做到低功耗、低信噪比,channel减小→信噪比降低→功耗减小,蓝牙5采用3个主要广播通道、37个次要广播和数据通道用于分担主信道负载。
如何评价一个好的bt产品:RF功耗、兼容性
蓝牙5 新特性:
2倍的速度;4倍的距离;8倍的广播数据包。
速度和范围可配置,距离远了相应的传输速度也变会变慢。
管理型网络泛洪:
多路径;
无单点故障;
无需为路由功能而消耗内存;
网络容量取决于多重因素;
TTL、心跳和消息缓存;
可对中继(Relay)进行配置。
消息和状态:
节点通过消息通信,节点具有状态值。访问消息基于状态值进行操作(set-状态变更、get-查询状态值、status-发送当前状态)基于消息和状态,提供订阅和发布功能,对应access message帧结构。
friendship
需要RAM占存消息,它支持的低功耗节点越多、消耗的RAM也越多:
RAM消耗 = 低功耗节点数量 * 暂存buf数量 * buf长度;
还需知道何种中断源能够唤醒休眠节点;知道有多少种低功耗模式支持选择合适的模式;知道从休眠到待机需要多久。
GAP - 广播
主要职责:广播,设备搜索,建立连接
后续会继续学习蓝牙并补充细节:
ibeacon数据帧
广播负载
Eddystone帧格式
广播数据帧四种类型(EID - 加密且可变的报文 、 url、uid - 广播唯一信标id、TLM - 广播遥测运行状态)
provisioning架构和流程
appkey
element / model
参考 www.bluetooth.com