Merge b2ginbound to central, a=merge

--HG--
extra : commitid : H8QgxzNGpnm
This commit is contained in:
Wes Kocher 2015-11-17 13:21:48 -08:00
Родитель f3c1ddea35 f1503e1eb3
Коммит 3b60bb0151
17 изменённых файлов: 215 добавлений и 110 удалений

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9473dbcbebf4e758a3b73200968efc69071b4312"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="28d63cf3bdc4417f7ad8cab2230f096bf9f6d3b5"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9473dbcbebf4e758a3b73200968efc69071b4312"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="28d63cf3bdc4417f7ad8cab2230f096bf9f6d3b5"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>

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

@ -19,7 +19,7 @@
<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="9473dbcbebf4e758a3b73200968efc69071b4312"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="28d63cf3bdc4417f7ad8cab2230f096bf9f6d3b5"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cb4604d5a578efd027277059ce3e0f6e3af59bd1"/>

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

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9473dbcbebf4e758a3b73200968efc69071b4312"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="28d63cf3bdc4417f7ad8cab2230f096bf9f6d3b5"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9473dbcbebf4e758a3b73200968efc69071b4312"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="28d63cf3bdc4417f7ad8cab2230f096bf9f6d3b5"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9473dbcbebf4e758a3b73200968efc69071b4312"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="28d63cf3bdc4417f7ad8cab2230f096bf9f6d3b5"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

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

@ -19,7 +19,7 @@
<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="9473dbcbebf4e758a3b73200968efc69071b4312"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="28d63cf3bdc4417f7ad8cab2230f096bf9f6d3b5"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cb4604d5a578efd027277059ce3e0f6e3af59bd1"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9473dbcbebf4e758a3b73200968efc69071b4312"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="28d63cf3bdc4417f7ad8cab2230f096bf9f6d3b5"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>

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

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "9473dbcbebf4e758a3b73200968efc69071b4312",
"git_revision": "28d63cf3bdc4417f7ad8cab2230f096bf9f6d3b5",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "0513f90869b616c88cfaa5fe52ff8ba22a472062",
"revision": "f1fbe09c3fd9e47b2ca2709b471b2c9cfd7a733f",
"repo_path": "integration/gaia-central"
}

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9473dbcbebf4e758a3b73200968efc69071b4312"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="28d63cf3bdc4417f7ad8cab2230f096bf9f6d3b5"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
@ -128,7 +128,7 @@
<project name="platform_system_core" path="system/core" remote="b2g" revision="8586f55fe4b015911b48e731b69c592ad82a0807"/>
<default remote="caf" revision="refs/tags/android-4.4.2_r1" sync-j="4"/>
<!-- Nexus 4 specific things -->
<project name="device-mako" path="device/lge/mako" remote="b2g" revision="aea6908cd694b4ef9e7ad64a930d52eab6ab1e17"/>
<project name="device-mako" path="device/lge/mako" remote="b2g" revision="d7b8c7b6be661270437704760a8cfc27ddbf9a9d"/>
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="72ffdf71c68a96309212eb13d63560d66db14c9e"/>
<project name="device_lge_mako-kernel" path="device/lge/mako-kernel" remote="b2g" revision="a49f2c34bc50a07b02f010a53d80477542209a81"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="f37bd545063039e30a92f2550ae78c0e6e4e2d08"/>

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

@ -18,7 +18,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9473dbcbebf4e758a3b73200968efc69071b4312"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="28d63cf3bdc4417f7ad8cab2230f096bf9f6d3b5"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="ac7e9ae8a24ab4a3f3da801ca53f95f39a32b89f"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="94bbf7890326d37f03fd2a6822b6618b08bec8e2"/>

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

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9473dbcbebf4e758a3b73200968efc69071b4312"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="28d63cf3bdc4417f7ad8cab2230f096bf9f6d3b5"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9a58f2e395da17c252f61f28900b5b09aeb813bd"/>
@ -142,7 +142,7 @@
<default remote="caf" revision="refs/tags/android-5.1.0_r1" sync-j="4"/>
<!-- Nexus 5 specific things -->
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="fe7df1bc8dd0fd71571505d7be1c31a4ad1e40fb"/>
<project name="device-hammerhead" path="device/lge/hammerhead" remote="b2g" revision="22ab4b0b7fa7ed7b10c1b0576462008c53127f10"/>
<project name="device-hammerhead" path="device/lge/hammerhead" remote="b2g" revision="1401762a4eea0b92141e8ff3100f93e9d6556fc8"/>
<project name="device_lge_hammerhead-kernel" path="device/lge/hammerhead-kernel" remote="b2g" revision="8b3ffcfdd3d3852eca5488628f8bb2a08acbffa7"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="5d0ae53d9588c3d70c005aec9be94af9a534de16"/>
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="c15b6e266136cd0cdd9b94d0bbed1962d9dd6672"/>

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

@ -154,13 +154,10 @@ public:
BluetoothService* bs = BluetoothService::Get();
NS_ENSURE_TRUE_VOID(bs);
nsAutoString appUuidStr;
UuidToString(mAppUuid, appUuidStr);
// Notify application to clear the cache values of
// service/characteristic/descriptor.
bs->DistributeSignal(NS_LITERAL_STRING("DiscoverCompleted"),
appUuidStr,
mAppUuid,
BluetoothValue(aSuccess));
// Resolve/Reject the Promise.
@ -659,13 +656,10 @@ public:
BluetoothService* bs = BluetoothService::Get();
NS_ENSURE_TRUE_VOID(bs);
nsAutoString appUuidStr;
UuidToString(mClient->mAppUuid, appUuidStr);
// Notify BluetoothGatt for client disconnected
bs->DistributeSignal(
NS_LITERAL_STRING(GATT_CONNECTION_STATE_CHANGED_ID),
appUuidStr,
mClient->mAppUuid,
BluetoothValue(false)); // Disconnected
// Reject the connect request
@ -698,12 +692,9 @@ public:
BluetoothService* bs = BluetoothService::Get();
NS_ENSURE_TRUE_VOID(bs);
nsAutoString appUuidStr;
UuidToString(mClient->mAppUuid, appUuidStr);
// Notify BluetoothGatt to clear the clientIf
bs->DistributeSignal(NS_LITERAL_STRING("ClientUnregistered"),
appUuidStr);
mClient->mAppUuid);
// Resolve the unregister request
DispatchReplySuccess(mClient->mUnregisterClientRunnable);
@ -906,13 +897,10 @@ public:
BluetoothService* bs = BluetoothService::Get();
NS_ENSURE_TRUE_VOID(bs);
nsAutoString appUuidStr;
UuidToString(mClient->mAppUuid, appUuidStr);
// Notify BluetoothGatt for client disconnected
bs->DistributeSignal(
NS_LITERAL_STRING(GATT_CONNECTION_STATE_CHANGED_ID),
appUuidStr,
mClient->mAppUuid,
BluetoothValue(false)); // Disconnected
// Reject the connect request
@ -976,13 +964,10 @@ public:
BluetoothService* bs = BluetoothService::Get();
NS_ENSURE_TRUE_VOID(bs);
nsAutoString appUuidStr;
UuidToString(mClient->mAppUuid, appUuidStr);
// Notify BluetoothGatt that the client remains connected
bs->DistributeSignal(
NS_LITERAL_STRING(GATT_CONNECTION_STATE_CHANGED_ID),
appUuidStr,
mClient->mAppUuid,
BluetoothValue(true)); // Connected
// Reject the disconnect request
@ -1836,12 +1821,9 @@ public:
BluetoothService* bs = BluetoothService::Get();
NS_ENSURE_TRUE_VOID(bs);
nsAutoString appUuidStr;
UuidToString(mServer->mAppUuid, appUuidStr);
// Notify BluetoothGattServer to clear the serverIf
bs->DistributeSignal(NS_LITERAL_STRING("ServerUnregistered"),
appUuidStr);
mServer->mAppUuid);
// Resolve the unregister request
if (mServer->mUnregisterServerRunnable) {
@ -2543,17 +2525,17 @@ BluetoothGattManager::RegisterClientNotification(BluetoothGattStatus aStatus,
BluetoothService* bs = BluetoothService::Get();
NS_ENSURE_TRUE_VOID(bs);
nsAutoString appUuidStr;
UuidToString(aAppUuid, appUuidStr);
if (aStatus != GATT_STATUS_SUCCESS) {
nsAutoString appUuidStr;
UuidToString(aAppUuid, appUuidStr);
BT_LOGD("RegisterClient failed: clientIf = %d, status = %d, appUuid = %s",
aClientIf, aStatus, NS_ConvertUTF16toUTF8(appUuidStr).get());
// Notify BluetoothGatt for client disconnected
bs->DistributeSignal(
NS_LITERAL_STRING(GATT_CONNECTION_STATE_CHANGED_ID),
appUuidStr, BluetoothValue(false)); // Disconnected
aAppUuid, BluetoothValue(false)); // Disconnected
if (client->mStartLeScanRunnable) {
// Reject the LE scan request
@ -2578,7 +2560,7 @@ BluetoothGattManager::RegisterClientNotification(BluetoothGattStatus aStatus,
// Notify BluetoothGatt to update the clientIf
bs->DistributeSignal(
NS_LITERAL_STRING("ClientRegistered"),
appUuidStr, BluetoothValue(uint32_t(aClientIf)));
aAppUuid, BluetoothValue(uint32_t(aClientIf)));
if (client->mStartLeScanRunnable) {
// Client just registered, proceed remaining startLeScan request.
@ -2677,9 +2659,6 @@ BluetoothGattManager::ConnectNotification(int aConnId,
RefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
nsAutoString appUuidStr;
UuidToString(client->mAppUuid, appUuidStr);
if (aStatus != GATT_STATUS_SUCCESS) {
BT_LOGD("Connect failed: clientIf = %d, connId = %d, status = %d",
aClientIf, aConnId, aStatus);
@ -2687,7 +2666,7 @@ BluetoothGattManager::ConnectNotification(int aConnId,
// Notify BluetoothGatt that the client remains disconnected
bs->DistributeSignal(
NS_LITERAL_STRING(GATT_CONNECTION_STATE_CHANGED_ID),
appUuidStr,
client->mAppUuid,
BluetoothValue(false)); // Disconnected
// Reject the connect request
@ -2705,7 +2684,7 @@ BluetoothGattManager::ConnectNotification(int aConnId,
// Notify BluetoothGatt for client connected
bs->DistributeSignal(
NS_LITERAL_STRING(GATT_CONNECTION_STATE_CHANGED_ID),
appUuidStr,
client->mAppUuid,
BluetoothValue(true)); // Connected
// Resolve the connect request
@ -2733,14 +2712,11 @@ BluetoothGattManager::DisconnectNotification(
RefPtr<BluetoothGattClient> client = sClients->ElementAt(index);
nsAutoString appUuidStr;
UuidToString(client->mAppUuid, appUuidStr);
if (aStatus != GATT_STATUS_SUCCESS) {
// Notify BluetoothGatt that the client remains connected
bs->DistributeSignal(
NS_LITERAL_STRING(GATT_CONNECTION_STATE_CHANGED_ID),
appUuidStr,
client->mAppUuid,
BluetoothValue(true)); // Connected
// Reject the disconnect request
@ -2758,7 +2734,7 @@ BluetoothGattManager::DisconnectNotification(
// Notify BluetoothGatt for client disconnected
bs->DistributeSignal(
NS_LITERAL_STRING(GATT_CONNECTION_STATE_CHANGED_ID),
appUuidStr,
client->mAppUuid,
BluetoothValue(false)); // Disconnected
// Resolve the disconnect request
@ -2789,12 +2765,9 @@ BluetoothGattManager::SearchCompleteNotification(int aConnId,
return;
}
nsAutoString appUuidStr;
UuidToString(client->mAppUuid, appUuidStr);
// Notify BluetoothGatt to create all services
bs->DistributeSignal(NS_LITERAL_STRING("ServicesDiscovered"),
appUuidStr,
client->mAppUuid,
BluetoothValue(client->mServices));
// All services are discovered, continue to search included services of each
@ -2872,11 +2845,8 @@ BluetoothGattManager::GetCharacteristicNotification(
AppendNamedValue(values, "serviceId", aServiceId);
AppendNamedValue(values, "characteristics", client->mCharacteristics);
nsAutoString appUuidStr;
UuidToString(client->mAppUuid, appUuidStr);
bs->DistributeSignal(NS_LITERAL_STRING("CharacteristicsDiscovered"),
appUuidStr,
client->mAppUuid,
BluetoothValue(values));
ProceedDiscoverProcess(client, aServiceId);
@ -2922,11 +2892,8 @@ BluetoothGattManager::GetDescriptorNotification(
AppendNamedValue(values, "characteristicId", aCharId);
AppendNamedValue(values, "descriptors", client->mDescriptors);
nsAutoString appUuidStr;
UuidToString(client->mAppUuid, appUuidStr);
bs->DistributeSignal(NS_LITERAL_STRING("DescriptorsDiscovered"),
appUuidStr,
client->mAppUuid,
BluetoothValue(values));
client->mDescriptors.Clear();
@ -2970,11 +2937,8 @@ BluetoothGattManager::GetIncludedServiceNotification(
AppendNamedValue(values, "serviceId", aServiceId);
AppendNamedValue(values, "includedServices", client->mIncludedServices);
nsAutoString appUuidStr;
UuidToString(client->mAppUuid, appUuidStr);
bs->DistributeSignal(NS_LITERAL_STRING("IncludedServicesDiscovered"),
appUuidStr,
client->mAppUuid,
BluetoothValue(values));
client->mIncludedServices.Clear();
@ -3045,11 +3009,8 @@ BluetoothGattManager::NotifyNotification(
ids.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("charId"),
aNotifyParam.mCharId));
nsAutoString appUuidStr;
UuidToString(client->mAppUuid, appUuidStr);
bs->DistributeSignal(NS_LITERAL_STRING(GATT_CHARACTERISTIC_CHANGED_ID),
appUuidStr,
client->mAppUuid,
BluetoothValue(ids));
}
@ -3092,11 +3053,8 @@ BluetoothGattManager::ReadCharacteristicNotification(
ids.AppendElement(BluetoothNamedValue(NS_LITERAL_STRING("charId"),
aReadParam.mCharId));
nsAutoString appUuidStr;
UuidToString(client->mAppUuid, appUuidStr);
bs->DistributeSignal(NS_LITERAL_STRING(GATT_CHARACTERISTIC_CHANGED_ID),
appUuidStr,
client->mAppUuid,
BluetoothValue(ids));
// Resolve the promise
@ -3320,9 +3278,6 @@ BluetoothGattManager::RegisterServerNotification(BluetoothGattStatus aStatus,
{
MOZ_ASSERT(NS_IsMainThread());
nsAutoString appUuidStr;
UuidToString(aAppUuid, appUuidStr);
size_t index = sServers->IndexOf(aAppUuid, 0 /* Start */, UuidComparator());
NS_ENSURE_TRUE_VOID(index != sServers->NoIndex);
@ -3332,6 +3287,9 @@ BluetoothGattManager::RegisterServerNotification(BluetoothGattStatus aStatus,
BluetoothService* bs = BluetoothService::Get();
if (!bs || aStatus != GATT_STATUS_SUCCESS) {
nsAutoString appUuidStr;
UuidToString(aAppUuid, appUuidStr);
BT_LOGD("RegisterServer failed: serverIf = %d, status = %d, appUuid = %s",
aServerIf, aStatus, NS_ConvertUTF16toUTF8(appUuidStr).get());
@ -3362,7 +3320,7 @@ BluetoothGattManager::RegisterServerNotification(BluetoothGattStatus aStatus,
// Notify BluetoothGattServer to update the serverIf
bs->DistributeSignal(
NS_LITERAL_STRING("ServerRegistered"),
appUuidStr, BluetoothValue(uint32_t(aServerIf)));
aAppUuid, BluetoothValue(uint32_t(aServerIf)));
if (server->mConnectPeripheralRunnable) {
// Only one entry exists in the map during first connect peripheral request
@ -3409,16 +3367,13 @@ BluetoothGattManager::ConnectionNotification(int aConnId,
nsAutoString bdAddrStr;
AddressToString(aBdAddr, bdAddrStr);
nsAutoString appUuidStr;
UuidToString(server->mAppUuid, appUuidStr);
// Notify BluetoothGattServer that connection status changed
InfallibleTArray<BluetoothNamedValue> props;
AppendNamedValue(props, "Connected", aConnected);
AppendNamedValue(props, "Address", bdAddrStr);
bs->DistributeSignal(
NS_LITERAL_STRING(GATT_CONNECTION_STATE_CHANGED_ID),
appUuidStr,
server->mAppUuid,
BluetoothValue(props));
// Resolve or reject connect/disconnect peripheral requests
@ -3466,15 +3421,12 @@ BluetoothGattManager::ServiceAddedNotification(
return;
}
nsAutoString appUuidStr;
UuidToString(server->mAppUuid, appUuidStr);
// Notify BluetoothGattServer to update service handle
InfallibleTArray<BluetoothNamedValue> props;
AppendNamedValue(props, "ServiceId", aServiceId);
AppendNamedValue(props, "ServiceHandle", aServiceHandle);
bs->DistributeSignal(NS_LITERAL_STRING("ServiceHandleUpdated"),
appUuidStr,
server->mAppUuid,
BluetoothValue(props));
if (server->mAddServiceState.mRunnable) {
@ -3541,16 +3493,13 @@ BluetoothGattManager::CharacteristicAddedNotification(
return;
}
nsAutoString appUuidStr;
UuidToString(server->mAppUuid, appUuidStr);
// Notify BluetoothGattServer to update characteristic handle
InfallibleTArray<BluetoothNamedValue> props;
AppendNamedValue(props, "CharacteristicUuid", aCharId);
AppendNamedValue(props, "ServiceHandle", aServiceHandle);
AppendNamedValue(props, "CharacteristicHandle", aCharacteristicHandle);
bs->DistributeSignal(NS_LITERAL_STRING("CharacteristicHandleUpdated"),
appUuidStr,
server->mAppUuid,
BluetoothValue(props));
if (server->mAddCharacteristicRunnable) {
@ -3587,9 +3536,6 @@ BluetoothGattManager::DescriptorAddedNotification(
return;
}
nsAutoString appUuidStr;
UuidToString(server->mAppUuid, appUuidStr);
// Notify BluetoothGattServer to update descriptor handle
InfallibleTArray<BluetoothNamedValue> props;
AppendNamedValue(props, "CharacteristicUuid", aCharId);
@ -3598,7 +3544,7 @@ BluetoothGattManager::DescriptorAddedNotification(
server->mAddDescriptorState.mCharacteristicHandle);
AppendNamedValue(props, "DescriptorHandle", aDescriptorHandle);
bs->DistributeSignal(NS_LITERAL_STRING("DescriptorHandleUpdated"),
appUuidStr,
server->mAppUuid,
BluetoothValue(props));
if (server->mAddDescriptorState.mRunnable) {
@ -3734,9 +3680,6 @@ BluetoothGattManager::RequestReadNotification(
nsAutoString bdAddrStr;
AddressToString(aBdAddr, bdAddrStr);
nsAutoString appUuidStr;
UuidToString(server->mAppUuid, appUuidStr);
// Distribute a signal to gattServer
InfallibleTArray<BluetoothNamedValue> properties;
@ -3747,7 +3690,7 @@ BluetoothGattManager::RequestReadNotification(
AppendNamedValue(properties, "Value", new nsTArray<uint8_t>());
bs->DistributeSignal(NS_LITERAL_STRING("ReadRequested"),
appUuidStr,
server->mAppUuid,
properties);
}
@ -3793,9 +3736,6 @@ BluetoothGattManager::RequestWriteNotification(
nsAutoString bdAddrStr;
AddressToString(aBdAddr, bdAddrStr);
nsAutoString appUuidStr;
UuidToString(server->mAppUuid, appUuidStr);
// Distribute a signal to gattServer
InfallibleTArray<BluetoothNamedValue> properties;
@ -3809,7 +3749,7 @@ BluetoothGattManager::RequestWriteNotification(
AppendNamedValue(properties, "Value", value);
bs->DistributeSignal(NS_LITERAL_STRING("WrtieRequested"),
appUuidStr,
server->mAppUuid,
properties);
}

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

@ -240,8 +240,7 @@ BluetoothService::Cleanup()
void
BluetoothService::RegisterBluetoothSignalHandler(
const nsAString& aNodeName,
BluetoothSignalObserver* aHandler)
const nsAString& aNodeName, BluetoothSignalObserver* aHandler)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aHandler);
@ -334,6 +333,48 @@ BluetoothService::DistributeSignal(const nsAString& aName,
DistributeSignal(signal);
}
void
BluetoothService::DistributeSignal(const nsAString& aName,
const BluetoothAddress& aAddress)
{
nsAutoString path;
AddressToString(aAddress, path);
DistributeSignal(aName, path);
}
void
BluetoothService::DistributeSignal(const nsAString& aName,
const BluetoothAddress& aAddress,
const BluetoothValue& aValue)
{
nsAutoString path;
AddressToString(aAddress, path);
DistributeSignal(aName, path, aValue);
}
void
BluetoothService::DistributeSignal(const nsAString& aName,
const BluetoothUuid& aUuid)
{
nsAutoString path;
UuidToString(aUuid, path);
DistributeSignal(aName, path);
}
void
BluetoothService::DistributeSignal(const nsAString& aName,
const BluetoothUuid& aUuid,
const BluetoothValue& aValue)
{
nsAutoString path;
UuidToString(aUuid, path);
DistributeSignal(aName, path, aValue);
}
void
BluetoothService::DistributeSignal(const BluetoothSignal& aSignal)
{

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

@ -107,6 +107,46 @@ public:
DistributeSignal(const nsAString& aName, const nsAString& aPath,
const BluetoothValue& aValue);
/**
* Create a signal without value and distribute it to the observer list
*
* @param aName Name of the signal
* @param aAddress Path of the signal to distribute to
*/
void
DistributeSignal(const nsAString& aName, const BluetoothAddress& aAddress);
/**
* Create a signal and distribute it to the observer list
*
* @param aName Name of the signal
* @param aAddress Path of the signal to distribute to
* @param aValue Value of the signal to carry
*/
void
DistributeSignal(const nsAString& aName, const BluetoothAddress& aAddress,
const BluetoothValue& aValue);
/**
* Create a signal without value and distribute it to the observer list
*
* @param aName Name of the signal
* @param aUuid Path of the signal to distribute to
*/
void
DistributeSignal(const nsAString& aName, const BluetoothUuid& aUuid);
/**
* Create a signal and distribute it to the observer list
*
* @param aName Name of the signal
* @param aUuid Path of the signal to distribute to
* @param aValue Value of the signal to carry
*/
void
DistributeSignal(const nsAString& aName, const BluetoothUuid& aUuid,
const BluetoothValue& aValue);
/**
* Distribute a signal to the observer list
*

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

@ -440,6 +440,26 @@ RegisterBluetoothSignalHandler(const nsAString& aPath,
aHandler->SetSignalRegistered(true);
}
void
RegisterBluetoothSignalHandler(const BluetoothAddress& aAddress,
BluetoothSignalObserver* aHandler)
{
nsAutoString path;
AddressToString(aAddress, path);
RegisterBluetoothSignalHandler(path, aHandler);
}
void
RegisterBluetoothSignalHandler(const BluetoothUuid& aUuid,
BluetoothSignalObserver* aHandler)
{
nsAutoString path;
UuidToString(aUuid, path);
RegisterBluetoothSignalHandler(path, aHandler);
}
void
UnregisterBluetoothSignalHandler(const nsAString& aPath,
BluetoothSignalObserver* aHandler)
@ -454,6 +474,26 @@ UnregisterBluetoothSignalHandler(const nsAString& aPath,
aHandler->SetSignalRegistered(false);
}
void
UnregisterBluetoothSignalHandler(const BluetoothAddress& aAddress,
BluetoothSignalObserver* aHandler)
{
nsAutoString path;
AddressToString(aAddress, path);
UnregisterBluetoothSignalHandler(path, aHandler);
}
void
UnregisterBluetoothSignalHandler(const BluetoothUuid& aUuid,
BluetoothSignalObserver* aHandler)
{
nsAutoString path;
UuidToString(aUuid, path);
UnregisterBluetoothSignalHandler(path, aHandler);
}
/**
* |SetJsObject| is an internal function used by |BroadcastSystemMessage| only
*/

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

@ -180,7 +180,7 @@ GeneratePathFromGattId(const BluetoothGattId& aId,
//
/**
* Register the bluetooth signal handler.
* Register the Bluetooth signal handler.
*
* @param aPath Path of the signal to be registered.
* @param aHandler The message handler object to be added into the observer
@ -191,7 +191,29 @@ RegisterBluetoothSignalHandler(const nsAString& aPath,
BluetoothSignalObserver* aHandler);
/**
* Unregister the bluetooth signal handler.
* Register the Bluetooth signal handler.
*
* @param aAddress Address of the signal to be unregistered.
* @param aHandler The message handler object to be added into the observer
* list. Note that this function doesn't take references to it.
*/
void
RegisterBluetoothSignalHandler(const BluetoothAddress& aAddress,
BluetoothSignalObserver* aHandler);
/**
* Register the Bluetooth signal handler.
*
* @param aUuid UUID of the signal to be unregistered.
* @param aHandler The message handler object to be added into the observer
* list. Note that this function doesn't take references to it.
*/
void
RegisterBluetoothSignalHandler(const BluetoothUuid& aUuid,
BluetoothSignalObserver* aHandler);
/**
* Unregister the Bluetooth signal handler.
*
* @param aPath Path of the signal to be unregistered.
* @param aHandler The message handler object to be removed from the observer
@ -201,6 +223,28 @@ void
UnregisterBluetoothSignalHandler(const nsAString& aPath,
BluetoothSignalObserver* aHandler);
/**
* Unregister the Bluetooth signal handler.
*
* @param aAddress Address of the signal to be unregistered.
* @param aHandler The message handler object to be removed from the observer
* list. Note that this function doesn't take references to it.
*/
void
UnregisterBluetoothSignalHandler(const BluetoothAddress& aAddress,
BluetoothSignalObserver* aHandler);
/**
* Unregister the Bluetooth signal handler.
*
* @param aUuid UUID of the signal to be unregistered.
* @param aHandler The message handler object to be removed from the observer
* list. Note that this function doesn't take references to it.
*/
void
UnregisterBluetoothSignalHandler(const BluetoothUuid& aUuid,
BluetoothSignalObserver* aHandler);
//
// Broadcast system message
//