1 /* 2 * Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com 3 * 4 * All rights reserved. Distributed under the terms of the MIT License. 5 * 6 */ 7 8 #ifndef _LOCAL_DEVICE_H 9 #define _LOCAL_DEVICE_H 10 11 #include <bluetooth/bluetooth.h> 12 #include <bluetooth/DeviceClass.h> 13 #include <bluetooth/BluetoothDevice.h> 14 15 #include <bluetooth/HCI/btHCI.h> 16 17 #include <Messenger.h> 18 #include <Message.h> 19 20 #include <String.h> 21 22 23 namespace Bluetooth { 24 25 class DiscoveryAgent; 26 27 class LocalDevice : public BluetoothDevice { 28 29 public: 30 /* Possible throwing */ 31 static LocalDevice* GetLocalDevice(); 32 static uint32 GetLocalDeviceCount(); 33 34 static LocalDevice* GetLocalDevice(hci_id hid); 35 static LocalDevice* GetLocalDevice(bdaddr_t bdaddr); 36 37 DiscoveryAgent* GetDiscoveryAgent(); 38 BString GetFriendlyName(); 39 DeviceClass GetDeviceClass(); 40 /* Possible throwing */ 41 status_t SetDiscoverable(int mode); 42 43 BString GetProperty(const char* property); 44 void GetProperty(const char* property, uint32* value); 45 46 int GetDiscoverable(); 47 bdaddr_t GetBluetoothAddress(); 48 /* 49 ServiceRecord getRecord(Connection notifier); 50 void updateRecord(ServiceRecord srvRecord); 51 */ 52 private: 53 LocalDevice(hci_id hid); 54 55 static LocalDevice* RequestLocalDeviceID(BMessage* request); 56 57 static BMessenger* sfMessenger; 58 BMessenger* fMessenger; 59 60 hci_id hid; 61 hci_id GetID(void) {return hid;} 62 63 friend class DiscoveryAgent; 64 friend class RemoteDevice; 65 }; 66 67 } 68 69 #ifndef _BT_USE_EXPLICIT_NAMESPACE 70 using Bluetooth::LocalDevice; 71 #endif 72 73 #endif 74