From f4771974e7bfeecb99096a3cf4fe4f120d644a93 Mon Sep 17 00:00:00 2001 From: seungku kim Date: Wed, 29 Jul 2015 15:03:44 +0900 Subject: [PATCH] Revise auto accept for pairing request for TV profile Change-Id: Ibc495968c50e33b67c032061cb0713b8baa67328 --- bt-service/bt-service-agent.c | 49 +++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/bt-service/bt-service-agent.c b/bt-service/bt-service-agent.c index 82fdb13..53d386f 100644 --- a/bt-service/bt-service-agent.c +++ b/bt-service/bt-service-agent.c @@ -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: -- 2.7.4