Add define and modify wearable code 35/77335/1
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 29 Jun 2016 10:54:07 +0000 (19:54 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 29 Jun 2016 10:54:07 +0000 (19:54 +0900)
Change-Id: Ib8a19dcb73f2737585ef462350ef0211af6091a3
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
CMakeLists.txt
src/bt-syspopup-m.c
src/bt-syspopup-w.c

index b0408a5..4bb06c4 100644 (file)
@@ -91,6 +91,7 @@ ENDIF("${ARCH}" STREQUAL "arm")
 
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
 ADD_DEFINITIONS("-DSLP_DEBUG")
+ADD_DEFINITIONS("-DNO_DBUS_REPLY")
 
 IF(WAYLAND_SUPPORT)
   ADD_DEFINITIONS(
index 3e62e09..6326474 100644 (file)
@@ -456,13 +456,15 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
        BT_INFO("Remove event 0X%X", ad->event_type);
        switch (ad->event_type) {
        case BT_EVENT_PIN_REQUEST:
-
+#ifdef NO_DBUS_REPLY
+               bt_passkey_reply("0000", false);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                           "ReplyPinCode",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_STRING, "", G_TYPE_INVALID,
                                           G_TYPE_INVALID);
-
+#endif
                break;
 
 
@@ -473,22 +475,26 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
                break;
 
        case BT_EVENT_PASSKEY_CONFIRM_REQUEST:
-
+#ifdef NO_DBUS_REPLY
+               bt_passkey_confirmation_reply(true);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                           "ReplyConfirmation",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_INVALID, G_TYPE_INVALID);
-
+#endif
                break;
 
        case BT_EVENT_PASSKEY_REQUEST:
-
+#ifdef NO_DBUS_REPLY
+               bt_passkey_reply("0000", false);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                           "ReplyPasskey",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_STRING, "", G_TYPE_INVALID,
                                           G_TYPE_INVALID);
-
+#endif
                break;
 
        case BT_EVENT_PASSKEY_DISPLAY_REQUEST:
@@ -496,12 +502,15 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
                break;
 
        case BT_EVENT_AUTHORIZE_REQUEST:
-
+#ifdef NO_DBUS_REPLY
+               /* Should add 1 more API for authorize reply */
+               bt_passkey_confirmation_reply(true);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                           "ReplyAuthorize",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_INVALID, G_TYPE_INVALID);
-
+#endif
                break;
 
        case BT_EVENT_APP_CONFIRM_REQUEST:
@@ -533,12 +542,14 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
        case BT_EVENT_PHONEBOOK_REQUEST:
        case BT_EVENT_MESSAGE_REQUEST:
        case BT_EVENT_EXCHANGE_REQUEST:
-
+#ifdef NO_DBUS_REPLY
+               bt_passkey_confirmation_reply(false);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                           "ReplyAuthorize",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_INVALID, G_TYPE_INVALID);
-
+#endif
                break;
 
        case BT_EVENT_CONFIRM_OVERWRITE_REQUEST: {
@@ -641,15 +652,23 @@ static void __bluetooth_input_request_cb(void *data,
                     (response == BT_AGENT_ACCEPT) ? "Accept" : "Cancel");
 
        if (ad->event_type == BT_EVENT_PIN_REQUEST) {
+#ifdef NO_DBUS_REPLY
+               bt_passkey_reply(convert_input_text, true);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                   "ReplyPinCode", G_TYPE_UINT, response,
                                   G_TYPE_STRING, convert_input_text,
                                   G_TYPE_INVALID, G_TYPE_INVALID);
+#endif
        } else {
+#ifdef NO_DBUS_REPLY
+               bt_passkey_reply(convert_input_text, true);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                   "ReplyPasskey", G_TYPE_UINT, response,
                                   G_TYPE_STRING, convert_input_text,
                                   G_TYPE_INVALID, G_TYPE_INVALID);
+#endif
        }
        __bluetooth_delete_input_view(ad);
 
@@ -678,19 +697,21 @@ static void __bluetooth_passkey_confirm_cb(void *data,
        const char *event = elm_object_text_get(obj);
 
        if (!g_strcmp0(event, BT_STR_CONFIRM)) {
-#if 0
+#ifdef NO_DBUS_REPLY
+               bt_passkey_confirmation_reply(true);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyConfirmation",
                                           G_TYPE_UINT, BT_AGENT_ACCEPT,
                                           G_TYPE_INVALID, G_TYPE_INVALID);
 #endif
-               bt_passkey_confirmation_reply(true);
        } else {
-#if 0
+#ifdef NO_DBUS_REPLY
+               bt_passkey_confirmation_reply(false);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyConfirmation",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_INVALID, G_TYPE_INVALID);
 #endif
-               bt_passkey_confirmation_reply(false);
        }
 
        evas_object_del(obj);
@@ -769,9 +790,16 @@ static void __bluetooth_authorization_request_cb(void *data,
                reply_val = BT_AGENT_CANCEL;
        }
 
+#ifdef NO_DBUS_REPLY
+       if (reply_val == BT_AGENT_ACCEPT || reply_val == BT_AGENT_ACCEPT_ALWAYS)
+               bt_passkey_confirmation_reply(true);
+       else
+               bt_passkey_confirmation_reply(false);
+#else
        dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyAuthorize",
                G_TYPE_UINT, reply_val,
                G_TYPE_INVALID, G_TYPE_INVALID);
+#endif
 
        ad->make_trusted = FALSE;
 
@@ -800,6 +828,12 @@ static void __bluetooth_push_authorization_request_cb(void *data,
 
        const char *event = elm_object_text_get(obj);
 
+#ifdef NO_DBUS_REPLY
+       if (!g_strcmp0(event, BT_STR_OK))
+               bt_passkey_confirmation_reply(true);
+       else
+               bt_passkey_confirmation_reply(false);
+#else
        if (!g_strcmp0(event, BT_STR_OK))
                dbus_g_proxy_call_no_reply(ad->obex_proxy, "ReplyAuthorize",
                                           G_TYPE_UINT, BT_AGENT_ACCEPT,
@@ -808,7 +842,7 @@ static void __bluetooth_push_authorization_request_cb(void *data,
                dbus_g_proxy_call_no_reply(ad->obex_proxy, "ReplyAuthorize",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_INVALID, G_TYPE_INVALID);
-
+#endif
        __bluetooth_win_del(ad);
 }
 
@@ -1172,7 +1206,6 @@ static void __bluetooth_input_mouseup_cb(void *data,
        FN_START;
        Evas_Event_Mouse_Up *ev = event_info;
        struct bt_popup_appdata *ad = data;
-       int response = BT_AGENT_CANCEL;
        char *input_text = NULL;
        char *convert_input_text = NULL;
 
@@ -1198,6 +1231,11 @@ static void __bluetooth_input_mouseup_cb(void *data,
                if (convert_input_text == NULL)
                        return;
 
+#ifdef NO_DBUS_REPLY
+               bt_passkey_reply(convert_input_text, true);
+#else
+               int response = BT_AGENT_CANCEL;
+
                if (ad->event_type == BT_EVENT_PIN_REQUEST) {
                        dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                           "ReplyPinCode", G_TYPE_UINT, response,
@@ -1209,6 +1247,7 @@ static void __bluetooth_input_mouseup_cb(void *data,
                                           G_TYPE_STRING, convert_input_text,
                                           G_TYPE_INVALID, G_TYPE_INVALID);
                }
+#endif
                __bluetooth_delete_input_view(ad);
                free(convert_input_text);
                if (ad->entry) {
index 4bd1320..715ad30 100644 (file)
@@ -25,6 +25,7 @@
 #include <E_DBus.h>
 #include <aul.h>
 #include <bluetooth.h>
+#include <bluetooth_internal.h>
 #include <feedback.h>
 #include <device/display.h>
 #include <efl_extension.h>
@@ -289,16 +290,17 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
        BT_INFO("Remove event 0X%X", ad->event_type);
        switch (ad->event_type) {
        case BT_EVENT_PIN_REQUEST:
-
+#ifdef NO_DBUS_REPLY
+               bt_passkey_reply("0000", false);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                           "ReplyPinCode",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_STRING, "", G_TYPE_INVALID,
                                           G_TYPE_INVALID);
-
+#endif
                break;
 
-
        case BT_EVENT_KEYBOARD_PASSKEY_REQUEST:
 
                __bluetooth_request_to_cancel();
@@ -306,23 +308,28 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
                break;
 
        case BT_EVENT_PASSKEY_CONFIRM_REQUEST:
-
+#ifdef NO_DBUS_REPLY
+               bt_passkey_confirmation_reply(false);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                           "ReplyConfirmation",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_INVALID, G_TYPE_INVALID);
+#endif
                __unlock_display();
 
                break;
 
        case BT_EVENT_PASSKEY_REQUEST:
-
+#ifdef NO_DBUS_REPLY
+               bt_passkey_reply("0000", false);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                           "ReplyPasskey",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_STRING, "", G_TYPE_INVALID,
                                           G_TYPE_INVALID);
-
+#endif
                break;
 
        case BT_EVENT_PASSKEY_DISPLAY_REQUEST:
@@ -330,12 +337,14 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
                break;
 
        case BT_EVENT_AUTHORIZE_REQUEST:
-
+#ifdef NO_DBUS_REPLY
+               bt_passkey_confirmation_reply(false);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                           "ReplyAuthorize",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_INVALID, G_TYPE_INVALID);
-
+#endif
                break;
 
        case BT_EVENT_APP_CONFIRM_REQUEST:
@@ -365,12 +374,14 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
 
        case BT_EVENT_PUSH_AUTHORIZE_REQUEST:
        case BT_EVENT_EXCHANGE_REQUEST:
-
+#ifdef NO_DBUS_REPLY
+               bt_passkey_confirmation_reply(false);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                           "ReplyAuthorize",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_INVALID, G_TYPE_INVALID);
-
+#endif
                break;
 
        case BT_EVENT_CONFIRM_OVERWRITE_REQUEST: {
@@ -394,11 +405,14 @@ static void __bluetooth_remove_all_event(struct bt_popup_appdata *ad)
        }
 
        case BT_EVENT_SYSTEM_RESET_REQUEST:
-
+#ifdef NO_DBUS_REPLY
+               bt_passkey_confirmation_reply(false);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                           "ReplyConfirmation",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_INVALID, G_TYPE_INVALID);
+#endif
                __unlock_display();
 
                break;
@@ -505,15 +519,23 @@ static void __bluetooth_passkey_confirm_cb(void *data,
        if (!g_strcmp0(style, "popup/circle/right")) {
                BT_INFO("Accept the pairing passkey");
                __bluetooth_send_signal_pairing_confirm_result(ad, 1);
+#ifdef NO_DBUS_REPLY
+               bt_passkey_confirmation_reply(true);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyConfirmation",
                                           G_TYPE_UINT, BT_AGENT_ACCEPT,
                                           G_TYPE_INVALID, G_TYPE_INVALID);
+#endif
        } else {
                BT_INFO("Reject the pairing passkey");
                __bluetooth_send_signal_pairing_confirm_result(ad, 0);
+#ifdef NO_DBUS_REPLY
+               bt_passkey_confirmation_reply(false);
+#else
                dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyConfirmation",
                                           G_TYPE_UINT, BT_AGENT_CANCEL,
                                           G_TYPE_INVALID, G_TYPE_INVALID);
+#endif
        }
        __unlock_display();
 
@@ -578,10 +600,14 @@ static void __bluetooth_reset_cb(void *data, Evas_Object *obj, void *event_info)
        const char *style = elm_object_style_get(obj);
 
        __bluetooth_send_signal_pairing_confirm_result(ad, 0);
+
+#ifdef NO_DBUS_REPLY
+       bt_passkey_confirmation_reply(false);
+#else
        dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyConfirmation",
                                   G_TYPE_UINT, BT_AGENT_CANCEL,
                                   G_TYPE_INVALID, G_TYPE_INVALID);
-
+#endif
        if (!g_strcmp0(style, "popup/circle/right")) {
                BT_INFO("Confirm Soft reset");
                reset = 1;
@@ -632,9 +658,16 @@ static void __bluetooth_authorization_request_cb(void *data,
                reply_val = BT_AGENT_CANCEL;
        }
 
+#ifdef NO_DBUS_REPLY
+       if (reply_val == BT_AGENT_ACCEPT || reply_val == BT_AGENT_ACCEPT_ALWAYS)
+               bt_passkey_confirmation_reply(true);
+       else
+               bt_passkey_confirmation_reply(false);
+#else
        dbus_g_proxy_call_no_reply(ad->agent_proxy, "ReplyAuthorize",
                G_TYPE_UINT, reply_val,
                G_TYPE_INVALID, G_TYPE_INVALID);
+#endif
 
        evas_object_del(obj);
        __bluetooth_win_del(ad);
@@ -1243,6 +1276,9 @@ static void __bluetooth_pincode_btn_cb(void *data, Evas_Object *obj,
        bt_pincode_input_object *po = ad->po;
        retm_if(po == NULL, "ad is NULL!");
 
+#ifdef NO_DBUS_REPLY
+       bt_passkey_reply(po->pincode, true);
+#else
        if (ad->event_type == BT_EVENT_PIN_REQUEST) {
                dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                        "ReplyPinCode", G_TYPE_UINT, BT_AGENT_ACCEPT,
@@ -1254,6 +1290,7 @@ static void __bluetooth_pincode_btn_cb(void *data, Evas_Object *obj,
                                        G_TYPE_STRING, po->pincode,
                                        G_TYPE_INVALID, G_TYPE_INVALID);
        }
+#endif
 
        if (po->pincode) {
                g_free(po->pincode);
@@ -1680,10 +1717,15 @@ static int __bluetooth_launch_handler(struct bt_popup_appdata *ad,
                                free(conv_str);
 
                        __bluetooth_send_signal_pairing_confirm_result(ad, 1);
+
+#ifdef NO_DBUS_REPLY
+                       bt_passkey_confirmation_reply(true);
+#else
                        dbus_g_proxy_call_no_reply(ad->agent_proxy,
                                        "ReplyConfirmation",
                                        G_TYPE_UINT, BT_AGENT_ACCEPT,
                                        G_TYPE_INVALID, G_TYPE_INVALID);
+#endif
                }
                break;
        }