- Show the class of device(for local and discovered ones).

- Listeners do not need to inform about the LocalDevice handling to the Discovery Agent anymore.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28810 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes
2008-12-13 23:47:10 +00:00
parent 33fe7b32db
commit c1990799c0
2 changed files with 30 additions and 14 deletions
+13 -7
View File
@@ -1,8 +1,6 @@
/*
* Copyright 2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
*
* All rights reserved. Distributed under the terms of the MIT License.
*
*/
#include <stdio.h>
@@ -11,27 +9,35 @@
#include <bluetooth/LocalDevice.h>
#include <bluetooth/bdaddrUtils.h>
#include <bluetooth/DeviceClass.h>
#include <bluetooth/DiscoveryAgent.h>
#include <bluetooth/DiscoveryListener.h>
thread_id mainThread;
class simpleDiscoveryListener : public DiscoveryListener {
public:
simpleDiscoveryListener(LocalDevice *device) : DiscoveryListener()
simpleDiscoveryListener() : DiscoveryListener()
{
/* TODO: Should not be needed */
SetLocalDeviceOwner(device);
}
void
DeviceDiscovered(RemoteDevice* btDevice, DeviceClass cod)
{
BString classString;
printf("\t%s: Device %s discovered.\n",__FUNCTION__, bdaddrUtils::ToString(btDevice->GetBluetoothAddress()));
cod.GetServiceClass(classString);
classString << " |";
cod.GetMajorDeviceClass(classString);
classString << " |";
cod.GetMinorDeviceClass(classString);
printf("\t\t%s: \n", classString.String());
}
@@ -69,7 +75,7 @@ DumpInfo(LocalDevice* device)
(device->GetFriendlyName()).String(),
bdaddrUtils::ToString(device->GetBluetoothAddress()));
simpleDiscoveryListener* dListener = new simpleDiscoveryListener(device);
simpleDiscoveryListener* dListener = new simpleDiscoveryListener();
dAgent->StartInquiry(BT_GIAC, dListener);