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:
@@ -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
|
||||||
@@ -21,6 +21,11 @@ class DeviceClass {
|
|||||||
this->record = record;
|
this->record = record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DeviceClass()
|
||||||
|
{
|
||||||
|
this->record = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int GetServiceClasses()
|
int GetServiceClasses()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include <bluetooth/bluetooth.h>
|
#include <bluetooth/bluetooth.h>
|
||||||
#include <bluetooth/DeviceClass.h>
|
#include <bluetooth/DeviceClass.h>
|
||||||
|
#include <bluetooth/BluetoothDevice.h>
|
||||||
|
|
||||||
#include <bluetooth/HCI/btHCI.h>
|
#include <bluetooth/HCI/btHCI.h>
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ namespace Bluetooth {
|
|||||||
|
|
||||||
class DiscoveryAgent;
|
class DiscoveryAgent;
|
||||||
|
|
||||||
class LocalDevice {
|
class LocalDevice : public BluetoothDevice {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* Possible throwing */
|
/* Possible throwing */
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#define _REMOTE_DEVICE_H
|
#define _REMOTE_DEVICE_H
|
||||||
|
|
||||||
#include <bluetooth/bluetooth.h>
|
#include <bluetooth/bluetooth.h>
|
||||||
|
#include <bluetooth/BluetoothDevice.h>
|
||||||
|
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
@@ -21,7 +22,7 @@ namespace Bluetooth {
|
|||||||
class Connection;
|
class Connection;
|
||||||
class LocalDevice;
|
class LocalDevice;
|
||||||
|
|
||||||
class RemoteDevice {
|
class RemoteDevice : public BluetoothDevice {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -30,7 +31,10 @@ class RemoteDevice {
|
|||||||
|
|
||||||
bool IsTrustedDevice();
|
bool IsTrustedDevice();
|
||||||
BString GetFriendlyName(bool alwaysAsk); /* Throwing */
|
BString GetFriendlyName(bool alwaysAsk); /* Throwing */
|
||||||
|
BString GetFriendlyName(void); /* Throwing */
|
||||||
bdaddr_t GetBluetoothAddress();
|
bdaddr_t GetBluetoothAddress();
|
||||||
|
DeviceClass GetDeviceClass();
|
||||||
|
|
||||||
bool Equals(RemoteDevice* obj);
|
bool Equals(RemoteDevice* obj);
|
||||||
|
|
||||||
/*static RemoteDevice* GetRemoteDevice(Connection conn); Throwing */
|
/*static RemoteDevice* GetRemoteDevice(Connection conn); Throwing */
|
||||||
@@ -40,6 +44,10 @@ class RemoteDevice {
|
|||||||
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 */
|
||||||
|
void GetProperty(const char* property, uint32* value); /* Throwing */
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
RemoteDevice(BString address);
|
RemoteDevice(BString address);
|
||||||
@@ -51,7 +59,7 @@ class RemoteDevice {
|
|||||||
private:
|
private:
|
||||||
void SetLocalDeviceOwner(LocalDevice* ld);
|
void SetLocalDeviceOwner(LocalDevice* ld);
|
||||||
|
|
||||||
bdaddr_t fBdaddr;
|
|
||||||
LocalDevice* fDiscovererLocalDevice;
|
LocalDevice* fDiscovererLocalDevice;
|
||||||
|
|
||||||
uint8 fPageRepetitionMode;
|
uint8 fPageRepetitionMode;
|
||||||
|
|||||||
Reference in New Issue
Block a user