您的位置:首页 > 移动开发 > Android开发

A2DP Sink, AVRCP Controller and HFP Client in Android L

2015-11-25 11:37 555 查看



时间:2015-08-25 16:46:09 阅读:384 评论:0
收藏:0 [点我收藏+]

标签:bluetooth a2dp
sink hfp client avrcp
controller
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.


a2dp sink 在android kk(4.4)和L(5.0)实现的区别

2015-03-05 15:28 898人阅读 评论(0) 收藏 举报


分类:

bluetooth a2dp sink BT(7)


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

bluetooth HID dev, HFP client ,a2dp sink在android平台已经支持,下面做下简单说明:

在高通平台android4.4已经实现了a2dp sink,只要打开BTA_AVK_INCLUDED这个定义就可以启用a2dp sink的功能。

不过存在一个问题:在两个手机配对成功后,如果手机a主动连接手机b,那么手机a就会作为sourc端,断开连接后,如果b去主动连接a那么b就成为source端。

在5.0中 framework通过系统属性“persist.service.bt.a2dp.sink”在打开蓝牙时进行sink和source的判断,一旦确定角色就不会因为发起连接的不同而导致角色不同。

咋打开蓝牙时执行AdapterService.java::processStart->checkA2dpState(),根据系统属性把需要禁用的角色服务放到HashSet mDisabledProfiles中,然后启动需要的角色服务,然后启动其他需要启动的服务。

Bluedroid中通过BTA_AV_SINK_INCLUDED来控制a2dp sink功能的启用。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: