Revise auto accept for pairing request for TV profile 82/44882/1 accepted/tizen/mobile/20150729.105609 accepted/tizen/tv/20150729.105626 accepted/tizen/wearable/20150729.105635 submit/tizen_mobile/20150729.071022 submit/tizen_tv/20150729.071030 submit/tizen_wearable/20150729.071035
authorseungku kim <seungku.kim@samsung.com>
Wed, 29 Jul 2015 06:03:44 +0000 (15:03 +0900)
committerseungku kim <seungku.kim@samsung.com>
Wed, 29 Jul 2015 06:03:44 +0000 (15:03 +0900)
Change-Id: Ibc495968c50e33b67c032061cb0713b8baa67328

bt-service/bt-service-agent.c

index 82fdb13..53d386f 100644 (file)
@@ -479,12 +479,6 @@ static gboolean __pincode_request(GapAgentPrivate *agent, GDBusProxy *device)
                goto done;
        }
 
-#ifdef AUTO_ACCEPT
-       gap_agent_reply_pin_code(agent, GAP_AGENT_ACCEPT, "0000",
-                                                                               NULL);
-       goto done;
-#endif
-
        g_variant_get(reply_temp,"(@a{sv})", &reply); /* Format of reply a{sv}*/
 
        tmp_value = g_variant_lookup_value(reply, "Class", G_VARIANT_TYPE_UINT32);
@@ -527,9 +521,14 @@ static gboolean __pincode_request(GapAgentPrivate *agent, GDBusProxy *device)
                gap_agent_reply_pin_code(agent, GAP_AGENT_ACCEPT,
                                                        str_passkey, NULL);
 
+#ifdef AUTO_ACCEPT
+               gap_agent_reply_pin_code(agent, GAP_AGENT_ACCEPT, "0000",
+                                                                                       NULL);
+#else
                _bt_launch_system_popup(BT_AGENT_EVENT_KEYBOARD_PASSKEY_REQUEST,
                                                name, str_passkey, NULL,
                                                _gap_agent_get_path(agent));
+#endif
        } else {
                BT_DBG("Show Pin entry");
                _bt_launch_system_popup(BT_AGENT_EVENT_PIN_REQUEST, name, NULL,
@@ -562,12 +561,6 @@ static gboolean __passkey_request(GapAgentPrivate *agent, GDBusProxy *device)
                goto done;
        }
 
-#ifdef AUTO_ACCEPT
-       gap_agent_reply_pin_code(agent, GAP_AGENT_ACCEPT, "0000",
-                                                                               NULL);
-       goto done;
-#endif
-
        g_variant_get(reply_temp,"(@a{sv})", &reply); /* Format of reply a{sv}*/
 
        tmp_value = g_variant_lookup_value (reply, "Address", G_VARIANT_TYPE_STRING);
@@ -584,8 +577,13 @@ static gboolean __passkey_request(GapAgentPrivate *agent, GDBusProxy *device)
        if (!name)
                name = address;
 
+#ifdef AUTO_ACCEPT
+       gap_agent_reply_pin_code(agent, GAP_AGENT_ACCEPT, "0000",
+                                                                               NULL);
+#else
        _bt_launch_system_popup(BT_AGENT_EVENT_PASSKEY_REQUEST, name, NULL, NULL,
                                                _gap_agent_get_path(agent));
+#endif
 
 done:
        g_variant_unref(reply);
@@ -615,12 +613,6 @@ static gboolean __display_request(GapAgentPrivate *agent, GDBusProxy *device,
                goto done;
        }
 
-#ifdef AUTO_ACCEPT
-       gap_agent_reply_pin_code(agent, GAP_AGENT_ACCEPT, "0000",
-                                                                               NULL);
-       goto done;
-#endif
-
        g_variant_get(reply_temp,"(@a{sv})", &reply); /* Format of reply a{sv}*/
 
        tmp_value = g_variant_lookup_value (reply, "Address", G_VARIANT_TYPE_STRING);
@@ -639,10 +631,14 @@ static gboolean __display_request(GapAgentPrivate *agent, GDBusProxy *device,
 
        str_passkey = g_strdup_printf("%d", passkey);
 
+#ifdef AUTO_ACCEPT
+       gap_agent_reply_pin_code(agent, GAP_AGENT_ACCEPT, str_passkey,
+                                                                               NULL);
+#else
        _bt_launch_system_popup(BT_AGENT_EVENT_KEYBOARD_PASSKEY_REQUEST, name,
                                                str_passkey, NULL,
                                                _gap_agent_get_path(agent));
-
+#endif
        g_free(str_passkey);
 
 done:
@@ -676,12 +672,6 @@ static gboolean __confirm_request(GapAgentPrivate *agent, GDBusProxy *device,
                goto done;
        }
 
-#ifdef AUTO_ACCEPT
-       gap_agent_reply_pin_code(agent, GAP_AGENT_ACCEPT, str_passkey,
-                                                                               NULL);
-       goto done;
-#endif
-
        g_variant_get(reply_temp,"(@a{sv})", &reply); /* Format of reply a{sv}*/
 
        tmp_value = g_variant_lookup_value (reply, "Address", G_VARIANT_TYPE_STRING);
@@ -727,11 +717,16 @@ static gboolean __confirm_request(GapAgentPrivate *agent, GDBusProxy *device,
                gap_agent_reply_confirmation(agent, GAP_AGENT_ACCEPT, NULL);
        }
 #else
+#ifdef AUTO_ACCEPT
+       BT_DBG("Confirm reply");
+       gap_agent_reply_confirmation(agent, GAP_AGENT_ACCEPT, NULL);
+#else
        BT_DBG("LAUNCH SYSPOPUP");
        _bt_launch_system_popup(BT_AGENT_EVENT_PASSKEY_CONFIRM_REQUEST, name,
                                                str_passkey, NULL,
                                                _gap_agent_get_path(agent));
 #endif
+#endif
 
 done:
        g_variant_unref(reply);
@@ -936,8 +931,12 @@ fail:
                gap_agent_reply_authorize(agent,
                                              GAP_AGENT_ACCEPT, NULL);
        } else {
+#ifdef AUTO_ACCEPT
+               gap_agent_reply_authorize(agent, GAP_AGENT_ACCEPT, NULL);
+#else
                _bt_launch_system_popup(request_type, name, NULL, NULL,
                                                _gap_agent_get_path(agent));
+#endif
        }
 
 done: