2007-10-22 21:51:59 +04:00
|
|
|
/*
|
2008-03-31 01:42:22 +04:00
|
|
|
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
|
2007-10-22 21:51:59 +04:00
|
|
|
*
|
|
|
|
* All rights reserved. Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _DISCOVERY_AGENT_H
|
|
|
|
#define _DISCOVERY_AGENT_H
|
|
|
|
|
|
|
|
#include <bluetooth/bluetooth.h>
|
2008-03-31 01:42:22 +04:00
|
|
|
#include <bluetooth/DiscoveryListener.h>
|
2007-10-22 21:51:59 +04:00
|
|
|
|
|
|
|
|
2008-03-31 01:42:22 +04:00
|
|
|
#define BT_CACHED 0x00
|
|
|
|
#define BT_PREKNOWN 0x01
|
|
|
|
#define BT_NOT_DISCOVERABLE 0x01
|
|
|
|
|
|
|
|
#define BT_GIAC 0x9E8B33
|
|
|
|
#define BT_LIAC 0x9E8B00
|
|
|
|
|
|
|
|
#define BT_MAX_RESPONSES (32)
|
|
|
|
#define BT_BASE_INQUIRY_TIME (1.28)
|
|
|
|
#define BT_DEFAULT_INQUIRY_TIME (0x15*BT_BASE_INQUIRY_TIME) /* TODO: REVIEW SPECS! */
|
2007-10-22 21:51:59 +04:00
|
|
|
|
|
|
|
namespace Bluetooth {
|
|
|
|
|
|
|
|
class DiscoveryListener;
|
|
|
|
class RemoteDevice;
|
|
|
|
|
|
|
|
class DiscoveryAgent {
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2008-03-31 01:42:22 +04:00
|
|
|
static const int GIAC = BT_GIAC;
|
|
|
|
static const int LIAC = BT_LIAC;
|
2007-10-22 21:51:59 +04:00
|
|
|
|
2008-03-31 01:42:22 +04:00
|
|
|
static const int PREKNOWN = BT_PREKNOWN;
|
|
|
|
static const int CACHED = BT_CACHED;
|
|
|
|
static const int NOT_DISCOVERABLE = BT_NOT_DISCOVERABLE;
|
2007-10-22 21:51:59 +04:00
|
|
|
|
2008-03-31 01:42:22 +04:00
|
|
|
RemoteDevicesList RetrieveDevices(int option); /* TODO */
|
|
|
|
status_t StartInquiry(int accessCode, DiscoveryListener* listener); /* Throwing */
|
|
|
|
status_t StartInquiry(uint32 accessCode, DiscoveryListener* listener, bigtime_t secs);
|
|
|
|
status_t CancelInquiry(DiscoveryListener* listener);
|
2007-10-22 21:51:59 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
int searchServices(int[] attrSet,
|
|
|
|
UUID[] uuidSet,
|
|
|
|
RemoteDevice btDev,
|
|
|
|
DiscoveryListener discListener);
|
|
|
|
|
|
|
|
bool cancelServiceSearch(int transID);
|
|
|
|
BString selectService(UUID uuid, int security, boolean master);
|
|
|
|
*/
|
|
|
|
|
|
|
|
private:
|
2008-04-16 02:26:32 +04:00
|
|
|
DiscoveryAgent(LocalDevice* ld);
|
2008-03-31 01:42:22 +04:00
|
|
|
void SetLocalDeviceOwner(LocalDevice* ld);
|
|
|
|
|
|
|
|
DiscoveryListener* fLastUsedListener;
|
|
|
|
LocalDevice* fLocalDevice;
|
2008-04-16 02:26:32 +04:00
|
|
|
|
|
|
|
friend class LocalDevice;
|
2008-03-31 01:42:22 +04:00
|
|
|
|
2007-10-22 21:51:59 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2008-04-16 02:26:32 +04:00
|
|
|
#ifndef _BT_USE_EXPLICIT_NAMESPACE
|
|
|
|
using Bluetooth::DiscoveryAgent;
|
|
|
|
#endif
|
|
|
|
|
2007-10-22 21:51:59 +04:00
|
|
|
#endif
|