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 14 #include <bluetooth/HCI/btHCI.h> 15 16 #include <Messenger.h> 17 #include <Message.h> 18 19 #include <String.h> 20 21 22 namespace Bluetooth { 23 24 class DiscoveryAgent; 25 26 class LocalDevice { 27 28 public: 29 /* Possible throwing */ 30 static LocalDevice* GetLocalDevice(); 31 static uint32 GetLocalDeviceCount(); 32 33 static LocalDevice* GetLocalDevice(hci_id hid); 34 static LocalDevice* GetLocalDevice(bdaddr_t bdaddr); 35 36 DiscoveryAgent* GetDiscoveryAgent(); 37 BString GetFriendlyName(); 38 DeviceClass GetDeviceClass(); 39 /* Possible throwing */ 40 status_t SetDiscoverable(int mode); 41 42 BString GetProperty(const char* property); 43 void 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 private: 52 LocalDevice(hci_id hid); 53 54 static LocalDevice* RequestLocalDeviceID(BMessage* request); 55 56 static BMessenger* sfMessenger; 57 BMessenger* fMessenger; 58 59 hci_id hid; 60 hci_id GetID(void) {return hid;} 61 62 friend class DiscoveryAgent; 63 friend class RemoteDevice; 64 }; 65 66 } 67 68 #ifndef _BT_USE_EXPLICIT_NAMESPACE 69 using Bluetooth::LocalDevice; 70 #endif 71 72 #endif 73