[Bluetooth] stopDiscovery API fix to be compliant with TCT tests
authorCorentin Lecouvey <corentin.lecouvey@open.eurogiciel.org>
Wed, 9 Jul 2014 12:35:00 +0000 (14:35 +0200)
committerCorentin Lecouvey <corentin.lecouvey@open.eurogiciel.org>
Wed, 9 Jul 2014 12:41:12 +0000 (14:41 +0200)
stopDiscovery API is supposed to cancel an active discovery session.
If user cancels the discovery while there is no active discovery,
we should NOT return an error to pass TCT tests.

bluetooth/bluetooth_instance_capi.cc

index bb0b820..4c5086a 100644 (file)
@@ -571,7 +571,7 @@ void BluetoothInstance::HandleStopDiscovery(const picojson::value& msg) {
   CAPI(bt_adapter_is_discovering(&is_discovering));
   if (!is_discovering) {
     picojson::value::object o;
-    o["error"] = picojson::value(static_cast<double>(1));
+    o["error"] = picojson::value(static_cast<double>(0));
     o["cmd"] = picojson::value("");
     o["reply_id"] = picojson::value(callbacks_id_map_["StopDiscovery"]);
     callbacks_id_map_.erase("StopDiscovery");