Added Gtest for nfc-manager 02/190602/2 submit/tizen/20181011.043956
authorLokesh <l.kasana@samsung.com>
Thu, 4 Oct 2018 04:49:32 +0000 (10:19 +0530)
committerJihoon Jung <jh8801.jung@samsung.com>
Thu, 11 Oct 2018 04:25:58 +0000 (13:25 +0900)
Overall coverage rate:
  lines......: 91.0% (2069 of 2273 lines)
  functions..: 97.2% (211 of 217 functions)

Change-Id: Ib779ca30fba1492794ad4874bccf194e30bc7534
Signed-off-by: Lokesh <l.kasana@samsung.com>
54 files changed:
CMakeLists.txt
packaging/nfc-manager.spec
src/commonlib/CMakeLists.txt
src/commonlib/net_nfc_util.c
src/commonlib/net_nfc_util_gdbus.c
src/commonlib/net_nfc_util_handover.c
src/commonlib/net_nfc_util_handover_bt.c
src/commonlib/net_nfc_util_handover_wfd.c
src/commonlib/net_nfc_util_handover_wps.c
src/commonlib/net_nfc_util_hce.c
src/commonlib/net_nfc_util_ndef_message.c
src/commonlib/net_nfc_util_ndef_record.c
src/commonlib/net_nfc_util_openssl.c
src/commonlib/net_nfc_util_sign_record.c
src/manager/addons/net_nfc_addon_hce.c
src/manager/addons/net_nfc_addon_hce_ndef.c
src/manager/addons/net_nfc_addon_hce_ppse.c
src/manager/addons/net_nfc_addon_hce_tmoney.c
src/manager/addons/net_nfc_addons.c
src/manager/net_nfc_app_util.c
src/manager/net_nfc_controller.c
src/manager/net_nfc_manager.c
src/manager/net_nfc_manager_util.c
src/manager/net_nfc_server.c
src/manager/net_nfc_server_common.c
src/manager/net_nfc_server_context.c
src/manager/net_nfc_server_handover.c
src/manager/net_nfc_server_handover_bt.c
src/manager/net_nfc_server_handover_wfd.c
src/manager/net_nfc_server_handover_wps.c
src/manager/net_nfc_server_hce.c
src/manager/net_nfc_server_hce_ipc.c
src/manager/net_nfc_server_llcp.c
src/manager/net_nfc_server_manager.c
src/manager/net_nfc_server_ndef.c
src/manager/net_nfc_server_p2p.c
src/manager/net_nfc_server_process_handover.c
src/manager/net_nfc_server_process_npp.c
src/manager/net_nfc_server_process_snep.c
src/manager/net_nfc_server_route_table.c
src/manager/net_nfc_server_se.c
src/manager/net_nfc_server_snep.c
src/manager/net_nfc_server_system_handler.c
src/manager/net_nfc_server_tag.c
src/manager/net_nfc_server_test.c
src/manager/net_nfc_server_transceive.c
src/manager/net_nfc_server_vconf.c
unittest/CMakeLists.txt [new file with mode: 0644]
unittest/gdbus.cpp [new file with mode: 0644]
unittest/gdbus.h [new file with mode: 0644]
unittest/manager.cpp [new file with mode: 0644]
unittest/manager.h [new file with mode: 0644]
unittest/nfcmgr.h [new file with mode: 0644]
unittest/unittest.cpp [new file with mode: 0644]

index 00c975e05848d5f5796cc264b2e2f4bf1e23e067..d851a464737eeeb980881545d80379c8c7335869 100644 (file)
@@ -1,13 +1,28 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(nfc-manager C CXX)
 
 MESSAGE("build nfc-common-lib and nfc-manager")
 
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(LIBDIR "${PREFIX}/lib")
 SET(MODULEDIR "${LIBDIR}/nfc")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror -fprofile-arcs -ftest-coverage")
 
 ADD_DEFINITIONS("-D_GNU_SOURCE")
 
+IF(BUILD_GTESTS)
+ADD_DEFINITIONS(-DBUILD_GCOV)
+ENDIF(BUILD_GTESTS)
+
+IF(BUILD_GCOV)
+       ADD_DEFINITIONS("-DTIZEN_TEST_GCOV")
+ENDIF(BUILD_GCOV)
+
 ADD_SUBDIRECTORY(src/commonlib)
 ADD_SUBDIRECTORY(src/manager)
 ADD_SUBDIRECTORY(haltests)
+
+IF(BUILD_GTESTS)
+ADD_SUBDIRECTORY(unittest)
+ENDIF(BUIILD_GTESTS)
+
index 9e367f8d4fe5b0bdd801fa41700bc48a27c4a3b2..360a3d5f364429bc703caea8b1efa0114339b47f 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       nfc-manager
 Summary:    NFC framework manager
-Version:    0.1.176
+Version:    0.1.177
 Release:    0
 Group:      Network & Connectivity/NFC
 License:    Flora-1.1
@@ -40,6 +40,10 @@ BuildRequires: pkgconfig(libsystemd-daemon)
 BuildRequires: python
 BuildRequires: python-xml
 
+%if 0%{?gtests:1}
+BuildRequires: pkgconfig(gmock)
+%endif
+
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
@@ -84,12 +88,20 @@ export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
 export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
 export CFLAGS="$CFLAGS -DTIZEN_TELEPHONY_ENABLED"
 
-export LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--as-needed"
+%if 0%{?gcov:1}
+export CFLAGS+=" -fprofile-arcs -ftest-coverage"
+export CXXFLAGS+=" -fprofile-arcs -ftest-coverage"
+export LDFLAGS+=" -lgcov"
+%endif
+
+export LDFLAGS+=" -Wl,--rpath=%{_prefix}/lib -Wl,--as-needed"
 LDFLAGS="$LDFLAGS" cmake . \
                -DTIZEN_ENGINEER_MODE=1 \
                -DCMAKE_INSTALL_PREFIX=%{_prefix} \
                -DTIZEN_TELEPHONY_ENABLED=1 \
                -DBIN_DIR=%{_bindir} \
+               -DBUILD_GTESTS=%{?gtests:1}%{!?gtests:0} \
+               -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0} \
 %ifarch aarch64 x86_64
                -DTIZEN_ARCH_64=1 \
 %endif
@@ -159,6 +171,9 @@ systemctl daemon-reload
 /usr/lib/systemd/system/multi-user.target.wants/%{name}.service
 %{_datadir}/dbus-1/system-services/org.tizen.NetNfcService.service
 /etc/dbus-1/system.d/org.tizen.NetNfcService.conf
+%if 0%{?gtests:1}
+%{_bindir}/gtest*
+%endif
 
 
 %files -n nfc-common-lib
index bc1a5da59951ec3f6036643c6b1fd9417b52e98e..3209b30c1e66d5bb2840a07a5a313df425021392 100755 (executable)
@@ -14,6 +14,8 @@ EXEC_PROGRAM(${GDBUS_CODEGEN} ARGS
                ${CMAKE_CURRENT_SOURCE_DIR}/net_nfc.xml \\
                ")
 
+#SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/net_nfc_gdbus.c PROPERTIES GENERATED TRUE)
+
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
 
 AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} COMMON_LIB_SRCS)
index 36045935e56cbc60729f5940e189824c328cf62d..2e237036ca8634e0fc29849bba1a9e5954003598 100755 (executable)
@@ -140,6 +140,7 @@ void net_nfc_manager_fini_log()
        }
 }
 
+/* LCOV_EXCL_START */
 NET_NFC_EXPORT_API void __net_nfc_util_free_mem(void **mem, char *filename, unsigned int line)
 {
        if (mem == NULL) {
@@ -628,6 +629,7 @@ bool net_nfc_util_binary_to_hex_string(data_s * data, char *out_buf, uint32_t ma
 
        return true;
 }
+/* LCOV_EXCL_STOP */
 
 int net_nfc_util_get_fd_from_systemd()
 {
index 8f88d9d69d33fc937cdbee617c772f1d909d0f39..de317177d340e19e0e3c5da3d43807b943bd1d32 100755 (executable)
@@ -24,6 +24,7 @@
 #include "net_nfc_util_gdbus_internal.h"
 #include "net_nfc_util_ndef_message.h"
 
+/* LCOV_EXCL_START */
 void net_nfc_util_gdbus_variant_to_buffer(GVariant * variant, uint8_t ** buffer, size_t * length)
 {
        GVariantIter *iter;
@@ -204,3 +205,4 @@ GVariant *net_nfc_util_gdbus_ndef_message_to_variant(const ndef_message_s * mess
 
        return variant;
 }
+/* LCOV_EXCL_STOP */
index 3d023b828b67aa989f005dc790221d6ad908edcc..a37cb592b09fcb92b8008d9e78cd406e99ccc094 100755 (executable)
@@ -29,6 +29,7 @@
        (__x.length == __y##_LEN) && \
        (memcmp(__x.buffer, __y, __y##_LEN) == 0))
 
+/* LCOV_EXCL_START */
 static gboolean _find_by_attribute_cb(GNode * node, gpointer data)
 {
        net_nfc_carrier_property_s *prop = node->data;
@@ -1325,3 +1326,4 @@ net_nfc_error_e net_nfc_util_get_selector_power_status(net_nfc_ch_message_s * me
 
        return error;
 }
+/* LCOV_EXCL_STOP */
index ec4caf4fbcc8ba16cef53fb0e8de4006b98a3ddf..d633839775907fa12f8bf04618a97351885867c5 100644 (file)
@@ -27,6 +27,7 @@
 #define CH_BT_MIME             "application/vnd.bluetooth.ep.oob"
 #define CH_BT_MIME_LEN         32
 
+/* LCOV_EXCL_START */
 bool net_nfc_util_handover_bt_check_carrier_record(ndef_record_s * record)
 {
        bool result;
@@ -232,3 +233,4 @@ net_nfc_error_e net_nfc_util_handover_bt_create_config_from_record(net_nfc_carri
 
        return result;
 }
+/* LCOV_EXCL_STOP */
index 8678c94d42517f593caff26c7269acbbeec635d4..59ecbf3a77fdaa7a2eeeb9e6817572e9c60155c5 100644 (file)
@@ -24,6 +24,7 @@
 #include "net_nfc_util_ndef_message.h"
 #include "net_nfc_util_handover.h"
 
+/* LCOV_EXCL_START */
 bool net_nfc_util_handover_wfd_check_carrier_record(ndef_record_s * record)
 {
        bool result;
@@ -325,3 +326,4 @@ net_nfc_error_e net_nfc_util_handover_wfd_create_record_from_config(ndef_record_
 
        return result;
 }
+/* LCOV_EXCL_STOP */
index d67e03470c8cf4d83c52d8e55216fd3a170bc34f..12bc06e293de7e8f8e176d5ef6b81d7168b4db47 100644 (file)
@@ -24,6 +24,7 @@
 #include "net_nfc_util_ndef_message.h"
 #include "net_nfc_util_handover.h"
 
+/* LCOV_EXCL_START */
 bool net_nfc_util_handover_wps_check_carrier_record(ndef_record_s * record)
 {
        bool result;
@@ -199,3 +200,4 @@ net_nfc_error_e net_nfc_util_handover_wps_create_record_from_config(ndef_record_
 
        return result;
 }
+/* LCOV_EXCL_STOP */
index 527b4dd5380db252b762153163452c10a79a06b2..41fc0516174db9156a28a35b8f56d80de66a662d 100755 (executable)
@@ -32,6 +32,7 @@ typedef struct _apdu_header_t {
        uint8_t data[0];
 } __attribute__ ((packed)) apdu_header_t;
 
+/* LCOV_EXCL_START */
 net_nfc_apdu_data_t *net_nfc_util_hce_create_apdu_data()
 {
        net_nfc_apdu_data_t *apdu_data;
@@ -136,3 +137,4 @@ net_nfc_error_e net_nfc_util_hce_generate_apdu(net_nfc_apdu_data_t * apdu_data,
 {
        return NET_NFC_NOT_SUPPORTED;
 }
+/* LCOV_EXCL_STOP */
index 3cc90aaa81ce9d4b2087d94ce15a0f02af9b9a8c..cf34468355e408025e205484ed3e1b54fbc47fda 100755 (executable)
@@ -37,6 +37,7 @@ typedef struct _ndef_header_t {
 
 static net_nfc_error_e __net_nfc_repair_record_flags(ndef_message_s * ndef_message);
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_util_check_ndef_message_rawdata(data_s * rawdata)
 {
        uint32_t offset = 0, records = 0;
@@ -765,3 +766,4 @@ void net_nfc_util_foreach_ndef_records(ndef_message_s * msg, net_nfc_foreach_nde
        }
 
 }
+/* LCOV_EXCL_STOP */
index 4d4691cf045e68d839f42c9b80c9c7e78d4d1488..b0c517d25375c8238a142a63e22eefd95d664787 100755 (executable)
@@ -20,6 +20,7 @@
 #include "net_nfc_util_ndef_message.h"
 #include "net_nfc_util_ndef_record.h"
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_util_free_record(ndef_record_s * record)
 {
        if (record == NULL)
@@ -302,3 +303,4 @@ net_nfc_error_e net_nfc_util_create_uri_string_from_uri_record(ndef_record_s * r
 
        return result;
 }
+/* LCOV_EXCL_STOP */
index afc0e0295f4dce19a215381c9f55cc5faa70d02c..8971b192b796ae87241809ac1f10641fe02edf6b 100755 (executable)
@@ -43,6 +43,7 @@
 //  return x509;
 //}
 
+/* LCOV_EXCL_START */
 static X509 *_load_certificate_from_mem(int format, uint8_t * buffer, uint32_t length, char *password)
 {
        X509 *x509 = NULL;
@@ -781,3 +782,4 @@ bool net_nfc_util_openssl_digest(const char *algorithm, const uint8_t * buffer,
 
        return ret;
 }
+/* LCOV_EXCL_STOP */
index 1b030bf76d09fa581d8abd4346fdba8fe3be779a..25edbbc1ffda53b40f508d196fac98bb161b0be4 100644 (file)
@@ -61,6 +61,7 @@ typedef struct _net_nfc_certificate_chain_s {
 
 #define __NEXT_SUB_FIELD(__dst) ((__dst)->value + (__dst)->length)
 
+/* LCOV_EXCL_START */
 bool _get_records_data_buffer(ndef_record_s * begin_record, ndef_record_s * end_record, uint8_t ** buffer, uint32_t * length)
 {
        bool result = false;
@@ -369,3 +370,4 @@ net_nfc_error_e net_nfc_util_sign_ndef_message(ndef_message_s * msg, char *cert_
 
        return result;
 }
+/* LCOV_EXCL_STOP */
index 15776d0c51f6796a5c3b3860efb133dd2bbb4ca5..6ca97fac7a81a822f04ad6b56e2b369934c85b71 100755 (executable)
@@ -51,6 +51,7 @@ size_t hce_addons_count = (sizeof(hce_addons) / sizeof(net_nfc_addon_hce_ops_t *
 
 static net_nfc_addon_hce_ops_t *selected_ops;
 
+/* LCOV_EXCL_START */
 static void __process_command(net_nfc_target_handle_s * handle, data_s * data)
 {
        net_nfc_apdu_data_t *apdu_data;
@@ -111,6 +112,7 @@ static void __hce_listener(net_nfc_target_handle_s * handle, int event, data_s *
                break;
        }
 }
+/* LCOV_EXCL_STOP */
 
 static void _nfc_addon_hce_init(void)
 {
@@ -123,9 +125,10 @@ static void _nfc_addon_hce_init(void)
        net_nfc_server_hce_start_hce_handler("nfc-manager", NULL, __hce_listener, NULL, NULL);
 
        for (i = 0; i < hce_addons_count; i++)
-               hce_addons[i]->init();
+               hce_addons[i]->init(); // LCOV_EXCL_LINE
 }
 
+/* LCOV_EXCL_START */
 static void _nfc_addon_hce_pause(void)
 {
        int i;
@@ -145,6 +148,7 @@ static void _nfc_addon_hce_resume(void)
        for (i = 0; i < hce_addons_count; i++)
                hce_addons[i]->resume();
 }
+/* LCOV_EXCL_STOP */
 
 static void _nfc_addon_hce_deinit(void)
 {
@@ -152,8 +156,8 @@ static void _nfc_addon_hce_deinit(void)
 
        DEBUG_ADDON_MSG(">>>>");
 
-       for (i = 0; i < hce_addons_count; i++)
-               hce_addons[i]->deinit();
+       for (i = 0; i < hce_addons_count; i++) // LCOV_EXCL_LINE
+               hce_addons[i]->deinit(); // LCOV_EXCL_LINE
 
        net_nfc_server_hce_stop_hce_handler("nfc-manager");
 }
index 9196e6351fbd3b91d0124ce51e8231d05849e5cd..518c69afd6a6095e58f8a877adcfbf3549bffa0f 100755 (executable)
@@ -92,6 +92,7 @@ static uint8_t *selected_fid;
 
 static bool enabled;
 
+/* LCOV_EXCL_START */
 static void __send_response(net_nfc_target_handle_s * handle, uint16_t sw, uint8_t * resp, size_t len)
 {
        size_t total_len = sizeof(sw);
@@ -285,6 +286,7 @@ static void __nfc_addon_hce_ndef_deinit(void)
 
        g_free(ndef_data);
 }
+/* LCOV_EXCL_STOP */
 
 net_nfc_addon_hce_ops_t net_nfc_addon_hce_ndef_ops = {
        .name = "HCE NDEF EMUL",
@@ -297,6 +299,7 @@ net_nfc_addon_hce_ops_t net_nfc_addon_hce_ndef_ops = {
        .listener = __nfc_addon_hce_ndef_listener,
 };
 
+/* LCOV_EXCL_START */
 void net_nfc_addon_hce_ndef_enable(void)
 {
        net_nfc_error_e result = NET_NFC_OK;
@@ -335,3 +338,4 @@ void net_nfc_addon_hce_ndef_disable(void)
                enabled = false;
        }
 }
+/* LCOV_EXCL_STOP */
index b057b286874234edcf999ba33eeaa6c65a03475c..a7adfc7ae6cbd79c07177fa40d555e9900140e24 100755 (executable)
@@ -35,6 +35,7 @@ static uint8_t ppse_aid[] = { '2', 'P', 'A', 'Y', '.', 'S', 'Y', 'S', '.', 'D',
 
 static bool selected;
 
+/* LCOV_EXCL_START */
 static size_t __put_tlv(uint8_t * out, size_t len, uint16_t t, uint16_t l, uint8_t * v)
 {
        size_t offset = 0;
@@ -264,6 +265,7 @@ static void _nfc_plugin_hce_ppse_deinit(void)
                        DEBUG_ERR_MSG("net_nfc_server_route_table_del_aid failed, [%d]", result);
        }
 }
+/* LCOV_EXCL_STOP */
 
 net_nfc_addon_hce_ops_t net_nfc_addon_hce_ppse_ops = {
        .name = "HCE PPSE EMUL",
index 7b5c92cfd3cd0843d9d03e8a821818d9b29c5dd0..b83ad227a67cfa8fd195c478d1412df85a2318a8 100644 (file)
@@ -44,6 +44,7 @@ static uint8_t tmoney_uid[] = { 'T', 'i', 'z', 'e', 'n', '1', '2', '3' };
 static bool selected;
 static bool enabled;
 
+/* LCOV_EXCL_START */
 static void __send_response(net_nfc_target_handle_s * handle, uint16_t sw, uint8_t * resp, size_t len)
 {
        size_t total_len = sizeof(sw);
@@ -210,6 +211,7 @@ static void _nfc_plugin_hce_tmoney_deinit(void)
 
        _plugin_hce_tmoney_disable();
 }
+/* LCOV_EXCL_STOP */
 
 net_nfc_addon_hce_ops_t net_nfc_addon_hce_tmoney_ops = {
        .name = "HCE T-MONEY EMUL",
index 2b424e2023db77369a1af6bd56903878b4a87d6b..a669f129955a4069716a6d1c98a9e8c400fa51da 100755 (executable)
@@ -43,6 +43,7 @@ net_nfc_error_e net_nfc_addons_init(void)
        return NET_NFC_OK;
 }
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_addons_pause(void)
 {
        int i;
@@ -62,6 +63,7 @@ net_nfc_error_e net_nfc_addons_resume(void)
 
        return NET_NFC_OK;
 }
+/* LCOV_EXCL_STOP */
 
 net_nfc_error_e net_nfc_addons_deinit(void)
 {
index 2e644d9abe80a1fe60a960b5bc41d34a01cf5987..b6aee70489e62f874af75fddd57ba192e8707fd2 100755 (executable)
@@ -71,6 +71,8 @@ static const char osp_launch_type_condition[] = "condition";
 typedef net_nfc_error_e(*process_message_cb) (ndef_message_s * msg);
 
 /* TEMP : process handover message */
+
+/* LCOV_EXCL_START */
 static void _process_carrier_record_cb(net_nfc_error_e result, net_nfc_conn_handover_carrier_type_e type, data_s * data, void *user_param)
 {
        data_s *message = (data_s *) user_param;
@@ -392,6 +394,7 @@ bool net_nfc_app_util_is_dir(const char *path_name)
        else
                return false;
 }
+/* LCOV_EXCL_STOP */
 
 void net_nfc_app_util_clean_storage(char *src_path)
 {
@@ -403,6 +406,7 @@ void net_nfc_app_util_clean_storage(char *src_path)
        if ((dir = opendir(src_path)) == NULL)
                return;
 
+       /* LCOV_EXCL_START */
        while ((ent = readdir(dir)) != NULL) {
                if (strncmp(ent->d_name, ".", 1) == 0 || strncmp(ent->d_name, "..", 2) == 0) {
                        continue;
@@ -421,8 +425,10 @@ void net_nfc_app_util_clean_storage(char *src_path)
        closedir(dir);
 
        rmdir(src_path);
+       /* LCOV_EXCL_STOP */
 }
 
+/* LCOV_EXCL_START */
 static void _to_lower_utf_8(char *str)
 {
        while (*str != 0) {
@@ -1148,3 +1154,4 @@ void net_nfc_app_util_show_notification(const char *signal, const char *param)
                notification_status_message_post(msg);
        }
 }
+/* LCOV_EXCL_STOP */
index 8bf4dde85048669920b5fd294ef510b4a362d853..0bed88b0b68242936718bd01a7783ddc154841c6 100755 (executable)
@@ -51,43 +51,43 @@ static void *net_nfc_controller_load_file(const char *dir_path, const char *file
        SECURE_MSG("path : %s", path);
 
        if (stat(path, &st) == -1) {
-               DEBUG_ERR_MSG("stat failed : file not found");
+               DEBUG_ERR_MSG("stat failed : file not found");  // LCOV_EXCL_LINE
                goto ERROR;
        }
 
        if (S_ISREG(st.st_mode) == 0) {
-               DEBUG_ERR_MSG("S_ISREG(st.st_mode) == 0");
+               DEBUG_ERR_MSG("S_ISREG(st.st_mode) == 0");      // LCOV_EXCL_LINE
                goto ERROR;
        }
 
        handle = dlopen(path, RTLD_LAZY);
        if (handle == NULL) {
-               DEBUG_ERR_MSG("dlopen failed, [%d] : %s", errno, dlerror());
+               DEBUG_ERR_MSG("dlopen failed, [%d] : %s", errno, dlerror());    // LCOV_EXCL_LINE
                goto ERROR;
        }
 
        onload = dlsym(handle, "onload");
        if (onload == NULL) {
-               DEBUG_ERR_MSG("dlsym failed, [%d] : %s", errno, dlerror());
+               DEBUG_ERR_MSG("dlsym failed, [%d] : %s", errno, dlerror());     // LCOV_EXCL_LINE
                goto ERROR;
        }
 
        memset(&g_interface, 0, sizeof(g_interface));
        if (onload(&g_interface) == false) {
-               DEBUG_ERR_MSG("onload failed");
+               DEBUG_ERR_MSG("onload failed"); // LCOV_EXCL_LINE
                goto ERROR;
        }
 
        if (net_nfc_controller_support_nfc(&result) == false) {
-               DEBUG_ERR_MSG("net_nfc_controller_support_nfc failed, [%d]", result);
+               DEBUG_ERR_MSG("net_nfc_controller_support_nfc failed, [%d]", result);   // LCOV_EXCL_LINE
                goto ERROR;
        }
 
        return handle;
 
  ERROR:
-       if (handle != NULL)
-               dlclose(handle);
+       if (handle != NULL)     // LCOV_EXCL_LINE
+               dlclose(handle);        // LCOV_EXCL_LINE
 
        return NULL;
 }
@@ -125,16 +125,16 @@ void *net_nfc_controller_onload()
                }
        }
 
-       closedir(dirp);
+       closedir(dirp); // LCOV_EXCL_LINE
 
        /* load default plugin */
-       handle = net_nfc_controller_load_file(NFC_MANAGER_MODULEDIR, NET_NFC_DEFAULT_PLUGIN);
+       handle = net_nfc_controller_load_file(NFC_MANAGER_MODULEDIR, NET_NFC_DEFAULT_PLUGIN);   // LCOV_EXCL_LINE
 
-       if (handle) {
-               SECURE_MSG("loaded default plugin : %s", NET_NFC_DEFAULT_PLUGIN);
+       if (handle) {   // LCOV_EXCL_LINE
+               SECURE_MSG("loaded default plugin : %s", NET_NFC_DEFAULT_PLUGIN);       // LCOV_EXCL_LINE
                return handle;
        } else {
-               SECURE_MSG("can not load default plugin : %s", NET_NFC_DEFAULT_PLUGIN);
+               SECURE_MSG("can not load default plugin : %s", NET_NFC_DEFAULT_PLUGIN); // LCOV_EXCL_LINE
                return NULL;
        }
 }
@@ -155,8 +155,8 @@ bool net_nfc_controller_init(net_nfc_error_e * result)
        if (g_interface.init != NULL) {
                return g_interface.init(result);
        } else {
-               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
-               DEBUG_SERVER_MSG("interface is null");
+               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;  // LCOV_EXCL_LINE
+               DEBUG_SERVER_MSG("interface is null");  // LCOV_EXCL_LINE
                return false;
        }
 }
@@ -176,12 +176,13 @@ bool net_nfc_controller_register_listener(target_detection_listener_cb target_de
        if (g_interface.register_listener != NULL) {
                return g_interface.register_listener(target_detection_listener, se_transaction_listener, llcp_event_listener, hce_apdu_listener, result);
        } else {
-               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
-               DEBUG_SERVER_MSG("interface is null");
+               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;  // LCOV_EXCL_LINE
+               DEBUG_SERVER_MSG("interface is null");  // LCOV_EXCL_LINE
                return false;
        }
 }
 
+/* LCOV_EXCL_START */
 bool net_nfc_controller_unregister_listener()
 {
        if (g_interface.unregister_listener != NULL) {
@@ -235,28 +236,31 @@ bool net_nfc_controller_get_stack_information(net_nfc_stack_information_s * stac
                return false;
        }
 }
+/* LCOV_EXCL_STOP */
 
 bool net_nfc_controller_configure_discovery(net_nfc_discovery_mode_e mode, net_nfc_event_filter_e config, net_nfc_error_e * result)
 {
        if (g_interface.configure_discovery != NULL) {
                return g_interface.configure_discovery(mode, config, result);
        } else {
-               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
-               DEBUG_SERVER_MSG("interface is null");
+               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;  // LCOV_EXCL_LINE
+               DEBUG_SERVER_MSG("interface is null");  // LCOV_EXCL_LINE
                return false;
        }
 }
 
+/* LCOV_EXCL_START */
 bool net_nfc_controller_get_secure_element_list(net_nfc_secure_element_info_s * list, int *count, net_nfc_error_e * result)
 {
        if (g_interface.get_secure_element_list != NULL) {
                return g_interface.get_secure_element_list(list, count, result);
        } else {
-               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
-               DEBUG_SERVER_MSG("interface is null");
+               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;  // LCOV_EXCL_LINE
+               DEBUG_SERVER_MSG("interface is null");  // LCOV_EXCL_LINE
                return false;
        }
 }
+/* LCOV_EXCL_STOP */
 
 bool net_nfc_controller_set_secure_element_mode(net_nfc_secure_element_type_e element_type, net_nfc_secure_element_mode_e mode, net_nfc_error_e * result)
 {
@@ -269,6 +273,7 @@ bool net_nfc_controller_set_secure_element_mode(net_nfc_secure_element_type_e el
        }
 }
 
+/* LCOV_EXCL_START */
 bool net_nfc_controller_secure_element_open(net_nfc_secure_element_type_e element_type, net_nfc_target_handle_s ** handle, net_nfc_error_e * result)
 {
        if (g_interface.secure_element_open != NULL) {
@@ -457,14 +462,15 @@ bool net_nfc_controller_exception_handler()
                return false;
        }
 }
+/* LCOV_EXCL_STOP */
 
 bool net_nfc_controller_is_ready(net_nfc_error_e * result)
 {
        if (g_interface.is_ready != NULL) {
                return g_interface.is_ready(result);
        } else {
-               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
-               DEBUG_SERVER_MSG("interface is null");
+               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;  // LCOV_EXCL_LINE
+               DEBUG_SERVER_MSG("interface is null");  // LCOV_EXCL_LINE
                return false;
        }
 }
@@ -474,12 +480,13 @@ bool net_nfc_controller_llcp_config(net_nfc_llcp_config_info_s * config, net_nfc
        if (g_interface.config_llcp != NULL) {
                return g_interface.config_llcp(config, result);
        } else {
-               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;
-               DEBUG_SERVER_MSG("interface is null");
+               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;  // LCOV_EXCL_LINE
+               DEBUG_SERVER_MSG("interface is null");  // LCOV_EXCL_LINE
                return false;
        }
 }
 
+/* LCOV_EXCL_START */
 bool net_nfc_controller_llcp_check_llcp(net_nfc_target_handle_s * handle, net_nfc_error_e * result)
 {
        if (g_interface.check_llcp_status != NULL) {
@@ -1032,6 +1039,7 @@ bool net_nfc_controller_test_mode_off(net_nfc_error_e * result)
                return false;
        }
 }
+/* LCOV_EXCL_STOP */
 
 bool net_nfc_controller_support_nfc(net_nfc_error_e * result)
 {
@@ -1044,6 +1052,7 @@ bool net_nfc_controller_support_nfc(net_nfc_error_e * result)
        }
 }
 
+/* LCOV_EXCL_START */
 bool net_nfc_controller_eedata_register_set(net_nfc_error_e * result, uint32_t mode, uint32_t reg_id, data_s * data)
 {
        if (g_interface.eedata_register_set != NULL) {
@@ -1120,6 +1129,7 @@ bool net_nfc_controller_secure_element_unroute_aid(data_s * aid, net_nfc_error_e
                return false;
        }
 }
+/* LCOV_EXCL_STOP */
 
 bool net_nfc_controller_secure_element_commit_routing(net_nfc_error_e * result)
 {
@@ -1131,6 +1141,7 @@ bool net_nfc_controller_secure_element_commit_routing(net_nfc_error_e * result)
        }
 }
 
+/* LCOV_EXCL_START */
 bool net_nfc_controller_secure_element_set_default_route(net_nfc_se_type_e switch_on, net_nfc_se_type_e switch_off, net_nfc_se_type_e battery_off, net_nfc_error_e * result)
 {
        if (g_interface.set_default_route != NULL) {
@@ -1160,6 +1171,7 @@ bool net_nfc_controller_secure_element_get_aid_table_size(int *AIDTableSize, net
                return false;
        }
 }
+/* LCOV_EXCL_STOP */
 
 bool net_nfc_controller_secure_element_set_route_entry(net_nfc_se_entry_type_e type, net_nfc_se_tech_protocol_type_e value, net_nfc_se_type_e route, int power, net_nfc_error_e * result)
 {
@@ -1181,6 +1193,7 @@ bool net_nfc_controller_secure_element_clear_routing_entry(net_nfc_se_entry_type
        }
 }
 
+/* LCOV_EXCL_START*/
 bool net_nfc_controller_secure_element_set_listen_tech_mask(net_nfc_se_tech_protocol_type_e value, net_nfc_error_e * result)
 {
        if (g_interface.set_listen_tech_mask != NULL) {
@@ -1191,6 +1204,7 @@ bool net_nfc_controller_secure_element_set_listen_tech_mask(net_nfc_se_tech_prot
                return false;
        }
 }
+/* LCOV_EXCL_STOP */
 
 bool net_nfc_controller_set_screen_state(net_nfc_screen_state_type_e screen_state, net_nfc_error_e * result)
 {
index 4100aeb4e84e1c7b500298a816a17b9527324f1a..7f06d9dace18eb9eff8940720a5ce395c5b5fb2b 100755 (executable)
@@ -59,11 +59,11 @@ static void _net_nfc_disable_ese()
                return;
 
        if (value == true) {
-               DEBUG_SERVER_MSG("Set the se_type , wallet mode HCE");
+               DEBUG_SERVER_MSG("Set the se_type , wallet mode HCE");  // LCOV_EXCL_LINE
 
-               vconf_set_int(VCONFKEY_NFC_SE_TYPE, VCONFKEY_NFC_SE_POLICY_HCE_ON);
+               vconf_set_int(VCONFKEY_NFC_SE_TYPE, VCONFKEY_NFC_SE_POLICY_HCE_ON);     // LCOV_EXCL_LINE
 
-               vconf_set_int(VCONFKEY_NFC_WALLET_MODE, VCONFKEY_NFC_WALLET_MODE_HCE);
+               vconf_set_int(VCONFKEY_NFC_WALLET_MODE, VCONFKEY_NFC_WALLET_MODE_HCE);  // LCOV_EXCL_LINE
        }
 }
 
@@ -105,12 +105,12 @@ static void on_bus_acquired(GDBusConnection * connection, const gchar * path, gp
 
        if (state == 1)
                net_nfc_server_manager_set_active(TRUE);
-       else if (net_nfc_check_mode_conditions())
-               net_nfc_server_manager_set_active(FALSE);
+       else if (net_nfc_check_mode_conditions())       // LCOV_EXCL_LINE
+               net_nfc_server_manager_set_active(FALSE);       // LCOV_EXCL_LINE
 #ifndef ESE_ALWAYS_ON
-       else if (use_daemon == TRUE) {
-               DEBUG_SERVER_MSG("exit process...");
-               net_nfc_server_controller_deinit();
+       else if (use_daemon == TRUE) {  // LCOV_EXCL_LINE
+               DEBUG_SERVER_MSG("exit process...");    // LCOV_EXCL_LINE
+               net_nfc_server_controller_deinit();     // LCOV_EXCL_LINE
        }
 #endif
 }
@@ -120,15 +120,26 @@ static void on_name_acquired(GDBusConnection * connection, const gchar * name, g
        SECURE_MSG("name : %s", name);
 }
 
+/* LCOV_EXCL_START */
 static void on_name_lost(GDBusConnection * connnection, const gchar * name, gpointer user_data)
 {
        SECURE_MSG("name : %s", name);
 
        net_nfc_manager_quit();
 }
+/* LCOV_EXCL_STOP */
 
 int main(int argc, char *argv[])
 {
+#ifdef TIZEN_TEST_GCOV
+       setenv("GCOV_PREFIX", "/tmp/daemon", 1);
+#endif
+
+#ifdef TIZEN_TEST_GCOV
+       void __gcov_flush(void); // if you use C++, you should declare extern "C" at out of the function.
+       __gcov_flush();
+#endif
+
        void *handle = NULL;
        guint id = 0;
        gboolean use_daemon = FALSE;
@@ -139,10 +150,10 @@ int main(int argc, char *argv[])
        g_option_context_add_main_entries(option_context, option_entries, NULL);
 
        if (g_option_context_parse(option_context, &argc, &argv, &error) == FALSE) {
-               DEBUG_ERR_MSG("can not parse option: %s", error->message);
-               g_error_free(error);
+               DEBUG_ERR_MSG("can not parse option: %s", error->message);      // LCOV_EXCL_LINE
+               g_error_free(error);    // LCOV_EXCL_LINE
 
-               g_option_context_free(option_context);
+               g_option_context_free(option_context);  // LCOV_EXCL_LINE
                return 0;
        }
 
@@ -155,13 +166,13 @@ int main(int argc, char *argv[])
 
        handle = net_nfc_controller_onload();
        if (handle == NULL) {
-               DEBUG_ERR_MSG("load plugin library is failed");
+               DEBUG_ERR_MSG("load plugin library is failed"); // LCOV_EXCL_LINE
 
-               if (vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_OFF) != 0)
-                       DEBUG_ERR_MSG("VCONFKEY_NFC_FEATURE set to %d failed", VCONFKEY_NFC_FEATURE_OFF);
+               if (vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_OFF) != 0)        // LCOV_EXCL_LINE
+                       DEBUG_ERR_MSG("VCONFKEY_NFC_FEATURE set to %d failed", VCONFKEY_NFC_FEATURE_OFF);       // LCOV_EXCL_LINE
 
-               if (vconf_set_bool(VCONFKEY_NFC_STATE, 0) != 0)
-                       DEBUG_ERR_MSG("VCONFKEY_NFC_STATE set to %d failed", 0);
+               if (vconf_set_bool(VCONFKEY_NFC_STATE, 0) != 0) // LCOV_EXCL_LINE
+                       DEBUG_ERR_MSG("VCONFKEY_NFC_STATE set to %d failed", 0);        // LCOV_EXCL_LINE
 
                goto EXIT;
        }
@@ -196,6 +207,7 @@ int main(int argc, char *argv[])
        return 0;
 }
 
+/* LCOV_EXCL_START */
 static bool net_nfc_check_mode_conditions()
 {
 #ifdef ENABLE_TELEPHONY
@@ -220,3 +232,4 @@ static bool net_nfc_check_mode_conditions()
 #endif
 
 }
+/* LCOV_EXCL_STOP */
index b674f808f8b50111a0cd97a91a2fb6db16ea02cc..d898f88136387303d4ca6c2c5710320855e02dc0 100755 (executable)
@@ -26,6 +26,7 @@
 #include "net_nfc_util_internal.h"
 #include "net_nfc_manager_util_internal.h"
 
+/* LCOV_EXCL_START */
 static void __focus_changed_cb(sound_stream_info_h stream_info, sound_stream_focus_mask_e focus_mask, sound_stream_focus_state_e focus_state, sound_stream_focus_change_reason_e reason_for_change, int sound_behavior, const char *additional_info, void *user_data)
 {
 
@@ -115,3 +116,4 @@ void net_nfc_manager_util_play_sound(net_nfc_sound_type_e sound_type)
                }
        }
 }
+/* LCOV_EXCL_STOP */
index bb3d1dd718fd9bbf7e83ff00745790984968088c..c7a96f8664535a71d0d30bbfd4a449574b05cf1c 100755 (executable)
@@ -125,69 +125,69 @@ void net_nfc_server_gdbus_init(void)
        net_nfc_server_gdbus_init_client_context();
 
        if (net_nfc_server_controller_thread_init() == FALSE) {
-               DEBUG_ERR_MSG("Can not init controller thread");
+               DEBUG_ERR_MSG("Can not init controller thread");        // LCOV_EXCL_LINE
                return;
        }
 
        _subscribe_name_owner_changed_event();
 
        if (net_nfc_server_manager_init(connection) == FALSE) {
-               DEBUG_ERR_MSG("Can not init manager");
+               DEBUG_ERR_MSG("Can not init manager");  // LCOV_EXCL_LINE
                return;
        }
 
        if (net_nfc_server_tag_init(connection) == FALSE) {
-               DEBUG_ERR_MSG("Can not init tag");
+               DEBUG_ERR_MSG("Can not init tag");      // LCOV_EXCL_LINE
                return;
        }
 
        if (net_nfc_server_ndef_init(connection) == FALSE) {
-               DEBUG_ERR_MSG("Can not init ndef");
+               DEBUG_ERR_MSG("Can not init ndef");     // LCOV_EXCL_LINE
                return;
        }
 
        if (net_nfc_server_llcp_init(connection) == FALSE) {
-               DEBUG_ERR_MSG("Can not init llcp");
+               DEBUG_ERR_MSG("Can not init llcp");     // LCOV_EXCL_LINE
                return;
        }
 
        if (net_nfc_server_p2p_init(connection) == FALSE) {
-               DEBUG_ERR_MSG("Can not init tag");
+               DEBUG_ERR_MSG("Can not init tag");      // LCOV_EXCL_LINE
                return;
        }
 
        if (net_nfc_server_transceive_init(connection) == FALSE) {
-               DEBUG_ERR_MSG("Can not initialize transceive");
+               DEBUG_ERR_MSG("Can not initialize transceive"); // LCOV_EXCL_LINE
                return;
        }
 
        if (net_nfc_server_test_init(connection) == FALSE) {
-               DEBUG_ERR_MSG("Can not init Test");
+               DEBUG_ERR_MSG("Can not init Test");     // LCOV_EXCL_LINE
                return;
        }
 
        if (net_nfc_server_handover_init(connection) == FALSE) {
-               DEBUG_ERR_MSG("Can not initialize transceive");
+               DEBUG_ERR_MSG("Can not initialize transceive"); // LCOV_EXCL_LINE
                return;
        }
 
        if (net_nfc_server_se_init(connection) == FALSE) {
-               DEBUG_ERR_MSG("Can not init Test");
+               DEBUG_ERR_MSG("Can not init Test");     // LCOV_EXCL_LINE
                return;
        }
 
        if (net_nfc_server_snep_init(connection) == FALSE) {
-               DEBUG_ERR_MSG("Can not init controller thread");
+               DEBUG_ERR_MSG("Can not init controller thread");        // LCOV_EXCL_LINE
                return;
        }
 
        if (net_nfc_server_system_handler_init(connection) == FALSE) {
-               DEBUG_ERR_MSG("Can not init controller thread");
+               DEBUG_ERR_MSG("Can not init controller thread");        // LCOV_EXCL_LINE
                return;
        }
 
        if (net_nfc_server_hce_init(connection) == FALSE) {
-               DEBUG_ERR_MSG("Can not init Test");
+               DEBUG_ERR_MSG("Can not init Test");     // LCOV_EXCL_LINE
                return;
        }
 }
index 6b8519371b38a7394bec5d6364b71c4f9594ae81..b7974bdba895b09c090110afc60238eb13c2c511 100755 (executable)
@@ -113,6 +113,7 @@ static void controller_thread_deinit_thread_func(gpointer user_data)
        controller_is_running = FALSE;
 }
 
+/* LCOV_EXCL_START */
 static net_nfc_current_target_info_s *_create_target_info(net_nfc_request_target_detected_t * msg)
 {
        net_nfc_current_target_info_s *info;
@@ -348,6 +349,7 @@ static void controller_init_thread_func(gpointer user_data)
 
        DEBUG_SERVER_MSG("net_nfc_server_llcp_set_config success");
 }
+/* LCOV_EXCL_STOP */
 
 #ifndef ESE_ALWAYS_ON
 static void controller_deinit_thread_func(gpointer user_data)
@@ -367,6 +369,8 @@ static void controller_deinit_thread_func(gpointer user_data)
        net_nfc_manager_quit();
 }
 #endif
+
+/* LCOV_EXCL_START */
 static void restart_polling_loop_thread_func(gpointer user_data)
 {
        gint state = 0;
@@ -447,6 +451,7 @@ static void quit_nfc_manager_loop_thread_func(gpointer user_data)
                        DEBUG_SERVER_MSG("NFC is ON!! No kill daemon!!");
        }
 }
+/* LCOV_EXCL_STOP */
 
 gboolean net_nfc_server_controller_thread_init(void)
 {
@@ -457,10 +462,10 @@ gboolean net_nfc_server_controller_thread_init(void)
        controller_thread = g_thread_try_new("controller_thread", controller_thread_func, NULL, &error);
 
        if (controller_thread == NULL) {
-               DEBUG_ERR_MSG("can not create controller thread");
-               if (error != NULL) {
-                       DEBUG_ERR_MSG("error msg : %s", error->message);
-                       g_error_free(error);
+               DEBUG_ERR_MSG("can not create controller thread");      // LCOV_EXCL_LINE
+               if (error != NULL) {    // LCOV_EXCL_LINE
+                       DEBUG_ERR_MSG("error msg : %s", error->message);        // LCOV_EXCL_LINE
+                       g_error_free(error);    // LCOV_EXCL_LINE
                }
                return FALSE;
        }
@@ -480,6 +485,7 @@ void net_nfc_server_controller_thread_deinit(void)
        controller_async_queue = NULL;
 }
 
+/* LCOV_EXCL_START */
 void net_nfc_server_controller_init(void)
 {
        if (net_nfc_server_controller_async_queue_push_force(controller_init_thread_func, NULL) == FALSE)
@@ -494,6 +500,7 @@ static inline gboolean _timeout_cb(gpointer data)
 
        return false;
 }
+/* LCOV_EXCL_STOP */
 
 static inline void _push_to_queue(guint msec, bool blocking, net_nfc_server_controller_func func, gpointer user_data)
 {
@@ -507,14 +514,14 @@ static inline void _push_to_queue(guint msec, bool blocking, net_nfc_server_cont
        if (__builtin_expect(msec == 0, true))
                g_async_queue_push(controller_async_queue, func_data);
        else
-               g_timeout_add(msec, _timeout_cb, func_data);
+               g_timeout_add(msec, _timeout_cb, func_data);    //LCOV_EXCL_LINE
 }
 
 #ifndef ESE_ALWAYS_ON
 void net_nfc_server_controller_deinit(void)
 {
        if (controller_async_queue == NULL) {
-               DEBUG_ERR_MSG("controller_async_queue is not initialized");
+               DEBUG_ERR_MSG("controller_async_queue is not initialized");     //LCOV_EXCL_LINE
 
                return;
        }
@@ -537,7 +544,7 @@ gboolean net_nfc_server_controller_is_blocked()
 gboolean net_nfc_server_controller_async_queue_delayed_push_force(guint msec, net_nfc_server_controller_func func, gpointer user_data)
 {
        if (controller_async_queue == NULL) {
-               DEBUG_ERR_MSG("controller_async_queue is not initialized");
+               DEBUG_ERR_MSG("controller_async_queue is not initialized");     //LCOV_EXCL_LINE
 
                return FALSE;
        }
@@ -579,6 +586,7 @@ gboolean net_nfc_server_controller_async_queue_push_and_block(net_nfc_server_con
        return TRUE;
 }
 
+/* LCOV_EXCL_START */
 void net_nfc_server_controller_run_dispatch_loop()
 {
        if (controller_async_queue == NULL)
@@ -645,24 +653,25 @@ guint32 net_nfc_server_get_state(void)
 {
        return server_state;
 }
+/* LCOV_EXCL_STOP */
 
 bool net_nfc_server_controller_init_sync(void)
 {
        net_nfc_error_e result;
 
        if (net_nfc_controller_init(&result) == false) {
-               DEBUG_ERR_MSG("net_nfc_controller_init failed, [%d]", result);
+               DEBUG_ERR_MSG("net_nfc_controller_init failed, [%d]", result);  //LCOV_EXCL_LINE
 
-               net_nfc_manager_quit();
+               net_nfc_manager_quit(); //LCOV_EXCL_LINE
                return false;
        }
 
        DEBUG_SERVER_MSG("net_nfc_controller_init success, [%d]", result);
 
        if (net_nfc_controller_register_listener(controller_target_detected_cb, controller_se_transaction_cb, controller_llcp_event_cb, controller_hce_apdu_cb, &result) == false) {
-               DEBUG_ERR_MSG("net_nfc_contorller_register_listener failed [%d]", result);
+               DEBUG_ERR_MSG("net_nfc_contorller_register_listener failed [%d]", result);      //LCOV_EXCL_LINE
 
-               net_nfc_manager_quit();
+               net_nfc_manager_quit(); //LCOV_EXCL_LINE
                return false;
        }
 
@@ -670,9 +679,9 @@ bool net_nfc_server_controller_init_sync(void)
 
        result = net_nfc_server_llcp_set_config(NULL);
        if (result != NET_NFC_OK) {
-               DEBUG_ERR_MSG("net_nfc_server_llcp_set config failed, [%d]", result);
+               DEBUG_ERR_MSG("net_nfc_server_llcp_set config failed, [%d]", result);   //LCOV_EXCL_LINE
 
-               net_nfc_manager_quit();
+               net_nfc_manager_quit(); //LCOV_EXCL_LINE
                return false;
        }
 
index ca8bb3561208d3aef86789d4a7d248e41277f936..d56bc4020001df88a233405c6e58c814bca9b882 100755 (executable)
@@ -119,26 +119,26 @@ static bool _get_credentials(GDBusMethodInvocation * invocation, net_nfc_privile
 
        ret = cynara_initialize(&p_cynara, NULL);
        if (ret != CYNARA_API_SUCCESS) {
-               DEBUG_SERVER_MSG("cynara_initialize() failed");
+               DEBUG_SERVER_MSG("cynara_initialize() failed"); // LCOV_EXCL_LINE
                return false;
        }
 
        ret = cynara_creds_gdbus_get_pid(connection, sender_unique_name, &pid);
        if (ret != CYNARA_API_SUCCESS) {
-               DEBUG_SERVER_MSG("cynara_creds_gdbus_get_pid() failed");
+               DEBUG_SERVER_MSG("cynara_creds_gdbus_get_pid() failed");        // LCOV_EXCL_LINE
                return false;
        }
 
        ret = cynara_creds_gdbus_get_user(connection, sender_unique_name, USER_METHOD_DEFAULT, &user);
        if (ret != CYNARA_API_SUCCESS) {
-               DEBUG_SERVER_MSG("cynara_creds_gdbus_get_user() failed");
+               DEBUG_SERVER_MSG("cynara_creds_gdbus_get_user() failed");       // LCOV_EXCL_LINE
                return false;
        }
 
        ret = cynara_creds_gdbus_get_client(connection, sender_unique_name, CLIENT_METHOD_DEFAULT, &client);
        if (ret != CYNARA_API_SUCCESS) {
-               DEBUG_SERVER_MSG("cynara_creds_gdbus_get_client() failed");
-               g_free(user);
+               DEBUG_SERVER_MSG("cynara_creds_gdbus_get_client() failed");     // LCOV_EXCL_LINE
+               g_free(user);   // LCOV_EXCL_LINE
                return false;
        }
 
@@ -160,10 +160,10 @@ static bool _get_credentials(GDBusMethodInvocation * invocation, net_nfc_privile
                break;
 
        case NET_NFC_PRIVILEGE_NFC_CARD_EMUL:
-               privilege = "http://tizen.org/privilege/nfc.cardemulation";
-               break;
+               privilege = "http://tizen.org/privilege/nfc.cardemulation";     // LCOV_EXCL_LINE
+               break;  // LCOV_EXCL_LINE
        default:
-               DEBUG_SERVER_MSG("Undifined privilege");
+               DEBUG_SERVER_MSG("Undifined privilege");        // LCOV_EXCL_LINE
                return false;
                break;
        }
@@ -171,9 +171,9 @@ static bool _get_credentials(GDBusMethodInvocation * invocation, net_nfc_privile
        client_session = cynara_session_from_pid(pid);
 
        if (!client_session) {
-               DEBUG_SERVER_MSG("cynara_session_from_pid() failed");
-               g_free(client);
-               g_free(user);
+               DEBUG_SERVER_MSG("cynara_session_from_pid() failed");   // LCOV_EXCL_LINE
+               g_free(client); // LCOV_EXCL_LINE
+               g_free(user);   // LCOV_EXCL_LINE
                return false;
        }
 
@@ -216,6 +216,7 @@ size_t net_nfc_server_gdbus_get_client_count_no_lock()
        return g_hash_table_size(client_contexts);
 }
 
+/* LCOV_EXCL_START */
 size_t net_nfc_server_gdbus_get_client_count()
 {
        size_t result;
@@ -228,6 +229,7 @@ size_t net_nfc_server_gdbus_get_client_count()
 
        return result;
 }
+/* LCOV_EXCL_STOP */
 
 net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context_no_lock(const char *id)
 {
@@ -251,6 +253,7 @@ net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context(const cha
        return result;
 }
 
+/* LCOV_EXCL_START */
 net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context_by_pid(pid_t pid)
 {
        net_nfc_client_context_info_t *result = NULL;
@@ -273,6 +276,7 @@ net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context_by_pid(pi
 
        return result;
 }
+/* LCOV_EXCL_STOP */
 
 void net_nfc_server_gdbus_add_client_context(const char *id, client_state_e state)
 {
@@ -335,6 +339,7 @@ void net_nfc_server_gdbus_cleanup_client_context(const char *id)
        pthread_mutex_unlock(&context_lock);
 }
 
+/* LCOV_EXCL_START */
 void net_nfc_server_gdbus_for_each_client_context(net_nfc_server_gdbus_for_each_client_cb cb, void *user_param)
 {
        GHashTableIter iter;
@@ -352,12 +357,14 @@ void net_nfc_server_gdbus_for_each_client_context(net_nfc_server_gdbus_for_each_
 
        pthread_mutex_unlock(&context_lock);
 }
+/* LCOV_EXCL_STOP */
 
 bool net_nfc_server_gdbus_check_client_is_running(const char *id)
 {
        return (net_nfc_server_gdbus_get_client_context(id) != NULL);
 }
 
+/* LCOV_EXCL_START */
 client_state_e net_nfc_server_gdbus_get_client_state(const char *id)
 {
        net_nfc_client_context_info_t *info;
@@ -535,6 +542,7 @@ void net_nfc_server_gdbus_decrease_se_count(const char *id)
 
        pthread_mutex_unlock(&context_lock);
 }
+/* LCOV_EXCL_STOP */
 
 bool net_nfc_server_gdbus_is_server_busy_no_lock()
 {
index 58bd3b1ce6019e1418eb1729360bf5b800cdbc84..1ffb94d3d0b574ae8dfaac93ef80887943d40bf0 100755 (executable)
@@ -28,6 +28,7 @@ static void handover_request_thread_func(gpointer user_data);
 
 static gboolean handover_handle_request(NetNfcGDbusHandover * hdover, GDBusMethodInvocation * invocation, guint32 arg_handle, gint32 arg_type, GVariant * smack_privilege, gpointer user_data);
 
+/* LCOV_EXCL_START */
 static void handover_request_thread_func(gpointer user_data)
 {
        HandoverRequestData *handover_data = (HandoverRequestData *) user_data;
@@ -118,25 +119,26 @@ net_nfc_error_e net_nfc_server_handover_emit_finished_signal(net_nfc_error_e res
 
        return NET_NFC_OK;
 }
+/* LCOV_EXCL_STOP */
 
 gboolean net_nfc_server_handover_init(GDBusConnection * connection)
 {
        GError *error = NULL;
 
        if (handover_skeleton)
-               g_object_unref(handover_skeleton);
+               g_object_unref(handover_skeleton); // LCOV_EXCL_LINE
 
        handover_skeleton = net_nfc_gdbus_handover_skeleton_new();
 
        g_signal_connect(handover_skeleton, "handle-request", G_CALLBACK(handover_handle_request), NULL);
 
        if (g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(handover_skeleton), connection, "/org/tizen/NetNfcService/Handover", &error) == FALSE) {
-               g_error_free(error);
+               g_error_free(error); // LCOV_EXCL_LINE
 
-               g_object_unref(handover_skeleton);
-               handover_skeleton = NULL;
+               g_object_unref(handover_skeleton); // LCOV_EXCL_LINE
+               handover_skeleton = NULL; // LCOV_EXCL_LINE
 
-               return FALSE;
+               return FALSE; // LCOV_EXCL_LINE
        }
 
        return TRUE;
index cd9fbb7e9fa1d175f59f84f24b3602c4a3f5ffe5..334b06ca747b52968e3dd769e87d85fa53ddf0cf 100755 (executable)
@@ -71,6 +71,7 @@ static int _bt_get_carrier_record(net_nfc_handover_bt_get_context_t * context);
 static int _bt_prepare_pairing(net_nfc_handover_bt_process_context_t * context);
 static int _bt_do_pairing(net_nfc_handover_bt_process_context_t * context);
 
+/* LCOV_EXCL_START */
 net_nfc_conn_handover_carrier_state_e net_nfc_server_handover_bt_get_cps()
 {
        net_nfc_conn_handover_carrier_state_e cps = NET_NFC_CONN_HANDOVER_CARRIER_INACTIVATE;
@@ -1140,3 +1141,4 @@ net_nfc_error_e net_nfc_server_handover_bt_do_pairing(net_nfc_ch_carrier_s * car
 
        return result;
 }
+/* LCOV_EXCL_STOP */
index 4c3552ad75c90ec88a9f5ec4625c25b6d59f6147..157e11c55d85e2701d14e87eb08258c84e64494b 100755 (executable)
@@ -51,6 +51,7 @@ typedef struct _device_info_attr_t {
        device_type_t secondary_devices[0];
 } __attribute__ ((packed)) device_info_attr_t;
 
+/* LCOV_EXCL_START */
 static void set_mac_address(char *data, uint8_t * origin_data)
 {
        int i, len = 0;
@@ -237,3 +238,4 @@ net_nfc_error_e net_nfc_server_handover_wfd_do_pairing(net_nfc_ch_carrier_s * ca
 
        return result;
 }
+/* LCOV_EXCL_STOP */
index 4cbe61aa73fc4adb52557bddcaf61034521dad22..f054f2d11d65456830a599921f502c38511f8545 100755 (executable)
@@ -35,6 +35,7 @@ typedef struct _wps_process_context_t {
        void *user_param;
 } wps_process_context_t;
 
+/* LCOV_EXCL_START */
 net_nfc_conn_handover_carrier_state_e net_nfc_server_handover_wps_get_cps()
 {
        int wifi_manager_state = 0;
@@ -104,13 +105,14 @@ static char *_wps_get_mac_address(net_nfc_carrier_config_s * config)
 
        return result;
 }
+/* LCOV_EXCL_STOP */
 
 static wifi_manager_security_type_e _wps_get_security_type(net_nfc_carrier_config_s * config)
 {
        wifi_manager_security_type_e result;
        uint16_t ret;
 
-       ret = _wps_get_short_property(config, NET_NFC_WIFI_ATTRIBUTE_AUTH_TYPE);
+       ret = _wps_get_short_property(config, NET_NFC_WIFI_ATTRIBUTE_AUTH_TYPE);        // LCOV_EXCL_LINE
 
        switch (ret) {
        case 1:                                 /* open */
@@ -150,7 +152,7 @@ static wifi_manager_encryption_type_e _wps_get_encryption_type(net_nfc_carrier_c
        wifi_manager_encryption_type_e result;
        uint16_t ret;
 
-       ret = _wps_get_short_property(config, NET_NFC_WIFI_ATTRIBUTE_ENC_TYPE);
+       ret = _wps_get_short_property(config, NET_NFC_WIFI_ATTRIBUTE_ENC_TYPE); // LCOV_EXCL_LINE
 
        switch (ret) {
        case 1:                                 /* None */
@@ -181,6 +183,7 @@ static wifi_manager_encryption_type_e _wps_get_encryption_type(net_nfc_carrier_c
        return result;
 }
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_server_handover_wps_get_selector_carrier(net_nfc_server_handover_get_carrier_cb cb, void *user_param)
 {
        net_nfc_error_e result = NET_NFC_NOT_SUPPORTED;
@@ -490,3 +493,4 @@ net_nfc_error_e net_nfc_server_handover_wps_do_connect(net_nfc_ch_carrier_s * ca
 
        return result;
 }
+/* LCOV_EXCL_STOP */
index f224b9641dfa14acaf2e8896cfec2f6d4a6a1900..7b9ad2ea29948d5ec39e0da053ecdd1c5250a7eb 100755 (executable)
@@ -179,6 +179,7 @@ static void _routing_table_iterate(route_table_iter_cb cb, void *user_data)
        }
 }
 
+/* LCOV_EXCL_START */
 static bool _del_by_id_cb(hce_listener_t * data, void *user_data)
 {
        const char *id = user_data;
@@ -206,6 +207,7 @@ static bool _del_by_id_cb(hce_listener_t * data, void *user_data)
 
        return result;
 }
+/* LCOV_EXCL_STOP */
 
 static void _routing_table_del_by_id(const char *id)
 {
@@ -239,6 +241,7 @@ net_nfc_error_e net_nfc_server_hce_stop_hce_handler(const char *package)
        return NET_NFC_OK;
 }
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_server_hce_stop_hce_handler_by_id(const char *id)
 {
        if (id == NULL || strlen(id) == 0)
@@ -265,6 +268,7 @@ net_nfc_error_e net_nfc_server_hce_send_apdu_response(net_nfc_target_handle_s *
 
        return result;
 }
+/* LCOV_EXCL_STOP */
 
 ////////////////////////////////////////////////////////////////////////////////
 #if 0
@@ -324,6 +328,8 @@ static void _hce_default_listener_cb(net_nfc_target_handle_s * handle, int event
        }
 }
 #else
+
+/* LCOV_EXCL_START */
 static void _hce_default_listener_cb(net_nfc_target_handle_s * handle, int event, data_s * data, void *user_data)
 {
        hce_client_context_s *context = (hce_client_context_s *) user_data;
@@ -681,6 +687,7 @@ void net_nfc_server_hce_handle_send_apdu_response(net_nfc_target_handle_s * hand
                g_free(data);
        }
 }
+/* LCOV_EXCL_STOP */
 
 /******************************************************************************/
 
@@ -692,6 +699,7 @@ typedef struct _apdu_header_t {
        uint8_t data[0];
 } __attribute__ ((packed)) apdu_header_t;
 
+/* LCOV_EXCL_START */
 static bool __extract_parameter(apdu_header_t * apdu, size_t len, uint16_t * lc, uint16_t * le, uint8_t ** data)
 {
        size_t l = sizeof(*apdu);
@@ -977,6 +985,7 @@ void net_nfc_server_hce_apdu_received(void *hce_event)
 
        _net_nfc_util_free_mem(hce_event);
 }
+/* LCOV_EXCL_STOP */
 
 static void _hce_on_client_detached_cb(net_nfc_client_context_info_t * info)
 {
index f05c931d6ff7e5d0daee782e9e00e6346eeedeb6..9265a1f65d71c07154b67e13844d5a42b599ad36 100755 (executable)
@@ -78,6 +78,7 @@ static void __set_non_block_socket(int socket)
                DEBUG_ERR_MSG("fcntl, executing nonblock error");
 }
 
+/* LCOV_EXCL_START */
 static pid_t __get_pid_by_socket(int socket)
 {
        struct ucred uc;
@@ -116,6 +117,7 @@ static void __on_client_value_destroy(gpointer data)
 
        DEBUG_SERVER_MSG("client removed, [%d]", g_hash_table_size(hce_clients));
 }
+/* LCOV_EXCL_STOP */
 
 static void __hce_client_init()
 {
@@ -123,6 +125,7 @@ static void __hce_client_init()
                hce_clients = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, __on_client_value_destroy);
 }
 
+/* LCOV_EXCL_START */
 static void __hce_client_add(int socket, GIOChannel * channel, guint source_id)
 {
        net_nfc_hce_client_t *client;
@@ -159,6 +162,7 @@ static void __hce_client_del(GIOChannel * channel)
 {
        g_hash_table_remove(hce_clients, (gconstpointer) channel);
 }
+/* LCOV_EXCL_STOP */
 
 static void __hce_client_clear()
 {
@@ -170,6 +174,7 @@ static net_nfc_hce_client_t *__hce_client_find(GIOChannel * channel)
        return (net_nfc_hce_client_t *) g_hash_table_lookup(hce_clients, (gconstpointer) channel);
 }
 
+/* LCOV_EXCL_START */
 static net_nfc_hce_client_t *__hce_client_find_by_id(const char *id)
 {
        net_nfc_hce_client_t *result = NULL;
@@ -364,6 +369,7 @@ static gboolean __on_io_event_cb(GIOChannel * channel, GIOCondition condition, g
 
        return TRUE;
 }
+/* LCOV_EXCL_STOP */
 
 bool net_nfc_server_hce_ipc_init()
 {
@@ -416,6 +422,7 @@ bool net_nfc_server_hce_ipc_init()
        return true;
 
  ERROR:
+/* LCOV_EXCL_START */
        if (hce_server_src_id > 0) {
                g_source_remove(hce_server_src_id);
                hce_server_src_id = 0;
@@ -432,6 +439,7 @@ bool net_nfc_server_hce_ipc_init()
 
                hce_server_socket = -1;
        }
+/* LCOV_EXCL_STOP */
 
        return false;
 }
@@ -457,6 +465,7 @@ void net_nfc_server_hce_ipc_deinit()
        }
 }
 
+/* LCOV_EXCL_START */
 static bool __send_data_to_client(int socket, data_s * data)
 {
        ssize_t ret;
@@ -548,3 +557,4 @@ bool net_nfc_server_hce_send_to_all_client(int type, net_nfc_target_handle_s * h
 
        return ret;
 }
+/* LCOV_EXCL_STOP */
index c2bdb869e6cb6df24044e2cf5d0be5d26cc1414a..18c95acc991a84f4c336238bbc9c910fa592daa4 100755 (executable)
@@ -269,6 +269,7 @@ static void llcp_simple_send_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e re
 
 static void llcp_simple_receive_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param);
 
+/* LCOV_EXCL_START */
 static void llcp_socket_error_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e result, data_s * data, void *extra, void *user_param)
 {
        llcp_client_data *client_data = (llcp_client_data *) user_param;
@@ -1578,10 +1579,11 @@ static void llcp_simple_receive_cb(net_nfc_llcp_socket_t socket, net_nfc_error_e
 
        g_free(simple_data);
 }
+/* LCOV_EXCL_STOP */
 
-static void _llcp_on_client_detached_cb(net_nfc_client_context_info_t * client)
+static void _llcp_on_client_detached_cb(net_nfc_client_context_info_t * client)        // LCOV_EXCL_LINE
 {
-       net_nfc_server_llcp_unregister_services(client->id);
+       net_nfc_server_llcp_unregister_services(client->id);    // LCOV_EXCL_LINE
 }
 
 /* Public Function */
@@ -1623,9 +1625,9 @@ gboolean net_nfc_server_llcp_init(GDBusConnection * connection)
        if (result == TRUE) {
                net_nfc_server_gdbus_register_on_client_detached_cb(_llcp_on_client_detached_cb);
        } else {
-               g_error_free(error);
+               g_error_free(error);    // LCOV_EXCL_LINE
 
-               net_nfc_server_llcp_deinit();
+               net_nfc_server_llcp_deinit();   // LCOV_EXCL_LINE
        }
 
        return result;
@@ -1650,12 +1652,13 @@ net_nfc_error_e net_nfc_server_llcp_set_config(net_nfc_llcp_config_info_s * conf
                return result;
        }
 
-       net_nfc_controller_llcp_config(config, &result);
-       memcpy(&llcp_config, config, sizeof(llcp_config));
+       net_nfc_controller_llcp_config(config, &result);        // LCOV_EXCL_LINE
+       memcpy(&llcp_config, config, sizeof(llcp_config));      // LCOV_EXCL_LINE
 
-       return result;
+       return result;  // LCOV_EXCL_LINE
 }
 
+/* LCOV_EXCL_START */
 guint16 net_nfc_server_llcp_get_miu(void)
 {
        return llcp_config.miu;
@@ -1901,6 +1904,7 @@ net_nfc_error_e net_nfc_server_llcp_simple_receive(net_nfc_target_handle_s * han
 
        return result;
 }
+/* LCOV_EXCL_STOP */
 
 typedef struct _service_t {
        uint32_t sap;
@@ -1953,12 +1957,12 @@ static net_nfc_error_e _llcp_add_service(const char *id, uint32_t sap, const cha
 
                        result = NET_NFC_OK;
                } else {
-                       DEBUG_ERR_MSG("alloc failed");
+                       DEBUG_ERR_MSG("alloc failed");  // LCOV_EXCL_LINE
 
                        result = NET_NFC_ALLOC_FAIL;
                }
        } else {
-               DEBUG_ERR_MSG("already registered");
+               DEBUG_ERR_MSG("already registered");    // LCOV_EXCL_LINE
 
                result = NET_NFC_ALREADY_REGISTERED;
        }
@@ -1966,6 +1970,7 @@ static net_nfc_error_e _llcp_add_service(const char *id, uint32_t sap, const cha
        return result;
 }
 
+/* LCOV_EXCL_START */
 static void _llcp_remove_service(uint32_t sap)
 {
        service_t *service = NULL;
@@ -1992,10 +1997,10 @@ static void _llcp_remove_services(const char *id)
        g_hash_table_iter_init(&iter, service_table);
 
        while (g_hash_table_iter_next(&iter, &key, (gpointer) & service)) {
-               if (id == NULL || strcmp(service->id, id) == 0) {
-                       g_free(service->san);
-                       g_free(service->id);
-                       g_free(service);
+               if (id == NULL || strcmp(service->id, id) == 0) {       // LCOV_EXCL_LINE
+                       g_free(service->san);   // LCOV_EXCL_LINE
+                       g_free(service->id);    // LCOV_EXCL_LINE
+                       g_free(service);        // LCOV_EXCL_LINE
 
                        g_hash_table_iter_remove(&iter);
                }
@@ -2015,12 +2020,14 @@ static void _llcp_start_services(net_nfc_target_handle_s * handle)
 {
        g_hash_table_foreach(service_table, _llcp_start_services_cb, handle);
 }
+/* LCOV_EXCL_STOP */
 
 net_nfc_error_e net_nfc_server_llcp_register_service(const char *id, sap_t sap, const char *san, net_nfc_server_llcp_activate_cb cb, void *user_param)
 {
        return _llcp_add_service(id, sap, san, cb, user_param);
 }
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_server_llcp_unregister_service(const char *id, sap_t sap, const char *san)
 {
        net_nfc_error_e result;
@@ -2049,6 +2056,7 @@ net_nfc_error_e net_nfc_server_llcp_unregister_services(const char *id)
 
        return NET_NFC_OK;
 }
+/* LCOV_EXCL_STOP */
 
 net_nfc_error_e net_nfc_server_llcp_unregister_all()
 {
@@ -2074,6 +2082,7 @@ net_nfc_error_e net_nfc_server_llcp_unregister_all()
        return NET_NFC_OK;
 }
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_server_llcp_start_registered_services(net_nfc_target_handle_s * handle)
 {
        _llcp_start_services(handle);
@@ -2145,3 +2154,4 @@ bool net_nfc_server_llcp_target_detected(void *info)
 
        return true;
 }
+/* LCOV_EXCL_STOP */
index 5793153d55d108c8ddc37af985a526754fc54f41..7d40d988460e99f04f65f8815887563a822ee7c1 100755 (executable)
@@ -92,11 +92,12 @@ static net_nfc_error_e manager_active(void)
        if (net_nfc_controller_configure_discovery(NET_NFC_DISCOVERY_MODE_START, NET_NFC_ALL_ENABLE, &result) == true) {
                /* vconf on */
                if (vconf_set_bool(VCONFKEY_NFC_STATE, TRUE) != 0) {
-                       DEBUG_ERR_MSG("vconf_set_bool is failed");
+                       DEBUG_ERR_MSG("vconf_set_bool is failed");      // LCOV_EXCL_LINE
 
-                       result = NET_NFC_OPERATION_FAIL;
+                       result = NET_NFC_OPERATION_FAIL;        // LCOV_EXCL_LINE
                }
        } else {
+/* LCOV_EXCL_START */
                DEBUG_ERR_MSG("net_nfc_controller_configure_discovery is failed, [%d]", result);
 
                net_nfc_server_controller_init();
@@ -105,6 +106,7 @@ static net_nfc_error_e manager_active(void)
 
                /* ADD TEMPORARY ABORT FOR DEBUG */
                //abort();
+/* LCOV_EXCL_STOP */
        }
 
        return result;
@@ -215,6 +217,7 @@ static gboolean manager_handle_set_active(NetNfcGDbusManager * manager, GDBusMet
        data->is_active = arg_is_active;
 
        if (data->is_active == true) {
+/* LCOV_EXCL_START */
                net_nfc_error_e check_result;
                INFO_MSG("Daemon alive, But check the nfc device state.");
 
@@ -225,6 +228,7 @@ static gboolean manager_handle_set_active(NetNfcGDbusManager * manager, GDBusMet
                        net_nfc_server_controller_init();
                } else
                        INFO_MSG("nfc is already active!!!!!!");
+/* LCOV_EXCL_STOP */
        }
 
        if (net_nfc_server_controller_async_queue_push_and_block(manager_handle_active_thread_func, data) == FALSE) {
@@ -237,6 +241,7 @@ static gboolean manager_handle_set_active(NetNfcGDbusManager * manager, GDBusMet
 
        return TRUE;
 
+/* LCOV_EXCL_START */
  ERROR:
        if (data != NULL) {
                g_object_unref(data->invocation);
@@ -272,6 +277,7 @@ static gboolean manager_handle_get_server_state(NetNfcGDbusManager * manager, GD
 
        return TRUE;
 }
+/* LCOV_EXCL_STOP */
 
 /* server side */
 static void manager_active_thread_func(gpointer user_data)
@@ -350,16 +356,16 @@ void net_nfc_server_manager_set_active(gboolean is_active)
        net_nfc_error_e result;
 
        if (manager_skeleton == NULL) {
-               DEBUG_ERR_MSG("net_nfc_server_manager is not initialized");
+               DEBUG_ERR_MSG("net_nfc_server_manager is not initialized");     // LCOV_EXCL_LINE
 
-               return;
+               return; // LCOV_EXCL_LINE
        }
 
        DEBUG_SERVER_MSG("is_active %d", is_active);
 
        data = g_try_new0(ManagerActivationData, 1);
        if (data == NULL) {
-               DEBUG_ERR_MSG("Memory allocation failed");
+               DEBUG_ERR_MSG("Memory allocation failed");      // LCOV_EXCL_LINE
 
                return;
        }
@@ -373,20 +379,21 @@ void net_nfc_server_manager_set_active(gboolean is_active)
                net_nfc_controller_is_ready(&result);
 
                if (result != NET_NFC_OK) {
-                       INFO_MSG("nfc is not active. so call net_nfc_server_controller_init");
-                       net_nfc_server_controller_init();
+                       INFO_MSG("nfc is not active. so call net_nfc_server_controller_init");  // LCOV_EXCL_LINE
+                       net_nfc_server_controller_init();       // LCOV_EXCL_LINE
                } else
                        INFO_MSG("nfc is already active!!!!!!");
        }
 
        if (net_nfc_server_controller_async_queue_push(manager_active_thread_func, data) == FALSE) {
-               DEBUG_ERR_MSG("can not push to controller thread");
+               DEBUG_ERR_MSG("can not push to controller thread");     // LCOV_EXCL_LINE
 
-               g_object_unref(data->manager);
-               g_free(data);
+               g_object_unref(data->manager);  // LCOV_EXCL_LINE
+               g_free(data);   // LCOV_EXCL_LINE
        }
 }
 
+/* LCOV_EXCL_START */
 bool net_nfc_server_manager_get_active()
 {
        int value;
@@ -396,3 +403,4 @@ bool net_nfc_server_manager_get_active()
 
        return (!!value);
 }
+/* LCOV_EXCL_STOP */
index 318e2de18549092f5a447f69d2a58a4e55d96c75..86123f84db5b25b84be3a53b1b6db0ab0912aab3 100755 (executable)
@@ -79,6 +79,7 @@ static gboolean ndef_handle_make_read_only(NetNfcGDbusNdef * ndef, GDBusMethodIn
 
 static gboolean ndef_handle_format(NetNfcGDbusNdef * ndef, GDBusMethodInvocation * invocation, guint32 arg_handle, GVariant * arg_key, GVariant * smack_privilege, gpointer user_data);
 
+/* LCOV_EXCL_START */
 static void ndef_read_thread_func(gpointer user_data)
 {
        ReadData *data = user_data;
@@ -400,6 +401,7 @@ static gboolean ndef_handle_format(NetNfcGDbusNdef * ndef, GDBusMethodInvocation
 
        return TRUE;
 }
+/* LCOV_EXCL_STOP */
 
 gboolean net_nfc_server_ndef_init(GDBusConnection * connection)
 {
index faaf0d67cc8c1177ca45db67ccaeecda02031482..805c42cb483fc68569ec3c907d2f892a9ffd4445 100755 (executable)
@@ -42,6 +42,7 @@ static gboolean p2p_handle_send(NetNfcGDbusP2p * p2p, GDBusMethodInvocation * in
 
 static NetNfcGDbusP2p *p2p_skeleton = NULL;
 
+/* LCOV_EXCL_START */
 static void p2p_send_data_thread_func(gpointer user_data)
 {
        P2pSendData *p2p_data = (P2pSendData *) user_data;
@@ -130,6 +131,7 @@ static gboolean p2p_handle_send(NetNfcGDbusP2p * p2p, GDBusMethodInvocation * in
 
        return TRUE;
 }
+/* LCOV_EXCL_STOP */
 
 gboolean net_nfc_server_p2p_init(GDBusConnection * connection)
 {
@@ -153,6 +155,7 @@ gboolean net_nfc_server_p2p_init(GDBusConnection * connection)
        return result;
 }
 
+/* LCOV_EXCL_START */
 void net_nfc_server_p2p_deinit(void)
 {
        if (p2p_skeleton) {
@@ -223,3 +226,4 @@ void net_nfc_server_p2p_data_sent(net_nfc_error_e result, gpointer user_data)
 
        g_free(data);
 }
+/* LCOV_EXCL_STOP */
index bbf79f742943aad500120394565df2b200ecf014..2a9d56e4dfc1e1e93150eeea4ceaffa746c631d9 100755 (executable)
@@ -102,6 +102,7 @@ static net_nfc_error_e _net_nfc_server_handover_create_low_power_selector_messag
 #endif
 ////////////////////////////////////////////////////////////////////////////
 
+/* LCOV_EXCL_START */
 static void _send_response(net_nfc_error_e result, net_nfc_conn_handover_carrier_type_e carrier, data_h ac_data, void *user_param)
 {
        HandoverRequestData *handover_data = (HandoverRequestData *) user_param;
@@ -790,6 +791,7 @@ static net_nfc_error_e _process_selector_carrier(net_nfc_ch_carrier_s * carrier,
 
        return result;
 }
+/* LCOV_EXCL_STOP */
 
 #if 0
 static net_nfc_error_e _net_nfc_server_handover_snep_client_cb(net_nfc_snep_handle_h handle, net_nfc_error_e result, uint32_t type, data_s * data, void *user_param)
@@ -1004,6 +1006,7 @@ static net_nfc_error_e _net_nfc_server_handover_create_server_cb(net_nfc_snep_ha
 }
 #else
 
+/* LCOV_EXCL_START */
 static net_nfc_error_e _select_carrier_record(net_nfc_ch_message_s * request, net_nfc_ch_carrier_s ** carrier)
 {
        net_nfc_error_e result;
@@ -1444,6 +1447,7 @@ net_nfc_error_e net_nfc_server_handover_default_server_start(net_nfc_target_hand
 
        return result;
 }
+/* LCOV_EXCL_STOP */
 
 static void _handover_default_activate_cb(int event, net_nfc_target_handle_s * handle, uint32_t sap, const char *san, void *user_param)
 {
@@ -1452,6 +1456,7 @@ static void _handover_default_activate_cb(int event, net_nfc_target_handle_s * h
        DEBUG_SERVER_MSG("event [%d], handle [%p], sap [%d], san [%s]", event, handle, sap, san);
 
        if (event == NET_NFC_LLCP_START) {
+               /* LCOV_EXCL_START */
                /* start default handover server using snep */
                result = net_nfc_server_snep_default_server_register_get_response_cb(_get_response_cb, NULL);
 
@@ -1461,6 +1466,7 @@ static void _handover_default_activate_cb(int event, net_nfc_target_handle_s * h
                        DEBUG_SERVER_MSG("start handover server, san [%s], sap [%d]", CH_SAN, CH_SAP);
                else
                        DEBUG_ERR_MSG("net_nfc_service_llcp_server failed, [%d]", result);
+               /* LCOV_EXCL_STOP */
        } else if (event == NET_NFC_LLCP_UNREGISTERED) {
                /* unregister server, do nothing */
        }
@@ -1477,6 +1483,7 @@ net_nfc_error_e net_nfc_server_handover_default_server_register()
        return net_nfc_server_llcp_register_service(id, CH_SAP, CH_SAN, _handover_default_activate_cb, NULL);
 }
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_server_handover_default_server_unregister()
 {
        char id[20];
@@ -1735,3 +1742,4 @@ net_nfc_error_e net_nfc_server_handover_default_client_start(net_nfc_target_hand
 
        return result;
 }
+/* LCOV_EXCL_STOP */
index caa4fbbcd54bde793b67699373ba20b03b9ba6a2..75ef765d7b819e34d7a7b4ed52a1c5dd1036019c 100755 (executable)
@@ -92,6 +92,7 @@ static void npp_default_server_cb(net_nfc_error_e result, data_s * data, gpointe
 
 static void npp_default_client_cb(net_nfc_error_e result, data_s * data, gpointer user_data);
 
+/* LCOV_EXCL_START */
 static net_nfc_error_e npp_create_message(data_s * data, data_s * message)
 {
        size_t length = NPP_HEADER_LEN;
@@ -536,6 +537,7 @@ net_nfc_error_e net_nfc_server_npp_default_server_start(net_nfc_target_handle_s
        /* start default npp server */
        return net_nfc_server_npp_server(handle, NPP_SAN, NPP_SAP, npp_default_server_cb, (gpointer) 1234);
 }
+/* LCOV_EXCL_STOP */
 
 static void _npp_default_activate_cb(int event, net_nfc_target_handle_s * handle, uint32_t sap, const char *san, void *user_param)
 {
@@ -545,9 +547,9 @@ static void _npp_default_activate_cb(int event, net_nfc_target_handle_s * handle
 
        if (event == NET_NFC_LLCP_START) {
                /* start default npp server */
-               result = net_nfc_server_npp_server(handle, (char *)san, sap, npp_default_server_cb, user_param);
-               if (result != NET_NFC_OK)
-                       DEBUG_ERR_MSG("net_nfc_server_npp_server failed, [%d]", result);
+               result = net_nfc_server_npp_server(handle, (char *)san, sap, npp_default_server_cb, user_param);        //LCOV_EXCL_LINE
+               if (result != NET_NFC_OK)       //LCOV_EXCL_LINE
+                       DEBUG_ERR_MSG("net_nfc_server_npp_server failed, [%d]", result);        //LCOV_EXCL_LINE
        } else if (event == NET_NFC_LLCP_UNREGISTERED) {
                /* unregister server, do nothing */
        }
@@ -564,6 +566,7 @@ net_nfc_error_e net_nfc_server_npp_default_server_register()
        return net_nfc_server_llcp_register_service(id, NPP_SAP, NPP_SAN, _npp_default_activate_cb, NULL);
 }
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_server_npp_default_server_unregister()
 {
        char id[20];
@@ -610,3 +613,4 @@ net_nfc_error_e net_nfc_server_npp_default_client_start(net_nfc_target_handle_s
 
        return result;
 }
+/* LCOV_EXCL_STOP */
index 8495ae3b10860c4440363fad9ea57365d84b35bf..97ecd277144178a52ffafef09027af387c62deb1 100755 (executable)
@@ -129,6 +129,7 @@ static void _net_nfc_server_snep_client_process(net_nfc_server_snep_job_t * job)
 static void _net_nfc_server_snep_server_process(net_nfc_server_snep_context_t * context);
 
 /**********************************************************************/
+/* LCOV_EXCL_START */
 static bool _net_nfc_server_snep_add_get_response_cb(net_nfc_server_snep_listen_cb cb, void *user_param)
 {
        net_nfc_server_cb_data_t *data = NULL;
@@ -1470,6 +1471,7 @@ net_nfc_error_e net_nfc_server_snep_default_server_send_get_response(net_nfc_sne
 
        return result;
 }
+/* LCOV_EXCL_STOP */
 
 static void _snep_default_activate_cb(int event, net_nfc_target_handle_s * handle, uint32_t sap, const char *san, void *user_param)
 {
@@ -1479,9 +1481,9 @@ static void _snep_default_activate_cb(int event, net_nfc_target_handle_s * handl
 
        if (event == NET_NFC_LLCP_START) {
                /* start snep server */
-               result = net_nfc_server_snep_server(handle, (char *)san, sap, _net_nfc_server_default_server_cb_, user_param);
-               if (result != NET_NFC_OK)
-                       DEBUG_ERR_MSG("net_nfc_service_snep_server failed, [%d]", result);
+               result = net_nfc_server_snep_server(handle, (char *)san, sap, _net_nfc_server_default_server_cb_, user_param);  //LCOV_EXCL_LINE
+               if (result != NET_NFC_OK)       //LCOV_EXCL_LINE
+                       DEBUG_ERR_MSG("net_nfc_service_snep_server failed, [%d]", result);      //LCOV_EXCL_LINE
        } else if (event == NET_NFC_LLCP_UNREGISTERED) {
                /* unregister server, do nothing */
        }
@@ -1498,6 +1500,7 @@ net_nfc_error_e net_nfc_server_snep_default_server_register()
        return net_nfc_server_llcp_register_service(id, SNEP_SAP, SNEP_SAN, _snep_default_activate_cb, NULL);
 }
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_server_snep_default_server_unregister()
 {
        char id[20];
@@ -1527,3 +1530,4 @@ net_nfc_error_e net_nfc_server_snep_parse_get_request(data_s * request, size_t *
 
        return NET_NFC_OK;
 }
+/* LCOV_EXCL_STOP */
index aaed90bfbad39c3726bb1071156bebde33e20fa4..2e7cafb20ddfc55bd3877269494cadbc6b2ebd43 100755 (executable)
@@ -69,23 +69,23 @@ static bool __is_table_existing(const char *table)
                                if (count > 0)
                                        result = true;
                                else
-                                       result = false;
+                                       result = false; //LCOV_EXCL_LINE
                        } else {
-                               DEBUG_ERR_MSG("sqlite3_step failed, [%d:%s]", ret, sqlite3_errmsg(db));
+                               DEBUG_ERR_MSG("sqlite3_step failed, [%d:%s]", ret, sqlite3_errmsg(db)); //LCOV_EXCL_LINE
 
                                result = false;
                        }
 
                        sqlite3_finalize(stmt);
                } else {
-                       DEBUG_ERR_MSG("sqlite3_prepare_v2 failed, [%d:%s]", ret, sqlite3_errmsg(db));
+                       DEBUG_ERR_MSG("sqlite3_prepare_v2 failed, [%d:%s]", ret, sqlite3_errmsg(db));   //LCOV_EXCL_LINE
 
                        result = false;
                }
 
                sqlite3_free(sql);
        } else {
-               DEBUG_ERR_MSG("sqlite3_mprintf failed");
+               DEBUG_ERR_MSG("sqlite3_mprintf failed");        //LCOV_EXCL_LINE
 
                result = false;
        }
@@ -93,6 +93,7 @@ static bool __is_table_existing(const char *table)
        return result;
 }
 
+/* LCOV_EXCL_START */
 static void __create_table()
 {
        int ret;
@@ -114,6 +115,7 @@ static void __create_table()
                DEBUG_ERR_MSG("sqlite3_mprintf failed");
        }
 }
+/* LCOV_EXCL_STOP */
 
 static int __check_integrity()
 {
@@ -153,7 +155,7 @@ static int __check_integrity()
 static void __prepare_table()
 {
        if (__is_table_existing(NFC_ROUTE_TABLE_DB_TABLE) == false)
-               __create_table();
+               __create_table();       //LCOV_EXCL_LINE
 }
 
 static void __initialize_db()
@@ -164,12 +166,13 @@ static void __initialize_db()
        if (db == NULL) {
                result = sqlite3_open_v2(NFC_ROUTE_TABLE_DB_FILE, &db, SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL);
                if (result != SQLITE_OK) {
-                       DEBUG_ERR_MSG("sqlite3_open_v2 failed, [%d]", result);
+                       DEBUG_ERR_MSG("sqlite3_open_v2 failed, [%d]", result);  //LCOV_EXCL_LINE
 
                        goto ERR;
                }
 
                if (__check_integrity() < 0) {
+                       /* LCOV_EXCL_START */
                        DEBUG_ERR_MSG("Failed to check integrity");
                        unlink(NFC_ROUTE_TABLE_DB_FILE);
                        db = NULL;
@@ -179,13 +182,14 @@ static void __initialize_db()
 
                                goto ERR;
                        }
+                       /* LCOV_EXCL_STOP */
                }
 
                /* Enable persist journal mode */
                result = sqlite3_exec(db, "PRAGMA journal_mode = PERSIST", NULL, NULL, &error);
                if (result != SQLITE_OK) {
-                       DEBUG_ERR_MSG("Fail to change journal mode: %s", error);
-                       sqlite3_free(error);
+                       DEBUG_ERR_MSG("Fail to change journal mode: %s", error);        //LCOV_EXCL_LINE
+                       sqlite3_free(error);    //LCOV_EXCL_LINE
 
                        goto ERR;
                }
@@ -196,6 +200,7 @@ static void __initialize_db()
        return;
 
  ERR:
+/* LCOV_EXCL_START */
        if (db != NULL) {
                result = sqlite3_close(db);
                if (result == SQLITE_OK)
@@ -223,6 +228,7 @@ static void __finalize_db()
                        DEBUG_ERR_MSG("sqlite3_close failed, [%d]", result);
        }
 }
+/* LCOV_EXCL_STOP */
 
 static void __iterate_db(_iterate_db_cb cb, void *user_data)
 {
@@ -247,6 +253,7 @@ static void __iterate_db(_iterate_db_cb cb, void *user_data)
                        bool manifest;
 
                        while ((ret = sqlite3_step(stmt)) == SQLITE_ROW) {
+/* LCOV_EXCL_START */
                                package = (const char *)sqlite3_column_text(stmt, 1);
                                se_type = (net_nfc_se_type_e) sqlite3_column_int(stmt, 2);
                                category = (net_nfc_card_emulation_category_t) sqlite3_column_int(stmt, 3);
@@ -256,6 +263,7 @@ static void __iterate_db(_iterate_db_cb cb, void *user_data)
                                manifest = (bool) sqlite3_column_int(stmt, 7);
 
                                cb(package, se_type, category, aid, unlock, power, manifest, user_data);
+/* LCOV_EXCL_STOP */
                        }
 
                        sqlite3_finalize(stmt);
@@ -269,6 +277,7 @@ static void __iterate_db(_iterate_db_cb cb, void *user_data)
        }
 }
 
+/* LCOV_EXCL_START */
 static net_nfc_error_e __insert_into_db(const char *package, net_nfc_se_type_e se_type, net_nfc_card_emulation_category_t category, const char *aid, bool unlock, int power, bool manifest)
 {
        net_nfc_error_e result;
@@ -353,6 +362,7 @@ static net_nfc_error_e __delete_from_db(const char *package, const char *aid)
 
        return result;
 }
+/* LCOV_EXCL_STOP */
 
 #if 0
 static net_nfc_error_e __delete_aids_from_db(const char *package)
@@ -404,6 +414,7 @@ static void __update_payment_handler(const char *package)
                activated_payment = g_strdup(package);
 }
 
+/* LCOV_EXCL_START */
 static bool __is_preferred_payment_handler(const char *package)
 {
        return (preferred_payment != NULL && g_strcmp0(package, preferred_payment) == 0);
@@ -427,6 +438,7 @@ static void __on_destroy_other_cb(gpointer data)
 {
        g_free(data);
 }
+/* LCOV_EXCL_STOP */
 
 static void __update_other_handler(const char *packages)
 {
@@ -448,6 +460,7 @@ static void __update_other_handler(const char *packages)
        }
 }
 
+/* LCOV_EXCL_START */
 void net_nfc_server_route_table_update_other_handler(const char *packages)
 {
        __update_other_handler(packages);
@@ -610,6 +623,7 @@ void net_nfc_server_route_table_update_category_handler(const char *package, net
                break;
        }
 }
+/* LCOV_EXCL_STOP */
 
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -617,6 +631,7 @@ void net_nfc_server_route_table_update_category_handler(const char *package, net
 route_table_handler_t *preferred_handler;
 static GHashTable *routing_handlers;
 
+/* LCOV_EXCL_START */
 static bool __get_package_name(const char *id, char *package, size_t len)
 {
        pid_t pid;
@@ -678,6 +693,7 @@ static void __on_iterate_db_aid_cb(const char *package, net_nfc_se_type_e se_typ
 
        __route_table_add_aid(NULL, package, se_type, category, aid, unlock, power, manifest, false);
 }
+/* LCOV_EXCL_STOP */
 
 void net_nfc_server_route_table_init()
 {
@@ -712,6 +728,7 @@ void net_nfc_server_route_table_load_db()
                __iterate_db(__on_iterate_db_aid_cb, NULL);
 }
 
+/* LCOV_EXCL_START */
 void net_nfc_server_route_table_deinit()
 {
        if (routing_handlers != NULL) {
@@ -722,12 +739,14 @@ void net_nfc_server_route_table_deinit()
        }
 
 }
+/* LCOV_EXCL_STOP */
 
 route_table_handler_t *net_nfc_server_route_table_find_handler(const char *package)
 {
        return (route_table_handler_t *) g_hash_table_lookup(routing_handlers, (gconstpointer) package);
 }
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_server_route_table_add_handler(const char *id, const char *package)
 {
        route_table_handler_t *data;
@@ -953,6 +972,8 @@ net_nfc_error_e net_nfc_server_route_table_del_handler(const char *id, const cha
 
        return result;
 }
+/* LCOV_EXCL_STOP */
+
 #endif
 net_nfc_error_e net_nfc_server_route_table_update_handler_id(const char *package, const char *id)
 {
@@ -965,11 +986,13 @@ net_nfc_error_e net_nfc_server_route_table_update_handler_id(const char *package
 
                data = net_nfc_server_route_table_find_handler(package);
                if (data != NULL) {
+/* LCOV_EXCL_START */
                        if (data->id != NULL) {
                                SECURE_MSG("remove client id, [%s]", id);
                                g_free(data->id);
                                data->id = NULL;
                        }
+/* LCOV_EXCL_STOP */
 
                }
 
@@ -979,6 +1002,7 @@ net_nfc_error_e net_nfc_server_route_table_update_handler_id(const char *package
        return result;
 }
 
+/* LCOV_EXCL_START */
 route_table_handler_t *net_nfc_server_route_table_get_preferred_handler()
 {
        return preferred_handler;
@@ -1088,6 +1112,8 @@ void net_nfc_server_route_table_preferred_handler_dump()
        }
        DEBUG_SERVER_MSG("------------------------------");
 }
+/* LCOV_EXCL_STOP */
+
 #endif
 
 void net_nfc_server_route_table_iterate_handler(net_nfc_server_route_table_handler_iter_cb cb, void *user_data)
@@ -1119,11 +1145,11 @@ void net_nfc_server_route_table_iterate_handler_activated_last(net_nfc_server_ro
        g_hash_table_iter_init(&iter, routing_handlers);
 
        while (g_hash_table_iter_next(&iter, &key, (gpointer) & data)) {
-               if (!__is_preferred_payment_handler((const char *)key)
-                       && !__is_preferred_other_handler((const char *)key)
-                       && !__is_payment_handler((const char *)key)
-                       && !__is_other_handler((const char *)key)) {
-                       if (cb((const char *)key, data, user_data) == false)
+               if (!__is_preferred_payment_handler((const char *)key)  // LCOV_EXCL_LINE
+                       && !__is_preferred_other_handler((const char *)key)     // LCOV_EXCL_LINE
+                       && !__is_payment_handler((const char *)key)     // LCOV_EXCL_LINE
+                       && !__is_other_handler((const char *)key)) {    // LCOV_EXCL_LINE
+                       if (cb((const char *)key, data, user_data) == false)    // LCOV_EXCL_LINE
                                break;
                }
        }
@@ -1131,20 +1157,20 @@ void net_nfc_server_route_table_iterate_handler_activated_last(net_nfc_server_ro
        g_hash_table_iter_init(&iter, routing_handlers);
 
        while (g_hash_table_iter_next(&iter, &key, (gpointer) & data)) {
-               if (__is_preferred_payment_handler((const char *)key) == false && __is_preferred_other_handler((const char *)key) == false && (__is_payment_handler((const char *)key) || __is_other_handler((const char *)key))) {
-                       if (cb((const char *)key, data, user_data) == false)
+               if (__is_preferred_payment_handler((const char *)key) == false && __is_preferred_other_handler((const char *)key) == false && (__is_payment_handler((const char *)key) || __is_other_handler((const char *)key))) {     // LCOV_EXCL_LINE
+                       if (cb((const char *)key, data, user_data) == false)    // LCOV_EXCL_LINE
                                break;
                }
        }
 
        if (preferred_handler != NULL)
-               cb((const char *)preferred_handler->package, preferred_handler, user_data);
+               cb((const char *)preferred_handler->package, preferred_handler, user_data);     // LCOV_EXCL_LINE
 }
 
 #ifdef PRINT_TABLE
 static const char *__get_se_name(net_nfc_se_type_e se_type)
 {
-       switch (se_type) {
+       switch (se_type) {      // LCOV_EXCL_LINE
        case NET_NFC_SE_TYPE_ESE:
                return "eSE";
        case NET_NFC_SE_TYPE_UICC:
@@ -1158,6 +1184,7 @@ static const char *__get_se_name(net_nfc_se_type_e se_type)
        }
 }
 
+/* LCOV_EXCL_START */
 static bool _display_route_table_cb(const char *package, route_table_handler_t * handler, void *user_data)
 {
        int i;
@@ -1174,6 +1201,7 @@ static bool _display_route_table_cb(const char *package, route_table_handler_t *
 
        return true;
 }
+/* LCOV_EXCL_STOP */
 
 static void __display_route_table()
 {
@@ -1182,6 +1210,7 @@ static void __display_route_table()
        DEBUG_SERVER_MSG(" +------------------------------------------------+");
 }
 #endif
+/* LCOV_EXCL_START */
 static bool __activation_iter_cb(const char *package, route_table_handler_t * handler, void *user_data)
 {
        int i;
@@ -1846,6 +1875,7 @@ static bool __update_table_iter_cb(const char *package, route_table_handler_t *
 
        return true;
 }
+/* LCOV_EXCL_STOP */
 
 net_nfc_error_e net_nfc_server_route_table_do_update(bool routing)
 {
@@ -1875,6 +1905,7 @@ net_nfc_error_e net_nfc_server_route_table_do_update(bool routing)
 
                result = NET_NFC_OK;
        } else if (ret > 1) {
+       /* LCOV_EXCL_START */
                DEBUG_ERR_MSG("some packages are not updated, [%d]", ret);
 
                result = NET_NFC_OPERATION_FAIL;
@@ -1882,6 +1913,7 @@ net_nfc_error_e net_nfc_server_route_table_do_update(bool routing)
                DEBUG_ERR_MSG("wrong result, [%d]", ret);
 
                result = NET_NFC_OPERATION_FAIL;
+       /* LCOV_EXCL_STOP */
        }
 
        if (routing == true)
@@ -1893,6 +1925,7 @@ net_nfc_error_e net_nfc_server_route_table_do_update(bool routing)
        return result;
 }
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_server_route_table_get_storage_info(net_nfc_card_emulation_category_t category, int *used, int *max)
 {
        if (used == NULL || max == NULL)
@@ -1903,3 +1936,4 @@ net_nfc_error_e net_nfc_server_route_table_get_storage_info(net_nfc_card_emulati
 
        return NET_NFC_OK;
 }
+/* LCOV_EXCL_STOP */
index fb73dff0c50762e745dfa0f1b054707463e5b491..8cdd775768b6cf50d52057fe6a266913effa9b1b 100755 (executable)
@@ -194,10 +194,10 @@ static net_nfc_card_emulation_mode_t __se_get_se_state(net_nfc_secure_element_po
                break;
 
        case SECURE_ELEMENT_POLICY_UICC_ON:
-               if (gdbus_uicc_ready == SE_UICC_READY)
+               if (gdbus_uicc_ready == SE_UICC_READY)  //LCOV_EXCL_LINE
                        state = NET_NFC_CARD_EMELATION_ENABLE;
                else
-                       state = NET_NFC_CARD_EMULATION_DISABLE;
+                       state = NET_NFC_CARD_EMULATION_DISABLE; //LCOV_EXCL_LINE
                break;
 
        case SECURE_ELEMENT_POLICY_HCE_ON:
@@ -205,13 +205,14 @@ static net_nfc_card_emulation_mode_t __se_get_se_state(net_nfc_secure_element_po
                break;
 
        default:
-               state = NET_NFC_CARD_EMULATION_DISABLE;
+               state = NET_NFC_CARD_EMULATION_DISABLE; //LCOV_EXCL_LINE
                break;
        }
 
        return state;
 }
 
+/* LCOV_EXCL_START */
 net_nfc_card_emulation_mode_t net_nfc_server_se_get_se_state()
 {
        net_nfc_card_emulation_mode_t state;
@@ -295,6 +296,7 @@ net_nfc_error_e net_nfc_server_se_set_se_state(net_nfc_card_emulation_mode_t sta
 
        return result;
 }
+/* LCOV_EXCL_STOP */
 
 static inline const char *__se_get_se_name(net_nfc_se_type_e type)
 {
@@ -310,17 +312,18 @@ static inline const char *__se_get_se_name(net_nfc_se_type_e type)
                break;
 
        case NET_NFC_SE_TYPE_HCE:
-               name = "HCE";
+               name = "HCE";   //LCOV_EXCL_LINE
                break;
 
        default:
-               name = "unknown";
+               name = "unknown";       //LCOV_EXCL_LINE
                break;
        }
 
        return name;
 }
 
+/* LCOV_EXCL_START */
 static net_nfc_se_type_e __se_get_se_type(net_nfc_secure_element_policy_e policy)
 {
        net_nfc_se_type_e type;
@@ -342,12 +345,13 @@ static net_nfc_se_type_e __se_get_se_type(net_nfc_secure_element_policy_e policy
                break;
 
        default:
-               type = NET_NFC_SE_TYPE_NONE;
+               type = NET_NFC_SE_TYPE_NONE;    //LCOV_EXCL_LINE
                break;
        }
 
        return type;
 }
+/* LCOV_EXCL_STOP */
 
 net_nfc_se_type_e net_nfc_server_se_get_se_type()
 {
@@ -374,6 +378,7 @@ net_nfc_se_type_e net_nfc_server_se_get_se_type()
        return se_type;
 }
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_server_se_set_se_type(net_nfc_se_type_e type)
 {
        net_nfc_error_e result;
@@ -441,6 +446,7 @@ net_nfc_error_e net_nfc_server_se_set_se_type(net_nfc_se_type_e type)
 
        return result;
 }
+/* LCOV_EXCL_STOP */
 
 static net_nfc_secure_element_policy_e __se_get_se_policy()
 {
@@ -448,19 +454,22 @@ static net_nfc_secure_element_policy_e __se_get_se_policy()
        int wallet_mode = 0;
 
        if (vconf_get_int(VCONFKEY_NFC_WALLET_MODE, &wallet_mode) != 0)
-               DEBUG_ERR_MSG("vconf_get_int failed");
+               DEBUG_ERR_MSG("vconf_get_int failed");  //LCOV_EXCL_LINE
 
        if (vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_policy) != 0)
-               DEBUG_ERR_MSG("vconf_get_int failed");
+               DEBUG_ERR_MSG("vconf_get_int failed");  //LCOV_EXCL_LINE
 
        if (wallet_mode == NET_NFC_WALLET_MODE_UICC) {
+       /* LCOV_EXCL_START */
                if (__se_get_se_state(se_policy) == NET_NFC_CARD_EMELATION_ENABLE)
                        se_policy = SECURE_ELEMENT_POLICY_UICC_ON;
                else
                        se_policy = SECURE_ELEMENT_POLICY_UICC_OFF;
+       /* LCOV_EXCL_STOP */
        } else if (wallet_mode == NET_NFC_WALLET_MODE_ESE) {
                if (__se_get_se_state(se_policy) == NET_NFC_CARD_EMELATION_ENABLE)
                        se_policy = SECURE_ELEMENT_POLICY_ESE_ON;
+       /* LCOV_EXCL_START */
                else
                        se_policy = SECURE_ELEMENT_POLICY_ESE_OFF;
        } else if (wallet_mode == NET_NFC_WALLET_MODE_HCE) {
@@ -469,10 +478,12 @@ static net_nfc_secure_element_policy_e __se_get_se_policy()
                else
                        se_policy = SECURE_ELEMENT_POLICY_HCE_OFF;
        }
+       /* LCOV_EXCL_STOP */
 
        return se_policy;
 }
 
+/* LCOV_EXCL_START */
 #if 0
 net_nfc_error_e net_nfc_server_se_set_se_policy(net_nfc_secure_element_policy_e policy)
 {
@@ -679,6 +690,7 @@ static bool _se_is_uicc_handle(net_nfc_target_handle_s * handle)
 {
        return (gdbus_uicc_ready == SE_UICC_READY && gdbus_uicc_handle != NULL && (TapiHandle *) handle == gdbus_uicc_handle);
 }
+/* LCOV_EXCL_STOP */
 
 static void _se_uicc_close(net_nfc_target_handle_s * handle)
 {
@@ -694,6 +706,7 @@ net_nfc_error_e net_nfc_server_se_apply_se_policy(net_nfc_secure_element_policy_
 
        switch (policy) {
        case SECURE_ELEMENT_POLICY_UICC_ON:
+               /* LCOV_EXCL_START */
                if (gdbus_uicc_ready == SE_UICC_READY) {
                        net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_ESE, SECURE_ELEMENT_OFF_MODE, &result);
 
@@ -713,6 +726,7 @@ net_nfc_error_e net_nfc_server_se_apply_se_policy(net_nfc_secure_element_policy_
                } else {
                        current_policy = SECURE_ELEMENT_POLICY_UICC_OFF;
                }
+               /* LCOV_EXCL_STOP */
                break;
 
        case SECURE_ELEMENT_POLICY_ESE_ON:
@@ -733,6 +747,7 @@ net_nfc_error_e net_nfc_server_se_apply_se_policy(net_nfc_secure_element_policy_
                break;
 
        case SECURE_ELEMENT_POLICY_HCE_ON:
+       /* LCOV_EXCL_START */
                net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_UICC, SECURE_ELEMENT_OFF_MODE, &result);
 
                net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_ESE, SECURE_ELEMENT_OFF_MODE, &result);
@@ -748,6 +763,7 @@ net_nfc_error_e net_nfc_server_se_apply_se_policy(net_nfc_secure_element_policy_
 #endif
                current_policy = policy;
                break;
+       /* LCOV_EXCL_STOP */
 
        case SECURE_ELEMENT_POLICY_UICC_OFF:
        case SECURE_ELEMENT_POLICY_ESE_OFF:
@@ -784,6 +800,7 @@ net_nfc_error_e net_nfc_server_se_apply_se_current_policy()
        return net_nfc_server_se_apply_se_policy(policy);
 }
 
+/* LCOV_EXCL_START */
 net_nfc_error_e net_nfc_server_se_change_wallet_mode(net_nfc_wallet_mode_e wallet_mode)
 {
        net_nfc_error_e result = NET_NFC_OK;
@@ -2953,18 +2970,20 @@ static net_nfc_error_e __se_close_ese_no_lock()
 
        return result;
 }
+/* LCOV_EXCL_STOP */
 
 static void __llcp_on_client_detached_cb(net_nfc_client_context_info_t * client)
 {
        if (client->ref_se > 0) {
-               DEBUG_SERVER_MSG("close opened secure element");
+               DEBUG_SERVER_MSG("close opened secure element");        //LCOV_EXCL_LINE
 
-               client->ref_se = 0;
+               client->ref_se = 0;     //LCOV_EXCL_LINE
 
-               __se_close_ese_no_lock();
+               __se_close_ese_no_lock();       //LCOV_EXCL_LINE
        }
 }
 
+/* LCOV_EXCL_START */
 static void se_set_preferred_handler_thread_func(gpointer user_data)
 {
        SeSetPreferred *data = (SeSetPreferred *) user_data;
@@ -3066,6 +3085,7 @@ static gboolean se_handle_set_preferred_handler(NetNfcGDbusSecureElement * objec
 
        return TRUE;
 }
+/* LCOV_EXCL_STOP */
 
 gboolean net_nfc_server_se_init(GDBusConnection * connection)
 {
@@ -3135,11 +3155,11 @@ gboolean net_nfc_server_se_init(GDBusConnection * connection)
        if (result == true) {
                net_nfc_server_gdbus_register_on_client_detached_cb(__llcp_on_client_detached_cb);
        } else {
-               DEBUG_ERR_MSG("can not skeleton_export %s", error->message);
+               DEBUG_ERR_MSG("can not skeleton_export %s", error->message);    //LCOV_EXCL_LINE
 
-               g_error_free(error);
+               g_error_free(error);    //LCOV_EXCL_LINE
 
-               net_nfc_server_se_deinit();
+               net_nfc_server_se_deinit();     //LCOV_EXCL_LINE
        }
 
        return result;
@@ -3162,6 +3182,7 @@ void net_nfc_server_se_deinit(void)
        }
 }
 
+/* LCOV_EXCL_START */
 static void se_detected_thread_func(gpointer user_data)
 {
        net_nfc_target_handle_s *handle = NULL;
@@ -3315,12 +3336,14 @@ void net_nfc_server_se_rf_field_on(void *info)
        /* FIXME : should be removed when plugins would be fixed */
        _net_nfc_util_free_mem(info);
 }
+/* LCOV_EXCL_STOP */
 
 static guint __timer_handle;
 static gint __set_guard_time;
 static net_nfc_screen_state_type_e __lcd_state;
 static pthread_mutex_t __state_mutex = PTHREAD_MUTEX_INITIALIZER;
 
+/* LCOV_EXCL_START */
 static void ____delayed_change_screen_state_thread_func(gpointer user_data)
 {
        net_nfc_error_e result = NET_NFC_OK;
@@ -3355,6 +3378,7 @@ static gboolean __delayed_change_screen_state(gpointer user_data)
 
        return FALSE;
 }
+/* LCOV_EXCL_STOP */
 
 static void __stop_lcd_on_timer()
 {
@@ -3363,13 +3387,14 @@ static void __stop_lcd_on_timer()
        DEBUG_SERVER_MSG("timer stopped");
 
        if (__timer_handle > 0) {
-               g_source_remove(__timer_handle);
-               __timer_handle = 0;
+               g_source_remove(__timer_handle);        //LCOV_EXCL_LINE
+               __timer_handle = 0;     //LCOV_EXCL_LINE
        }
 
        pthread_mutex_unlock(&__state_mutex);
 }
 
+/* LCOV_EXCL_START */
 static void __start_lcd_on_timer()
 {
        __stop_lcd_on_timer();
@@ -3523,6 +3548,7 @@ void net_nfc_server_se_convert_to_binary(uint8_t * orig, size_t len, uint8_t **
 void net_nfc_server_se_create_deactivate_apdu_command(uint8_t * orig, uint8_t ** dest, size_t * destLen)
 {
 }
+/* LCOV_EXCL_STOP */
 
 #define USEESE_FILE_PATH "/opt/usr/data/nfc-manager-daemon/aid.dat"
 #define FIRST_BOOT_USEESE_FILE_PATH  "/opt/usr/share/nfc_debug/is_first_boot.dat"
@@ -3566,6 +3592,7 @@ static void net_nfc_server_se_deactivated_card_thread_func(gpointer user_data)
                DEBUG_SERVER_MSG("first boot NO");
                return;
        } else if (result == -1) {
+       /* LCOV_EXCL_START */
                DEBUG_SERVER_MSG("first boot YES");
                fp = fopen(FIRST_BOOT_USEESE_FILE_PATH, "w+");
                if (fp) {
@@ -3706,6 +3733,7 @@ static void net_nfc_server_se_deactivated_card_thread_func(gpointer user_data)
 
        if (cmd != NULL)
                g_free(cmd);
+       /* LCOV_EXCL_STOP */
 }
 
 void net_nfc_server_se_deactivate_card(void)
index 766785069c79ddf293b5f623c6ad973e727db74c..8edc9e570bdc64170b6bbfef818ae4ed2c9196e0 100755 (executable)
@@ -47,6 +47,7 @@ static void snep_stop_service_thread_func(gpointer user_data);
 /* definition */
 static NetNfcGDbusSnep *snep_skeleton = NULL;
 
+/* LCOV_EXCL_START */
 static void _emit_snep_event_signal(GVariant * parameter, net_nfc_snep_handle_h handle, net_nfc_error_e result, uint32_t type, data_s * data)
 {
        GDBusConnection *connection;
@@ -727,6 +728,7 @@ static gboolean _handle_unregister_server(NetNfcGDbusSnep * object, GDBusMethodI
 
        return TRUE;
 }
+/* LCOV_EXCL_STOP */
 
 gboolean net_nfc_server_snep_init(GDBusConnection * connection)
 {
@@ -734,7 +736,7 @@ gboolean net_nfc_server_snep_init(GDBusConnection * connection)
        gboolean result;
 
        if (snep_skeleton)
-               g_object_unref(snep_skeleton);
+               g_object_unref(snep_skeleton);  //LCOV_EXCL_LINE
 
        snep_skeleton = net_nfc_gdbus_snep_skeleton_new();
 
@@ -752,7 +754,7 @@ gboolean net_nfc_server_snep_init(GDBusConnection * connection)
 
        result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(snep_skeleton), connection, "/org/tizen/NetNfcService/Snep", &error);
        if (result == FALSE) {
-               g_error_free(error);
+               g_error_free(error);    //LCOV_EXCL_LINE
 
                net_nfc_server_snep_deinit();
        }
index 5a717595cc8d05591326b83f4ae35f8b1dde3c36..518527ef0c5c44d5340829aa2b71f9177f528816 100755 (executable)
@@ -26,6 +26,7 @@ static gboolean popup_handle_set(NetNfcGDbusPopup * popup_manager, GDBusMethodIn
 
 static gboolean popup_handle_get(NetNfcGDbusPopup * popup_manager, GDBusMethodInvocation * invocation, GVariant * smack_privilege, gpointer user_data);
 
+/* LCOV_EXCL_START */
 static gboolean popup_handle_set(NetNfcGDbusPopup * popup_manager, GDBusMethodInvocation * invocation, gint state, gint focus_state, GVariant * smack_privilege, gpointer user_data)
 {
        int result = NET_NFC_OK;
@@ -72,6 +73,7 @@ static gboolean popup_handle_get(NetNfcGDbusPopup * popup_manager, GDBusMethodIn
 
        return TRUE;
 }
+/* LCOV_EXCL_STOP */
 
 gboolean net_nfc_server_system_handler_init(GDBusConnection * connection)
 {
@@ -79,11 +81,11 @@ gboolean net_nfc_server_system_handler_init(GDBusConnection * connection)
        gboolean result;
 
        if (popup_skeleton)
-               g_object_unref(popup_skeleton);
+               g_object_unref(popup_skeleton); //LCOV_EXCL_LINE
 
        popup_skeleton = net_nfc_gdbus_popup_skeleton_new();
        if (popup_skeleton == NULL) {
-               DEBUG_ERR_MSG("Failed to allocate popup skeleton");
+               DEBUG_ERR_MSG("Failed to allocate popup skeleton");     //LCOV_EXCL_LINE
 
                return FALSE;
        }
@@ -94,9 +96,9 @@ gboolean net_nfc_server_system_handler_init(GDBusConnection * connection)
 
        result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(popup_skeleton), connection, "/org/tizen/NetNfcService/Popup", &error);
        if (result == FALSE) {
-               DEBUG_ERR_MSG("Can not skeleton_export %s", error->message);
+               DEBUG_ERR_MSG("Can not skeleton_export %s", error->message);    //LCOV_EXCL_LINE
 
-               g_error_free(error);
+               g_error_free(error);    //LCOV_EXCL_LINE
 
                net_nfc_server_system_handler_deinit();
        }
index 3400d22751b18b5670d904586216a83e7fb93946..eace97b2077004e04cfa7ad08fb67c2ce496cb98 100755 (executable)
@@ -99,6 +99,7 @@ static gboolean tag_is_isp_dep_ndef_formatable(net_nfc_target_handle_s * handle,
        return result;
 }
 #endif
+/* LCOV_EXCL_START */
 static gboolean tag_read_ndef_message(net_nfc_target_handle_s * handle, int dev_type, data_s ** read_ndef)
 {
        net_nfc_error_e result = NET_NFC_OK;
@@ -645,6 +646,7 @@ static gboolean tag_handle_get_current_target_handle(NetNfcGDbusTag * tag, GDBus
 
        return TRUE;
 }
+/* LCOV_EXCL_STOP */
 
 gboolean net_nfc_server_tag_init(GDBusConnection * connection)
 {
@@ -666,9 +668,9 @@ gboolean net_nfc_server_tag_init(GDBusConnection * connection)
 
        result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(tag_skeleton), connection, "/org/tizen/NetNfcService/Tag", &error);
        if (result == FALSE) {
-               DEBUG_ERR_MSG("can not skeleton_export %s", error->message);
+               DEBUG_ERR_MSG("can not skeleton_export %s", error->message);    //LCOV_EXCL_LINE
 
-               g_error_free(error);
+               g_error_free(error);    //LCOV_EXCL_LINE
 
                net_nfc_server_tag_deinit();
        }
@@ -684,6 +686,7 @@ void net_nfc_server_tag_deinit(void)
        }
 }
 
+/* LCOV_EXCL_START */
 void net_nfc_server_set_target_info(net_nfc_current_target_info_s * info)
 {
        if (current_target_info)
@@ -730,6 +733,7 @@ gboolean net_nfc_server_target_connected(uint32_t handle)
 
        return TRUE;
 }
+/* LCOV_EXCL_STOP */
 
 void net_nfc_server_free_target_info(void)
 {
@@ -737,6 +741,7 @@ void net_nfc_server_free_target_info(void)
        current_target_info = NULL;
 }
 
+/* LCOV_EXCL_START */
 bool net_nfc_server_tag_target_detected(void *info)
 {
        if (net_nfc_server_controller_async_queue_push_force(tag_slave_target_detected_thread_func, info) == FALSE) {
@@ -746,3 +751,4 @@ bool net_nfc_server_tag_target_detected(void *info)
 
        return true;
 }
+/* LCOV_EXCL_STOP */
index a8fe77b1a5d788b73f61aec5f472936b990cd207..bcb81a3e02c6336329b8ba5146ce4ba66e472e53 100755 (executable)
@@ -78,6 +78,7 @@ static gboolean test_handle_set_ee_data(NetNfcGDbusTest * test, GDBusMethodInvoc
 
 static NetNfcGDbusTest *test_skeleton = NULL;
 
+/* LCOV_EXCL_START */
 static void test_handle_sim_test_thread_func(gpointer user_data)
 {
        TestData *data = (TestData *) user_data;
@@ -587,6 +588,7 @@ static gboolean test_handle_set_listen_tech_mask(NetNfcGDbusTest * test, GDBusMe
 
        return TRUE;
 }
+/* LCOV_EXCL_STOP */
 
 gboolean net_nfc_server_test_init(GDBusConnection * connection)
 {
@@ -614,11 +616,13 @@ gboolean net_nfc_server_test_init(GDBusConnection * connection)
 
        result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(test_skeleton), connection, "/org/tizen/NetNfcService/Test", &error);
        if (result == FALSE) {
+               /* LCOV_EXCL_START */
                DEBUG_ERR_MSG("Can not skeleton_export %s", error->message);
                g_error_free(error);
                g_object_unref(test_skeleton);
 
                test_skeleton = NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        return result;
index 42cb417f51d4548e06d0566c3070f4815f7c420b..d9d4308c517276d8cff4e09a9c27ff98bf4835ec 100755 (executable)
@@ -44,6 +44,7 @@ struct _TransceiveSendData {
        net_nfc_transceive_info_s transceive_info;
 };
 
+/* LCOV_EXCL_START */
 static void transceive_data_thread_func(gpointer user_data)
 {
        TransceiveSendData *transceive_data = (TransceiveSendData *) user_data;
@@ -235,6 +236,7 @@ static gboolean transceive_handle(NetNfcGDbusTransceive * transceive, GDBusMetho
 
        return TRUE;
 }
+/* LCOV_EXCL_STOP */
 
 gboolean net_nfc_server_transceive_init(GDBusConnection * connection)
 {
@@ -252,9 +254,11 @@ gboolean net_nfc_server_transceive_init(GDBusConnection * connection)
 
        result = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(transceive_skeleton), connection, "/org/tizen/NetNfcService/Transceive", &error);
        if (result == FALSE) {
+               /* LCOV_EXCL_START */
                g_error_free(error);
                g_object_unref(transceive_skeleton);
                transceive_skeleton = NULL;
+               /* LCOV_EXCL_STOP */
        }
 
        return result;
index 5f1e24057a2aa1f890aa764267788240cbaf5404..f0fc06d1d63ba0b506051566685362bfbb5f38a1 100755 (executable)
@@ -31,6 +31,7 @@ static void net_nfc_server_vconf_lock_state_changed(keynode_t * key, void *user_
 
 static void net_nfc_server_vconf_pm_state_changed(keynode_t * key, void *user_data);
 
+/* LCOV_EXCL_START */
 static void net_nfc_server_vconf_lock_state_changed(keynode_t * key, void *user_data)
 {
 
@@ -50,6 +51,7 @@ static void net_nfc_server_vconf_lock_state_changed(keynode_t * key, void *user_
                net_nfc_server_restart_polling_loop();
 
 }
+/* LCOV_EXCL_STOP */
 
 static void net_nfc_server_vconf_pm_state_changed(keynode_t * key, void *user_data)
 {
@@ -80,6 +82,7 @@ static void net_nfc_server_vconf_pm_state_changed(keynode_t * key, void *user_da
        }
 }
 
+/* LCOV_EXCL_START */
 static void net_nfc_server_vconf_se_type_changed(keynode_t * key, void *user_data)
 {
        net_nfc_server_se_apply_se_current_policy();
@@ -141,6 +144,7 @@ static void net_nfc_server_vconf_other_handlers_changed(keynode_t * key, void *u
        if (net_nfc_server_controller_async_queue_push(__on_other_handlers_changed_func, g_strdup(key->value.s)) == false)
                DEBUG_ERR_MSG("net_nfc_server_controller_async_queue_push failed");
 }
+/* LCOV_EXCL_STOP */
 
 void net_nfc_server_vconf_init(void)
 {
@@ -171,6 +175,7 @@ void net_nfc_server_vconf_deinit(void)
        vconf_ignore_key_changed(VCONFKEY_NFC_OTHER_HANDLERS, net_nfc_server_vconf_other_handlers_changed);
 }
 
+/* LCOV_EXCL_START */
 bool net_nfc_check_start_polling_vconf(void)
 {
        gint lock_state = 0;
@@ -217,3 +222,4 @@ void net_nfc_server_vconf_set_screen_on_flag(bool flag)
 {
        is_screen_state_on = flag;
 }
+/* LCOV_EXCL_STOP */
diff --git a/unittest/CMakeLists.txt b/unittest/CMakeLists.txt
new file mode 100644 (file)
index 0000000..7505fec
--- /dev/null
@@ -0,0 +1,33 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(gtest-nfc-manager C CXX)
+
+SET(TARGET_GTEST_TESTS "gtest-nfc-manager")
+ADD_DEFINITIONS("-DUSE_DLOG")
+
+SET(REQUIRES_LIST ${REQUIRES_LIST}
+       glib-2.0
+       gio-2.0
+       gmock
+       dlog
+       capi-system-info
+)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(TARGET_GTEST_TESTS_PKG REQUIRED ${REQUIRES_LIST})
+
+FOREACH(flag ${TARGET_GTEST_TESTS_PKG_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -fPIE")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
+
+FILE(GLOB TARGET_GTEST_TESTS_SRCS *.cpp)
+SET(TARGET_GTEST_TESTS_SRCS ${TARGET_GTEST_TESTS_SRCS})
+
+ADD_EXECUTABLE(${TARGET_GTEST_TESTS} ${TARGET_GTEST_TESTS_SRCS})
+TARGET_LINK_LIBRARIES(${TARGET_GTEST_TESTS} ${TARGET_GTEST_TESTS_LDFLAGS} ${TARGET_GTEST_TESTS_PKG_LDFLAGS} -ldl -lgcov)
+
+INSTALL(TARGETS ${TARGET_GTEST_TESTS} RUNTIME DESTINATION ${BIN_DIR})
diff --git a/unittest/gdbus.cpp b/unittest/gdbus.cpp
new file mode 100644 (file)
index 0000000..57e0c56
--- /dev/null
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <iostream>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "gdbus.h"
+
+GDbus::GDbus()
+{
+       this->m_pConnection = NULL;
+       this->m_pCancellable = NULL;
+}
+
+GDbus::~GDbus()
+{
+       GDBusConnection *conn = this->m_pConnection;
+       GCancellable *cancel = this->m_pCancellable;
+
+       if (cancel) {
+               g_cancellable_cancel(cancel);   // LCOV_EXCL_LINE
+               g_object_unref(cancel); // LCOV_EXCL_LINE
+               cancel = NULL;  // LCOV_EXCL_LINE
+       }
+
+       if (conn) {
+               g_object_unref(conn);
+               conn = NULL;
+       }
+}
+
+error_e GDbus::Create(void)
+{
+       GError *err = NULL;
+
+#if !GLIB_CHECK_VERSION(2, 36, 0)
+       g_type_init();
+#endif
+
+       this->m_pConnection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
+       if (this->m_pConnection == NULL) {
+               if (err != NULL) {
+                       GLOGD("Failed to connect to the D-BUS daemon [%s]", err->message);
+                       g_error_free(err);
+               }
+
+               return ERROR_OPERATION_FAILED;
+       }
+
+       this->m_pCancellable = g_cancellable_new();
+
+       return ERROR_NONE;
+}
+
+error_e GDbus::Destroy(void)
+{
+       g_cancellable_cancel(this->m_pCancellable);
+       g_object_unref(this->m_pCancellable);
+       this->m_pCancellable = NULL;
+
+       g_object_unref(this->m_pConnection);
+       this->m_pConnection = NULL;
+
+       return ERROR_NONE;
+}
+
+/* LCOV_EXCL_START */
+GDBusConnection *GDbus::GetConnection(void)
+{
+       return this->m_pConnection;
+}
+
+GCancellable *GDbus::GetCancellable(void)
+{
+       return this->m_pCancellable;
+}
+/* LCOV_EXCL_STOP*/
+
+/* LCOV_EXCL_START */
+error_e GDbus::ConvertErrorStringToEnum(const char *error)
+{
+       if (NULL != strstr(error, "NoReply"))
+               return ERROR_INVALID_OPERATION;
+       else if (NULL != strstr(error, "Failed"))
+               return ERROR_OPERATION_FAILED;
+       else if (NULL != strstr(error, "UnknownMethod"))
+               return ERROR_INVALID_OPERATION;
+       else if (NULL != strstr(error, "InvalidArguments"))
+               return ERROR_INVALID_PARAMETER;
+       else if (NULL != strstr(error, "AccessDenied"))
+               return ERROR_PERMISSION_DENIED;
+       else if (NULL != strstr(error, "PermissionDenied"))
+               return ERROR_PERMISSION_DENIED;
+       else if (NULL != strstr(error, "NotSupported"))
+               return ERROR_NOT_SUPPORTED;
+       else if (NULL != strstr(error, "InProgress"))
+               return ERROR_IN_PROGRESS;
+
+       return ERROR_OPERATION_FAILED;
+}
+/* LCOV_EXCL_STOP */
+
+GVariant *GDbus::InvokeMethod(const char *dest, const char *path,
+       const char *iface_name, const char *method, GVariant *params, int *dbus_error)
+{
+       GError *error = NULL;
+       GVariant *reply = NULL;
+       GDBusConnection *connection = NULL;
+       *dbus_error = ERROR_NONE;
+
+       connection = GetConnection();
+       if (connection == NULL) {
+               /* LCOV_EXCL_START */
+               GLOGD("GDBusconnection is NULL");
+               *dbus_error = ERROR_NOT_INITIALIZED;
+               return reply;
+               /* LCOV_EXCL_STOP */
+       }
+
+       reply = g_dbus_connection_call_sync(connection,
+                       dest,
+                       path,
+                       iface_name,
+                       method,
+                       params,
+                       NULL,
+                       G_DBUS_CALL_FLAGS_NONE,
+                       DBUS_REPLY_TIMEOUT,
+                       GetCancellable(),
+                       &error);
+
+       if (reply == NULL) {
+               /* LCOV_EXCL_START */
+               if (error != NULL) {
+                       GLOGD("g_dbus_connection_call_sync() failed "
+                               "error [%d: %s]", error->code, error->message);
+                       *dbus_error = ConvertErrorStringToEnum(error->message);
+                       g_error_free(error);
+               } else {
+                       GLOGD("g_dbus_connection_call_sync() failed");
+                       *dbus_error = ERROR_OPERATION_FAILED;
+               }
+
+               return NULL;
+               /* LCOV_EXCL_STOP */
+       }
+
+       return reply;
+}
+
+/* LCOV_EXCL_START */
+error_e GDbus::InvokeMethodNonblock(const char *dest, const char *path,
+       const char *iface_name, const char *method, GVariant *params, int timeout,
+       GAsyncReadyCallback notify_func, void *user_data)
+{
+       GDBusConnection *connection = NULL;
+
+       connection = GetConnection();
+       if (connection == NULL) {
+               GLOGD("GDBusconnection is NULL");
+               return ERROR_NOT_INITIALIZED;
+       }
+
+       g_dbus_connection_call(connection,
+                       dest,
+                       path,
+                       iface_name,
+                       method,
+                       params,
+                       NULL,
+                       G_DBUS_CALL_FLAGS_NONE,
+                       timeout,
+                       GetCancellable(),
+                       (GAsyncReadyCallback) notify_func,
+                       (gpointer)user_data);
+
+       return ERROR_NONE;
+}
+/* LCOV_EXCL_STOP */
diff --git a/unittest/gdbus.h b/unittest/gdbus.h
new file mode 100644 (file)
index 0000000..39733ce
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __NFC_MGR_GDBUS_H__
+#define __NFC_MGR_GDBUS_H__
+
+#include <glib.h>
+#include <gio/gio.h>
+
+#include "nfcmgr.h"
+
+#define GMAINTIMEOUT 10000
+#define DBUS_REPLY_TIMEOUT (120 * 1000)
+
+#define NFC_MGR_SERVICE "org.tizen.NetNfcService"
+
+#define NFC_MANAGER_PATH "/org/tizen/NetNfcService/Manager"
+#define NFC_TAG_PATH "/org/tizen/NetNfcService/Tag"
+#define NFC_NDEF_PATH "/org/tizen/NetNfcService/Ndef"
+#define NFC_LLCP_PATH "/org/tizen/NetNfcService/Llcp"
+#define NFC_P2P_PATH "/org/tizen/NetNfcService/P2p"
+#define NFC_POPUP_PATH "/org/tizen/NetNfcService/Popup"
+#define NFC_SECURE_ELEMENT_PATH "/org/tizen/NetNfcService/SecureElement"
+#define NFC_TRANSCEIVE_PATH "/org/tizen/NetNfcService/Transceive"
+#define NFC_HANDOVER_PATH "/org/tizen/NetNfcService/Handover"
+#define NFC_TEST_PATH "/org/tizen/NetNfcService/Test"
+#define NFC_SNEP_PATH "/org/tizen/NetNfcService/Snep"
+#define NFC_HCE_PATH "/org/tizen/NetNfcService/Hce"
+
+#define NFC_MANAGER_INTERFACE "org.tizen.NetNfcService.Manager"
+#define NFC_TAG_INTERFACE "org.tizen.NetNfcService.Tag"
+#define NFC_NDEF_INTERFACE "org.tizen.NetNfcService.Ndef"
+#define NFC_LLCP_INTERFACE "org.tizen.NetNfcService.Llcp"
+#define NFC_P2P_INTERFACE "org.tizen.NetNfcService.P2p"
+#define NFC_POPUP_INTERFACE "org.tizen.NetNfcService.Popup"
+#define NFC_SECURE_ELEMENT_INTERFACE "org.tizen.NetNfcService.SecureElement"
+#define NFC_TRANSCEIVE_INTERFACE "org.tizen.NetNfcService.Transceive"
+#define NFC_HANDOVER_INTERFACE "org.tizen.NetNfcService.Handover"
+#define NFC_TEST_INTERFACE "org.tizen.NetNfcService.Test"
+#define NFC_SNEP_INTERFACE "org.tizen.NetNfcService.Snep"
+#define NFC_HCE_INTERFACE "org.tizen.NetNfcService.Hce"
+
+
+class GDbus {
+private:
+       GDBusConnection *m_pConnection;
+       GCancellable *m_pCancellable;
+public:
+       GDbus();
+       ~GDbus();
+       error_e Create(void);
+       error_e Destroy(void);
+       GDBusConnection *GetConnection(void);
+       GCancellable *GetCancellable(void);
+       error_e ConvertErrorStringToEnum(const char *error);
+       GVariant *InvokeMethod(const char *dest, const char *path,
+               const char *iface_name, const char *method, GVariant *params, int *dbus_error);
+       error_e InvokeMethodNonblock(const char *dest, const char *path,
+               const char *iface_name, const char *method, GVariant *params, int timeout,
+               GAsyncReadyCallback notify_func, void *user_data);
+};
+
+#endif /* __NFC_MGR_GDBUS_H__ */
diff --git a/unittest/manager.cpp b/unittest/manager.cpp
new file mode 100644 (file)
index 0000000..c3c311d
--- /dev/null
@@ -0,0 +1,2208 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <iostream>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "manager.h"
+
+Manager::Manager()
+{
+       Create();
+}
+
+Manager::~Manager()
+{
+       Destroy();
+}
+
+//===================== Manager ======================
+
+int Manager::SetActive(bool is_active)
+{
+       sleep(1);                               // needed in case when setactive(false) is called too quickly. This issue handled and resolved in another commit.
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("SetActive()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_MANAGER_PATH,
+               NFC_MANAGER_INTERFACE,
+               "SetActive",
+               g_variant_new("(b)", is_active),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::GetServerState(unsigned int *state)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("GetServerState()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_MANAGER_PATH,
+               NFC_MANAGER_INTERFACE,
+               "GetServerState",
+               NULL,
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(iu)", &error, state);
+       GLOGD("ret = [%d: %u]", error, *state);
+       g_variant_unref(message);
+
+       return error;
+}
+
+//===================== Tag ======================
+
+int Manager::IsTagConnected(bool *is_connected, int *dev_type)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("IsTagConnected()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_TAG_PATH,
+               NFC_TAG_INTERFACE,
+               "IsTagConnected",
+               NULL,
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(ibi)", &error, is_connected, dev_type);
+       GLOGD("ret = [%d: %d: %d]", error, (int)*is_connected, *dev_type);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::GetCurrentTagInfo(bool *is_connected, unsigned int *handle, int *dev_type, bool *is_ndef_supported, unsigned char *ndef_card_state,
+       unsigned int *max_data_size, unsigned int *actual_data_size, unsigned int *number_of_keys, GVariant **target_info_values, GVariant **raw_data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("GetCurrentTagInfo()");
+
+       int pre_error = this->IsTagConnected(is_connected, dev_type);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_TAG_PATH,
+               NFC_TAG_INTERFACE,
+               "GetCurrentTagInfo",
+               NULL,
+               &error);
+
+       if (message == NULL) {
+               GLOGD("Failed to invoke dbus method");
+               return error;
+       }
+
+       GVariantIter *value_iter = NULL;
+       GVariantIter *raw_data_iter = NULL;
+       unsigned char endpoint = 0;
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+
+       g_variant_get(message, "(ibuibyuuua(y)a(y))", &error, is_connected, handle, dev_type, is_ndef_supported,
+                       ndef_card_state, max_data_size, actual_data_size, number_of_keys, &value_iter, &raw_data_iter);
+
+       GLOGD("ret = [%d: %d: %u: %d: %d: %u: %u: %u: %u: ...]", error, (int)*is_connected, *handle, *dev_type, (int)*is_ndef_supported, *ndef_card_state,
+                                       *max_data_size, *actual_data_size, *number_of_keys);
+
+       while (g_variant_iter_loop(value_iter, "(y)", &endpoint))
+               g_variant_builder_add(builder, "(y)", endpoint);
+
+       *target_info_values = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+       while (g_variant_iter_loop(raw_data_iter, "(y)", &endpoint))
+               g_variant_builder_add(builder, "(y)", endpoint);
+
+       *raw_data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       g_variant_iter_free(value_iter);
+       g_variant_iter_free(raw_data_iter);
+       g_variant_unref(message);
+
+       if (pre_error != ERROR_NONE || *is_connected == 0)
+               return ERROR_NONE;
+
+       return error;
+}
+
+int Manager::GetBarcode(GVariant **barcode)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("GetBarcode()");
+
+       bool is_connected = 0;
+       int dev_type = 0;
+       int pre_error = this->IsTagConnected(&is_connected, &dev_type);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_TAG_PATH,
+               NFC_TAG_INTERFACE,
+               "GetBarcode",
+               NULL,
+               &error);
+
+       if (message == NULL) {
+               GLOGD("Failed to invoke dbus method");
+               return error;
+       }
+
+       GVariantIter *iter = NULL;
+       unsigned char endpoint = 0;
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+
+       g_variant_get(message, "(ia(y))", &error, &iter);
+       GLOGD("ret = [%d: ...]", error);
+
+       while (g_variant_iter_loop(iter, "(y)", &endpoint))
+               g_variant_builder_add(builder, "(y)", endpoint);
+
+       *barcode = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+       if (pre_error != ERROR_NONE)
+               return pre_error;
+       if (is_connected == 0)
+               return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::GetCurrentTargetHandle(bool *is_connected, unsigned int *handle, int *dev_type)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("GetCurrentTargetHandle()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_TAG_PATH,
+               NFC_TAG_INTERFACE,
+               "GetCurrentTargetHandle",
+               NULL,
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(ibui)", &error, is_connected, handle, dev_type);
+       GLOGD("ret = [%d: %d: %u: %d]", error, (int)*is_connected, *handle, *dev_type);
+       g_variant_unref(message);
+
+       return error;
+}
+
+//===================== Ndef ======================
+
+int Manager::Read(unsigned int *handle, GVariant **data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Read()");
+
+       bool is_connected = 0;
+       int dev_type = 0;
+       int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_NDEF_PATH,
+               NFC_NDEF_INTERFACE,
+               "Read",
+               g_variant_new("(u)", *handle),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       GVariantIter *iter = NULL;
+       unsigned char endpoint = 0;
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+
+       g_variant_get(message, "(ia(y))", &error, &iter);
+       GLOGD("ret = [%d: ...]", error);
+
+       while (g_variant_iter_loop(iter, "(y)", &endpoint))
+               g_variant_builder_add(builder, "(y)", endpoint);
+
+       *data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+       if (pre_error != ERROR_NONE || is_connected == 0)
+               return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::Write(unsigned int *handle, GVariant **data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Write()");
+
+       bool is_connected = 0;
+       int dev_type = 0;
+       int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       unsigned int data_length = 10;
+       unsigned char data_array[data_length] = {'a', 'a', '\0'};
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+       unsigned int i = 0;
+       while (i++ < data_length)
+               g_variant_builder_add(builder, "(y)", data_array[i]);
+
+       *data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_NDEF_PATH,
+               NFC_NDEF_INTERFACE,
+               "Write",
+               g_variant_new("(u@a(y))", *handle, *data),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       if (pre_error != ERROR_NONE || is_connected == 0)
+               return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::MakeReadOnly(unsigned int *handle)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("MakeReadOnly()");
+
+       bool is_connected = 0;
+       int dev_type = 0;
+       int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_NDEF_PATH,
+               NFC_NDEF_INTERFACE,
+               "MakeReadOnly",
+               g_variant_new("(u)", *handle),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       if (pre_error != ERROR_NONE)
+               return pre_error;
+       if (is_connected == 0)
+               return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::Format(unsigned int *handle, unsigned char *key, unsigned int key_length)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Format()");
+
+       bool is_connected = 0;
+       int dev_type = 0;
+       int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       GVariant *key_var = NULL;
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+       unsigned int i = 0;
+       while (i++ < key_length)
+               g_variant_builder_add(builder, "(y)", key[i]);
+
+       key_var = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_NDEF_PATH,
+               NFC_NDEF_INTERFACE,
+               "Format",
+               g_variant_new("(u@a(y))", *handle, key_var),
+               &error);
+
+       if (message == NULL) {
+               GLOGD("Failed to invoke dbus method");
+               return error;
+       }
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       if (pre_error != ERROR_NONE)
+               return pre_error;
+       if (is_connected == 0)
+               return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+//===================== Llcp ======================
+
+int Manager::Config(unsigned short *c1, unsigned short *c2, unsigned char *c3, unsigned char *c4)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Config()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_LLCP_PATH,
+               NFC_LLCP_INTERFACE,
+               "Config",
+               g_variant_new("((qqyy))", *c1, *c2, *c3, *c4),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::Listen(unsigned int *handle, unsigned int *client_socket, unsigned short *miu, unsigned char *rw, int *type, unsigned char *sap, char **service_name)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Listen()");
+
+       char service_name_arr[] = "org.tizen.NetNfcService";
+       *service_name = service_name_arr;
+//     bool is_connected = 0;
+//     int dev_type = 0;
+//     int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_LLCP_PATH,
+               NFC_LLCP_INTERFACE,
+               "Listen",
+               g_variant_new("(uuqyiys)", *handle, *client_socket, *miu, *rw, *type, *sap, *service_name),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(iu)", &error, client_socket);
+       GLOGD("ret = [%d: %u]", error, *client_socket);
+       g_variant_unref(message);
+
+//     if (pre_error != ERROR_NONE || is_connected == 0)
+//             return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::Accept(unsigned int *handle, unsigned int *client_socket)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Accept()");
+
+//     bool is_connected = 0;
+//     int dev_type = 0;
+//     int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_LLCP_PATH,
+               NFC_LLCP_INTERFACE,
+               "Accept",
+               g_variant_new("(uu)", *handle, *client_socket),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+//     if (pre_error != ERROR_NONE || is_connected == 0)
+//             return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+/* LCOV_EXCL_START */
+int Manager::Reject(unsigned int *handle, unsigned int *client_socket)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Reject()");
+
+//     bool is_connected = 0;
+//     int dev_type = 0;
+//     int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_LLCP_PATH,
+               NFC_LLCP_INTERFACE,
+               "Reject",
+               g_variant_new("(uu)", *handle, *client_socket),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+//     if (pre_error != ERROR_NONE || is_connected == 0)
+//             return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::Connect(unsigned int *handle, unsigned int *client_socket, unsigned short *miu, unsigned char *rw, int *type, char **service_name)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Connect()");
+
+       char service_name_arr[] = "org.tizen.NetNfcService";
+       *service_name = service_name_arr;
+//     bool is_connected = 0;
+//     int dev_type = 0;
+//     int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_LLCP_PATH,
+               NFC_LLCP_INTERFACE,
+               "Connect",
+               g_variant_new("(uuqyis)", *handle, *client_socket, *miu, *rw, *type, *service_name),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(iu)", &error, client_socket);
+       GLOGD("ret = [%d: %u]", error, *client_socket);
+       g_variant_unref(message);
+
+//     if (pre_error != ERROR_NONE || is_connected == 0)
+//             return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::ConnectSap(unsigned int *handle, unsigned int *client_socket, unsigned short *miu, unsigned char *rw, int *type, unsigned char *sap)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("ConnectSap()");
+
+//     bool is_connected = 0;
+//     int dev_type = 0;
+//     int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_LLCP_PATH,
+               NFC_LLCP_INTERFACE,
+               "ConnectSap",
+               g_variant_new("(uuqyiy)", *handle, *client_socket, *miu, *rw, *type, *sap),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(iu)", &error, client_socket);
+       GLOGD("ret = [%d: %u]", error, *client_socket);
+       g_variant_unref(message);
+
+//     if (pre_error != ERROR_NONE || is_connected == 0)
+//             return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::Send(unsigned int *handle, unsigned int *client_socket, GVariant **data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Send()");
+
+//     bool is_connected = 0;
+//     int dev_type = 0;
+//     int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       unsigned int data_length = 10;
+       unsigned char data_array[data_length] = {'a', 'a', '\0'};
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+       unsigned int i = 0;
+       while (i++ < data_length)
+               g_variant_builder_add(builder, "(y)", data_array[i]);
+
+       *data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_LLCP_PATH,
+               NFC_LLCP_INTERFACE,
+               "Send",
+               g_variant_new("(uu@a(y))", *handle, *client_socket, *data),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(iu)", &error, client_socket);
+       GLOGD("ret = [%d: %u]", error, *client_socket);
+       g_variant_unref(message);
+
+//     if (pre_error != ERROR_NONE || is_connected == 0)
+//             return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::SendTo(unsigned int *handle, unsigned int *client_socket, unsigned char *sap, GVariant **data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("SendTo()");
+
+//     bool is_connected = 0;
+//     int dev_type = 0;
+//     int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       unsigned int data_length = 10;
+       unsigned char data_array[data_length] = {'a', 'a', '\0'};
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+       unsigned int i = 0;
+       while (i++ < data_length)
+               g_variant_builder_add(builder, "(y)", data_array[i]);
+
+       *data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_LLCP_PATH,
+               NFC_LLCP_INTERFACE,
+               "SendTo",
+               g_variant_new("(uuy@a(y))", *handle, *client_socket, *sap, *data),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(iu)", &error, client_socket);
+       GLOGD("ret = [%d: %u: ...]", error, *client_socket);
+       g_variant_unref(message);
+
+//     if (pre_error != ERROR_NONE || is_connected == 0)
+//             return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::Receive(unsigned int *handle, unsigned int *client_socket, unsigned int *request_length, GVariant **data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Receive()");
+
+//     bool is_connected = 0;
+//     int dev_type = 0;
+//     int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_LLCP_PATH,
+               NFC_LLCP_INTERFACE,
+               "Receive",
+               g_variant_new("(uuu)", *handle, *client_socket, *request_length),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       GVariantIter *iter = NULL;
+       unsigned char endpoint = 0;
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+
+       g_variant_get(message, "(ia(y))", &error, &iter);
+       GLOGD("ret = [%d: ...]", error);
+
+       while (g_variant_iter_loop(iter, "(y)", &endpoint))
+               g_variant_builder_add(builder, "(y)", endpoint);
+
+       *data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+//     if (pre_error != ERROR_NONE || is_connected == 0)
+//             return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::ReceiveFrom(unsigned int *handle, unsigned int *client_socket, unsigned int *request_length, unsigned char *sap, GVariant **data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("ReceiveFrom()");
+
+       bool is_connected = 0;
+       int dev_type = 0;
+       int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_LLCP_PATH,
+               NFC_LLCP_INTERFACE,
+               "ReceiveFrom",
+               g_variant_new("(uuu)", *handle, *client_socket, *request_length),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       GVariantIter *iter = NULL;
+       unsigned char endpoint = 0;
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+
+       g_variant_get(message, "(iya(y))", &error, sap, &iter);
+       GLOGD("ret = [%d: %c: ...]", error, *sap);
+
+       while (g_variant_iter_loop(iter, "(y)", &endpoint))
+               g_variant_builder_add(builder, "(y)", endpoint);
+
+       *data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+       if (pre_error != ERROR_NONE || is_connected == 0)
+               return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+/* LCOV_EXCL_STOP */
+
+int Manager::Close(unsigned int *handle, unsigned int *client_socket)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Close()");
+
+//     bool is_connected = 0;
+//     int dev_type = 0;
+//     int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_LLCP_PATH,
+               NFC_LLCP_INTERFACE,
+               "Close",
+               g_variant_new("(uu)", *handle, *client_socket),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(iu)", &error, client_socket);
+       GLOGD("ret = [%d: %u]", error, *client_socket);
+       g_variant_unref(message);
+
+//     if (pre_error != ERROR_NONE || is_connected == 0)
+//             return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+/* LCOV_EXCL_START */
+int Manager::Disconnect(unsigned int *handle, unsigned int *client_socket)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Disconnect()");
+
+//     bool is_connected = 0;
+//     int dev_type = 0;
+//     int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_LLCP_PATH,
+               NFC_LLCP_INTERFACE,
+               "Disconnect",
+               g_variant_new("(uu)", *handle, *client_socket),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(iu)", &error, client_socket);
+       GLOGD("ret = [%d: %u]", error, *client_socket);
+       g_variant_unref(message);
+
+//     if (pre_error != ERROR_NONE || is_connected == 0)
+//             return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+/* LCOV_EXCL_STOP */
+
+//===================== P2p ======================
+
+int Manager::SendPtop(int *type, GVariant **data, unsigned int *handle)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("SendPtop()");
+
+       bool is_connected = 0;
+       int dev_type = 0;
+       int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       unsigned int data_length = 10;
+       unsigned char data_array[data_length] = {'a', 'a', '\0'};
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+       unsigned int i = 0;
+       while (i++ < data_length)
+               g_variant_builder_add(builder, "(y)", data_array[i]);
+
+       *data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_P2P_PATH,
+               NFC_P2P_INTERFACE,
+               "Send",
+               g_variant_new("(i@a(y)u)", *type, *data, *handle),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       if (pre_error != ERROR_NONE || is_connected == 0)
+               return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+//===================== Popup ======================
+
+int Manager::SetPopup(int *state, int *focus_state)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("SetPopup()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_POPUP_PATH,
+               NFC_POPUP_INTERFACE,
+               "Set",
+               g_variant_new("(ii)", *state, *focus_state),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::GetPopup(int *state)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("GetPopup()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_POPUP_PATH,
+               NFC_POPUP_INTERFACE,
+               "Get",
+               NULL,
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(ii)", &error, state);
+       GLOGD("ret = [%d: %d]", error, *state);
+       g_variant_unref(message);
+
+       return error;
+}
+
+//===================== SecureElement ======================
+
+int Manager::Set(int *type)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Set()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "Set",
+               g_variant_new("(i)", *type),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::Get(int *type)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Get()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "Get",
+               NULL,
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(ii)", &error, type);
+       GLOGD("ret = [%d: %d]", error, *type);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::SetCardEmulation(int *mode)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("SetCardEmulation()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "SetCardEmulation",
+               g_variant_new("(i)", *mode),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::GetCardEmulation(int *type)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("GetCardEmulation()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "GetCardEmulation",
+               NULL,
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(ii)", &error, type);
+       GLOGD("ret = [%d: %d]", error, *type);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::OpenSecureElement(int *type, unsigned int *handle)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("OpenSecureElement()");
+
+//     int mode = 1;
+//     int pre_error = SetCardEmulation(&mode);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "OpenSecureElement",
+               g_variant_new("(i)", *type),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(iu)", &error, handle);
+       GLOGD("ret = [%d: %u]", error, *handle);
+       g_variant_unref(message);
+
+//     if(pre_error != ERROR_NONE)
+//             return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::CloseSecureElement(unsigned int *handle)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("CloseSecureElement()");
+
+       int type = 1;
+       int pre_error = this->OpenSecureElement(&type, handle);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "CloseSecureElement",
+               g_variant_new("(u)", *handle),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       if(pre_error != ERROR_NONE)
+               return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::GetAtr(unsigned int *handle, GVariant **atr)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("GetAtr()");
+
+       int type = 1;
+       int pre_error = this->OpenSecureElement(&type, handle);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "GetAtr",
+               g_variant_new("(u)", *handle),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       GVariantIter *iter = NULL;
+       unsigned char endpoint = 0;
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+
+       g_variant_get(message, "(ia(y))", &error, &iter);
+       GLOGD("ret = [%d: ...]", error);
+
+       while (g_variant_iter_loop(iter, "(y)", &endpoint))
+               g_variant_builder_add(builder, "(y)", endpoint);
+
+       *atr = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+       if(pre_error != ERROR_NONE)
+               return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::SendAPDU(unsigned int *handle, GVariant **data, GVariant **response)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("SendAPDU()");
+
+       int type = 1;
+       int pre_error = this->OpenSecureElement(&type, handle);
+
+       unsigned int data_length = 10;
+       unsigned char data_array[data_length] = {'a', 'a', '\0'};
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+       unsigned int i = 0;
+       while (i++ < data_length)
+               g_variant_builder_add(builder, "(y)", data_array[i]);
+
+       *data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "SendAPDU",
+               g_variant_new("(u@a(y))", *handle, *data),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       GVariantIter *iter = NULL;
+       unsigned char endpoint = 0;
+       builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+
+       g_variant_get(message, "(ia(y))", &error, &iter);
+       GLOGD("ret = [%d: ...]", error);
+
+       while (g_variant_iter_loop(iter, "(y)", &endpoint))
+               g_variant_builder_add(builder, "(y)", endpoint);
+
+       *response = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+       if(pre_error != ERROR_NONE)
+               return ERROR_INVALID_OPERATION;
+
+       return error;
+}
+
+int Manager::SetTransactionFgDispatch(int *mode)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("SetTransactionFgDispatch()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "SetTransactionFgDispatch",
+               g_variant_new("(i)", *mode),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::SetDefaultRoute(unsigned int *switch_on, unsigned int *switch_off, unsigned int *battery_off)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("SetDefaultRoute()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "SetDefaultRoute",
+               g_variant_new("(uuu)", *switch_on, *switch_off, *battery_off),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::SetPreferredHandler(bool *state)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("SetPreferredHandler()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "SetPreferredHandler",
+               g_variant_new("(b)", *state),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::CheckTransactionPermission(GVariant **aid)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("CheckTransactionPermission()");
+
+       unsigned int data_length = 10;
+       unsigned char data_array[data_length] = {'a', 'a', '\0'};
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+       unsigned int i = 0;
+       while (i++ < data_length)
+               g_variant_builder_add(builder, "(y)", data_array[i]);
+
+       *aid = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "CheckTransactionPermission",
+               g_variant_new("(@a(y))", *aid),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::IsActivatedAidHandler(unsigned int *type, char **aid, bool *activated)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("IsActivatedAidHandler()");
+
+       unsigned int data_length = 10;
+       char data_array[data_length] = {'a', 'a', '\0'};
+       *aid = &data_array[0];
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "IsActivatedAidHandler",
+               g_variant_new("(us)", *type, *aid),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(ib)", &error, activated);
+       GLOGD("ret = [%d: %d]", error, (int)*activated);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::IsActivatedCategoryHandler(unsigned int *type, unsigned int *category, bool *activated)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("IsActivatedCategoryHandler()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "IsActivatedCategoryHandler",
+               g_variant_new("(uu)", *type, *category),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(ib)", &error, activated);
+       GLOGD("ret = [%d: %d]", error, (int)*activated);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::GetRegisteredAids(unsigned int *type, unsigned int *category, GVariant **aids)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("GetRegisteredAids()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "GetRegisteredAids",
+               g_variant_new("(uu)", *type, *category),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       GVariantIter *iter = NULL;
+       char *aid_ptr = NULL;
+       bool bool_data = 0;
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(sb)"));
+
+       g_variant_get(message, "(ia(sb))", &error, &iter);
+       GLOGD("ret = [%d: ...]", error);
+
+       while (g_variant_iter_loop(iter, "(sb)", &aid_ptr, &bool_data))
+               g_variant_builder_add(builder, "(sb)", aid_ptr, bool_data);
+
+       *aids = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::RegisterAid(unsigned int *type, unsigned int *category, char **aid)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("RegisterAid()");
+
+       unsigned int data_length = 10;
+       char data_array[data_length] = {'a', 'a', '\0'};
+       *aid = &data_array[0];
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "RegisterAid",
+               g_variant_new("(uus)", *type, *category, *aid),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::UnregisterAid(unsigned int *type, unsigned int *category, char **aid)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("UnregisterAid()");
+
+       unsigned int data_length = 10;
+       char data_array[data_length] = {'a', 'a', '\0'};
+       *aid = &data_array[0];
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "UnregisterAid",
+               g_variant_new("(uus)", *type, *category, *aid),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::UnregisterAids(unsigned int *type, unsigned int *category)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("UnregisterAids()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "UnregisterAids",
+               g_variant_new("(uu)", *type, *category),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+
+int Manager::AddRouteAid(char **package, char **aid, unsigned int *se_type, unsigned int *category, bool *unlock, unsigned int *power)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("AddRouteAid()");
+
+       unsigned int data_length = 10;
+       char data_array[data_length] = {'a', 'a', '\0'};
+       *package = &data_array[0];
+       *aid = &data_array[0];
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "AddRouteAid",
+               g_variant_new("(ssuubu)", *package, *aid, *se_type, *category, *unlock, *power),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::RemoveRouteAid(char **package, char **aid)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("RemoveRouteAid()");
+
+       unsigned int data_length = 10;
+       char data_array[data_length] = {'a', 'a', '\0'};
+       *package = &data_array[0];
+       *aid = &data_array[0];
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "RemoveRouteAid",
+               g_variant_new("(ss)", *package, *aid),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::RemovePackageAids(char **package)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("RemovePackageAids()");
+
+       unsigned int data_length = 10;
+       char data_array[data_length] = {'a', 'a', '\0'};
+       *package = &data_array[0];
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "RemovePackageAids",
+               g_variant_new("(s)", *package),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::GetRegisteredHandlers(unsigned int *category, GVariant **packages)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("GetRegisteredHandlers()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "GetRegisteredHandlers",
+               g_variant_new("(u)", *category),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       GVariantIter *iter = NULL;
+       int int_data = 0;
+       char *str_ptr = NULL;
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(is)"));
+
+       g_variant_get(message, "(ia(is))", &error, &iter);
+       GLOGD("ret = [%d: ...]", error);
+
+       while (g_variant_iter_loop(iter, "(is)", &int_data, &str_ptr))
+               g_variant_builder_add(builder, "(is)", int_data, str_ptr);
+
+       *packages = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::GetHandlerStorageInfo(unsigned int *category, int *used, int *maximum)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("GetHandlerStorageInfo()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "GetHandlerStorageInfo",
+               g_variant_new("(u)", *category),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(iii)", &error, used, maximum);
+       GLOGD("ret = [%d: %d: %d]", error, *used, *maximum);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::GetConflictHandlers(char **package, unsigned int *category, char **aid, GVariant **packages)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("GetConflictHandlers()");
+
+       unsigned int data_length = 10;
+       char data_array[data_length] = {'a', 'a', '\0'};
+       *package = &data_array[0];
+       *aid = &data_array[0];
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SECURE_ELEMENT_PATH,
+               NFC_SECURE_ELEMENT_INTERFACE,
+               "GetConflictHandlers",
+               g_variant_new("(sus)", *package, *category, *aid),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       GVariantIter *iter = NULL;
+       char *str_ptr = NULL;
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(s)"));
+
+       g_variant_get(message, "(ia(s))", &error, &iter);
+       GLOGD("ret = [%d: ...]", error);
+
+       while (g_variant_iter_loop(iter, "(s)", &str_ptr))
+               g_variant_builder_add(builder, "(s)", str_ptr);
+
+       *packages = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+       return error;
+}
+
+//===================== Transceive ======================
+
+int Manager::TransceiveData(unsigned int *handle, unsigned int *dev_type, GVariant **data, GVariant **resp_data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("TransceiveData()");
+
+       unsigned int data_length = 10;
+       unsigned char data_array[data_length] = {'a', 'a', '\0'};
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+       unsigned int i = 0;
+       while (i++ < data_length)
+               g_variant_builder_add(builder, "(y)", data_array[i]);
+
+       *data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_TRANSCEIVE_PATH,
+               NFC_TRANSCEIVE_INTERFACE,
+               "TransceiveData",
+               g_variant_new("(uu@a(y))", *handle, *dev_type, *data),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       GVariantIter *iter = NULL;
+       unsigned char endpoint = 0;
+       builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+
+       g_variant_get(message, "(ia(y))", &error, &iter);
+       GLOGD("ret = [%d: ...]", error);
+
+       while (g_variant_iter_loop(iter, "(y)", &endpoint))
+               g_variant_builder_add(builder, "(y)", endpoint);
+
+       *resp_data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::Transceive(unsigned int *handle, unsigned int *dev_type, GVariant **data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Transceive()");
+
+       unsigned int data_length = 10;
+       unsigned char data_array[data_length] = {'a', 'a', '\0'};
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+       unsigned int i = 0;
+       while (i++ < data_length)
+               g_variant_builder_add(builder, "(y)", data_array[i]);
+
+       *data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_TRANSCEIVE_PATH,
+               NFC_TRANSCEIVE_INTERFACE,
+               "Transceive",
+               g_variant_new("(uu@a(y))", *handle, *dev_type, *data),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+//===================== Handover ======================
+
+int Manager::Request(unsigned int *handle, int *type, int *carrier_type, GVariant **handover_data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("Request()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_HANDOVER_PATH,
+               NFC_HANDOVER_INTERFACE,
+               "Request",
+               g_variant_new("(ui)", *handle, *type),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       GVariantIter *iter = NULL;
+       unsigned char endpoint = 0;
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+
+       g_variant_get(message, "(iia(y))", &error, carrier_type, &iter);
+       GLOGD("ret = [%d: %d: ...]", error, *carrier_type);
+
+       while (g_variant_iter_loop(iter, "(y)", &endpoint))
+               g_variant_builder_add(builder, "(y)", endpoint);
+
+       *handover_data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+       return error;
+}
+
+//===================== Test ======================
+
+int Manager::SimTest()
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("SimTest()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_TEST_PATH,
+               NFC_TEST_INTERFACE,
+               "SimTest",
+               NULL,
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::PrbsTest(unsigned int *tech, unsigned int *rate)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("PrbsTest()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_TEST_PATH,
+               NFC_TEST_INTERFACE,
+               "PrbsTest",
+               g_variant_new("(uu)", *tech, *rate),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::GetFirmwareVersion(GVariant **version)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("GetFirmwareVersion()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_TEST_PATH,
+               NFC_TEST_INTERFACE,
+               "GetFirmwareVersion",
+               NULL,
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       char *ptr = NULL;
+
+       g_variant_get(message, "(is)", &error, &ptr);
+       GLOGD("ret = [%d: %s]", error, ptr);
+
+       *version = g_variant_new("(s)", ptr);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::SetEeData(unsigned int *mode, unsigned int *reg_id, GVariant **data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("SetEeData()");
+
+       unsigned int data_length = 10;
+       unsigned char data_array[data_length] = {'a', 'a', '\0'};
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+       unsigned int i = 0;
+       while (i++ < data_length)
+               g_variant_builder_add(builder, "(y)", data_array[i]);
+
+       *data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_TEST_PATH,
+               NFC_TEST_INTERFACE,
+               "SetEeData",
+               g_variant_new("(uu@a(y))", *mode, *reg_id, *data),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::EseTest()
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("EseTest()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_TEST_PATH,
+               NFC_TEST_INTERFACE,
+               "EseTest",
+               NULL,
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::SetSeTechType(unsigned int *type, unsigned int *tech)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("SetSeTechType()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_TEST_PATH,
+               NFC_TEST_INTERFACE,
+               "SetSeTechType",
+               g_variant_new("(uu)", *type, *tech),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::SetListenTechMask(unsigned int *tech)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("SetListenTechMask()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_TEST_PATH,
+               NFC_TEST_INTERFACE,
+               "SetListenTechMask",
+               g_variant_new("(u)", *tech),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+//===================== Snep ======================
+
+int Manager::ServerRegister(unsigned int *sap, char **san, unsigned int *user_data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("ServerRegister()");
+
+       unsigned int data_length = 10;
+       char data_array[data_length] = {'a', 'a', '\0'};
+       *san = &data_array[0];
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SNEP_PATH,
+               NFC_SNEP_INTERFACE,
+               "ServerRegister",
+               g_variant_new("(usu)", *sap, *san, *user_data),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::ServerUnregister(unsigned int *sap, char **san)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("ServerUnregister()");
+
+       unsigned int data_length = 10;
+       char data_array[data_length] = {'a', 'a', '\0'};
+       *san = &data_array[0];
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SNEP_PATH,
+               NFC_SNEP_INTERFACE,
+               "ServerUnregister",
+               g_variant_new("(us)", *sap, *san),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::ServerStart(unsigned int *handle, unsigned int *sap, char **san, unsigned int *user_data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("ServerStart()");
+
+       unsigned int data_length = 10;
+       char data_array[data_length] = {'a', 'a', '\0'};
+       *san = &data_array[0];
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SNEP_PATH,
+               NFC_SNEP_INTERFACE,
+               "ServerStart",
+               g_variant_new("(uusu)", *handle, *sap, *san, *user_data),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::ClientStart(unsigned int *handle, unsigned int *sap, char **san, unsigned int *user_data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("ClientStart()");
+
+       unsigned int data_length = 10;
+       char data_array[data_length] = {'a', 'a', '\0'};
+       *san = &data_array[0];
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SNEP_PATH,
+               NFC_SNEP_INTERFACE,
+               "ClientStart",
+               g_variant_new("(uusu)", *handle, *sap, *san, *user_data),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::ClientRequest(unsigned int *snep_handle, unsigned int *type, GVariant **ndef_msg, GVariant **data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("ClientRequest()");
+
+       unsigned int data_length = 10;
+       unsigned char data_array[data_length] = {'a', 'a', '\0'};
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+       unsigned int i = 0;
+       while (i++ < data_length)
+               g_variant_builder_add(builder, "(y)", data_array[i]);
+
+       *ndef_msg = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SNEP_PATH,
+               NFC_SNEP_INTERFACE,
+               "ClientRequest",
+               g_variant_new("(uu@a(y))", *snep_handle, *type, *ndef_msg),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       GVariantIter *iter = NULL;
+       unsigned char endpoint = 0;
+       builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+
+       g_variant_get(message, "(iua(y))", &error, type, &iter);
+       GLOGD("ret = [%d: %d: ...]", error, *type);
+
+       while (g_variant_iter_loop(iter, "(y)", &endpoint))
+               g_variant_builder_add(builder, "(y)", endpoint);
+
+       *data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+       g_variant_iter_free(iter);
+       g_variant_unref(message);
+
+       return error;
+}
+
+int Manager::StopSnep(unsigned int *handle, unsigned int *snep_handle)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("StopSnep()");
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_SNEP_PATH,
+               NFC_SNEP_INTERFACE,
+               "StopSnep",
+               g_variant_new("(uu)", *handle, *snep_handle),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       return error;
+}
+
+//===================== Hce ======================
+
+int Manager::StartHceHandler()
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("StartHceHandler()");
+
+       int pre_error = this->SetActive(true);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_HCE_PATH,
+               NFC_HCE_INTERFACE,
+               "StartHceHandler",
+               NULL,
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       if (pre_error != ERROR_NONE)
+               return pre_error;
+
+       return error;
+}
+
+int Manager::StopHceHandler()
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("StopHceHandler()");
+
+       int pre_error = this->SetActive(true);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_HCE_PATH,
+               NFC_HCE_INTERFACE,
+               "StopHceHandler",
+               NULL,
+               &error);
+
+       if (message == NULL) {
+               GLOGD("Failed to invoke dbus method");
+               return error;
+       }
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       if (pre_error != ERROR_NONE)
+               return pre_error;
+
+       return error;
+}
+
+int Manager::ResponseApdu(unsigned int *handle, GVariant **data)
+{
+       GVariant *message = NULL;
+       int error = ERROR_NONE;
+
+       GLOGD("ResponseApdu()");
+
+       bool is_connected = 0;
+       int dev_type = 0;
+       int pre_error = this->GetCurrentTargetHandle(&is_connected, handle, &dev_type);
+
+       unsigned int data_length = 10;
+       unsigned char data_array[data_length] = {'a', 'a', '\0'};
+       GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("a(y)"));
+       unsigned int i = 0;
+       while (i++ < data_length)
+               g_variant_builder_add(builder, "(y)", data_array[i]);
+
+       *data = g_variant_builder_end(builder);
+       g_variant_builder_unref(builder);
+
+       message = InvokeMethod(NFC_MGR_SERVICE,
+               NFC_HCE_PATH,
+               NFC_HCE_INTERFACE,
+               "ResponseApdu",
+               g_variant_new("(u@a(y))", *handle, *data),
+               &error);
+
+       if (message == NULL)
+               return error;
+
+       g_variant_get(message, "(i)", &error);
+       GLOGD("ret = [%d]", error);
+       g_variant_unref(message);
+
+       if (pre_error != ERROR_NONE || is_connected == 0)
+               return ERROR_INVALID_OPERATION;
+
+       return error;
+}
diff --git a/unittest/manager.h b/unittest/manager.h
new file mode 100644 (file)
index 0000000..0a2151e
--- /dev/null
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __NFC_MGR_MANAGER_H__
+#define __NFC_MGR_MANAGER_H__
+
+#include "nfcmgr.h"
+#include "gdbus.h"
+
+#define WMESHD_STATION_TYPE_MESH_POINT 0
+
+class Manager:public GDbus {
+private:
+public:
+       Manager();
+       ~Manager();
+
+//===================== Manager ======================
+
+       int SetActive(bool is_active);
+       int GetServerState(unsigned int *state);
+
+//===================== Tag ======================
+
+       int IsTagConnected(bool *is_connected, int *dev_type);
+       int GetCurrentTagInfo(bool *is_connected, unsigned int *handle, int *dev_type, bool *is_ndef_supported, unsigned char *ndef_card_state,
+                               unsigned int *max_data_size, unsigned int *actual_data_size, unsigned int *number_of_keys, GVariant **target_info_values, GVariant **raw_data);
+       int GetBarcode(GVariant **barcode);
+       int GetCurrentTargetHandle(bool *is_connected, unsigned int *handle, int *dev_type);                                    //remove sleep and check it's effect
+
+//===================== Ndef ======================
+
+       int Read(unsigned int *handle, GVariant **data);
+       int Write(unsigned int *handle, GVariant **data);
+       int MakeReadOnly(unsigned int *handle);
+       int Format(unsigned int *handle, unsigned char *key, unsigned int key_length);
+
+
+//===================== Llcp ======================
+
+       int Config(unsigned short *c1, unsigned short *c2, unsigned char *c3, unsigned char *c4);
+       int Listen(unsigned int *handle, unsigned int *client_socket, unsigned short *miu, unsigned char *rw, int *type, unsigned char *sap, char **service_name);
+       int Accept(unsigned int *handle, unsigned int *client_socket);
+       int Reject(unsigned int *handle, unsigned int *client_socket);
+       int Connect(unsigned int *handle, unsigned int *client_socket, unsigned short *miu, unsigned char *rw, int *type, char **service_name);
+       int ConnectSap(unsigned int *handle, unsigned int *client_socket, unsigned short *miu, unsigned char *rw, int *type, unsigned char *sap);
+       int Send(unsigned int *handle, unsigned int *client_socket, GVariant **data);
+       int SendTo(unsigned int *handle, unsigned int *client_socket, unsigned char *sap, GVariant **data);
+       int Receive(unsigned int *handle, unsigned int *client_socket, unsigned int *request_length, GVariant **data);
+       int ReceiveFrom(unsigned int *handle, unsigned int *client_socket, unsigned int *request_length, unsigned char *sap, GVariant **data);
+       int Close(unsigned int *handle, unsigned int *client_socket);
+       int Disconnect(unsigned int *handle, unsigned int *client_socket);
+
+
+
+
+//===================== P2p ======================
+
+       int SendPtop(int *type, GVariant **data, unsigned int *handle);
+
+//===================== Popup ======================
+
+       int SetPopup(int *state, int *focus_state);
+       int GetPopup(int *state);
+
+//===================== SecureElement ======================
+
+       int Set(int *type);
+       int Get(int *type);
+       int SetCardEmulation(int *mode);
+       int GetCardEmulation(int *type);
+       int OpenSecureElement(int *type, unsigned int *handle);
+       int CloseSecureElement(unsigned int *handle);
+       int GetAtr(unsigned int *handle, GVariant **atr);
+       int SendAPDU(unsigned int *handle, GVariant **data, GVariant **response);
+
+       int SetTransactionFgDispatch(int *mode);
+       int SetDefaultRoute(unsigned int *switch_on, unsigned int *switch_off, unsigned int *battery_off);
+       int SetPreferredHandler(bool *state);
+       int CheckTransactionPermission(GVariant **aid);
+       int IsActivatedAidHandler(unsigned int *type, char **aid, bool *activated);
+       int IsActivatedCategoryHandler(unsigned int *type, unsigned int *category, bool *activated);
+       int GetRegisteredAids(unsigned int *type, unsigned int *category, GVariant **aids);
+       int RegisterAid(unsigned int *type, unsigned int *category, char **aid);
+       int UnregisterAid(unsigned int *type, unsigned int *category, char **aid);
+       int UnregisterAids(unsigned int *type, unsigned int *category);
+       int AddRouteAid(char **package, char **aid, unsigned int *se_type, unsigned int *category, bool *unlock, unsigned int *power);
+       int RemoveRouteAid(char **package, char **aid);
+       int RemovePackageAids(char **package);
+       int GetRegisteredHandlers(unsigned int *category, GVariant **packages);
+       int GetHandlerStorageInfo(unsigned int *category,  int *used, int *maximum);
+       int GetConflictHandlers(char **package, unsigned int *category, char **aid, GVariant **packages);
+
+//===================== Transceive ======================
+
+       int TransceiveData(unsigned int *handle, unsigned int *dev_type, GVariant **data, GVariant **resp_data);
+       int Transceive(unsigned int *handle, unsigned int *dev_type, GVariant **data);
+
+//===================== Handover ======================
+
+       int Request(unsigned int *handle, int *type, int *carrier_type, GVariant **handover_data);
+
+//===================== Test ======================
+
+       int SimTest();
+       int PrbsTest(unsigned int *tech, unsigned int *rate);
+       int GetFirmwareVersion(GVariant **version);
+       int SetEeData(unsigned int *mode, unsigned int *reg_id, GVariant **data);
+       int EseTest();
+       int SetSeTechType(unsigned int *type, unsigned int *tech);
+       int SetListenTechMask(unsigned int *tech);
+
+//===================== Snep ======================
+
+       int ServerRegister(unsigned int *sap, char **san, unsigned int *user_data);
+       int ServerUnregister(unsigned int *sap, char **san);
+       int ServerStart(unsigned int *handle, unsigned int *sap, char **san, unsigned int *user_data);
+       int ClientStart(unsigned int *handle, unsigned int *sap, char **san, unsigned int *user_data);
+       int ClientRequest(unsigned int *snep_handle, unsigned int *type, GVariant **ndef_msg, GVariant **data);
+       int StopSnep(unsigned int *handle, unsigned int *snep_handle);
+
+//===================== Hce ======================
+
+       int StartHceHandler();
+       int StopHceHandler();
+       int ResponseApdu(unsigned int *handle, GVariant **data);
+
+};
+#endif /* __NFC_MGR_MANAGER_H__ */
+
+
diff --git a/unittest/nfcmgr.h b/unittest/nfcmgr.h
new file mode 100644 (file)
index 0000000..efa0119
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __NFC_MGR_H__
+#define __NFC_MGR_H__
+
+#include <glib.h>
+
+#ifdef USE_DLOG
+#include <dlog.h>
+#undef LOG_TAG
+#define LOG_TAG "NFC_MGR_GTEST"
+#define GLOGD(format, args...) LOGD(format, ##args)
+#else
+#define GLOGD(format, args...)
+#endif
+
+typedef enum {
+       ERROR_NONE = 0,
+       ERROR_NOT_PERMITTED = -1,
+       ERROR_OUT_OF_MEMORY = -2,
+       ERROR_PERMISSION_DENIED = -3,
+       ERROR_RESOURCE_BUSY = -4,
+       ERROR_INVALID_OPERATION = -5,
+       ERROR_INVALID_PARAMETER = -6,
+       ERROR_NOT_SUPPORTED = -7,
+       ERROR_OPERATION_FAILED = -8,
+       ERROR_NOT_INITIALIZED = -9,
+       ERROR_ALREADY_INITIALIZED = -10,
+       ERROR_IN_PROGRESS = -11,
+} error_e;
+
+
+#endif /* __NFC_MGR_H__ */
diff --git a/unittest/unittest.cpp b/unittest/unittest.cpp
new file mode 100644 (file)
index 0000000..a0e066b
--- /dev/null
@@ -0,0 +1,897 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <iostream>
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+#include <system_info.h>
+
+#include "manager.h"
+
+using ::testing::InitGoogleTest;
+using ::testing::Test;
+using ::testing::TestCase;
+
+char *feature_name = (char *)"http://tizen.org/feature/network.nfc";
+
+int CheckFeature()
+{
+       bool nfc_supported = FALSE;
+       if (!system_info_get_platform_bool(feature_name, &nfc_supported)) {
+               if (FALSE == nfc_supported) {
+                       GLOGD("nfc feature is disabled");       // LCOV_EXCL_LINE
+                       return ERROR_NOT_SUPPORTED;
+               }
+               return ERROR_NONE;
+       } else {
+               GLOGD("Error - Feature getting from System Info");      // LCOV_EXCL_LINE
+               return ERROR_INVALID_PARAMETER;
+       }
+}
+
+//===================== Manager ======================
+
+TEST(nfc_gtest, SetActive_n)
+{
+       int ret = ERROR_NONE;
+       Manager mgr;
+
+       ret = mgr.SetActive(false);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, SetActive_p)
+{
+       int ret = ERROR_NONE;
+       Manager mgr;
+
+       ret = mgr.SetActive(true);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, GetServerState_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int state = 0;
+
+       ret = mgr.GetServerState(&state);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+//===================== Tag ======================
+
+TEST(nfc_gtest, IsTagConnected_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       bool is_connected = 0;
+       int dev_type = 0;
+
+       ret = mgr.IsTagConnected(&is_connected, &dev_type);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, GetCurrentTagInfo_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       bool is_connected = 0;
+       unsigned int handle = 0;
+       int dev_type = 0;
+       bool is_ndef_supported = 0;
+       unsigned char ndef_card_state = 0;
+       unsigned int max_data_size = 0;
+       unsigned int actual_data_size = 0;
+       unsigned int number_of_keys = 0;
+       GVariant *target_info_values = NULL;
+       GVariant *raw_data = NULL;
+
+       ret = mgr.GetCurrentTagInfo(&is_connected,
+                       &handle, &dev_type, &is_ndef_supported,
+                       &ndef_card_state, &max_data_size,
+                       &actual_data_size, &number_of_keys,
+                       &target_info_values, &raw_data);
+
+       if(target_info_values)
+               g_variant_unref(target_info_values);
+       if(raw_data)
+               g_variant_unref(raw_data);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, GetBarcode_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       GVariant *barcode = NULL;
+
+       ret = mgr.GetBarcode(&barcode);
+
+       if(barcode)
+               g_variant_unref(barcode);
+
+       EXPECT_EQ(ERROR_INVALID_OPERATION, ret);
+}
+
+TEST(nfc_gtest, GetCurrentTargetHandle_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       bool is_connected = 0;
+       unsigned int handle = 0;
+       int dev_type = 0;
+
+       ret = mgr.GetCurrentTargetHandle(&is_connected, &handle, &dev_type);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+//===================== Ndef ======================
+
+TEST(nfc_gtest, Read_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       GVariant *data = NULL;
+
+       ret = mgr.Read(&handle, &data);
+
+       if (data)
+               g_variant_unref(data);
+
+       EXPECT_EQ(ERROR_INVALID_OPERATION, ret);
+}
+
+TEST(nfc_gtest, Write_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       GVariant *data = NULL;
+
+       ret = mgr.Write(&handle, &data);
+
+       EXPECT_EQ(ERROR_INVALID_OPERATION, ret);
+}
+
+TEST(nfc_gtest, MakeReadOnly_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+
+       ret = mgr.MakeReadOnly(&handle);
+
+       EXPECT_EQ(ERROR_INVALID_OPERATION, ret);
+}
+
+TEST(nfc_gtest, Format_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       unsigned int key_length = 4;
+       unsigned char key[key_length] = { 'a', 'a', 'a', 'a' };
+
+       ret = mgr.Format(&handle, key, key_length);
+
+       EXPECT_EQ(ERROR_INVALID_OPERATION, ret);
+}
+
+//===================== Llcp ======================
+
+TEST(nfc_gtest, Config_p)
+{
+       Manager mgr;                    // file: "net_nfc_server_llcp.c +860":- g_variant_get(arg_config, "(qqyy)", &data->miu, &data->wks, &data->lto, &data->option)
+       int ret = ERROR_NONE;
+       unsigned short c1 = 128;                                // default values from file "net_nfc_server_llcp.h"
+       unsigned short c2 = 1;
+       unsigned char c3 = 10;
+       unsigned char c4 = 0;
+
+       ret = mgr.Config(&c1, &c2, &c3, &c4);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+unsigned int client_socket_value = 0;
+
+TEST(nfc_gtest, Listen_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       unsigned int client_socket = 0;                         // this value get returned also
+       unsigned short miu = 128;
+       unsigned char rw = 0;
+       int type = 1;                                           // socket_type
+       unsigned char sap = 1;                          // SDP_SAP 1, IP_SAP 2, OBEX_SAP 3              // 1 gives 982: invalid handle, bind failed
+       char *service_name = NULL;                      // these lines at two places
+
+       ret = mgr.Listen(&handle, &client_socket, &miu, &rw, &type, &sap, &service_name);
+
+       client_socket_value = client_socket;
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, Accept_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       unsigned int client_socket = 0;
+
+       ret = mgr.Accept(&handle, &client_socket);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, Close_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       unsigned int client_socket = 0;
+
+       ret = mgr.Close(&handle, &client_socket);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+
+//===================== P2p ======================
+
+TEST(nfc_gtest, SendPtop_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       int type = 0;
+       GVariant *data = NULL;
+       unsigned int handle = 0;
+
+       ret = mgr.SendPtop(&type, &data, &handle);
+
+       EXPECT_EQ(ERROR_INVALID_OPERATION, ret);
+}
+
+//===================== Popup ======================
+
+TEST(nfc_gtest, SetPopup_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       int state = 0;
+       int focus_state = 0;
+
+       ret = mgr.SetPopup(&state, &focus_state);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, GetPopup_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       int state = 0;
+
+       ret = mgr.GetPopup(&state);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+//===================== SecureElement ======================
+
+TEST(nfc_gtest, Set_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       int type = 0;                           // se_type
+
+       ret = mgr.Set(&type);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, Set_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       int type = 1;
+
+       ret = mgr.Set(&type);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, Get_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       int type = 0;           // check value of type in output, to be fetched
+
+       ret = mgr.Get(&type);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, SetCardEmulation_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       int mode = 1;                           // 1 means ON
+
+       ret = mgr.SetCardEmulation(&mode);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, GetCardEmulation_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       int type = 0;                           // to be fetched
+
+       ret = mgr.GetCardEmulation(&type);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, OpenSecureElement_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       int type = 1;                                   // its "se_type", -- is 4(hce) a valid option?
+       unsigned int handle = 0;                // to be fetched
+
+       ret = mgr.OpenSecureElement(&type, &handle);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, CloseSecureElement_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+
+       ret = mgr.CloseSecureElement(&handle);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, GetAtr_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       GVariant *atr = NULL;
+
+       ret = mgr.GetAtr(&handle, &atr);
+
+       if(atr)
+               g_variant_unref(atr);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, SendAPDU_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       GVariant *data = NULL;
+       GVariant *response = NULL;
+
+       ret = mgr.SendAPDU(&handle, &data, &response);
+
+       if(response)
+               g_variant_unref(response);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, SetTransactionFgDispatch_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       int mode = 0;
+
+       ret = mgr.SetTransactionFgDispatch(&mode);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, SetDefaultRoute_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int switch_on = 1;
+       unsigned int switch_off = 0;
+       unsigned int battery_off = 0;
+
+       ret = mgr.SetDefaultRoute(&switch_on, &switch_off, &battery_off);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, SetPreferredHandler_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       bool state = 0;                         //net_nfc_secure_element_state_e (0-inactive, active)
+
+       ret = mgr.SetPreferredHandler(&state);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, CheckTransactionPermission_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       GVariant *aid = NULL;
+
+       ret = mgr.CheckTransactionPermission(&aid);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, IsActivatedAidHandler_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int type = 1;
+       char *aid = NULL;
+       bool activated = 0;
+
+       ret = mgr.IsActivatedAidHandler(&type, &aid, &activated);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, IsActivatedCategoryHandler_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int type = 1;
+       unsigned int category = 1;
+       bool activated = 0;
+
+       ret = mgr.IsActivatedCategoryHandler(&type, &category, &activated);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, GetRegisteredAids_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int type = 1;
+       unsigned int category = 1;
+       GVariant *aids = NULL;
+
+       ret = mgr.GetRegisteredAids(&type, &category, &aids);
+
+       if(aids)
+               g_variant_unref(aids);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, RegisterAid_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int type = 1;
+       unsigned int category = 1;                              //net_nfc_card_emulation_category_t(0-unknown, payment, other, 3-max)
+       char *aid = NULL;
+
+       ret = mgr.RegisterAid(&type, &category, &aid);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, UnregisterAid_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int type = 1;
+       unsigned int category = 1;
+       char *aid = NULL;
+
+       ret = mgr.UnregisterAid(&type, &category, &aid);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, UnregisterAids_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int type = 1;
+       unsigned int category = 1;
+
+       ret = mgr.UnregisterAids(&type, &category);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+
+TEST(nfc_gtest, AddRouteAid_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       char *package = NULL;
+       char *aid = NULL;
+       unsigned int se_type = 1;
+       unsigned int category = 1;                      //net_nfc_card_emulation_category_t
+       bool unlock = 1;                                // its value???
+       unsigned int power = 1;
+
+       ret = mgr.AddRouteAid(&package, &aid, &se_type, &category, &unlock, &power);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, RemoveRouteAid_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       char *package = NULL;
+       char *aid = NULL;
+
+       ret = mgr.RemoveRouteAid(&package, &aid);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, RemovePackageAids_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       char *package = NULL;
+
+       ret = mgr.RemovePackageAids(&package);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, GetRegisteredHandlers_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int category = 1;
+       GVariant *packages = NULL;
+
+       ret = mgr.GetRegisteredHandlers(&category, &packages);
+
+       if(packages)
+               g_variant_unref(packages);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, GetHandlerStorageInfo_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int category = 1;
+       int used = 0;
+       int maximum = 0;
+
+       ret = mgr.GetHandlerStorageInfo(&category, &used, &maximum);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, GetConflictHandlers_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       char *package = NULL;
+       unsigned int category = 1;
+       char *aid = NULL;
+       GVariant *packages = NULL;
+
+       ret = mgr.GetConflictHandlers(&package, &category, &aid, &packages);
+
+       if(packages)
+               g_variant_unref(packages);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+//===================== Transceive ======================
+
+TEST(nfc_gtest, TransceiveData_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       unsigned int dev_type = 0;
+       GVariant *data = NULL;
+       GVariant *resp_data = NULL;
+
+       ret = mgr.TransceiveData(&handle, &dev_type, &data, &resp_data);
+
+       if(resp_data)
+               g_variant_unref(resp_data);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, Transceive_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       unsigned int dev_type = 0;
+       GVariant *data = NULL;
+
+       ret = mgr.Transceive(&handle, &dev_type, &data);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+//===================== Handover ======================
+
+TEST(nfc_gtest, Request_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       int type = 4;
+       int carrier_type = 0;
+       GVariant *handover_data = NULL;
+
+       ret = mgr.Request(&handle, &type, &carrier_type, &handover_data);
+
+       if(handover_data)
+               g_variant_unref(handover_data);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+//===================== Test ======================
+
+TEST(nfc_gtest, SimTest_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+
+       ret = mgr.SimTest();
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, PrbsTest_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int tech = 0;
+       unsigned int rate = 0;
+
+       ret = mgr.PrbsTest(&tech, &rate);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, GetFirmwareVersion_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       GVariant *version = NULL;
+
+       ret = mgr.GetFirmwareVersion(&version);
+
+       if (version)
+               g_variant_unref(version);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, SetEeData_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int mode = 1;
+       unsigned int reg_id = 0;
+       GVariant *data = NULL;
+
+       ret = mgr.SetEeData(&mode, &reg_id, &data);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, EseTest_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+
+       ret = mgr.EseTest();
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, SetSeTechType_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int type = 1;
+       unsigned int tech = 0;
+
+       ret = mgr.SetSeTechType(&type, &tech);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, SetListenTechMask_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int tech = 0;
+
+       ret = mgr.SetListenTechMask(&tech);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+//===================== Snep ======================
+
+TEST(nfc_gtest, ServerRegister_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int sap = 0;
+       char *san = NULL;
+       unsigned int user_data = 0;
+
+       ret = mgr.ServerRegister(&sap, &san, &user_data);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, ServerUnregister_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int sap = 0;
+       char *san = NULL;
+       unsigned int user_data = 0;
+
+       ret = mgr.ServerRegister(&sap, &san, &user_data);
+       if (ret == ERROR_NONE) {
+               ret = mgr.ServerUnregister(&sap, &san);
+       }
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, ServerStart_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       unsigned int sap = 0;
+       char *san = NULL;
+       unsigned int user_data = 0;
+
+       ret = mgr.ServerStart(&handle, &sap, &san, &user_data);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, ClientStart_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       unsigned int sap = 0;
+       char *san = NULL;
+       unsigned int user_data = 0;
+
+       ret = mgr.ClientStart(&handle, &sap, &san, &user_data);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, ClientRequest_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int snep_handle = 0;
+       unsigned int type = 0;
+       GVariant *ndef_msg = NULL;
+       GVariant *data = NULL;
+
+       ret = mgr.ClientRequest(&snep_handle, &type, &ndef_msg, &data);
+
+       if(data)
+               g_variant_unref(data);
+
+       EXPECT_NE(ERROR_NONE, ret);
+}
+
+TEST(nfc_gtest, StopSnep_p)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       unsigned int snep_handle = 0;
+
+       ret = mgr.StopSnep(&handle, &snep_handle);
+
+       EXPECT_EQ(ERROR_NONE, ret);
+}
+
+//===================== Hce ======================
+
+
+TEST(nfc_gtest, StartHceHandler_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+
+       ret = mgr.StartHceHandler();
+
+       EXPECT_EQ(-975, ret);
+}
+
+TEST(nfc_gtest, StopHceHandler_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+
+       ret = mgr.StopHceHandler();
+
+       EXPECT_EQ(-975, ret);
+}
+
+TEST(nfc_gtest, ResponseApdu_n)
+{
+       Manager mgr;
+       int ret = ERROR_NONE;
+       unsigned int handle = 0;
+       GVariant *data = NULL;
+
+       ret = mgr.ResponseApdu(&handle, &data);
+
+       EXPECT_EQ(ERROR_INVALID_OPERATION, ret);
+}
+
+// ********************************************
+
+int main(int argc, char **argv)
+{
+       int ret = 0;
+       ret = CheckFeature();
+
+       if (ERROR_NONE != ret)
+               return ret;
+
+       testing::InitGoogleTest(&argc, argv);
+       ret = RUN_ALL_TESTS();
+
+       return ret;
+}