Android bluetooth
来源:互联网 发布:js只能输入数字 编辑:程序博客网 时间:2024/04/26 15:56
在SystemServer启动的时候,会生成一个BluetoothDeviceService的实例
//skip bluetooth if we have an emulator kernel
//TODO:Use a more reliable check to see if this product should
// support Bluetooth
if(SystemProperties.get("ro.kernel.qemu").equals("1")){
Log.i(TAG, "Registering null Bluetooth Service(Emulator)");
ServiceManager.addService(Context.BLUETOOTH_SERVICE,null);
} else if(factoryTest == SystemServer.FACTORY_TEST_LOW_LEVEL) {
Log.i(TAG, "Registering null Bluetooth Service(factory test)");
ServiceManager.addService(Context.BLUETOOTH_SERVICE,null);
} else {
Log.i(TAG, "Starting Bluetooth Service");
bluetooth = new BluetoothDeviceService(context);
bluetooth.init();
ServiceManager.addService(Context.BLUETOOTH_SERVICE,bluetooth);
int bluetoothOn = Settings.System.getInt(mContentResolver,Settings.System.BLUETOOTH_ON, 0);
if( bluetoothOn > 0){
bluetooth.enable(null);
}
}
BluetoothDeviceService会生成一个BluetoothEventLoop的实例,它们两者均通过DBUS来和
BlusZ通信。BluetoothDeviceService是通过DBUS向BlueZ发送命令,儿命令的返回结果则是
由BlueZ通过DBUS传回给BluetoothEventLoop的(具体交互请参加BlueZ的dbus_api.txt),
BlueZ也会通过DBUS向BluetoothEventLoop发送一些事件通知。BluetoothEventLoop和外部
的接口是通过预先定义的Intent,
初始的时候蓝牙是没有使能的,是通过BluetoothSettings或者WirelessSettings来打开蓝牙设备
,然后通过BluetoothSettings去查找附近的其他蓝牙设备,找到后可以建立RFCOMM连接和配对。
- [Bluetooth] Android Bluetooth
- Bluetooth--- android -- 蓝牙 bluetooth
- Android Bluetooth
- Android bluetooth
- Android Bluetooth
- android Bluetooth
- Android Bluetooth
- android bluetooth
- android bluetooth
- Android Bluetooth
- Android Bluetooth
- android bluetooth
- Android Bluetooth
- Android Bluetooth
- android.bluetooth
- android bluetooth
- Android-Bluetooth
- Android Bluetooth
- 防止sql注入
- Cisco路由器Frame-relay故障问题现象及解决方案
- 说说我们开发中编写的文档
- 堆的算法
- 如何在一个工程中嵌入模块
- Android bluetooth
- Java开源 代码分析器
- 关于JNDI的描述
- 第一个简单的Yacc程序
- (C#)中的身份模拟/帐户模拟(编程方式实现)(转载)
- 探索 Emacs 中 Ibuffer.el 的使用方法
- 江湖
- ASP.NET MVC框架之视图View(五)
- Apache HTTP Server 与 Tomcat 的三种连接方式介绍