2022.4.18
一 、Bluetooth结构
1、JAVA层
bluetooth的JAVA类 frameworks/base/core/java/android/bluetooth/
2、JNI层
frameworks/base/core/jni/android_bluetooth_开头的文件
bluez通过JNI到上层的接口
frameworks/base/core/jni/android_server_bluetoothservice.cpp
调用硬件适配层的接口system/bluetooth/bluedroid/bluetooth.c
3、bluez库
external/bluez/
bluez用户空间的库,开源的bluetooth代码,包括很多协议,生成libbluetooth.so。
4、硬件适配层
system/bluetooth/bluedroid/bluetooth.c 对硬件操作的接口
system/bluetooth/data/* 一些配置文件,复制到/etc/bluetooth/
还有其他一些测试代码和工具。
二、Bluetooth开发涉及的4种类
1、BluetoothAdapter,蓝牙适配器,可判断蓝牙设备是否可用等功能。
常用12种方法列举如下(字母顺序):
cancel