xref: /haiku/headers/os/bluetooth/DiscoveryAgent.h (revision fa262f2273ad87695689f196e75fc18c451aa708)
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 #include <bluetooth/RemoteDevice.h>
11 
12 
13 #define BT_CACHED 0x00
14 #define BT_PREKNOWN 0x01
15 #define BT_NOT_DISCOVERABLE 0x01
16 
17 #define BT_GIAC 0x9E8B33
18 #define BT_LIAC 0x9E8B00
19 
20 #define BT_MAX_RESPONSES		(32)
21 
22 #define BT_BASE_INQUIRY_TIME	(1.28)
23 #define BT_DEFAULT_INQUIRY_TIME	(0x0A)
24 #define BT_MIN_INQUIRY_TIME	(0x01) //  1.18 secs
25 #define BT_MAX_INQUIRY_TIME	(0x30) // 61.44 secs
26 
27 namespace Bluetooth {
28 
29 class LocalDevice;
30 
31 class DiscoveryAgent {
32 
33 public:
34 
35 	static const int GIAC = BT_GIAC;
36 	static const int LIAC = BT_LIAC;
37 
38 	static const int PREKNOWN = BT_PREKNOWN;
39 	static const int CACHED = BT_CACHED;
40 	static const int NOT_DISCOVERABLE = BT_NOT_DISCOVERABLE;
41 
42 	RemoteDevicesList RetrieveDevices(int option); /* TODO */
43 	status_t StartInquiry(int accessCode, DiscoveryListener* listener); /* Throwing */
44 	status_t StartInquiry(uint32 accessCode, DiscoveryListener* listener, bigtime_t secs);
45 	status_t CancelInquiry(DiscoveryListener* listener);
46 
47 	/*
48 	int searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev,
49 					DiscoveryListener discListener);
50 
51 	bool cancelServiceSearch(int transID);
52 	BString selectService(UUID uuid, int security, boolean master);
53 	*/
54 
55 private:
56 	DiscoveryAgent(LocalDevice* ld);
57 	~DiscoveryAgent();
58 	void SetLocalDeviceOwner(LocalDevice* ld);
59 
60 	DiscoveryListener* fLastUsedListener;
61 	LocalDevice*       fLocalDevice;
62 	BMessenger*        fMessenger;
63 
64 	friend class LocalDevice;
65 };
66 
67 }
68 
69 #ifndef _BT_USE_EXPLICIT_NAMESPACE
70 using Bluetooth::DiscoveryAgent;
71 #endif
72 
73 #endif // _DISCOVERY_AGENT_H
74