Android平台开发-Bluez function porting-蓝牙功能移植
来源:互联网 发布:淘宝二手市场靠谱吗 编辑:程序博客网 时间:2024/05/16 00:34
一、Bluez编译配置支持
在BoardConfig.mk中添加:
BOARD_HAVE_BLUETOOTH := true。
二、启动hciattach
在BoardConfig.mk中添加:
BOARD_HAVE_BLUETOOTH := true。
二、启动hciattach
BlueZ核心子系统使用hciattach守护进程添加指定的硬件串口驱动。
修改init.rc来启动hciattach:
修改init.rc来启动hciattach:
service hciattach /system/bin/hciattch -n -s 115200 /dev/ttyS2 bcm2035 115200
user bluetooth
group bluetooth net_bt_admin
disabled
同时也要启动dbus daemon,因为bluez需要dbus与其它进程通讯的。
user bluetooth
group bluetooth net_bt_admin
disabled
同时也要启动dbus daemon,因为bluez需要dbus与其它进程通讯的。
三、Bluez控制流程
class bluetoothsetting是UI的入口,通过按button scan进入搜索状态,
applicaton层调用bluetoothdevice, 接着就是bluetoothservice的调用,
bluetoothservice调用native方法,到此全部的java程序结束了。
下面的调用都是JNI, cpp实现的。android_server_bluetoothservice.cpp里面实现了native
applicaton层调用bluetoothdevice, 接着就是bluetoothservice的调用,
bluetoothservice调用native方法,到此全部的java程序结束了。
下面的调用都是JNI, cpp实现的。android_server_bluetoothservice.cpp里面实现了native
方法,最终通过dbus封装,调用 HCID deamon 的function DiscoverDevice。
Bluetooth的启动流程是:
1. 打开蓝牙电源,通过rfkill来enable;(system/bluetooth/bluedroid/bluetooth.c)
2. 启动service hciattch -n -s 115200 /dev/ttyS2 bcm2035 115200;
3. 检测HCI是否成功(接受HCIDEVUP socket来判断或hciconfig hci0 up);
4. hcid deamon start up。
2. 启动service hciattch -n -s 115200 /dev/ttyS2 bcm2035 115200;
3. 检测HCI是否成功(接受HCIDEVUP socket来判断或hciconfig hci0 up);
4. hcid deamon start up。
四、Bluetooth结构
1、JAVA层
frameworks/base/core/java/android/bluetooth/
包含了bluetooth的JAVA类。
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/。
还有其他一些测试代码和工具。
来源:http://blog.chinaunix.net/uid-24605155-id-191630.html
- Android平台开发-Bluez function porting-蓝牙功能移植
- Android平台开发-Bluez function porting-蓝牙功能移植
- Android平台开发-Bluez function porting-蓝牙功能移植
- Android平台开发-Bluez function porting-蓝牙功能移植
- Android平台开发-Bluez function porting-蓝牙功能移植
- Android平台开发-WIFI function porting-WIFI功能移植
- Android平台开发-WIFI function porting-WIFI功能移植
- Android平台开发-WIFI function porting-WIFI功能移植
- Android平台开发-WIFI function porting-WIFI功能移植
- Android平台开发-WIFI function porting-WIFI功能移植
- Android平台开发-WIFI function porting-WIFI功能移植
- Android平台开发-3G function porting-3G功能移植
- Android平台开发-WIFI function porting-WIFI功能移植
- Android平台开发-3G function porting-3G功能移植
- Android平台开发-WIFI function porting-WIFI功能移植
- Android平台开发-WIFI function porting-WIFI功能移植
- 007-Android平台开发-SD function porting-SD功能移植
- 【转】Android平台开发-3G function porting-3G功能移植
- 12套超酷的后台管理员界面网站模板
- C# 中的委托和事件
- LinkedList实现Queue并实现线程的同步
- 百度笔试题目集合
- 关键路径
- Android平台开发-Bluez function porting-蓝牙功能移植
- 关于mysql+mmm+amoeba+keepalived启动命令 保存
- android源码解析--switch
- poj 1014
- 无监督学习特征--稀疏编码、深度学习、ICA部分代表文献-------之一
- HTNL+CSS注意事项
- mysql amoeba安装配置步骤
- 爱奇艺面试记录--电话面试
- 简单图论:遍历所有最短路径