xref: /haiku/headers/os/bluetooth/DiscoveryAgent.h (revision fa262f2273ad87695689f196e75fc18c451aa708)
17044da55SOliver Ruiz Dorantes /*
2b426fc04SOliver Ruiz Dorantes  * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
37044da55SOliver Ruiz Dorantes  * All rights reserved. Distributed under the terms of the MIT License.
47044da55SOliver Ruiz Dorantes  */
57044da55SOliver Ruiz Dorantes #ifndef _DISCOVERY_AGENT_H
67044da55SOliver Ruiz Dorantes #define _DISCOVERY_AGENT_H
77044da55SOliver Ruiz Dorantes 
87044da55SOliver Ruiz Dorantes #include <bluetooth/bluetooth.h>
9b426fc04SOliver Ruiz Dorantes #include <bluetooth/DiscoveryListener.h>
10*fa262f22SOliver Ruiz Dorantes #include <bluetooth/RemoteDevice.h>
117044da55SOliver Ruiz Dorantes 
127044da55SOliver Ruiz Dorantes 
13b426fc04SOliver Ruiz Dorantes #define BT_CACHED 0x00
14b426fc04SOliver Ruiz Dorantes #define BT_PREKNOWN 0x01
15b426fc04SOliver Ruiz Dorantes #define BT_NOT_DISCOVERABLE 0x01
16b426fc04SOliver Ruiz Dorantes 
17b426fc04SOliver Ruiz Dorantes #define BT_GIAC 0x9E8B33
18b426fc04SOliver Ruiz Dorantes #define BT_LIAC 0x9E8B00
19b426fc04SOliver Ruiz Dorantes 
20b426fc04SOliver Ruiz Dorantes #define BT_MAX_RESPONSES		(32)
21*fa262f22SOliver Ruiz Dorantes 
22b426fc04SOliver Ruiz Dorantes #define BT_BASE_INQUIRY_TIME	(1.28)
23*fa262f22SOliver Ruiz Dorantes #define BT_DEFAULT_INQUIRY_TIME	(0x0A)
24*fa262f22SOliver Ruiz Dorantes #define BT_MIN_INQUIRY_TIME	(0x01) //  1.18 secs
25*fa262f22SOliver Ruiz Dorantes #define BT_MAX_INQUIRY_TIME	(0x30) // 61.44 secs
267044da55SOliver Ruiz Dorantes 
277044da55SOliver Ruiz Dorantes namespace Bluetooth {
287044da55SOliver Ruiz Dorantes 
29*fa262f22SOliver Ruiz Dorantes class LocalDevice;
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 	/*
4826e7ba56SOliver Ruiz Dorantes 	int searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev,
497044da55SOliver Ruiz Dorantes 					DiscoveryListener discListener);
507044da55SOliver Ruiz Dorantes 
517044da55SOliver Ruiz Dorantes 	bool cancelServiceSearch(int transID);
527044da55SOliver Ruiz Dorantes 	BString selectService(UUID uuid, int security, boolean master);
537044da55SOliver Ruiz Dorantes 	*/
547044da55SOliver Ruiz Dorantes 
557044da55SOliver Ruiz Dorantes private:
56be79ee53SOliver Ruiz Dorantes 	DiscoveryAgent(LocalDevice* ld);
57870ae24aSOliver Ruiz Dorantes 	~DiscoveryAgent();
58b426fc04SOliver Ruiz Dorantes 	void SetLocalDeviceOwner(LocalDevice* ld);
59b426fc04SOliver Ruiz Dorantes 
60b426fc04SOliver Ruiz Dorantes 	DiscoveryListener* fLastUsedListener;
61b426fc04SOliver Ruiz Dorantes 	LocalDevice*       fLocalDevice;
62870ae24aSOliver Ruiz Dorantes 	BMessenger*        fMessenger;
637044da55SOliver Ruiz Dorantes 
64be79ee53SOliver Ruiz Dorantes 	friend class LocalDevice;
657044da55SOliver Ruiz Dorantes };
667044da55SOliver Ruiz Dorantes 
677044da55SOliver Ruiz Dorantes }
687044da55SOliver Ruiz Dorantes 
69be79ee53SOliver Ruiz Dorantes #ifndef _BT_USE_EXPLICIT_NAMESPACE
70be79ee53SOliver Ruiz Dorantes using Bluetooth::DiscoveryAgent;
71be79ee53SOliver Ruiz Dorantes #endif
72be79ee53SOliver Ruiz Dorantes 
73001662aeSOliver Ruiz Dorantes #endif // _DISCOVERY_AGENT_H
74