1 /* 2 * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef _DISCOVERY_AGENT_H 6 #define _DISCOVERY_AGENT_H 7 8 #include <bluetooth/bluetooth.h> 9 #include <bluetooth/DiscoveryListener.h> 10 11 12 #define BT_CACHED 0x00 13 #define BT_PREKNOWN 0x01 14 #define BT_NOT_DISCOVERABLE 0x01 15 16 #define BT_GIAC 0x9E8B33 17 #define BT_LIAC 0x9E8B00 18 19 #define BT_MAX_RESPONSES (32) 20 #define BT_BASE_INQUIRY_TIME (1.28) 21 #define BT_DEFAULT_INQUIRY_TIME (0x15*BT_BASE_INQUIRY_TIME) /* TODO: REVIEW SPECS! */ 22 23 namespace Bluetooth { 24 25 class DiscoveryListener; 26 class RemoteDevice; 27 28 class DiscoveryAgent { 29 30 public: 31 32 static const int GIAC = BT_GIAC; 33 static const int LIAC = BT_LIAC; 34 35 static const int PREKNOWN = BT_PREKNOWN; 36 static const int CACHED = BT_CACHED; 37 static const int NOT_DISCOVERABLE = BT_NOT_DISCOVERABLE; 38 39 RemoteDevicesList RetrieveDevices(int option); /* TODO */ 40 status_t StartInquiry(int accessCode, DiscoveryListener* listener); /* Throwing */ 41 status_t StartInquiry(uint32 accessCode, DiscoveryListener* listener, bigtime_t secs); 42 status_t CancelInquiry(DiscoveryListener* listener); 43 44 /* 45 int searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev, 46 DiscoveryListener discListener); 47 48 bool cancelServiceSearch(int transID); 49 BString selectService(UUID uuid, int security, boolean master); 50 */ 51 52 private: 53 DiscoveryAgent(LocalDevice* ld); 54 ~DiscoveryAgent(); 55 void SetLocalDeviceOwner(LocalDevice* ld); 56 57 DiscoveryListener* fLastUsedListener; 58 LocalDevice* fLocalDevice; 59 BMessenger* fMessenger; 60 61 friend class LocalDevice; 62 }; 63 64 } 65 66 #ifndef _BT_USE_EXPLICIT_NAMESPACE 67 using Bluetooth::DiscoveryAgent; 68 #endif 69 70 #endif // _DISCOVERY_AGENT_H 71