bluez 事件 联系

2018/03/02 11:05
阅读数 191

一直不知道 事件是怎么触发的.事件触发回调

觉得很神奇.很迷糊. 其实bluez不能单独的看,也要在 内核中看代码

文件src/adapter.c  (bluez)
...
    mgmt_register(adapter->mgmt, MGMT_EV_CONNECT_FAILED,
                        adapter->dev_id,
                        connect_failed_callback,
                        adapter, NULL);
                               
    mgmt_register(adapter->mgmt, MGMT_EV_DEVICE_UNPAIRED,
                        adapter->dev_id,
                        unpaired_callback,
                        adapter, NULL);
                               
    mgmt_register(adapter->mgmt, MGMT_EV_AUTH_FAILED,
                        adapter->dev_id,
                        auth_failed_callback,
                        adapter, NULL);                                                                                                                                       
                               
    mgmt_register(adapter->mgmt, MGMT_EV_NEW_LINK_KEY,
                        adapter->dev_id,
                        new_link_key_callback,
                        adapter, NULL);
文件  net/bluetooth/mgmt.c
...
static const u16 mgmt_events[] = {                                                                                                                                            
    MGMT_EV_CONTROLLER_ERROR,
    MGMT_EV_INDEX_ADDED,
    MGMT_EV_INDEX_REMOVED,
    MGMT_EV_NEW_SETTINGS,
    MGMT_EV_CLASS_OF_DEV_CHANGED,
    MGMT_EV_LOCAL_NAME_CHANGED,
    MGMT_EV_NEW_LINK_KEY,
    MGMT_EV_NEW_LONG_TERM_KEY,
    MGMT_EV_DEVICE_CONNECTED,
    MGMT_EV_DEVICE_DISCONNECTED,
    MGMT_EV_CONNECT_FAILED,
    MGMT_EV_PIN_CODE_REQUEST,
    MGMT_EV_USER_CONFIRM_REQUEST,
    MGMT_EV_USER_PASSKEY_REQUEST,
    MGMT_EV_AUTH_FAILED,
    MGMT_EV_DEVICE_FOUND,
    MGMT_EV_DISCOVERING,
    MGMT_EV_DEVICE_BLOCKED,
    MGMT_EV_DEVICE_UNBLOCKED,
    MGMT_EV_DEVICE_UNPAIRED,
    MGMT_EV_PASSKEY_NOTIFY,
    MGMT_EV_NEW_IRK,
    MGMT_EV_NEW_CSRK,
    MGMT_EV_DEVICE_ADDED,
    MGMT_EV_DEVICE_REMOVED,
    MGMT_EV_NEW_CONN_PARAM,
    MGMT_EV_UNCONF_INDEX_ADDED,
    MGMT_EV_UNCONF_INDEX_REMOVED,
    MGMT_EV_NEW_CONFIG_OPTIONS,


有没有觉得似曾相识. 好了可以接着看了.

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部