Backed out changeset ef9e220beb2d (bug 1250694)

This commit is contained in:
Bruce Sun 2016-03-04 18:54:26 +08:00
parent ceeabc2747
commit 0e6586272e
5 changed files with 38 additions and 54 deletions

View File

@ -20,7 +20,7 @@ BluetoothHandsfreeNotificationHandler*
#if ANDROID_VERSION < 21
BluetoothAddress BluetoothDaemonHandsfreeModule::sConnectedDeviceAddress(
BluetoothAddress::ANY());
BluetoothAddress::ANY);
#endif
void
@ -760,7 +760,7 @@ public:
if (aArg1 == HFP_CONNECTION_STATE_CONNECTED) {
sConnectedDeviceAddress = aArg2;
} else if (aArg1 == HFP_CONNECTION_STATE_DISCONNECTED) {
sConnectedDeviceAddress = BluetoothAddress::ANY();
sConnectedDeviceAddress = BluetoothAddress::ANY;
}
#endif
WarnAboutTrailingData();

View File

@ -898,7 +898,7 @@ BluetoothGattManager::StartLeScan(const nsTArray<BluetoothUuid>& aServiceUuids,
index = sClients->Length();
sClients->AppendElement(new BluetoothGattClient(appUuid,
BluetoothAddress::ANY()));
BluetoothAddress::ANY));
RefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
client->mStartLeScanRunnable = aRunnable;
@ -1036,7 +1036,7 @@ BluetoothGattManager::StartAdvertising(
index = sClients->Length();
sClients->AppendElement(new BluetoothGattClient(aAppUuid,
BluetoothAddress::ANY()));
BluetoothAddress::ANY));
RefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
client->mStartAdvertisingRunnable = aRunnable;
client->mAdvertisingData = aData;

View File

@ -16,36 +16,23 @@ BEGIN_BLUETOOTH_NAMESPACE
// |BluetoothAddress|
//
const BluetoothAddress& BluetoothAddress::ANY()
{
static const BluetoothAddress sAddress(0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
return sAddress;
}
const BluetoothAddress BluetoothAddress::ANY(0x00, 0x00, 0x00,
0x00, 0x00, 0x00);
const BluetoothAddress& BluetoothAddress::ALL()
{
static const BluetoothAddress sAddress(0xff, 0xff, 0xff, 0xff, 0xff, 0xff);
return sAddress;
}
const BluetoothAddress BluetoothAddress::ALL(0xff, 0xff, 0xff,
0xff, 0xff, 0xff);
const BluetoothAddress& BluetoothAddress::LOCAL()
{
static const BluetoothAddress sAddress(0x00, 0x00, 0x00, 0xff, 0xff, 0xff);
return sAddress;
}
const BluetoothAddress BluetoothAddress::LOCAL(0x00, 0x00, 0x00,
0xff, 0xff, 0xff);
//
// |BluetoothUuid|
//
const BluetoothUuid& BluetoothUuid::ZERO()
{
static const BluetoothUuid sUuid(0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00);
return sUuid;
}
const BluetoothUuid BluetoothUuid::ZERO(0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00);
/*
* [Bluetooth Specification Version 4.2, Volume 3, Part B, Section 2.5.1]
@ -56,13 +43,9 @@ const BluetoothUuid& BluetoothUuid::ZERO()
* the Bluetooth Base UUID and has the value 00000000-0000-1000-8000-
* 00805F9B34FB, from the Bluetooth Assigned Numbers document.
*/
const BluetoothUuid& BluetoothUuid::BASE()
{
static const BluetoothUuid sUuid(0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80,
0x5f, 0x9b, 0x34, 0xfb);
return sUuid;
}
const BluetoothUuid BluetoothUuid::BASE(0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80,
0x5f, 0x9b, 0x34, 0xfb);
END_BLUETOOTH_NAMESPACE

View File

@ -408,19 +408,20 @@ struct BluetoothActivityEnergyInfo {
/**
* |BluetoothAddress| stores the 6-byte MAC address of a Bluetooth
* device. The constants returned from ANY(), ALL() and LOCAL()
* represent addresses with special meaning.
* device. The constants ANY, ALL and LOCAL represent addresses with
* special meaning.
*/
struct BluetoothAddress {
static const BluetoothAddress& ANY();
static const BluetoothAddress& ALL();
static const BluetoothAddress& LOCAL();
static const BluetoothAddress ANY;
static const BluetoothAddress ALL;
static const BluetoothAddress LOCAL;
uint8_t mAddr[6];
BluetoothAddress()
{
Clear(); // assign ANY()
Clear(); // assign ANY
}
MOZ_IMPLICIT BluetoothAddress(const BluetoothAddress&) = default;
@ -450,20 +451,20 @@ struct BluetoothAddress {
}
/**
* |Clear| assigns an invalid value (i.e., ANY()) to the address.
* |Clear| assigns an invalid value (i.e., ANY) to the address.
*/
void Clear()
{
operator=(ANY());
operator=(ANY);
}
/**
* |IsCleared| returns true if the address does not contain a
* specific value (i.e., it contains ANY()).
* |IsCleared| returns true if the address doesn not contain a
* specific value (i.e., it contains ANY).
*/
bool IsCleared() const
{
return operator==(ANY());
return operator==(ANY);
}
/*
@ -549,13 +550,13 @@ enum BluetoothServiceClass {
};
struct BluetoothUuid {
static const BluetoothUuid& ZERO();
static const BluetoothUuid& BASE();
static const BluetoothUuid ZERO;
static const BluetoothUuid BASE;
uint8_t mUuid[16]; // store 128-bit UUID value in big-endian order
BluetoothUuid()
: BluetoothUuid(ZERO())
: BluetoothUuid(ZERO)
{ }
MOZ_IMPLICIT BluetoothUuid(const BluetoothUuid&) = default;
@ -609,7 +610,7 @@ struct BluetoothUuid {
*/
void Clear()
{
operator=(ZERO());
operator=(ZERO);
}
/**
@ -618,7 +619,7 @@ struct BluetoothUuid {
*/
bool IsCleared() const
{
return operator==(ZERO());
return operator==(ZERO);
}
bool operator==(const BluetoothUuid& aRhs) const
@ -649,7 +650,7 @@ struct BluetoothUuid {
void SetUuid32(uint32_t aUuid32)
{
operator=(BASE());
operator=(BASE);
BigEndian::writeUint32(&mUuid[0], aUuid32);
}
@ -660,7 +661,7 @@ struct BluetoothUuid {
void SetUuid16(uint16_t aUuid16)
{
operator=(BASE());
operator=(BASE);
BigEndian::writeUint16(&mUuid[2], aUuid16);
}

View File

@ -304,7 +304,7 @@ BytesToUuid(const nsTArray<uint8_t>& aArray,
return NS_ERROR_ILLEGAL_VALUE;
}
aUuid = BluetoothUuid::BASE();
aUuid = BluetoothUuid::BASE;
if (aEndian == ENDIAN_BIG) {
for (size_t i = 0; i < length; ++i) {