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.handhardware/libhardware/include/hardware/bt_*.hfiles. - 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-vendormodule. See thevendor/broadcom/libbt-vendordirectory for an example. - Host Controller Interface (HCI) - You can provide your own HCI by creating a
libbt-hcimodule, which is mainly used for debug tracing. See theexternal/bluetooth/hcidirectory 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以上版本通知点击无效的一次分 ...
随机推荐
- chrome中,BackstopJS 使用cookie文件后依旧提示需要登录
1. 本地环境: apache-tomcat:7.05,jdk8, backstopJS:latest-version 配置tomcat管理用户成功:手工访问tomcat应用内部服务正常: 2. 问 ...
- [P1860]新魔法药水
题目描述 商店里有N种药水,每种药水都有一个售价和回收价.小S攒了V元钱,还会M种魔法,可以把一些药水合成另一种药水.他一天可以使用K次魔法,问他一天最多赚多少钱? 输入输出格式 输入格式: 第一行四 ...
- Leetcode——Third Maximum Number
Question Given a non-empty array of integers, return the third maximum number in this array. If it d ...
- vue-router之学习笔记
用 Vue.js + vue-router 创建单页应用,是非常简单的.使用 Vue.js ,我们已经可以通过组合组件来组成应用程序,当你要把 vue-router 添加进来,我们需要做的是,将组件( ...
- JS书籍推荐
JS书籍推荐 一.总结 一句话总结: 二.JS进阶书籍 第一阶段:<JavaScript DOM编程艺术> 看这本书之前,请先确认您对Javascript有个基本的了解,应该知道if el ...
- MVVM模式的3种command总结[2]--RelayCommand
MVVM模式的3种command总结[2]--RelayCommand RelayCommand本来是WPF下面用的一种自定义的command,主要是它用到了事件管理函数,这个SL下面是没有的.不过这 ...
- ACM比赛辅导--授课内容
Lesson1(3月19日) 1.讲解Dev-C++.VC++6.0的单步调试方法 2.学习比赛的基本输入输出,练习C语言网的1085—1092 Lesson2(3月21日) 1.学习挑战程序设计,第 ...
- 15.并发容器之ConcurrentLinkedQueue
1.ConcurrentLinkedQueue简介 在单线程编程中我们会经常用到一些集合类,比如ArrayList,HashMap等,但是这些类都不是线程安全的类.在面试中也经常会有一些考点,比如Ar ...
- mac下通过brew切换php版本
第一步,先安装 brew Brew 是 Mac 下面的包管理工具,通过 Github 托管适合 Mac 的编译配置以及 Patch,可以方便的安装开发工具. Mac 自带ruby 所以安装起来很 ...
- Qt5.3中qml ApplicationWindow设置窗口无边框问题
这个版本的qt在这里有点bug.. 设置ApplicationWindow的flags属性为Qt.FramelessWindowHint的确可以使程序无边框,但是同时程序在任务栏的图标也没了. 看文档 ...