From 91f7786bc36f52f0a7e82be41bd4fad48f44e5cf Mon Sep 17 00:00:00 2001 From: Oliver Ruiz Dorantes Date: Sun, 15 Jun 2008 14:40:03 +0000 Subject: [PATCH] test git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25963 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/bluetooth/DiscoveryAgent.cpp | 33 +++++++++++++++------------ 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/kits/bluetooth/DiscoveryAgent.cpp b/src/kits/bluetooth/DiscoveryAgent.cpp index ad2d70fa5c..7bb4a0779d 100644 --- a/src/kits/bluetooth/DiscoveryAgent.cpp +++ b/src/kits/bluetooth/DiscoveryAgent.cpp @@ -27,7 +27,7 @@ DiscoveryAgent::RetrieveDevices(int option) { /* No inquiry process initiated */ if (fLastUsedListener == NULL) - return NULL; + return NULL; // xxx: Fix me return fLastUsedListener->GetRemoteDevicesList(); } @@ -44,7 +44,7 @@ status_t DiscoveryAgent::StartInquiry(uint32 accessCode, DiscoveryListener* listener, bigtime_t secs) { BMessenger* btsm = NULL; - size_t size; + size_t size; if ((btsm = _RetrieveBluetoothMessenger()) == NULL) return B_ERROR; @@ -66,11 +66,11 @@ DiscoveryAgent::StartInquiry(uint32 accessCode, DiscoveryListener* listener, big BMessage reply; request.AddInt32("hci_id", fLocalDevice->GetID()); - - startInquiryCommand = buildInquiry(accessCode, secs, BT_MAX_RESPONSES, &size); - // For stating the inquiry - request.AddData("raw command", B_ANY_TYPE, startInquiryCommand, size); + startInquiryCommand = buildInquiry(accessCode, secs, BT_MAX_RESPONSES, &size); + + // For stating the inquiry + request.AddData("raw command", B_ANY_TYPE, startInquiryCommand, size); request.AddInt16("eventExpected", HCI_EVENT_CMD_STATUS); request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_LINK_CONTROL, OCF_INQUIRY)); @@ -94,7 +94,8 @@ DiscoveryAgent::StartInquiry(uint32 accessCode, DiscoveryListener* listener, big status_t DiscoveryAgent::CancelInquiry(DiscoveryListener* listener) { - BMessenger* btsm = NULL; + BMessenger* btsm = NULL; //TODO: this should be a member field + size_t size; if ((btsm = _RetrieveBluetoothMessenger()) == NULL) return B_ERROR; @@ -107,17 +108,19 @@ DiscoveryAgent::CancelInquiry(DiscoveryListener* listener) BMessage reply; request.AddInt32("hci_id", fLocalDevice->GetID()); - // TODO: Add the raw command to the BMessage + expected event(s) + cancelInquiryCommand = buildInquiryCancel(&size); + request.AddData("raw command", B_ANY_TYPE, cancelInquiryCommand, size); + request.AddInt16("eventExpected", HCI_EVENT_CMD_STATUS); + request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_LINK_CONTROL, OCF_INQUIRY_CANCEL)); - - if (btsm->SendMessage(&request, listener) == B_OK) { + if (btsm->SendMessage(&request, &reply) == B_OK) { if (reply.FindInt8("status", &bt_status ) == B_OK ) { - return bt_status; - } - } - - return B_ERROR; + return bt_status; + } + } + + return B_ERROR; } void