豆浆机改装记(6): Android BLE 开发阶段总结
来源:互联网 发布:淘宝网买篮球 编辑:程序博客网 时间:2024/04/30 03:08
技术交流QQ:1356438802
欢迎留言!^_^
低功耗蓝牙包括的术语及概念:
如上图所示,使用低功耗蓝牙可以包括多个Profile,一个Profile中有多个Service,一个Service中有多个Characteristic,一个Characteristic中包括一个value和多个Descriptor。
Android中进行蓝牙开发需要使用到的类的执行过程是:
1、使用BluetoothAdapter.startLeScan来扫描低功耗蓝牙设备
2、在扫描到设备的回调函数中会得到BluetoothDevice对象,并使用BluetoothAdapter.stopLeScan停止扫描
3、使用BluetoothDevice.connectGatt来获取到BluetoothGatt对象
4、执行BluetoothGatt.discoverServices,这个方法是异步操作,在回调函数onServicesDiscovered中得到status,通过判断status是否等于BluetoothGatt.GATT_SUCCESS来判断查找Service是否成功
5、如果成功了,则通过BluetoothGatt.getService来获取BluetoothGattService
6、接着通过BluetoothGattService.getCharacteristic获取BluetoothGattCharacteristic
7、然后通过BluetoothGattCharacteristic.getDescriptor获取BluetoothGattDescriptor
Android Bluetooth源码静态类图如下:
- 豆浆机改装记(6): Android BLE 开发阶段总结
- 豆浆机改装记(3): Android BLE 蓝牙开发略解
- 豆浆机改装记(1): Android BLE框架
- 豆浆机改装记(4): Android BLE 编码正式入门
- 豆浆机改装记(5): Android BLE 编码入门 稍进一步
- 豆浆机改装记(2): Android4.3 蓝牙BLE初步
- 豆浆机改装记(0): 为什么要改装豆浆机!
- 豆浆机改装记(8): Fragment测试
- Android BLE 开发总结
- Android BLE开发总结
- 豆浆机改装记(7): 关于UI界面的构思
- Android BLE 开发常见问题总结
- Android蓝牙4.0 BLE开发坑总结
- Android 蓝牙4.0 BLE 开发总结
- Android蓝牙4.0 BLE开发坑总结
- Android BLE开发总结第一篇
- Ble 开发 个人总结
- [Android实例] BLE总结
- golang 数组 slice 乱序
- Block - 5
- 漫谈 HMM之三:Kalman/Particle Filtering
- UVa1375- The Best Name for Your Baby
- 短网址dwz.cn批量注册
- 豆浆机改装记(6): Android BLE 开发阶段总结
- 路上遭遇警察盘查 不知道他们的行为是否合法
- 使用TortoiseGit从github上下载源码
- 记录
- 读代码整洁之道 clean code一些命名规则
- Android原生json类org.json.JSONObject初步使用
- 安装collectl
- Hello world
- Android中ContentProvider组件详解