2014-07-01 15:50:30 +00:00
|
|
|
/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
#ifndef mozilla_dom_bluetooth_bluetoothinterface_h__
|
|
|
|
#define mozilla_dom_bluetooth_bluetoothinterface_h__
|
|
|
|
|
2014-07-01 15:50:30 +00:00
|
|
|
#include "BluetoothCommon.h"
|
2014-08-15 11:41:18 +00:00
|
|
|
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
|
2014-09-26 03:16:36 +00:00
|
|
|
#include "mozilla/dom/TypedArray.h"
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
BEGIN_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
//
|
|
|
|
// Socket Interface
|
|
|
|
//
|
|
|
|
|
2014-07-16 08:23:35 +00:00
|
|
|
class BluetoothSocketResultHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothSocketResultHandler)
|
|
|
|
|
|
|
|
virtual ~BluetoothSocketResultHandler() { }
|
|
|
|
|
2014-08-15 11:41:19 +00:00
|
|
|
virtual void OnError(BluetoothStatus aStatus)
|
2014-07-16 08:23:35 +00:00
|
|
|
{
|
|
|
|
BT_WARNING("Received error code %d", (int)aStatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Listen(int aSockFd) { }
|
2014-07-16 08:24:33 +00:00
|
|
|
virtual void Connect(int aSockFd, const nsAString& aBdAddress,
|
|
|
|
int aConnectionState) { }
|
2014-07-16 08:24:41 +00:00
|
|
|
virtual void Accept(int aSockFd, const nsAString& aBdAddress,
|
|
|
|
int aConnectionState) { }
|
2014-07-16 08:23:35 +00:00
|
|
|
};
|
|
|
|
|
2014-07-01 15:50:30 +00:00
|
|
|
class BluetoothSocketInterface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Init and Cleanup is handled by BluetoothInterface
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void Listen(BluetoothSocketType aType,
|
|
|
|
const nsAString& aServiceName,
|
|
|
|
const uint8_t aServiceUuid[16],
|
|
|
|
int aChannel, bool aEncrypt, bool aAuth,
|
|
|
|
BluetoothSocketResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void Connect(const nsAString& aBdAddr,
|
|
|
|
BluetoothSocketType aType,
|
|
|
|
const uint8_t aUuid[16],
|
|
|
|
int aChannel, bool aEncrypt, bool aAuth,
|
|
|
|
BluetoothSocketResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void Accept(int aFd, BluetoothSocketResultHandler* aRes) = 0;
|
2014-07-16 08:24:41 +00:00
|
|
|
|
2014-09-25 10:35:54 +00:00
|
|
|
virtual void Close(BluetoothSocketResultHandler* aRes) = 0;
|
|
|
|
|
2014-07-01 15:50:30 +00:00
|
|
|
protected:
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual ~BluetoothSocketInterface();
|
2014-07-01 15:50:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// Handsfree Interface
|
|
|
|
//
|
|
|
|
|
2014-09-02 16:02:55 +00:00
|
|
|
class BluetoothHandsfreeNotificationHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~BluetoothHandsfreeNotificationHandler();
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
ConnectionStateNotification(BluetoothHandsfreeConnectionState aState,
|
|
|
|
const nsAString& aBdAddr)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
AudioStateNotification(BluetoothHandsfreeAudioState aState,
|
|
|
|
const nsAString& aBdAddr)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
VoiceRecognitionNotification(BluetoothHandsfreeVoiceRecognitionState aState)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
AnswerCallNotification()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
HangupCallNotification()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
VolumeNotification(BluetoothHandsfreeVolumeType aType, int aVolume)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
DialCallNotification(const nsAString& aNumber)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
DtmfNotification(char aDtmf)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
NRECNotification(BluetoothHandsfreeNRECState aNrec)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
CallHoldNotification(BluetoothHandsfreeCallHoldType aChld)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
CnumNotification()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
CindNotification()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
CopsNotification()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
ClccNotification()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
UnknownAtNotification(const nsACString& aAtString)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
KeyPressedNotification()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BluetoothHandsfreeNotificationHandler()
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2014-07-22 11:53:27 +00:00
|
|
|
class BluetoothHandsfreeResultHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothHandsfreeResultHandler)
|
|
|
|
|
|
|
|
virtual ~BluetoothHandsfreeResultHandler() { }
|
|
|
|
|
2014-08-15 11:41:19 +00:00
|
|
|
virtual void OnError(BluetoothStatus aStatus)
|
2014-07-22 11:53:27 +00:00
|
|
|
{
|
|
|
|
BT_WARNING("Received error code %d", (int)aStatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Init() { }
|
|
|
|
virtual void Cleanup() { }
|
|
|
|
|
|
|
|
virtual void Connect() { }
|
|
|
|
virtual void Disconnect() { }
|
|
|
|
virtual void ConnectAudio() { }
|
|
|
|
virtual void DisconnectAudio() { }
|
|
|
|
|
|
|
|
virtual void StartVoiceRecognition() { }
|
|
|
|
virtual void StopVoiceRecognition() { }
|
|
|
|
|
|
|
|
virtual void VolumeControl() { }
|
|
|
|
|
|
|
|
virtual void DeviceStatusNotification() { }
|
|
|
|
|
|
|
|
virtual void CopsResponse() { }
|
|
|
|
virtual void CindResponse() { }
|
|
|
|
virtual void FormattedAtResponse() { }
|
|
|
|
virtual void AtResponse() { }
|
|
|
|
virtual void ClccResponse() { }
|
|
|
|
virtual void PhoneStateChange() { }
|
|
|
|
};
|
|
|
|
|
2014-07-01 15:50:30 +00:00
|
|
|
class BluetoothHandsfreeInterface
|
|
|
|
{
|
|
|
|
public:
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void Init(
|
|
|
|
BluetoothHandsfreeNotificationHandler* aNotificationHandler,
|
|
|
|
BluetoothHandsfreeResultHandler* aRes) = 0;
|
|
|
|
virtual void Cleanup(BluetoothHandsfreeResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* Connect / Disconnect */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void Connect(const nsAString& aBdAddr,
|
|
|
|
BluetoothHandsfreeResultHandler* aRes) = 0;
|
|
|
|
virtual void Disconnect(const nsAString& aBdAddr,
|
|
|
|
BluetoothHandsfreeResultHandler* aRes) = 0;
|
|
|
|
virtual void ConnectAudio(const nsAString& aBdAddr,
|
|
|
|
BluetoothHandsfreeResultHandler* aRes) = 0;
|
|
|
|
virtual void DisconnectAudio(const nsAString& aBdAddr,
|
|
|
|
BluetoothHandsfreeResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* Voice Recognition */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void StartVoiceRecognition(BluetoothHandsfreeResultHandler* aRes) = 0;
|
|
|
|
virtual void StopVoiceRecognition(BluetoothHandsfreeResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* Volume */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void VolumeControl(BluetoothHandsfreeVolumeType aType, int aVolume,
|
|
|
|
BluetoothHandsfreeResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* Device status */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void DeviceStatusNotification(
|
|
|
|
BluetoothHandsfreeNetworkState aNtkState,
|
|
|
|
BluetoothHandsfreeServiceType aSvcType,
|
|
|
|
int aSignal, int aBattChg, BluetoothHandsfreeResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* Responses */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void CopsResponse(const char* aCops,
|
|
|
|
BluetoothHandsfreeResultHandler* aRes) = 0;
|
|
|
|
virtual void CindResponse(int aSvc, int aNumActive, int aNumHeld,
|
|
|
|
BluetoothHandsfreeCallState aCallSetupState,
|
|
|
|
int aSignal, int aRoam, int aBattChg,
|
|
|
|
BluetoothHandsfreeResultHandler* aRes) = 0;
|
|
|
|
virtual void FormattedAtResponse(const char* aRsp,
|
|
|
|
BluetoothHandsfreeResultHandler* aRes) = 0;
|
|
|
|
virtual void AtResponse(BluetoothHandsfreeAtResponse aResponseCode, int aErrorCode,
|
|
|
|
BluetoothHandsfreeResultHandler* aRes) = 0;
|
|
|
|
virtual void ClccResponse(int aIndex, BluetoothHandsfreeCallDirection aDir,
|
|
|
|
BluetoothHandsfreeCallState aState,
|
|
|
|
BluetoothHandsfreeCallMode aMode,
|
|
|
|
BluetoothHandsfreeCallMptyType aMpty,
|
|
|
|
const nsAString& aNumber,
|
|
|
|
BluetoothHandsfreeCallAddressType aType,
|
|
|
|
BluetoothHandsfreeResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* Phone State */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void PhoneStateChange(int aNumActive, int aNumHeld,
|
|
|
|
BluetoothHandsfreeCallState aCallSetupState,
|
|
|
|
const nsAString& aNumber,
|
|
|
|
BluetoothHandsfreeCallAddressType aType,
|
|
|
|
BluetoothHandsfreeResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
protected:
|
2014-09-23 01:40:36 +00:00
|
|
|
BluetoothHandsfreeInterface();
|
|
|
|
virtual ~BluetoothHandsfreeInterface();
|
2014-07-01 15:50:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// Bluetooth Advanced Audio Interface
|
|
|
|
//
|
|
|
|
|
2014-09-05 08:00:39 +00:00
|
|
|
class BluetoothA2dpNotificationHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~BluetoothA2dpNotificationHandler();
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
ConnectionStateNotification(BluetoothA2dpConnectionState aState,
|
|
|
|
const nsAString& aBdAddr)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
AudioStateNotification(BluetoothA2dpAudioState aState,
|
|
|
|
const nsAString& aBdAddr)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BluetoothA2dpNotificationHandler()
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2014-07-28 07:52:50 +00:00
|
|
|
class BluetoothA2dpResultHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothA2dpResultHandler)
|
|
|
|
|
|
|
|
virtual ~BluetoothA2dpResultHandler() { }
|
|
|
|
|
2014-08-15 11:41:19 +00:00
|
|
|
virtual void OnError(BluetoothStatus aStatus)
|
2014-07-28 07:52:50 +00:00
|
|
|
{
|
2014-08-15 11:41:19 +00:00
|
|
|
BT_WARNING("Received error code %d", (int)aStatus);
|
2014-07-28 07:52:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Init() { }
|
|
|
|
virtual void Cleanup() { }
|
|
|
|
virtual void Connect() { }
|
|
|
|
virtual void Disconnect() { }
|
|
|
|
};
|
|
|
|
|
2014-07-01 15:50:30 +00:00
|
|
|
class BluetoothA2dpInterface
|
|
|
|
{
|
|
|
|
public:
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void Init(BluetoothA2dpNotificationHandler* aNotificationHandler,
|
|
|
|
BluetoothA2dpResultHandler* aRes) = 0;
|
|
|
|
virtual void Cleanup(BluetoothA2dpResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void Connect(const nsAString& aBdAddr,
|
|
|
|
BluetoothA2dpResultHandler* aRes) = 0;
|
|
|
|
virtual void Disconnect(const nsAString& aBdAddr,
|
|
|
|
BluetoothA2dpResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
protected:
|
2014-09-23 01:40:36 +00:00
|
|
|
BluetoothA2dpInterface();
|
|
|
|
virtual ~BluetoothA2dpInterface();
|
2014-07-01 15:50:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// Bluetooth AVRCP Interface
|
|
|
|
//
|
|
|
|
|
2014-09-05 08:00:39 +00:00
|
|
|
class BluetoothAvrcpNotificationHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~BluetoothAvrcpNotificationHandler();
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
GetPlayStatusNotification()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
ListPlayerAppAttrNotification()
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
ListPlayerAppValuesNotification(BluetoothAvrcpPlayerAttribute aAttrId)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
GetPlayerAppValueNotification(uint8_t aNumAttrs,
|
|
|
|
const BluetoothAvrcpPlayerAttribute* aAttrs)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
GetPlayerAppAttrsTextNotification(uint8_t aNumAttrs,
|
|
|
|
const BluetoothAvrcpPlayerAttribute* aAttrs)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
GetPlayerAppValuesTextNotification(uint8_t aAttrId, uint8_t aNumVals,
|
|
|
|
const uint8_t* aValues)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
SetPlayerAppValueNotification(const BluetoothAvrcpPlayerSettings& aSettings)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
GetElementAttrNotification(uint8_t aNumAttrs,
|
|
|
|
const BluetoothAvrcpMediaAttribute* aAttrs)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
RegisterNotificationNotification(BluetoothAvrcpEvent aEvent,
|
|
|
|
uint32_t aParam)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
RemoteFeatureNotification(const nsAString& aBdAddr, unsigned long aFeatures)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
VolumeChangeNotification(uint8_t aVolume, uint8_t aCType)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
PassthroughCmdNotification(int aId, int aKeyState)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BluetoothAvrcpNotificationHandler()
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2014-07-28 07:52:50 +00:00
|
|
|
class BluetoothAvrcpResultHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothAvrcpResultHandler)
|
|
|
|
|
|
|
|
virtual ~BluetoothAvrcpResultHandler() { }
|
|
|
|
|
2014-08-15 11:41:19 +00:00
|
|
|
virtual void OnError(BluetoothStatus aStatus)
|
2014-07-28 07:52:50 +00:00
|
|
|
{
|
2014-08-15 11:41:19 +00:00
|
|
|
BT_WARNING("Received error code %d", (int)aStatus);
|
2014-07-28 07:52:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Init() { }
|
|
|
|
virtual void Cleanup() { }
|
|
|
|
|
|
|
|
virtual void GetPlayStatusRsp() { }
|
|
|
|
|
|
|
|
virtual void ListPlayerAppAttrRsp() { }
|
|
|
|
virtual void ListPlayerAppValueRsp() { }
|
|
|
|
|
|
|
|
virtual void GetPlayerAppValueRsp() { }
|
|
|
|
virtual void GetPlayerAppAttrTextRsp() { }
|
|
|
|
virtual void GetPlayerAppValueTextRsp() { }
|
|
|
|
|
|
|
|
virtual void GetElementAttrRsp() { }
|
|
|
|
|
|
|
|
virtual void SetPlayerAppValueRsp() { }
|
|
|
|
|
|
|
|
virtual void RegisterNotificationRsp() { }
|
|
|
|
|
|
|
|
virtual void SetVolume() { }
|
|
|
|
};
|
|
|
|
|
2014-07-01 15:50:30 +00:00
|
|
|
class BluetoothAvrcpInterface
|
|
|
|
{
|
|
|
|
public:
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void Init(BluetoothAvrcpNotificationHandler* aNotificationHandler,
|
|
|
|
BluetoothAvrcpResultHandler* aRes) = 0;
|
|
|
|
virtual void Cleanup(BluetoothAvrcpResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void GetPlayStatusRsp(ControlPlayStatus aPlayStatus,
|
|
|
|
uint32_t aSongLen, uint32_t aSongPos,
|
|
|
|
BluetoothAvrcpResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void ListPlayerAppAttrRsp(
|
|
|
|
int aNumAttr, const BluetoothAvrcpPlayerAttribute* aPAttrs,
|
|
|
|
BluetoothAvrcpResultHandler* aRes) = 0;
|
|
|
|
virtual void ListPlayerAppValueRsp(int aNumVal, uint8_t* aPVals,
|
|
|
|
BluetoothAvrcpResultHandler* aRes) = 0;
|
2014-07-28 07:52:51 +00:00
|
|
|
|
2014-08-15 11:41:19 +00:00
|
|
|
/* TODO: redesign this interface once we actually use it */
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void GetPlayerAppValueRsp(uint8_t aNumAttrs, const uint8_t* aIds,
|
|
|
|
const uint8_t* aValues,
|
|
|
|
BluetoothAvrcpResultHandler* aRes) = 0;
|
2014-08-15 11:41:19 +00:00
|
|
|
/* TODO: redesign this interface once we actually use it */
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void GetPlayerAppAttrTextRsp(int aNumAttr, const uint8_t* aIds,
|
|
|
|
const char** aTexts,
|
|
|
|
BluetoothAvrcpResultHandler* aRes) = 0;
|
2014-08-15 11:41:19 +00:00
|
|
|
/* TODO: redesign this interface once we actually use it */
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void GetPlayerAppValueTextRsp(int aNumVal, const uint8_t* aIds,
|
|
|
|
const char** aTexts,
|
|
|
|
BluetoothAvrcpResultHandler* aRes) = 0;
|
2014-07-28 07:52:51 +00:00
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void GetElementAttrRsp(uint8_t aNumAttr,
|
|
|
|
const BluetoothAvrcpElementAttribute* aAttr,
|
|
|
|
BluetoothAvrcpResultHandler* aRes) = 0;
|
2014-07-28 07:52:51 +00:00
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void SetPlayerAppValueRsp(BluetoothAvrcpStatus aRspStatus,
|
|
|
|
BluetoothAvrcpResultHandler* aRes) = 0;
|
2014-07-28 07:52:51 +00:00
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void RegisterNotificationRsp(
|
|
|
|
BluetoothAvrcpEvent aEvent, BluetoothAvrcpNotification aType,
|
|
|
|
const BluetoothAvrcpNotificationParam& aParam,
|
|
|
|
BluetoothAvrcpResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void SetVolume(uint8_t aVolume, BluetoothAvrcpResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
protected:
|
2014-09-23 01:40:36 +00:00
|
|
|
BluetoothAvrcpInterface();
|
|
|
|
virtual ~BluetoothAvrcpInterface();
|
2014-07-01 15:50:30 +00:00
|
|
|
};
|
|
|
|
|
2014-09-26 03:16:36 +00:00
|
|
|
//
|
|
|
|
// GATT Interface
|
|
|
|
//
|
|
|
|
|
|
|
|
class BluetoothGattClientNotificationHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~BluetoothGattClientNotificationHandler();
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
RegisterClientNotification(int aStatus,
|
|
|
|
int aClientIf,
|
|
|
|
const BluetoothUuid& aAppUuid)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
ScanResultNotification(const nsAString& aBdAddr,
|
|
|
|
int aRssi,
|
|
|
|
const BluetoothGattAdvData& aAdvData)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
ConnectNotification(int aConnId,
|
|
|
|
int aStatus,
|
|
|
|
int aClientIf,
|
|
|
|
const nsAString& aBdAddr)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
DisconnectNotification(int aConnId,
|
|
|
|
int aStatus,
|
|
|
|
int aClientIf,
|
|
|
|
const nsAString& aBdAddr)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
SearchCompleteNotification(int aConnId, int aStatus) { }
|
|
|
|
virtual void
|
|
|
|
SearchResultNotification(int aConnId,
|
|
|
|
const BluetoothGattServiceId& aServiceId)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
GetCharacteristicNotification(int aConnId,
|
|
|
|
int aStatus,
|
|
|
|
const BluetoothGattServiceId& aServiceId,
|
|
|
|
const BluetoothGattId& aCharId,
|
|
|
|
int aCharProperty)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
GetDescriptorNotification(int aConnId,
|
|
|
|
int aStatus,
|
|
|
|
const BluetoothGattServiceId& aServiceId,
|
|
|
|
const BluetoothGattId& aCharId,
|
|
|
|
const BluetoothGattId& aDescriptorId)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
GetIncludedServiceNotification(int aConnId,
|
|
|
|
int aStatus,
|
|
|
|
const BluetoothGattServiceId& aServiceId,
|
|
|
|
const BluetoothGattServiceId& aIncludedServId)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
RegisterNotificationNotification(int aConnId,
|
|
|
|
int aIsRegister,
|
|
|
|
int aStatus,
|
|
|
|
const BluetoothGattServiceId& aServiceId,
|
|
|
|
const BluetoothGattId& aCharId)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
NotifyNotification(int aConnId, const BluetoothGattNotifyParam& aNotifyParam)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
ReadCharacteristicNotification(int aConnId,
|
|
|
|
int aStatus,
|
|
|
|
const BluetoothGattReadParam& aReadParam)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
WriteCharacteristicNotification(int aConnId,
|
|
|
|
int aStatus,
|
|
|
|
const BluetoothGattWriteParam& aWriteParam)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
ReadDescriptorNotification(int aConnId,
|
|
|
|
int aStatus,
|
|
|
|
const BluetoothGattReadParam& aReadParam)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
WriteDescriptorNotification(int aConnId,
|
|
|
|
int aStatus,
|
|
|
|
const BluetoothGattWriteParam& aWriteParam)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
ExecuteWriteNotification(int aConnId, int aStatus) { }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
ReadRemoteRssiNotification(int aClientIf,
|
|
|
|
const nsAString& aBdAddr,
|
|
|
|
int aRssi,
|
|
|
|
int aStatus)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
virtual void
|
|
|
|
ListenNotification(int aStatus, int aServerIf) { }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BluetoothGattClientNotificationHandler()
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
class BluetoothGattServerNotificationHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~BluetoothGattServerNotificationHandler();
|
|
|
|
// TODO: Add server notifications
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BluetoothGattServerNotificationHandler()
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
class BluetoothGattNotificationHandler
|
|
|
|
: public BluetoothGattClientNotificationHandler
|
|
|
|
, public BluetoothGattServerNotificationHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~BluetoothGattNotificationHandler();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BluetoothGattNotificationHandler()
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
|
|
|
class BluetoothGattClientResultHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothGattClientResultHandler)
|
|
|
|
|
|
|
|
virtual ~BluetoothGattClientResultHandler() { }
|
|
|
|
|
|
|
|
virtual void OnError(BluetoothStatus aStatus)
|
|
|
|
{
|
|
|
|
BT_WARNING("Received error code %d", (int)aStatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void RegisterClient() { }
|
|
|
|
virtual void UnregisterClient() { }
|
|
|
|
|
|
|
|
virtual void Scan() { }
|
|
|
|
|
|
|
|
virtual void Connect() { }
|
|
|
|
virtual void Disconnect() { }
|
|
|
|
|
|
|
|
virtual void Listen() { }
|
|
|
|
virtual void Refresh() { }
|
|
|
|
|
|
|
|
virtual void SearchService() { }
|
|
|
|
virtual void GetIncludedService() { }
|
|
|
|
virtual void GetCharacteristic() { }
|
|
|
|
virtual void GetDescriptor() { }
|
|
|
|
|
|
|
|
virtual void ReadCharacteristic() { }
|
|
|
|
virtual void WriteCharacteristic() { }
|
|
|
|
virtual void ReadDescriptor() { }
|
|
|
|
virtual void WriteDescriptor() { }
|
|
|
|
|
|
|
|
virtual void ExecuteWrite() { }
|
|
|
|
|
|
|
|
virtual void RegisterNotification() { }
|
|
|
|
virtual void DeregisterNotification() { }
|
|
|
|
|
|
|
|
virtual void ReadRemoteRssi() { }
|
|
|
|
virtual void GetDeviceType() { }
|
|
|
|
virtual void SetAdvData() { }
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO: Add GattServerResultHandler
|
|
|
|
|
|
|
|
class BluetoothGattResultHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothGattResultHandler)
|
|
|
|
|
|
|
|
virtual ~BluetoothGattResultHandler() { }
|
|
|
|
|
|
|
|
virtual void OnError(BluetoothStatus aStatus)
|
|
|
|
{
|
|
|
|
BT_WARNING("Received error code %d", (int)aStatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Init() { }
|
|
|
|
virtual void Cleanup() { }
|
|
|
|
};
|
|
|
|
|
|
|
|
class BluetoothGattClientInterface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/* Register / Unregister */
|
|
|
|
virtual void RegisterClient(const BluetoothUuid& aUuid,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
virtual void UnregisterClient(int aClientIf,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
|
|
|
|
/* Start / Stop LE Scan */
|
|
|
|
virtual void Scan(int aClientIf, bool aStart,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
|
|
|
|
/* Connect / Disconnect */
|
|
|
|
virtual void Connect(int aClientIf,
|
|
|
|
const nsAString& aBdAddr,
|
|
|
|
bool aIsDirect, /* auto connect */
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
virtual void Disconnect(int aClientIf,
|
|
|
|
const nsAString& aBdAddr,
|
|
|
|
int aConnId,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
|
|
|
|
/* Start / Stop advertisements to listen for incoming connections */
|
|
|
|
virtual void Listen(int aClientIf,
|
|
|
|
bool aIsStart,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
|
|
|
|
/* Clear the attribute cache for a given device*/
|
|
|
|
virtual void Refresh(int aClientIf,
|
|
|
|
const nsAString& aBdAddr,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
|
|
|
|
/* Enumerate Attributes */
|
|
|
|
virtual void SearchService(int aConnId,
|
|
|
|
const BluetoothUuid& aUuid,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
virtual void GetIncludedService(
|
|
|
|
int aConnId,
|
|
|
|
const BluetoothGattServiceId& aServiceId,
|
|
|
|
const BluetoothGattServiceId& aStartServiceId,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
virtual void GetCharacteristic(int aConnId,
|
|
|
|
const BluetoothGattServiceId& aServiceId,
|
|
|
|
const BluetoothGattId& aStartCharId,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
virtual void GetDescriptor(int aConnId,
|
|
|
|
const BluetoothGattServiceId& aServiceId,
|
|
|
|
const BluetoothGattId& aCharId,
|
|
|
|
const BluetoothGattId& aDescriptorId,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
|
|
|
|
/* Read / Write An Attribute */
|
|
|
|
virtual void ReadCharacteristic(int aConnId,
|
|
|
|
const BluetoothGattServiceId& aServiceId,
|
|
|
|
const BluetoothGattId& aCharId,
|
|
|
|
int aAuthReq,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
virtual void WriteCharacteristic(int aConnId,
|
|
|
|
const BluetoothGattServiceId& aServiceId,
|
|
|
|
const BluetoothGattId& aCharId,
|
|
|
|
int aWriteType,
|
|
|
|
int aLen,
|
|
|
|
int aAuthReq,
|
|
|
|
const ArrayBuffer& aValue,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
virtual void ReadDescriptor(int aConnId,
|
|
|
|
const BluetoothGattServiceId& aServiceId,
|
|
|
|
const BluetoothGattId& aCharId,
|
|
|
|
const BluetoothGattId& aDescriptorId,
|
|
|
|
int aAuthReq,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
virtual void WriteDescriptor(int aConnId,
|
|
|
|
const BluetoothGattServiceId& aServiceId,
|
|
|
|
const BluetoothGattId& aCharId,
|
|
|
|
const BluetoothGattId& aDescriptorId,
|
|
|
|
int aWriteType,
|
|
|
|
int aLen,
|
|
|
|
int aAuthReq,
|
|
|
|
const ArrayBuffer& aValue,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
|
|
|
|
/* Execute / Abort Prepared Write*/
|
|
|
|
virtual void ExecuteWrite(int aConnId,
|
|
|
|
int aIsExecute,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/* Register / Deregister Characteristic Notifications or Indications */
|
|
|
|
virtual void RegisterNotification(
|
|
|
|
int aClientIf,
|
|
|
|
const nsAString& aBdAddr,
|
|
|
|
const BluetoothGattServiceId& aServiceId,
|
|
|
|
const BluetoothGattId& aCharId,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
virtual void DeregisterNotification(
|
|
|
|
int aClientIf,
|
|
|
|
const nsAString& aBdAddr,
|
|
|
|
const BluetoothGattServiceId& aServiceId,
|
|
|
|
const BluetoothGattId& aCharId,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
|
|
|
|
virtual void ReadRemoteRssi(int aClientIf,
|
|
|
|
const nsAString& aBdAddr,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
|
|
|
|
virtual void GetDeviceType(const nsAString& aBdAddr,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
|
|
|
|
/* Set advertising data or scan response data */
|
|
|
|
virtual void SetAdvData(int aServerIf,
|
|
|
|
bool aIsScanRsp,
|
|
|
|
bool aIsNameIncluded,
|
|
|
|
bool aIsTxPowerIncluded,
|
|
|
|
int aMinInterval,
|
|
|
|
int aMaxInterval,
|
|
|
|
int aApperance,
|
|
|
|
uint8_t aManufacturerLen,
|
|
|
|
const ArrayBuffer& aManufacturerData,
|
|
|
|
BluetoothGattClientResultHandler* aRes) = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BluetoothGattClientInterface();
|
|
|
|
virtual ~BluetoothGattClientInterface();
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO: Add GattServerInterface
|
|
|
|
|
|
|
|
class BluetoothGattInterface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void Init(BluetoothGattNotificationHandler* aNotificationHandler,
|
|
|
|
BluetoothGattResultHandler* aRes) = 0;
|
|
|
|
virtual void Cleanup(BluetoothGattResultHandler* aRes) = 0;
|
|
|
|
|
|
|
|
virtual BluetoothGattClientInterface* GetBluetoothGattClientInterface() = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BluetoothGattInterface();
|
|
|
|
virtual ~BluetoothGattInterface();
|
|
|
|
};
|
|
|
|
|
2014-07-01 15:50:30 +00:00
|
|
|
//
|
|
|
|
// Bluetooth Core Interface
|
|
|
|
//
|
|
|
|
|
2014-09-02 10:38:45 +00:00
|
|
|
class BluetoothNotificationHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~BluetoothNotificationHandler();
|
|
|
|
|
|
|
|
virtual void AdapterStateChangedNotification(bool aState) { }
|
|
|
|
virtual void AdapterPropertiesNotification(
|
|
|
|
BluetoothStatus aStatus, int aNumProperties,
|
|
|
|
const BluetoothProperty* aProperties) { }
|
|
|
|
|
|
|
|
virtual void RemoteDevicePropertiesNotification(
|
|
|
|
BluetoothStatus aStatus, const nsAString& aBdAddr,
|
|
|
|
int aNumProperties, const BluetoothProperty* aProperties) { }
|
|
|
|
|
|
|
|
virtual void DeviceFoundNotification(
|
|
|
|
int aNumProperties, const BluetoothProperty* aProperties) { }
|
|
|
|
|
|
|
|
virtual void DiscoveryStateChangedNotification(bool aState) { }
|
|
|
|
|
|
|
|
virtual void PinRequestNotification(const nsAString& aRemoteBdAddr,
|
|
|
|
const nsAString& aBdName, uint32_t aCod) { }
|
|
|
|
virtual void SspRequestNotification(const nsAString& aRemoteBdAddr,
|
|
|
|
const nsAString& aBdName,
|
|
|
|
uint32_t aCod,
|
|
|
|
BluetoothSspVariant aPairingVariant,
|
|
|
|
uint32_t aPassKey) { }
|
|
|
|
|
|
|
|
virtual void BondStateChangedNotification(BluetoothStatus aStatus,
|
|
|
|
const nsAString& aRemoteBdAddr,
|
|
|
|
BluetoothBondState aState) { }
|
|
|
|
virtual void AclStateChangedNotification(BluetoothStatus aStatus,
|
|
|
|
const nsAString& aRemoteBdAddr,
|
|
|
|
bool aState) { }
|
|
|
|
|
|
|
|
virtual void DutModeRecvNotification(uint16_t aOpcode,
|
|
|
|
const uint8_t* aBuf, uint8_t aLen) { }
|
|
|
|
virtual void LeTestModeNotification(BluetoothStatus aStatus,
|
|
|
|
uint16_t aNumPackets) { }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
BluetoothNotificationHandler()
|
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2014-07-09 07:37:40 +00:00
|
|
|
class BluetoothResultHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(BluetoothResultHandler)
|
|
|
|
|
|
|
|
virtual ~BluetoothResultHandler() { }
|
|
|
|
|
2014-08-15 11:41:19 +00:00
|
|
|
virtual void OnError(BluetoothStatus aStatus)
|
2014-07-09 07:37:40 +00:00
|
|
|
{
|
|
|
|
BT_LOGR("Received error code %d", aStatus);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void Init() { }
|
|
|
|
virtual void Cleanup() { }
|
|
|
|
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 PinReply() { }
|
|
|
|
virtual void SspReply() { }
|
|
|
|
|
|
|
|
virtual void DutModeConfigure() { }
|
|
|
|
virtual void DutModeSend() { }
|
|
|
|
|
|
|
|
virtual void LeTestMode() { }
|
|
|
|
};
|
|
|
|
|
2014-07-01 15:50:30 +00:00
|
|
|
class BluetoothInterface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static BluetoothInterface* GetInstance();
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void Init(BluetoothNotificationHandler* aNotificationHandler,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
|
|
|
virtual void Cleanup(BluetoothResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void Enable(BluetoothResultHandler* aRes) = 0;
|
|
|
|
virtual void Disable(BluetoothResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* Adapter Properties */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void GetAdapterProperties(BluetoothResultHandler* aRes) = 0;
|
|
|
|
virtual void GetAdapterProperty(const nsAString& aName,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
|
|
|
virtual void SetAdapterProperty(const BluetoothNamedValue& aProperty,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* Remote Device Properties */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void GetRemoteDeviceProperties(const nsAString& aRemoteAddr,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
|
|
|
virtual void GetRemoteDeviceProperty(const nsAString& aRemoteAddr,
|
|
|
|
const nsAString& aName,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
|
|
|
virtual void SetRemoteDeviceProperty(const nsAString& aRemoteAddr,
|
|
|
|
const BluetoothNamedValue& aProperty,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* Remote Services */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void GetRemoteServiceRecord(const nsAString& aRemoteAddr,
|
|
|
|
const uint8_t aUuid[16],
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
|
|
|
virtual void GetRemoteServices(const nsAString& aRemoteAddr,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* Discovery */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void StartDiscovery(BluetoothResultHandler* aRes) = 0;
|
|
|
|
virtual void CancelDiscovery(BluetoothResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* Bonds */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void CreateBond(const nsAString& aBdAddr,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
|
|
|
virtual void RemoveBond(const nsAString& aBdAddr,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
|
|
|
virtual void CancelBond(const nsAString& aBdAddr,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* Authentication */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void PinReply(const nsAString& aBdAddr, bool aAccept,
|
|
|
|
const nsAString& aPinCode,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void SspReply(const nsAString& aBdAddr, const nsAString& aVariant,
|
|
|
|
bool aAccept, uint32_t aPasskey,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* DUT Mode */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void DutModeConfigure(bool aEnable,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
|
|
|
virtual void DutModeSend(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* LE Mode */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual void LeTestMode(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
|
|
|
|
BluetoothResultHandler* aRes) = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
/* Profile Interfaces */
|
|
|
|
|
2014-09-23 01:40:36 +00:00
|
|
|
virtual BluetoothSocketInterface* GetBluetoothSocketInterface() = 0;
|
|
|
|
virtual BluetoothHandsfreeInterface* GetBluetoothHandsfreeInterface() = 0;
|
|
|
|
virtual BluetoothA2dpInterface* GetBluetoothA2dpInterface() = 0;
|
|
|
|
virtual BluetoothAvrcpInterface* GetBluetoothAvrcpInterface() = 0;
|
2014-09-26 03:16:36 +00:00
|
|
|
virtual BluetoothGattInterface* GetBluetoothGattInterface() = 0;
|
2014-07-01 15:50:30 +00:00
|
|
|
|
|
|
|
protected:
|
2014-09-23 01:40:36 +00:00
|
|
|
BluetoothInterface();
|
|
|
|
virtual ~BluetoothInterface();
|
2014-07-01 15:50:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
END_BLUETOOTH_NAMESPACE
|
|
|
|
|
|
|
|
#endif
|