Files
haiku-beta6/headers/os/bluetooth/RemoteDevice.h
T
mohammedrattia 91994efedd bluetooth: refactor in remote devices handling
- adding persistent link key storage to avoid re-authentications
- saving important information about remote devices to make it survive reboots
- making all bluetooth status variables uint8 like it is in the command definitions

Change-Id: I8956fb356ee734b9fa0ae9704624f6e5fef39e55
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11203
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-07-15 21:08:28 +00:00

98 lines
2.3 KiB
C++

/*
* Copyright 2007 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
* All rights reserved. Distributed under the terms of the MIT License.
*/
#ifndef _REMOTE_DEVICE_H
#define _REMOTE_DEVICE_H
#include <bluetooth/bluetooth.h>
#include <bluetooth/bluetooth_error.h>
#include <bluetooth/BluetoothDevice.h>
#include <bluetoothserver_p.h>
#include <support/String.h>
#include <ObjectList.h>
#define B_BT_WAIT 0x00
#define B_BT_SUCCEEDED 0x01
namespace Bluetooth {
class Connection;
class LocalDevice;
class RemoteDevice : public BluetoothDevice {
public:
static const int WAIT = B_BT_WAIT;
static const int SUCCEEDED = B_BT_SUCCEEDED;
enum ConnectionState {
CONNECTED,
CONNECTING,
DISCONNECTED
};
static BObjectList<RemoteDevice> GetRemoteDevices(LocalDevice* localDevice);
virtual ~RemoteDevice();
bool IsTrustedDevice();
BString GetFriendlyName(bool alwaysAsk); /* Throwing */
BString GetFriendlyName(void); /* Throwing */
BString GetCachedFriendlyName();
bdaddr_t GetBluetoothAddress();
uint8 GetPageRepetitionMode();
uint16 GetClockOffset();
DeviceClass GetDeviceClass();
bool Equals(RemoteDevice* obj);
status_t Connect();
status_t CancelConnection();
status_t Disconnect(bool removeDevice);
/*static RemoteDevice* GetRemoteDevice(Connection conn); Throwing */
/* bool Authorize(Connection conn); Throwing */
/*bool Encrypt(Connection conn, bool on); Throwing */
/*bool IsAuthorized(Connection conn); Throwing */
RemoteDevice::ConnectionState GetConnectionState();
bool IsEncrypted(); /* Throwing */
BString GetProperty(const char* property); /* Throwing */
status_t GetProperty(const char* property, uint32* value); /* Throwing */
LocalDevice* GetLocalDeviceOwner();
RemoteDevice(const BString& address);
RemoteDevice(const bdaddr_t address, uint8 record[3]);
protected:
/* called by Discovery[Listener|Agent] */
void SetLocalDeviceOwner(LocalDevice* ld);
friend class DiscoveryListener;
private:
LocalDevice* fDiscovererLocalDevice;
BMessenger* fMessenger;
uint8 fPageRepetitionMode;
uint8 fScanPeriodMode;
uint8 fScanMode;
uint16 fClockOffset;
int8 fRSSI;
BString fFriendlyName;
bool fFriendlyNameIsComplete;
};
}
#ifndef _BT_USE_EXPLICIT_NAMESPACE
using Bluetooth::RemoteDevice;
#endif
#endif // _REMOTE_DEVICE_H