From 5ceb8de4e9dae1ccd7c91e74f5c464b7591c217f Mon Sep 17 00:00:00 2001 From: Oliver Ruiz Dorantes Date: Mon, 17 Mar 2008 22:46:56 +0000 Subject: [PATCH] SetDiscoverable method Implementation git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24427 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/bluetooth/LocalDevice.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/kits/bluetooth/LocalDevice.cpp b/src/kits/bluetooth/LocalDevice.cpp index 0041beda8f..0fbef4fdcb 100644 --- a/src/kits/bluetooth/LocalDevice.cpp +++ b/src/kits/bluetooth/LocalDevice.cpp @@ -8,14 +8,17 @@ #include +#include +#include + #include #include #include #include #include - #include +#include #include "KitSupport.h" @@ -148,12 +151,23 @@ LocalDevice::SetDiscoverable(int mode) BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST); BMessage reply; + + size_t size; int8 bt_status = BT_ERROR; request.AddInt32("hci_id", hid); + + + void* command = buildWriteScan(mode, &size); - // TODO: Add the raw command to the BMessage + expected event + if (command == NULL) { + return B_NO_MEMORY; + } + + request.AddData("raw command", B_ANY_TYPE, command, size); + request.AddInt16("eventExpected", HCI_EVENT_CMD_COMPLETE); + request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_CONTROL_BASEBAND, OCF_WRITE_SCAN_ENABLE)); if (fMessenger->SendMessage(&request, &reply) == B_OK) { if (reply.FindInt8("status", &bt_status ) == B_OK ) { @@ -163,7 +177,6 @@ LocalDevice::SetDiscoverable(int mode) } - return B_ERROR; }