Fix : logic error in MDM visibility policy
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-event-receiver.c
index 9b468bf..7a434cb 100644 (file)
@@ -709,21 +709,22 @@ static void __bt_adapter_property_changed_event(GVariant *msg, const char *path)
 
                        if (discoverable == FALSE) {
                                if (_bt_get_discoverable_timeout_property() > 0) {
-                                       int time = 0;
+                                       unsigned int time = 0;
+
                                        adapter_proxy = _bt_get_adapter_properties_proxy();
                                        if (adapter_proxy == NULL)
                                                continue;
+
                                        ret = g_dbus_proxy_call_sync(adapter_proxy, "Set",
                                                g_variant_new("(ssv)", BT_ADAPTER_INTERFACE,
                                                "DiscoverableTimeout",
-                                               g_variant_new("i", time)),
+                                               g_variant_new("u", time)),
                                                G_DBUS_CALL_FLAGS_NONE,
                                                DBUS_TIMEOUT, NULL,
                                                &err);
-
                                        if (err != NULL) {
-                                               BT_ERR("StopLEDiscovery Failed: %s", err->message);
-                                               g_error_free(err);
+                                               BT_ERR("Set DiscoverableTimeout Failed: %s", err->message);
+                                               g_clear_error(&err);
                                        }
                                        if (ret)
                                                g_variant_unref(ret);
@@ -732,7 +733,7 @@ static void __bt_adapter_property_changed_event(GVariant *msg, const char *path)
                                mode = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
 
                                /* Send event to application */
-                               BT_INFO("[Connectable]");
+                               BT_INFO("[Non Discoverable]");
                                param = g_variant_new("(in)", result, mode);
                                _bt_send_event(BT_ADAPTER_EVENT,
                                        BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
@@ -761,11 +762,11 @@ static void __bt_adapter_property_changed_event(GVariant *msg, const char *path)
 
                        /* Send event to application */
                        BT_INFO("[Limited Discoverable (Timeout %u secs)]",
-                       _bt_get_discoverable_timeout_property());
+                                       _bt_get_discoverable_timeout_property());
                        param = g_variant_new("(in)", result, mode);
                        _bt_send_event(BT_ADAPTER_EVENT,
-                               BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
-                               param);
+                                       BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED,
+                                       param);
                } else if (strcasecmp(property, "Powered") == 0) {
                        /* TODO: Need to check this operation!! */
                        gboolean powered = FALSE;