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 status_t SetDeviceClass(DeviceClass deviceClass); 38 39 /* Possible throwing */ 40 status_t SetDiscoverable(int mode); 41 42 BString GetProperty(const char* property); 43 status_t GetProperty(const char* property, uint32* value); 44 45 int GetDiscoverable(); 46 bdaddr_t GetBluetoothAddress(); 47 /* 48 ServiceRecord getRecord(Connection notifier); 49 void updateRecord(ServiceRecord srvRecord); 50 */ 51 hci_id ID() const; 52 private: 53 LocalDevice(hci_id hid); 54 virtual ~LocalDevice(); 55 56 status_t _ReadLocalVersion(); 57 status_t _ReadBufferSize(); 58 status_t _ReadLocalFeatures(); 59 status_t Reset(); 60 61 static LocalDevice* RequestLocalDeviceID(BMessage* request); 62 63 BMessenger* fMessenger; 64 hci_id fHid; 65 66 friend class DiscoveryAgent; 67 friend class RemoteDevice; 68 friend class PincodeWindow; 69 70 }; 71 72 } 73 74 75 #ifndef _BT_USE_EXPLICIT_NAMESPACE 76 using Bluetooth::LocalDevice; 77 #endif 78 79 #endif // _LOCAL_DEVICE_H 80