Bluetooth
Android provides a default Bluetooth stack, BlueDroid, that is divided into two layers: The Bluetooth Embedded System (BTE), which implements the core Bluetooth functionality and the Bluetooth Application Layer (BTA), which communicates with Android framework applications. A Bluetooth system service communicates with the Bluetooth stack through JNI and with applications through Binder IPC. The system service provides developers access to various Bluetooth profiles. The following diagram shows the general structure of the Bluetooth stack:
- Application framework
- At the application framework level is the app's code, which utilizes the android.bluetooth APIs to interact with the bluetooth hardware. Internally, this code calls the Bluetooth process through the Binder IPC mechanism.
- Bluetooth system service
- The Bluetooth system service, located in
packages/apps/Bluetooth
, is packaged as an Android app and implements the Bluetooth service and profiles at the Android framework layer. This app calls into the HAL layer via JNI. - JNI
- The JNI code associated with android.bluetooth is located in
packages/apps/Bluetooth/jni
. The JNI code calls into the HAL layer and receives callbacks from the HAL when certain Bluetooth operations occur, such as when devices are discovered. - HAL
- The hardware abstraction layer defines the standard interface that the android.bluetooth APIs and Bluetooth process calls into and that you must implement to have your bluetooth hardware function correctly. The header files for the Bluetooth HAL is located in the
hardware/libhardware/include/hardware/bluetooth.h
andhardware/libhardware/include/hardware/bt_*.h
files. - Bluetooth stack
- The default Bluetooth stack is provided for you and is located in
external/bluetooth/bluedroid
. The stack implements the generic Bluetooth HAL as well as customizes it with extensions and configuration changes. - Vendor extensions
- To add custom extensions and an HCI layer for tracing, you can create a libbt-vendor module and specify these components.
Implementing the HAL
The Bluetooth HAL is located in the hardware/libhardware/include/hardware/
directory and consists of the following header files:
bluetooth.h
: Contains the HAL for the Bluetooth hardware on the devicebt_av.h
: Contains the HAL for the advanced audio profile.bt_hf.h
: Contains the HAL for the handsfree profile.bt_hh.h
: Contains the HAL for the HID host profilebt_hl.h
: Contains the HAL for the health profilebt_pan.h
: Contains the HAL for the pan profilebt_sock.h
: Contains the HAL for the socket profile.
Keep in mind that your Bluetooth implementation is not constrained to the features and profiles exposed in the HAL. You can find the default implementation located in the BlueDroid Bluetooth stack in the external/bluetooth/bluedroid
directory, which implements the default HAL and also extra features and customizations.
Customizing the BlueDroid Stack
If you are using the default BlueDroid stack, but want to make a few customizations, you can do the following things:
- Custom Bluetooth profiles - If you want to add Bluetooth profiles that do not have HAL interfaces provided by Android, you must supply an SDK add-on download to make the profile available to app developers, make the APIs available in the Bluetooth system process app (
packages/apps/Bluetooth
), and add them to the BlueDroid stack (external/bluetooth/bluedroid
). - Custom vendor extensions and configuration changes - You can add things such as extra AT commands or device-specific configuration changes by creating a
libbt-vendor
module. See thevendor/broadcom/libbt-vendor
directory for an example. - Host Controller Interface (HCI) - You can provide your own HCI by creating a
libbt-hci
module, which is mainly used for debug tracing. See theexternal/bluetooth/hci
directory for an example.
http://source.android.com/devices/bluetooth.html
Bluetooth的更多相关文章
- 蓝牙Bluetooth技术小知识
蓝牙Bluetooth技术以及广泛的应用于各种设备,并将继续在物联网IoT领域担任重要角色.下面搜集整理了一些关于蓝牙技术的小知识,以备参考. 蓝牙Bluetooth技术始创于1994年,其名字来源于 ...
- 浅谈Bluetooth蓝牙开发
前言:项目用到蓝牙开发,具体蓝牙获取硬件传感器中的数据. 因为没有蓝牙开发的相关经验,决定先了解一些蓝牙开发的知识,再去看之前同事写的蓝牙相关代码. ------------------------- ...
- Bluetooth Low Energy 嗅探
Bluetooth Low Energy 嗅探 路人甲 · 2015/10/16 10:52 0x00 前言 如果你打开这篇文章时期望看到一些新的东西,那么很抱歉这篇文章不是你在找的那篇文章.因为严格 ...
- 例子:Bluetooth app to device sample
本例子演示了: 判断蓝牙是否打开,是通过一个HRsult值为0x8007048F的异常来判断的 catch (Exception ex) { if ((uint)ex.HResult == 0x800 ...
- core Bluetooth(蓝牙4.0)
蓝牙4.0以低功耗著称,一般也叫BLE(Bluetooth Low Energy). 目前主要应用的场景有:智能家居.运动手环和室内导航等. 利用core Bluetooth框架可以实现苹果设备与第三 ...
- Find out files transfered via Bluetooth
The case was about business secret and forensic guy did a physical acquisition from a smart phone. H ...
- 蓝牙(Bluetooth) IEEE 802.15.1 协议学习
catalogue . 蓝牙概念 . 配对和连接 . 机密安全性 . 蓝牙协议分类 . 蓝牙协议栈 1. 蓝牙概念 蓝牙(Bluetooth)是一种无线技术标准,可实现固定设备.移动设备和楼宇个人域网 ...
- Overview and Evaluation of Bluetooth Low Energy: An Emerging Low-Power Wireless Technology
转自:http://www.mdpi.com/1424-8220/12/9/11734/htm Sensors 2012, 12(9), 11734-11753; doi:10.3390/s12091 ...
- bluetooth service uuid
转自:https://www.bluetooth.com/specifications/assigned-numbers/service-discovery service discovery ...
- bluetooth 蓝牙协议和标准,配置
Bluetooth 配置文件表达了一般行为,Bluetooth 设备可以通过这些行为与其它设备进行通信.Bluetooth 技术定义了广泛的配置文件,描述了许多不同类型的使用案例.为了使用 Bluet ...
随机推荐
- 【转】PS学堂之一:展示一下自己做的圆形印章
共分七个步骤: 1.点击文件--新建,新建一个500×500像素,背景为透明的文件,选择RGB颜色. 2.把前景色和文字颜色设置为正红(R为255,G和B为0). 3.在视图下拉菜单中选择标尺,将横. ...
- JS/jQuery宽高的理解和应用
1.widows:窗口.window对象可省略 2.document对象是window对象的一部分 浏览器的Html文档成为Document对象 window.location===document. ...
- backbone.Model 源码笔记
backbone.Model backbone的model(模型),用来存储数据,交互数据,数据验证,在view里面可以直接监听model来达到model一改变,就通知视图. 这个里面的代码是从bac ...
- 深入浅出ExtJS 第七章 弹出窗口
7.1 Ext.MessageBox 7.1 Ext.MessageBox //Ext.MessageBox为我们提供的alert/confirm/prompt等完全可以代替浏览器原生; 7.1.1 ...
- Oracle中的内置函数在sql中的转换整理
程序里面经常会即支持Oracle数据库,又支持sql数据库.而有些Oracle内置函数用的比较多,但在sql中语法有些不同,我做了些整理,希望可以帮助大家.... 1.oracle中的内置函数:ora ...
- JS正则表达式简单总结
正则表达式定义 JavaScript中的正则表达式用RegExp 对象表示,可以使用RegExp ()构造函数来创建RegExp对象,不过RegExp 对象更多的是通过一种特殊的直接量愈发来创建. 例 ...
- windows下,python+scrapy环境搭建
•安装lxml(官网给出的地址http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml,下载whl文件安装) •安装zope.interface https:// ...
- JavaScript之动画2
在JavaScript动画中,我们调用setInterval函数(setInterval动作的作用是在播放动画的时,每隔一定时间就调用函数,方法或对象),值得注意的是:setInterval它设置的时 ...
- 入门必须掌握8个DOS命令
一,ping 它是用来检查网络是否通畅或者网络连接速度的命令.作为一个生活在网络上的管理员或者黑客来说,ping命令是第一个必须掌握的DOS命令,它所利用的原理是这样的:网络上的机器都有唯一确定的IP ...
- mysql数据库用户和权限管理记录
一.MySQL用户的基本说明: 1.1 用户的基本结构MySQL的用户:用户名@主机 ■用户名:16个字符以内■主机:可以是主机名.IP地址.网络地址等主机名:www.111cn.net,localh ...