Create a parent class for the 2 devices class (RemoteDevice LocalDevice)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25596 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes 2008-05-21 21:56:55 +00:00
parent fd585f3c8b
commit 0963754edf
4 changed files with 63 additions and 3 deletions

View File

@ -0,0 +1,46 @@
/*
* Copyright 2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
*
* All rights reserved. Distributed under the terms of the MIT License.
*
*/
#ifndef _BLUETOOTH_DEVICE_H
#define _BLUETOOTH_DEVICE_H
#include <bluetooth/bluetooth.h>
#include <bluetooth/DeviceClass.h>
#include <Messenger.h>
#include <Message.h>
#include <String.h>
namespace Bluetooth {
class BluetoothDevice {
public:
virtual BString GetFriendlyName()=0;
virtual DeviceClass GetDeviceClass()=0;
virtual BString GetProperty(const char* property)=0;
virtual void GetProperty(const char* property, uint32* value)=0;
virtual bdaddr_t GetBluetoothAddress()=0;
protected:
bdaddr_t fBdaddr;
DeviceClass fDeviceClass;
};
}
#ifndef _BT_USE_EXPLICIT_NAMESPACE
using Bluetooth::BluetoothDevice;
#endif
#endif

View File

@ -21,6 +21,11 @@ class DeviceClass {
this->record = record;
}
DeviceClass()
{
this->record = 0;
}
int GetServiceClasses()
{

View File

@ -10,6 +10,7 @@
#include <bluetooth/bluetooth.h>
#include <bluetooth/DeviceClass.h>
#include <bluetooth/BluetoothDevice.h>
#include <bluetooth/HCI/btHCI.h>
@ -23,7 +24,7 @@ namespace Bluetooth {
class DiscoveryAgent;
class LocalDevice {
class LocalDevice : public BluetoothDevice {
public:
/* Possible throwing */

View File

@ -9,6 +9,7 @@
#define _REMOTE_DEVICE_H
#include <bluetooth/bluetooth.h>
#include <bluetooth/BluetoothDevice.h>
#include <String.h>
@ -21,7 +22,7 @@ namespace Bluetooth {
class Connection;
class LocalDevice;
class RemoteDevice {
class RemoteDevice : public BluetoothDevice {
public:
@ -30,7 +31,10 @@ class RemoteDevice {
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 */
@ -40,6 +44,10 @@ class RemoteDevice {
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 */
protected:
RemoteDevice(BString address);
@ -51,7 +59,7 @@ class RemoteDevice {
private:
void SetLocalDeviceOwner(LocalDevice* ld);
bdaddr_t fBdaddr;
LocalDevice* fDiscovererLocalDevice;
uint8 fPageRepetitionMode;