diff options
author | Marcin Kraglak <marcin.kraglak@tieto.com> | 2014-11-21 12:16:38 +0100 |
---|---|---|
committer | Szymon Janc <szymon.janc@tieto.com> | 2014-11-24 15:08:41 +0100 |
commit | 64f08bc02b12a402871d9f2c0e69829adfcba1be (patch) | |
tree | 704cc090fbd89390fe2faeb54056bfa017f5ac83 /android/hal-bluetooth.c | |
parent | e9b99f6a20e2b6af67ff6684c3562f9534c41fcf (diff) | |
download | bluez-64f08bc02b12a402871d9f2c0e69829adfcba1be.tar.gz |
android/hal-bluetooth: Implement get_connection_state
Diffstat (limited to 'android/hal-bluetooth.c')
-rw-r--r-- | android/hal-bluetooth.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/android/hal-bluetooth.c b/android/hal-bluetooth.c index 68811dfd6..defaef1ab 100644 --- a/android/hal-bluetooth.c +++ b/android/hal-bluetooth.c @@ -957,11 +957,26 @@ static int config_hci_snoop_log(uint8_t enable) #if ANDROID_VERSION >= PLATFORM_VER(5, 0, 0) static int get_connection_state(const bt_bdaddr_t *bd_addr) { + struct hal_cmd_get_connection_state cmd; + struct hal_rsp_get_connection_state rsp; + size_t rsp_len = sizeof(rsp); + bt_status_t status; + DBG("bdaddr: %s", bdaddr2str(bd_addr)); - /* TODO: implement */ + if (!interface_ready()) + return 0; - return BT_STATUS_UNSUPPORTED; + memcpy(cmd.bdaddr, bd_addr, sizeof(cmd.bdaddr)); + + status = hal_ipc_cmd(HAL_SERVICE_ID_BLUETOOTH, + HAL_OP_GET_CONNECTION_STATE, sizeof(cmd), &cmd, + &rsp_len, &rsp, NULL); + + if (status != BT_STATUS_SUCCESS) + return 0; + + return rsp.connection_state; } static int set_os_callouts(bt_os_callouts_t *callouts) |