bluez plugins

When Bluetoothd initializing, it will load plugins in /usr/lib/bluetooth/plugins by default. Actually, most of bluetooth profiles are implemented as plugins in BlueZ.

In plugin.h, it defines:

struct bluetooth_plugin_desc {
const char *name;
int (*init) (void);
void (*exit) (void);
};

#define BLUETOOTH_PLUGIN_DEFINE(name,init,exit) \
struct bluetooth_plugin_desc bluetooth_plugin_desc = { \
name, init, exit \
};

It means that if you want to implement a plugin, just try to implement to callback functions: init and exit. All other communctions should be communicated with socket or IO channel.

Search macro BLUETOOTH_PLUGIN_DEFINE, you will find:

  1. BLUETOOTH_PLUGIN_DEFINE(“audio”, audio_init, audio_exit)
  2. BLUETOOTH_PLUGIN_DEFINE(“input”, input_init, input_exit)
  3. BLUETOOTH_PLUGIN_DEFINE(“network”, network_init, network_exit)
  4. BLUETOOTH_PLUGIN_DEFINE(“echo”, echo_init, echo_exit)
  5. BLUETOOTH_PLUGIN_DEFINE(“storage”, storage_init, storage_exit)  //no implementation actually
  6. BLUETOOTH_PLUGIN_DEFINE(“serial”, serial_init, serial_exit)

Implement on serial plugin

  1. Connect to dbus system bus;
  2. btd_register_adapter_driver(&serial_proxy_driver);
  3. btd_register_device_driver(&serial_port_driver);
  4. communicate others with socket and dbus;

Implement on echo

  1. Communicate RFCOMM with socket;
  2. Use IO channel for internal event;

Implement on audio

  1. Connect to Dbus system bus;
  2. Load audio.conf;
  3. According to settings, start headset, audio gateway, sink, source, control service;
  4. Register device drivers;

Implement on input

It is similar with audio.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值