xref: /haiku/headers/os/bluetooth/DiscoveryAgent.h (revision 001662ae04b1e220cfc87453b03a050938040d6f)
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>
107044da55SOliver Ruiz Dorantes 
117044da55SOliver Ruiz Dorantes 
12b426fc04SOliver Ruiz Dorantes #define BT_CACHED 0x00
13b426fc04SOliver Ruiz Dorantes #define BT_PREKNOWN 0x01
14b426fc04SOliver Ruiz Dorantes #define BT_NOT_DISCOVERABLE 0x01
15b426fc04SOliver Ruiz Dorantes 
16b426fc04SOliver Ruiz Dorantes #define BT_GIAC 0x9E8B33
17b426fc04SOliver Ruiz Dorantes #define BT_LIAC 0x9E8B00
18b426fc04SOliver Ruiz Dorantes 
19b426fc04SOliver Ruiz Dorantes #define BT_MAX_RESPONSES		(32)
20b426fc04SOliver Ruiz Dorantes #define BT_BASE_INQUIRY_TIME	(1.28)
21b426fc04SOliver Ruiz Dorantes #define BT_DEFAULT_INQUIRY_TIME	(0x15*BT_BASE_INQUIRY_TIME)  /* TODO: REVIEW SPECS! */
227044da55SOliver Ruiz Dorantes 
237044da55SOliver Ruiz Dorantes namespace Bluetooth {
247044da55SOliver Ruiz Dorantes 
257044da55SOliver Ruiz Dorantes class DiscoveryListener;
267044da55SOliver Ruiz Dorantes class RemoteDevice;
277044da55SOliver Ruiz Dorantes 
287044da55SOliver Ruiz Dorantes class DiscoveryAgent {
297044da55SOliver Ruiz Dorantes 
307044da55SOliver Ruiz Dorantes public:
317044da55SOliver Ruiz Dorantes 
32b426fc04SOliver Ruiz Dorantes 	static const int GIAC = BT_GIAC;
33b426fc04SOliver Ruiz Dorantes 	static const int LIAC = BT_LIAC;
347044da55SOliver Ruiz Dorantes 
35b426fc04SOliver Ruiz Dorantes 	static const int PREKNOWN = BT_PREKNOWN;
36b426fc04SOliver Ruiz Dorantes 	static const int CACHED = BT_CACHED;
37b426fc04SOliver Ruiz Dorantes 	static const int NOT_DISCOVERABLE = BT_NOT_DISCOVERABLE;
387044da55SOliver Ruiz Dorantes 
39b426fc04SOliver Ruiz Dorantes 	RemoteDevicesList RetrieveDevices(int option); /* TODO */
40b426fc04SOliver Ruiz Dorantes 	status_t StartInquiry(int accessCode, DiscoveryListener* listener); /* Throwing */
41b426fc04SOliver Ruiz Dorantes 	status_t StartInquiry(uint32 accessCode, DiscoveryListener* listener, bigtime_t secs);
42b426fc04SOliver Ruiz Dorantes 	status_t CancelInquiry(DiscoveryListener* listener);
437044da55SOliver Ruiz Dorantes 
447044da55SOliver Ruiz Dorantes 	/*
4526e7ba56SOliver Ruiz Dorantes 	int searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev,
467044da55SOliver Ruiz Dorantes 					DiscoveryListener discListener);
477044da55SOliver Ruiz Dorantes 
487044da55SOliver Ruiz Dorantes 	bool cancelServiceSearch(int transID);
497044da55SOliver Ruiz Dorantes 	BString selectService(UUID uuid, int security, boolean master);
507044da55SOliver Ruiz Dorantes 	*/
517044da55SOliver Ruiz Dorantes 
527044da55SOliver Ruiz Dorantes private:
53be79ee53SOliver Ruiz Dorantes 	DiscoveryAgent(LocalDevice* ld);
54870ae24aSOliver Ruiz Dorantes 	~DiscoveryAgent();
55b426fc04SOliver Ruiz Dorantes 	void SetLocalDeviceOwner(LocalDevice* ld);
56b426fc04SOliver Ruiz Dorantes 
57b426fc04SOliver Ruiz Dorantes 	DiscoveryListener* fLastUsedListener;
58b426fc04SOliver Ruiz Dorantes 	LocalDevice*       fLocalDevice;
59870ae24aSOliver Ruiz Dorantes 	BMessenger*        fMessenger;
607044da55SOliver Ruiz Dorantes 
61be79ee53SOliver Ruiz Dorantes 	friend class LocalDevice;
627044da55SOliver Ruiz Dorantes };
637044da55SOliver Ruiz Dorantes 
647044da55SOliver Ruiz Dorantes }
657044da55SOliver Ruiz Dorantes 
66be79ee53SOliver Ruiz Dorantes #ifndef _BT_USE_EXPLICIT_NAMESPACE
67be79ee53SOliver Ruiz Dorantes using Bluetooth::DiscoveryAgent;
68be79ee53SOliver Ruiz Dorantes #endif
69be79ee53SOliver Ruiz Dorantes 
70*001662aeSOliver Ruiz Dorantes #endif // _DISCOVERY_AGENT_H
71