mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 05:48:26 +00:00
Bug 1207649: Convert Bluetooth Core backend to |BluetoothAddress|, r=brsun
This patch converts all methods in Bluetooth's Core interface to use |BluetoothAddress|.
This commit is contained in:
parent
25f47780dd
commit
4a49e25f31
@ -151,7 +151,7 @@ BluetoothDaemonCoreModule::SetAdapterPropertyCmd(
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonCoreModule::GetRemoteDevicePropertiesCmd(
|
||||
const nsAString& aRemoteAddr, BluetoothResultHandler* aRes)
|
||||
const BluetoothAddress& aRemoteAddr, BluetoothResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -159,8 +159,7 @@ BluetoothDaemonCoreModule::GetRemoteDevicePropertiesCmd(
|
||||
new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_REMOTE_DEVICE_PROPERTIES,
|
||||
0));
|
||||
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(aRemoteAddr), *pdu);
|
||||
nsresult rv = PackPDU(aRemoteAddr, *pdu);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -174,7 +173,7 @@ BluetoothDaemonCoreModule::GetRemoteDevicePropertiesCmd(
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonCoreModule::GetRemoteDevicePropertyCmd(
|
||||
const nsAString& aRemoteAddr,
|
||||
const BluetoothAddress& aRemoteAddr,
|
||||
const nsAString& aName,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
@ -185,7 +184,7 @@ BluetoothDaemonCoreModule::GetRemoteDevicePropertyCmd(
|
||||
0));
|
||||
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(aRemoteAddr),
|
||||
aRemoteAddr,
|
||||
PackConversion<nsAString, BluetoothPropertyType>(aName), *pdu);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
@ -200,7 +199,7 @@ BluetoothDaemonCoreModule::GetRemoteDevicePropertyCmd(
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonCoreModule::SetRemoteDevicePropertyCmd(
|
||||
const nsAString& aRemoteAddr,
|
||||
const BluetoothAddress& aRemoteAddr,
|
||||
const BluetoothNamedValue& aProperty,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
@ -210,9 +209,7 @@ BluetoothDaemonCoreModule::SetRemoteDevicePropertyCmd(
|
||||
new DaemonSocketPDU(SERVICE_ID, OPCODE_SET_REMOTE_DEVICE_PROPERTY,
|
||||
0));
|
||||
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(aRemoteAddr),
|
||||
aProperty, *pdu);
|
||||
nsresult rv = PackPDU(aRemoteAddr, aProperty, *pdu);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -226,7 +223,7 @@ BluetoothDaemonCoreModule::SetRemoteDevicePropertyCmd(
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonCoreModule::GetRemoteServiceRecordCmd(
|
||||
const nsAString& aRemoteAddr, const BluetoothUuid& aUuid,
|
||||
const BluetoothAddress& aRemoteAddr, const BluetoothUuid& aUuid,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -235,9 +232,7 @@ BluetoothDaemonCoreModule::GetRemoteServiceRecordCmd(
|
||||
new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_REMOTE_SERVICE_RECORD,
|
||||
0));
|
||||
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(aRemoteAddr),
|
||||
aUuid, *pdu);
|
||||
nsresult rv = PackPDU(aRemoteAddr, aUuid, *pdu);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -251,15 +246,14 @@ BluetoothDaemonCoreModule::GetRemoteServiceRecordCmd(
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonCoreModule::GetRemoteServicesCmd(
|
||||
const nsAString& aRemoteAddr, BluetoothResultHandler* aRes)
|
||||
const BluetoothAddress& aRemoteAddr, BluetoothResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsAutoPtr<DaemonSocketPDU> pdu(
|
||||
new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_REMOTE_SERVICES, 0));
|
||||
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(aRemoteAddr), *pdu);
|
||||
nsresult rv = PackPDU(aRemoteAddr, *pdu);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -306,7 +300,7 @@ BluetoothDaemonCoreModule::CancelDiscoveryCmd(BluetoothResultHandler* aRes)
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonCoreModule::CreateBondCmd(const nsAString& aBdAddr,
|
||||
BluetoothDaemonCoreModule::CreateBondCmd(const BluetoothAddress& aBdAddr,
|
||||
BluetoothTransport aTransport,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
@ -317,11 +311,9 @@ BluetoothDaemonCoreModule::CreateBondCmd(const nsAString& aBdAddr,
|
||||
0));
|
||||
|
||||
#if ANDROID_VERSION >= 21
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(aBdAddr), aTransport, *pdu);
|
||||
nsresult rv = PackPDU(aBdAddr, aTransport, *pdu);
|
||||
#else
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(aBdAddr), *pdu);
|
||||
nsresult rv = PackPDU(aBdAddr, *pdu);
|
||||
#endif
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
@ -335,7 +327,7 @@ BluetoothDaemonCoreModule::CreateBondCmd(const nsAString& aBdAddr,
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonCoreModule::RemoveBondCmd(const nsAString& aBdAddr,
|
||||
BluetoothDaemonCoreModule::RemoveBondCmd(const BluetoothAddress& aBdAddr,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -344,8 +336,7 @@ BluetoothDaemonCoreModule::RemoveBondCmd(const nsAString& aBdAddr,
|
||||
new DaemonSocketPDU(SERVICE_ID, OPCODE_REMOVE_BOND,
|
||||
0));
|
||||
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(aBdAddr), *pdu);
|
||||
nsresult rv = PackPDU(aBdAddr, *pdu);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -358,7 +349,7 @@ BluetoothDaemonCoreModule::RemoveBondCmd(const nsAString& aBdAddr,
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonCoreModule::CancelBondCmd(const nsAString& aBdAddr,
|
||||
BluetoothDaemonCoreModule::CancelBondCmd(const BluetoothAddress& aBdAddr,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -367,8 +358,7 @@ BluetoothDaemonCoreModule::CancelBondCmd(const nsAString& aBdAddr,
|
||||
new DaemonSocketPDU(SERVICE_ID, OPCODE_CANCEL_BOND,
|
||||
0));
|
||||
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(aBdAddr), *pdu);
|
||||
nsresult rv = PackPDU(aBdAddr, *pdu);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -381,7 +371,8 @@ BluetoothDaemonCoreModule::CancelBondCmd(const nsAString& aBdAddr,
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonCoreModule::PinReplyCmd(const nsAString& aBdAddr, bool aAccept,
|
||||
BluetoothDaemonCoreModule::PinReplyCmd(const BluetoothAddress& aBdAddr,
|
||||
bool aAccept,
|
||||
const nsAString& aPinCode,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
@ -392,7 +383,7 @@ BluetoothDaemonCoreModule::PinReplyCmd(const nsAString& aBdAddr, bool aAccept,
|
||||
0));
|
||||
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(aBdAddr),
|
||||
aBdAddr,
|
||||
aAccept,
|
||||
PackConversion<nsAString, BluetoothPinCode>(aPinCode), *pdu);
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -407,7 +398,7 @@ BluetoothDaemonCoreModule::PinReplyCmd(const nsAString& aBdAddr, bool aAccept,
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonCoreModule::SspReplyCmd(const nsAString& aBdAddr,
|
||||
BluetoothDaemonCoreModule::SspReplyCmd(const BluetoothAddress& aBdAddr,
|
||||
BluetoothSspVariant aVariant,
|
||||
bool aAccept, uint32_t aPasskey,
|
||||
BluetoothResultHandler* aRes)
|
||||
@ -418,9 +409,7 @@ BluetoothDaemonCoreModule::SspReplyCmd(const nsAString& aBdAddr,
|
||||
new DaemonSocketPDU(SERVICE_ID, OPCODE_SSP_REPLY,
|
||||
0));
|
||||
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(aBdAddr),
|
||||
aVariant, aAccept, aPasskey, *pdu);
|
||||
nsresult rv = PackPDU(aBdAddr, aVariant, aAccept, aPasskey, *pdu);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -866,7 +855,7 @@ public:
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothStatus& aArg1, nsString& aArg2, int& aArg3,
|
||||
operator () (BluetoothStatus& aArg1, BluetoothAddress& aArg2, int& aArg3,
|
||||
nsAutoArrayPtr<BluetoothProperty>& aArg4) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
@ -878,8 +867,7 @@ public:
|
||||
}
|
||||
|
||||
/* Read address */
|
||||
rv = UnpackPDU(
|
||||
pdu, UnpackConversion<BluetoothAddress, nsAString>(aArg2));
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -973,13 +961,12 @@ public:
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (nsString& aArg1, nsString& aArg2, uint32_t& aArg3) const
|
||||
operator () (BluetoothAddress& aArg1, nsString& aArg2, uint32_t& aArg3) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read remote address */
|
||||
nsresult rv = UnpackPDU(
|
||||
pdu, UnpackConversion<BluetoothAddress, nsAString>(aArg1));
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -1020,14 +1007,13 @@ public:
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (nsString& aArg1, nsString& aArg2, uint32_t& aArg3,
|
||||
operator () (BluetoothAddress& aArg1, nsString& aArg2, uint32_t& aArg3,
|
||||
BluetoothSspVariant& aArg4, uint32_t& aArg5) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read remote address */
|
||||
nsresult rv = UnpackPDU(
|
||||
pdu, UnpackConversion<BluetoothAddress, nsAString>(aArg1));
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -1080,7 +1066,7 @@ public:
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothStatus& aArg1, nsString& aArg2,
|
||||
operator () (BluetoothStatus& aArg1, BluetoothAddress& aArg2,
|
||||
BluetoothBondState& aArg3) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
@ -1092,8 +1078,7 @@ public:
|
||||
}
|
||||
|
||||
/* Read remote address */
|
||||
rv = UnpackPDU(
|
||||
pdu, UnpackConversion<BluetoothAddress, nsAString>(aArg2));
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
@ -1127,7 +1112,8 @@ public:
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothStatus& aArg1, nsString& aArg2, bool& aArg3) const
|
||||
operator () (BluetoothStatus& aArg1, BluetoothAddress& aArg2,
|
||||
bool& aArg3) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
@ -1138,8 +1124,7 @@ public:
|
||||
}
|
||||
|
||||
/* Read remote address */
|
||||
rv = UnpackPDU(
|
||||
pdu, UnpackConversion<BluetoothAddress, nsAString>(aArg2));
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -85,43 +85,44 @@ public:
|
||||
nsresult SetAdapterPropertyCmd(const BluetoothNamedValue& aProperty,
|
||||
BluetoothResultHandler* aRes);
|
||||
|
||||
nsresult GetRemoteDevicePropertiesCmd(const nsAString& aRemoteAddr,
|
||||
nsresult GetRemoteDevicePropertiesCmd(const BluetoothAddress& aRemoteAddr,
|
||||
BluetoothResultHandler* aRes);
|
||||
|
||||
nsresult GetRemoteDevicePropertyCmd(const nsAString& aRemoteAddr,
|
||||
nsresult GetRemoteDevicePropertyCmd(const BluetoothAddress& aRemoteAddr,
|
||||
const nsAString& aName,
|
||||
BluetoothResultHandler* aRes);
|
||||
|
||||
nsresult SetRemoteDevicePropertyCmd(const nsAString& aRemoteAddr,
|
||||
nsresult SetRemoteDevicePropertyCmd(const BluetoothAddress& aRemoteAddr,
|
||||
const BluetoothNamedValue& aProperty,
|
||||
BluetoothResultHandler* aRes);
|
||||
|
||||
nsresult GetRemoteServiceRecordCmd(const nsAString& aRemoteAddr,
|
||||
nsresult GetRemoteServiceRecordCmd(const BluetoothAddress& aRemoteAddr,
|
||||
const BluetoothUuid& aUuid,
|
||||
BluetoothResultHandler* aRes);
|
||||
|
||||
nsresult GetRemoteServicesCmd(const nsAString& aRemoteAddr,
|
||||
nsresult GetRemoteServicesCmd(const BluetoothAddress& aRemoteAddr,
|
||||
BluetoothResultHandler* aRes);
|
||||
|
||||
nsresult StartDiscoveryCmd(BluetoothResultHandler* aRes);
|
||||
|
||||
nsresult CancelDiscoveryCmd(BluetoothResultHandler* aRes);
|
||||
|
||||
nsresult CreateBondCmd(const nsAString& aBdAddr,
|
||||
nsresult CreateBondCmd(const BluetoothAddress& aBdAddr,
|
||||
BluetoothTransport aTransport,
|
||||
BluetoothResultHandler* aRes);
|
||||
|
||||
nsresult RemoveBondCmd(const nsAString& aBdAddr,
|
||||
nsresult RemoveBondCmd(const BluetoothAddress& aBdAddr,
|
||||
BluetoothResultHandler* aRes);
|
||||
|
||||
nsresult CancelBondCmd(const nsAString& aBdAddr,
|
||||
nsresult CancelBondCmd(const BluetoothAddress& aBdAddr,
|
||||
BluetoothResultHandler* aRes);
|
||||
|
||||
nsresult PinReplyCmd(const nsAString& aBdAddr, bool aAccept,
|
||||
nsresult PinReplyCmd(const BluetoothAddress& aBdAddr, bool aAccept,
|
||||
const nsAString& aPinCode,
|
||||
BluetoothResultHandler* aRes);
|
||||
|
||||
nsresult SspReplyCmd(const nsAString& aBdAddr, BluetoothSspVariant aVariant,
|
||||
nsresult SspReplyCmd(const BluetoothAddress& aBdAddr,
|
||||
BluetoothSspVariant aVariant,
|
||||
bool aAccept, uint32_t aPasskey,
|
||||
BluetoothResultHandler* aRes);
|
||||
|
||||
@ -250,9 +251,9 @@ private:
|
||||
AdapterPropertiesNotification;
|
||||
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable4<
|
||||
NotificationHandlerWrapper, void, BluetoothStatus, nsString, int,
|
||||
nsAutoArrayPtr<BluetoothProperty>, BluetoothStatus, const nsAString&,
|
||||
int, const BluetoothProperty*>
|
||||
NotificationHandlerWrapper, void, BluetoothStatus, BluetoothAddress, int,
|
||||
nsAutoArrayPtr<BluetoothProperty>, BluetoothStatus,
|
||||
const BluetoothAddress&, int, const BluetoothProperty*>
|
||||
RemoteDevicePropertiesNotification;
|
||||
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable2<
|
||||
@ -265,23 +266,23 @@ private:
|
||||
DiscoveryStateChangedNotification;
|
||||
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
NotificationHandlerWrapper, void, nsString, nsString, uint32_t,
|
||||
const nsAString&, const nsAString&>
|
||||
NotificationHandlerWrapper, void, BluetoothAddress, nsString, uint32_t,
|
||||
const BluetoothAddress&, const nsAString&>
|
||||
PinRequestNotification;
|
||||
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable5<
|
||||
NotificationHandlerWrapper, void, nsString, nsString, uint32_t,
|
||||
BluetoothSspVariant, uint32_t, const nsAString&, const nsAString&>
|
||||
NotificationHandlerWrapper, void, BluetoothAddress, nsString, uint32_t,
|
||||
BluetoothSspVariant, uint32_t, const BluetoothAddress&, const nsAString&>
|
||||
SspRequestNotification;
|
||||
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
NotificationHandlerWrapper, void, BluetoothStatus, nsString,
|
||||
BluetoothBondState, BluetoothStatus, const nsAString&>
|
||||
NotificationHandlerWrapper, void, BluetoothStatus, BluetoothAddress,
|
||||
BluetoothBondState, BluetoothStatus, const BluetoothAddress&>
|
||||
BondStateChangedNotification;
|
||||
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
NotificationHandlerWrapper, void, BluetoothStatus, nsString, bool,
|
||||
BluetoothStatus, const nsAString&>
|
||||
NotificationHandlerWrapper, void, BluetoothStatus, BluetoothAddress, bool,
|
||||
BluetoothStatus, const BluetoothAddress&>
|
||||
AclStateChangedNotification;
|
||||
|
||||
typedef mozilla::ipc::DaemonNotificationRunnable3<
|
||||
|
@ -1629,8 +1629,7 @@ UnpackPDU(DaemonSocketPDU& aPDU, BluetoothProperty& aOut)
|
||||
}
|
||||
break;
|
||||
case PROPERTY_BDADDR:
|
||||
rv = UnpackPDU<BluetoothAddress>(
|
||||
aPDU, UnpackConversion<BluetoothAddress, nsAString>(aOut.mString));
|
||||
rv = UnpackPDU(aPDU, aOut.mBdAddress);
|
||||
break;
|
||||
case PROPERTY_UUIDS: {
|
||||
size_t numUuids = len / MAX_UUID_SIZE;
|
||||
@ -1655,17 +1654,8 @@ UnpackPDU(DaemonSocketPDU& aPDU, BluetoothProperty& aOut)
|
||||
case PROPERTY_ADAPTER_BONDED_DEVICES: {
|
||||
/* unpack addresses */
|
||||
size_t numAddresses = len / BLUETOOTH_ADDRESS_BYTES;
|
||||
nsAutoArrayPtr<BluetoothAddress> addresses;
|
||||
UnpackArray<BluetoothAddress> addressArray(addresses, numAddresses);
|
||||
rv = UnpackPDU(aPDU, addressArray);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
/* convert addresses to strings */
|
||||
aOut.mStringArray.SetLength(numAddresses);
|
||||
ConvertArray<BluetoothAddress> convertArray(addressArray.mData,
|
||||
addressArray.mLength);
|
||||
rv = Convert(convertArray, aOut.mStringArray);
|
||||
aOut.mBdAddressArray.SetLength(numAddresses);
|
||||
rv = UnpackPDU(aPDU, aOut.mBdAddressArray);
|
||||
}
|
||||
break;
|
||||
case PROPERTY_REMOTE_RSSI: {
|
||||
|
@ -667,7 +667,7 @@ BluetoothDaemonInterface::SetAdapterProperty(
|
||||
|
||||
void
|
||||
BluetoothDaemonInterface::GetRemoteDeviceProperties(
|
||||
const nsAString& aRemoteAddr, BluetoothResultHandler* aRes)
|
||||
const BluetoothAddress& aRemoteAddr, BluetoothResultHandler* aRes)
|
||||
{
|
||||
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
|
||||
(mProtocol)->GetRemoteDevicePropertiesCmd(aRemoteAddr, aRes);
|
||||
@ -678,7 +678,7 @@ BluetoothDaemonInterface::GetRemoteDeviceProperties(
|
||||
|
||||
void
|
||||
BluetoothDaemonInterface::GetRemoteDeviceProperty(
|
||||
const nsAString& aRemoteAddr, const nsAString& aName,
|
||||
const BluetoothAddress& aRemoteAddr, const nsAString& aName,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
|
||||
@ -690,7 +690,7 @@ BluetoothDaemonInterface::GetRemoteDeviceProperty(
|
||||
|
||||
void
|
||||
BluetoothDaemonInterface::SetRemoteDeviceProperty(
|
||||
const nsAString& aRemoteAddr, const BluetoothNamedValue& aProperty,
|
||||
const BluetoothAddress& aRemoteAddr, const BluetoothNamedValue& aProperty,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
|
||||
@ -703,9 +703,9 @@ BluetoothDaemonInterface::SetRemoteDeviceProperty(
|
||||
/* Remote Services */
|
||||
|
||||
void
|
||||
BluetoothDaemonInterface::GetRemoteServiceRecord(const nsAString& aRemoteAddr,
|
||||
const BluetoothUuid& aUuid,
|
||||
BluetoothResultHandler* aRes)
|
||||
BluetoothDaemonInterface::GetRemoteServiceRecord(
|
||||
const BluetoothAddress& aRemoteAddr, const BluetoothUuid& aUuid,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
|
||||
(mProtocol)->GetRemoteServiceRecordCmd(aRemoteAddr, aUuid, aRes);
|
||||
@ -715,8 +715,8 @@ BluetoothDaemonInterface::GetRemoteServiceRecord(const nsAString& aRemoteAddr,
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonInterface::GetRemoteServices(const nsAString& aRemoteAddr,
|
||||
BluetoothResultHandler* aRes)
|
||||
BluetoothDaemonInterface::GetRemoteServices(
|
||||
const BluetoothAddress& aRemoteAddr, BluetoothResultHandler* aRes)
|
||||
{
|
||||
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
|
||||
(mProtocol)->GetRemoteServicesCmd(aRemoteAddr, aRes);
|
||||
@ -750,7 +750,7 @@ BluetoothDaemonInterface::CancelDiscovery(BluetoothResultHandler* aRes)
|
||||
/* Bonds */
|
||||
|
||||
void
|
||||
BluetoothDaemonInterface::CreateBond(const nsAString& aBdAddr,
|
||||
BluetoothDaemonInterface::CreateBond(const BluetoothAddress& aBdAddr,
|
||||
BluetoothTransport aTransport,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
@ -762,7 +762,7 @@ BluetoothDaemonInterface::CreateBond(const nsAString& aBdAddr,
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonInterface::RemoveBond(const nsAString& aBdAddr,
|
||||
BluetoothDaemonInterface::RemoveBond(const BluetoothAddress& aBdAddr,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
|
||||
@ -773,7 +773,7 @@ BluetoothDaemonInterface::RemoveBond(const nsAString& aBdAddr,
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonInterface::CancelBond(const nsAString& aBdAddr,
|
||||
BluetoothDaemonInterface::CancelBond(const BluetoothAddress& aBdAddr,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
nsresult rv = static_cast<BluetoothDaemonCoreModule*>
|
||||
@ -786,7 +786,7 @@ BluetoothDaemonInterface::CancelBond(const nsAString& aBdAddr,
|
||||
/* Connection */
|
||||
|
||||
void
|
||||
BluetoothDaemonInterface::GetConnectionState(const nsAString& aBdAddr,
|
||||
BluetoothDaemonInterface::GetConnectionState(const BluetoothAddress& aBdAddr,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
// NO-OP: no corresponding interface of current BlueZ
|
||||
@ -795,7 +795,8 @@ BluetoothDaemonInterface::GetConnectionState(const nsAString& aBdAddr,
|
||||
/* Authentication */
|
||||
|
||||
void
|
||||
BluetoothDaemonInterface::PinReply(const nsAString& aBdAddr, bool aAccept,
|
||||
BluetoothDaemonInterface::PinReply(const BluetoothAddress& aBdAddr,
|
||||
bool aAccept,
|
||||
const nsAString& aPinCode,
|
||||
BluetoothResultHandler* aRes)
|
||||
{
|
||||
@ -807,7 +808,7 @@ BluetoothDaemonInterface::PinReply(const nsAString& aBdAddr, bool aAccept,
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonInterface::SspReply(const nsAString& aBdAddr,
|
||||
BluetoothDaemonInterface::SspReply(const BluetoothAddress& aBdAddr,
|
||||
BluetoothSspVariant aVariant,
|
||||
bool aAccept, uint32_t aPasskey,
|
||||
BluetoothResultHandler* aRes)
|
||||
|
@ -62,21 +62,21 @@ public:
|
||||
|
||||
/* Remote Device Properties */
|
||||
|
||||
void GetRemoteDeviceProperties(const nsAString& aRemoteAddr,
|
||||
void GetRemoteDeviceProperties(const BluetoothAddress& aRemoteAddr,
|
||||
BluetoothResultHandler* aRes) override;
|
||||
void GetRemoteDeviceProperty(const nsAString& aRemoteAddr,
|
||||
void GetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
|
||||
const nsAString& aName,
|
||||
BluetoothResultHandler* aRes) override;
|
||||
void SetRemoteDeviceProperty(const nsAString& aRemoteAddr,
|
||||
void SetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
|
||||
const BluetoothNamedValue& aProperty,
|
||||
BluetoothResultHandler* aRes) override;
|
||||
|
||||
/* Remote Services */
|
||||
|
||||
void GetRemoteServiceRecord(const nsAString& aRemoteAddr,
|
||||
void GetRemoteServiceRecord(const BluetoothAddress& aRemoteAddr,
|
||||
const BluetoothUuid& aUuid,
|
||||
BluetoothResultHandler* aRes) override;
|
||||
void GetRemoteServices(const nsAString& aRemoteAddr,
|
||||
void GetRemoteServices(const BluetoothAddress& aRemoteAddr,
|
||||
BluetoothResultHandler* aRes) override;
|
||||
|
||||
/* Discovery */
|
||||
@ -86,25 +86,27 @@ public:
|
||||
|
||||
/* Bonds */
|
||||
|
||||
void CreateBond(const nsAString& aBdAddr, BluetoothTransport aTransport,
|
||||
void CreateBond(const BluetoothAddress& aBdAddr,
|
||||
BluetoothTransport aTransport,
|
||||
BluetoothResultHandler* aRes) override;
|
||||
void RemoveBond(const nsAString& aBdAddr,
|
||||
void RemoveBond(const BluetoothAddress& aBdAddr,
|
||||
BluetoothResultHandler* aRes) override;
|
||||
void CancelBond(const nsAString& aBdAddr,
|
||||
void CancelBond(const BluetoothAddress& aBdAddr,
|
||||
BluetoothResultHandler* aRes) override;
|
||||
|
||||
/* Connection */
|
||||
|
||||
void GetConnectionState(const nsAString& aBdAddr,
|
||||
void GetConnectionState(const BluetoothAddress& aBdAddr,
|
||||
BluetoothResultHandler* aRes) override;
|
||||
|
||||
/* Authentication */
|
||||
|
||||
void PinReply(const nsAString& aBdAddr, bool aAccept,
|
||||
void PinReply(const BluetoothAddress& aBdAddr, bool aAccept,
|
||||
const nsAString& aPinCode,
|
||||
BluetoothResultHandler* aRes) override;
|
||||
|
||||
void SspReply(const nsAString& aBdAddr, BluetoothSspVariant aVariant,
|
||||
void SspReply(const BluetoothAddress& aBdAddr,
|
||||
BluetoothSspVariant aVariant,
|
||||
bool aAccept, uint32_t aPasskey,
|
||||
BluetoothResultHandler* aRes) override;
|
||||
|
||||
|
@ -800,15 +800,26 @@ BluetoothServiceBluedroid::GetAdaptersInternal(
|
||||
InfallibleTArray<BluetoothNamedValue> adaptersProperties;
|
||||
uint32_t numAdapters = 1; // Bluedroid supports single adapter only
|
||||
|
||||
nsAutoString bdAddressStr;
|
||||
AddressToString(mBdAddress, bdAddressStr);
|
||||
|
||||
nsTArray<nsString> bondedAddresses;
|
||||
|
||||
for (uint32_t i = 0; i < mBondedAddresses.Length(); ++i) {
|
||||
nsAutoString bondedAddressStr;
|
||||
AddressToString(mBondedAddresses[i], bondedAddressStr);
|
||||
bondedAddresses.AppendElement(bondedAddressStr);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < numAdapters; i++) {
|
||||
InfallibleTArray<BluetoothNamedValue> properties;
|
||||
|
||||
AppendNamedValue(properties, "State", mEnabled);
|
||||
AppendNamedValue(properties, "Address", mBdAddress);
|
||||
AppendNamedValue(properties, "Address", bdAddressStr);
|
||||
AppendNamedValue(properties, "Name", mBdName);
|
||||
AppendNamedValue(properties, "Discoverable", mDiscoverable);
|
||||
AppendNamedValue(properties, "Discovering", mDiscovering);
|
||||
AppendNamedValue(properties, "PairedDevices", mBondedAddresses);
|
||||
AppendNamedValue(properties, "PairedDevices", bondedAddresses);
|
||||
|
||||
AppendNamedValue(adaptersProperties, "Adapter",
|
||||
BluetoothValue(properties));
|
||||
@ -838,7 +849,7 @@ class BluetoothServiceBluedroid::GetRemoteDevicePropertiesResultHandler
|
||||
public:
|
||||
GetRemoteDevicePropertiesResultHandler(
|
||||
nsTArray<GetDeviceRequest>& aRequests,
|
||||
const nsAString& aDeviceAddress)
|
||||
const BluetoothAddress& aDeviceAddress)
|
||||
: mRequests(aRequests)
|
||||
, mDeviceAddress(aDeviceAddress)
|
||||
{ }
|
||||
@ -848,8 +859,11 @@ public:
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!mRequests.IsEmpty());
|
||||
|
||||
nsAutoString addressString;
|
||||
AddressToString(mDeviceAddress, addressString);
|
||||
|
||||
BT_WARNING("GetRemoteDeviceProperties(%s) failed: %d",
|
||||
NS_ConvertUTF16toUTF8(mDeviceAddress).get(), aStatus);
|
||||
NS_ConvertUTF16toUTF8(addressString).get(), aStatus);
|
||||
|
||||
/* Dispatch result after the final pending operation */
|
||||
if (--mRequests[0].mDeviceCount == 0) {
|
||||
@ -863,7 +877,7 @@ public:
|
||||
|
||||
private:
|
||||
nsTArray<GetDeviceRequest>& mRequests;
|
||||
nsString mDeviceAddress;
|
||||
BluetoothAddress mDeviceAddress;
|
||||
};
|
||||
|
||||
nsresult
|
||||
@ -888,8 +902,15 @@ BluetoothServiceBluedroid::GetConnectedDevicePropertiesInternal(
|
||||
}
|
||||
|
||||
// Get address of the connected device
|
||||
nsString address;
|
||||
profile->GetAddress(address);
|
||||
nsString addressString;
|
||||
profile->GetAddress(addressString);
|
||||
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(addressString, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Append request of the connected device
|
||||
GetDeviceRequest request(1, aRunnable);
|
||||
@ -919,10 +940,17 @@ BluetoothServiceBluedroid::GetPairedDevicePropertiesInternal(
|
||||
mGetDeviceRequests.AppendElement(request);
|
||||
|
||||
for (uint8_t i = 0; i < aDeviceAddress.Length(); i++) {
|
||||
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress[i], address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Retrieve all properties of devices
|
||||
sBtInterface->GetRemoteDeviceProperties(aDeviceAddress[i],
|
||||
new GetRemoteDevicePropertiesResultHandler(mGetDeviceRequests,
|
||||
aDeviceAddress[i]));
|
||||
sBtInterface->GetRemoteDeviceProperties(address,
|
||||
new GetRemoteDevicePropertiesResultHandler(mGetDeviceRequests, address));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -982,8 +1010,15 @@ BluetoothServiceBluedroid::FetchUuidsInternal(
|
||||
StopDiscoveryInternal(aRunnable);
|
||||
}
|
||||
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return rv;
|
||||
}
|
||||
|
||||
mFetchUuidsRunnables.AppendElement(aRunnable);
|
||||
sBtInterface->GetRemoteServices(aDeviceAddress,
|
||||
sBtInterface->GetRemoteServices(address,
|
||||
new DispatchReplyErrorResultHandler(mFetchUuidsRunnables, aRunnable));
|
||||
|
||||
return NS_OK;
|
||||
@ -1021,18 +1056,17 @@ BluetoothServiceBluedroid::SetProperty(BluetoothObjectType aType,
|
||||
|
||||
struct BluetoothServiceBluedroid::GetRemoteServiceRecordRequest final
|
||||
{
|
||||
GetRemoteServiceRecordRequest(const nsAString& aDeviceAddress,
|
||||
GetRemoteServiceRecordRequest(const BluetoothAddress& aDeviceAddress,
|
||||
const BluetoothUuid& aUuid,
|
||||
BluetoothProfileManagerBase* aManager)
|
||||
: mDeviceAddress(aDeviceAddress)
|
||||
, mUuid(aUuid)
|
||||
, mManager(aManager)
|
||||
{
|
||||
MOZ_ASSERT(!mDeviceAddress.IsEmpty());
|
||||
MOZ_ASSERT(mManager);
|
||||
}
|
||||
|
||||
nsString mDeviceAddress;
|
||||
BluetoothAddress mDeviceAddress;
|
||||
BluetoothUuid mUuid;
|
||||
BluetoothProfileManagerBase* mManager;
|
||||
};
|
||||
@ -1043,14 +1077,12 @@ class BluetoothServiceBluedroid::GetRemoteServiceRecordResultHandler final
|
||||
public:
|
||||
GetRemoteServiceRecordResultHandler(
|
||||
nsTArray<GetRemoteServiceRecordRequest>& aGetRemoteServiceRecordArray,
|
||||
const nsAString& aDeviceAddress,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
const BluetoothUuid& aUuid)
|
||||
: mGetRemoteServiceRecordArray(aGetRemoteServiceRecordArray)
|
||||
, mDeviceAddress(aDeviceAddress)
|
||||
, mUuid(aUuid)
|
||||
{
|
||||
MOZ_ASSERT(!mDeviceAddress.IsEmpty());
|
||||
}
|
||||
{ }
|
||||
|
||||
void OnError(BluetoothStatus aStatus) override
|
||||
{
|
||||
@ -1065,10 +1097,11 @@ public:
|
||||
|
||||
// Signal error to profile manager
|
||||
|
||||
nsAutoString uuidStr;
|
||||
nsAutoString addressStr, uuidStr;
|
||||
AddressToString(mDeviceAddress, addressStr);
|
||||
UuidToString(mUuid, uuidStr);
|
||||
mGetRemoteServiceRecordArray[i].mManager->OnGetServiceChannel(
|
||||
mDeviceAddress, uuidStr, -1);
|
||||
addressStr, uuidStr, -1);
|
||||
mGetRemoteServiceRecordArray.RemoveElementAt(i);
|
||||
}
|
||||
|
||||
@ -1092,7 +1125,7 @@ private:
|
||||
}
|
||||
|
||||
nsTArray<GetRemoteServiceRecordRequest>& mGetRemoteServiceRecordArray;
|
||||
nsString mDeviceAddress;
|
||||
BluetoothAddress mDeviceAddress;
|
||||
BluetoothUuid mUuid;
|
||||
};
|
||||
|
||||
@ -1102,14 +1135,21 @@ BluetoothServiceBluedroid::GetServiceChannel(
|
||||
const nsAString& aServiceUuid,
|
||||
BluetoothProfileManagerBase* aManager)
|
||||
{
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
BluetoothUuid uuid;
|
||||
StringToUuid(aServiceUuid, uuid);
|
||||
|
||||
mGetRemoteServiceRecordArray.AppendElement(
|
||||
GetRemoteServiceRecordRequest(aDeviceAddress, uuid, aManager));
|
||||
GetRemoteServiceRecordRequest(address, uuid, aManager));
|
||||
|
||||
nsRefPtr<BluetoothResultHandler> res =
|
||||
new GetRemoteServiceRecordResultHandler(mGetRemoteServiceRecordArray,
|
||||
aDeviceAddress, uuid);
|
||||
address, uuid);
|
||||
|
||||
/* Stop discovery of remote devices here, because SDP operations
|
||||
* won't be performed while the adapter is in discovery mode.
|
||||
@ -1117,8 +1157,7 @@ BluetoothServiceBluedroid::GetServiceChannel(
|
||||
if (mDiscovering) {
|
||||
sBtInterface->CancelDiscovery(res);
|
||||
} else {
|
||||
sBtInterface->GetRemoteServiceRecord(
|
||||
aDeviceAddress, uuid, res);
|
||||
sBtInterface->GetRemoteServiceRecord(address, uuid, res);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -1126,16 +1165,15 @@ BluetoothServiceBluedroid::GetServiceChannel(
|
||||
|
||||
struct BluetoothServiceBluedroid::GetRemoteServicesRequest final
|
||||
{
|
||||
GetRemoteServicesRequest(const nsAString& aDeviceAddress,
|
||||
GetRemoteServicesRequest(const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothProfileManagerBase* aManager)
|
||||
: mDeviceAddress(aDeviceAddress)
|
||||
, mManager(aManager)
|
||||
{
|
||||
MOZ_ASSERT(!mDeviceAddress.IsEmpty());
|
||||
MOZ_ASSERT(mManager);
|
||||
}
|
||||
|
||||
const nsString mDeviceAddress;
|
||||
BluetoothAddress mDeviceAddress;
|
||||
BluetoothProfileManagerBase* mManager;
|
||||
};
|
||||
|
||||
@ -1145,7 +1183,7 @@ class BluetoothServiceBluedroid::GetRemoteServicesResultHandler final
|
||||
public:
|
||||
GetRemoteServicesResultHandler(
|
||||
nsTArray<GetRemoteServicesRequest>& aGetRemoteServicesArray,
|
||||
const nsAString& aDeviceAddress,
|
||||
const BluetoothAddress& aDeviceAddress,
|
||||
BluetoothProfileManagerBase* aManager)
|
||||
: mGetRemoteServicesArray(aGetRemoteServicesArray)
|
||||
, mDeviceAddress(aDeviceAddress)
|
||||
@ -1167,7 +1205,9 @@ public:
|
||||
mGetRemoteServicesArray.RemoveElementAt(i);
|
||||
|
||||
// There's no error-signaling mechanism; just call manager
|
||||
mManager->OnUpdateSdpRecords(mDeviceAddress);
|
||||
nsAutoString addressStr;
|
||||
AddressToString(mDeviceAddress, addressStr);
|
||||
mManager->OnUpdateSdpRecords(addressStr);
|
||||
}
|
||||
|
||||
void CancelDiscovery() override
|
||||
@ -1190,7 +1230,7 @@ private:
|
||||
}
|
||||
|
||||
nsTArray<GetRemoteServicesRequest>& mGetRemoteServicesArray;
|
||||
const nsString mDeviceAddress;
|
||||
BluetoothAddress mDeviceAddress;
|
||||
BluetoothProfileManagerBase* mManager;
|
||||
};
|
||||
|
||||
@ -1199,12 +1239,18 @@ BluetoothServiceBluedroid::UpdateSdpRecords(
|
||||
const nsAString& aDeviceAddress,
|
||||
BluetoothProfileManagerBase* aManager)
|
||||
{
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mGetRemoteServicesArray.AppendElement(
|
||||
GetRemoteServicesRequest(aDeviceAddress, aManager));
|
||||
GetRemoteServicesRequest(address, aManager));
|
||||
|
||||
nsRefPtr<BluetoothResultHandler> res =
|
||||
new GetRemoteServicesResultHandler(mGetRemoteServicesArray,
|
||||
aDeviceAddress, aManager);
|
||||
address, aManager);
|
||||
|
||||
/* Stop discovery of remote devices here, because SDP operations
|
||||
* won't be performed while the adapter is in discovery mode.
|
||||
@ -1212,7 +1258,7 @@ BluetoothServiceBluedroid::UpdateSdpRecords(
|
||||
if (mDiscovering) {
|
||||
sBtInterface->CancelDiscovery(res);
|
||||
} else {
|
||||
sBtInterface->GetRemoteServices(aDeviceAddress, res);
|
||||
sBtInterface->GetRemoteServices(address, res);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1227,8 +1273,15 @@ BluetoothServiceBluedroid::CreatePairedDeviceInternal(
|
||||
|
||||
ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK);
|
||||
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return rv;
|
||||
}
|
||||
|
||||
mCreateBondRunnables.AppendElement(aRunnable);
|
||||
sBtInterface->CreateBond(aDeviceAddress, TRANSPORT_AUTO,
|
||||
sBtInterface->CreateBond(address, TRANSPORT_AUTO,
|
||||
new DispatchReplyErrorResultHandler(mCreateBondRunnables, aRunnable));
|
||||
|
||||
return NS_OK;
|
||||
@ -1242,8 +1295,15 @@ BluetoothServiceBluedroid::RemoveDeviceInternal(
|
||||
|
||||
ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK);
|
||||
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return rv;
|
||||
}
|
||||
|
||||
mRemoveBondRunnables.AppendElement(aRunnable);
|
||||
sBtInterface->RemoveBond(aDeviceAddress,
|
||||
sBtInterface->RemoveBond(address,
|
||||
new DispatchReplyErrorResultHandler(mRemoveBondRunnables, aRunnable));
|
||||
|
||||
return NS_OK;
|
||||
@ -1280,7 +1340,14 @@ BluetoothServiceBluedroid::PinReplyInternal(
|
||||
|
||||
ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
|
||||
|
||||
sBtInterface->PinReply(aDeviceAddress, aAccept, aPinCode,
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
sBtInterface->PinReply(address, aAccept, aPinCode,
|
||||
new PinReplyResultHandler(aRunnable));
|
||||
}
|
||||
|
||||
@ -1331,7 +1398,14 @@ BluetoothServiceBluedroid::SspReplyInternal(
|
||||
|
||||
ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
|
||||
|
||||
sBtInterface->SspReply(aDeviceAddress, aVariant, aAccept, 0 /* passkey */,
|
||||
BluetoothAddress address;
|
||||
nsresult rv = StringToAddress(aDeviceAddress, address);
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
|
||||
return;
|
||||
}
|
||||
|
||||
sBtInterface->SspReply(address, aVariant, aAccept, 0 /* passkey */,
|
||||
new SspReplyResultHandler(aRunnable));
|
||||
}
|
||||
|
||||
@ -1811,12 +1885,15 @@ BluetoothServiceBluedroid::AdapterStateChangedNotification(bool aState)
|
||||
NS_ENSURE_TRUE_VOID(bs);
|
||||
|
||||
// Cleanup static adapter properties and notify adapter.
|
||||
mBdAddress.Truncate();
|
||||
mBdAddress.Clear();
|
||||
mBdName.Truncate();
|
||||
|
||||
nsAutoString bdAddressStr;
|
||||
AddressToString(mBdAddress, bdAddressStr);
|
||||
|
||||
InfallibleTArray<BluetoothNamedValue> props;
|
||||
AppendNamedValue(props, "Name", mBdName);
|
||||
AppendNamedValue(props, "Address", mBdAddress);
|
||||
AppendNamedValue(props, "Address", bdAddressStr);
|
||||
if (mDiscoverable) {
|
||||
mDiscoverable = false;
|
||||
AppendNamedValue(props, "Discoverable", false);
|
||||
@ -1915,8 +1992,11 @@ BluetoothServiceBluedroid::AdapterPropertiesNotification(
|
||||
const BluetoothProperty& p = aProperties[i];
|
||||
|
||||
if (p.mType == PROPERTY_BDADDR) {
|
||||
mBdAddress = p.mString;
|
||||
AppendNamedValue(propertiesArray, "Address", mBdAddress);
|
||||
mBdAddress = p.mBdAddress;
|
||||
nsAutoString addressStr;
|
||||
AddressToString(mBdAddress, addressStr);
|
||||
|
||||
AppendNamedValue(propertiesArray, "Address", addressStr);
|
||||
|
||||
} else if (p.mType == PROPERTY_BDNAME) {
|
||||
mBdName = p.mString;
|
||||
@ -1936,13 +2016,21 @@ BluetoothServiceBluedroid::AdapterPropertiesNotification(
|
||||
// Bluedroid would not send another PROPERTY_ADAPTER_BONDED_DEVICES
|
||||
// event after bond completed.
|
||||
BT_LOGD("Adapter property: BONDED_DEVICES. Count: %d",
|
||||
p.mStringArray.Length());
|
||||
p.mBdAddressArray.Length());
|
||||
|
||||
// Whenever reloading paired devices, force refresh
|
||||
mBondedAddresses.Clear();
|
||||
mBondedAddresses.AppendElements(p.mStringArray);
|
||||
mBondedAddresses.AppendElements(p.mBdAddressArray);
|
||||
|
||||
AppendNamedValue(propertiesArray, "PairedDevices", mBondedAddresses);
|
||||
nsTArray<nsString> bondedAddresses;
|
||||
|
||||
for (unsigned int j = 0; j < p.mBdAddressArray.Length(); ++j) {
|
||||
nsAutoString addressStr;
|
||||
AddressToString(p.mBdAddressArray[j], addressStr);
|
||||
bondedAddresses.AppendElement(addressStr);
|
||||
}
|
||||
|
||||
AppendNamedValue(propertiesArray, "PairedDevices", bondedAddresses);
|
||||
} else if (p.mType == PROPERTY_UNKNOWN) {
|
||||
/* Bug 1065999: working around unknown properties */
|
||||
} else {
|
||||
@ -1975,15 +2063,17 @@ BluetoothServiceBluedroid::AdapterPropertiesNotification(
|
||||
*/
|
||||
void
|
||||
BluetoothServiceBluedroid::RemoteDevicePropertiesNotification(
|
||||
BluetoothStatus aStatus, const nsAString& aBdAddr,
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aBdAddr,
|
||||
int aNumProperties, const BluetoothProperty* aProperties)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
InfallibleTArray<BluetoothNamedValue> propertiesArray;
|
||||
|
||||
nsString bdAddr(aBdAddr);
|
||||
AppendNamedValue(propertiesArray, "Address", bdAddr);
|
||||
nsAutoString bdAddrStr;
|
||||
AddressToString(aBdAddr, bdAddrStr);
|
||||
|
||||
AppendNamedValue(propertiesArray, "Address", bdAddrStr);
|
||||
|
||||
for (int i = 0; i < aNumProperties; ++i) {
|
||||
|
||||
@ -1993,8 +2083,8 @@ BluetoothServiceBluedroid::RemoteDevicePropertiesNotification(
|
||||
AppendNamedValue(propertiesArray, "Name", p.mString);
|
||||
|
||||
// Update <address, name> mapping
|
||||
mDeviceNameMap.Remove(bdAddr);
|
||||
mDeviceNameMap.Put(bdAddr, p.mString);
|
||||
mDeviceNameMap.Remove(aBdAddr);
|
||||
mDeviceNameMap.Put(aBdAddr, p.mString);
|
||||
} else if (p.mType == PROPERTY_CLASS_OF_DEVICE) {
|
||||
uint32_t cod = p.mUint32;
|
||||
AppendNamedValue(propertiesArray, "Cod", cod);
|
||||
@ -2012,7 +2102,7 @@ BluetoothServiceBluedroid::RemoteDevicePropertiesNotification(
|
||||
}
|
||||
|
||||
if (index < mGetRemoteServicesArray.Length()) {
|
||||
mGetRemoteServicesArray[index].mManager->OnUpdateSdpRecords(aBdAddr);
|
||||
mGetRemoteServicesArray[index].mManager->OnUpdateSdpRecords(bdAddrStr);
|
||||
mGetRemoteServicesArray.RemoveElementAt(index);
|
||||
continue; // continue with outer loop
|
||||
}
|
||||
@ -2051,7 +2141,7 @@ BluetoothServiceBluedroid::RemoteDevicePropertiesNotification(
|
||||
UuidToString(mGetRemoteServiceRecordArray[i].mUuid, uuidStr);
|
||||
|
||||
mGetRemoteServiceRecordArray[i].mManager->OnGetServiceChannel(
|
||||
aBdAddr, uuidStr, p.mServiceRecord.mChannel);
|
||||
bdAddrStr, uuidStr, p.mServiceRecord.mChannel);
|
||||
|
||||
mGetRemoteServiceRecordArray.RemoveElementAt(i);
|
||||
break;
|
||||
@ -2078,7 +2168,7 @@ BluetoothServiceBluedroid::RemoteDevicePropertiesNotification(
|
||||
|
||||
// Update to registered BluetoothDevice objects
|
||||
BluetoothSignal signal(NS_LITERAL_STRING("PropertyChanged"),
|
||||
bdAddr, propertiesArray);
|
||||
bdAddrStr, propertiesArray);
|
||||
|
||||
// FetchUuids task
|
||||
if (!mFetchUuidsRunnables.IsEmpty()) {
|
||||
@ -2099,7 +2189,7 @@ BluetoothServiceBluedroid::RemoteDevicePropertiesNotification(
|
||||
|
||||
// Use address as the index
|
||||
mGetDeviceRequests[0].mDevicesPack.AppendElement(
|
||||
BluetoothNamedValue(bdAddr, propertiesArray));
|
||||
BluetoothNamedValue(bdAddrStr, propertiesArray));
|
||||
|
||||
if (--mGetDeviceRequests[0].mDeviceCount == 0) {
|
||||
if (mGetDeviceRequests[0].mRunnable) {
|
||||
@ -2120,14 +2210,18 @@ BluetoothServiceBluedroid::DeviceFoundNotification(
|
||||
|
||||
InfallibleTArray<BluetoothNamedValue> propertiesArray;
|
||||
|
||||
nsString bdAddr, bdName;
|
||||
BluetoothAddress bdAddr;
|
||||
nsString bdName;
|
||||
|
||||
for (int i = 0; i < aNumProperties; i++) {
|
||||
|
||||
const BluetoothProperty& p = aProperties[i];
|
||||
|
||||
if (p.mType == PROPERTY_BDADDR) {
|
||||
AppendNamedValue(propertiesArray, "Address", p.mString);
|
||||
bdAddr = p.mString;
|
||||
nsAutoString addressStr;
|
||||
AddressToString(p.mBdAddress, addressStr);
|
||||
AppendNamedValue(propertiesArray, "Address", addressStr);
|
||||
bdAddr = p.mBdAddress;
|
||||
} else if (p.mType == PROPERTY_BDNAME) {
|
||||
AppendNamedValue(propertiesArray, "Name", p.mString);
|
||||
bdName = p.mString;
|
||||
@ -2192,7 +2286,7 @@ BluetoothServiceBluedroid::DiscoveryStateChangedNotification(bool aState)
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::PinRequestNotification(
|
||||
const nsAString& aRemoteBdAddr, const nsAString& aBdName, uint32_t aCod)
|
||||
const BluetoothAddress& aRemoteBdAddr, const nsAString& aBdName, uint32_t aCod)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -2200,13 +2294,15 @@ BluetoothServiceBluedroid::PinRequestNotification(
|
||||
|
||||
// If |aBdName| is empty, get device name from |mDeviceNameMap|;
|
||||
// Otherwise update <address, name> mapping with |aBdName|
|
||||
nsString bdAddr(aRemoteBdAddr);
|
||||
nsAutoString bdAddr;
|
||||
AddressToString(aRemoteBdAddr, bdAddr);
|
||||
|
||||
nsString bdName(aBdName);
|
||||
if (bdName.IsEmpty()) {
|
||||
mDeviceNameMap.Get(bdAddr, &bdName);
|
||||
mDeviceNameMap.Get(aRemoteBdAddr, &bdName);
|
||||
} else {
|
||||
mDeviceNameMap.Remove(bdAddr);
|
||||
mDeviceNameMap.Put(bdAddr, bdName);
|
||||
mDeviceNameMap.Remove(aRemoteBdAddr);
|
||||
mDeviceNameMap.Put(aRemoteBdAddr, bdName);
|
||||
}
|
||||
|
||||
AppendNamedValue(propertiesArray, "address", bdAddr);
|
||||
@ -2222,8 +2318,8 @@ BluetoothServiceBluedroid::PinRequestNotification(
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::SspRequestNotification(
|
||||
const nsAString& aRemoteBdAddr, const nsAString& aBdName, uint32_t aCod,
|
||||
BluetoothSspVariant aPairingVariant, uint32_t aPassKey)
|
||||
const BluetoothAddress& aRemoteBdAddr, const nsAString& aBdName,
|
||||
uint32_t aCod, BluetoothSspVariant aPairingVariant, uint32_t aPassKey)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -2231,13 +2327,15 @@ BluetoothServiceBluedroid::SspRequestNotification(
|
||||
|
||||
// If |aBdName| is empty, get device name from |mDeviceNameMap|;
|
||||
// Otherwise update <address, name> mapping with |aBdName|
|
||||
nsString bdAddr(aRemoteBdAddr);
|
||||
nsAutoString bdAddr;
|
||||
AddressToString(aRemoteBdAddr, bdAddr);
|
||||
|
||||
nsString bdName(aBdName);
|
||||
if (bdName.IsEmpty()) {
|
||||
mDeviceNameMap.Get(bdAddr, &bdName);
|
||||
mDeviceNameMap.Get(aRemoteBdAddr, &bdName);
|
||||
} else {
|
||||
mDeviceNameMap.Remove(bdAddr);
|
||||
mDeviceNameMap.Put(bdAddr, bdName);
|
||||
mDeviceNameMap.Remove(aRemoteBdAddr);
|
||||
mDeviceNameMap.Put(aRemoteBdAddr, bdName);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2279,7 +2377,7 @@ BluetoothServiceBluedroid::SspRequestNotification(
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::BondStateChangedNotification(
|
||||
BluetoothStatus aStatus, const nsAString& aRemoteBdAddr,
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
|
||||
BluetoothBondState aState)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -2315,17 +2413,19 @@ BluetoothServiceBluedroid::BondStateChangedNotification(
|
||||
}
|
||||
|
||||
// Query pairing device name from hash table
|
||||
nsString remoteBdAddr(aRemoteBdAddr);
|
||||
nsAutoString remoteBdAddr;
|
||||
AddressToString(aRemoteBdAddr, remoteBdAddr);
|
||||
|
||||
nsString remotebdName;
|
||||
mDeviceNameMap.Get(remoteBdAddr, &remotebdName);
|
||||
mDeviceNameMap.Get(aRemoteBdAddr, &remotebdName);
|
||||
|
||||
// Update bonded address array and append pairing device name
|
||||
InfallibleTArray<BluetoothNamedValue> propertiesArray;
|
||||
if (!bonded) {
|
||||
mBondedAddresses.RemoveElement(remoteBdAddr);
|
||||
mBondedAddresses.RemoveElement(aRemoteBdAddr);
|
||||
} else {
|
||||
if (!mBondedAddresses.Contains(remoteBdAddr)) {
|
||||
mBondedAddresses.AppendElement(remoteBdAddr);
|
||||
if (!mBondedAddresses.Contains(aRemoteBdAddr)) {
|
||||
mBondedAddresses.AppendElement(aRemoteBdAddr);
|
||||
}
|
||||
|
||||
// We don't assert |!remotebdName.IsEmpty()| since empty string is also
|
||||
@ -2360,7 +2460,7 @@ BluetoothServiceBluedroid::BondStateChangedNotification(
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::AclStateChangedNotification(
|
||||
BluetoothStatus aStatus, const nsAString& aRemoteBdAddr, bool aState)
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr, bool aState)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define mozilla_dom_bluetooth_bluedroid_BluetoothServiceBluedroid_h
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
#include "BluetoothHashKeys.h"
|
||||
#include "BluetoothInterface.h"
|
||||
#include "BluetoothService.h"
|
||||
#include "nsDataHashtable.h"
|
||||
@ -388,7 +389,7 @@ public:
|
||||
const BluetoothProperty* aProperties) override;
|
||||
|
||||
virtual void RemoteDevicePropertiesNotification(
|
||||
BluetoothStatus aStatus, const nsAString& aBdAddr,
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aBdAddr,
|
||||
int aNumProperties, const BluetoothProperty* aProperties) override;
|
||||
|
||||
virtual void DeviceFoundNotification(
|
||||
@ -396,21 +397,21 @@ public:
|
||||
|
||||
virtual void DiscoveryStateChangedNotification(bool aState) override;
|
||||
|
||||
virtual void PinRequestNotification(const nsAString& aRemoteBdAddr,
|
||||
virtual void PinRequestNotification(const BluetoothAddress& aRemoteBdAddr,
|
||||
const nsAString& aBdName,
|
||||
uint32_t aCod) override;
|
||||
virtual void SspRequestNotification(const nsAString& aRemoteBdAddr,
|
||||
virtual void SspRequestNotification(const BluetoothAddress& aRemoteBdAddr,
|
||||
const nsAString& aBdName,
|
||||
uint32_t aCod,
|
||||
BluetoothSspVariant aPairingVariant,
|
||||
uint32_t aPasskey) override;
|
||||
|
||||
virtual void BondStateChangedNotification(
|
||||
BluetoothStatus aStatus, const nsAString& aRemoteBdAddr,
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
|
||||
BluetoothBondState aState) override;
|
||||
virtual void AclStateChangedNotification(BluetoothStatus aStatus,
|
||||
const nsAString& aRemoteBdAddr,
|
||||
bool aState) override;
|
||||
virtual void AclStateChangedNotification(
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
|
||||
bool aState) override;
|
||||
|
||||
virtual void DutModeRecvNotification(uint16_t aOpcode,
|
||||
const uint8_t* aBuf,
|
||||
@ -439,12 +440,12 @@ protected:
|
||||
static void NextBluetoothProfileController();
|
||||
|
||||
// Adapter properties
|
||||
nsString mBdAddress;
|
||||
BluetoothAddress mBdAddress;
|
||||
nsString mBdName;
|
||||
bool mEnabled;
|
||||
bool mDiscoverable;
|
||||
bool mDiscovering;
|
||||
nsTArray<nsString> mBondedAddresses;
|
||||
nsTArray<BluetoothAddress> mBondedAddresses;
|
||||
|
||||
// Backend error recovery
|
||||
bool mIsRestart;
|
||||
@ -465,7 +466,7 @@ protected:
|
||||
nsTArray<GetDeviceRequest> mGetDeviceRequests;
|
||||
|
||||
// <address, name> mapping table for remote devices
|
||||
nsDataHashtable<nsStringHashKey, nsString> mDeviceNameMap;
|
||||
nsDataHashtable<BluetoothAddressHashKey, nsString> mDeviceNameMap;
|
||||
|
||||
// Arrays for SDP operations
|
||||
nsTArray<GetRemoteServiceRecordRequest> mGetRemoteServiceRecordArray;
|
||||
|
@ -511,8 +511,10 @@ struct BluetoothProperty {
|
||||
/* Value
|
||||
*/
|
||||
|
||||
/* PROPERTY_BDADDR */
|
||||
BluetoothAddress mBdAddress;
|
||||
|
||||
/* PROPERTY_BDNAME
|
||||
PROPERTY_BDADDR
|
||||
PROPERTY_REMOTE_FRIENDLY_NAME */
|
||||
nsString mString;
|
||||
|
||||
@ -520,7 +522,7 @@ struct BluetoothProperty {
|
||||
nsTArray<BluetoothUuid> mUuidArray;
|
||||
|
||||
/* PROPERTY_ADAPTER_BONDED_DEVICES */
|
||||
nsTArray<nsString> mStringArray;
|
||||
nsTArray<BluetoothAddress> mBdAddressArray;
|
||||
|
||||
/* PROPERTY_CLASS_OF_DEVICE
|
||||
PROPERTY_ADAPTER_DISCOVERY_TIMEOUT */
|
||||
|
@ -861,8 +861,8 @@ BluetoothNotificationHandler::AdapterPropertiesNotification(
|
||||
|
||||
void
|
||||
BluetoothNotificationHandler::RemoteDevicePropertiesNotification(
|
||||
BluetoothStatus aStatus, const nsAString& aBdAddr, int aNumProperties,
|
||||
const BluetoothProperty* aProperties)
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aBdAddr,
|
||||
int aNumProperties, const BluetoothProperty* aProperties)
|
||||
{ }
|
||||
|
||||
void
|
||||
@ -876,24 +876,25 @@ BluetoothNotificationHandler::DiscoveryStateChangedNotification(bool aState)
|
||||
|
||||
void
|
||||
BluetoothNotificationHandler::PinRequestNotification(
|
||||
const nsAString& aRemoteBdAddr, const nsAString& aBdName, uint32_t aCod)
|
||||
const BluetoothAddress& aRemoteBdAddr, const nsAString& aBdName,
|
||||
uint32_t aCod)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothNotificationHandler::SspRequestNotification(
|
||||
const nsAString& aRemoteBdAddr, const nsAString& aBdName, uint32_t aCod,
|
||||
BluetoothSspVariant aPairingVariant, uint32_t aPassKey)
|
||||
const BluetoothAddress& aRemoteBdAddr, const nsAString& aBdName,
|
||||
uint32_t aCod, BluetoothSspVariant aPairingVariant, uint32_t aPassKey)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothNotificationHandler::BondStateChangedNotification(
|
||||
BluetoothStatus aStatus, const nsAString& aRemoteBdAddr,
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
|
||||
BluetoothBondState aState)
|
||||
{ }
|
||||
|
||||
void
|
||||
BluetoothNotificationHandler::AclStateChangedNotification(
|
||||
BluetoothStatus aStatus, const nsAString& aRemoteBdAddr, bool aState)
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr, bool aState)
|
||||
{ }
|
||||
|
||||
void
|
||||
|
@ -939,7 +939,7 @@ public:
|
||||
const BluetoothProperty* aProperties);
|
||||
|
||||
virtual void RemoteDevicePropertiesNotification(
|
||||
BluetoothStatus aStatus, const nsAString& aBdAddr,
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aBdAddr,
|
||||
int aNumProperties, const BluetoothProperty* aProperties);
|
||||
|
||||
virtual void DeviceFoundNotification(
|
||||
@ -947,21 +947,21 @@ public:
|
||||
|
||||
virtual void DiscoveryStateChangedNotification(bool aState);
|
||||
|
||||
virtual void PinRequestNotification(const nsAString& aRemoteBdAddr,
|
||||
virtual void PinRequestNotification(const BluetoothAddress& aRemoteBdAddr,
|
||||
const nsAString& aBdName,
|
||||
uint32_t aCod);
|
||||
virtual void SspRequestNotification(const nsAString& aRemoteBdAddr,
|
||||
virtual void SspRequestNotification(const BluetoothAddress& 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 BondStateChangedNotification(
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
|
||||
BluetoothBondState aState);
|
||||
virtual void AclStateChangedNotification(
|
||||
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
|
||||
bool aState);
|
||||
|
||||
virtual void DutModeRecvNotification(uint16_t aOpcode,
|
||||
const uint8_t* aBuf, uint8_t aLen);
|
||||
@ -1044,21 +1044,21 @@ public:
|
||||
|
||||
/* Remote Device Properties */
|
||||
|
||||
virtual void GetRemoteDeviceProperties(const nsAString& aRemoteAddr,
|
||||
virtual void GetRemoteDeviceProperties(const BluetoothAddress& aRemoteAddr,
|
||||
BluetoothResultHandler* aRes) = 0;
|
||||
virtual void GetRemoteDeviceProperty(const nsAString& aRemoteAddr,
|
||||
virtual void GetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
|
||||
const nsAString& aName,
|
||||
BluetoothResultHandler* aRes) = 0;
|
||||
virtual void SetRemoteDeviceProperty(const nsAString& aRemoteAddr,
|
||||
virtual void SetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
|
||||
const BluetoothNamedValue& aProperty,
|
||||
BluetoothResultHandler* aRes) = 0;
|
||||
|
||||
/* Remote Services */
|
||||
|
||||
virtual void GetRemoteServiceRecord(const nsAString& aRemoteAddr,
|
||||
virtual void GetRemoteServiceRecord(const BluetoothAddress& aRemoteAddr,
|
||||
const BluetoothUuid& aUuid,
|
||||
BluetoothResultHandler* aRes) = 0;
|
||||
virtual void GetRemoteServices(const nsAString& aRemoteAddr,
|
||||
virtual void GetRemoteServices(const BluetoothAddress& aRemoteAddr,
|
||||
BluetoothResultHandler* aRes) = 0;
|
||||
|
||||
/* Discovery */
|
||||
@ -1068,26 +1068,27 @@ public:
|
||||
|
||||
/* Bonds */
|
||||
|
||||
virtual void CreateBond(const nsAString& aBdAddr,
|
||||
virtual void CreateBond(const BluetoothAddress& aBdAddr,
|
||||
BluetoothTransport aTransport,
|
||||
BluetoothResultHandler* aRes) = 0;
|
||||
virtual void RemoveBond(const nsAString& aBdAddr,
|
||||
virtual void RemoveBond(const BluetoothAddress& aBdAddr,
|
||||
BluetoothResultHandler* aRes) = 0;
|
||||
virtual void CancelBond(const nsAString& aBdAddr,
|
||||
virtual void CancelBond(const BluetoothAddress& aBdAddr,
|
||||
BluetoothResultHandler* aRes) = 0;
|
||||
|
||||
/* Connection */
|
||||
|
||||
virtual void GetConnectionState(const nsAString& aBdAddr,
|
||||
virtual void GetConnectionState(const BluetoothAddress& aBdAddr,
|
||||
BluetoothResultHandler* aRes) = 0;
|
||||
|
||||
/* Authentication */
|
||||
|
||||
virtual void PinReply(const nsAString& aBdAddr, bool aAccept,
|
||||
virtual void PinReply(const BluetoothAddress& aBdAddr, bool aAccept,
|
||||
const nsAString& aPinCode,
|
||||
BluetoothResultHandler* aRes) = 0;
|
||||
|
||||
virtual void SspReply(const nsAString& aBdAddr, BluetoothSspVariant aVariant,
|
||||
virtual void SspReply(const BluetoothAddress& aBdAddr,
|
||||
BluetoothSspVariant aVariant,
|
||||
bool aAccept, uint32_t aPasskey,
|
||||
BluetoothResultHandler* aRes) = 0;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user