A2DP Sink, AVRCP Controller and HFP Client in Android L

The APIs of A2DP sink, AVRCP controller and HFP client are not published in Android L, but the code which implements the  profiles  is indeed in Android L. You can set the configuration for the car to build the code.

Where is the code?

  • A2DP sink

    • /frameworks/base/core/java/android/bluetooth/BluetoothA2dpSink.java
    • /packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpSinkService.java
    • /packages/apps/Bluetooth/src/com/android/bluetooth/a2dp/A2dpSinkStateMachine.java
    • /packages/apps/Bluetooth/jni/com_android_bluetooth_a2dp_sink.cpp
    • /hardware/libhardware/include/hardware/bt_av.h
  • AVRCP controller
    • /frameworks/base/core/java/android/bluetooth/BluetoothAvrcpController.java
    • /packages/apps/Bluetooth/src/com/android/bluetooth/avrcp/AvrcpControllerService.java
    • /packages/apps/Bluetooth/jni/com_android_bluetooth_avrcp_controller.cpp
  • HFP client
    • /frameworks/base/core/java/android/bluetooth/BluetoothHeadsetClient.java
    • /frameworks/base/core/java/android/bluetooth/BluetoothHeadsetClientCall.java
    • /packages/apps/Bluetooth/src/com/android/bluetooth/hfpclient/HeadsetClientHalConstants.java
    • /packages/apps/Bluetooth/src/com/android/bluetooth/hfpclient/HeadsetClientService.java
    • /packages/apps/Bluetooth/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java
    • /packages/apps/Bluetooth/jni/com_android_bluetooth_hfpclient.cpp
    • /hardware/libhardware/include/hardware/bt_hf_client.h

I does not list the files in bluedroid. You can find the files which are added or modified for A2DP sink, AVRCP controller and HFP client in the layers of BTIF, BTA and BTE(stack directory). An A2DP decoder locates in /external/bluetooth/bluedroid/embdrv/sbc/decoder/.

How to build the code?

Google develops A2DP sink, AVRCP controller and HFP client for Android Auto. car_hammerhead.mk is added in /device/lge/hammerhead/. You must add the product item ‘add_lunch_combo car_hammerhead-userdebug‘ in /device/lge/hammerhead/vendorsetup.sh. Then
run ‘lunch‘, and select ‘car_hammerhead-userdebug‘. Now you can build the image of car_hammerhead and flash the image to Nexus 5.

You can used hcitool and sdptool to browse all available services on Nexus 5 with car_hammerhead image.  You should see A2DP sink, AVRCP controller and HFP client in the list of available services. If you want to hear the sound from the speaker of Nexus
5 with car_hammerhead image, you have to develop the App which uses A2DP sink APIs to trigger the audio routing from from BT stack to speaker. If no App registers a listener to bluedroid, the audio data will be discarded before decoder.

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-07-30 18:27:12

A2DP Sink, AVRCP Controller and HFP Client in Android L的相关文章

蓝牙耳机规格(HFP、HSP、A2DP、AVRCP)简介

当两台蓝牙设备建立连接时,它们会获取对应设备提供的协议. 只有使用相同协议的设备才能交换数据,就像两个人要使用相同的语言才能进行有意义的对话一样.当蓝牙定义设备之间的物理无线连接时,蓝牙规格会建立这些设备能够使用蓝牙技术交换的命令和功能.HSP和HFP蓝牙规格是典型单声道蓝牙耳机操作所需的规格,A2DP和AVRCP对于立体声耳机很重要. HSP(手机规格,Head-Set-Profile) 这是最常用的配置,为当前流行支持蓝牙耳机与移动电话使用,提供手机与耳机之间通信所需的基本功能. 连接和配置

The Implementation of A2DP Sink in Android 4.4

A2DP Sink was not supported in Android 4.4. We implemented this feature which can be applied in the scenarios below. You can get the code from https://android-review.googlesource.com/#/c/98161/. We tested the solution on Nexus 5. Our solution include

在Android4.2中实现bluetooth A2dp Sink(一)——移植Android5.0蓝牙协议栈

一直以来,Android对于蓝牙的支持都很混乱,简直可以说是一坨shit.各个版本的协议栈都不一样,最早用的是bluez,进入4.x时代之后,换成了谷歌自己的bluedroid.换就换吧,至少等做完了再用吧,结果4.2.4.3.4.4的bluedroid全都不一样.这就对我等非专业蓝牙开发人员开发蓝牙制造了巨大的麻烦. 好了,吐槽到此为止,该说正事了.因为公司在做智能家居项目,需要在Android上实现蓝牙A2dp Sink的profile,这样我们的设备就能当蓝牙音箱来用了.我们是用的平台是全

在Android4.2中实现bluetooth A2dp Sink(二)——移植Android5.0蓝牙协议栈

在Android中,蓝牙系统的结构如下图所示: 在这个体系结构中,从下往上依次是模块驱动.蓝牙协议栈.Bluetooth.apk.Framework和各种蓝牙应用.其中,内核中的驱动是直接和硬件打交道的,一般由模块厂商提供.Android层中,最下面的是处理具体蓝牙协议的协议栈,里面包含了蓝牙各种profile的具体实现,Bluetooth.apk是蓝牙协议栈和framework之间的纽带,使用jni接口沟通了用java实现的framework和c实现的协议栈,并且实现了状态机来控制各种prof

CSR8670的A2DP与AVRCP的应用笔记

1. A2DP 1.1. 基本概念 阅读A2DP SPEC V12的1.1章,可知: Advanced Audio Distribution Profile(A2DP) 典型应用是立体声音乐播放器的音乐到耳机或扬声器的播放 目的是用来传输高品质的单声道或立体声音频,环绕声不能用A2DP传输 A2DP不包括遥控功能,用户需要同AVRCP组合使用 情景模式相互依赖关系: 1.2. 编码格式 The Advanced Audio Distribution Profile (A2DP) defines

Retrofit——A type-safe HTTP client for Android and Java(The first part)

一,介绍 Retrofit将你的http接口API转换成项目中的一个java的接口. public interface GitHubService { @GET("users/{user}/repos") Call<List<Repo>> listRepos(@Path("user") String user); } Retrofit会自动为上面的Service生成一个实现类. Retrofit retrofit = new Retrofit

【蓝牙音箱】小米小爱蓝牙音箱

小米小爱蓝牙音箱--产品外观 小米小爱蓝牙音箱 - - 产品参数 蓝牙版本:4.2 工作距离:10 米 额定阻抗:4Ω 支持协议:A2DP / AVRCP / SPP / HFP / BLE 声频响范围:200Hz~18kHz(-10dB) 供电方式:内置锂电池 充电端口:Micro USB电池容量:3.7V 480mAh 电池续航:4 小时( 70% 音量 ) 免提通话:支持 包装清单:音箱 × 1.说明书 × 1.挂绳 × 1 (不含 USB 充电线材) 小米小爱蓝牙音箱 - - 按键说明

SpringMVC综合使用手机管理系统Controller层开发

1. beans.xml的配置 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframewo

Passive Client Feature

Q. How is the passive client feature used on Wireless LAN Controllers? A. Passive clients are wireless devices, such as scales and printers that are configured with a static IP address. These clients do not transmit any IP information such as IP addr