From: Sechang Sohn Date: Tue, 3 Sep 2013 23:57:24 +0000 (+0900) Subject: merge some local changes X-Git-Tag: accepted/tizen/generic/20140317.083658~60 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ab252e43392e2a0ee9cabf91b2cb09a276325c5;p=platform%2Fcore%2Fconnectivity%2Fnfc-manager-neard.git merge some local changes - Fix more change for delaying nfc activation - bug fix(g_object_ref to g_variant_ref) - keep_SE_select_value - Modify the boot-sequence of the nfc-manager-daemon Change-Id: Ib7b98e959b602c67993df19c32dae1692c9f9c90 --- diff --git a/client/net_nfc_client_manager.c b/client/net_nfc_client_manager.c index 1a7b6a0..51d0ff2 100644 --- a/client/net_nfc_client_manager.c +++ b/client/net_nfc_client_manager.c @@ -57,12 +57,10 @@ static gboolean _set_activate_time_elapsed_callback(gpointer user_data) g_assert(func_data != NULL); - if (func_data != NULL) { - net_nfc_client_manager_set_active_completed callback = - (net_nfc_client_manager_set_active_completed)func_data->callback; + net_nfc_client_manager_set_active_completed callback = + (net_nfc_client_manager_set_active_completed)func_data->callback; - callback(func_data->result, func_data->user_data); - } + callback(func_data->result, func_data->user_data); g_free(func_data); @@ -91,6 +89,7 @@ static void manager_call_set_active_callback(GObject *source_object, } func_data->result = result; + net_nfc_client_get_nfc_state(&is_activated); if (is_activated == false) { diff --git a/client/net_nfc_client_snep.c b/client/net_nfc_client_snep.c index 232a6b0..0293218 100644 --- a/client/net_nfc_client_snep.c +++ b/client/net_nfc_client_snep.c @@ -125,7 +125,7 @@ static void snep_send_client_request(GObject *source_object, message, user_param); } - g_object_unref(parameter); + g_variant_unref(parameter); } } @@ -156,8 +156,6 @@ API net_nfc_error_e net_nfc_client_snep_start_server( GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data)); - g_object_ref(parameter); - if (net_nfc_gdbus_snep_call_server_start_sync(snep_proxy, GPOINTER_TO_UINT(target), sap, @@ -171,7 +169,7 @@ API net_nfc_error_e net_nfc_client_snep_start_server( DEBUG_ERR_MSG("snep server(sync call) failed: %s", error->message); g_error_free(error); - g_object_unref(parameter); + g_variant_unref(parameter); result = NET_NFC_UNKNOWN_ERROR; } @@ -206,8 +204,6 @@ API net_nfc_error_e net_nfc_client_snep_start_client( GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data)); - g_object_ref(parameter); - if (net_nfc_gdbus_snep_call_client_start_sync(snep_proxy, GPOINTER_TO_UINT(target), sap, @@ -221,7 +217,7 @@ API net_nfc_error_e net_nfc_client_snep_start_client( DEBUG_ERR_MSG("snep client(sync call) failed: %s", error->message); g_error_free(error); - g_object_unref(parameter); + g_variant_unref(parameter); result = NET_NFC_UNKNOWN_ERROR; } @@ -261,8 +257,6 @@ API net_nfc_error_e net_nfc_client_snep_send_client_request( GPOINTER_TO_UINT(user_data), GPOINTER_TO_UINT(target)); - g_object_ref(parameter); - ndef_msg = snep_message_to_variant(msg); net_nfc_gdbus_snep_call_client_request(snep_proxy, diff --git a/daemon/net_nfc_server_llcp.c b/daemon/net_nfc_server_llcp.c index c94ab1e..5996716 100644 --- a/daemon/net_nfc_server_llcp.c +++ b/daemon/net_nfc_server_llcp.c @@ -2816,7 +2816,7 @@ static void llcp_simple_listen_cb(net_nfc_llcp_socket_t socket, simple_data->user_data); } - g_free(simple_data); + /* 'simple_data' will be freed in socket error callback */ } static void llcp_simple_connect_cb(net_nfc_llcp_socket_t socket, @@ -2842,7 +2842,7 @@ static void llcp_simple_connect_cb(net_nfc_llcp_socket_t socket, simple_data->user_data); } - g_free(simple_data); + /* 'simple_data' will be freed in socket error callback */ } static void llcp_simple_server_error_cb(net_nfc_llcp_socket_t socket, diff --git a/daemon/net_nfc_server_manager.c b/daemon/net_nfc_server_manager.c index 466e091..4e03cb6 100644 --- a/daemon/net_nfc_server_manager.c +++ b/daemon/net_nfc_server_manager.c @@ -68,6 +68,8 @@ static void manager_active_thread_func(gpointer user_data); static net_nfc_error_e manager_active(void) { net_nfc_error_e result; + int ret; + int se_type; if (net_nfc_controller_is_ready(&result) == false) { @@ -76,7 +78,13 @@ static net_nfc_error_e manager_active(void) return result; } - result = net_nfc_server_se_change_se(SECURE_ELEMENT_TYPE_UICC); + /* keep_SE_select_value */ + ret = vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_type); + if (ret == 0) + { + DEBUG_SERVER_MSG("manager_active se_type [%d]",se_type); + result = net_nfc_server_se_change_se(se_type); + } /* register default snep server */ net_nfc_server_snep_default_server_register(); @@ -123,7 +131,25 @@ static net_nfc_error_e manager_deactive(void) /* unregister all services */ net_nfc_server_llcp_unregister_all(); - result = net_nfc_server_se_change_se(SECURE_ELEMENT_TYPE_INVALID); + /* keep_SE_select_value do not need to update vconf and gdbus_se_setting */ +// result = net_nfc_server_se_change_se(SECURE_ELEMENT_TYPE_INVALID); + + { + net_nfc_error_e result_ese, result_uicc; + + /*turn off ESE*/ + net_nfc_controller_set_secure_element_mode( + SECURE_ELEMENT_TYPE_ESE, + SECURE_ELEMENT_OFF_MODE, + &result_ese); + + /*turn off UICC*/ + net_nfc_controller_set_secure_element_mode( + SECURE_ELEMENT_TYPE_UICC, + SECURE_ELEMENT_OFF_MODE, + &result_uicc); + + } if (net_nfc_controller_configure_discovery( NET_NFC_DISCOVERY_MODE_STOP, diff --git a/daemon/net_nfc_server_se.c b/daemon/net_nfc_server_se.c index caf8c5e..47e400b 100644 --- a/daemon/net_nfc_server_se.c +++ b/daemon/net_nfc_server_se.c @@ -252,29 +252,37 @@ static void _se_uicc_status_noti_cb(TapiHandle *handle, if (gdbus_se_setting.busy == true) { net_nfc_error_e result = NET_NFC_OK; + int ret; + int se_type; DEBUG_SERVER_MSG("TAPI_SIM_STATUS_SIM_INIT_COMPLETED"); gdbus_se_setting.busy = false; - net_nfc_controller_set_secure_element_mode( - SECURE_ELEMENT_TYPE_UICC, - SECURE_ELEMENT_VIRTUAL_MODE, &result); - if (result == NET_NFC_OK) { - DEBUG_SERVER_MSG( - "changed to SECURE_ELEMENT_TYPE_UICC"); - net_nfc_server_se_set_se_type( - SECURE_ELEMENT_TYPE_UICC); - net_nfc_server_se_set_se_mode( - SECURE_ELEMENT_VIRTUAL_MODE); - if (vconf_set_int(VCONFKEY_NFC_SE_TYPE, - VCONFKEY_NFC_SE_TYPE_UICC) != 0) { - DEBUG_ERR_MSG("vconf_set_int failed"); + /* keep_SE_select_value */ + ret = vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_type); + if (ret == 0) + { + if (se_type == SECURE_ELEMENT_TYPE_UICC) + { + net_nfc_controller_set_secure_element_mode( + SECURE_ELEMENT_TYPE_UICC, + SECURE_ELEMENT_VIRTUAL_MODE, &result); + if (result == NET_NFC_OK) { + DEBUG_SERVER_MSG( + "changed to SECURE_ELEMENT_TYPE_UICC"); + net_nfc_server_se_set_se_type( + SECURE_ELEMENT_TYPE_UICC); + net_nfc_server_se_set_se_mode( + SECURE_ELEMENT_VIRTUAL_MODE); + } else { + DEBUG_ERR_MSG( + "SECURE_ELEMENT_TYPE_UICC, SECURE_ELEMENT_VIRTUAL_MODE failed [%d]", + result); + } + + } - } else { - DEBUG_ERR_MSG( - "SECURE_ELEMENT_TYPE_UICC, SECURE_ELEMENT_VIRTUAL_MODE failed [%d]", - result); } } break; diff --git a/packaging/nfc-manager.service b/packaging/nfc-manager.service index 0a7b2df..85be079 100644 --- a/packaging/nfc-manager.service +++ b/packaging/nfc-manager.service @@ -1,10 +1,11 @@ [Unit] Description=NFC manager -After=tizen-boot.target telephony.service +After=system-server.service +Requires=system-server.service [Service] Type=simple -ExecStart=/usr/bin/nfc-manager-daemon --dbus +ExecStart=/usr/bin/nfc-manager-daemon --daemon KillSignal=SIGKILL [Install] diff --git a/packaging/nfc-manager.spec b/packaging/nfc-manager.spec index ce48289..f82a8c9 100644 --- a/packaging/nfc-manager.spec +++ b/packaging/nfc-manager.spec @@ -109,10 +109,10 @@ fi %post -n nfc-client-lib /sbin/ldconfig vconftool set -t bool db/nfc/feature 0 -u 5000 -f -vconftool set -t int db/nfc/se_type 0 -u 5000 -f vconftool set -t bool db/nfc/predefined_item_state 0 -u 5000 -f vconftool set -t string db/nfc/predefined_item "None" -u 5000 -f vconftool set -t bool db/nfc/enable 0 -u 5000 -f +vconftool set -t int db/nfc/se_type 0 -u 5000 -f %postun /sbin/ldconfig