Skip to content

Commit

Permalink
Backed out changeset ef9e220beb2d (bug 1250694)
Browse files Browse the repository at this point in the history
  • Loading branch information
BruceSunMozilla committed Mar 4, 2016
1 parent ceeabc2 commit 0e65862
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 54 deletions.
4 changes: 2 additions & 2 deletions dom/bluetooth/bluedroid/BluetoothDaemonHandsfreeInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ BluetoothHandsfreeNotificationHandler*

#if ANDROID_VERSION < 21
BluetoothAddress BluetoothDaemonHandsfreeModule::sConnectedDeviceAddress(
BluetoothAddress::ANY());
BluetoothAddress::ANY);
#endif

void
Expand Down Expand Up @@ -760,7 +760,7 @@ class BluetoothDaemonHandsfreeModule::ConnectionStateInitOp final
if (aArg1 == HFP_CONNECTION_STATE_CONNECTED) {
sConnectedDeviceAddress = aArg2;
} else if (aArg1 == HFP_CONNECTION_STATE_DISCONNECTED) {
sConnectedDeviceAddress = BluetoothAddress::ANY();
sConnectedDeviceAddress = BluetoothAddress::ANY;
}
#endif
WarnAboutTrailingData();
Expand Down
4 changes: 2 additions & 2 deletions dom/bluetooth/bluedroid/BluetoothGattManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
45 changes: 14 additions & 31 deletions dom/bluetooth/common/BluetoothCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
37 changes: 19 additions & 18 deletions dom/bluetooth/common/BluetoothCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

/*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -609,7 +610,7 @@ struct BluetoothUuid {
*/
void Clear()
{
operator=(ZERO());
operator=(ZERO);
}

/**
Expand All @@ -618,7 +619,7 @@ struct BluetoothUuid {
*/
bool IsCleared() const
{
return operator==(ZERO());
return operator==(ZERO);
}

bool operator==(const BluetoothUuid& aRhs) const
Expand Down Expand Up @@ -649,7 +650,7 @@ struct BluetoothUuid {

void SetUuid32(uint32_t aUuid32)
{
operator=(BASE());
operator=(BASE);
BigEndian::writeUint32(&mUuid[0], aUuid32);
}

Expand All @@ -660,7 +661,7 @@ struct BluetoothUuid {

void SetUuid16(uint16_t aUuid16)
{
operator=(BASE());
operator=(BASE);
BigEndian::writeUint16(&mUuid[2], aUuid16);
}

Expand Down
2 changes: 1 addition & 1 deletion dom/bluetooth/common/BluetoothUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 0e65862

Please sign in to comment.