mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Backed out changeset 078dd0e39cc8 (bug 1215525) for bustage
This commit is contained in:
parent
aa4d7353fb
commit
e8397e7416
@ -38,22 +38,34 @@ using namespace mozilla::ipc;
|
||||
|
||||
namespace {
|
||||
// UUID of Map Mas
|
||||
static const BluetoothUuid kMapMas(MAP_MAS);
|
||||
|
||||
static const BluetoothUuid kMapMas = {
|
||||
{
|
||||
0x00, 0x00, 0x11, 0x32, 0x00, 0x00, 0x10, 0x00,
|
||||
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
|
||||
}
|
||||
};
|
||||
// UUID of Map Mns
|
||||
static const BluetoothUuid kMapMns(MAP_MNS);
|
||||
|
||||
static const BluetoothUuid kMapMns = {
|
||||
{
|
||||
0x00, 0x00, 0x11, 0x33, 0x00, 0x00, 0x10, 0x00,
|
||||
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
|
||||
}
|
||||
};
|
||||
// UUID used in Map OBEX MAS target header
|
||||
static const BluetoothUuid kMapMasObexTarget(0xBB, 0x58, 0x2B, 0x40,
|
||||
0x42, 0x0C, 0x11, 0xDB,
|
||||
0xB0, 0xDE, 0x08, 0x00,
|
||||
0x20, 0x0C, 0x9A, 0x66);
|
||||
static const BluetoothUuid kMapMasObexTarget = {
|
||||
{
|
||||
0xBB, 0x58, 0x2B, 0x40, 0x42, 0x0C, 0x11, 0xDB,
|
||||
0xB0, 0xDE, 0x08, 0x00, 0x20, 0x0C, 0x9A, 0x66
|
||||
}
|
||||
};
|
||||
|
||||
// UUID used in Map OBEX MNS target header
|
||||
static const BluetoothUuid kMapMnsObexTarget(0xBB, 0x58, 0x2B, 0x41,
|
||||
0x42, 0x0C, 0x11, 0xDB,
|
||||
0xB0, 0xDE, 0x08, 0x00,
|
||||
0x20, 0x0C, 0x9A, 0x66);
|
||||
static const BluetoothUuid kMapMnsObexTarget = {
|
||||
{
|
||||
0xBB, 0x58, 0x2B, 0x41, 0x42, 0x0C, 0x11, 0xDB,
|
||||
0xB0, 0xDE, 0x08, 0x00, 0x20, 0x0C, 0x9A, 0x66
|
||||
}
|
||||
};
|
||||
|
||||
StaticRefPtr<BluetoothMapSmsManager> sMapSmsManager;
|
||||
static bool sInShutdown = false;
|
||||
|
@ -60,7 +60,12 @@ namespace {
|
||||
static const double kSdpUpdatingTimeoutMs = 3000.0;
|
||||
|
||||
// UUID of OBEX Object Push
|
||||
static const BluetoothUuid kObexObjectPush(OBJECT_PUSH);
|
||||
static const BluetoothUuid kObexObjectPush = {
|
||||
{
|
||||
0x00, 0x00, 0x11, 0x05, 0x00, 0x00, 0x10, 0x00,
|
||||
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
|
||||
}
|
||||
};
|
||||
|
||||
StaticRefPtr<BluetoothOppManager> sBluetoothOppManager;
|
||||
static bool sInShutdown = false;
|
||||
|
@ -31,13 +31,20 @@ using namespace mozilla::ipc;
|
||||
|
||||
namespace {
|
||||
// UUID of PBAP PSE
|
||||
static const BluetoothUuid kPbapPSE(PBAP_PSE);
|
||||
static const BluetoothUuid kPbapPSE = {
|
||||
{
|
||||
0x00, 0x00, 0x11, 0x2F, 0x00, 0x00, 0x10, 0x00,
|
||||
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
|
||||
}
|
||||
};
|
||||
|
||||
// UUID used in PBAP OBEX target header
|
||||
static const BluetoothUuid kPbapObexTarget(0x79, 0x61, 0x35, 0xF0,
|
||||
0xF0, 0xC5, 0x11, 0xD8,
|
||||
0x09, 0x66, 0x08, 0x00,
|
||||
0x20, 0x0C, 0x9A, 0x66);
|
||||
static const BluetoothUuid kPbapObexTarget = {
|
||||
{
|
||||
0x79, 0x61, 0x35, 0xF0, 0xF0, 0xC5, 0x11, 0xD8,
|
||||
0x09, 0x66, 0x08, 0x00, 0x20, 0x0C, 0x9A, 0x66
|
||||
}
|
||||
};
|
||||
|
||||
// App parameters to pull phonebook
|
||||
static const AppParameterTag sPhonebookTags[] = {
|
||||
|
@ -82,13 +82,28 @@ namespace {
|
||||
static const char kHfpCrlf[] = "\xd\xa";
|
||||
|
||||
// UUID of Handsfree Audio Gateway
|
||||
static const BluetoothUuid kHandsfreeAG(HANDSFREE_AG);
|
||||
static const BluetoothUuid kHandsfreeAG = {
|
||||
{
|
||||
0x00, 0x00, 0x11, 0x1F, 0x00, 0x00, 0x10, 0x00,
|
||||
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
|
||||
}
|
||||
};
|
||||
|
||||
// UUID of Headset Audio Gateway
|
||||
static const BluetoothUuid kHeadsetAG(HEADSET_AG);
|
||||
static const BluetoothUuid kHeadsetAG = {
|
||||
{
|
||||
0x00, 0x00, 0x11, 0x12, 0x00, 0x00, 0x10, 0x00,
|
||||
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
|
||||
}
|
||||
};
|
||||
|
||||
// Unknown service UUID (for SCO socket)
|
||||
static const BluetoothUuid kUnknownService(BluetoothServiceClass::UNKNOWN);
|
||||
static const BluetoothUuid kUnknownService = {
|
||||
{
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
|
||||
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
// Sending ringtone related
|
||||
|
@ -62,7 +62,12 @@ namespace {
|
||||
static const double kSdpUpdatingTimeoutMs = 3000.0;
|
||||
|
||||
// UUID of OBEX Object Push
|
||||
static const BluetoothUuid kObexObjectPush(OBJECT_PUSH);
|
||||
static const BluetoothUuid kObexObjectPush = {
|
||||
{
|
||||
0x00, 0x00, 0x11, 0x05, 0x00, 0x00, 0x10, 0x00,
|
||||
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB
|
||||
}
|
||||
};
|
||||
|
||||
StaticRefPtr<BluetoothOppManager> sBluetoothOppManager;
|
||||
static bool sInShutdown = false;
|
||||
|
@ -21,13 +21,4 @@ const BluetoothAddress BluetoothAddress::ALL(0xff, 0xff, 0xff,
|
||||
const BluetoothAddress BluetoothAddress::LOCAL(0x00, 0x00, 0x00,
|
||||
0xff, 0xff, 0xff);
|
||||
|
||||
//
|
||||
// |BluetoothUuid|
|
||||
//
|
||||
|
||||
const BluetoothUuid BluetoothUuid::ZERO(0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00);
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
@ -7,7 +7,6 @@
|
||||
#ifndef mozilla_dom_bluetooth_BluetoothCommon_h
|
||||
#define mozilla_dom_bluetooth_BluetoothCommon_h
|
||||
|
||||
#include <algorithm>
|
||||
#include "mozilla/Compiler.h"
|
||||
#include "mozilla/Observer.h"
|
||||
#include "nsAutoPtr.h"
|
||||
@ -505,165 +504,22 @@ struct BluetoothConfigurationParameter {
|
||||
nsAutoArrayPtr<uint8_t> mValue;
|
||||
};
|
||||
|
||||
/*
|
||||
* Service classes and Profile Identifiers
|
||||
*
|
||||
* Supported Bluetooth services for v1 are listed as below.
|
||||
*
|
||||
* The value of each service class is defined in "AssignedNumbers/Service
|
||||
* Discovery Protocol (SDP)/Service classes and Profile Identifiers" in the
|
||||
* Bluetooth Core Specification.
|
||||
*/
|
||||
enum BluetoothServiceClass {
|
||||
UNKNOWN = 0x0000,
|
||||
OBJECT_PUSH = 0x1105,
|
||||
HEADSET = 0x1108,
|
||||
A2DP_SINK = 0x110b,
|
||||
AVRCP_TARGET = 0x110c,
|
||||
A2DP = 0x110d,
|
||||
AVRCP = 0x110e,
|
||||
AVRCP_CONTROLLER = 0x110f,
|
||||
HEADSET_AG = 0x1112,
|
||||
HANDSFREE = 0x111e,
|
||||
HANDSFREE_AG = 0x111f,
|
||||
HID = 0x1124,
|
||||
PBAP_PCE = 0x112e,
|
||||
PBAP_PSE = 0x112f,
|
||||
MAP_MAS = 0x1132,
|
||||
MAP_MNS = 0x1133
|
||||
};
|
||||
|
||||
struct BluetoothUuid final {
|
||||
|
||||
static const BluetoothUuid ZERO;
|
||||
|
||||
struct BluetoothUuid {
|
||||
uint8_t mUuid[16];
|
||||
|
||||
BluetoothUuid()
|
||||
bool operator==(const BluetoothUuid& aOther) const
|
||||
{
|
||||
Clear(); // assign ZERO
|
||||
for (uint8_t i = 0; i < sizeof(mUuid); i++) {
|
||||
if (mUuid[i] != aOther.mUuid[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
MOZ_IMPLICIT BluetoothUuid(const BluetoothUuid&) = default;
|
||||
|
||||
BluetoothUuid(uint8_t aUuid0, uint8_t aUuid1,
|
||||
uint8_t aUuid2, uint8_t aUuid3,
|
||||
uint8_t aUuid4, uint8_t aUuid5,
|
||||
uint8_t aUuid6, uint8_t aUuid7,
|
||||
uint8_t aUuid8, uint8_t aUuid9,
|
||||
uint8_t aUuid10, uint8_t aUuid11,
|
||||
uint8_t aUuid12, uint8_t aUuid13,
|
||||
uint8_t aUuid14, uint8_t aUuid15)
|
||||
bool operator!=(const BluetoothUuid& aOther) const
|
||||
{
|
||||
mUuid[0] = aUuid0;
|
||||
mUuid[1] = aUuid1;
|
||||
mUuid[2] = aUuid2;
|
||||
mUuid[3] = aUuid3;
|
||||
mUuid[4] = aUuid4;
|
||||
mUuid[5] = aUuid5;
|
||||
mUuid[6] = aUuid6;
|
||||
mUuid[7] = aUuid7;
|
||||
mUuid[8] = aUuid8;
|
||||
mUuid[9] = aUuid9;
|
||||
mUuid[10] = aUuid10;
|
||||
mUuid[11] = aUuid11;
|
||||
mUuid[12] = aUuid12;
|
||||
mUuid[13] = aUuid13;
|
||||
mUuid[14] = aUuid14;
|
||||
mUuid[15] = aUuid15;
|
||||
}
|
||||
|
||||
explicit BluetoothUuid(uint32_t aUuid32)
|
||||
{
|
||||
SetUuid32(aUuid32);
|
||||
}
|
||||
|
||||
explicit BluetoothUuid(uint16_t aUuid16)
|
||||
{
|
||||
SetUuid16(aUuid16);
|
||||
}
|
||||
|
||||
explicit BluetoothUuid(BluetoothServiceClass aServiceClass)
|
||||
{
|
||||
SetUuid16(static_cast<uint16_t>(aServiceClass));
|
||||
}
|
||||
|
||||
BluetoothUuid& operator=(const BluetoothUuid& aRhs) = default;
|
||||
|
||||
/**
|
||||
* |Clear| assigns an invalid value (i.e., ZERO) to the UUID.
|
||||
*/
|
||||
void Clear()
|
||||
{
|
||||
operator=(ZERO);
|
||||
}
|
||||
|
||||
/**
|
||||
* |IsCleared| returns true if the UUID contains a value of
|
||||
* zero (i.e., ZERO).
|
||||
*/
|
||||
bool IsCleared() const
|
||||
{
|
||||
return operator==(ZERO);
|
||||
}
|
||||
|
||||
bool operator==(const BluetoothUuid& aRhs) const
|
||||
{
|
||||
return std::equal(aRhs.mUuid,
|
||||
aRhs.mUuid + MOZ_ARRAY_LENGTH(aRhs.mUuid), mUuid);
|
||||
}
|
||||
|
||||
bool operator!=(const BluetoothUuid& aRhs) const
|
||||
{
|
||||
return !operator==(aRhs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Getter-setter methods for short UUIDS. The first 4 bytes in the
|
||||
* UUID are represented by the short notation UUID32, and bytes 3
|
||||
* and 4 (indices 2 and 3) are represented by UUID16. The rest of
|
||||
* the UUID is filled with the SDP base UUID.
|
||||
*
|
||||
* Below are helpers for accessing these values.
|
||||
*/
|
||||
|
||||
void SetUuid32(uint32_t aUuid32)
|
||||
{
|
||||
mUuid[0] = static_cast<uint8_t>(0xff & (aUuid32 >> 24));
|
||||
mUuid[1] = static_cast<uint8_t>(0xff & (aUuid32 >> 16));
|
||||
mUuid[2] = static_cast<uint8_t>(0xff & (aUuid32 >> 8));
|
||||
mUuid[3] = static_cast<uint8_t>(0xff & (aUuid32));
|
||||
mUuid[4] = 0x00;
|
||||
mUuid[5] = 0x00;
|
||||
mUuid[6] = 0x10;
|
||||
mUuid[7] = 0x00;
|
||||
mUuid[8] = 0x80;
|
||||
mUuid[9] = 0x00;
|
||||
mUuid[10] = 0x00;
|
||||
mUuid[11] = 0x80;
|
||||
mUuid[12] = 0x5f;
|
||||
mUuid[13] = 0x9b;
|
||||
mUuid[14] = 0x34;
|
||||
mUuid[15] = 0xfb;
|
||||
}
|
||||
|
||||
uint32_t GetUuid32() const
|
||||
{
|
||||
return (static_cast<uint32_t>(mUuid[0]) << 24) |
|
||||
(static_cast<uint32_t>(mUuid[1]) << 16) |
|
||||
(static_cast<uint32_t>(mUuid[2]) << 8) |
|
||||
(static_cast<uint32_t>(mUuid[3]));
|
||||
}
|
||||
|
||||
void SetUuid16(uint16_t aUuid16)
|
||||
{
|
||||
SetUuid32(aUuid16); // MSB is 0x0000
|
||||
}
|
||||
|
||||
uint16_t GetUuid16() const
|
||||
{
|
||||
return (static_cast<uint16_t>(mUuid[2]) << 8) |
|
||||
(static_cast<uint16_t>(mUuid[3]));
|
||||
return !(*this == aOther);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -13,6 +13,31 @@ BEGIN_BLUETOOTH_NAMESPACE
|
||||
|
||||
class BluetoothProfileManagerBase;
|
||||
|
||||
/*
|
||||
* Service classes and Profile Identifiers
|
||||
*
|
||||
* Supported Bluetooth services for v1 are listed as below.
|
||||
*
|
||||
* The value of each service class is defined in "AssignedNumbers/Service
|
||||
* Discovery Protocol (SDP)/Service classes and Profile Identifiers" in the
|
||||
* Bluetooth Core Specification.
|
||||
*/
|
||||
enum BluetoothServiceClass
|
||||
{
|
||||
A2DP = 0x110D,
|
||||
A2DP_SINK = 0x110B,
|
||||
AVRCP = 0x110E,
|
||||
AVRCP_TARGET = 0x110C,
|
||||
AVRCP_CONTROLLER = 0x110F,
|
||||
HANDSFREE = 0x111E,
|
||||
HANDSFREE_AG = 0x111F,
|
||||
HEADSET = 0x1108,
|
||||
HEADSET_AG = 0x1112,
|
||||
HID = 0x1124,
|
||||
OBJECT_PUSH = 0x1105,
|
||||
UNKNOWN = 0x0000
|
||||
};
|
||||
|
||||
class BluetoothUuidHelper
|
||||
{
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user