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
+32 -31
View File
@@ -28,42 +28,43 @@ 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(bdaddr_t bdaddr);
DiscoveryAgent* GetDiscoveryAgent();
BString GetFriendlyName();
DeviceClass GetDeviceClass();
/* Possible throwing */
status_t SetDiscoverable(int mode);
BString GetProperty(const char* property);
void GetProperty(const char* property, uint32* value);
int GetDiscoverable();
bdaddr_t GetBluetoothAddress();
/*
ServiceRecord getRecord(Connection notifier);
void updateRecord(ServiceRecord srvRecord);
*/
private:
LocalDevice(hci_id hid);
static LocalDevice* RequestLocalDeviceID(BMessage* request);
static BMessenger* sfMessenger;
BMessenger* fMessenger;
hci_id hid; static LocalDevice* GetLocalDevice(hci_id hid);
hci_id GetID(void) {return hid;} static LocalDevice* GetLocalDevice(bdaddr_t bdaddr);
DiscoveryAgent* GetDiscoveryAgent();
BString GetFriendlyName();
DeviceClass GetDeviceClass();
/* Possible throwing */
status_t SetDiscoverable(int mode);
BString GetProperty(const char* property);
void GetProperty(const char* property, uint32* value);
int GetDiscoverable();
bdaddr_t GetBluetoothAddress();
/*
ServiceRecord getRecord(Connection notifier);
void updateRecord(ServiceRecord srvRecord);
*/
private:
LocalDevice(hci_id hid);
hci_id GetID(void) {return hid;}
static LocalDevice* RequestLocalDeviceID(BMessage* request);
static BMessenger* sfMessenger;
BMessenger* fMessenger;
hci_id hid;
friend class DiscoveryAgent; friend class DiscoveryAgent;
friend class RemoteDevice; friend class RemoteDevice;
friend class PincodeWindow;
}; };
} }
#ifndef _BT_USE_EXPLICIT_NAMESPACE #ifndef _BT_USE_EXPLICIT_NAMESPACE
+18 -20
View File
@@ -25,18 +25,17 @@ 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;
bool IsTrustedDevice(); bool IsTrustedDevice();
BString GetFriendlyName(bool alwaysAsk); /* Throwing */ BString GetFriendlyName(bool alwaysAsk); /* Throwing */
BString GetFriendlyName(void); /* Throwing */ BString GetFriendlyName(void); /* Throwing */
bdaddr_t GetBluetoothAddress(); bdaddr_t GetBluetoothAddress();
DeviceClass GetDeviceClass(); DeviceClass GetDeviceClass();
bool Equals(RemoteDevice* obj); bool Equals(RemoteDevice* obj);
/*static RemoteDevice* GetRemoteDevice(Connection conn); Throwing */ /*static RemoteDevice* GetRemoteDevice(Connection conn); Throwing */
bool Authenticate(); /* Throwing */ bool Authenticate(); /* Throwing */
/* bool Authorize(Connection conn); Throwing */ /* bool Authorize(Connection conn); Throwing */
@@ -44,29 +43,28 @@ class RemoteDevice : public BluetoothDevice {
bool IsAuthenticated(); /* Throwing */ bool IsAuthenticated(); /* Throwing */
/*bool IsAuthorized(Connection conn); Throwing */ /*bool IsAuthorized(Connection conn); Throwing */
bool IsEncrypted(); /* Throwing */ bool IsEncrypted(); /* Throwing */
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
; ;
+6 -6
View File
@@ -152,10 +152,10 @@ 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;
request.AddInt32("hci_id", hid); request.AddInt32("hci_id", hid);
@@ -170,12 +170,12 @@ 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;
} }
} }
return B_ERROR; return B_ERROR;
} }
+5
View File
@@ -134,6 +134,11 @@ RemoteDevice::IsEncrypted()
return true; return true;
} }
LocalDevice*
RemoteDevice::GetLocalDeviceOwner()
{
return fDiscovererLocalDevice;
}
/* Private */ /* Private */
void void