OSDN Git Service

android: Add support for handling cancel bond command
authorSzymon Janc <szymon.janc@gmail.com>
Thu, 31 Oct 2013 02:55:47 +0000 (02:55 +0000)
committerJohan Hedberg <johan.hedberg@intel.com>
Thu, 31 Oct 2013 08:47:48 +0000 (10:47 +0200)
android/adapter.c

index 8c5482b..0f174a6 100644 (file)
@@ -626,6 +626,19 @@ static bool create_bond(void *buf, uint16_t len)
        return true;
 }
 
+static bool cancel_bond(void *buf, uint16_t len)
+{
+       struct hal_cmd_cancel_bond *cmd = buf;
+       struct mgmt_addr_info cp;
+
+       cp.type = BDADDR_BREDR;
+       android2bdaddr(cmd->bdaddr, &cp.bdaddr);
+
+       return mgmt_reply(adapter->mgmt, MGMT_OP_CANCEL_PAIR_DEVICE,
+                               adapter->index, sizeof(cp), &cp, NULL, NULL,
+                               NULL) > 0;
+}
+
 void bt_adapter_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf,
                                                                uint16_t len)
 {
@@ -668,6 +681,11 @@ void bt_adapter_handle_cmd(GIOChannel *io, uint8_t opcode, void *buf,
                        goto error;
 
                break;
+       case HAL_OP_CANCEL_BOND:
+               if (!cancel_bond(buf, len))
+                       goto error;
+
+               break;
        default:
                DBG("Unhandled command, opcode 0x%x", opcode);
                goto error;