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