mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1167064 - Patch1: Switch to bluetooth APIv2. r=shuang
This commit is contained in:
parent
5f230f63b2
commit
9c2669be88
@ -436,13 +436,13 @@ LOCAL_INCLUDES += [
|
||||
'/xpcom/ds',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_B2G_BT_API_V2']:
|
||||
if CONFIG['MOZ_B2G_BT_API_V1']:
|
||||
LOCAL_INCLUDES += [
|
||||
'../bluetooth/bluetooth2',
|
||||
'../bluetooth/bluetooth1',
|
||||
]
|
||||
else:
|
||||
LOCAL_INCLUDES += [
|
||||
'../bluetooth/bluetooth1',
|
||||
'../bluetooth/bluetooth2',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
|
||||
|
@ -91,13 +91,13 @@ if CONFIG['MOZ_AUDIO_CHANNEL_MANAGER']:
|
||||
'/dom/system/gonk',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_B2G_BT_API_V2']:
|
||||
if CONFIG['MOZ_B2G_BT_API_V1']:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth/bluetooth2',
|
||||
'/dom/bluetooth/bluetooth1',
|
||||
]
|
||||
else:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth/bluetooth1',
|
||||
'/dom/bluetooth/bluetooth2',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
@ -278,7 +278,7 @@ DispatchReplyError(BluetoothReplyRunnable* aRunnable,
|
||||
MOZ_ASSERT(!aErrorStr.IsEmpty());
|
||||
|
||||
// Reply will be deleted by the runnable after running on main thread
|
||||
#if MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
BluetoothReply* reply =
|
||||
new BluetoothReply(BluetoothReplyError(STATUS_FAIL, nsString(aErrorStr)));
|
||||
#else
|
||||
@ -298,7 +298,7 @@ DispatchReplyError(BluetoothReplyRunnable* aRunnable,
|
||||
MOZ_ASSERT(aStatus != STATUS_SUCCESS);
|
||||
|
||||
// Reply will be deleted by the runnable after running on main thread
|
||||
#if MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
BluetoothReply* reply =
|
||||
new BluetoothReply(BluetoothReplyError(aStatus, EmptyString()));
|
||||
#else
|
||||
@ -325,7 +325,7 @@ DispatchStatusChangedEvent(const nsAString& aType,
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
NS_ENSURE_TRUE_VOID(bs);
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
bs->DistributeSignal(aType, NS_LITERAL_STRING(KEY_ADAPTER), data);
|
||||
#else
|
||||
BluetoothSignal signal(nsString(aType), NS_LITERAL_STRING(KEY_ADAPTER), data);
|
||||
|
@ -1065,7 +1065,7 @@ BluetoothA2dpManager::GetPlayStatusNotification()
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
bs->DistributeSignal(NS_LITERAL_STRING(REQUEST_MEDIA_PLAYSTATUS_ID),
|
||||
NS_LITERAL_STRING(KEY_ADAPTER));
|
||||
#else
|
||||
|
@ -19,13 +19,13 @@
|
||||
#include "BluetoothServiceBluedroid.h"
|
||||
|
||||
#include "BluetoothA2dpManager.h"
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
#include "BluetoothGattManager.h"
|
||||
#else
|
||||
// TODO: Support GATT
|
||||
#endif
|
||||
#include "BluetoothHfpManager.h"
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
#include "BluetoothHidManager.h"
|
||||
#else
|
||||
// TODO: Support HID
|
||||
@ -41,7 +41,7 @@
|
||||
#include "mozilla/StaticMutex.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/unused.h"
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
#include "nsDataHashtable.h"
|
||||
#endif
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
|
||||
#define ENSURE_GATT_MGR_IS_READY_VOID(gatt, runnable) \
|
||||
do { \
|
||||
@ -947,7 +947,7 @@ BluetoothServiceBluedroid::StopInternal()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
nsresult
|
||||
BluetoothServiceBluedroid::GetAdaptersInternal(
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
@ -1039,7 +1039,7 @@ public:
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
BT_WARNING("GetRemoteDeviceProperties(%s) failed: %d",
|
||||
NS_ConvertUTF16toUTF8(mDeviceAddress).get(), aStatus);
|
||||
|
||||
@ -1083,7 +1083,7 @@ BluetoothServiceBluedroid::GetConnectedDevicePropertiesInternal(
|
||||
|
||||
ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK);
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
BluetoothProfileManagerBase* profile =
|
||||
BluetoothUuidHelper::GetBluetoothProfileManager(aServiceUuid);
|
||||
if (!profile) {
|
||||
@ -1148,7 +1148,7 @@ BluetoothServiceBluedroid::GetPairedDevicePropertiesInternal(
|
||||
|
||||
ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK);
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
int requestedDeviceCount = aDeviceAddress.Length();
|
||||
if (requestedDeviceCount == 0) {
|
||||
DispatchReplySuccess(aRunnable);
|
||||
@ -1182,7 +1182,7 @@ public:
|
||||
: mRunnable(aRunnable)
|
||||
{ }
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
void OnError(BluetoothStatus aStatus) override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -1214,7 +1214,7 @@ BluetoothServiceBluedroid::StartDiscoveryInternal(
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
sChangeDiscoveryRunnableArray.AppendElement(aRunnable);
|
||||
#else
|
||||
// Missing in bluetooth1
|
||||
@ -1231,7 +1231,7 @@ public:
|
||||
: mRunnable(aRunnable)
|
||||
{ }
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
void OnError(BluetoothStatus aStatus) override
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -1256,7 +1256,7 @@ private:
|
||||
BluetoothReplyRunnable* mRunnable;
|
||||
};
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
class BluetoothServiceBluedroid::GetRemoteServicesResultHandler final
|
||||
: public BluetoothResultHandler
|
||||
{
|
||||
@ -1310,7 +1310,7 @@ BluetoothServiceBluedroid::StopDiscoveryInternal(
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
sChangeDiscoveryRunnableArray.AppendElement(aRunnable);
|
||||
#else
|
||||
// Missing in bluetooth1
|
||||
@ -1331,7 +1331,7 @@ public:
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
sSetPropertyRunnableArray.RemoveElement(mRunnable);
|
||||
DispatchReplyError(mRunnable, aStatus);
|
||||
#else
|
||||
@ -1388,7 +1388,7 @@ public:
|
||||
|
||||
void OnError(BluetoothStatus aStatus) override
|
||||
{
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
sBondingRunnableArray.RemoveElement(mRunnable);
|
||||
DispatchReplyError(mRunnable, aStatus);
|
||||
#else
|
||||
@ -1429,7 +1429,7 @@ public:
|
||||
|
||||
void OnError(BluetoothStatus aStatus) override
|
||||
{
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
sUnbondingRunnableArray.RemoveElement(mRunnable);
|
||||
DispatchReplyError(mRunnable, aStatus);
|
||||
#else
|
||||
@ -1458,7 +1458,7 @@ BluetoothServiceBluedroid::RemoveDeviceInternal(
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
class BluetoothServiceBluedroid::PinReplyResultHandler final
|
||||
: public BluetoothResultHandler
|
||||
{
|
||||
@ -1540,7 +1540,7 @@ BluetoothServiceBluedroid::SetPinCodeInternal(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
void
|
||||
BluetoothServiceBluedroid::SetPasskeyInternal(
|
||||
const nsAString& aDeviceAddress, uint32_t aPasskey,
|
||||
@ -1558,7 +1558,7 @@ BluetoothServiceBluedroid::SetPasskeyInternal(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
class BluetoothServiceBluedroid::SspReplyResultHandler final
|
||||
: public BluetoothResultHandler
|
||||
{
|
||||
@ -1641,7 +1641,7 @@ BluetoothServiceBluedroid::SetPairingConfirmationInternal(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
// Missing in bluetooth2
|
||||
#else
|
||||
bool
|
||||
@ -1659,7 +1659,7 @@ BluetoothServiceBluedroid::PrepareAdapterInternal()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
void
|
||||
BluetoothServiceBluedroid::NextBluetoothProfileController()
|
||||
#else
|
||||
@ -1679,7 +1679,7 @@ NextBluetoothProfileController()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
void
|
||||
BluetoothServiceBluedroid::ConnectDisconnect(
|
||||
bool aConnect, const nsAString& aDeviceAddress,
|
||||
@ -1728,7 +1728,7 @@ BluetoothServiceBluedroid::Disconnect(
|
||||
ConnectDisconnect(false, aDeviceAddress, aRunnable, aServiceUuid);
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
bool
|
||||
BluetoothServiceBluedroid::IsConnected(uint16_t aProfileId)
|
||||
{
|
||||
@ -1953,7 +1953,7 @@ BluetoothServiceBluedroid::ToggleCalls(BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
// Missing in bluetooth2
|
||||
#else
|
||||
uint16_t
|
||||
@ -2062,7 +2062,7 @@ public:
|
||||
void
|
||||
BluetoothServiceBluedroid::AdapterStateChangedNotification(bool aState)
|
||||
{
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BT_LOGR("BT_STATE: %d", aState);
|
||||
@ -2235,7 +2235,7 @@ BluetoothServiceBluedroid::AdapterPropertiesNotification(
|
||||
BluetoothStatus aStatus, int aNumProperties,
|
||||
const BluetoothProperty* aProperties)
|
||||
{
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
InfallibleTArray<BluetoothNamedValue> propertiesArray;
|
||||
@ -2390,7 +2390,7 @@ BluetoothServiceBluedroid::RemoteDevicePropertiesNotification(
|
||||
BluetoothStatus aStatus, const nsAString& aBdAddr,
|
||||
int aNumProperties, const BluetoothProperty* aProperties)
|
||||
{
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
InfallibleTArray<BluetoothNamedValue> propertiesArray;
|
||||
@ -2596,7 +2596,7 @@ void
|
||||
BluetoothServiceBluedroid::DeviceFoundNotification(
|
||||
int aNumProperties, const BluetoothProperty* aProperties)
|
||||
{
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BluetoothValue propertyValue;
|
||||
@ -2684,7 +2684,7 @@ BluetoothServiceBluedroid::DeviceFoundNotification(
|
||||
void
|
||||
BluetoothServiceBluedroid::DiscoveryStateChangedNotification(bool aState)
|
||||
{
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
sAdapterDiscovering = aState;
|
||||
@ -2727,7 +2727,7 @@ BluetoothServiceBluedroid::PinRequestNotification(const nsAString& aRemoteBdAddr
|
||||
const nsAString& aBdName,
|
||||
uint32_t aCod)
|
||||
{
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
InfallibleTArray<BluetoothNamedValue> propertiesArray;
|
||||
@ -2766,7 +2766,7 @@ BluetoothServiceBluedroid::SspRequestNotification(
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
InfallibleTArray<BluetoothNamedValue> propertiesArray;
|
||||
nsAutoString passkey;
|
||||
nsAutoString pairingType;
|
||||
@ -2826,7 +2826,7 @@ BluetoothServiceBluedroid::BondStateChangedNotification(
|
||||
BluetoothStatus aStatus, const nsAString& aRemoteBdAddr,
|
||||
BluetoothBondState aState)
|
||||
{
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (aState == BOND_STATE_BONDING) {
|
||||
@ -3023,7 +3023,7 @@ BluetoothServiceBluedroid::LeTestModeNotification(BluetoothStatus aStatus,
|
||||
// FIXME: This will be implemented in the later patchset
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
// TODO: Support EnergyInfoNotification
|
||||
#else
|
||||
void
|
||||
@ -3059,7 +3059,7 @@ BluetoothServiceBluedroid::BackendErrorNotification(bool aCrashed)
|
||||
|
||||
sIsRestart = true;
|
||||
BT_LOGR("Recovery step2: stop bluetooth");
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
StopBluetooth(false, nullptr);
|
||||
#else
|
||||
StopBluetooth(false);
|
||||
|
@ -7,7 +7,7 @@
|
||||
#ifndef mozilla_dom_bluetooth_bluetoothservicebluedroid_h__
|
||||
#define mozilla_dom_bluetooth_bluetoothservicebluedroid_h__
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
|
||||
#include "BluetoothCommon.h"
|
||||
#include "BluetoothInterface.h"
|
||||
|
@ -91,7 +91,7 @@ USING_BLUETOOTH_NAMESPACE
|
||||
#define TIMEOUT_FORCE_TO_DISABLE_BT 5
|
||||
#define BT_LAZY_THREAD_TIMEOUT_MS 3000
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
// missing on blutooth2
|
||||
#else
|
||||
// Set Class of Device value bit
|
||||
@ -149,7 +149,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
// TODO: This is the wrong place for handling manager classes
|
||||
BluetoothProfileManagerBase* profile;
|
||||
profile = BluetoothHfpManager::Get();
|
||||
@ -627,7 +627,7 @@ public:
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
NS_ENSURE_TRUE_VOID(bs);
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
// Missing in bluetooth2
|
||||
#else
|
||||
bs->AdapterAddedReceived();
|
||||
@ -663,7 +663,7 @@ private:
|
||||
bool mDelay;
|
||||
};
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
// Missing in bluetooth2
|
||||
#else
|
||||
class InternalStopDiscoveryTask : public nsRunnable
|
||||
@ -918,7 +918,7 @@ HasAudioService(uint32_t aCodValue)
|
||||
return ((aCodValue & 0x200000) == 0x200000);
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
static bool
|
||||
ContainsIcon(const InfallibleTArray<BluetoothNamedValue>& aProperties)
|
||||
{
|
||||
@ -1782,7 +1782,7 @@ public:
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
NS_ENSURE_TRUE(bs, NS_ERROR_FAILURE);
|
||||
|
||||
@ -1886,7 +1886,7 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("Path"),
|
||||
GetObjectPathFromAddress(signalPath, address)));
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
if (!ContainsIcon(properties)) {
|
||||
#else
|
||||
if (FindProperty(properties, "Icon") < 0) {
|
||||
@ -1908,7 +1908,7 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
// Missing in bluetooth2
|
||||
#else
|
||||
if (FindProperty(properties, "Class") < 0) {
|
||||
@ -1987,7 +1987,7 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
|
||||
sAdapterProperties,
|
||||
ArrayLength(sAdapterProperties));
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
// Missing in bluetooth2
|
||||
#else
|
||||
BluetoothNamedValue& property = v.get_ArrayOfBluetoothNamedValue()[0];
|
||||
@ -2020,7 +2020,7 @@ EventFilter(DBusConnection* aConn, DBusMessage* aMsg, void* aData)
|
||||
// "bluetooth-pairedstatuschanged" from BluetoothService.
|
||||
BluetoothValue newValue(v);
|
||||
ToLowerCase(newValue.get_ArrayOfBluetoothNamedValue()[0].name());
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
BluetoothSignal signal(NS_LITERAL_STRING("pairedstatuschanged"),
|
||||
NS_LITERAL_STRING(KEY_LOCAL_AGENT),
|
||||
newValue);
|
||||
@ -2294,7 +2294,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
nsresult
|
||||
BluetoothDBusService::StartInternal(BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
@ -2429,7 +2429,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
nsresult
|
||||
BluetoothDBusService::StopInternal(BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
@ -2587,7 +2587,7 @@ private:
|
||||
nsRefPtr<BluetoothReplyRunnable> mRunnable;
|
||||
};
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
nsresult
|
||||
BluetoothDBusService::GetAdaptersInternal(BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
@ -2639,7 +2639,7 @@ OnSendDiscoveryMessageReply(DBusMessage *aReply, void *aData)
|
||||
errorStr.AssignLiteral("SendDiscovery failed");
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
// Missing in blueooth2
|
||||
#else
|
||||
// aData may be a nullptr because we may call StopDiscovery internally when
|
||||
@ -2672,7 +2672,7 @@ public:
|
||||
, mRunnable(aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(!mMessageName.IsEmpty());
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
MOZ_ASSERT(mRunnable);
|
||||
#else
|
||||
// Missing in bluetooth1
|
||||
@ -2710,7 +2710,7 @@ BluetoothDBusService::SendDiscoveryMessage(const char* aMessageName,
|
||||
MOZ_ASSERT(!sAdapterPath.IsEmpty());
|
||||
|
||||
if (!IsReady()) {
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
NS_NAMED_LITERAL_STRING(errorStr, "Bluetooth service is not ready yet!");
|
||||
DispatchBluetoothReply(aRunnable, BluetoothValue(), errorStr);
|
||||
#else
|
||||
@ -2910,7 +2910,7 @@ public:
|
||||
// Icon as audio-card. This is for PTS test TC_AG_COD_BV_02_I.
|
||||
// As HFP specification defined that
|
||||
// service class is "Audio" can be considered as HFP AG.
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
if (!ContainsIcon(devicePropertiesArray)) {
|
||||
#else
|
||||
if (FindProperty(devicePropertiesArray, "Icon") < 0) {
|
||||
@ -2928,7 +2928,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
// Missing in bluetooth2
|
||||
#else
|
||||
// Check whether the properties array contains CoD. If it doesn't, fallback to restore
|
||||
@ -3111,7 +3111,7 @@ BluetoothDBusService::GetPairedDevicePropertiesInternal(
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
nsresult
|
||||
BluetoothDBusService::FetchUuidsInternal(const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
@ -3496,7 +3496,7 @@ private:
|
||||
nsRefPtr<BluetoothReplyRunnable> mRunnable;
|
||||
};
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
void
|
||||
BluetoothDBusService::PinReplyInternal(
|
||||
const nsAString& aDeviceAddress, bool aAccept,
|
||||
@ -3601,7 +3601,7 @@ private:
|
||||
nsRefPtr<BluetoothReplyRunnable> mRunnable;
|
||||
};
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
void
|
||||
BluetoothDBusService::SetPasskeyInternal(const nsAString& aDeviceAddress,
|
||||
uint32_t aPasskey,
|
||||
@ -3627,7 +3627,7 @@ BluetoothDBusService::SetPasskeyInternal(const nsAString& aDeviceAddress,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
void
|
||||
BluetoothDBusService::SetPairingConfirmationInternal(
|
||||
const nsAString& aDeviceAddress,
|
||||
@ -3714,7 +3714,7 @@ BluetoothDBusService::Disconnect(const nsAString& aDeviceAddress,
|
||||
ConnectDisconnect(false, aDeviceAddress, aRunnable, aServiceUuid);
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
bool
|
||||
BluetoothDBusService::IsConnected(const uint16_t aServiceUuid)
|
||||
{
|
||||
@ -3787,7 +3787,7 @@ BluetoothDBusService::ToggleCalls(BluetoothReplyRunnable* aRunnable)
|
||||
class OnUpdateSdpRecordsRunnable : public nsRunnable
|
||||
{
|
||||
public:
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
OnUpdateSdpRecordsRunnable(const nsAString& aObjectPath,
|
||||
BluetoothProfileManagerBase* aManager)
|
||||
: mManager(aManager)
|
||||
@ -3818,7 +3818,7 @@ public:
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
// Missing in bluetooth2
|
||||
#else
|
||||
void
|
||||
@ -4013,7 +4013,7 @@ public:
|
||||
MOZ_ASSERT(sDBusConnection);
|
||||
MOZ_ASSERT(!sAdapterPath.IsEmpty());
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
const nsString objectPath =
|
||||
GetObjectPathFromAddress(sAdapterPath, mDeviceAddress);
|
||||
|
||||
@ -4055,7 +4055,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
// Missing in bluetooth2
|
||||
#else
|
||||
static void CreateDeviceCallback(DBusMessage* aMsg, void* aData)
|
||||
@ -4096,7 +4096,7 @@ protected:
|
||||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
nsRefPtr<OnUpdateSdpRecordsRunnable> r(
|
||||
static_cast<OnUpdateSdpRecordsRunnable*>(aData));
|
||||
NS_DispatchToMainThread(r);
|
||||
@ -4124,7 +4124,7 @@ BluetoothDBusService::UpdateSdpRecords(const nsAString& aDeviceAddress,
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
Task* task = new UpdateSdpRecordsTask(aDeviceAddress, aManager);
|
||||
DispatchToDBusThread(task);
|
||||
#else
|
||||
@ -4379,7 +4379,7 @@ BluetoothDBusService::SendMetaData(const nsAString& aTitle,
|
||||
a2dp->GetTitle(prevTitle);
|
||||
a2dp->GetAlbum(prevAlbum);
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
uint64_t mediaNumber = static_cast<uint64_t>(aMediaNumber);
|
||||
if (mediaNumber != a2dp->GetMediaNumber() ||
|
||||
!aTitle.Equals(prevTitle) ||
|
||||
@ -4690,7 +4690,7 @@ BluetoothDBusService::UpdateNotification(ControlEventId aEventId,
|
||||
DispatchToDBusThread(task);
|
||||
}
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
void
|
||||
BluetoothDBusService::StartLeScanInternal(
|
||||
const nsTArray<nsString>& aServiceUuids,
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
|
||||
bool IsReady();
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
virtual nsresult StartInternal(BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual nsresult StopInternal(BluetoothReplyRunnable* aRunnable) override;
|
||||
@ -109,7 +109,7 @@ public:
|
||||
RemoveDeviceInternal(const nsAString& aDeviceObjectPath,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
virtual void
|
||||
PinReplyInternal(const nsAString& aDeviceAddress,
|
||||
bool aAccept,
|
||||
@ -153,7 +153,7 @@ public:
|
||||
uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
virtual bool
|
||||
IsConnected(uint16_t aServiceUuid) override;
|
||||
#else
|
||||
@ -233,7 +233,7 @@ public:
|
||||
SendInputMessage(const nsAString& aDeviceAddresses,
|
||||
const nsAString& aMessage) override;
|
||||
|
||||
#ifdef MOZ_B2G_BT_API_V2
|
||||
#ifndef MOZ_B2G_BT_API_V1
|
||||
virtual void
|
||||
StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
@ -24,7 +24,25 @@ if CONFIG['MOZ_B2G_BT']:
|
||||
'BluetoothRilListener.cpp'
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_B2G_BT_API_V2']:
|
||||
if CONFIG['MOZ_B2G_BT_API_V1']:
|
||||
SOURCES += [
|
||||
'bluetooth1/BluetoothAdapter.cpp',
|
||||
'bluetooth1/BluetoothDevice.cpp',
|
||||
'bluetooth1/BluetoothManager.cpp',
|
||||
'bluetooth1/BluetoothProfileController.cpp',
|
||||
'bluetooth1/BluetoothPropertyContainer.cpp',
|
||||
'bluetooth1/BluetoothReplyRunnable.cpp',
|
||||
'bluetooth1/BluetoothService.cpp',
|
||||
'bluetooth1/ipc/BluetoothChild.cpp',
|
||||
'bluetooth1/ipc/BluetoothParent.cpp',
|
||||
'bluetooth1/ipc/BluetoothServiceChildProcess.cpp',
|
||||
]
|
||||
LOCAL_INCLUDES += [
|
||||
'bluetooth1',
|
||||
'bluetooth1/ipc',
|
||||
]
|
||||
DEFINES['MOZ_B2G_BT_API_V1'] = True
|
||||
else:
|
||||
SOURCES += [
|
||||
'bluetooth2/BluetoothAdapter.cpp',
|
||||
'bluetooth2/BluetoothClassOfDevice.cpp',
|
||||
@ -49,24 +67,6 @@ if CONFIG['MOZ_B2G_BT']:
|
||||
'bluetooth2',
|
||||
'bluetooth2/ipc',
|
||||
]
|
||||
DEFINES['MOZ_B2G_BT_API_V2'] = True
|
||||
else:
|
||||
SOURCES += [
|
||||
'bluetooth1/BluetoothAdapter.cpp',
|
||||
'bluetooth1/BluetoothDevice.cpp',
|
||||
'bluetooth1/BluetoothManager.cpp',
|
||||
'bluetooth1/BluetoothProfileController.cpp',
|
||||
'bluetooth1/BluetoothPropertyContainer.cpp',
|
||||
'bluetooth1/BluetoothReplyRunnable.cpp',
|
||||
'bluetooth1/BluetoothService.cpp',
|
||||
'bluetooth1/ipc/BluetoothChild.cpp',
|
||||
'bluetooth1/ipc/BluetoothParent.cpp',
|
||||
'bluetooth1/ipc/BluetoothServiceChildProcess.cpp',
|
||||
]
|
||||
LOCAL_INCLUDES += [
|
||||
'bluetooth1',
|
||||
'bluetooth1/ipc',
|
||||
]
|
||||
|
||||
#
|
||||
# Bluetooth backends
|
||||
@ -130,7 +130,7 @@ if CONFIG['MOZ_B2G_BT']:
|
||||
LOCAL_INCLUDES += [
|
||||
'bluedroid/hfp-fallback',
|
||||
]
|
||||
if CONFIG['MOZ_B2G_BT_API_V2']:
|
||||
if not CONFIG['MOZ_B2G_BT_API_V1']:
|
||||
SOURCES += [
|
||||
'bluedroid/BluetoothGattManager.cpp',
|
||||
]
|
||||
@ -163,7 +163,21 @@ EXPORTS.mozilla.dom.bluetooth += [
|
||||
'BluetoothCommon.h'
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_B2G_BT_API_V2']:
|
||||
if CONFIG['MOZ_B2G_BT_API_V1']:
|
||||
EXPORTS.mozilla.dom.bluetooth.ipc += [
|
||||
'bluetooth1/ipc/BluetoothMessageUtils.h',
|
||||
]
|
||||
EXPORTS.mozilla.dom.bluetooth += [
|
||||
'bluetooth1/BluetoothAdapter.h',
|
||||
'bluetooth1/BluetoothDevice.h',
|
||||
'bluetooth1/BluetoothManager.h',
|
||||
]
|
||||
IPDL_SOURCES += [
|
||||
'bluetooth1/ipc/BluetoothTypes.ipdlh',
|
||||
'bluetooth1/ipc/PBluetooth.ipdl',
|
||||
'bluetooth1/ipc/PBluetoothRequest.ipdl',
|
||||
]
|
||||
else:
|
||||
EXPORTS.mozilla.dom.bluetooth.ipc += [
|
||||
'bluetooth2/ipc/BluetoothMessageUtils.h',
|
||||
]
|
||||
@ -186,20 +200,6 @@ if CONFIG['MOZ_B2G_BT_API_V2']:
|
||||
'bluetooth2/ipc/PBluetooth.ipdl',
|
||||
'bluetooth2/ipc/PBluetoothRequest.ipdl',
|
||||
]
|
||||
else:
|
||||
EXPORTS.mozilla.dom.bluetooth.ipc += [
|
||||
'bluetooth1/ipc/BluetoothMessageUtils.h',
|
||||
]
|
||||
EXPORTS.mozilla.dom.bluetooth += [
|
||||
'bluetooth1/BluetoothAdapter.h',
|
||||
'bluetooth1/BluetoothDevice.h',
|
||||
'bluetooth1/BluetoothManager.h',
|
||||
]
|
||||
IPDL_SOURCES += [
|
||||
'bluetooth1/ipc/BluetoothTypes.ipdlh',
|
||||
'bluetooth1/ipc/PBluetooth.ipdl',
|
||||
'bluetooth1/ipc/PBluetoothRequest.ipdl',
|
||||
]
|
||||
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
||||
|
@ -162,16 +162,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gonk', 'qt'):
|
||||
if CONFIG['MOZ_TOOLKIT_SEARCH']:
|
||||
DEFINES['MOZ_TOOLKIT_SEARCH'] = True
|
||||
|
||||
if CONFIG['MOZ_B2G_BT_API_V2']:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth/bluetooth2',
|
||||
'/dom/bluetooth/bluetooth2/ipc',
|
||||
]
|
||||
else:
|
||||
if CONFIG['MOZ_B2G_BT_API_V1']:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth/bluetooth1',
|
||||
'/dom/bluetooth/bluetooth1/ipc',
|
||||
]
|
||||
else:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth/bluetooth2',
|
||||
'/dom/bluetooth/bluetooth2/ipc',
|
||||
]
|
||||
|
||||
JAR_MANIFESTS += ['jar.mn']
|
||||
|
||||
|
@ -125,13 +125,13 @@ LOCAL_INCLUDES += [
|
||||
'/dom/wifi',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_B2G_BT_API_V2']:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth/bluetooth2',
|
||||
]
|
||||
else:
|
||||
if CONFIG['MOZ_B2G_BT_API_V1']:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth/bluetooth1',
|
||||
]
|
||||
else:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth/bluetooth2',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
@ -645,7 +645,13 @@ if CONFIG['MOZ_DEBUG']:
|
||||
WEBIDL_FILES += ['TestInterfaceJS.webidl', 'TestInterfaceJSDictionaries.webidl']
|
||||
|
||||
if CONFIG['MOZ_B2G_BT']:
|
||||
if CONFIG['MOZ_B2G_BT_API_V2']:
|
||||
if CONFIG['MOZ_B2G_BT_API_V1']:
|
||||
WEBIDL_FILES += [
|
||||
'BluetoothAdapter.webidl',
|
||||
'BluetoothDevice.webidl',
|
||||
'BluetoothManager.webidl',
|
||||
]
|
||||
else:
|
||||
WEBIDL_FILES += [
|
||||
'BluetoothAdapter2.webidl',
|
||||
'BluetoothClassOfDevice.webidl',
|
||||
@ -660,12 +666,6 @@ if CONFIG['MOZ_B2G_BT']:
|
||||
'BluetoothPairingHandle.webidl',
|
||||
'BluetoothPairingListener.webidl',
|
||||
]
|
||||
else:
|
||||
WEBIDL_FILES += [
|
||||
'BluetoothAdapter.webidl',
|
||||
'BluetoothDevice.webidl',
|
||||
'BluetoothManager.webidl',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_SIMPLEPUSH']:
|
||||
WEBIDL_FILES += [
|
||||
@ -796,17 +796,17 @@ if CONFIG['MOZ_GAMEPAD']:
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_B2G_BT']:
|
||||
if CONFIG['MOZ_B2G_BT_API_V2']:
|
||||
if CONFIG['MOZ_B2G_BT_API_V1']:
|
||||
GENERATED_EVENTS_WEBIDL_FILES += [
|
||||
'BluetoothDiscoveryStateChangedEvent.webidl',
|
||||
]
|
||||
else:
|
||||
GENERATED_EVENTS_WEBIDL_FILES += [
|
||||
'BluetoothAdapterEvent.webidl',
|
||||
'BluetoothAttributeEvent.webidl',
|
||||
'BluetoothGattCharacteristicEvent.webidl',
|
||||
'BluetoothPairingEvent.webidl',
|
||||
]
|
||||
else:
|
||||
GENERATED_EVENTS_WEBIDL_FILES += [
|
||||
'BluetoothDiscoveryStateChangedEvent.webidl',
|
||||
]
|
||||
|
||||
GENERATED_EVENTS_WEBIDL_FILES += [
|
||||
'BluetoothDeviceEvent.webidl',
|
||||
|
@ -73,11 +73,11 @@ if CONFIG['MOZ_B2G_BT']:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth',
|
||||
]
|
||||
if CONFIG['MOZ_B2G_BT_API_V2']:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth/bluetooth2',
|
||||
]
|
||||
else:
|
||||
if CONFIG['MOZ_B2G_BT_API_V1']:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth/bluetooth1',
|
||||
]
|
||||
else:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth/bluetooth2',
|
||||
]
|
||||
|
@ -108,13 +108,13 @@ if CONFIG['MOZ_B2G_BT']:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth',
|
||||
]
|
||||
if CONFIG['MOZ_B2G_BT_API_V2']:
|
||||
if CONFIG['MOZ_B2G_BT_API_V1']:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth/bluetooth2',
|
||||
'/dom/bluetooth/bluetooth1',
|
||||
]
|
||||
else:
|
||||
LOCAL_INCLUDES += [
|
||||
'/dom/bluetooth/bluetooth1',
|
||||
'/dom/bluetooth/bluetooth2',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WEBSPEECH']:
|
||||
|
Loading…
Reference in New Issue
Block a user