Merge b2g-inbound to m-c. a=merge

This commit is contained in:
Ryan VanderMeulen 2014-09-02 14:02:58 -04:00
Родитель 7c4403a53b 697833b652
Коммит f0f846d875
25 изменённых файлов: 1809 добавлений и 712 удалений

Просмотреть файл

@ -15,9 +15,9 @@
<project name="platform_build" path="build" remote="b2g" revision="4b4336c73c081b39776d399835ce4853aee5cc1c">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="44bf2e3bc5ddea9db9a8c851bd353cb234aa883c"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7e469783859785a8bd4bf02a802f32561c84be7b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
@ -127,7 +127,7 @@
<!-- Stock Android things -->
<project name="platform/external/icu4c" path="external/icu4c" revision="2bb01561780583cc37bc667f0ea79f48a122d8a2"/>
<!-- dolphin specific things -->
<project name="device/sprd" path="device/sprd" revision="ee67887cb2b7171db34b92d3f72b159d7dc51f10"/>
<project name="device/sprd" path="device/sprd" revision="4eac1e31bf69596bf229a6877c9aa3493ecd9fce"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="4e58336019b5cbcfd134caf55b142236cf986618"/>
<project name="platform/frameworks/av" path="frameworks/av" revision="facca8d3e35431b66f85a4eb42bc6c5b24bd04da"/>
<project name="platform/hardware/akm" path="hardware/akm" revision="6d3be412647b0eab0adff8a2768736cf4eb68039"/>

Просмотреть файл

@ -19,8 +19,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="44bf2e3bc5ddea9db9a8c851bd353cb234aa883c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7e469783859785a8bd4bf02a802f32561c84be7b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>

Просмотреть файл

@ -17,8 +17,8 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="44bf2e3bc5ddea9db9a8c851bd353cb234aa883c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7e469783859785a8bd4bf02a802f32561c84be7b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7ddb07033043613303061416882c9b02ac3d76b6"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>

Просмотреть файл

@ -15,9 +15,9 @@
<project name="platform_build" path="build" remote="b2g" revision="4b4336c73c081b39776d399835ce4853aee5cc1c">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="44bf2e3bc5ddea9db9a8c851bd353cb234aa883c"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7e469783859785a8bd4bf02a802f32561c84be7b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>

Просмотреть файл

@ -19,8 +19,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="44bf2e3bc5ddea9db9a8c851bd353cb234aa883c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7e469783859785a8bd4bf02a802f32561c84be7b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>

Просмотреть файл

@ -15,9 +15,9 @@
<project name="platform_build" path="build" remote="b2g" revision="4b4336c73c081b39776d399835ce4853aee5cc1c">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="44bf2e3bc5ddea9db9a8c851bd353cb234aa883c"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7e469783859785a8bd4bf02a802f32561c84be7b"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>

Просмотреть файл

@ -17,8 +17,8 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="44bf2e3bc5ddea9db9a8c851bd353cb234aa883c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7e469783859785a8bd4bf02a802f32561c84be7b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7ddb07033043613303061416882c9b02ac3d76b6"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>

Просмотреть файл

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "14400ee07e836d74039e2317feebc0a13fcb60c8",
"revision": "a5c22fd2faed558bd633a191e9db710b8080abca",
"repo_path": "/integration/gaia-central"
}

Просмотреть файл

@ -17,8 +17,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="44bf2e3bc5ddea9db9a8c851bd353cb234aa883c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7e469783859785a8bd4bf02a802f32561c84be7b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>

Просмотреть файл

@ -15,8 +15,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="44bf2e3bc5ddea9db9a8c851bd353cb234aa883c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7e469783859785a8bd4bf02a802f32561c84be7b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>

Просмотреть файл

@ -17,8 +17,8 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="44bf2e3bc5ddea9db9a8c851bd353cb234aa883c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="7e469783859785a8bd4bf02a802f32561c84be7b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="7ddb07033043613303061416882c9b02ac3d76b6"/>
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>

Просмотреть файл

@ -17,8 +17,8 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="44bf2e3bc5ddea9db9a8c851bd353cb234aa883c"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="7e469783859785a8bd4bf02a802f32561c84be7b"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>

Просмотреть файл

@ -362,6 +362,10 @@ enum ControlPlayStatus {
PLAYSTATUS_ERROR = 0xFF,
};
enum {
AVRCP_UID_SIZE = 8
};
enum BluetoothAvrcpMediaAttribute {
AVRCP_MEDIA_ATTRIBUTE_TITLE,
AVRCP_MEDIA_ATTRIBUTE_ARTIST,

Просмотреть файл

@ -31,12 +31,9 @@ namespace {
StaticRefPtr<BluetoothA2dpManager> sBluetoothA2dpManager;
bool sInShutdown = false;
static BluetoothA2dpInterface* sBtA2dpInterface;
#if ANDROID_VERSION > 17
static BluetoothAvrcpInterface* sBtAvrcpInterface;
#endif
} // anonymous namespace
#if ANDROID_VERSION > 17
/*
* This function maps attribute id and returns corresponding values
*/
@ -72,7 +69,6 @@ ConvertAttributeString(BluetoothAvrcpMediaAttribute aAttrId,
break;
}
}
#endif
NS_IMETHODIMP
BluetoothA2dpManager::Observe(nsISupports* aSubject,
@ -105,20 +101,25 @@ BluetoothA2dpManager::Reset()
static void
AvStatusToSinkString(BluetoothA2dpConnectionState aState, nsAString& aString)
{
static const nsLiteralString sString[] = {
[A2DP_CONNECTION_STATE_DISCONNECTED] = NS_LITERAL_STRING("disconnected"),
[A2DP_CONNECTION_STATE_CONNECTING] = NS_LITERAL_STRING("connecting"),
[A2DP_CONNECTION_STATE_CONNECTED] = NS_LITERAL_STRING("connected"),
[A2DP_CONNECTION_STATE_DISCONNECTING] = NS_LITERAL_STRING("disconnecting")
};
if (aState >= MOZ_ARRAY_LENGTH(sString)) {
BT_WARNING("Unknown sink state %d", static_cast<int>(aState));
return;
switch (aState) {
case A2DP_CONNECTION_STATE_DISCONNECTED:
aString.AssignLiteral("disconnected");
break;
case A2DP_CONNECTION_STATE_CONNECTING:
aString.AssignLiteral("connecting");
break;
case A2DP_CONNECTION_STATE_CONNECTED:
aString.AssignLiteral("connected");
break;
case A2DP_CONNECTION_STATE_DISCONNECTING:
aString.AssignLiteral("disconnecting");
break;
default:
BT_WARNING("Unknown sink state %d", static_cast<int>(aState));
return;
}
aString = sString[aState];
}
#if ANDROID_VERSION > 17
class InitAvrcpResultHandler MOZ_FINAL : public BluetoothAvrcpResultHandler
{
public:
@ -131,7 +132,15 @@ public:
BT_WARNING("BluetoothAvrcpInterface::Init failed: %d",
(int)aStatus);
if (mRes) {
mRes->OnError(NS_ERROR_FAILURE);
if (aStatus == STATUS_UNSUPPORTED) {
/* Not all versions of Bluedroid support AVRCP. So if the
* initialization fails with STATUS_UNSUPPORTED, we still
* signal success.
*/
mRes->Init();
} else {
mRes->OnError(NS_ERROR_FAILURE);
}
}
}
@ -145,7 +154,6 @@ public:
private:
nsRefPtr<BluetoothProfileResultHandler> mRes;
};
#endif
class InitA2dpResultHandler MOZ_FINAL : public BluetoothA2dpResultHandler
{
@ -165,22 +173,20 @@ public:
void Init() MOZ_OVERRIDE
{
#if ANDROID_VERSION > 17
/* Also init AVRCP if it's available, ... */
BluetoothInterface* btInf = BluetoothInterface::GetInstance();
NS_ENSURE_TRUE_VOID(btInf);
if (NS_WARN_IF(!btInf)) {
mRes->OnError(NS_ERROR_FAILURE);
return;
}
sBtAvrcpInterface = btInf->GetBluetoothAvrcpInterface();
NS_ENSURE_TRUE_VOID(sBtAvrcpInterface);
if (NS_WARN_IF(!sBtAvrcpInterface)) {
mRes->OnError(NS_ERROR_FAILURE);
return;
}
BluetoothA2dpManager* a2dpManager = BluetoothA2dpManager::Get();
sBtAvrcpInterface->Init(a2dpManager, new InitAvrcpResultHandler(mRes));
#else
/* ...or signal success otherwise. */
if (mRes) {
mRes->Init();
}
#endif
}
private:
@ -278,7 +284,6 @@ BluetoothA2dpManager::Get()
return sBluetoothA2dpManager;
}
#if ANDROID_VERSION > 17
class CleanupAvrcpResultHandler MOZ_FINAL : public BluetoothAvrcpResultHandler
{
public:
@ -291,7 +296,15 @@ public:
BT_WARNING("BluetoothAvrcpInterface::Cleanup failed: %d",
(int)aStatus);
if (mRes) {
mRes->OnError(NS_ERROR_FAILURE);
if (aStatus == STATUS_UNSUPPORTED) {
/* Not all versions of Bluedroid support AVRCP. So if the
* cleanup fails with STATUS_UNSUPPORTED, we still signal
* success.
*/
mRes->Deinit();
} else {
mRes->OnError(NS_ERROR_FAILURE);
}
}
}
@ -306,7 +319,6 @@ public:
private:
nsRefPtr<BluetoothProfileResultHandler> mRes;
};
#endif
class CleanupA2dpResultHandler MOZ_FINAL : public BluetoothA2dpResultHandler
{
@ -327,15 +339,8 @@ public:
void Cleanup() MOZ_OVERRIDE
{
sBtA2dpInterface = nullptr;
#if ANDROID_VERSION > 17
/* Cleanup AVRCP if it's available and initialized, ...*/
if (sBtAvrcpInterface) {
sBtAvrcpInterface->Cleanup(new CleanupAvrcpResultHandler(mRes));
} else
#endif
if (mRes) {
/* ...or simply signal success from here. */
mRes->Deinit();
}
}
@ -353,15 +358,8 @@ public:
NS_IMETHOD Run() MOZ_OVERRIDE
{
sBtA2dpInterface = nullptr;
#if ANDROID_VERSION > 17
/* Cleanup AVRCP if it's available and initialized, ...*/
if (sBtAvrcpInterface) {
sBtAvrcpInterface->Cleanup(new CleanupAvrcpResultHandler(mRes));
} else
#endif
if (mRes) {
/* ...or simply signal success from here. */
mRes->Deinit();
}
return NS_OK;
@ -718,7 +716,6 @@ BluetoothA2dpManager::UpdateMetaData(const nsAString& aTitle,
{
MOZ_ASSERT(NS_IsMainThread());
#if ANDROID_VERSION > 17
NS_ENSURE_TRUE_VOID(sBtAvrcpInterface);
// Send track changed and position changed if track num is not the same.
@ -728,8 +725,8 @@ BluetoothA2dpManager::UpdateMetaData(const nsAString& aTitle,
BluetoothAvrcpNotificationParam param;
// convert to network big endian format
// since track stores as uint8[8]
// 56 = 8 * (BTRC_UID_SIZE -1)
for (int i = 0; i < BTRC_UID_SIZE; ++i) {
// 56 = 8 * (AVRCP_UID_SIZE -1)
for (int i = 0; i < AVRCP_UID_SIZE; ++i) {
param.mTrack[i] = (aMediaNumber >> (56 - 8 * i));
}
mTrackChangedNotifyType = AVRCP_NTF_CHANGED;
@ -752,7 +749,6 @@ BluetoothA2dpManager::UpdateMetaData(const nsAString& aTitle,
mMediaNumber = aMediaNumber;
mTotalMediaCount = aTotalMediaCount;
mDuration = aDuration;
#endif
}
/*
@ -766,7 +762,6 @@ BluetoothA2dpManager::UpdatePlayStatus(uint32_t aDuration,
{
MOZ_ASSERT(NS_IsMainThread());
#if ANDROID_VERSION > 17
NS_ENSURE_TRUE_VOID(sBtAvrcpInterface);
// always update playstatus first
sBtAvrcpInterface->GetPlayStatusRsp(aPlayStatus, aDuration,
@ -795,7 +790,6 @@ BluetoothA2dpManager::UpdatePlayStatus(uint32_t aDuration,
mDuration = aDuration;
mPosition = aPosition;
mPlayStatus = aPlayStatus;
#endif
}
/*
@ -811,7 +805,6 @@ BluetoothA2dpManager::UpdateRegisterNotification(BluetoothAvrcpEvent aEvent,
{
MOZ_ASSERT(NS_IsMainThread());
#if ANDROID_VERSION > 17
NS_ENSURE_TRUE_VOID(sBtAvrcpInterface);
BluetoothAvrcpNotificationParam param;
@ -832,7 +825,7 @@ BluetoothA2dpManager::UpdateRegisterNotification(BluetoothAvrcpEvent aEvent,
mTrackChangedNotifyType = AVRCP_NTF_INTERIM;
// needs to convert to network big endian format since track stores
// as uint8[8]. 56 = 8 * (BTRC_UID_SIZE -1).
for (int index = 0; index < BTRC_UID_SIZE; ++index) {
for (int index = 0; index < AVRCP_UID_SIZE; ++index) {
// We cannot easily check if a track is selected, so whenever A2DP is
// streaming, we assume a track is selected.
if (mSinkState == BluetoothA2dpManager::SinkState::SINK_PLAYING) {
@ -858,7 +851,6 @@ BluetoothA2dpManager::UpdateRegisterNotification(BluetoothAvrcpEvent aEvent,
sBtAvrcpInterface->RegisterNotificationRsp(aEvent, AVRCP_NTF_INTERIM,
param, nullptr);
#endif
}
void
@ -1052,10 +1044,8 @@ BluetoothA2dpManager::GetElementAttrNotification(
attrs[i].mValue);
}
#if ANDROID_VERSION >= 18
MOZ_ASSERT(sBtAvrcpInterface);
sBtAvrcpInterface->GetElementAttrRsp(aNumAttrs, attrs, nullptr);
#endif // ANDROID_VERSION >= 18
}
void
@ -1069,9 +1059,7 @@ BluetoothA2dpManager::RegisterNotificationNotification(
return;
}
#if ANDROID_VERSION >= 18
a2dp->UpdateRegisterNotification(aEvent, aParam);
#endif // ANDROID_VERSION >= 18
}
/* This method is used to get CT features from the Feature Bit Mask. If

Просмотреть файл

@ -4,11 +4,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "BluetoothInterface.h"
#include <errno.h>
#include <unistd.h>
#include <sys/socket.h>
#include "base/message_loop.h"
#include "BluetoothInterface.h"
#include "nsAutoPtr.h"
#include "nsThreadUtils.h"
#include "nsXULAppAPI.h"
@ -2986,6 +2986,7 @@ struct interface_traits<BluetoothAvrcpInterface>
return BT_PROFILE_AV_RC_ID;
}
};
#endif
typedef
BluetoothInterfaceRunnable0<BluetoothAvrcpResultHandler, void>
@ -3018,7 +3019,6 @@ DispatchBluetoothAvrcpResult(
}
return rv;
}
#endif
// Notification handling
//
@ -3026,7 +3026,6 @@ DispatchBluetoothAvrcpResult(
BluetoothAvrcpNotificationHandler::~BluetoothAvrcpNotificationHandler()
{ }
#if ANDROID_VERSION >= 18
static BluetoothAvrcpNotificationHandler* sAvrcpNotificationHandler;
struct BluetoothAvrcpCallback
@ -3092,7 +3091,6 @@ struct BluetoothAvrcpCallback
BluetoothAvrcpEvent, uint32_t>
RegisterNotificationNotification;
#if ANDROID_VERSION >= 19
typedef BluetoothNotificationRunnable2<AvrcpNotificationHandlerWrapper,
void,
nsString, unsigned long,
@ -3108,10 +3106,10 @@ struct BluetoothAvrcpCallback
void,
int, int>
PassthroughCmdNotification;
#endif // ANDROID_VERSION >= 19
// Bluedroid AVRCP callbacks
#if ANDROID_VERSION >= 18
static void
GetPlayStatus()
{
@ -3181,6 +3179,7 @@ struct BluetoothAvrcpCallback
&BluetoothAvrcpNotificationHandler::RegisterNotificationNotification,
aEvent, aParam);
}
#endif // ANDROID_VERSION >= 18
#if ANDROID_VERSION >= 19
static void
@ -3213,10 +3212,17 @@ struct BluetoothAvrcpCallback
//
BluetoothAvrcpInterface::BluetoothAvrcpInterface(
const btrc_interface_t* aInterface)
#if ANDROID_VERSION >= 18
const btrc_interface_t* aInterface
#endif
)
#if ANDROID_VERSION >= 18
: mInterface(aInterface)
#endif
{
#if ANDROID_VERSION >= 18
MOZ_ASSERT(mInterface);
#endif
}
BluetoothAvrcpInterface::~BluetoothAvrcpInterface()
@ -3227,6 +3233,7 @@ BluetoothAvrcpInterface::Init(
BluetoothAvrcpNotificationHandler* aNotificationHandler,
BluetoothAvrcpResultHandler* aRes)
{
#if ANDROID_VERSION >= 18
static btrc_callbacks_t sCallbacks = {
sizeof(sCallbacks),
#if ANDROID_VERSION >= 19
@ -3247,10 +3254,15 @@ BluetoothAvrcpInterface::Init(
BluetoothAvrcpCallback::PassthroughCmd
#endif
};
#endif // ANDROID_VERSION >= 18
sAvrcpNotificationHandler = aNotificationHandler;
#if ANDROID_VERSION >= 18
bt_status_t status = mInterface->init(&sCallbacks);
#else
bt_status_t status = BT_STATUS_UNSUPPORTED;
#endif
if (aRes) {
DispatchBluetoothAvrcpResult(aRes, &BluetoothAvrcpResultHandler::Init,
@ -3261,7 +3273,9 @@ BluetoothAvrcpInterface::Init(
void
BluetoothAvrcpInterface::Cleanup(BluetoothAvrcpResultHandler* aRes)
{
#if ANDROID_VERSION >= 18
mInterface->cleanup();
#endif
if (aRes) {
DispatchBluetoothAvrcpResult(aRes, &BluetoothAvrcpResultHandler::Cleanup,
@ -3275,6 +3289,8 @@ BluetoothAvrcpInterface::GetPlayStatusRsp(ControlPlayStatus aPlayStatus,
BluetoothAvrcpResultHandler* aRes)
{
bt_status_t status;
#if ANDROID_VERSION >= 18
btrc_play_status_t playStatus = BTRC_PLAYSTATE_STOPPED;
if (!(NS_FAILED(Convert(aPlayStatus, playStatus)))) {
@ -3282,6 +3298,9 @@ BluetoothAvrcpInterface::GetPlayStatusRsp(ControlPlayStatus aPlayStatus,
} else {
status = BT_STATUS_PARM_INVALID;
}
#else
status = BT_STATUS_UNSUPPORTED;
#endif
if (aRes) {
DispatchBluetoothAvrcpResult(
@ -3296,6 +3315,8 @@ BluetoothAvrcpInterface::ListPlayerAppAttrRsp(
BluetoothAvrcpResultHandler* aRes)
{
bt_status_t status;
#if ANDROID_VERSION >= 18
ConvertArray<BluetoothAvrcpPlayerAttribute> pAttrsArray(aPAttrs, aNumAttr);
nsAutoArrayPtr<btrc_player_attr_t> pAttrs;
@ -3304,6 +3325,9 @@ BluetoothAvrcpInterface::ListPlayerAppAttrRsp(
} else {
status = BT_STATUS_PARM_INVALID;
}
#else
status = BT_STATUS_UNSUPPORTED;
#endif
if (aRes) {
DispatchBluetoothAvrcpResult(
@ -3316,7 +3340,11 @@ void
BluetoothAvrcpInterface::ListPlayerAppValueRsp(
int aNumVal, uint8_t* aPVals, BluetoothAvrcpResultHandler* aRes)
{
#if ANDROID_VERSION >= 18
bt_status_t status = mInterface->list_player_app_value_rsp(aNumVal, aPVals);
#else
bt_status_t status = BT_STATUS_UNSUPPORTED;
#endif
if (aRes) {
DispatchBluetoothAvrcpResult(
@ -3331,6 +3359,8 @@ BluetoothAvrcpInterface::GetPlayerAppValueRsp(
BluetoothAvrcpResultHandler* aRes)
{
bt_status_t status;
#if ANDROID_VERSION >= 18
btrc_player_settings_t pVals;
/* FIXME: you need to implement the missing conversion functions */
@ -3341,6 +3371,9 @@ BluetoothAvrcpInterface::GetPlayerAppValueRsp(
} else {
status = BT_STATUS_PARM_INVALID;
}
#else
status = BT_STATUS_UNSUPPORTED;
#endif
if (aRes) {
DispatchBluetoothAvrcpResult(
@ -3355,6 +3388,8 @@ BluetoothAvrcpInterface::GetPlayerAppAttrTextRsp(
BluetoothAvrcpResultHandler* aRes)
{
bt_status_t status;
#if ANDROID_VERSION >= 18
btrc_player_setting_text_t* aPAttrs;
/* FIXME: you need to implement the missing conversion functions */
@ -3365,6 +3400,9 @@ BluetoothAvrcpInterface::GetPlayerAppAttrTextRsp(
} else {
status = BT_STATUS_PARM_INVALID;
}
#else
status = BT_STATUS_UNSUPPORTED;
#endif
if (aRes) {
DispatchBluetoothAvrcpResult(
@ -3379,6 +3417,8 @@ BluetoothAvrcpInterface::GetPlayerAppValueTextRsp(
BluetoothAvrcpResultHandler* aRes)
{
bt_status_t status;
#if ANDROID_VERSION >= 18
btrc_player_setting_text_t* pVals;
/* FIXME: you need to implement the missing conversion functions */
@ -3389,6 +3429,9 @@ BluetoothAvrcpInterface::GetPlayerAppValueTextRsp(
} else {
status = BT_STATUS_PARM_INVALID;
}
#else
status = BT_STATUS_UNSUPPORTED;
#endif
if (aRes) {
DispatchBluetoothAvrcpResult(
@ -3403,6 +3446,8 @@ BluetoothAvrcpInterface::GetElementAttrRsp(
BluetoothAvrcpResultHandler* aRes)
{
bt_status_t status;
#if ANDROID_VERSION >= 18
ConvertArray<BluetoothAvrcpElementAttribute> pAttrsArray(aAttrs, aNumAttr);
nsAutoArrayPtr<btrc_element_attr_val_t> pAttrs;
@ -3411,6 +3456,9 @@ BluetoothAvrcpInterface::GetElementAttrRsp(
} else {
status = BT_STATUS_PARM_INVALID;
}
#else
status = BT_STATUS_UNSUPPORTED;
#endif
if (aRes) {
DispatchBluetoothAvrcpResult(
@ -3424,6 +3472,8 @@ BluetoothAvrcpInterface::SetPlayerAppValueRsp(
BluetoothAvrcpStatus aRspStatus, BluetoothAvrcpResultHandler* aRes)
{
bt_status_t status;
#if ANDROID_VERSION >= 18
btrc_status_t rspStatus = BTRC_STS_BAD_CMD; // silences compiler warning
if (NS_SUCCEEDED(Convert(aRspStatus, rspStatus))) {
@ -3431,6 +3481,9 @@ BluetoothAvrcpInterface::SetPlayerAppValueRsp(
} else {
status = BT_STATUS_PARM_INVALID;
}
#else
status = BT_STATUS_UNSUPPORTED;
#endif
if (aRes) {
DispatchBluetoothAvrcpResult(
@ -3445,8 +3498,10 @@ BluetoothAvrcpInterface::RegisterNotificationRsp(
const BluetoothAvrcpNotificationParam& aParam,
BluetoothAvrcpResultHandler* aRes)
{
nsresult rv;
bt_status_t status;
#if ANDROID_VERSION >= 18
nsresult rv;
btrc_event_id_t event = { };
btrc_notification_type_t type = BTRC_NOTIFICATION_TYPE_INTERIM;
btrc_register_notification_t param;
@ -3489,6 +3544,9 @@ BluetoothAvrcpInterface::RegisterNotificationRsp(
} else {
status = BT_STATUS_PARM_INVALID;
}
#else
status = BT_STATUS_UNSUPPORTED;
#endif
if (aRes) {
DispatchBluetoothAvrcpResult(
@ -3513,7 +3571,6 @@ BluetoothAvrcpInterface::SetVolume(uint8_t aVolume,
ConvertDefault(status, STATUS_FAIL));
}
}
#endif
//
// Bluetooth Core Interface
@ -4292,14 +4349,8 @@ BluetoothInterface::LeTestMode(uint16_t aOpcode, uint8_t* aBuf, uint8_t aLen,
template <class T>
T*
BluetoothInterface::GetProfileInterface()
BluetoothInterface::CreateProfileInterface()
{
static T* sBluetoothProfileInterface;
if (sBluetoothProfileInterface) {
return sBluetoothProfileInterface;
}
typename interface_traits<T>::const_interface_type* interface =
reinterpret_cast<typename interface_traits<T>::const_interface_type*>(
mInterface->get_profile_interface(interface_traits<T>::profile_id()));
@ -4315,7 +4366,36 @@ BluetoothInterface::GetProfileInterface()
return nullptr;
}
sBluetoothProfileInterface = new T(interface);
return new T(interface);
}
#if ANDROID_VERSION < 18
/*
* Bluedroid versions that don't support AVRCP will call this function
* to create an AVRCP interface. All interface methods will fail with
* the error constant STATUS_UNSUPPORTED.
*/
template <>
BluetoothAvrcpInterface*
BluetoothInterface::CreateProfileInterface<BluetoothAvrcpInterface>()
{
BT_WARNING("Bluetooth profile 'avrcp' is not supported");
return new BluetoothAvrcpInterface();
}
#endif
template <class T>
T*
BluetoothInterface::GetProfileInterface()
{
static T* sBluetoothProfileInterface;
if (sBluetoothProfileInterface) {
return sBluetoothProfileInterface;
}
sBluetoothProfileInterface = CreateProfileInterface<T>();
return sBluetoothProfileInterface;
}
@ -4341,11 +4421,7 @@ BluetoothInterface::GetBluetoothA2dpInterface()
BluetoothAvrcpInterface*
BluetoothInterface::GetBluetoothAvrcpInterface()
{
#if ANDROID_VERSION >= 18
return GetProfileInterface<BluetoothAvrcpInterface>();
#else
return nullptr;
#endif
}
END_BLUETOOTH_NAMESPACE

Просмотреть файл

@ -427,7 +427,6 @@ public:
class BluetoothAvrcpInterface
{
#if ANDROID_VERSION >= 18
public:
friend class BluetoothInterface;
@ -473,10 +472,15 @@ public:
void SetVolume(uint8_t aVolume, BluetoothAvrcpResultHandler* aRes);
protected:
BluetoothAvrcpInterface(const btrc_interface_t* aInterface);
BluetoothAvrcpInterface(
#if ANDROID_VERSION >= 18
const btrc_interface_t* aInterface
#endif
);
~BluetoothAvrcpInterface();
private:
#if ANDROID_VERSION >= 18
const btrc_interface_t* mInterface;
#endif
};
@ -657,6 +661,9 @@ protected:
~BluetoothInterface();
private:
template <class T>
T* CreateProfileInterface();
template <class T>
T* GetProfileInterface();

Просмотреть файл

@ -201,8 +201,8 @@ BluetoothHfpManager::Cleanup()
mReceiveVgsFlag = false;
mDialingRequestProcessed = true;
mConnectionState = BTHF_CONNECTION_STATE_DISCONNECTED;
mPrevConnectionState = BTHF_CONNECTION_STATE_DISCONNECTED;
mConnectionState = HFP_CONNECTION_STATE_DISCONNECTED;
mPrevConnectionState = HFP_CONNECTION_STATE_DISCONNECTED;
mBattChg = 5;
mService = HFP_NETWORK_STATE_NOT_AVAILABLE;
mRoam = HFP_SERVICE_TYPE_HOME;
@ -217,7 +217,7 @@ BluetoothHfpManager::Reset()
// Phone & Device CIND
ResetCallArray();
// Clear Sco state
mAudioState = BTHF_AUDIO_STATE_DISCONNECTED;
mAudioState = HFP_AUDIO_STATE_DISCONNECTED;
Cleanup();
}
@ -522,9 +522,9 @@ BluetoothHfpManager::NotifyConnectionStateChanged(const nsAString& aType)
mListener->EnumerateCalls();
OnConnect(EmptyString());
} else if (mConnectionState == BTHF_CONNECTION_STATE_DISCONNECTED) {
} else if (mConnectionState == HFP_CONNECTION_STATE_DISCONNECTED) {
mDeviceAddress.AssignLiteral(BLUETOOTH_ADDRESS_NONE);
if (mPrevConnectionState == BTHF_CONNECTION_STATE_DISCONNECTED) {
if (mPrevConnectionState == HFP_CONNECTION_STATE_DISCONNECTED) {
// Bug 979160: This implies the outgoing connection failure.
// When the outgoing hfp connection fails, state changes to disconnected
// state. Since bluedroid would not report connecting state, but only
@ -1114,13 +1114,13 @@ BluetoothHfpManager::DisconnectSco()
bool
BluetoothHfpManager::IsScoConnected()
{
return (mAudioState == BTHF_AUDIO_STATE_CONNECTED);
return (mAudioState == HFP_AUDIO_STATE_CONNECTED);
}
bool
BluetoothHfpManager::IsConnected()
{
return (mConnectionState == BTHF_CONNECTION_STATE_SLC_CONNECTED);
return (mConnectionState == HFP_CONNECTION_STATE_SLC_CONNECTED);
}
void
@ -1433,13 +1433,18 @@ void BluetoothHfpManager::DialCallNotification(const nsAString& aNumber)
void
BluetoothHfpManager::CnumNotification()
{
static const uint8_t sAddressType[] {
[HFP_CALL_ADDRESS_TYPE_UNKNOWN] = 0x81,
[HFP_CALL_ADDRESS_TYPE_INTERNATIONAL] = 0x91 // for completeness
};
MOZ_ASSERT(NS_IsMainThread());
if (!mMsisdn.IsEmpty()) {
nsAutoCString message("+CNUM: ,\"");
message.Append(NS_ConvertUTF16toUTF8(mMsisdn).get());
message.AppendLiteral("\",");
message.AppendInt(BTHF_CALL_ADDRTYPE_UNKNOWN);
message.AppendInt(sAddressType[HFP_CALL_ADDRESS_TYPE_UNKNOWN]);
message.AppendLiteral(",,4");
SendLine(message.get());

Просмотреть файл

@ -170,9 +170,9 @@ private:
void SendLine(const char* aMessage);
void SendResponse(BluetoothHandsfreeAtResponse aResponseCode);
int mConnectionState;
int mPrevConnectionState;
int mAudioState;
BluetoothHandsfreeConnectionState mConnectionState;
BluetoothHandsfreeConnectionState mPrevConnectionState;
BluetoothHandsfreeAudioState mAudioState;
// Device CIND
int mBattChg;
BluetoothHandsfreeNetworkState mService;

Просмотреть файл

@ -194,6 +194,101 @@ enum BluetoothStatus {
STATUS_RMT_DEV_DOWN
};
enum BluetoothBondState {
BOND_STATE_NONE,
BOND_STATE_BONDING,
BOND_STATE_BONDED
};
enum BluetoothDeviceType {
DEVICE_TYPE_BREDR,
DEVICE_TYPE_BLE,
DEVICE_TYPE_DUAL
};
enum BluetoothPropertyType {
PROPERTY_BDNAME,
PROPERTY_BDADDR,
PROPERTY_UUIDS,
PROPERTY_CLASS_OF_DEVICE,
PROPERTY_TYPE_OF_DEVICE,
PROPERTY_SERVICE_RECORD,
PROPERTY_ADAPTER_SCAN_MODE,
PROPERTY_ADAPTER_BONDED_DEVICES,
PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
PROPERTY_REMOTE_FRIENDLY_NAME,
PROPERTY_REMOTE_RSSI,
PROPERTY_REMOTE_VERSION_INFO,
PROPERTY_REMOTE_DEVICE_TIMESTAMP
};
enum BluetoothScanMode {
SCAN_MODE_NONE,
SCAN_MODE_CONNECTABLE,
SCAN_MODE_CONNECTABLE_DISCOVERABLE
};
enum BluetoothSspVariant {
SSP_VARIANT_PASSKEY_CONFIRMATION,
SSP_VARIANT_PASSKEY_ENTRY,
SSP_VARIANT_CONSENT,
SSP_VARIANT_PASSKEY_NOTIFICATION
};
struct BluetoothUuid {
uint8_t mUuid[16];
};
struct BluetoothServiceRecord {
BluetoothUuid mUuid;
uint16_t mChannel;
char mName[256];
};
struct BluetoothRemoteInfo {
int mVerMajor;
int mVerMinor;
int mManufacturer;
};
struct BluetoothProperty {
/* Type */
BluetoothPropertyType mType;
/* Value
*/
/* PROPERTY_BDNAME
PROPERTY_BDADDR
PROPERTY_REMOTE_FRIENDLY_NAME */
nsString mString;
/* PROPERTY_UUIDS */
nsTArray<BluetoothUuid> mUuidArray;
/* PROPERTY_ADAPTER_BONDED_DEVICES */
nsTArray<nsString> mStringArray;
/* PROPERTY_CLASS_OF_DEVICE
PROPERTY_ADAPTER_DISCOVERY_TIMEOUT */
uint32_t mUint32;
/* PROPERTY_RSSI_VALUE */
int32_t mInt32;
/* PROPERTY_DEVICE_TYPE */
BluetoothDeviceType mDeviceType;
/* PROPERTY_SERVICE_RECORD */
BluetoothServiceRecord mServiceRecord;
/* PROPERTY_SCAN_MODE */
BluetoothScanMode mScanMode;
/* PROPERTY_REMOTE_VERSION_INFO */
BluetoothRemoteInfo mRemoteInfo;
};
enum BluetoothSocketType {
RFCOMM = 1,
SCO = 2,

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -326,6 +326,50 @@ private:
// Bluetooth Core Interface
//
class BluetoothNotificationHandler
{
public:
virtual ~BluetoothNotificationHandler();
virtual void AdapterStateChangedNotification(bool aState) { }
virtual void AdapterPropertiesNotification(
BluetoothStatus aStatus, int aNumProperties,
const BluetoothProperty* aProperties) { }
virtual void RemoteDevicePropertiesNotification(
BluetoothStatus aStatus, const nsAString& aBdAddr,
int aNumProperties, const BluetoothProperty* aProperties) { }
virtual void DeviceFoundNotification(
int aNumProperties, const BluetoothProperty* aProperties) { }
virtual void DiscoveryStateChangedNotification(bool aState) { }
virtual void PinRequestNotification(const nsAString& aRemoteBdAddr,
const nsAString& aBdName, uint32_t aCod) { }
virtual void SspRequestNotification(const nsAString& 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 DutModeRecvNotification(uint16_t aOpcode,
const uint8_t* aBuf, uint8_t aLen) { }
virtual void LeTestModeNotification(BluetoothStatus aStatus,
uint16_t aNumPackets) { }
protected:
BluetoothNotificationHandler()
{ }
};
class BluetoothResultHandler
{
public:
@ -375,7 +419,8 @@ class BluetoothInterface
public:
static BluetoothInterface* GetInstance();
void Init(bt_callbacks_t* aCallbacks, BluetoothResultHandler* aRes);
void Init(BluetoothNotificationHandler* aNotificationHandler,
BluetoothResultHandler* aRes);
void Cleanup(BluetoothResultHandler* aRes);
void Enable(BluetoothResultHandler* aRes);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -10,11 +10,13 @@
#include <hardware/bluetooth.h>
#include "BluetoothCommon.h"
#include "BluetoothInterface.h"
#include "BluetoothService.h"
BEGIN_BLUETOOTH_NAMESPACE
class BluetoothServiceBluedroid : public BluetoothService
, public BluetoothNotificationHandler
{
public:
static const bt_interface_t* GetBluetoothInterface();
@ -155,6 +157,46 @@ public:
virtual nsresult
SendInputMessage(const nsAString& aDeviceAddresses,
const nsAString& aMessage) MOZ_OVERRIDE;
//
// Bluetooth notifications
//
virtual void AdapterStateChangedNotification(bool aState) MOZ_OVERRIDE;
virtual void AdapterPropertiesNotification(
BluetoothStatus aStatus, int aNumProperties,
const BluetoothProperty* aProperties) MOZ_OVERRIDE;
virtual void RemoteDevicePropertiesNotification(
BluetoothStatus aStatus, const nsAString& aBdAddr,
int aNumProperties, const BluetoothProperty* aProperties) MOZ_OVERRIDE;
virtual void DeviceFoundNotification(
int aNumProperties, const BluetoothProperty* aProperties) MOZ_OVERRIDE;
virtual void DiscoveryStateChangedNotification(bool aState) MOZ_OVERRIDE;
virtual void PinRequestNotification(const nsAString& aRemoteBdAddr,
const nsAString& aBdName,
uint32_t aCod) MOZ_OVERRIDE;
virtual void SspRequestNotification(const nsAString& aRemoteBdAddr,
const nsAString& aBdName,
uint32_t aCod,
BluetoothSspVariant aPairingVariant,
uint32_t aPasskey) MOZ_OVERRIDE;
virtual void BondStateChangedNotification(
BluetoothStatus aStatus, const nsAString& aRemoteBdAddr,
BluetoothBondState aState) MOZ_OVERRIDE;
virtual void AclStateChangedNotification(BluetoothStatus aStatus,
const nsAString& aRemoteBdAddr,
bool aState) MOZ_OVERRIDE;
virtual void DutModeRecvNotification(uint16_t aOpcode,
const uint8_t* aBuf,
uint8_t aLen) MOZ_OVERRIDE;
virtual void LeTestModeNotification(BluetoothStatus aStatus,
uint16_t aNumPackets) MOZ_OVERRIDE;
};
END_BLUETOOTH_NAMESPACE

Просмотреть файл

@ -23,19 +23,6 @@
BEGIN_BLUETOOTH_NAMESPACE
void
StringToBdAddressType(const nsAString& aBdAddress,
bt_bdaddr_t *aRetBdAddressType)
{
NS_ConvertUTF16toUTF8 bdAddressUTF8(aBdAddress);
const char* str = bdAddressUTF8.get();
for (int i = 0; i < 6; i++) {
aRetBdAddressType->address[i] = (uint8_t) strtoul(str, (char **)&str, 16);
str++;
}
}
void
BdAddressTypeToString(bt_bdaddr_t* aBdAddressType, nsAString& aRetBdAddress)
{
@ -50,18 +37,18 @@ BdAddressTypeToString(bt_bdaddr_t* aBdAddressType, nsAString& aRetBdAddress)
}
void
UuidToString(bt_uuid_t* aUuid, nsAString& aString) {
UuidToString(const BluetoothUuid& aUuid, nsAString& aString)
{
char uuidStr[37];
uint32_t uuid0, uuid4;
uint16_t uuid1, uuid2, uuid3, uuid5;
memcpy(&uuid0, &(aUuid->uu[0]), sizeof(uint32_t));
memcpy(&uuid1, &(aUuid->uu[4]), sizeof(uint16_t));
memcpy(&uuid2, &(aUuid->uu[6]), sizeof(uint16_t));
memcpy(&uuid3, &(aUuid->uu[8]), sizeof(uint16_t));
memcpy(&uuid4, &(aUuid->uu[10]), sizeof(uint32_t));
memcpy(&uuid5, &(aUuid->uu[14]), sizeof(uint16_t));
memcpy(&uuid0, &aUuid.mUuid[0], sizeof(uint32_t));
memcpy(&uuid1, &aUuid.mUuid[4], sizeof(uint16_t));
memcpy(&uuid2, &aUuid.mUuid[6], sizeof(uint16_t));
memcpy(&uuid3, &aUuid.mUuid[8], sizeof(uint16_t));
memcpy(&uuid4, &aUuid.mUuid[10], sizeof(uint32_t));
memcpy(&uuid5, &aUuid.mUuid[14], sizeof(uint16_t));
sprintf(uuidStr, "%.8x-%.4x-%.4x-%.4x-%.8x%.4x",
ntohl(uuid0), ntohs(uuid1),

Просмотреть файл

@ -27,7 +27,7 @@ BdAddressTypeToString(bt_bdaddr_t* aBdAddressType,
nsAString& aRetBdAddress);
void
UuidToString(bt_uuid_t* aUuid, nsAString& aString);
UuidToString(const BluetoothUuid& aUuid, nsAString& aString);
bool
SetJsObject(JSContext* aContext,