xref: /haiku/headers/os/bluetooth/RemoteDevice.h (revision 4720c31bb08f5c6d1c8ddb616463c6fba9b350a1)
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 _REMOTE_DEVICE_H
6 #define _REMOTE_DEVICE_H
7 
8 #include <bluetooth/bluetooth.h>
9 #include <bluetooth/BluetoothDevice.h>
10 
11 #include <String.h>
12 
13 #define B_BT_WAIT 0x00
14 #define B_BT_SUCCEEDED 0x01
15 
16 
17 namespace Bluetooth {
18 
19 class Connection;
20 class LocalDevice;
21 
22 class RemoteDevice : public BluetoothDevice {
23 
24 public:
25 	static const int WAIT = B_BT_WAIT;
26 	static const int SUCCEEDED = B_BT_SUCCEEDED;
27 
28 	virtual ~RemoteDevice();
29 
30 	bool IsTrustedDevice();
31 	BString GetFriendlyName(bool alwaysAsk); /* Throwing */
32 	BString GetFriendlyName(void); /* Throwing */
33 	bdaddr_t GetBluetoothAddress();
34 	DeviceClass GetDeviceClass();
35 
36 	bool Equals(RemoteDevice* obj);
37 
38 	/*static RemoteDevice* GetRemoteDevice(Connection conn);   Throwing */
39 	bool Authenticate(); /* Throwing */
40 	/* bool Authorize(Connection conn);  Throwing */
41 	/*bool Encrypt(Connection conn, bool on);  Throwing */
42 	bool IsAuthenticated(); /* Throwing */
43 	/*bool IsAuthorized(Connection conn);  Throwing */
44 	bool IsEncrypted(); /* Throwing */
45 
46 	BString GetProperty(const char* property); /* Throwing */
47 	status_t GetProperty(const char* property, uint32* value); /* Throwing */
48 
49 	LocalDevice* GetLocalDeviceOwner();
50 
51 	RemoteDevice(const BString& address);
52 	RemoteDevice(const bdaddr_t address, uint8 record[3]);
53 
54 protected:
55 	/* called by Discovery[Listener|Agent] */
56 	void SetLocalDeviceOwner(LocalDevice* ld);
57 	friend class DiscoveryListener;
58 
59 private:
60 
61 	LocalDevice* fDiscovererLocalDevice;
62 	BMessenger*	 fMessenger;
63 
64 	uint8		fPageRepetitionMode;
65 	uint8		fScanPeriodMode;
66 	uint8		fScanMode;
67 	uint16		fClockOffset;
68 
69 };
70 
71 }
72 
73 #ifndef _BT_USE_EXPLICIT_NAMESPACE
74 using Bluetooth::RemoteDevice;
75 #endif
76 
77 #endif // _REMOTE_DEVICE_H
78