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:
parent
b12daa5f08
commit
24f4a20d25
|
@ -28,42 +28,43 @@ class LocalDevice : public BluetoothDevice {
|
|||
|
||||
public:
|
||||
/* Possible throwing */
|
||||
static LocalDevice* GetLocalDevice();
|
||||
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;
|
||||
static LocalDevice* GetLocalDevice();
|
||||
static uint32 GetLocalDeviceCount();
|
||||
|
||||
hci_id hid;
|
||||
hci_id GetID(void) {return hid;}
|
||||
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);
|
||||
hci_id GetID(void) {return hid;}
|
||||
static LocalDevice* RequestLocalDeviceID(BMessage* request);
|
||||
|
||||
static BMessenger* sfMessenger;
|
||||
BMessenger* fMessenger;
|
||||
|
||||
hci_id hid;
|
||||
|
||||
friend class DiscoveryAgent;
|
||||
friend class RemoteDevice;
|
||||
friend class PincodeWindow;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#ifndef _BT_USE_EXPLICIT_NAMESPACE
|
||||
|
|
|
@ -25,18 +25,17 @@ class LocalDevice;
|
|||
class RemoteDevice : public BluetoothDevice {
|
||||
|
||||
public:
|
||||
|
||||
static const int WAIT = B_BT_WAIT;
|
||||
static const int SUCCEEDED = B_BT_SUCCEEDED;
|
||||
|
||||
|
||||
bool IsTrustedDevice();
|
||||
BString GetFriendlyName(bool alwaysAsk); /* Throwing */
|
||||
BString GetFriendlyName(void); /* Throwing */
|
||||
bdaddr_t GetBluetoothAddress();
|
||||
DeviceClass GetDeviceClass();
|
||||
|
||||
|
||||
bool Equals(RemoteDevice* obj);
|
||||
|
||||
|
||||
/*static RemoteDevice* GetRemoteDevice(Connection conn); Throwing */
|
||||
bool Authenticate(); /* Throwing */
|
||||
/* bool Authorize(Connection conn); Throwing */
|
||||
|
@ -44,29 +43,28 @@ class RemoteDevice : public BluetoothDevice {
|
|||
bool IsAuthenticated(); /* Throwing */
|
||||
/*bool IsAuthorized(Connection conn); Throwing */
|
||||
bool IsEncrypted(); /* Throwing */
|
||||
|
||||
|
||||
BString GetProperty(const char* property); /* Throwing */
|
||||
void GetProperty(const char* property, uint32* value); /* Throwing */
|
||||
|
||||
|
||||
LocalDevice* GetLocalDeviceOwner();
|
||||
protected:
|
||||
RemoteDevice(BString address);
|
||||
RemoteDevice(bdaddr_t address);
|
||||
|
||||
/* Instances of this class only will be done by Discovery[Listener|Agent] TODO */
|
||||
friend class DiscoveryListener;
|
||||
|
||||
RemoteDevice(bdaddr_t address);
|
||||
|
||||
/* Instances of this class only would be instantiated by Discovery[Listener|Agent] */
|
||||
friend class DiscoveryListener;
|
||||
void SetLocalDeviceOwner(LocalDevice* ld);
|
||||
|
||||
private:
|
||||
void SetLocalDeviceOwner(LocalDevice* ld);
|
||||
|
||||
|
||||
|
||||
LocalDevice* fDiscovererLocalDevice;
|
||||
|
||||
uint8 fPageRepetitionMode;
|
||||
uint8 fScanPeriodMode;
|
||||
uint8 fScanMode;
|
||||
uint16 fClockOffset;
|
||||
|
||||
|
||||
uint8 fPageRepetitionMode;
|
||||
uint8 fScanPeriodMode;
|
||||
uint8 fScanMode;
|
||||
uint16 fClockOffset;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -2,11 +2,16 @@ SubDir HAIKU_TOP src kits bluetooth ;
|
|||
|
||||
SetSubDirSupportedPlatformsBeOSCompatible ;
|
||||
|
||||
if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
|
||||
UseHeaders [ FDirName $(HAIKU_TOP) headers os ] : true ;
|
||||
}
|
||||
#if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
|
||||
# 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 :
|
||||
LocalDevice.cpp
|
||||
|
@ -15,5 +20,8 @@ SharedLibrary libbluetooth.so :
|
|||
RemoteDevice.cpp
|
||||
CommandManager.cpp
|
||||
KitSupport.cpp
|
||||
#UI
|
||||
PincodeWindow.cpp
|
||||
ConnectionIncoming.cpp
|
||||
: be
|
||||
;
|
||||
|
|
|
@ -152,10 +152,10 @@ LocalDevice::SetDiscoverable(int mode)
|
|||
BMessage request(BT_MSG_HANDLE_SIMPLE_REQUEST);
|
||||
BMessage reply;
|
||||
|
||||
size_t size;
|
||||
size_t size;
|
||||
int8 bt_status = BT_ERROR;
|
||||
|
||||
|
||||
|
||||
|
||||
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));
|
||||
|
||||
if (fMessenger->SendMessage(&request, &reply) == B_OK) {
|
||||
if (reply.FindInt8("status", &bt_status ) == B_OK ) {
|
||||
return bt_status;
|
||||
if (reply.FindInt8("status", &bt_status ) == B_OK ) {
|
||||
return bt_status;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return B_ERROR;
|
||||
}
|
||||
|
|
|
@ -134,6 +134,11 @@ RemoteDevice::IsEncrypted()
|
|||
return true;
|
||||
}
|
||||
|
||||
LocalDevice*
|
||||
RemoteDevice::GetLocalDeviceOwner()
|
||||
{
|
||||
return fDiscovererLocalDevice;
|
||||
}
|
||||
|
||||
/* Private */
|
||||
void
|
||||
|
|
Loading…
Reference in New Issue