[Bluetooth][bugfix] Call success callbacks in registerService() 40/245140/1 submit/tizen/20201005.050422
authorPawel Wasowski <p.wasowski2@samsung.com>
Fri, 2 Oct 2020 16:28:27 +0000 (18:28 +0200)
committerPawel Wasowski <p.wasowski2@samsung.com>
Fri, 2 Oct 2020 16:49:06 +0000 (18:49 +0200)
registerService() used to call successCallback only when registered
service had at least 1 component with read/write value request callback.
Now, the function will call successCallback even, if the service
has no components with such read/write value request calbacks.

[Verification] registerService() calls successCallback when no
read/write value request callbacks are registered

Change-Id: I4f4af260179fb21ac785dc1ccb0f5dab6d986496
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
src/bluetooth/bluetooth_api.js

index 26ad947..826cbb9 100755 (executable)
@@ -2176,6 +2176,12 @@ function _registerReadWriteValueRequestCallbacksInGATTService(
     errorCallback
 ) {
     var count = _countCallbackToRegisterInService(service);
+
+    if (count === 0) {
+      successCallback();
+      return;
+    }
+
     var callbacksAggregator = new ResultCallbacksAggregator(
         count,
         function onAllSucceeded() {