蓝牙开发笔记

MFI ======= make for ipad ,iphone, itouch 专们为苹果设备制作的设备
 
BLE ==== buletouch low energy,蓝牙4.0设备因为低耗电,所以也叫做BLE
 
peripheral,central == 外设和中心,发起连接的时central,被连接的设备为perilheral
 
peripheral,central == 外设和中心,发起连接的时central,被连接的设备为perilheral

service and characteristic === 服务和特征 每个设备会提供服务和特征,类似于服务端的api,但是机构不同。每个外设会有很多服务,每个服务中包含很多字段,这些字段的权限一般分为 读read,写write,通知notiy几种,就是我们连接设备后具体需要操作的内容。

Description 每个characteristic可以对应一个或多个Description用户描述characteristic的信息或属性

MFI === 开发使用ExternalAccessory 框架

 
4.0 BLE === 开发使用CoreBluetooth 框架
 
 
蓝牙中心模式流程
 
1. 建立中心角色
2. 扫描外设(discover)
3. 连接外设(connect)
4. 扫描外设中的服务和特征(discover)
    - 4.1 获取外设的services
    - 4.2 获取外设的Characteristics,获取Characteristics的值,获取Characteristics的Descriptor和Descriptor的值
5. 与外设做数据交互(explore and interact)
6. 订阅Characteristic的通知
7. 断开连接(disconnect)
 
 
蓝牙外设模式流程
1. 启动一个Peripheral管理对象
2. 本地Peripheral设置服务,特性,描述,权限等等
3. Peripheral发送广告
4. 设置处理订阅、取消订阅、读characteristic、写characteristic的委托方法
 
 
蓝牙设备状态
1. 待机状态(standby):设备没有传输和发送数据,并且没有连接到任何设
2. 广播状态(Advertiser):周期性广播状态
3. 扫描状态(Scanner):主动寻找正在广播的设备
4. 发起链接状态(Initiator):主动向扫描设备发起连接。
5. 主设备(Master):作为主设备连接到其他设备。
6. 从设备(Slave):作为从设备连接到其他设备。
 
 
蓝牙设备的五种工作状态
原文地址:https://www.cnblogs.com/air-liyan/p/6126647.html