xref: /haiku/headers/os/bluetooth/LocalDevice.h (revision a4ef4a49150f118d47324242917a596a3f8f8bd5)
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 _LOCAL_DEVICE_H
6 #define _LOCAL_DEVICE_H
7 
8 #include <bluetooth/bluetooth.h>
9 #include <bluetooth/DeviceClass.h>
10 #include <bluetooth/BluetoothDevice.h>
11 
12 #include <bluetooth/HCI/btHCI.h>
13 
14 #include <Messenger.h>
15 #include <Message.h>
16 
17 #include <String.h>
18 
19 
20 namespace Bluetooth {
21 
22 class DiscoveryAgent;
23 
24 class LocalDevice : public BluetoothDevice {
25 
26 public:
27 	/* Possible throwing */
28 	static	LocalDevice*	GetLocalDevice();
29 	static	uint32			GetLocalDeviceCount();
30 
31 	static	LocalDevice*	GetLocalDevice(const hci_id hid);
32 	static	LocalDevice*	GetLocalDevice(const bdaddr_t bdaddr);
33 
34 			DiscoveryAgent*	GetDiscoveryAgent();
35 			BString			GetFriendlyName();
36 			DeviceClass		GetDeviceClass();
37 	/* Possible throwing */
38 			status_t		SetDiscoverable(int mode);
39 
40 			BString			GetProperty(const char* property);
41 			void			GetProperty(const char* property, uint32* value);
42 
43 			int				GetDiscoverable();
44 			bdaddr_t		GetBluetoothAddress();
45 	/*
46 			ServiceRecord getRecord(Connection notifier);
47 			void updateRecord(ServiceRecord srvRecord);
48 	*/
49 
50 private:
51 			LocalDevice(hci_id hid);
52 			virtual	~LocalDevice();
53 
54 			hci_id			GetID(void) {return hid;}
55 	static	LocalDevice*	RequestLocalDeviceID(BMessage* request);
56 
57 			BMessenger*		fMessenger;
58 
59 			hci_id			hid;
60 
61 	friend class DiscoveryAgent;
62 	friend class RemoteDevice;
63 	friend class PincodeWindow;
64 };
65 
66 }
67 
68 #ifndef _BT_USE_EXPLICIT_NAMESPACE
69 using Bluetooth::LocalDevice;
70 #endif
71 
72 #endif // _LOCAL_DEVICE_H
73