Bluetooth(android 4.2.2版本)
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.
Bluetooth(android 4.2.2版本)的更多相关文章
- 【原创】Android 4.4前后版本读取图库图片方式的变化
Android 4.4前后版本读取图库图片方式的变化 本文讲述Android 4.4(KitKat)前后访问图库以及访问后通过图片路径读取图片的变化 Android 4.4(KitKat)以前 ...
- Android SDK与API版本的对应关系
看教程.开发Android程序等很多地方,需要设置Android SDK的版本,而其要我们写的却是API版本的数字, 为了方便查看 Android SDK与API版本的对应关系 我在SDK Manag ...
- 【Android】Android Studio3.1 Mac版本设置项目桌面icon
近来项目处于测试阶段,工作少了许多,就装了个最新的Android Studio,想写一下安卓.新建好项目,想设置个桌面的icon.我先准备好自己的icon图片,然后复制粘贴到res/mipmap-hd ...
- Android Studio发布Release版本之坑--Unknown host 'd29vzk4ow07wi7.cloudfront.net'
使用Android Studio发布Release版本时,出现Unknown host 'd29vzk4ow07wi7.cloudfront.net'...错误. 解决方法:修改本机的DNS为8.8. ...
- 【转】Android SDK,ADT,API 版本的对应关系
写对应关系之前,先了解一下几个名字的含义. 一. Android ADT: 按照官方网站的开发介绍:Android Development Tools (ADT) is a plugin for th ...
- Android 打包出现jdk版本错误的问题
Android 打包出现 jdk 版本错误的问题,本质上是 SDK 的问题,与 JDK 无关.如果 SDK 的 API 是24或者更高,就要求 jdk 1.8,我这里指定的 API 是22,所以去勾选 ...
- Xamarin Android项目提示SDK版本太老
Xamarin Android项目提示SDK版本太老 错误信息:The installed Android SDK is too old.Version 24.3.4 or newer is requ ...
- 我的Android进阶之旅------>Android中高低API版本兼容使用@TargetApi或者@SuppressLint("NewApi")
Android中高低API版本兼容使用@TargetApi或者@SuppressLint("NewApi") 例如:AndroidManifest.xml中,我们配置了sdk版本的 ...
- 对Android 8.0以上版本通知点击无效的一次分析
版权声明:本文为xing_star原创文章,转载请注明出处! 本文同步自http://javaexception.com/archives/178 对Android 8.0以上版本通知点击无效的一次分 ...
随机推荐
- GDOI2017 五一游玩记
GDOI2017 到辣! 在五一比赛,成功躲了两天文化课. Day 0 早上睡到挺晚,想着同学在上课,我在睡觉,暗爽... 动车上,拿起电脑就是颓废,打模板!(然而真相是打了两个模板就开始颓了) 一天 ...
- 关于C# get set的简单用法
关于C# get set的文章很多,但是笔者的这篇文章有它的特别之处,笔者用简单的语言把c# get set讲述的十分明了. C# get set释一:属性的访问器包含与获取(读取或计算)或设置(写) ...
- kylin入门到实战:入门
版权申明:转载请注明出处.文章来源:http://bigdataer.net/?p=292 排版乱?请移步原文获得更好的阅读体验 1.概述 kylin是一款开源的分布式数据分析工具,基于hadoop之 ...
- [Network Architecture]Mask R-CNN论文解析(转)
前言 最近有一个idea需要去验证,比较忙,看完Mask R-CNN论文了,最近会去研究Mask R-CNN的代码,论文解析转载网上的两篇博客 技术挖掘者 remanented 文章1 论文题目:Ma ...
- VirtualBox 安装增强功能失败 解决方法
参考:virtualbox安装增强功能时[未能加载虚拟光盘] 在安装VirtualBox并配置虚拟机之后,想要安装增强功能:设备 => 安装增强功能. 出现未能加载虚拟光盘问题. 解决方法: 进 ...
- class.getResource()和getResourceAsStream的用法
转自:http://blog.csdn.net/lcj8/article/details/3502849 class.getResource()的用法 用JAVA获取文件,听似简单,但对于很多像我这样 ...
- poj 1050 To the Max 最大子矩阵和 经典dp
To the Max Description Given a two-dimensional array of positive and negative integers, a sub-rect ...
- 修改sublime侧边栏的颜色
Ctrl+Shift+P -> install -> 搜索安装包SyncedSidebarBg,自动同步侧边栏底色为编辑窗口底色.
- (转)SQL Server中的索引结构与疑惑
说实话我从没有在实际项目中使用过索引,仅知道索引是一个相当重要的技术点,因此我也看了不少文章知道了索引的区别.分类.优缺点以及如何使用索引.但关于索引它最本质的是什么笔者一直没明白,本文是笔者带着这些 ...
- 堆 Heap
2018-03-01 20:38:34 堆(Heap)是可以用来实现优先的队列的数据结构,而不是堆栈. 若采用数组或者链表实现优先队列 若采用树的结构 如果采用二叉搜索树,那么每次删除,比如删除最大值 ...