From e5450f6439d9cd3aca53d31590cc2f7dd7b3c88a Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 17 Nov 2015 00:10:32 -0800 Subject: [PATCH 1/4] Bumping gaia.json for 1 gaia revision(s) a=gaia-bump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ======== https://hg.mozilla.org/integration/gaia-central/rev/f1fbe09c3fd9 Author: Théo Chevalier Desc: Bug 1222204 - Add Persian (fa) to master and 2.5 builds, r=stas, a=mahe --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 80a4021c7082..3da191fd34b4 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -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" } From c5e11400e1d65a656eba6ae09a76222409e02dd6 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 17 Nov 2015 00:12:18 -0800 Subject: [PATCH 2/4] Bumping manifests a=b2g-bump --- b2g/config/aries/sources.xml | 2 +- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator-l/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/nexus-4-kk/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/b2g/config/aries/sources.xml b/b2g/config/aries/sources.xml index 18013ed5f9ad..a3c45e4cb6c8 100644 --- a/b2g/config/aries/sources.xml +++ b/b2g/config/aries/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 5ce057aa04e0..f1563808a32c 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 8579431549ec..e13f98dd8ca2 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 4d65bcdbe720..cba7ea253563 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 709d5e1675df..a2c84698c98d 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-l/sources.xml b/b2g/config/emulator-l/sources.xml index 8009645af161..d2de54fbed95 100644 --- a/b2g/config/emulator-l/sources.xml +++ b/b2g/config/emulator-l/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 8579431549ec..e13f98dd8ca2 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index e68f2ca64489..d04680ed65cc 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4-kk/sources.xml b/b2g/config/nexus-4-kk/sources.xml index 3cbd9e730849..69bf43e69a51 100644 --- a/b2g/config/nexus-4-kk/sources.xml +++ b/b2g/config/nexus-4-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 61fa3abc4ccd..7cacf669b39c 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -18,7 +18,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 7d66d1552cc4..ddf550cb66f7 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 8294faa09b320695f93a9dbd837fb7201afb2171 Mon Sep 17 00:00:00 2001 From: Thomas Zimmermann Date: Tue, 17 Nov 2015 11:25:34 +0100 Subject: [PATCH 3/4] Bug 1223720: Support UUIDs and addresses for Bluetooth signal paths, r=joliu This patch improves the Bluetooth signal API by adding methods for dealing with UUIDs and addresses directly. Callers have been converted where possible. --- .../bluedroid/BluetoothGattManager.cpp | 122 +++++------------- dom/bluetooth/common/BluetoothService.cpp | 45 ++++++- dom/bluetooth/common/BluetoothService.h | 40 ++++++ dom/bluetooth/common/BluetoothUtils.cpp | 40 ++++++ dom/bluetooth/common/BluetoothUtils.h | 48 ++++++- 5 files changed, 200 insertions(+), 95 deletions(-) diff --git a/dom/bluetooth/bluedroid/BluetoothGattManager.cpp b/dom/bluetooth/bluedroid/BluetoothGattManager.cpp index 791226b35560..25e3b88496c5 100644 --- a/dom/bluetooth/bluedroid/BluetoothGattManager.cpp +++ b/dom/bluetooth/bluedroid/BluetoothGattManager.cpp @@ -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 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 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 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 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 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 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 properties; @@ -3747,7 +3690,7 @@ BluetoothGattManager::RequestReadNotification( AppendNamedValue(properties, "Value", new nsTArray()); 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 properties; @@ -3809,7 +3749,7 @@ BluetoothGattManager::RequestWriteNotification( AppendNamedValue(properties, "Value", value); bs->DistributeSignal(NS_LITERAL_STRING("WrtieRequested"), - appUuidStr, + server->mAppUuid, properties); } diff --git a/dom/bluetooth/common/BluetoothService.cpp b/dom/bluetooth/common/BluetoothService.cpp index b3352d7ae5fc..63c4d0d45d94 100644 --- a/dom/bluetooth/common/BluetoothService.cpp +++ b/dom/bluetooth/common/BluetoothService.cpp @@ -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) { diff --git a/dom/bluetooth/common/BluetoothService.h b/dom/bluetooth/common/BluetoothService.h index 8a869266a437..634d8d95af8d 100644 --- a/dom/bluetooth/common/BluetoothService.h +++ b/dom/bluetooth/common/BluetoothService.h @@ -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 * diff --git a/dom/bluetooth/common/BluetoothUtils.cpp b/dom/bluetooth/common/BluetoothUtils.cpp index f7601358add3..3dfb2894370d 100644 --- a/dom/bluetooth/common/BluetoothUtils.cpp +++ b/dom/bluetooth/common/BluetoothUtils.cpp @@ -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 */ diff --git a/dom/bluetooth/common/BluetoothUtils.h b/dom/bluetooth/common/BluetoothUtils.h index e286d6ec9c74..f188d27fba6b 100644 --- a/dom/bluetooth/common/BluetoothUtils.h +++ b/dom/bluetooth/common/BluetoothUtils.h @@ -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 // From f1503e1eb366ac9f5f878fbe47eaa761940e1662 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 17 Nov 2015 03:56:39 -0800 Subject: [PATCH 4/4] Bumping manifests a=b2g-bump --- b2g/config/nexus-4-kk/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/nexus-4-kk/sources.xml b/b2g/config/nexus-4-kk/sources.xml index 69bf43e69a51..7d1b870c12d8 100644 --- a/b2g/config/nexus-4-kk/sources.xml +++ b/b2g/config/nexus-4-kk/sources.xml @@ -128,7 +128,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index ddf550cb66f7..a3c2ae49997e 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -142,7 +142,7 @@ - +