17044da55SOliver Ruiz Dorantes /* 2b426fc04SOliver Ruiz Dorantes * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com 37044da55SOliver Ruiz Dorantes * 47044da55SOliver Ruiz Dorantes * All rights reserved. Distributed under the terms of the MIT License. 57044da55SOliver Ruiz Dorantes * 67044da55SOliver Ruiz Dorantes */ 77044da55SOliver Ruiz Dorantes 87044da55SOliver Ruiz Dorantes #ifndef _DISCOVERY_AGENT_H 97044da55SOliver Ruiz Dorantes #define _DISCOVERY_AGENT_H 107044da55SOliver Ruiz Dorantes 117044da55SOliver Ruiz Dorantes #include <bluetooth/bluetooth.h> 12b426fc04SOliver Ruiz Dorantes #include <bluetooth/DiscoveryListener.h> 137044da55SOliver Ruiz Dorantes 147044da55SOliver Ruiz Dorantes 15b426fc04SOliver Ruiz Dorantes #define BT_CACHED 0x00 16b426fc04SOliver Ruiz Dorantes #define BT_PREKNOWN 0x01 17b426fc04SOliver Ruiz Dorantes #define BT_NOT_DISCOVERABLE 0x01 18b426fc04SOliver Ruiz Dorantes 19b426fc04SOliver Ruiz Dorantes #define BT_GIAC 0x9E8B33 20b426fc04SOliver Ruiz Dorantes #define BT_LIAC 0x9E8B00 21b426fc04SOliver Ruiz Dorantes 22b426fc04SOliver Ruiz Dorantes #define BT_MAX_RESPONSES (32) 23b426fc04SOliver Ruiz Dorantes #define BT_BASE_INQUIRY_TIME (1.28) 24b426fc04SOliver Ruiz Dorantes #define BT_DEFAULT_INQUIRY_TIME (0x15*BT_BASE_INQUIRY_TIME) /* TODO: REVIEW SPECS! */ 257044da55SOliver Ruiz Dorantes 267044da55SOliver Ruiz Dorantes namespace Bluetooth { 277044da55SOliver Ruiz Dorantes 287044da55SOliver Ruiz Dorantes class DiscoveryListener; 297044da55SOliver Ruiz Dorantes class RemoteDevice; 307044da55SOliver Ruiz Dorantes 317044da55SOliver Ruiz Dorantes class DiscoveryAgent { 327044da55SOliver Ruiz Dorantes 337044da55SOliver Ruiz Dorantes public: 347044da55SOliver Ruiz Dorantes 35b426fc04SOliver Ruiz Dorantes static const int GIAC = BT_GIAC; 36b426fc04SOliver Ruiz Dorantes static const int LIAC = BT_LIAC; 377044da55SOliver Ruiz Dorantes 38b426fc04SOliver Ruiz Dorantes static const int PREKNOWN = BT_PREKNOWN; 39b426fc04SOliver Ruiz Dorantes static const int CACHED = BT_CACHED; 40b426fc04SOliver Ruiz Dorantes static const int NOT_DISCOVERABLE = BT_NOT_DISCOVERABLE; 417044da55SOliver Ruiz Dorantes 42b426fc04SOliver Ruiz Dorantes RemoteDevicesList RetrieveDevices(int option); /* TODO */ 43b426fc04SOliver Ruiz Dorantes status_t StartInquiry(int accessCode, DiscoveryListener* listener); /* Throwing */ 44b426fc04SOliver Ruiz Dorantes status_t StartInquiry(uint32 accessCode, DiscoveryListener* listener, bigtime_t secs); 45b426fc04SOliver Ruiz Dorantes status_t CancelInquiry(DiscoveryListener* listener); 467044da55SOliver Ruiz Dorantes 477044da55SOliver Ruiz Dorantes /* 487044da55SOliver Ruiz Dorantes int searchServices(int[] attrSet, 497044da55SOliver Ruiz Dorantes UUID[] uuidSet, 507044da55SOliver Ruiz Dorantes RemoteDevice btDev, 517044da55SOliver Ruiz Dorantes DiscoveryListener discListener); 527044da55SOliver Ruiz Dorantes 537044da55SOliver Ruiz Dorantes bool cancelServiceSearch(int transID); 547044da55SOliver Ruiz Dorantes BString selectService(UUID uuid, int security, boolean master); 557044da55SOliver Ruiz Dorantes */ 567044da55SOliver Ruiz Dorantes 577044da55SOliver Ruiz Dorantes private: 58*be79ee53SOliver Ruiz Dorantes DiscoveryAgent(LocalDevice* ld); 59b426fc04SOliver Ruiz Dorantes void SetLocalDeviceOwner(LocalDevice* ld); 60b426fc04SOliver Ruiz Dorantes 61b426fc04SOliver Ruiz Dorantes DiscoveryListener* fLastUsedListener; 62b426fc04SOliver Ruiz Dorantes LocalDevice* fLocalDevice; 637044da55SOliver Ruiz Dorantes 64*be79ee53SOliver Ruiz Dorantes friend class LocalDevice; 65*be79ee53SOliver Ruiz Dorantes 667044da55SOliver Ruiz Dorantes }; 677044da55SOliver Ruiz Dorantes 687044da55SOliver Ruiz Dorantes } 697044da55SOliver Ruiz Dorantes 70*be79ee53SOliver Ruiz Dorantes #ifndef _BT_USE_EXPLICIT_NAMESPACE 71*be79ee53SOliver Ruiz Dorantes using Bluetooth::DiscoveryAgent; 72*be79ee53SOliver Ruiz Dorantes #endif 73*be79ee53SOliver Ruiz Dorantes 747044da55SOliver Ruiz Dorantes #endif 75