Add UI classes to the build.

Adding some helper methods to the Local and remote devices



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26011 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes
2008-06-18 21:01:26 +00:00
parent b12daa5f08
commit 24f4a20d25
5 changed files with 73 additions and 61 deletions
+22 -21
View File
@@ -28,40 +28,41 @@ class LocalDevice : public BluetoothDevice {
public: public:
/* Possible throwing */ /* Possible throwing */
static LocalDevice* GetLocalDevice(); static LocalDevice* GetLocalDevice();
static uint32 GetLocalDeviceCount(); static uint32 GetLocalDeviceCount();
static LocalDevice* GetLocalDevice(hci_id hid); static LocalDevice* GetLocalDevice(hci_id hid);
static LocalDevice* GetLocalDevice(bdaddr_t bdaddr); static LocalDevice* GetLocalDevice(bdaddr_t bdaddr);
DiscoveryAgent* GetDiscoveryAgent(); DiscoveryAgent* GetDiscoveryAgent();
BString GetFriendlyName(); BString GetFriendlyName();
DeviceClass GetDeviceClass(); DeviceClass GetDeviceClass();
/* Possible throwing */ /* Possible throwing */
status_t SetDiscoverable(int mode); status_t SetDiscoverable(int mode);
BString GetProperty(const char* property); BString GetProperty(const char* property);
void GetProperty(const char* property, uint32* value); void GetProperty(const char* property, uint32* value);
int GetDiscoverable(); int GetDiscoverable();
bdaddr_t GetBluetoothAddress(); bdaddr_t GetBluetoothAddress();
/* /*
ServiceRecord getRecord(Connection notifier); ServiceRecord getRecord(Connection notifier);
void updateRecord(ServiceRecord srvRecord); void updateRecord(ServiceRecord srvRecord);
*/ */
private: private:
LocalDevice(hci_id hid); LocalDevice(hci_id hid);
hci_id GetID(void) {return hid;}
static LocalDevice* RequestLocalDeviceID(BMessage* request);
static LocalDevice* RequestLocalDeviceID(BMessage* request); static BMessenger* sfMessenger;
BMessenger* fMessenger;
static BMessenger* sfMessenger; hci_id hid;
BMessenger* fMessenger;
hci_id hid;
hci_id GetID(void) {return hid;}
friend class DiscoveryAgent; friend class DiscoveryAgent;
friend class RemoteDevice; friend class RemoteDevice;
friend class PincodeWindow;
}; };
} }
+8 -10
View File
@@ -25,7 +25,6 @@ class LocalDevice;
class RemoteDevice : public BluetoothDevice { class RemoteDevice : public BluetoothDevice {
public: public:
static const int WAIT = B_BT_WAIT; static const int WAIT = B_BT_WAIT;
static const int SUCCEEDED = B_BT_SUCCEEDED; static const int SUCCEEDED = B_BT_SUCCEEDED;
@@ -48,24 +47,23 @@ class RemoteDevice : public BluetoothDevice {
BString GetProperty(const char* property); /* Throwing */ BString GetProperty(const char* property); /* Throwing */
void GetProperty(const char* property, uint32* value); /* Throwing */ void GetProperty(const char* property, uint32* value); /* Throwing */
LocalDevice* GetLocalDeviceOwner();
protected: protected:
RemoteDevice(BString address); RemoteDevice(BString address);
RemoteDevice(bdaddr_t address); RemoteDevice(bdaddr_t address);
/* Instances of this class only will be done by Discovery[Listener|Agent] TODO */ /* Instances of this class only would be instantiated by Discovery[Listener|Agent] */
friend class DiscoveryListener; friend class DiscoveryListener;
void SetLocalDeviceOwner(LocalDevice* ld);
private: private:
void SetLocalDeviceOwner(LocalDevice* ld);
LocalDevice* fDiscovererLocalDevice; LocalDevice* fDiscovererLocalDevice;
uint8 fPageRepetitionMode; uint8 fPageRepetitionMode;
uint8 fScanPeriodMode; uint8 fScanPeriodMode;
uint8 fScanMode; uint8 fScanMode;
uint16 fClockOffset; uint16 fClockOffset;
}; };
+12 -4
View File
@@ -2,11 +2,16 @@ SubDir HAIKU_TOP src kits bluetooth ;
SetSubDirSupportedPlatformsBeOSCompatible ; SetSubDirSupportedPlatformsBeOSCompatible ;
if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { #if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
UseHeaders [ FDirName $(HAIKU_TOP) headers os ] : true ; # UseHeaders [ FDirName $(HAIKU_TOP) headers os ] : true ;
} #}
UsePrivateHeaders shared bluetooth ;
SubDirHdrs [ FDirName $(SUBDIR) UI ] ;
SEARCH_SOURCE += [ FDirName $(SUBDIR) UI ] ;
UsePrivateHeaders bluetooth shared ;
SharedLibrary libbluetooth.so : SharedLibrary libbluetooth.so :
LocalDevice.cpp LocalDevice.cpp
@@ -15,5 +20,8 @@ SharedLibrary libbluetooth.so :
RemoteDevice.cpp RemoteDevice.cpp
CommandManager.cpp CommandManager.cpp
KitSupport.cpp KitSupport.cpp
#UI
PincodeWindow.cpp
ConnectionIncoming.cpp
: be : be
; ;
+2 -2
View File
@@ -152,7 +152,7 @@ LocalDevice::SetDiscoverable(int mode)
BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST); BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST);
BMessage reply; BMessage reply;
size_t size; size_t size;
int8 bt_status = BT_ERROR; int8 bt_status = BT_ERROR;
@@ -170,7 +170,7 @@ LocalDevice::SetDiscoverable(int mode)
request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_CONTROL_BASEBAND, OCF_WRITE_SCAN_ENABLE)); request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_CONTROL_BASEBAND, OCF_WRITE_SCAN_ENABLE));
if (fMessenger->SendMessage(&request, &reply) == B_OK) { if (fMessenger->SendMessage(&request, &reply) == B_OK) {
if (reply.FindInt8("status", &bt_status ) == B_OK ) { if (reply.FindInt8("status", &bt_status ) == B_OK ) {
return bt_status; return bt_status;
} }
+5
View File
@@ -134,6 +134,11 @@ RemoteDevice::IsEncrypted()
return true; return true;
} }
LocalDevice*
RemoteDevice::GetLocalDeviceOwner()
{
return fDiscovererLocalDevice;
}
/* Private */ /* Private */
void void