diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2013-10-31 14:19:47 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-10-31 15:00:10 +0200 |
commit | 6a92a05be30733fe28af80e578dad187d4b12c45 (patch) | |
tree | abe784a20bdc702b2323ac42ecabdb77a4eaa937 /android/hal-hidhost.c | |
parent | 043fd76a2b35cc052f7a99fc9bfd183193bff39d (diff) | |
download | bluez-6a92a05be30733fe28af80e578dad187d4b12c45.tar.gz |
android/hal-hidhost: Add implementation of .connection_state_cb
Diffstat (limited to 'android/hal-hidhost.c')
-rw-r--r-- | android/hal-hidhost.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/android/hal-hidhost.c b/android/hal-hidhost.c index 032e96186..a72410bf1 100644 --- a/android/hal-hidhost.c +++ b/android/hal-hidhost.c @@ -31,6 +31,31 @@ static bool interface_ready(void) return bt_hh_cbacks != NULL; } +static void handle_conn_state(void *buf) +{ + struct hal_ev_hid_conn_state *ev = buf; + + if (bt_hh_cbacks->connection_state_cb) + bt_hh_cbacks->connection_state_cb((bt_bdaddr_t *) ev->bdaddr, + ev->state); +} + +/* will be called from notification thread context */ +void bt_notify_hh(uint16_t opcode, void *buf, uint16_t len) +{ + if (!interface_ready()) + return; + + switch (opcode) { + case HAL_EV_HID_CONN_STATE: + handle_conn_state(buf); + break; + default: + DBG("Unhandled callback opcode=0x%x", opcode); + break; + } +} + static bt_status_t hh_connect(bt_bdaddr_t *bd_addr) { struct hal_cmd_hid_connect cmd; |