From 774802d474d5aa7b5e72c3594e6ead930177ac93 Mon Sep 17 00:00:00 2001 From: Jihoon Jung Date: Tue, 22 Nov 2016 17:12:38 +0900 Subject: [PATCH] Add implemenation for appcontrol extra data Signed-off-by: Jihoon Jung Change-Id: I0599e40ac22a1234acb5c35f592803c70499b923 --- packaging/ug-nfc-efl.spec | 2 +- wearable/app/include/nsa-main.h | 7 ++++++ wearable/app/src/nsa-main.c | 56 ++++++++++++++++++++++++++++++++++++++--- 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/packaging/ug-nfc-efl.spec b/packaging/ug-nfc-efl.spec index bc83d31..33a4c0f 100644 --- a/packaging/ug-nfc-efl.spec +++ b/packaging/ug-nfc-efl.spec @@ -16,7 +16,7 @@ ExcludeArch: %{arm} %ix86 x86_64 Name: ug-nfc-efl Summary: NFC Setting UI -Version: 3.1.3 +Version: 3.1.4 Release: 0 Group: App/Network License: Flora-1.1 diff --git a/wearable/app/include/nsa-main.h b/wearable/app/include/nsa-main.h index e13f5cb..8b2c1ef 100755 --- a/wearable/app/include/nsa-main.h +++ b/wearable/app/include/nsa-main.h @@ -53,6 +53,11 @@ typedef struct { int aid_count; } wallet_info_t; +typedef enum { + NSA_OP_NFC = 1, + NSA_OP_TAP_N_PAY = 2 +} nsa_operation_type; + typedef struct { Evas_Object *main_win; Evas_Object *main_layout; @@ -73,6 +78,8 @@ typedef struct { int payment_wallet_cnt; GArray *payment_wallet_list; Evas_Object *radio_main; + + nsa_operation_type op_type; } appdata; #ifdef __cplusplus diff --git a/wearable/app/src/nsa-main.c b/wearable/app/src/nsa-main.c index 88a3081..a92fc61 100755 --- a/wearable/app/src/nsa-main.c +++ b/wearable/app/src/nsa-main.c @@ -34,7 +34,7 @@ static void __back_clicked_cb(void *data, Evas_Object *obj, void *event_info) elm_naviframe_item_pop(ad->navi_frame); - if (ad->current_view == V_TAP_N_PAY) { + if (ad->current_view == V_TAP_N_PAY && ad->op_type != NSA_OP_TAP_N_PAY) { Evas_Object *circle_obj; /* release Tap & Pay view */ @@ -58,7 +58,7 @@ static void __back_clicked_cb(void *data, Evas_Object *obj, void *event_info) ad->current_view = V_MAIN; eext_rotary_object_event_activated_set(ad->main_circle_obj, EINA_TRUE); - } else if (ad->current_view == V_MAIN) { + } else { /* release Main view and exit application */ NSA_MEM_FREE(ad->payment_handler); @@ -99,6 +99,47 @@ void _nsa_main_app_terminate(void *user_data) NSA_DEBUG("_nsa_main_app_terminate end"); } +static void __parse_service(app_control_h service, void *user_data) +{ + appdata *ad = user_data; + char *operation = NULL; + char *app_id = NULL; + char *ex_data = NULL; + + ret_if(ad == NULL); + + app_control_get_operation(service, &operation); + app_control_get_app_id(service, &app_id); + app_control_get_extra_data(service, "type", &ex_data); + + NSA_DEBUG("operation [%s] >>>>> ", GET_SAFE_STRING(operation)); + NSA_DEBUG("app_id [%s] >>>>> ", GET_SAFE_STRING(app_id)); + NSA_DEBUG("extra data [%s] >>>>> ", GET_SAFE_STRING(ex_data)); + + ad->op_type = NSA_OP_NFC; + if (!ex_data) { + NSA_DEBUG_ERR("extra data is NULL"); + goto end; + } + + if (strncmp(operation, APP_CONTROL_OPERATION_SETTING_NFC, + strlen(APP_CONTROL_OPERATION_SETTING_NFC)) == 0) { + /* launched by app-control */ + if (strncmp(ex_data, "nfc", strlen("nfc")) == 0) { + ad->op_type = NSA_OP_NFC; + } else if (strncmp(ex_data, "tap_n_pay", strlen("tap_n_pay")) == 0) { + ad->op_type = NSA_OP_TAP_N_PAY; + } + } + +end: + NSA_MEM_FREE(operation); + NSA_MEM_FREE(app_id); + NSA_MEM_FREE(ex_data); + + return; +} + void _nsa_main_app_service(app_control_h service, void *user_data) { appdata *ad = user_data; @@ -134,7 +175,16 @@ void _nsa_main_app_service(app_control_h service, void *user_data) elm_object_part_content_set(ad->main_layout, "elm.swallow.content", ad->navi_frame); eext_object_event_callback_add(ad->navi_frame, EEXT_CALLBACK_BACK, __back_clicked_cb, ad); - _nsa_view_main_create(ad); + /* parse service data */ + __parse_service(service, ad); + + /* launch nss */ + if (ad->op_type == NSA_OP_TAP_N_PAY){ + _nsa_view_tap_n_pay_create(ad); + } else { + _nsa_view_main_create(ad); + } + elm_win_activate(ad->main_win); NSA_DEBUG("_nsa_main_app_service end"); -- 2.7.4