mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1223806: Add Bluetooth Core interface, notification and result handler, r=btian
This commit is contained in:
parent
7dac811b76
commit
350896bf18
@ -45,6 +45,193 @@ BluetoothSetupResultHandler::Configuration()
|
||||
BluetoothSetupInterface::~BluetoothSetupInterface()
|
||||
{ }
|
||||
|
||||
//
|
||||
// Bluetooth Core Interface
|
||||
//
|
||||
|
||||
// Notification handling
|
||||
//
|
||||
|
||||
BluetoothCoreNotificationHandler::BluetoothCoreNotificationHandler()
|
||||
{ }
|
||||
|
||||
BluetoothCoreNotificationHandler::~BluetoothCoreNotificationHandler()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreNotificationHandler::AdapterStateChangedNotification(bool aState)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreNotificationHandler::AdapterPropertiesNotification(
|
||||
BluetoothStatus aStatus,int aNumProperties,
|
||||
const BluetoothProperty* aProperties)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreNotificationHandler::RemoteDevicePropertiesNotification(
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aBdAddr,
|
||||
int aNumProperties, const BluetoothProperty* aProperties)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreNotificationHandler::DeviceFoundNotification(
|
||||
int aNumProperties, const BluetoothProperty* aProperties)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreNotificationHandler::DiscoveryStateChangedNotification(
|
||||
bool aState)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreNotificationHandler::PinRequestNotification(
|
||||
const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
|
||||
uint32_t aCod)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreNotificationHandler::SspRequestNotification(
|
||||
const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
|
||||
uint32_t aCod, BluetoothSspVariant aPairingVariant, uint32_t aPassKey)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreNotificationHandler::BondStateChangedNotification(
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
|
||||
BluetoothBondState aState)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreNotificationHandler::AclStateChangedNotification(
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
|
||||
BluetoothAclState aState)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreNotificationHandler::DutModeRecvNotification(
|
||||
uint16_t aOpcode,
|
||||
const uint8_t* aBuf,
|
||||
uint8_t aLen)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreNotificationHandler::LeTestModeNotification(
|
||||
BluetoothStatus aStatus,
|
||||
uint16_t aNumPackets)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreNotificationHandler::EnergyInfoNotification(
|
||||
const BluetoothActivityEnergyInfo& aInfo)
|
||||
{ }
|
||||
|
||||
// Result handling
|
||||
//
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::OnError(BluetoothStatus aStatus)
|
||||
{
|
||||
BT_LOGR("Received error code %d", aStatus);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::Enable()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::Disable()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::GetAdapterProperties()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::GetAdapterProperty()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::SetAdapterProperty()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::GetRemoteDeviceProperties()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::GetRemoteDeviceProperty()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::SetRemoteDeviceProperty()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::GetRemoteServiceRecord()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::GetRemoteServices()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::StartDiscovery()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::CancelDiscovery()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::CreateBond()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::RemoveBond()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::CancelBond()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::GetConnectionState()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::PinReply()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::SspReply()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::DutModeConfigure()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::DutModeSend()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::LeTestMode()
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothCoreResultHandler::ReadEnergyInfo()
|
||||
{ }
|
||||
|
||||
// Interface
|
||||
//
|
||||
|
||||
BluetoothCoreInterface::BluetoothCoreInterface()
|
||||
{ }
|
||||
|
||||
BluetoothCoreInterface::~BluetoothCoreInterface()
|
||||
{ }
|
||||
|
||||
//
|
||||
// Socket Interface
|
||||
//
|
||||
@ -811,7 +998,7 @@ BluetoothGattInterface::~BluetoothGattInterface()
|
||||
{ }
|
||||
|
||||
//
|
||||
// Bluetooth Core Interface
|
||||
// Bluetooth Interface
|
||||
//
|
||||
|
||||
// Notification handling
|
||||
|
@ -49,6 +49,183 @@ protected:
|
||||
virtual ~BluetoothSetupInterface();
|
||||
};
|
||||
|
||||
//
|
||||
// Bluetooth Core Interface
|
||||
//
|
||||
|
||||
class BluetoothCoreNotificationHandler
|
||||
{
|
||||
public:
|
||||
virtual void AdapterStateChangedNotification(bool aState);
|
||||
virtual void AdapterPropertiesNotification(
|
||||
BluetoothStatus aStatus, int aNumProperties,
|
||||
const BluetoothProperty* aProperties);
|
||||
|
||||
virtual void RemoteDevicePropertiesNotification(
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aBdAddr,
|
||||
int aNumProperties, const BluetoothProperty* aProperties);
|
||||
|
||||
virtual void DeviceFoundNotification(
|
||||
int aNumProperties, const BluetoothProperty* aProperties);
|
||||
|
||||
virtual void DiscoveryStateChangedNotification(bool aState);
|
||||
|
||||
virtual void PinRequestNotification(const BluetoothAddress& aRemoteBdAddr,
|
||||
const BluetoothRemoteName& aBdName,
|
||||
uint32_t aCod);
|
||||
virtual void SspRequestNotification(const BluetoothAddress& aRemoteBdAddr,
|
||||
const BluetoothRemoteName& aBdName,
|
||||
uint32_t aCod,
|
||||
BluetoothSspVariant aPairingVariant,
|
||||
uint32_t aPassKey);
|
||||
|
||||
virtual void BondStateChangedNotification(
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
|
||||
BluetoothBondState aState);
|
||||
virtual void AclStateChangedNotification(
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
|
||||
BluetoothAclState aState);
|
||||
|
||||
virtual void DutModeRecvNotification(uint16_t aOpcode,
|
||||
const uint8_t* aBuf, uint8_t aLen);
|
||||
virtual void LeTestModeNotification(BluetoothStatus aStatus,
|
||||
uint16_t aNumPackets);
|
||||
|
||||
virtual void EnergyInfoNotification(const BluetoothActivityEnergyInfo& aInfo);
|
||||
|
||||
protected:
|
||||
BluetoothCoreNotificationHandler();
|
||||
virtual ~BluetoothCoreNotificationHandler();
|
||||
};
|
||||
|
||||
class BluetoothCoreResultHandler
|
||||
: public mozilla::ipc::DaemonSocketResultHandler
|
||||
{
|
||||
public:
|
||||
virtual void OnError(BluetoothStatus aStatus);
|
||||
|
||||
virtual void Enable();
|
||||
virtual void Disable();
|
||||
|
||||
virtual void GetAdapterProperties();
|
||||
virtual void GetAdapterProperty();
|
||||
virtual void SetAdapterProperty();
|
||||
|
||||
virtual void GetRemoteDeviceProperties();
|
||||
virtual void GetRemoteDeviceProperty();
|
||||
virtual void SetRemoteDeviceProperty();
|
||||
|
||||
virtual void GetRemoteServiceRecord();
|
||||
virtual void GetRemoteServices();
|
||||
|
||||
virtual void StartDiscovery();
|
||||
virtual void CancelDiscovery();
|
||||
|
||||
virtual void CreateBond();
|
||||
virtual void RemoveBond();
|
||||
virtual void CancelBond();
|
||||
|
||||
virtual void GetConnectionState();
|
||||
|
||||
virtual void PinReply();
|
||||
virtual void SspReply();
|
||||
|
||||
virtual void DutModeConfigure();
|
||||
virtual void DutModeSend();
|
||||
|
||||
virtual void LeTestMode();
|
||||
|
||||
virtual void ReadEnergyInfo();
|
||||
|
||||
protected:
|
||||
virtual ~BluetoothCoreResultHandler() { }
|
||||
};
|
||||
|
||||
class BluetoothCoreInterface
|
||||
{
|
||||
public:
|
||||
virtual void Enable(BluetoothCoreResultHandler* aRes) = 0;
|
||||
virtual void Disable(BluetoothCoreResultHandler* aRes) = 0;
|
||||
|
||||
/* Adapter Properties */
|
||||
|
||||
virtual void GetAdapterProperties(BluetoothCoreResultHandler* aRes) = 0;
|
||||
virtual void GetAdapterProperty(BluetoothPropertyType,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
virtual void SetAdapterProperty(const BluetoothProperty& aProperty,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
|
||||
/* Remote Device Properties */
|
||||
|
||||
virtual void GetRemoteDeviceProperties(const BluetoothAddress& aRemoteAddr,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
virtual void GetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
|
||||
BluetoothPropertyType aType,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
virtual void SetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
|
||||
const BluetoothProperty& aProperty,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
|
||||
/* Remote Services */
|
||||
|
||||
virtual void GetRemoteServiceRecord(const BluetoothAddress& aRemoteAddr,
|
||||
const BluetoothUuid& aUuid,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
virtual void GetRemoteServices(const BluetoothAddress& aRemoteAddr,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
|
||||
/* Discovery */
|
||||
|
||||
virtual void StartDiscovery(BluetoothCoreResultHandler* aRes) = 0;
|
||||
virtual void CancelDiscovery(BluetoothCoreResultHandler* aRes) = 0;
|
||||
|
||||
/* Bonds */
|
||||
|
||||
virtual void CreateBond(const BluetoothAddress& aBdAddr,
|
||||
BluetoothTransport aTransport,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
virtual void RemoveBond(const BluetoothAddress& aBdAddr,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
virtual void CancelBond(const BluetoothAddress& aBdAddr,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
|
||||
/* Connection */
|
||||
|
||||
virtual void GetConnectionState(const BluetoothAddress& aBdAddr,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
|
||||
/* Authentication */
|
||||
|
||||
virtual void PinReply(const BluetoothAddress& aBdAddr, bool aAccept,
|
||||
const BluetoothPinCode& aPinCode,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
|
||||
virtual void SspReply(const BluetoothAddress& aBdAddr,
|
||||
BluetoothSspVariant aVariant,
|
||||
bool aAccept, uint32_t aPasskey,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
|
||||
/* DUT Mode */
|
||||
|
||||
virtual void DutModeConfigure(bool aEnable,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
virtual void DutModeSend(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
|
||||
/* LE Mode */
|
||||
|
||||
virtual void LeTestMode(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
|
||||
BluetoothCoreResultHandler* aRes) = 0;
|
||||
|
||||
/* Energy Info */
|
||||
|
||||
virtual void ReadEnergyInfo(BluetoothCoreResultHandler* aRes) = 0;
|
||||
|
||||
protected:
|
||||
BluetoothCoreInterface();
|
||||
virtual ~BluetoothCoreInterface();
|
||||
};
|
||||
|
||||
//
|
||||
// Socket Interface
|
||||
//
|
||||
@ -931,7 +1108,7 @@ protected:
|
||||
};
|
||||
|
||||
//
|
||||
// Bluetooth Core Interface
|
||||
// Bluetooth Interface
|
||||
//
|
||||
|
||||
class BluetoothNotificationHandler
|
||||
|
Loading…
Reference in New Issue
Block a user