Return the proper error when it is no discovery state 97/90997/1 accepted/tizen/common/20161005.165620 accepted/tizen/ivi/20161006.075753 accepted/tizen/mobile/20161006.075711 accepted/tizen/tv/20161006.075725 accepted/tizen/wearable/20161006.075737 submit/tizen/20161005.091935
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 5 Oct 2016 09:05:04 +0000 (18:05 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 5 Oct 2016 09:05:04 +0000 (18:05 +0900)
Change-Id: I366ce94bfb71d3c63a88faaf75a0fc980f035dad
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-service/bt-service-adapter.c

index 5482ef4..5b95282 100644 (file)
@@ -2094,12 +2094,19 @@ int _bt_cancel_discovery(void)
                                &error);
 
        if (!result) {
+               int ret = BLUETOOTH_ERROR_INTERNAL;
                if (error != NULL) {
                        BT_ERR("StopDiscovery failed (Error: %s)", error->message);
+
+                       if (g_strrstr(error->message, "No discovery started"))
+                               ret = BLUETOOTH_ERROR_NOT_IN_OPERATION;
+
                        g_clear_error(&error);
-               } else
+               } else {
                        BT_ERR("StopDiscovery failed");
-               return BLUETOOTH_ERROR_INTERNAL;
+               }
+
+               return ret;
        }
 
        cancel_by_user = TRUE;