android蓝牙移植,android bluetooth 移植相关注意事项

bluedroid的通用架构框图:

40cc12771cac501beb4455bb4511bce7.png

由上图可知,bluedroid包含如下的核心组件:

Bluetooth core stack library

HCI library

Vendor Specific HCI library

UART, RFKILL,TUN/TAP and UHID device drivers

移植过程

基于android上bluedroid上的蓝牙移植涉及到文件有:

bluetooth.apk

bludroid协议栈涉及到的库:

bluetooth.default.so

libbt-hci.so

libbt-utils.so

libbt-vendor.so

audio.a2dp.default.so

android.hardware.bluetooth.xml:该文件用于控制是否显示蓝牙的设置界面,位于/etc/permissions/目录下

bluetooth.default.so依赖于libbt-hci.so、libbt-utils.so、libbt-vendor.so等动态库,该库是蓝牙bluedroid协议栈的核心,该库的核心文件bluetooth.c实现了蓝牙的HAL层。

该硬件抽象层对应的接口定义如下(hardware/include/hardware/bluetooth.h):

/** NOTE: By default, no profiles are initialized at the time of init/enable.

*  Whenever the application invokes the 'init' API of a profile, then one of

*  the following shall occur:

*

*    1.) If Bluetooth is not enabled, then the Bluetooth core shall mark the

*        profile as enabled. Subsequently, when the application invokes the

*        Bluetooth 'enable', as part of the enable sequence the profile that were

*        marked shall be enabled by calling appropriate stack APIs. The

*        'adapter_properties_cb' shall return the list of UUIDs of the

*        enabled profiles.

*

*    2.) If Bluetooth is enabled, then the Bluetooth core shall invoke the stack

*        profile API to initialize the profile and trigger a

*        'adapter_properties_cb' with the current list of UUIDs including the

*        newly added profile's UUID.

*

*   The reverse shall occur whenever the profile 'cleanup' APIs are invoked

*/

/** Represents the standard Bluetooth DM interface. */

typedefstruct{

/** set to sizeof(bt_interface_t) */

size_tsize;

/**

* Opens the interface and provides the callback routines

* to the implemenation of this interface.

*/

int(*init)(bt_callbacks_t* callbacks );

/** Enable Bluetooth. */

int(*enable)(void);

/** Disable Bluetooth. */

int(*disable)(void);

/** This ensures the chip is Powered ON  to support other radios in the combo chip.

* If the chip is OFF it set the chip to ON, if it is already ON it just increases the radio ref count

* to keep track when to Power OFF */

int(*enableRadio)(void);

/** This decreases radio ref count  and ensures that chip is Powered OFF

* when the radio ref count becomes zero. */

int(*disableRadio)(void);

/** Closes the interface. */

void(*cleanup)(void);

/** Get all Bluetooth Adapter properties at init */

int(*get_adapter_properties)(void);

/** Get Bluetooth Adapter property of 'type' */

int(*get_adapter_property)(bt_property_type_t type);

/** Set Bluetooth Adapter property of 'type' */

/* Based on the type, val shall be one of

* bt_bdaddr_t or bt_bdname_t or bt_scanmode_t etc

*/

int(*set_adapter_property)(constbt_property_t *property);

/** Get all Remote Device properties */

int(*get_remote_device_properties)(bt_bdaddr_t *remote_addr);

/** Get Remote Device property of 'type' */

int(*get_remote_device_property)(bt_bdaddr_t *r

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值