xref: /haiku/headers/os/bluetooth/DiscoveryListener.h (revision 2600324b57fa31cdea1627d584d314f2a579c4a8)
1 /*
2  * Copyright 2007 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_LISTENER_H
6 #define _DISCOVERY_LISTENER_H
7 
8 #include <Looper.h>
9 #include <ObjectList.h>
10 
11 #include <bluetooth/RemoteDevice.h>
12 
13 
14 #define BT_INQUIRY_COMPLETED	0x01 // HCI_EVENT_X check specs
15 #define BT_INQUIRY_TERMINATED	0x02 // HCI_EVENT_X
16 #define BT_INQUIRY_ERROR		0x03 // HCI_EVENT_X
17 
18 
19 namespace Bluetooth {
20 
21 typedef BObjectList<RemoteDevice> RemoteDevicesList;
22 
23 class RemoteDevice;
24 class DeviceClass;
25 class LocalDevice;
26 
27 class DiscoveryListener : public BLooper {
28 
29 public:
30 
31 	static const int INQUIRY_COMPLETED = BT_INQUIRY_COMPLETED;
32 	static const int INQUIRY_TERMINATED = BT_INQUIRY_TERMINATED;
33 	static const int INQUIRY_ERROR = BT_INQUIRY_ERROR;
34 
35 	static const int SERVICE_SEARCH_COMPLETED = 0x01;
36 	static const int SERVICE_SEARCH_TERMINATED = 0x02;
37 	static const int SERVICE_SEARCH_ERROR = 0x03;
38 	static const int SERVICE_SEARCH_NO_RECORDS = 0x04;
39 	static const int SERVICE_SEARCH_DEVICE_NOT_REACHABLE = 0x06;
40 
41 	virtual void DeviceDiscovered(RemoteDevice* btDevice, DeviceClass cod);
42 	/*
43 	virtual void servicesDiscovered(int transID, ServiceRecord[] servRecord);
44 	virtual void serviceSearchCompleted(int transID, int respCode);
45 	*/
46 	virtual void InquiryCompleted(int discType);
47 
48 	/* JSR82 non-defined methods */
49 	virtual void InquiryStarted(status_t status);
50 
51 private:
52 
53 	RemoteDevicesList GetRemoteDevicesList(void);
54 
55 	void MessageReceived(BMessage* msg);
56 
57 	LocalDevice* fLocalDevice;
58 	RemoteDevicesList fRemoteDevicesList;
59 
60 	friend class DiscoveryAgent;
61 
62 protected:
63 	DiscoveryListener();
64 	void SetLocalDeviceOwner(LocalDevice* ld);
65 };
66 
67 }
68 
69 #ifndef _BT_USE_EXPLICIT_NAMESPACE
70 using Bluetooth::DiscoveryListener;
71 #endif
72 
73 #endif // _DISCOVERY_LISTENER_H
74