Android HAL 例 蓝牙模块

来源:互联网 发布:数据库 删除表drop 编辑:程序博客网 时间:2024/06/06 16:29

1,hw module

设备模块类型定义:

/hardware/libhardware/include/hardware/hardware.h


打开hw module

hardware.c

int hw_get_module(const char *id, const struct hw_module_t **module)

通过id获得module信息块--hmi

io和so名称匹配及so存放路径查找原则参考该函数实现。


2,打开设备

通过hmi的open方法打开设备

err = module->methods->open(module, id, &abstraction);

3,设备私有方法访问

使用前downcast到具体的设备模块类型:

           bluetooth_module_t* btStack = (bluetooth_module_t *)abstraction;

调用模块自己的方法:

         sBluetoothInterface = btStack->get_bluetooth_interface();

4,设备模块实现:

/external/bluetooth/bluedroid/btif/src/bluetooth.c


0 0
原创粉丝点击