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 status_t 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 status_t ReadLocalVersion(); 55 status_t ReadBufferSize(); 56 status_t Reset(); 57 hci_id GetID(void) {return hid;} 58 static LocalDevice* RequestLocalDeviceID(BMessage* request); 59 60 BMessenger* fMessenger; 61 62 hci_id hid; 63 64 friend class DiscoveryAgent; 65 friend class RemoteDevice; 66 friend class PincodeWindow; 67 }; 68 69 } 70 71 #ifndef _BT_USE_EXPLICIT_NAMESPACE 72 using Bluetooth::LocalDevice; 73 #endif 74 75 #endif // _LOCAL_DEVICE_H 76