change to new nfc-manager(using GDBus) 59/7759/11
authorYoungjae Shin <yj99.shin@samsung.com>
Sat, 3 Aug 2013 02:21:57 +0000 (11:21 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Thu, 29 Aug 2013 08:18:22 +0000 (17:18 +0900)
Change-Id: Icfb9634be03392f9a3c49853866e6576b2e721e7

15 files changed:
CMakeLists.txt
TC/testcase/Makefile [changed mode: 0755->0644]
TC/testcase/tslist [changed mode: 0755->0644]
TC/testcase/utc_network_nfc.c [changed mode: 0755->0644]
TC/testcase/utc_network_nfc_ndef_message.c [changed mode: 0755->0644]
TC/testcase/utc_network_nfc_ndef_record.c [changed mode: 0755->0644]
TC/tet_scen [changed mode: 0755->0644]
capi-network-nfc.pc.in
debian/control [changed mode: 0755->0644]
include/nfc.h [changed mode: 0755->0644]
include/nfc_internal.h [new file with mode: 0644]
include/nfc_private.h [deleted file]
packaging/capi-network-nfc.spec
src/nfc.c
test/network_nfc_test.c [changed mode: 0755->0644]

index 0aadfd9ed9c74137d5fb3c4286a769045b42162a..56e4ac337300d3fce00310c1d02472394aea34f4 100644 (file)
@@ -11,40 +11,26 @@ SET(Services
         "social"
         "telephony"
         "system"
-   )
-
+)
 
 # project
 SET(project_prefix "capi")
-SET(prefix "/usr")
-SET(version "0.0.3")
-SET(maintainer "Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>")
-SET(description "A NFC library in Tizen Native API")
 SET(service "network")
 SET(submodule "nfc")
 
-# for package file
-SET(dependents "dlog glib-2.0 nfc-common-lib nfc capi-base-common vconf ecore-x capi-appfw-app-manager")
-SET(pc_dependents "capi-base-common")
-
 SET(fw_name "${project_prefix}-${service}-${submodule}")
+PROJECT(${fw_name} C)
 
-PROJECT(${fw_name})
-
-SET(CMAKE_INSTALL_PREFIX ${prefix})
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(VERSION ${version})
-
-SET(INC_DIR include)
-INCLUDE_DIRECTORIES(${INC_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_name} REQUIRED ${dependents})
-FOREACH(flag ${${fw_name}_CFLAGS})
+pkg_check_modules(pkgs REQUIRED dlog glib-2.0 gio-2.0 nfc-common-lib nfc capi-base-common
+       vconf ecore-x)
+FOREACH(flag ${pkgs_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
 SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
 
 IF("${ARCH}" STREQUAL "arm")
@@ -52,40 +38,31 @@ IF("${ARCH}" STREQUAL "arm")
 ENDIF("${ARCH}" STREQUAL "arm")
 
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DTIZEN_DEBUG")
 
 SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
 
-aux_source_directory(src SOURCES)
-ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
-
-TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+SET(SOURCES src/nfc.c)
 
-SET_TARGET_PROPERTIES(${fw_name}
-     PROPERTIES
-     VERSION ${FULLVER}
-     SOVERSION ${MAJORVER}
-     CLEAN_DIRECT_OUTPUT 1
-)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+TARGET_LINK_LIBRARIES(${fw_name} ${pkgs_LDFLAGS})
+SET_TARGET_PROPERTIES(${fw_name} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
 
 INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
 INSTALL(
-        DIRECTORY ${INC_DIR}/ DESTINATION include/${service}
+        DIRECTORY include/ DESTINATION include/${service}
         FILES_MATCHING
-        PATTERN "*_private.h" EXCLUDE
-        PATTERN "${INC_DIR}/*.h"
+        PATTERN "*_internal.h" EXCLUDE
+        PATTERN "include/*.h"
         )
 
 SET(PC_NAME ${fw_name})
-SET(PC_REQUIRED ${pc_dependents})
+SET(PC_REQUIRED "capi-base-common")
 SET(PC_LDFLAGS -l${fw_name})
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(VERSION ${FULLVER})
 
-CONFIGURE_FILE(
-    ${fw_name}.pc.in
-    ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
-    @ONLY
-)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+CONFIGURE_FILE(${fw_name}.pc.in ${fw_name}.pc @ONLY)
+INSTALL(FILES ${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
 
 #ADD_SUBDIRECTORY(test)
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 2b11cf66e13556fb71598ba0c9dc7882d2ab4c5b..653e6e2f37fc3466676811baf0eeeaa1a3f89208 100644 (file)
@@ -1,15 +1,14 @@
-
 # Package Information for pkg-config
 
 prefix=@PREFIX@
 exec_prefix=/usr
 libdir=@LIB_INSTALL_DIR@
-includedir=/usr/include/network
+includedir=@INCLUDE_INSTALL_DIR@/@service@
 
 Name: @PC_NAME@
-Description: @PACKAGE_DESCRIPTION@
+Description: A NFC library in Tizen core API
 Version: @VERSION@
-Requires: @PC_REQUIRED@ 
+Requires: @PC_REQUIRED@
 Libs: -L${libdir} @PC_LDFLAGS@
 Cflags: -I${includedir}
 
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index cc7977d..d59f482
@@ -44,7 +44,7 @@ typedef enum {
        NFC_ERROR_INVALID_NDEF_MESSAGE = NFC_ERROR_CLASS | 0x02,        /**< Invalid NDEF message */
        NFC_ERROR_INVALID_RECORD_TYPE  = NFC_ERROR_CLASS | 0x03,        /**< Invalid record type*/
        NFC_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT,    /**< Timeout error, no answer */
-       NFC_ERROR_DEVICE_BUSY = TIZEN_ERROR_RESOURCE_BUSY,      /**< Previous opertion is not finished still busy */
+       NFC_ERROR_DEVICE_BUSY = TIZEN_ERROR_RESOURCE_BUSY,      /**< Previous operation is not finished still busy */
        NFC_ERROR_NO_DEVICE = NFC_ERROR_CLASS | 0x04, /**< no device */
        NFC_ERROR_NOT_ACTIVATED = NFC_ERROR_CLASS | 0x05, /**< NFC is not activated */
        NFC_ERROR_NOT_SUPPORTED = NFC_ERROR_CLASS | 0x06, /**< Not supported */
@@ -168,21 +168,60 @@ typedef enum{
        NFC_SE_TYPE_UICC = 0x02 /**< UICC type card emulation */
 } nfc_se_type_e;
 
-
-
 /**
- * @brief Enumerations for NFC AC(Alternative Carrior)
+ * @brief Enumerations for NFC AC(Alternative Carrier)
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  */
 typedef enum {
        NFC_AC_TYPE_BT = 0x00, /**< Bluetooth AC*/
        NFC_AC_TYPE_WIFI, /**<Wifi AC*/
        NFC_AC_TYPE_WIFI_DIRECT,/**<Wifi-direct AC*/
-       NFC_AC_TYPE_UNKNOWN, /* No selected preferd AC */
+       NFC_AC_TYPE_UNKNOWN, /* No selected preferred AC */
 } nfc_ac_type_e ;
 
+/**
+ * @brief Enumerations for SNEP event
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ */
+typedef enum {
+       NFC_SNEP_EVENT_STOP = 0x00, /**< server or client stopped */
+       NFC_SNEP_EVENT_START = 0x01, /**< server started or client connected */
+       NFC_SNEP_EVENT_GET = 0x02, /**< server received get request */
+       NFC_SNEP_EVENT_PUT = 0x03, /**< server received put request */
+       NFC_SNEP_EVENT_REGISTER = 0x04, /**< service registered */
+       NFC_SNEP_EVENT_UNREGISTER = 0x05, /**< service unregistered */
+} nfc_snep_event_e;
 
+/**
+ * @brief Enumerations for SNEP request type
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ */
+typedef enum {
+       NFC_SNEP_GET = 0x01, /**< get request */
+       NFC_SNEP_PUT = 0x02, /**< put request */
+} nfc_snep_type_e;
+
+/**
+ * @brief Enumerations for PRBS technology type
+ * @ingroup CAPI_NETWORK_NFC_TEST_MODULE
+ */
+typedef enum {
+       NFC_PRBS_TECH_NONE = 0x00, /**< Unknown NFC technology */
+       NFC_PRBS_TECH_A = 0x01, /**< NFC technology A */
+       NFC_PRBS_TECH_B = 0x02, /**< NFC technology B */
+       NFC_PRBS_TECH_F = 0x03, /**< NFC technology F */
+} nfc_prbs_tech_e;
 
+/**
+ * @brief Enumerations for PRBS speed rate type
+ * @ingroup CAPI_NETWORK_NFC_TEST_MODULE
+ */
+typedef enum {
+       NFC_PRBS_RATE_NONE = 0x00, /**< Unknown NFC speed */
+       NFC_PRBS_RATE_106K = 0x01, /**< 106kbps */
+       NFC_PRBS_RATE_212K = 0x02, /**< 212kbps */
+       NFC_PRBS_RATE_424K = 0x03, /**< 424kbps */
+} nfc_prbs_rate_e;
 
 /**
  * @brief The handle to the NDEF record
@@ -205,10 +244,22 @@ typedef struct _net_nfc_target_info_s *nfc_tag_h;
 
 /**
  * @brief The handle to NFC p2p target
- * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  */
 typedef void *nfc_p2p_target_h;
 
+/**
+ * @brief The handle to NFC p2p snep instance
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ */
+typedef struct _nfc_p2p_snep_s *nfc_p2p_snep_h;
+
+/**
+ * @brief The handle to NFC secure element instance
+ * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ */
+typedef void *nfc_se_h;
+
 /**
  * @brief The default factory key.
  * @details The key is 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
@@ -284,7 +335,7 @@ typedef void (* nfc_activation_completed_cb)(nfc_error_e error, void *user_data)
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @param [in] activated The activation state
- * @param [in] user_data The user data passed from the callback registeration function
+ * @param [in] user_data The user data passed from the callback registration function
  *
  * @see nfc_manager_set_activation_changed_cb()
  */
@@ -356,7 +407,7 @@ typedef void (* nfc_ndef_discovered_cb)(nfc_ndef_message_h message, void *user_d
  * @param[in] value_size The data size in bytes
  * @param[in] user_data The user data passed from the foreach function
  *
- * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
  * @pre nfc_tag_foreach_informations() invokes this callback.
  *
  * @see        nfc_tag_foreach_informations()
@@ -420,8 +471,10 @@ typedef void (* nfc_tag_format_completed_cb)(nfc_error_e result, void *user_data
 /**
  * @brief Called after nfc_mifare_authenticate_with_keyA() has completed
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ *
  * @param [in] result The result of nfc_mifare_authenticate_with_keyA()
  * @param [in] user_data The user data passed from nfc_mifare_authenticate_with_keyA()
+ *
  * @see nfc_mifare_authenticate_with_keyA()
  */
 typedef void (* nfc_mifare_authenticate_with_keyA_completed_cb)(nfc_error_e result, void *user_data);
@@ -429,8 +482,10 @@ typedef void (* nfc_mifare_authenticate_with_keyA_completed_cb)(nfc_error_e resu
 /**
  * @brief Called after nfc_mifare_authenticate_with_keyB() has completed
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ *
  * @param [in] result The result of function call
  * @param [in] user_data The user data passed from nfc_mifare_authenticate_with_keyB()
+ *
  * @see nfc_mifare_authenticate_with_keyB()
  */
 typedef void (* nfc_mifare_authenticate_with_keyB_completed_cb)(nfc_error_e result, void *user_data);
@@ -438,8 +493,10 @@ typedef void (* nfc_mifare_authenticate_with_keyB_completed_cb)(nfc_error_e resu
 /**
  * @brief Called after nfc_mifare_write_block() has completed
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ *
  * @param [in] result The result of nfc_mifare_write_block()
  * @param [in] user_data The user data passed from nfc_mifare_write_block()
+ *
  * @see nfc_mifare_write_block()
  */
 typedef void (* nfc_mifare_write_block_completed_cb)(nfc_error_e result, void *user_data);
@@ -447,8 +504,10 @@ typedef void (* nfc_mifare_write_block_completed_cb)(nfc_error_e result, void *u
 /**
  * @brief Called after nfc_mifare_write_page() has completed
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ *
  * @param [in] result The result of function call
  * @param [in] user_data The user data passed from nfc_mifare_write_page()
+ *
  * @see nfc_mifare_write_page()
  */
 typedef void (* nfc_mifare_write_page_completed_cb)(nfc_error_e result, void *user_data);
@@ -460,9 +519,10 @@ typedef void (* nfc_mifare_write_page_completed_cb)(nfc_error_e result, void *us
  * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
  *
  * @param [in] result The result of function call
- * @param [in] buffer Thre read buffer
+ * @param [in] buffer The read buffer
  * @param [in] size The size of buffer in bytes
  * @param [in] user_data The user data passed from nfc_mifare_read_block()
+ *
  * @see nfc_mifare_read_block()
  */
 typedef void (* nfc_mifare_read_block_completed_cb)(nfc_error_e result, unsigned char *buffer, int bufer_size, void *user_data);
@@ -477,6 +537,7 @@ typedef void (* nfc_mifare_read_block_completed_cb)(nfc_error_e result, unsigned
  * @param [in] buffer The read buffer
  * @param [in] size The size of read buffer in bytes
  * @param [in] user_data The user data passed from nfc_mifare_read_page()
+ *
  * @see nfc_mifare_read_page()
  */
 typedef void (* nfc_mifare_read_page_completed_cb)(nfc_error_e result, unsigned char *buffer, int bufer_size, void *user_data);
@@ -484,8 +545,10 @@ typedef void (* nfc_mifare_read_page_completed_cb)(nfc_error_e result, unsigned
 /**
  * @brief Called after nfc_mifare_increment() has completed
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ *
  * @param [in] result The result of nfc_mifare_increment()
  * @param [in] user_data The user data passed from nfc_mifare_increment()
+ *
  * @see nfc_mifare_increment()
  */
 typedef void (* nfc_mifare_increment_completed_cb)(nfc_error_e result, void *user_data);
@@ -493,8 +556,10 @@ typedef void (* nfc_mifare_increment_completed_cb)(nfc_error_e result, void *use
 /**
  * @brief Called after nfc_mifare_decrement() has completed
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ *
  * @param [in] result The result of nfc_mifare_decrement()
  * @param [in] user_data The user data passed from nfc_mifare_decrement()
+ *
  * @see nfc_mifare_decrement()
  */
 typedef void (* nfc_mifare_decrement_completed_cb)(nfc_error_e result, void *user_data);
@@ -502,8 +567,10 @@ typedef void (* nfc_mifare_decrement_completed_cb)(nfc_error_e result, void *use
 /**
  * @brief Called after nfc_mifare_transfer() has completed
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ *
  * @param [in] result The result of nfc_mifare_transfer()
  * @param [in] user_data The user data passed from nfc_mifare_transfer()
+ *
  * @see nfc_mifare_transfer()
  */
 typedef void (* nfc_mifare_transfer_completed_cb)(nfc_error_e result, void *user_data);
@@ -511,8 +578,10 @@ typedef void (* nfc_mifare_transfer_completed_cb)(nfc_error_e result, void *user
 /**
  * @brief Called after nfc_mifare_restore() has completed
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ *
  * @param [in] result The result of nfc_mifare_restore()
  * @param [in] user_data The user data passed from nfc_mifare_restore()
+ *
  * @see nfc_mifare_restore()
  */
 typedef void (* nfc_mifare_restore_completed_cb)(nfc_error_e result, void *user_data);
@@ -522,6 +591,7 @@ typedef void (* nfc_mifare_restore_completed_cb)(nfc_error_e result, void *user_
 /**
  * @brief Called when NFC peer-to-peer target appeared or disappeared
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
  * @param [in] type The discovered type attached or detached
  * @param [in] target The handle to p2p target
  * @param [in] user_data The user data passed from nfc_manager_set_p2p_target_discovered_cb()
@@ -534,6 +604,7 @@ typedef void (*nfc_p2p_target_discovered_cb)(nfc_discovered_type_e type, nfc_p2p
 /**
  * @brief Called when receiving  Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
  * @param [in] event The Secure Element event
  * @param [in] user_data The user data passed from nfc_manager_set_se_event_cb()
  *
@@ -547,6 +618,7 @@ typedef void (*nfc_se_event_cb)(nfc_se_event_e event , void *user_data);
  * @brief Called when receiving Secure Element(SIM/UICC(Universal Integrated Circuit Card)) transaction event data
  * @remarks This event  notifies , external reader trys to access secure element.
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
  * @param [in] aid Application Id, specified in ISO/IEC 7816-4
  * @param [in] aid_size The size of aid (5~16)
  * @param [in] param The parameter list, specified in ISO/IEC 8825-1
@@ -563,6 +635,7 @@ typedef void (*nfc_se_transaction_event_cb)(unsigned char* aid, int aid_size , u
 /**
  * @brief Called after nfc_p2p_send() has completed.
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
  * @param [in] result The result of function call
  * @param [in] user_data The user data passed from nfc_p2p_send()
  *
@@ -578,7 +651,7 @@ typedef void (*nfc_p2p_send_completed_cb)(nfc_error_e result, void *user_data);
  * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
  *
  * @param [in] target The handle to p2p target
- * @param [in] message The recevied message
+ * @param [in] message The received message
  * @param [in] user_data The user data passed from nfc_p2p_set_recv_cb()
  *
  * @see nfc_p2p_set_data_received_cb()
@@ -593,18 +666,36 @@ typedef void (*nfc_p2p_data_recived_cb)(nfc_p2p_target_h target, nfc_ndef_messag
  *
  * @remark To use the @a ac_data outside this function, copy the @a ac_data.
  * @remark @a ac_data could be NULL, if nfc_p2p_connection_handover failed.
- * @remark If @a carrior is #NFC_AC_TYPE_BT, @ac_data should be converted to 'char *' type. This is bluetooth address information.
+ * @remark If @a carrier is #NFC_AC_TYPE_BT, @ac_data should be converted to 'char *' type. This is bluetooth address information.
  *
  * @param [in] result The result of function call
- * @param [in] carrior The type of Alternative Carrior
- * @param [in] ac_data The connected remote device AC(Alternative Carrior) information data
- * @param [in] ac_data_size The connected remote device AC(Alternative Carrior) information data size
+ * @param [in] carrier The type of Alternative Carrier
+ * @param [in] ac_data The connected remote device AC(Alternative Carrier) information data
+ * @param [in] ac_data_size The connected remote device AC(Alternative Carrier) information data size
  * @param [in] user_data The user data passed from nfc_p2p_connection_handover()
  *
  * @see nfc_p2p_connection_handover()
  */
 typedef void (*nfc_p2p_connection_handover_completed_cb)(nfc_error_e result, nfc_ac_type_e carrior, void * ac_data, int ac_data_size , void *user_data);
 
+
+/**
+ * @brief Called when SNEP event is raised
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @param [in] handle The handle of current snep instance
+ * @param [in] event The kind of snep event
+ * @param [in] result The result of snep event
+ * @param [in] msg The ndef message which received from client or result of get request
+ * @param [in] user_data The user data passed from snep apis.
+ *
+ * @see nfc_snep_start_server()
+ * @see nfc_snep_send_request()
+ */
+typedef void (*nfc_snep_event_cb)(nfc_p2p_snep_h handle,
+       nfc_snep_event_e event, nfc_error_e result,
+       nfc_ndef_message_h msg, void *user_data);
+
 /**
  * @brief Gets the value that indicates whether NFC is supported.
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
@@ -612,6 +703,7 @@ typedef void (*nfc_p2p_connection_handover_completed_cb)(nfc_error_e result, nfc
  * @remarks This function can executed Regardless of nfc_manager_initialize state.
  *
  * @return true on NFC supported,  otherwise false
+ *
  * @see nfc_manager_set_activation()
  */
 bool nfc_manager_is_supported(void);
@@ -630,6 +722,7 @@ bool nfc_manager_is_supported(void);
  * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
  * @retval #NFC_ERROR_ALREADY_ACTIVATED Already activated
  * @retval #NFC_ERROR_ALREADY_DEACTIVATED Already deactivated
+ *
  * @see nfc_manager_is_activated()
  * @see nfc_activation_completed_cb()
  */
@@ -668,6 +761,7 @@ void nfc_manager_unset_activation_changed_cb(void);
  * @remarks This function can executed Regardless of nfc_manager_initialize state.
  *
  * @return true on NFC activated,  otherwise false
+ *
  * @see nfc_manager_set_activation()
  */
 
@@ -687,6 +781,7 @@ bool nfc_manager_is_activated(void);
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
+ *
  * @see nfc_manager_initialize_sync()
  * @see nfc_manager_deinitialize()
  */
@@ -703,6 +798,7 @@ int nfc_manager_initialize(nfc_initialize_completed_cb callback, void *user_data
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
+ *
  * @see nfc_manager_initialize()
  * @see nfc_manager_deinitialize()
  */
@@ -710,12 +806,13 @@ int nfc_manager_initialize_sync();
 
 
 /**
- * @brief Releases all the resource of the NFC Manager and disconnecst the session between an application and NFC Manager.
+ * @brief Releases all the resource of the NFC Manager and disconnect the session between an application and NFC Manager.
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
+ *
  * @see nfc_manager_initialize()
  */
 int nfc_manager_deinitialize(void);
@@ -730,6 +827,7 @@ int nfc_manager_deinitialize(void);
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
  * @see nfc_manager_unset_tag_discovered_cb()
  * @see nfc_tag_discovered_cb()
  */
@@ -754,6 +852,7 @@ void nfc_manager_unset_tag_discovered_cb(void);
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
  * @see nfc_manager_unset_ndef_discovered_cb()
  * @see nfc_ndef_discovered_cb()
  */
@@ -856,7 +955,6 @@ void nfc_manager_unset_se_transaction_event_cb(void);
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE The cached message does not exist
- *
  */
 int nfc_manager_get_cached_message(nfc_ndef_message_h *ndef_message);
 
@@ -864,7 +962,7 @@ int nfc_manager_get_cached_message(nfc_ndef_message_h *ndef_message);
 /**
  * @brief Sets filter of target types.
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
- * @remarks Bit operator OR(|) can be used in the config parameter (like  NFC_TAG_FILTER_ISO14443A_ENABLE | NFC_TAG_FILTER_ISO14443B_ENABLE)
+ * @remarks Bit operator OR(|) can be used in the configure parameter (like  NFC_TAG_FILTER_ISO14443A_ENABLE | NFC_TAG_FILTER_ISO14443B_ENABLE)
  *     or you may choose "NFC_TAG_ALL_ENABLE" enum value to get all result.
  *     It prevent getting tag types from RF level.
  *     If the client api does call this function, default is always NFC_TAG_ALL_ENABLE.
@@ -882,7 +980,9 @@ void nfc_manager_set_tag_filter(int filter);
  *
  * @remarks Bit operation OR(|) is used in return data\n
  * The default value is NFC_TAG_FILTER_ALL_ENABLE
+ *
  * @return The filter which is set #nfc_tag_filter_e
+ *
  * @see nfc_manager_set_tag_filter()
  */
 int nfc_manager_get_tag_filter(void);
@@ -897,7 +997,6 @@ int nfc_manager_get_tag_filter(void);
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_NO_DEVICE There is no connected tag
- *
  */
 int nfc_manager_get_connected_tag(nfc_tag_h *tag);
 
@@ -911,7 +1010,6 @@ int nfc_manager_get_connected_tag(nfc_tag_h *tag);
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_NO_DEVICE There is no connected target
- *
  */
 int nfc_manager_get_connected_target(nfc_p2p_target_h *target);
 
@@ -919,7 +1017,7 @@ int nfc_manager_get_connected_target(nfc_p2p_target_h *target);
 /**
  * @brief Enable or disable the system handling for tag and target discovered event
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
- * @remarks In default, The system handling is enabled.
+ * @remarks By default, The system handling is enabled.
  *
  * @param [in] enable The state of enable
  *
@@ -931,10 +1029,25 @@ int nfc_manager_get_connected_target(nfc_p2p_target_h *target);
  */
 int nfc_manager_set_system_handler_enable(bool enable);
 
+/**
+ * @brief Enable or disable the system handling for tag and target discovered event
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @remarks By default, The system handling is enabled.
+ *
+ * @param [in] enable The state of enable
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ * @see nfc_manager_is_system_handler_enabled()
+ */
+int nfc_manager_set_system_handler_enable_force(bool enable);
+
 /**
  * @brief Gets the state of the system handler
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
- * @remarks In default, The system handling is enabled.
+ * @remarks By default, The system handling is enabled.
  *
  * @return true on enabled, otherwise false.
  *
@@ -994,6 +1107,7 @@ int nfc_manager_get_card_emulation_se_type(nfc_se_type_e* type);
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ *
  * @see nfc_ndef_record_create_text()
  * @see nfc_ndef_record_create_uri()
  * @see nfc_ndef_record_create_mime()
@@ -1023,6 +1137,7 @@ int nfc_ndef_record_create(nfc_ndef_record_h *record, nfc_record_tnf_e tnf, cons
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ *
  * @see nfc_ndef_record_create()
  * @see nfc_ndef_record_create_uri()
  * @see nfc_ndef_record_create_mime()
@@ -1041,7 +1156,7 @@ int nfc_ndef_record_create_text(nfc_ndef_record_h *record, const char *text, con
  * The record is created in this format\n
  * - TNF : NFC_RECORD_TNF_WELL_KNOWN\n
  * - type : "U"\n
- * - payload : procotol scheme + uri\n
+ * - payload : protocol scheme + uri\n
  * Defined in Record Type Definition Technical Specifications.
  *
  * @param [out] record A handle to record
@@ -1052,6 +1167,7 @@ int nfc_ndef_record_create_text(nfc_ndef_record_h *record, const char *text, con
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ *
  * @see nfc_ndef_record_create()
  * @see nfc_ndef_record_create_text()
  * @see nfc_ndef_record_create_mime()
@@ -1083,6 +1199,7 @@ int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char *uri);
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ *
  * @see nfc_ndef_record_create()
  * @see nfc_ndef_record_create_uri()
  * @see nfc_ndef_record_create_text()
@@ -1101,6 +1218,7 @@ int nfc_ndef_record_create_mime(nfc_ndef_record_h* record, const char *mime_type
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
  * @see nfc_ndef_record_create()
  * @see nfc_ndef_record_create_text()
  * @see nfc_ndef_record_create_uri()
@@ -1117,9 +1235,11 @@ int nfc_ndef_record_destroy(nfc_ndef_record_h record);
  * @param [in] record The handle to record
  * @param [in] id The record ID
  * @param [in] id_size The size of ID in bytes
+ *
  * @return 0 on success, otherwise a negative error value.
  * @retval     #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
  * @see nfc_ndef_record_get_id()
  */
 int nfc_ndef_record_set_id(nfc_ndef_record_h record, unsigned char *id, int id_size);
@@ -1139,6 +1259,7 @@ int nfc_ndef_record_set_id(nfc_ndef_record_h record, unsigned char *id, int id_s
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
  * @see nfc_ndef_record_set_id()
  */
 int nfc_ndef_record_get_id(nfc_ndef_record_h record, unsigned char **id, int *size);
@@ -1147,7 +1268,7 @@ int nfc_ndef_record_get_id(nfc_ndef_record_h record, unsigned char **id, int *si
  * @brief Gets record payload.
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  *
- * @remarks This function gives you  the pointer of pyaload that is contained by record\n
+ * @remarks This function gives you  the pointer of payload that is contained by record\n
  * Do not free the payload. it will be freed when @a record is destroyed by nfc_ndef_record_destroy().
  *
  * @param [in] record The handle to record
@@ -1205,6 +1326,7 @@ int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e *tnf);
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
+ *
  * @see nfc_ndef_record_create_text()
  */
 int nfc_ndef_record_get_text(nfc_ndef_record_h record, char **text);
@@ -1223,6 +1345,7 @@ int nfc_ndef_record_get_text(nfc_ndef_record_h record, char **text);
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
+ *
  * @see nfc_ndef_record_create_text()
  */
 int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code);
@@ -1241,6 +1364,7 @@ int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code);
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
+ *
  * @see nfc_ndef_record_create_text()
  */
 int nfc_ndef_record_get_encode_type(nfc_ndef_record_h record, nfc_encode_type_e *encode);
@@ -1260,6 +1384,7 @@ int nfc_ndef_record_get_encode_type(nfc_ndef_record_h record, nfc_encode_type_e
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
+ *
  * @see nfc_ndef_record_create_uri()
  */
 int nfc_ndef_record_get_uri(nfc_ndef_record_h record, char **uri);
@@ -1280,6 +1405,7 @@ int nfc_ndef_record_get_uri(nfc_ndef_record_h record, char **uri);
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
+ *
  * @see nfc_ndef_record_create_mime()
  */
 int nfc_ndef_record_get_mime_type(nfc_ndef_record_h record, char **mime_type);
@@ -1295,9 +1421,9 @@ int nfc_ndef_record_get_mime_type(nfc_ndef_record_h record, char **mime_type);
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ *
  * @see nfc_ndef_message_create_from_rawdata()
  * @see nfc_ndef_message_destroy()
- *
  */
 int nfc_ndef_message_create(nfc_ndef_message_h *ndef_message);
 
@@ -1316,10 +1442,10 @@ int nfc_ndef_message_create(nfc_ndef_message_h *ndef_message);
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ *
  * @see nfc_ndef_message_create()
  * @see nfc_ndef_message_destroy()
  * @see nfc_ndef_message_get_rawdata()
- *
  */
 int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h *ndef_message, const unsigned char *rawdata, int rawdata_size);
 
@@ -1334,6 +1460,7 @@ int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h *ndef_message, const
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
  * @see nfc_ndef_message_create()
  * @see nfc_ndef_message_create_from_rawdata()
  */
@@ -1349,7 +1476,6 @@ int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message);
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
- *
  */
 int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message, int *count);
 
@@ -1357,11 +1483,11 @@ int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message, int *coun
  * @brief Gets serial bytes array of NDEF message.
  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
  *
- * @remarks It gets copy of the rawdata bytes from NDEF message. @a rawdata must be released with free() by you.
+ * @remarks It gets copy of the bytes array from NDEF message. @a rawdata must be released with free() by you.
  *
  * @param [in] ndef_message The handle to NDEF message
- * @param [out] rawdata The bytes array of rawdata
- * @param [out] rawdata_size The size of rawdata in byte
+ * @param [out] rawdata The bytes array of bytes array
+ * @param [out] rawdata_size The size of bytes array in byte
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1385,6 +1511,7 @@ int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message, unsigned char
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
  * @see nfc_ndef_message_insert_record()
  * @see nfc_ndef_message_remove_record()
  */
@@ -1405,6 +1532,7 @@ int nfc_ndef_message_append_record(nfc_ndef_message_h ndef_message, nfc_ndef_rec
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE     Invalid NDEF message
+ *
  * @see nfc_ndef_message_append_record()
  * @see nfc_ndef_message_remove_record()
  */
@@ -1421,6 +1549,7 @@ int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message, int index, n
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE     Invalid NDEF message
+ *
  * @see nfc_ndef_message_append_record()
  * @see nfc_ndef_message_insert_record()
  */
@@ -1439,7 +1568,6 @@ int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message, int index);
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
- *
  */
 int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message, int index, nfc_ndef_record_h *record);
 
@@ -1453,7 +1581,6 @@ int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message, int index, nfc_
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
- *
  */
 int nfc_tag_get_type(nfc_tag_h tag, nfc_tag_type_e *type);
 
@@ -1484,7 +1611,6 @@ int nfc_tag_is_support_ndef(nfc_tag_h tag, bool *is_supported);
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
- *
  */
 int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag, unsigned int *maximum_ndef_bytes_size);
 
@@ -1523,14 +1649,14 @@ int nfc_tag_foreach_information(nfc_tag_h tag, nfc_tag_information_cb callback,
  * @brief Transceives the data of the raw format card.
  * @details This function is the only way to access the raw format card (not formated),
        each tag type requires own command to access tags. \n
-       This function provides the low level access of tag operation and you require the knowlege of each tag technology.
+       This function provides the low level access of tag operation and you require the knowledge of each tag technology.
 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
 *
 * @param [in] tag The handle to NFC tag
 * @param [in] buffer The binary data for parameter or additional commands
 * @param [in] buffer_size The size of buffer in bytes
 * @param [in] callback The callback function to invoke after this function has completed\n It can be null if a notification is not required
-* @param [in] user_data        The user data to be passed to the callback funcation
+* @param [in] user_data        The user data to be passed to the callback function
 *
 * @return 0 on success, otherwise a negative error value.
 * @retval #NFC_ERROR_NONE Successful
@@ -1553,7 +1679,7 @@ int nfc_tag_transceive(nfc_tag_h tag, unsigned char *buffer, int buffer_size, nf
  *
  * @param [in] tag The handle to NFC tag
  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param [in] user_data The user data to be passed to the callback funcation
+ * @param [in] user_data The user data to be passed to the callback function
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1580,7 +1706,7 @@ int nfc_tag_read_ndef(nfc_tag_h tag, nfc_tag_read_completed_cb callback, void *u
  * @param [in] tag The handle to NFC tag
  * @param [in] msg The message will be write to the tag
  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param [in] user_dataa The user data to be passed to the callback funcation
+ * @param [in] user_dataa The user data to be passed to the callback function
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1608,7 +1734,7 @@ int nfc_tag_write_ndef(nfc_tag_h tag, nfc_ndef_message_h msg, nfc_tag_write_comp
  * @param [in] key The key value that may need to format the tag
  * @param [in] key_size The size of key in byte
  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param [in] user_data The user data to be passed to the callback funcation
+ * @param [in] user_data The user data to be passed to the callback function
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1646,7 +1772,7 @@ int nfc_tag_format_ndef(nfc_tag_h tag, unsigned char *key, int key_size, nfc_tag
  * @param[in] sector_index The index of sector to authenticate with key A, starting from 0
  * @param[in] auth_key 6-byte authentication key
  * @param[in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param[in] user_data        The user data to be passed to the callback funcation
+ * @param[in] user_data        The user data to be passed to the callback function
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1689,7 +1815,7 @@ int nfc_mifare_authenticate_with_keyA(nfc_tag_h tag, int sector_index, unsigned
  * @param [in] sector_index The index of sector to authenticate with key B, starting from 0
  * @param [in] auth_key 6-byte authentication key
  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param [in] user_data The user data to be passed to the callback funcation
+ * @param [in] user_data The user data to be passed to the callback function
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1720,7 +1846,7 @@ int nfc_mifare_authenticate_with_keyB(nfc_tag_h tag, int sector_index, unsigned
  * @param [in] tag The handle to NFC tag
  * @param [in] block_index The block or starting page number
  * @param [in] callback        The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param [in] user_data The user data to be passed to the callback funcation
+ * @param [in] user_data The user data to be passed to the callback function
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1746,7 +1872,7 @@ int nfc_mifare_read_block(nfc_tag_h tag, int block_index, nfc_mifare_read_block_
  * @param [in] tag The handle to NFC tag
  * @param [in] page_index  The index of page to read, starting from 0
  * @param [in] callback        The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param [in] user_data The user data to be passed to the callback funcation
+ * @param [in] user_data The user data to be passed to the callback function
  *
  *
  * @return 0 on success, otherwise a negative error value.
@@ -1774,7 +1900,7 @@ int nfc_mifare_read_page(nfc_tag_h tag, int page_index, nfc_mifare_read_page_com
  * @param [in] buffer 16 bytes of data to write
  * @param [in] buffer_size The size of buffer in bytes
  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param [in] user_data The user data to be passed to the callback funcation
+ * @param [in] user_data The user data to be passed to the callback function
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1786,7 +1912,7 @@ int nfc_mifare_read_page(nfc_tag_h tag, int page_index, nfc_mifare_read_page_com
  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
  *
- * @post It invokes nfc_mifare_write_block_completed_cb() when it hase completed to write a block.
+ * @post It invokes nfc_mifare_write_block_completed_cb() when it has completed to write a block.
  *
  * @see nfc_mifare_write_page()
  * @see nfc_mifare_read_block()
@@ -1803,7 +1929,7 @@ int nfc_mifare_write_block(nfc_tag_h tag, int block_index, unsigned char *buffer
  * @param [in] buffer 4 bytes of data to write
  * @param [in] buffer_size The size of buffer in bytes
  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param [in] user_data The user data to be passed to the callback funcation
+ * @param [in] user_data The user data to be passed to the callback function
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1856,7 +1982,7 @@ int nfc_mifare_increment(nfc_tag_h tag, int block_index, int value, nfc_mifare_i
  * @param [in] block_index The index of block to decrease, starting from 0
  * @param [in] value non-negative to decrement by
  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param [in] user_data The user data to be passed to the callback funcation
+ * @param [in] user_data The user data to be passed to the callback function
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1874,13 +2000,13 @@ int nfc_mifare_decrement(nfc_tag_h tag, int block_index, int value, nfc_mifare_d
 
 /**
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
- * @brief Copys from the temporary block to the specified block.
+ * @brief Copy from the temporary block to the specified block.
  * @remarks This function is only available for MIFARE classic
  *
  * @param [in] tag The handle to NFC tag
  * @param [in] block_index The index of block to copy to, starting from 0
  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param [in] user_data The user data to be passed to the callback funcation
+ * @param [in] user_data The user data to be passed to the callback function
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1897,13 +2023,13 @@ int nfc_mifare_transfer(nfc_tag_h tag, int block_index, nfc_mifare_transfer_comp
 
 /**
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
- * @brief Copys from a value block to the temporary block.
+ * @brief Copy from a value block to the temporary block.
  * @remarks This function is only available for MIFARE classic
  *
  * @param [in] tag The handle to NFC tag
  * @param [in] block_index The index of block to copy from, starting from 0
  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param [in] user_data The user data to be passed to the callback funcation
+ * @param [in] user_data The user data to be passed to the callback function
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1960,7 +2086,7 @@ int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target);
  * @param [in] tag The handle to NFC tag
  * @param [in] message The message to send
  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param [in] user_data The user data to be passed to the callback funcation
+ * @param [in] user_data The user data to be passed to the callback function
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1971,7 +2097,7 @@ int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target);
  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
  *
  * @see nfc_p2p_send_completed_cb()
- * @see @see nfc_p2p_target_discovered_cb()
+ * @see nfc_p2p_target_discovered_cb()
 */
 int nfc_p2p_send(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data);
 
@@ -1983,7 +2109,7 @@ int nfc_p2p_send(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_se
  * @param [in] tag The handle to NFC tag
  * @param [in] message The message to send
  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
- * @param [in] user_data The user data to be passed to the callback funcation
+ * @param [in] user_data The user data to be passed to the callback function
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
@@ -1994,18 +2120,18 @@ int nfc_p2p_send(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_se
  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
  *
  * @see nfc_p2p_send_completed_cb()
- * @see @see nfc_p2p_target_discovered_cb()
+ * @see nfc_p2p_target_discovered_cb()
 */
 int nfc_p2p_send_no_permission(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data);
 
 
 
 /**
- * @brief NFC Connetionhandover between NFC peer-to-peer target
+ * @brief NFC Connection handover between NFC peer-to-peer target
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  *
  * @param [in] target The handle to NFC device
- * @param [in] type Prepered Alternative Carrior
+ * @param [in] type Preferred Alternative Carrier
  * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
  * @param [in] user_data The user data to be passed to the callback function
  *
@@ -2018,28 +2144,222 @@ int nfc_p2p_send_no_permission(nfc_p2p_target_h target, nfc_ndef_message_h messa
  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
  *
  * @see nfc_p2p_connection_handover_completed_cb()
- * @see @see nfc_p2p_connection_handover_completed_cb()
-
 */
 int nfc_p2p_connection_handover(nfc_p2p_target_h target , nfc_ac_type_e type, nfc_p2p_connection_handover_completed_cb callback, void *user_data);
 
-
-
 /**
- * @brief Check available Alternative Carrior(AC) for NFC handover between NFC peer-to-peer target
+ * @brief Check available Alternative Carrier(AC) for NFC handover between NFC peer-to-peer target
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  *
- * @param [in] carrior Alternative Carrior whan to be checked whether supported or not
+ * @param [in] carrier Alternative Carrier when to be checked whether supported or not
  *
  * @retval #true Supported
  * @retval #false Not Supported
  *
  * @see nfc_p2p_is_supported_ac_type()
- *
 */
 bool nfc_p2p_is_supported_ac_type( nfc_ac_type_e carrior);
 
 
+/**
+ * @brief Start peer-to-peer server using SNEP protocol
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @param [in] target The handle to peer target
+ * @param [in] san The name of service (service access name)
+ * @param [in] sap The number of service (service access point)
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @see nfc_snep_event_cb()
+*/
+int nfc_snep_start_server(nfc_p2p_target_h target, const char *san, int sap, nfc_snep_event_cb callback, void *user_data);
+
+/**
+ * @brief Start peer-to-peer client using SNEP protocol
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @param [in] target The handle to peer target
+ * @param [in] san The name of service (service access name)
+ * @param [in] sap The number of service (service access point)
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @see nfc_snep_event_cb()
+ * @see nfc_snep_send_client_request()
+ * @see nfc_snep_stop_service
+*/
+int nfc_snep_start_client(nfc_p2p_target_h target, const char *san, int sap, nfc_snep_event_cb callback, void *user_data);
+
+/**
+ * @brief Send request message to peer-to-peer client using SNEP protocol
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @param [in] handle The handle to connected snep instance
+ * @param [in] type The request type of snep protocol
+ * @param [in] msg The ndef message which will be sent
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @see nfc_snep_event_cb()
+*/
+int nfc_snep_send_client_request(nfc_p2p_snep_h handle, nfc_snep_type_e type, nfc_ndef_message_h msg, nfc_snep_event_cb callback, void *user_data);
+
+/**
+ * @brief Stop snep server or client
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @param [in] target The handle to peer target
+ * @param [in] service The handle which will be stopped
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @see nfc_snep_event_cb()
+*/
+int nfc_snep_stop_service(nfc_p2p_target_h target, nfc_p2p_snep_h service);
+
+/**
+ * @brief Register peer-to-peer server using SNEP protocol
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @param [in] san The name of service (service access name)
+ * @param [in] sap The number of service (service access point)
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @see nfc_snep_event_cb()
+*/
+int nfc_snep_register_server(const char *san, int sap, nfc_snep_event_cb callback, void *user_data);
+
+/**
+ * @brief Unregister snep server or client
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @param [in] san The name of service (service access name)
+ * @param [in] sap The number of service (service access point)
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @see nfc_snep_event_cb()
+*/
+int nfc_snep_unregister_server(const char *san, int sap);
+
+/**
+ * @brief Open connection to secure element.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ *
+ * @param [in] se_type   The type you want to open
+ * @param [out] handle    The handle of connected secure element
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE Invalid NDEF message
+ *
+ * @see nfc_se_close_secure_element()
+ */
+int nfc_se_open_secure_element(nfc_se_type_e se_type, nfc_se_h *handle);
+
+/**
+ * @brief Open connection to secure element.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ *
+ * @remarks It gets the allocated bytes array including data. @a resp must be released with free() by you.
+ *
+ * @param [in]  handle   The handle of connected secure element
+ * @param [in]  cmd      The bytes array of apdu command data
+ * @param [in]  cmd_len  The size of apdu command bytes array
+ * @param [out] resp     The bytes array of response data
+ * @param [out] resp_len The size of response bytes array
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE Invalid NDEF message
+ *
+ * @see nfc_se_open_secure_element()
+ * @see nfc_se_close_secure_element()
+ */
+int nfc_se_send_apdu(nfc_se_h handle, unsigned char *cmd, unsigned int cmd_len, unsigned char **resp, unsigned int *resp_len);
+
+/**
+ * @brief Get ATR(Answer to Reset) of connected secure element.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ *
+ * @remarks It gets the allocated bytes array including data. @a atr must be released with free() by you.
+ *
+ * @param [in]  handle  The handle of connected secure element
+ * @param [out] atr     The bytes array of atr data
+ * @param [out] atr_len The size of atr bytes array
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE Invalid NDEF message
+ *
+ * @see nfc_se_open_secure_element()
+ * @see nfc_se_close_secure_element()
+ */
+int nfc_se_get_atr(nfc_se_h handle, unsigned char **atr, unsigned int *atr_len);
+
+/**
+ * @brief Close connection to secure element.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ *
+ * @param [in] handle   The handle of connected secure element
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE Invalid NDEF message
+ *
+ * @see nfc_se_open_secure_element()
+ */
+int nfc_se_close_secure_element(nfc_se_h handle);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/nfc_internal.h b/include/nfc_internal.h
new file mode 100644 (file)
index 0000000..cf4550c
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+*
+* 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_INTERNAL_H__
+#define __NFC_INTERNAL_H__
+
+#include <net_nfc.h>
+
+#include "nfc.h"
+
+typedef struct
+{
+       bool initialized;
+       bool on_activation_doing;
+
+       net_nfc_target_info_h current_tag;
+       net_nfc_target_handle_h current_target;
+
+       nfc_tag_discovered_cb on_tag_discovered_cb;
+       void *on_tag_discovered_user_data;
+
+       nfc_ndef_discovered_cb on_ndef_discovered_cb;
+       void *on_ndef_discovered_user_data;
+
+       nfc_p2p_target_discovered_cb on_p2p_target_discovered_cb;
+       void *on_p2p_target_discovered_user_data;
+
+       nfc_p2p_data_recived_cb on_p2p_recv_cb;
+       void *on_p2p_recv_user_data;
+
+       nfc_se_transaction_event_cb on_se_transaction_event_cb;
+       void *on_se_transaction_event_user_data;
+}_nfc_context_s;
+
+#endif //__NFC_INTERNAL_H__
\ No newline at end of file
diff --git a/include/nfc_private.h b/include/nfc_private.h
deleted file mode 100755 (executable)
index 552129a..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* 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_PRIVATE_H__
-#define __NFC_PRIVATE_H__
-#include <net_nfc.h>
-#include <net_nfc_typedef_private.h>
-
-#include <nfc.h>
-
-
-typedef enum {
-       _NFC_CALLBACK_TYPE_RESULT=0,
-       _NFC_CALLBACK_TYPE_DATA=1,
-} _nfc_callback_type;
-
-
-typedef struct {
-       bool initialized;
-
-       nfc_tag_discovered_cb                   on_tag_discovered_cb;
-       void *                                          on_tag_discovered_user_data;
-       nfc_ndef_discovered_cb          on_ndef_discovered_cb;
-       void *                                          on_ndef_discovered_user_data;
-       net_nfc_target_info_s                   *current_tag;
-
-       //net_nfc_target_handle_s               current_target;
-       net_nfc_target_handle_h         current_target;
-
-       nfc_p2p_target_discovered_cb    on_p2p_discovered_cb;
-       void *                                          on_p2p_discovered_user_data;
-
-       nfc_se_event_cb                         on_se_event_cb;
-       void *                                          on_se_event_user_data;
-
-       nfc_p2p_send_completed_cb       on_p2p_send_completed_cb;
-       void *                                          on_p2p_send_completed_user_data;
-
-       nfc_p2p_data_recived_cb         on_p2p_recv_cb;
-       void *                                          on_p2p_recv_user_data;
-
-       nfc_p2p_connection_handover_completed_cb                on_p2p_connection_handover_completed_cb;
-       void *                                                                          on_p2p_connection_handover_completed_user_data;
-
-       nfc_initialize_completed_cb             on_initialize_completed_cb;
-
-       nfc_se_transaction_event_cb             on_se_transaction_event_cb;
-       void *                                          on_se_transaction_event_user_data;
-
-       nfc_activation_changed_cb       on_activation_changed_cb;
-       void *                                          on_activation_changed_user_data;
-
-       nfc_activation_completed_cb     on_activation_completed_cb;
-       void *                                          on_activation_completed_user_data;
-       bool                        on_activation_doing;
-
-} _nfc_context_s;
-
-typedef struct {
-       void * callback;
-       void * user_data;
-       int callback_type;
-} _async_callback_data;
-
-#endif // __NET_NFC_PRIVATE_H__
index a56e20a4703cea22531361a158b5ec5c716a005e..7101cf5e531188c7f3d20e3aa190bb3fc97adb87 100644 (file)
@@ -1,21 +1,22 @@
-#sbs-git:slp/api/nfc capi-network-nfc 0.0.1 14f15050f8f6ff8217421da04fa5d66e834e2016
 Name:       capi-network-nfc
 Summary:    A NFC library in SLP C API
-Version:    0.0.8
+Version:    0.1.0
 Release:    0
-Group:      API/C API
+Group:      Network & Connectivity/NFC
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
-Source1001:    capi-network-nfc.manifest
+Source1001:    %{name}.manifest
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(glib-2.0)
-BuildRequires:  pkgconfig(nfc)
-BuildRequires:  pkgconfig(nfc-common-lib)
+BuildRequires:  pkgconfig(gobject-2.0)
+BuildRequires:  nfc-client-lib-devel
+BuildRequires:  nfc-common-lib-devel
 BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(ecore-x)
-BuildRequires:  pkgconfig(capi-appfw-app-manager)
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
 
 %description
 A NFC library in SLP C API.
@@ -23,7 +24,7 @@ A NFC library in SLP C API.
 
 %package devel
 Summary:  A NFC library in SLP C API -- Development Files
-Group:    API/C API
+Group:    Network & Connectivity/Development
 Requires: %{name} = %{version}-%{release}
 
 %description devel
@@ -44,10 +45,6 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
 make %{?jobs:-j%jobs}
 
 %install
-rm -rf %{buildroot}
-mkdir -p %{buildroot}/usr/share/license
-cp -af %{_builddir}/%{name}-%{version}/packaging/capi-network-nfc %{buildroot}/usr/share/license/
-
 %make_install
 
 %post -p /sbin/ldconfig
@@ -57,8 +54,8 @@ cp -af %{_builddir}/%{name}-%{version}/packaging/capi-network-nfc %{buildroot}/u
 
 %files
 %manifest %{name}.manifest
-%{_libdir}/libcapi-network-nfc.so*
-/usr/share/license/capi-network-nfc
+%{_libdir}/libcapi-network-nfc.so.*
+%license LICENSE.APLv2
 
 %files devel
 %manifest %{name}.manifest
index 412b1b1bb4a95af0f44eea3169b682c9054766b3..f9e063df16d212d74ff15ea097e6f2c17ee4d081 100644 (file)
--- a/src/nfc.c
+++ b/src/nfc.c
 */
 
 #include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
 
-#include <net_nfc.h>
-#include <net_nfc_typedef_private.h>
-#include <dlog.h>
-#include <nfc.h>
-#include <nfc_private.h>
-#include <net_nfc_exchanger.h>
 #include <vconf.h>
 #include <Ecore_X.h>
-#include <app_manager.h>
+#include <net_nfc_typedef_internal.h>
+
+#include "nfc_internal.h"
+
+#define LOG_TAG "CAPI_NETWORK_NFC"
+#include <dlog.h>
 
 /**
  * @brief The default factory key.
@@ -86,10 +87,9 @@ const unsigned char NFC_RECORD_HANDOVER_REQUEST_TYPE[2] = { 'H','r' };
 const unsigned char NFC_RECORD_HANDOVER_SELECT_TYPE[2] = { 'H','s' };
 
 
-#ifdef LOG_TAG
-#undef LOG_TAG
-#endif
-#define LOG_TAG "CAPI_NETWORK_NFC"
+static _nfc_context_s gdbus_nfc_context;
+
+/********************************Utility functions***********************/
 
 static pid_t _get_focus_app_pid()
 {
@@ -105,54 +105,48 @@ static pid_t _get_focus_app_pid()
        return -1;
 }
 
-static pid_t _get_current_app_pid()
-{
-       char *app_id = NULL;
-       app_context_h context = NULL;
-       pid_t pid, pgid;
-
-       pid = getpid();
-       app_manager_get_app_id(pid, &app_id);
-       app_manager_get_app_context(app_id, &context);
-
-       app_context_get_pid(context, &pgid);
-
-       free(app_id);
-       app_context_destroy(context);
-
-       return pgid;
-}
-
 static bool _check_app_permission()
 {
        pid_t focus_app_pid, current_app_pid;
 
        focus_app_pid = _get_focus_app_pid();
-       current_app_pid = _get_current_app_pid();
+       current_app_pid = getpgid(getpid());
 
-       LOGE( "[check app permission] focus_app_pid [%d],  current_app_pid [%d]", focus_app_pid, current_app_pid);
+       LOGD("[check app permission] focus_app_pid [%d], current_app_pid [%d]", focus_app_pid, current_app_pid);
 
-       return (focus_app_pid == current_app_pid) ? true : false;
+       if (-1 == current_app_pid)
+               return false;
+       else
+               return (focus_app_pid == current_app_pid) ? true : false;
 }
 
-static int _return_invalid_param(const char *func){
-       LOGE( "INVALID_PARAMETER (0x%08x)", NFC_ERROR_INVALID_PARAMETER);
+static int _return_invalid_param(const char *func)
+{
+       LOGE("INVALID_PARAMETER : %s", func);
+
        return NFC_ERROR_INVALID_PARAMETER;
 }
 
 static int _convert_error_code(const char *func, int native_error_code)
 {
        int error_code = NFC_ERROR_NONE;
-       char * errorstr = NULL;
-       switch(native_error_code){
-               case 0 :
+       char *errorstr = NULL;
+
+       switch (native_error_code)
+       {
+               case NET_NFC_OK:
                        error_code = NFC_ERROR_NONE;
-                       errorstr  = "ERROR_NONE";
+                       errorstr = "ERROR_NONE";
                        break;
 
                case NET_NFC_ALLOC_FAIL:
                        error_code = NFC_ERROR_OUT_OF_MEMORY;
-                       errorstr  = "OUT_OF_MEMORY";
+                       errorstr = "OUT_OF_MEMORY";
+                       break;
+
+               case NET_NFC_NOT_CONNECTED:
+                       error_code = NFC_ERROR_NO_DEVICE;
+                       errorstr = "NO_DEVICE";
                        break;
 
                case NET_NFC_UNKNOWN_ERROR:
@@ -168,11 +162,10 @@ static int _convert_error_code(const char *func, int native_error_code)
                case NET_NFC_OPERATION_FAIL:
                case NET_NFC_SECURITY_FAIL:
                case NET_NFC_INSUFFICIENT_STORAGE:
-               case NET_NFC_NOT_CONNECTED:
                case NET_NFC_NOT_INITIALIZED:
                case NET_NFC_NOT_REGISTERED:
                        error_code = NFC_ERROR_OPERATION_FAILED;
-                       errorstr  = "OPERATION_FAILED";
+                       errorstr = "OPERATION_FAILED";
                        break;
 
                case NET_NFC_OUT_OF_BOUND:
@@ -181,642 +174,485 @@ static int _convert_error_code(const char *func, int native_error_code)
                case NET_NFC_LLCP_INVALID_SOCKET:
                case NET_NFC_NO_DATA_FOUND:
                        error_code = NFC_ERROR_INVALID_PARAMETER;
-                       errorstr  = "INVALID_PARAMETER";
+                       errorstr = "INVALID_PARAMETER";
                        break;
                case NET_NFC_NDEF_RECORD_IS_NOT_EXPECTED_TYPE:
                        error_code = NFC_ERROR_INVALID_RECORD_TYPE;
-                       errorstr  = "INVALID_RECORD_TYPE";
+                       errorstr = "INVALID_RECORD_TYPE";
                        break;
 
                case NET_NFC_ALREADY_INITIALIZED:
                case NET_NFC_ALREADY_REGISTERED:
                        error_code = NFC_ERROR_NONE;
-                       errorstr  = "ERROR_NONE";
+                       errorstr = "ERROR_NONE";
                        break;
 
                case NET_NFC_RF_TIMEOUT:
                        error_code = NFC_ERROR_TIMED_OUT;
-                       errorstr  = "TIMED_OUT";
+                       errorstr = "TIMED_OUT";
                        break;
                case NET_NFC_INVALID_FORMAT:
                case NET_NFC_NDEF_TYPE_LENGTH_IS_NOT_OK:
                case NET_NFC_NDEF_ID_LENGTH_IS_NOT_OK:
                case NET_NFC_NDEF_BUF_END_WITHOUT_ME:
                        error_code = NFC_ERROR_INVALID_NDEF_MESSAGE;
-                       errorstr  = "INVALID_NDEF_MESSAGE";
+                       errorstr = "INVALID_NDEF_MESSAGE";
                        break;
                case NET_NFC_NO_NDEF_MESSAGE:
                        error_code = NFC_ERROR_NO_NDEF_MESSAGE;
-                       errorstr  = "NO_NDEF_MESSAGE";
+                       errorstr = "NO_NDEF_MESSAGE";
                        break;
                case NET_NFC_BUSY :
                        error_code = NFC_ERROR_DEVICE_BUSY;
-                       errorstr  = "DEVICE_BUSY";
+                       errorstr = "DEVICE_BUSY";
                        break;
                case NET_NFC_NO_NDEF_SUPPORT:
                        error_code = NFC_ERROR_NOT_NDEF_FORMAT;
-                       errorstr  = "NOT_SUPPORTED";
+                       errorstr = "NOT_SUPPORTED";
                        break;
                default :
                        error_code = NFC_ERROR_OPERATION_FAILED;
-                       errorstr  = "OPERATION_FAILED";
+                       errorstr = "OPERATION_FAILED";
        }
 
-       LOGE( "NFC %s(0x%08x)", errorstr, error_code);
+       LOGE("NFC %s(0x%08x)", errorstr, error_code);
 
        return error_code;
-
 }
 
-_nfc_context_s g_nfc_context;
-
-
-static void nfc_manager_set_activation_completed_cb(nfc_activation_completed_cb callback , void *user_data)
+static bool _is_initialized()
 {
-       g_nfc_context.on_activation_completed_cb = callback;
-       g_nfc_context.on_activation_completed_user_data = user_data;
-       g_nfc_context.on_activation_doing = true;
+       return gdbus_nfc_context.initialized;
 }
 
-static void nfc_manager_unset_activation_completed_cb(void)
+/**********************Activate/DeActivate*****************/
+
+bool nfc_manager_is_supported(void)
 {
-       g_nfc_context.on_activation_completed_cb = NULL;
-       g_nfc_context.on_activation_completed_user_data = NULL;
-       g_nfc_context.on_activation_doing = false;
+       int nfc_supported = 0;
+
+       net_nfc_client_is_nfc_supported(&nfc_supported);
+
+       return (!!nfc_supported);
 }
 
-static bool nfc_manager_check_activation(void)
+static void _activation_changed(net_nfc_error_e result, void *user_data)
 {
-       return g_nfc_context.on_activation_doing;
-}
+       nfc_activation_completed_cb callback;
+       void *user_param;
+
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result), user_param);
+       }
 
+       g_variant_unref((GVariant *)user_data);
+}
 
-void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, void* data, void* user_param, void * trans_data)
+int nfc_manager_set_activation(bool activation,
+       nfc_activation_completed_cb callback,
+       void *user_data)
 {
-       LOGI("NFC message %d - start result[%d] ", message, result);
+       int ret;
+       int nfc_supported = 0;
+#if 0
+       unsigned int state;
+#endif
+       ret = net_nfc_client_is_nfc_supported(&nfc_supported);
+       if (ret != NET_NFC_OK || nfc_supported == false)
+       {
+               LOGE("NFC not supported");
 
-       int capi_result = _convert_error_code("EVENT", result);
+               return NFC_ERROR_NOT_SUPPORTED;
+       }
+#if 0
+       ret = net_nfc_client_manager_get_server_state_sync(&state);
+       if (ret == NFC_ERROR_NONE && state != 0)
+       {
+               LOGE("nfc_manager_check_activation BUSY!!!!!");
 
-       switch ( message ){
-               case NET_NFC_MESSAGE_TRANSCEIVE:
-               {
-                       if( trans_data != NULL ){
-                               _async_callback_data *user_cb = (_async_callback_data*)trans_data;
-
-                               if( user_cb->callback_type == _NFC_CALLBACK_TYPE_DATA ){
-                                       unsigned char * buffer = NULL;
-                                       int buffer_size = 0;
-                                       if( result == 0 && data != NULL){
-                                               data_s *arg = (data_s*) data;
-                                               buffer = arg->buffer;
-                                               buffer_size = arg->length;
-                                       }
-                                       void (* data_type_callback)(int result , unsigned char * buffer, int buffer_size,  void * user_data);
-                                       data_type_callback = user_cb->callback;
-                                       data_type_callback(capi_result, buffer, buffer_size, user_cb->user_data);
-                               }else if ( user_cb->callback_type == _NFC_CALLBACK_TYPE_RESULT){
-                                       void (* result_type_callback)(int result , void * user_data);
-                                       result_type_callback = user_cb->callback;
-                                       result_type_callback(capi_result, user_cb->user_data);
-                               }
-                               free(user_cb);
-                       }
-                       break;
-               }
-               case NET_NFC_MESSAGE_READ_NDEF:
+               return NFC_ERROR_DEVICE_BUSY;
+       }
+#endif
+       if (nfc_manager_is_activated() == activation)
+       {
+               if (activation)
                {
-                       if( trans_data != NULL ) {
-                               ndef_message_h ndef_message = (ndef_message_h)data;
-                               _async_callback_data *user_cb = (_async_callback_data*)trans_data;
-                               ((nfc_tag_read_completed_cb)user_cb->callback)(capi_result, ndef_message, user_cb->user_data);
-                               free(user_cb);
-                       }
-                       break;
+                       ret = NFC_ERROR_ALREADY_ACTIVATED;
                }
-               case NET_NFC_MESSAGE_WRITE_NDEF:
+               else
                {
-                       if( trans_data != NULL ){
-                               _async_callback_data *user_cb = (_async_callback_data*)trans_data;
-                               ((nfc_tag_write_completed_cb)user_cb->callback)(capi_result, user_cb->user_data);
-                               free(user_cb);
-                       }
-                       break;
+                       ret = NFC_ERROR_ALREADY_DEACTIVATED;
                }
-               case NET_NFC_MESSAGE_TAG_DISCOVERED:
-               {
-                       net_nfc_target_info_s *target_info = (net_nfc_target_info_s *)data;
-
-                       if (g_nfc_context.current_tag != NULL)
-                       {
-                               net_nfc_release_tag_info((net_nfc_target_info_h)g_nfc_context.current_tag);
-                               g_nfc_context.current_tag = NULL;
-                       }
-
-                       net_nfc_duplicate_target_info((net_nfc_target_info_h)target_info, (net_nfc_target_info_h *)&g_nfc_context.current_tag);
+       }
+       else
+       {
+               GVariant *parameter;
 
-                       if (g_nfc_context.on_tag_discovered_cb)
+               parameter = g_variant_new("(uu)",
+                       callback,
+                       user_data);
+               if (parameter != NULL)
+               {
+                       ret = net_nfc_client_manager_set_active(activation,
+                               _activation_changed,
+                               parameter);
+                       if (ret != NET_NFC_OK)
                        {
-                               g_nfc_context.on_tag_discovered_cb(NFC_DISCOVERED_TYPE_ATTACHED, (nfc_tag_h)g_nfc_context.current_tag, g_nfc_context.on_tag_discovered_user_data);
-                       }
+                               LOGE("net_nfc_client_manager_set_active fail");
 
-                       //ndef discovered cb
-                       if (g_nfc_context.on_ndef_discovered_cb && target_info->raw_data.buffer != NULL)
-                       {
-                               ndef_message_h ndef_message;
-                               net_nfc_create_ndef_message_from_rawdata(&ndef_message, (data_h)&(target_info->raw_data));
-                               g_nfc_context.on_ndef_discovered_cb(ndef_message, g_nfc_context.on_ndef_discovered_user_data);
-                               net_nfc_free_ndef_message(ndef_message);
+                               g_variant_unref(parameter);
                        }
-                       break;
-               }
-               case NET_NFC_MESSAGE_NOTIFY:
-               {
-                       break;
                }
-               case NET_NFC_MESSAGE_TAG_DETACHED:
+               else
                {
-                       if( g_nfc_context.on_tag_discovered_cb ){
-                               g_nfc_context.on_tag_discovered_cb( NFC_DISCOVERED_TYPE_DETACHED,  (nfc_tag_h)g_nfc_context.current_tag , g_nfc_context.on_tag_discovered_user_data );
-                       }
-
-                       if (g_nfc_context.current_tag != NULL)
-                       {
-                               net_nfc_release_tag_info((net_nfc_target_info_h)g_nfc_context.current_tag);
-                               g_nfc_context.current_tag = NULL;
-                       }
-                       break;
+                       ret = NET_NFC_ALLOC_FAIL;
                }
-               case NET_NFC_MESSAGE_P2P_DISCOVERED:
-               {
-                       g_nfc_context.current_target = (net_nfc_target_handle_h)data;
-                       g_nfc_context.on_p2p_recv_cb = NULL;
-                       g_nfc_context.on_p2p_recv_user_data = NULL;
-                       g_nfc_context.on_p2p_send_completed_cb = NULL;
-                       g_nfc_context.on_p2p_send_completed_user_data = NULL;
-
-                       if( g_nfc_context.on_p2p_discovered_cb ){
-                               g_nfc_context.on_p2p_discovered_cb(NFC_DISCOVERED_TYPE_ATTACHED , (nfc_p2p_target_h)g_nfc_context.current_target, g_nfc_context.on_p2p_discovered_user_data );
-                       }
 
-                       break;
-               }
-               case NET_NFC_MESSAGE_P2P_DETACHED:
-               {
-                       if( g_nfc_context.on_p2p_discovered_cb ){
-                               g_nfc_context.on_p2p_discovered_cb( NFC_DISCOVERED_TYPE_DETACHED,  (nfc_p2p_target_h)(g_nfc_context.current_target) , g_nfc_context.on_p2p_discovered_user_data );
-                       }
-                       memset(&g_nfc_context.current_target , 0 , sizeof( g_nfc_context.current_target ));
-                       g_nfc_context.on_p2p_recv_cb = NULL;
-                       g_nfc_context.on_p2p_recv_user_data = NULL;
-                       g_nfc_context.on_p2p_send_completed_cb = NULL;
-                       g_nfc_context.on_p2p_send_completed_user_data = NULL;
+               ret = _convert_error_code(__func__, ret);
+       }
 
-                       break;
-               }
-               case NET_NFC_MESSAGE_P2P_SEND :
-               {
-                       if( g_nfc_context.on_p2p_send_completed_cb != NULL ){
+       return ret;
+}
 
-                               nfc_p2p_send_completed_cb       cb = g_nfc_context.on_p2p_send_completed_cb;
-                               void *                                          user_data = g_nfc_context.on_p2p_send_completed_user_data;
-                               g_nfc_context.on_p2p_send_completed_cb = NULL;
-                               g_nfc_context.on_p2p_send_completed_user_data = NULL;
-                               cb(capi_result , user_data );
-                       }
-                       break;
-               }
-               case NET_NFC_MESSAGE_P2P_RECEIVE :
-               {
-                       if( g_nfc_context.on_p2p_recv_cb != NULL ){
-                               ndef_message_h ndef_message ;
-                               net_nfc_create_ndef_message_from_rawdata (&ndef_message, (data_h)(data) );
-                               g_nfc_context.on_p2p_recv_cb( (nfc_p2p_target_h)(g_nfc_context.current_target) , ndef_message ,g_nfc_context.on_p2p_recv_user_data );
-                               net_nfc_free_ndef_message(ndef_message);
-                       }
+bool nfc_manager_is_activated(void)
+{
+       int activated = 0;
 
-                       break;
-               }
-               case NET_NFC_MESSAGE_FORMAT_NDEF:
-               {
-                       if( trans_data != NULL) {
-                               _async_callback_data *user_cb = (_async_callback_data*)trans_data;
-                               ((nfc_tag_format_completed_cb)user_cb->callback)(capi_result, user_cb->user_data);
-                               free(user_cb);
-                       }
-                       break;
-               }
+       net_nfc_client_get_nfc_state(&activated);
 
-               case NET_NFC_MESSAGE_CONNECTION_HANDOVER :
-               {
-                       if( g_nfc_context.on_p2p_connection_handover_completed_cb != NULL ){
+       return (!!activated);
+}
 
-                               net_nfc_conn_handover_carrier_type_e type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
-                               nfc_ac_type_e carrior_type = NFC_AC_TYPE_UNKNOWN;
-                               char * ac_data = NULL;
-                               int ac_data_size = 0;
-                               char * temp = NULL;
-                               char buffer[50] = {0,};
-                               data_h ac_info = NULL;
+int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback,
+       void *user_data)
+{
+       if (callback == NULL)
+               return _return_invalid_param(__func__);
 
+       net_nfc_client_manager_set_activated(callback, user_data);
 
-                               net_nfc_exchanger_get_alternative_carrier_type((net_nfc_connection_handover_info_h)data, &type);
-                               if (type == NET_NFC_CONN_HANDOVER_CARRIER_BT)
-                               {
-                                       carrior_type = NFC_AC_TYPE_BT;
-                                       if(net_nfc_exchanger_get_alternative_carrier_data((net_nfc_connection_handover_info_h)data, &ac_info)== 0)
-                                       {
-                                               temp = (char *)net_nfc_get_data_buffer(ac_info);
-                                               if( temp != NULL)
-                                               {
-
-                                                       snprintf(buffer, 50, "%02x:%02x:%02x:%02x:%02x:%02x",temp[0], temp[1], temp[2], temp[3], temp[4], temp[5]);
-
-                                                        ac_data = (strdup(buffer));
-                                                        ac_data_size = strlen(ac_data ) +1;
-                                               }
-                                               net_nfc_free_data(ac_info);
-                                       }
-                               }
+       return NFC_ERROR_NONE;
+}
 
-                               nfc_p2p_connection_handover_completed_cb        cb = g_nfc_context.on_p2p_connection_handover_completed_cb;
-                               void *                                                                          user_data = g_nfc_context.on_p2p_connection_handover_completed_user_data;
-                               g_nfc_context.on_p2p_connection_handover_completed_cb = NULL;
-                               g_nfc_context.on_p2p_connection_handover_completed_user_data = NULL;
-                               cb(capi_result , carrior_type, (void *)ac_data, ac_data_size, user_data );
+void nfc_manager_unset_activation_changed_cb(void)
+{
+       net_nfc_client_manager_unset_activated();
+}
 
-                               net_nfc_exchanger_free_alternative_carrier_data((net_nfc_connection_handover_info_h)data);
-                               free(ac_data);
-                       }
-                       break;
-               }
+#if 0
+void _net_nfc_manager_get_current_target_handle_(
+                       net_nfc_error_e result,
+                       net_nfc_target_handle_h handle,
+                       void *user_data)
+{
+       gdbus_nfc_context.current_target =(net_nfc_target_handle_s*) handle;
 
+       nfc_initialize_completed_cb cb =
+                       gdbus_nfc_context.on_initialize_completed_cb;
+       gdbus_nfc_context.on_initialize_completed_cb = NULL;
+       if( cb )
+       {
+               cb( result, user_data );
+       }
 
-               case NET_NFC_MESSAGE_IS_TAG_CONNECTED :
-               {
-                       net_nfc_target_type_e  devType = *(net_nfc_target_type_e *)data;
+}
 
-                       if( (devType == NET_NFC_NFCIP1_TARGET )||(devType == NET_NFC_NFCIP1_INITIATOR ))
-                       {
-                               net_nfc_get_current_target_handle(trans_data);
-                       }
-                       else if( (devType > NET_NFC_UNKNOWN_TARGET )&&(devType < NET_NFC_NFCIP1_TARGET ))
-                       {
-                               net_nfc_get_current_tag_info(trans_data);
-                       }
-                       else
-                       {
-                               if (result == NET_NFC_NOT_CONNECTED)
-                               {
-                                       capi_result = NFC_ERROR_NONE;
-                               }
+void _net_nfc_manager_get_current_tag_info_(
+                       net_nfc_error_e result,
+                       net_nfc_target_info_h info,
+                       void *user_data)
+{
+       net_nfc_target_info_s *target_info = (net_nfc_target_info_s *)info;
 
-                               if( g_nfc_context.on_initialize_completed_cb ){
-                                       nfc_initialize_completed_cb             cb = g_nfc_context.on_initialize_completed_cb;
-                                       g_nfc_context.on_initialize_completed_cb = NULL;
-                                       cb( capi_result,trans_data );
-                               }
-                       }
-                       break;
+       if (target_info != NULL)
+       {
+               if (gdbus_nfc_context.current_tag != NULL)
+               {
+                       net_nfc_release_tag_info(
+                               (net_nfc_target_info_h)gdbus_nfc_context.current_tag);
+                       gdbus_nfc_context.current_tag = NULL;
                }
 
-               case NET_NFC_MESSAGE_GET_CURRENT_TAG_INFO :
-               {
-                       net_nfc_target_info_s *target_info = (net_nfc_target_info_s *)data;
+               net_nfc_duplicate_target_info((net_nfc_target_info_h)target_info,
+                       (net_nfc_target_info_h *)&gdbus_nfc_context.current_tag);
+       }
 
-                       if (target_info != NULL)
-                       {
-                               if (g_nfc_context.current_tag != NULL)
-                               {
-                                       net_nfc_release_tag_info((net_nfc_target_info_h)g_nfc_context.current_tag);
-                                       g_nfc_context.current_tag = NULL;
-                               }
+       nfc_initialize_completed_cb cb =
+                       gdbus_nfc_context.on_initialize_completed_cb;
+       gdbus_nfc_context.on_initialize_completed_cb = NULL;
+       if (cb)
+       {
+               cb(result, user_data);
+       }
+}
 
-                               net_nfc_duplicate_target_info((net_nfc_target_info_h)target_info, (net_nfc_target_info_h *)&g_nfc_context.current_tag);
-                       }
 
-                       nfc_initialize_completed_cb cb = g_nfc_context.on_initialize_completed_cb;
-                       g_nfc_context.on_initialize_completed_cb = NULL;
-                       if (cb)
-                       {
-                               cb(capi_result, trans_data);
-                       }
-                       break;
-               }
+void _net_nfc_manager_tag_connected_cb(
+                       net_nfc_error_e result,
+                       net_nfc_target_type_e dev_type,
+                       void *user_data)
+{
+       net_nfc_target_type_e  devType = dev_type;
+       int capi_result;
 
-               case NET_NFC_MESSAGE_GET_CURRENT_TARGET_HANDLE :
+       if( (devType == NET_NFC_NFCIP1_TARGET )||
+                       (devType == NET_NFC_NFCIP1_INITIATOR ))
+       {
+               net_nfc_client_tag_get_current_target_handle(
+                       _net_nfc_manager_get_current_target_handle_,
+                       user_data);
+       }
+       else if( (devType > NET_NFC_UNKNOWN_TARGET )&&
+                       (devType < NET_NFC_NFCIP1_TARGET ))
+       {
+               net_nfc_client_tag_get_current_tag_info(
+                       _net_nfc_manager_get_current_tag_info_,
+                       user_data);
+       }
+       else
+       {
+               if (result == NET_NFC_NOT_CONNECTED)
                {
-                       g_nfc_context.current_target = (net_nfc_target_handle_h)data;
-
-                       nfc_initialize_completed_cb             cb = g_nfc_context.on_initialize_completed_cb;
-                       g_nfc_context.on_initialize_completed_cb = NULL;
-                       if( cb ){
-                               cb( capi_result, trans_data );
-                       }
+                       capi_result = NFC_ERROR_NONE;
+               }
 
-                       break;
+               if( gdbus_nfc_context.on_initialize_completed_cb )
+               {
+                       nfc_initialize_completed_cb cb =
+                               gdbus_nfc_context.on_initialize_completed_cb;
+                       gdbus_nfc_context.on_initialize_completed_cb = NULL;
+                       cb( capi_result,user_data );
                }
+       }
+}
+#endif
 
+static void _nfc_manager_tag_discovered_cb(net_nfc_target_info_h info,
+       void *user_data)
+{
+       net_nfc_target_info_s *target_info = (net_nfc_target_info_s *)info;
 
-               case NET_NFC_MESSAGE_INIT :
-               {
-                       bool activated = true;
+       gdbus_nfc_context.current_tag = target_info;
 
-                       LOGE( "_nfc_response_handler NET_NFC_MESSAGE_INIT\n");
+       if (gdbus_nfc_context.on_tag_discovered_cb != NULL) {
+               gdbus_nfc_context.on_tag_discovered_cb(
+                       NFC_DISCOVERED_TYPE_ATTACHED,
+                       (nfc_tag_h)gdbus_nfc_context.current_tag,
+                       gdbus_nfc_context.on_tag_discovered_user_data);
+       }
 
-                       if (result == NET_NFC_OK){
-                               if( g_nfc_context.on_activation_changed_cb != NULL ){
-                                       g_nfc_context.on_activation_changed_cb(activated , g_nfc_context.on_activation_changed_user_data);
-                                       LOGE( "_nfc_response_handler changed call back NET_NFC_MESSAGE_INIT NET_NFC_OK\n");
-                               }
+       /* ndef discovered cb */
+       if (gdbus_nfc_context.on_ndef_discovered_cb &&
+               target_info->raw_data.buffer != NULL)
+       {
+               ndef_message_h ndef_message;
 
-                               if( g_nfc_context.on_activation_completed_cb != NULL ){
-                                       g_nfc_context.on_activation_completed_cb(result , g_nfc_context.on_activation_completed_user_data);
-                                       LOGE( "_nfc_response_handler completed call back NET_NFC_MESSAGE_INIT NET_NFC_OK\n");
+               net_nfc_create_ndef_message_from_rawdata(&ndef_message,
+                       (data_h)&(target_info->raw_data));
 
-                                       nfc_manager_unset_activation_completed_cb();
-                               }
-                               else
-                               {
-                                       g_nfc_context.on_activation_doing = false;
-                                       LOGE( "g_nfc_context.on_activation_doing\n");
-                               }
+               gdbus_nfc_context.on_ndef_discovered_cb(ndef_message,
+                       gdbus_nfc_context.on_ndef_discovered_user_data);
 
+               net_nfc_free_ndef_message(ndef_message);
+       }
+}
 
-                       }
+static void _nfc_manager_tag_detached_cb(void *user_data)
+{
+       if (gdbus_nfc_context.on_tag_discovered_cb != NULL) {
+               gdbus_nfc_context.on_tag_discovered_cb(
+                       NFC_DISCOVERED_TYPE_DETACHED,
+                       (nfc_tag_h)gdbus_nfc_context.current_tag,
+                       gdbus_nfc_context.on_tag_discovered_user_data);
+       }
 
-                       break;
-               }
+       gdbus_nfc_context.current_tag = NULL;
+}
+static void _p2p_target_discovered_cb(
+       net_nfc_target_handle_h handle_info,
+       void *user_data)
+{
+       gdbus_nfc_context.current_target = handle_info;
 
-               case NET_NFC_MESSAGE_DEINIT :
-               {
-                       bool activated = false;
+       if (gdbus_nfc_context.on_p2p_target_discovered_cb != NULL) {
+               gdbus_nfc_context.on_p2p_target_discovered_cb(
+                       NFC_DISCOVERED_TYPE_ATTACHED,
+                       (nfc_p2p_target_h)gdbus_nfc_context.current_target,
+                       gdbus_nfc_context.on_p2p_target_discovered_user_data);
+       }
+}
 
-                       if (result == NET_NFC_OK){
-                               if( g_nfc_context.on_activation_changed_cb != NULL ){
-                                       g_nfc_context.on_activation_changed_cb(activated , g_nfc_context.on_activation_changed_user_data);
-                                       LOGE( "_nfc_response_handler NET_NFC_MESSAGE_DEINIT NET_NFC_OK\n");
-                               }
+static void _p2p_device_detached(void *user_data)
+{
+       nfc_p2p_target_h handle =
+               (nfc_p2p_target_h)gdbus_nfc_context.current_target;
 
-                               if( g_nfc_context.on_activation_completed_cb != NULL ){
-                                       g_nfc_context.on_activation_completed_cb(result , g_nfc_context.on_activation_completed_user_data);
-                                       LOGE( "_nfc_response_handler completed call back NET_NFC_MESSAGE_INIT NET_NFC_OK\n");
+       if (gdbus_nfc_context.on_p2p_target_discovered_cb != NULL) {
+               gdbus_nfc_context.on_p2p_target_discovered_cb(
+                       NFC_DISCOVERED_TYPE_DETACHED,
+                       handle,
+                       gdbus_nfc_context.on_p2p_target_discovered_user_data);
+       }
 
-                                       nfc_manager_unset_activation_completed_cb();
-                               }
-                               else
-                               {
-                                       g_nfc_context.on_activation_doing = false;
-                                       LOGE( "g_nfc_context.on_activation_doing\n");
-                               }
-                       }
+       /* unset data_received callback */
+       nfc_p2p_unset_data_received_cb(handle);
 
-                       break;
-               }
+       gdbus_nfc_context.current_target = NULL;
+}
 
-               case NET_NFC_MESSAGE_SET_SE :
-               {
-                       if( trans_data != NULL ){
-                               _async_callback_data *user_cb = (_async_callback_data*)trans_data;
-                               ((nfc_set_card_emulation_completed_cb)user_cb->callback)(capi_result, user_cb->user_data);
-                               free(user_cb);
-                       }
-                       break;
-               }
+/* deprecated */
+static gboolean _initialize_cb(gpointer user_data)
+{
+       nfc_initialize_completed_cb callback;
+       void *user_param;
 
-               case NET_NFC_MESSAGE_SE_START_TRANSACTION :
-               case NET_NFC_MESSAGE_SE_END_TRANSACTION :
-               case NET_NFC_MESSAGE_SE_TYPE_TRANSACTION:
-               case NET_NFC_MESSAGE_SE_CONNECTIVITY :
-               case NET_NFC_MESSAGE_SE_FIELD_ON :
-               case NET_NFC_MESSAGE_SE_FIELD_OFF :
-               case NET_NFC_MESSAGE_SE_TYPE_CHANGED :
-               {
-                       nfc_se_event_e event = NFC_SE_EVENT_START_TRANSACTION;
-                       switch( message ){
-                               case NET_NFC_MESSAGE_SE_START_TRANSACTION:
-                                       event = NFC_SE_EVENT_START_TRANSACTION;
-                                       break;
-                               case NET_NFC_MESSAGE_SE_END_TRANSACTION:
-                                       event = NFC_SE_EVENT_END_TRANSACTION;
-                                       break;
-                               case NET_NFC_MESSAGE_SE_CONNECTIVITY:
-                                       event = NFC_SE_EVENT_CONNECTIVITY;
-                                       break;
-                               case NET_NFC_MESSAGE_SE_FIELD_ON :
-                                       event = NFC_SE_EVENT_FIELD_ON;
-                                       break;
-                               case NET_NFC_MESSAGE_SE_FIELD_OFF :
-                                       event = NFC_SE_EVENT_FIELD_OFF;
-                                       break;
-                               case NET_NFC_MESSAGE_SE_TYPE_TRANSACTION:
-                                       event = NFC_SE_EVENT_TRANSACTION;
-                                       break;
-                               case NET_NFC_MESSAGE_SE_TYPE_CHANGED:
-                                       event = NFC_SE_EVENT_SE_TYPE_CHANGED;
-                                       break;
-                               default:
-                                       break;
-                       }
+       if (user_data == NULL)
+               return false;
 
-                       if( g_nfc_context.on_se_event_cb ){
-                               g_nfc_context.on_se_event_cb(event, g_nfc_context.on_se_event_user_data);
-                       }
-                       if( message == NET_NFC_MESSAGE_SE_TYPE_TRANSACTION){
-                               net_nfc_se_event_info_s* transaction_data = (net_nfc_se_event_info_s*)data;
-                               if( g_nfc_context.on_se_transaction_event_cb && transaction_data != NULL){
-                                       g_nfc_context.on_se_transaction_event_cb(transaction_data->aid.buffer,transaction_data->aid.length, transaction_data->param.buffer,transaction_data->param.length  , g_nfc_context.on_se_transaction_event_user_data);
-                               }
-                       }
-               }
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
 
-               default :
-                       break;
+       if (callback != NULL) {
+               callback(NFC_ERROR_NONE, user_param);
        }
 
-}
+       g_variant_unref((GVariant *)user_data);
 
+       return false;
+}
 
-bool nfc_manager_is_supported(void)
+int nfc_manager_initialize(nfc_initialize_completed_cb callback,
+       void *user_data)
 {
-
+       int ret;
        int nfc_supported = 0;
 
-       net_nfc_is_supported(&nfc_supported);
+       net_nfc_client_is_nfc_supported(&nfc_supported);
+       if (!nfc_supported)
+       {
+               LOGE("NFC_ERROR_NOT_SUPPORTED");
 
-       return nfc_supported;
+               return NFC_ERROR_NOT_SUPPORTED;
+       }
 
-}
+       if (!_is_initialized())
+       {
+               ret = net_nfc_client_initialize();
+               if (ret != NET_NFC_OK)
+                       return _convert_error_code(__func__, ret);
 
+               memset(&gdbus_nfc_context, 0, sizeof(gdbus_nfc_context));
 
-int nfc_manager_set_activation(bool activation, nfc_activation_completed_cb callback, void *user_data)
-{
-       int ret = 0;
-       int nfc_supported = 0;
-       bool nfc_check_activation = 0;
+               gdbus_nfc_context.initialized = true;
 
-       nfc_check_activation = nfc_manager_check_activation();
+               net_nfc_client_tag_set_tag_detached(
+                       _nfc_manager_tag_detached_cb,
+                       NULL);
+               net_nfc_client_tag_set_tag_discovered(
+                       _nfc_manager_tag_discovered_cb,
+                       NULL);
 
-       if (nfc_check_activation == true)
-       {
-               LOGE( "nfc_manager_check_activation BUSY!!!!!\n");
-               return NFC_ERROR_DEVICE_BUSY;
-       }
+               net_nfc_client_p2p_set_device_discovered(
+                       _p2p_target_discovered_cb, NULL);
 
-       net_nfc_is_supported(&nfc_supported);
+               net_nfc_client_p2p_set_device_detached(
+                       _p2p_device_detached, NULL);
 
-       if (!nfc_supported)
-       {
-               ret = NFC_ERROR_NOT_SUPPORTED;
-       }
-       else
-       {
-               if (nfc_manager_is_activated() == activation)
-               {
-                       if (activation)
-                       {
-                               ret = NFC_ERROR_ALREADY_ACTIVATED;
-                       }
-                       else
-                       {
-                               ret = NFC_ERROR_ALREADY_DEACTIVATED;
-                       }
+               /* invoke callback if it needs */
+               if (callback != NULL) {
+                       g_main_context_invoke(NULL,
+                               _initialize_cb,
+                               g_variant_new("(uu)", callback, user_data));
                }
-               else
-               {
-                       nfc_manager_set_activation_completed_cb(callback, user_data);
+#if 0
+               gdbus_nfc_context.on_initialize_completed_cb = callback;
 
-                       ret = net_nfc_set_state(activation, NULL);
+               ret = net_nfc_client_tag_is_tag_connected(
+                       _net_nfc_manager_tag_connected_cb,
+                       user_data);
 
-                       if (ret == NET_NFC_OK)
-                       {
-                               ret = NFC_ERROR_NONE;
-                               LOGE( "nfc_manager_set_activation net_nfc_set_state success\n");
-                       }
-                       else
-                       {
-                               nfc_manager_unset_activation_completed_cb();
-                               ret = NFC_ERROR_OPERATION_FAILED;
-                               LOGE( "nfc_manager_set_activation net_nfc_set_state fail\n");
-                       }
-               }
+               if( ret != NET_NFC_OK )
+               return _convert_error_code(__func__, ret);
+#endif
        }
-       return ret;
 
+       return NFC_ERROR_NONE;
 }
 
-int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback , void *user_data)
-{
-       if( callback == NULL)
-               return _return_invalid_param(__func__);
-       g_nfc_context.on_activation_changed_cb = callback;
-       g_nfc_context.on_activation_changed_user_data = user_data;
-       return 0;
-}
-
-void nfc_manager_unset_activation_changed_cb(void)
-{
-       g_nfc_context.on_activation_changed_cb = NULL;
-       g_nfc_context.on_activation_changed_user_data = NULL;
-}
-
-
-
-
-bool nfc_manager_is_activated(void)
-{
-       int activated = 0;
-
-       net_nfc_get_state(&activated);
-
-       if(activated)
-       {
-               return true;
-       }
-       else
-       {
-               return false;
-       }
-
-}
-
-static bool _is_initialized()
-{
-       return g_nfc_context.initialized;
-}
-
-int nfc_manager_initialize (nfc_initialize_completed_cb callback, void *user_data)
-{
-       int ret;
-       int nfc_supported = 0;
-
-       net_nfc_is_supported(&nfc_supported);
-
-       if(!nfc_supported)
-       {
-               LOGE( "nfc_manager_initialize  NFC_ERROR_NOT_SUPPORTED \n");
-               return  NFC_ERROR_NOT_SUPPORTED;
-       }
-
-       if (!_is_initialized())
-       {
-               ret = net_nfc_initialize();
-               if( ret != NET_NFC_OK )
-                       return _convert_error_code(__func__, ret);
-
-               memset( &g_nfc_context , 0 , sizeof( g_nfc_context));
-               net_nfc_set_response_callback( _nfc_response_handler , &g_nfc_context);
-               g_nfc_context.initialized = true;
-               net_nfc_state_activate();
-               g_nfc_context.on_initialize_completed_cb = callback;
-               ret = net_nfc_is_tag_connected(user_data);
-               if( ret != NET_NFC_OK )
-                       return _convert_error_code(__func__, ret);
-       }
-
-       return NFC_ERROR_NONE;
-}
-
-int nfc_manager_initialize_sync()
+int nfc_manager_initialize_sync()
 {
        int ret;
        int nfc_supported = 0;
 
-       net_nfc_is_supported(&nfc_supported);
+       net_nfc_client_is_nfc_supported(&nfc_supported);
        if (!nfc_supported)
        {
-               LOGE("nfc_manager_initialize  NFC_ERROR_NOT_SUPPORTED \n");
+               LOGE("NFC_ERROR_NOT_SUPPORTED");
+
                return NFC_ERROR_NOT_SUPPORTED;
        }
 
        if (!_is_initialized())
        {
-               int devType;
+#if 0
+               net_nfc_target_type_e devType;
+#endif
+               memset(&gdbus_nfc_context, 0, sizeof(gdbus_nfc_context));
 
-               ret = net_nfc_initialize();
+               ret = net_nfc_client_initialize();
                if (ret != NET_NFC_OK)
                        return _convert_error_code(__func__, ret);
 
-               memset(&g_nfc_context, 0, sizeof(g_nfc_context));
-               net_nfc_set_response_callback(_nfc_response_handler, &g_nfc_context);
-               g_nfc_context.initialized = true;
-               net_nfc_state_activate();
+               gdbus_nfc_context.initialized = true;
 
-               ret = net_nfc_is_tag_connected_sync(&devType);
+               net_nfc_client_tag_set_tag_detached(
+                       _nfc_manager_tag_detached_cb,
+                       NULL);
+               net_nfc_client_tag_set_tag_discovered(
+                       _nfc_manager_tag_discovered_cb,
+                       NULL);
+
+               net_nfc_client_p2p_set_device_discovered(
+                       _p2p_target_discovered_cb, NULL);
+
+               net_nfc_client_p2p_set_device_detached(
+                       _p2p_device_detached, NULL);
+#if 0
+               ret = net_nfc_client_tag_is_tag_connected_sync(&devType);
                if (ret == NET_NFC_OK)
                {
-                       if ((devType == NET_NFC_NFCIP1_TARGET) || (devType == NET_NFC_NFCIP1_INITIATOR))
+                       if ((devType == NET_NFC_NFCIP1_TARGET) ||
+                               (devType == NET_NFC_NFCIP1_INITIATOR))
                        {
-                               net_nfc_get_current_target_handle_sync((net_nfc_target_handle_h *)&g_nfc_context.current_target);
+                               net_nfc_client_tag_get_current_target_handle_sync(
+                                       (net_nfc_target_handle_h *)
+                                       &gdbus_nfc_context.current_target);
                        }
-                       else if ((devType > NET_NFC_UNKNOWN_TARGET) && (devType < NET_NFC_NFCIP1_TARGET))
+                       else if ((devType > NET_NFC_UNKNOWN_TARGET) &&
+                                               (devType < NET_NFC_NFCIP1_TARGET))
                        {
-                               if (g_nfc_context.current_tag != NULL)
+                               if (gdbus_nfc_context.current_tag != NULL)
                                {
-                                       net_nfc_release_tag_info((net_nfc_target_info_h)g_nfc_context.current_tag);
-                                       g_nfc_context.current_tag = NULL;
+                                       net_nfc_release_tag_info(
+                                               (net_nfc_target_info_h)
+                                               gdbus_nfc_context.current_tag);
+                                       gdbus_nfc_context.current_tag = NULL;
                                }
 
-                               net_nfc_get_current_tag_info_sync((net_nfc_target_info_h *)&g_nfc_context.current_tag);
+                               net_nfc_client_tag_get_current_tag_info_sync(
+                                       (net_nfc_target_info_h *)
+                                       &gdbus_nfc_context.current_tag);
                        }
                }
                else
@@ -829,6 +665,7 @@ int nfc_manager_initialize_sync()
 
                if (ret != NET_NFC_OK)
                        return _convert_error_code(__func__, ret);
+#endif
        }
 
        return NFC_ERROR_NONE;
@@ -836,1195 +673,2578 @@ int nfc_manager_initialize_sync()
 
 int nfc_manager_deinitialize (void)
 {
-       int ret = NFC_ERROR_NONE;
+       int ret = NET_NFC_OK;
 
        if (_is_initialized())
        {
-               net_nfc_state_deactivate();
+               net_nfc_client_p2p_unset_device_discovered();
+               net_nfc_client_p2p_unset_device_detached();
 
-               ret = net_nfc_deinitialize();
+               net_nfc_client_tag_unset_tag_discovered();
+               net_nfc_client_tag_unset_tag_detached();
 
-               if (ret == 0)
-                       net_nfc_unset_response_callback();
+               ret = net_nfc_client_deinitialize();
 
-               g_nfc_context.initialized = false;
+               gdbus_nfc_context.initialized = false;
        }
 
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_manager_set_tag_discovered_cb( nfc_tag_discovered_cb callback , void * user_data)
-{
-       if( callback == NULL)
-               return _return_invalid_param(__func__);
-       g_nfc_context.on_tag_discovered_cb = callback;
-       g_nfc_context.on_tag_discovered_user_data = user_data;
-       return 0;
-}
-void nfc_manager_unset_tag_discovered_cb( void )
-{
-       g_nfc_context.on_tag_discovered_cb = NULL;
-       g_nfc_context.on_tag_discovered_user_data = NULL;
-}
+/*********************** NDEF Functions*********************/
 
-int nfc_manager_set_ndef_discovered_cb( nfc_ndef_discovered_cb callback , void *user_data)
+int nfc_manager_set_ndef_discovered_cb(
+       nfc_ndef_discovered_cb callback,
+       void *user_data)
 {
-       ifcallback == NULL)
+       if (callback == NULL)
                return _return_invalid_param(__func__);
-       g_nfc_context.on_ndef_discovered_cb= callback;
-       g_nfc_context.on_ndef_discovered_user_data= user_data;
-       return 0;
+
+       gdbus_nfc_context.on_ndef_discovered_cb = callback;
+       gdbus_nfc_context.on_ndef_discovered_user_data = user_data;
+
+       return NFC_ERROR_NONE;
 }
 
 void nfc_manager_unset_ndef_discovered_cb( void )
 {
-
-       g_nfc_context.on_ndef_discovered_cb = NULL;
-       g_nfc_context.on_ndef_discovered_user_data = NULL;
+       gdbus_nfc_context.on_ndef_discovered_cb = NULL;
+       gdbus_nfc_context.on_ndef_discovered_user_data = NULL;
 }
 
 void nfc_manager_set_tag_filter(int filter )
 {
-       net_nfc_set_tag_filter(filter);
+       net_nfc_client_tag_set_filter(filter);
 }
 
 int nfc_manager_get_tag_filter(void)
 {
+       return net_nfc_client_tag_get_filter();
+}
+
+static void _net_nfc_manager_tag_format_ndef_cb(net_nfc_error_e result,
+       void *user_data)
+{
+       nfc_tag_format_completed_cb callback;
+       void *user_param;
+
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result),
+                       user_param);
+       }
 
-       return net_nfc_get_tag_filter();
+       g_variant_unref((GVariant *)user_data);
 }
 
-int nfc_manager_get_connected_tag(nfc_tag_h * tag)
+int nfc_tag_format_ndef(nfc_tag_h tag,
+       unsigned char *key,
+       int key_size,
+       nfc_tag_format_completed_cb callback,
+       void *user_data)
 {
        int ret;
-       if( tag == NULL )
+       data_s key_data = { key, key_size };
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       GVariant *parameter;
+
+       if (tag == NULL)
                return _return_invalid_param(__func__);
 
-       if(g_nfc_context.current_tag == NULL)
+       if (!nfc_manager_is_activated())
        {
-               return NFC_ERROR_NO_DEVICE;
+               return NFC_ERROR_NOT_ACTIVATED;
        }
 
-       if(g_nfc_context.current_tag->handle == NULL)
+       if (_check_app_permission() == false)
        {
-               ret = NFC_ERROR_NO_DEVICE;
+               LOGE("permission check fail");
+
+               return NFC_ERROR_SECURITY_RESTRICTED;
        }
-       else
-       {
-               *tag = (nfc_tag_h)g_nfc_context.current_tag;
-               ret = NFC_ERROR_NONE;
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_ndef_format(
+                       (net_nfc_target_handle_h)tag_info->handle,
+                       (data_h)&key_data,
+                       _net_nfc_manager_tag_format_ndef_cb,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
        }
-       return ret;
+
+       return _convert_error_code(__func__, ret);
 }
 
-int nfc_manager_get_connected_target(nfc_p2p_target_h *target)
+static void _net_nfc_manager_tag_read_ndef_cb(net_nfc_error_e result,
+       ndef_message_h message,
+       void *user_data)
+{
+       nfc_tag_read_completed_cb callback;
+       void *user_param;
+
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result),
+                       (nfc_ndef_message_h)message,
+                       user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_tag_read_ndef(nfc_tag_h tag,
+       nfc_tag_read_completed_cb callback,
+       void * user_data)
 {
        int ret;
-       if( target == NULL )
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       GVariant *parameter;
+
+       if (tag == NULL)
                return _return_invalid_param(__func__);
 
-       if(g_nfc_context.current_target == NULL)
+       if (!nfc_manager_is_activated())
        {
-               ret = NFC_ERROR_NO_DEVICE;
+               return NFC_ERROR_NOT_ACTIVATED;
        }
-       else
-       {
-               *target = (nfc_p2p_target_h)g_nfc_context.current_target;
-               ret = NFC_ERROR_NONE;
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_ndef_read(
+                       (net_nfc_target_handle_h)tag_info->handle,
+                       _net_nfc_manager_tag_read_ndef_cb,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
        }
 
-       return ret;
+       return _convert_error_code(__func__, ret);
 }
 
-int nfc_manager_set_system_handler_enable(bool enable)
+int nfc_ndef_message_get_rawdata_size(nfc_ndef_message_h ndef_message,
+       int *byte_size)
 {
-       int ret = NFC_ERROR_NONE;
+       int ret;
 
-       ret = net_nfc_set_launch_popup_state(enable);
+       if (ndef_message == NULL || byte_size == NULL)
+               return _return_invalid_param(__func__);
 
-       if( ret != NET_NFC_OK )
-               return _convert_error_code(__func__, ret);
-       else
-               return ret;
+       ret = net_nfc_get_ndef_message_byte_length(ndef_message,
+               (unsigned int *)byte_size);
+
+       return _convert_error_code(__func__, ret);
 }
 
-bool nfc_manager_is_system_handler_enabled(void)
+static void _net_nfc_manager_tag_write_ndef_cb(net_nfc_error_e result,
+       void *user_data)
 {
-       int state = 0;
+       nfc_tag_write_completed_cb callback;
+       void *user_param;
 
-       net_nfc_get_launch_popup_state(&state);
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result), user_param);
+       }
 
-       return state;
+       g_variant_unref((GVariant *)user_data);
 }
 
-int nfc_manager_set_card_emulation_se_type(nfc_se_type_e type, nfc_set_card_emulation_completed_cb callback, void* user_data)
+int nfc_tag_write_ndef(nfc_tag_h tag,
+       nfc_ndef_message_h msg,
+       nfc_tag_write_completed_cb callback,
+       void *user_data)
 {
-       if ((type < NFC_SE_TYPE_DISABLE) || (type > NFC_SE_TYPE_UICC))
-       {
+       int ret;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       int byte_size = 0;
+       GVariant *parameter;
+
+       if (tag == NULL)
                return _return_invalid_param(__func__);
-       }
 
-       if(!nfc_manager_is_activated())
+       if (!nfc_manager_is_activated())
        {
                return NFC_ERROR_NOT_ACTIVATED;
        }
 
-       _async_callback_data *trans_data = NULL;
-       int ret=0;
-       net_nfc_se_type_e se_type;
-
-       if( callback != NULL )
+       if (_check_app_permission() == false)
        {
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
+               LOGE("permission check fail");
+               return NFC_ERROR_SECURITY_RESTRICTED;
        }
 
-       switch(type)
-       {
-       case NFC_SE_TYPE_DISABLE:
-               se_type = NET_NFC_SE_TYPE_NONE;
-               break;
-       case NFC_SE_TYPE_ESE:
-               se_type = NET_NFC_SE_TYPE_ESE;
-               break;
-       case NFC_SE_TYPE_UICC:
-               se_type = NET_NFC_SE_TYPE_UICC;
-               break;
-       default:
-       break;
+       if (tag_info->ndefCardState == NET_NFC_NDEF_CARD_READ_ONLY) {
+               return NFC_ERROR_READ_ONLY_NDEF;
        }
 
-       ret = net_nfc_set_secure_element_type(se_type, (void *)trans_data);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_manager_get_card_emulation_se_type(nfc_se_type_e* type)
-{
-       int ret = NFC_ERROR_NONE;
-       int se_type;
-
-       if ((ret = vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_type)) != 0)
-       {
-               ret = NFC_ERROR_OPERATION_FAILED;
-               return ret;
+       nfc_ndef_message_get_rawdata_size(msg, &byte_size);
+       if (tag_info->maxDataSize < byte_size) {
+               return NFC_ERROR_NO_SPACE_ON_NDEF;
        }
-       else
-       {
-               if ((se_type >= NFC_SE_TYPE_DISABLE) && (se_type <= NFC_SE_TYPE_UICC))
-                       *type =         se_type;
-               else
-                       ret = NFC_ERROR_OPERATION_FAILED;
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_ndef_write(
+                       (net_nfc_target_handle_h)tag_info->handle,
+                       msg,
+                       _net_nfc_manager_tag_write_ndef_cb,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
        }
 
-       return ret;
+       return _convert_error_code(__func__, ret);
 }
 
 int nfc_manager_get_cached_message(nfc_ndef_message_h *ndef_message)
 {
        int ret;
-       if( ndef_message == NULL )
+
+       if (ndef_message == NULL)
                return _return_invalid_param(__func__);
+
        ret = net_nfc_retrieve_current_ndef_message(ndef_message);
+
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_ndef_record_create(nfc_ndef_record_h* record, nfc_record_tnf_e tnf, const unsigned char* type, int type_size , const unsigned char * id , int id_size, const unsigned char * payload, int payload_size)
+int nfc_ndef_record_create(nfc_ndef_record_h *record,
+       nfc_record_tnf_e tnf,
+       const unsigned char *type,
+       int type_size,
+       const unsigned char *id,
+       int id_size,
+       const unsigned char *payload,
+       int payload_size)
 {
-       if(record == NULL  )
+       int ret;
+       data_s type_data = { (unsigned char *)type, type_size };
+       data_s id_data = { (unsigned char *)id, id_size };
+       data_s payload_data = { (unsigned char *)payload, payload_size };
+
+       if (record == NULL || type == NULL || type_size <= 0)
                return _return_invalid_param(__func__);
 
-       data_s type_data = { (unsigned char*)type, type_size };
-       data_s id_data = { (unsigned char*)id , id_size };
-       data_s payload_data = {(unsigned char*)payload , payload_size };
-       int ret;
-       ret = net_nfc_create_record((ndef_record_h*)record , tnf , (data_h)&type_data , (data_h)&id_data, (data_h)&payload_data);
+       ret = net_nfc_create_record(
+               (ndef_record_h *)record,
+               tnf,
+               (data_h)&type_data,
+               (data_h)&id_data,
+               (data_h)&payload_data);
 
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_ndef_record_create_text(nfc_ndef_record_h* record, const char * text, const char * lang_code, nfc_encode_type_e encode )
+int nfc_ndef_record_create_text(nfc_ndef_record_h *record,
+       const char *text,
+       const char *lang_code,
+       nfc_encode_type_e encode)
 {
+       int ret;
 
-       if(record == NULL ||  text == NULL || lang_code == NULL )
+       if (record == NULL || text == NULL || lang_code == NULL)
                return _return_invalid_param(__func__);
-       int ret;
-       ret = net_nfc_create_text_type_record((ndef_record_h*)record, text, lang_code, encode);
+
+       ret = net_nfc_create_text_type_record(
+               (ndef_record_h *)record,
+               text,
+               lang_code,
+               encode);
+
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char* uri)
+int nfc_ndef_record_create_uri(nfc_ndef_record_h *record,
+       const char *uri)
 {
+       int ret;
 
-       if(record == NULL ||  uri == NULL)
+       if (record == NULL || uri == NULL)
                return _return_invalid_param(__func__);
-       int ret;
-       ret = net_nfc_create_uri_type_record((ndef_record_h*)record , uri , NET_NFC_SCHEMA_FULL_URI);
+
+       ret = net_nfc_create_uri_type_record(
+               (ndef_record_h *)record,
+               uri,
+               NET_NFC_SCHEMA_FULL_URI);
+
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_ndef_record_create_mime(nfc_ndef_record_h* record, const char * mime_type , const unsigned char * data , int data_size)
+int nfc_ndef_record_create_mime(nfc_ndef_record_h *record,
+       const char *mime_type,
+       const unsigned char *data,
+       int data_size)
 {
-       if(record == NULL ||  mime_type == NULL || data == NULL)
+       int ret;
+
+       if (record == NULL || mime_type == NULL ||
+               data == NULL || data_size <= 0)
                return _return_invalid_param(__func__);
-       return nfc_ndef_record_create(record , NFC_RECORD_TNF_MIME_MEDIA , (unsigned char *) mime_type, strlen(mime_type), NULL, 0, data, data_size );
-}
 
-int nfc_ndef_record_get_mime_type(nfc_ndef_record_h record , char **mime_type){
+       ret = nfc_ndef_record_create(record,
+               NFC_RECORD_TNF_MIME_MEDIA,
+               (unsigned char *)mime_type,
+               strlen(mime_type),
+               NULL,
+               0,
+               data,
+               data_size);
+
+       return _convert_error_code(__func__, ret);
+}
 
+int nfc_ndef_record_get_mime_type(nfc_ndef_record_h record,
+       char **mime_type)
+{
        int ret;
+       nfc_record_tnf_e tnf;
        unsigned char *typename;
        int length;
 
-       if(record == NULL ||  mime_type == NULL)
+       if (record == NULL || mime_type == NULL)
                return _return_invalid_param(__func__);
-       nfc_record_tnf_e tnf;
-       if( nfc_ndef_record_get_tnf(record, &tnf ) != 0 || tnf != NFC_RECORD_TNF_MIME_MEDIA ){
+
+       if (nfc_ndef_record_get_tnf(record, &tnf) != NET_NFC_OK ||
+               tnf != NFC_RECORD_TNF_MIME_MEDIA)
+                       {
                return NFC_ERROR_INVALID_RECORD_TYPE;
        }
 
-       ret = nfc_ndef_record_get_type(record,&typename, &length);
-       if( ret != 0 )
-               return _convert_error_code(__func__, ret);
-
-       *mime_type = malloc(length+1);
-       if( *mime_type == NULL ){
-               LOGE( "OUT_OF_MEMORY (0x%08x)", NFC_ERROR_OUT_OF_MEMORY);
-               return NFC_ERROR_OUT_OF_MEMORY;
+       ret = nfc_ndef_record_get_type(record, &typename, &length);
+       if (ret == NET_NFC_OK) {
+               *mime_type = calloc(1, length + 1);
+               if (*mime_type != NULL) {
+                       memcpy(*mime_type, typename, length);
+               } else {
+                       ret = NET_NFC_ALLOC_FAIL;
+               }
        }
 
-       memset(*mime_type, 0 , length+1);
-       memcpy(*mime_type, typename , length );
-       return 0;
+       return _convert_error_code(__func__, ret);
 }
 
 int nfc_ndef_record_destroy(nfc_ndef_record_h record)
 {
+       int ret;
 
-       if(record == NULL  )
+       if (record == NULL)
                return _return_invalid_param(__func__);
-       int ret;
+
        ret = net_nfc_free_record(record);
+
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_ndef_record_set_id (nfc_ndef_record_h record, unsigned char *id , int id_size)
+int nfc_ndef_record_set_id(nfc_ndef_record_h record,
+       unsigned char *id,
+       int id_size)
 {
+       int ret;
+       data_s id_data = { id, id_size };
 
-       if(record == NULL ||  id == NULL )
+       if (record == NULL || id == NULL)
                return _return_invalid_param(__func__);
-       int ret;
-       data_s id_data = {id, id_size};
+
        ret = net_nfc_set_record_id(record, (data_h)&id_data);
+
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_ndef_record_get_payload (nfc_ndef_record_h record, unsigned char ** payload, int *size)
+int nfc_ndef_record_get_payload(nfc_ndef_record_h record,
+       unsigned char **payload,
+       int *size)
 {
+       int ret;
+       data_s *payload_data;
 
-       if(record == NULL ||  payload == NULL || size == NULL )
+       if (record == NULL || payload == NULL || size == NULL)
                return _return_invalid_param(__func__);
-       int ret ;
-       data_s *payload_data;
-       ret = net_nfc_get_record_payload(record, (data_h*)&payload_data);
-       if( ret == 0){
+
+       *payload = NULL;
+       *size = 0;
+
+       ret = net_nfc_get_record_payload(record, (data_h *)&payload_data);
+       if (ret == NET_NFC_OK) {
                *payload = payload_data->buffer;
                *size = payload_data->length;
+       } else {
+               *payload = NULL;
+               *size = 0;
        }
+
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_ndef_record_get_type (nfc_ndef_record_h record, unsigned char ** type, int *size)
+int nfc_ndef_record_get_type(nfc_ndef_record_h record,
+       unsigned char **type,
+       int *size)
 {
-
-       int ret ;
+       int ret;
        data_s *type_data;
-       ret = net_nfc_get_record_type(record, (data_h*)&type_data);
-       if( ret == 0){
+
+       if (record == NULL || type == NULL || size == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_record_type(record, (data_h *)&type_data);
+       if (ret == NET_NFC_OK) {
                *type = type_data->buffer;
                *size = type_data->length;
+       } else {
+               *type = NULL;
+               *size = 0;
        }
+
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_ndef_record_get_id (nfc_ndef_record_h record, unsigned char **id , int *size)
+int nfc_ndef_record_get_id(nfc_ndef_record_h record,
+       unsigned char **id,
+       int *size)
 {
+       int ret;
+       data_s *id_data;
 
-       if(record == NULL ||  id == NULL || size == NULL )
+       if (record == NULL || id == NULL || size == NULL)
                return _return_invalid_param(__func__);
 
-       int ret ;
-       data_s *id_data;
-       ret = net_nfc_get_record_id(record, (data_h*)&id_data);
-       if( ret == 0){
+       *id = NULL;
+       *size = 0;
+
+       ret = net_nfc_get_record_id(record, (data_h *)&id_data);
+       if (ret == NET_NFC_OK) {
                *id = id_data->buffer;
                *size = id_data->length;
+       } else {
+               *id = NULL;
+               *size = 0;
        }
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e *tnf)
+{
+       int ret;
+
+       if (record == NULL || tnf == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_record_tnf(record, (net_nfc_record_tnf_e *)tnf);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_text(nfc_ndef_record_h record, char **buffer)
+{
+       int ret;
+
+       if (record == NULL || buffer == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_create_text_string_from_text_record(record, buffer);
+
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e * tnf)
+int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code)
 {
+       int ret;
 
-       if(record == NULL ||  tnf == NULL )
+       if (record == NULL || lang_code == NULL)
                return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_languange_code_string_from_text_record(record,
+               lang_code);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_encode_type(
+       nfc_ndef_record_h record,
+       nfc_encode_type_e *encode)
+{
        int ret;
-       ret = net_nfc_get_record_tnf(record, (net_nfc_record_tnf_e*)tnf);
+
+       if (record == NULL || encode == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_encoding_type_from_text_record(
+               record,
+               (net_nfc_encode_type_e *)encode);
+
+       /*      if( ret == NFC_NDEF_RECORD_IS_NOT_EXPECTED_TYPE)
+        LOGE("%s reord type is not text type");*/
+
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_ndef_record_get_text(nfc_ndef_record_h record, char** buffer)
+int nfc_ndef_record_get_uri(nfc_ndef_record_h record, char **uri)
 {
+       int ret;
 
-       if(record == NULL ||  buffer == NULL)
+       if (record == NULL || uri == NULL)
                return _return_invalid_param(__func__);
+
+       ret = net_nfc_create_uri_string_from_uri_record(record, uri);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_create(nfc_ndef_message_h *ndef_message)
+{
        int ret;
-       ret = net_nfc_create_text_string_from_text_record(record, buffer);
+
+       if (ndef_message == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_create_ndef_message(ndef_message);
+
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code)
-{
+int nfc_ndef_message_create_from_rawdata(
+       nfc_ndef_message_h *ndef_message,
+       const unsigned char *rawdata,
+       int rawdata_size)
+{
+       int ret;
+       data_s rawdata_data = { (unsigned char *)rawdata, rawdata_size };
+
+       if (ndef_message == NULL || rawdata == NULL || rawdata_size <= 0)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_create_ndef_message_from_rawdata(
+               (ndef_message_h *)ndef_message,
+               (data_h)&rawdata_data);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message)
+{
+       int ret;
+
+       if (ndef_message == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_free_ndef_message(ndef_message);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message,
+       int *count)
+{
+       int ret;
+
+       if (ndef_message == NULL || count == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_ndef_message_record_count(ndef_message, count);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message,
+       unsigned char **rawdata,
+       int *rawdata_size)
+{
+       int ret;
+       data_s *rawdata_data;
+
+       if (ndef_message == NULL || rawdata == NULL || rawdata_size == NULL)
+               return _return_invalid_param(__func__);
+
+       *rawdata = NULL;
+       *rawdata_size = 0;
+
+       ret = net_nfc_create_rawdata_from_ndef_message(ndef_message,
+               (data_h *)&rawdata_data);
+       if (ret == NET_NFC_OK) {
+               *rawdata = calloc(1, rawdata_data->length);
+               memcpy(*rawdata, rawdata_data->buffer, rawdata_data->length);
+               *rawdata_size = rawdata_data->length;
+
+               net_nfc_free_data((data_h)rawdata_data);
+       }
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_append_record(nfc_ndef_message_h ndef_message,
+       nfc_ndef_record_h record)
+{
+       int ret;
+
+       if (ndef_message == NULL || record == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_append_record_to_ndef_message(ndef_message, record);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message,
+       int index,
+       nfc_ndef_record_h record)
+{
+       int ret;
+
+       if (ndef_message == NULL || record == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_append_record_by_index(ndef_message, index, record);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message,
+       int index)
+{
+       int ret;
+
+       if (ndef_message == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_remove_record_by_index(ndef_message, index);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message,
+       int index,
+       nfc_ndef_record_h *record)
+{
+       int ret;
+
+       if (ndef_message == NULL || record == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_record_by_index(ndef_message,
+               index,
+               (ndef_record_h*)record);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_get_type(nfc_tag_h tag, nfc_tag_type_e *type)
+{
+       int ret;
+
+       if (tag == NULL || type == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_tag_type(tag, (net_nfc_target_type_e *)type);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_is_support_ndef(nfc_tag_h tag, bool *is_support)
+{
+       int ret;
+
+       if (tag == NULL || is_support == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_tag_ndef_support(tag, is_support);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag, unsigned int *max_size)
+{
+       int ret;
+
+       if (tag == NULL || max_size == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_tag_max_data_size(tag, max_size);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int *actual_data_size)
+{
+       int ret;
+
+       if (tag == NULL || actual_data_size == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_tag_actual_data_size(tag, actual_data_size);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_foreach_information(nfc_tag_h tag,
+       nfc_tag_information_cb callback,
+       void *user_data)
+{
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       net_nfc_tag_info_s *taglist = NULL;
+       int i;
+       bool cont;
+
+       if (tag == NULL || callback == NULL)
+               return _return_invalid_param(__func__);
+
+       taglist = tag_info->tag_info_list;
+
+       if (taglist == NULL) {
+               return NFC_ERROR_NOT_SUPPORTED;
+       }
+
+       for (i = 0; i < tag_info->number_of_keys; i++) {
+               cont = callback(taglist[i].key,
+                       net_nfc_get_data_buffer(taglist[i].value),
+                       net_nfc_get_data_length(taglist[i].value),
+                       user_data);
+
+               if (!cont)
+                       break;
+       }
+
+       return NFC_ERROR_NONE;
+}
+
+/***************************************Tag Functions********************************************/
+
+int nfc_manager_get_connected_tag(nfc_tag_h *tag)
+{
+       int ret;
+       net_nfc_target_info_h result = NULL;
+
+       if (tag == NULL)
+               return _return_invalid_param(__func__);
+
+       *tag = NULL;
+
+       if (gdbus_nfc_context.current_tag == NULL) {
+               ret = net_nfc_client_tag_get_current_tag_info_sync(&result);
+               if (ret == NET_NFC_OK) {
+                       *tag = (nfc_tag_h)result;
+               }
+       } else {
+               /* FIXME ??? */
+               *tag = gdbus_nfc_context.current_tag;
+
+               ret = NET_NFC_OK;
+       }
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_manager_get_connected_target(nfc_p2p_target_h *target)
+{
+       int ret;
+       net_nfc_target_handle_h result = NULL;
+
+       if (target == NULL)
+               return _return_invalid_param(__func__);
+
+       *target = NULL;
+
+       if (gdbus_nfc_context.current_target == NULL) {
+               ret = net_nfc_client_tag_get_current_target_handle_sync(&result);
+               if (ret == NET_NFC_OK) {
+                       gdbus_nfc_context.current_target = result;
+
+                       *target = gdbus_nfc_context.current_target;
+               }
+       } else {
+               /* FIXME ??? */
+               *target = gdbus_nfc_context.current_target;
+
+               ret = NET_NFC_OK;
+       }
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_manager_set_tag_discovered_cb(nfc_tag_discovered_cb callback,
+       void *user_data)
+{
+       if (callback == NULL)
+               return _return_invalid_param(__func__);
+
+       gdbus_nfc_context.on_tag_discovered_cb = callback;
+       gdbus_nfc_context.on_tag_discovered_user_data = user_data;
+
+       return NFC_ERROR_NONE;
+}
+
+void nfc_manager_unset_tag_discovered_cb(void)
+{
+       gdbus_nfc_context.on_tag_discovered_cb = NULL;
+       gdbus_nfc_context.on_tag_discovered_user_data = NULL;
+}
+#if 0
+void _nfc_manager_tag_detached_cb(void *user_data)
+{
+       if (gdbus_nfc_context.on_tag_discovered_cb)
+       {
+               gdbus_nfc_context.on_tag_discovered_cb(
+                       NFC_DISCOVERED_TYPE_DETACHED,
+                       (nfc_tag_h)gdbus_nfc_context.current_tag,
+                       gdbus_nfc_context.on_tag_discovered_user_data);
+       }
+
+       if (gdbus_nfc_context.current_tag != NULL )
+       {
+               net_nfc_release_tag_info(
+                       (net_nfc_target_info_h)gdbus_nfc_context.current_tag);
+               gdbus_nfc_context.current_tag = NULL;
+       }
+}
+
+int nfc_manager_set_tag_detached_cb(nfc_tag_discovered_cb callback,
+       void *user_data)
+{
+       if (callback == NULL)
+               return _return_invalid_param(__func__);
+
+       gdbus_nfc_context.on_tag_discovered_cb = callback;
+       gdbus_nfc_context.on_tag_discovered_user_data = user_data;
+
+       net_nfc_client_tag_set_tag_detached(
+               _nfc_manager_tag_detached_cb,
+               user_data);
+
+       return NFC_ERROR_NONE;
+}
+
+void nfc_manager_unset_tag_detached_cb(void)
+{
+       net_nfc_client_tag_unset_tag_detached();
+}
+#endif
+/******************************Popup Notification*******************************/
+
+int nfc_manager_set_system_handler_enable(bool enable)
+{
+       int ret;
+       int state;
+
+       if (enable == true) {
+               state = 0;
+       } else {
+               state = 1;
+       }
+
+       ret = net_nfc_client_sys_handler_set_launch_popup_state(state);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_manager_set_system_handler_enable_force(bool enable)
+{
+       int ret;
+       int state;
+
+       if (enable == true) {
+               state = 0;
+       } else {
+               state = 1;
+       }
+
+       ret = net_nfc_client_sys_handler_set_launch_popup_state_force(state);
+
+       return _convert_error_code(__func__, ret);
+}
+
+bool nfc_manager_is_system_handler_enabled(void)
+{
+       int state = 0;
+
+       net_nfc_client_sys_handler_get_launch_popup_state(&state);
+
+       return (state == 0);
+}
+
+/******************************Handover*******************************/
+
+static void _net_nfc_manager_p2p_handover_cb(net_nfc_error_e result,
+       net_nfc_conn_handover_carrier_type_e carrier,
+       data_h ac_data,
+       void *user_data)
+{
+       nfc_p2p_connection_handover_completed_cb callback;
+       void *user_param;
+
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               nfc_ac_type_e carrior_type = NFC_AC_TYPE_UNKNOWN;
+               char buffer[50] = { 0, };
+
+               if (carrier == NET_NFC_CONN_HANDOVER_CARRIER_BT) {
+                       data_s *data = (data_s *)ac_data;
+
+                       carrior_type = NFC_AC_TYPE_BT;
+                       if (data != NULL && data->buffer != NULL)
+                       {
+                               snprintf(buffer, sizeof(buffer),
+                                       "%02x:%02x:%02x:%02x:%02x:%02x",
+                                       data->buffer[0], data->buffer[1],
+                                       data->buffer[2], data->buffer[3],
+                                       data->buffer[4], data->buffer[5]);
+                       }
+               }
+
+               callback(_convert_error_code(__func__, result),
+                       carrior_type, (void *)buffer,
+                       strlen(buffer), user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_p2p_connection_handover(nfc_p2p_target_h target,
+       nfc_ac_type_e type,
+       nfc_p2p_connection_handover_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       net_nfc_conn_handover_carrier_type_e net_ac_type =
+               NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+       GVariant *parameter;
+
+       if (target == NULL)
+               return _return_invalid_param(__func__);
+
+       if (type > NFC_AC_TYPE_UNKNOWN)
+               return _return_invalid_param(__func__);
+
+       if (!nfc_manager_is_activated()) {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       switch (type)
+       {
+       case NFC_AC_TYPE_BT :
+               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_BT;
+               break;
+
+       case NFC_AC_TYPE_WIFI :
+               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS;
+               break;
+
+       case NFC_AC_TYPE_WIFI_DIRECT :
+               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_IBSS;
+               break;
+
+       case NFC_AC_TYPE_UNKNOWN :
+               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+               break;
+
+       default:
+               break;
+       }
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_p2p_connection_handover(
+                       (net_nfc_target_handle_h)target,
+                       net_ac_type,
+                       _net_nfc_manager_p2p_handover_cb,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
+       }
+
+       return _convert_error_code(__func__, ret);
+}
+
+bool nfc_p2p_is_supported_ac_type(nfc_ac_type_e carrier)
+{
+       bool result = false;
+
+       if (carrier == NFC_AC_TYPE_BT)
+               result = true;
+
+       return result;
+}
+
+/**********************P2P functions************************************/
+
+static void _p2p_send_cb(net_nfc_error_e result,
+       void *user_data)
+{
+       nfc_p2p_send_completed_cb callback;
+       void *user_param;
+
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result), user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_p2p_send(nfc_p2p_target_h target,
+       nfc_ndef_message_h message,
+       nfc_p2p_send_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       net_nfc_exchanger_data_h data_handle;
+       data_h rawdata;
+       GVariant *parameter;
+
+       if (target == NULL || message == NULL)
+               return _return_invalid_param(__func__);
+
+       if (!nfc_manager_is_activated())
+               return NFC_ERROR_NOT_ACTIVATED;
+
+       if (_check_app_permission() == false)
+       {
+               LOGE("permission check fail");
+
+               return NFC_ERROR_SECURITY_RESTRICTED;
+       }
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               net_nfc_create_rawdata_from_ndef_message(message, &rawdata);
+               ret = net_nfc_client_create_exchanger_data(&data_handle, rawdata);
+               if (ret == NET_NFC_OK) {
+                       ret = net_nfc_client_p2p_send(data_handle,
+                               (net_nfc_target_handle_h)target,
+                               _p2p_send_cb,
+                               parameter);
+                       if (ret != NET_NFC_OK) {
+                               g_variant_unref(parameter);
+                       }
+
+                       net_nfc_client_free_exchanger_data(data_handle);
+               }
+               net_nfc_free_data(rawdata);
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
+       }
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_p2p_send_no_permission(
+       nfc_p2p_target_h target,
+       nfc_ndef_message_h message,
+       nfc_p2p_send_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       net_nfc_exchanger_data_h data_handle;
+       data_h rawdata;
+       GVariant *parameter;
+
+       if (target == NULL || message == NULL)
+               return _return_invalid_param(__func__);
+
+       if (!nfc_manager_is_activated())
+               return NFC_ERROR_NOT_ACTIVATED;
+
+       /* skip check app permission */
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               net_nfc_create_rawdata_from_ndef_message(message, &rawdata);
+               ret = net_nfc_client_create_exchanger_data(&data_handle, rawdata);
+               if (ret == NET_NFC_OK) {
+                       ret = net_nfc_client_p2p_send(data_handle,
+                               (net_nfc_target_handle_h)target,
+                               _p2p_send_cb,
+                               parameter);
+                       if (ret != NET_NFC_OK) {
+                               g_variant_unref(parameter);
+                       }
+
+                       net_nfc_client_free_exchanger_data(data_handle);
+               }
+               net_nfc_free_data(rawdata);
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
+       }
+
+       return _convert_error_code(__func__, ret);
+}
+
+static void _net_nfc_manager_p2p_set_data_received_cb(data_h data,
+       void *user_data)
+{
+       if (gdbus_nfc_context.on_p2p_recv_cb != NULL)
+       {
+               ndef_message_h ndef_message;
+
+               net_nfc_create_ndef_message_from_rawdata(&ndef_message, data);
+
+               gdbus_nfc_context.on_p2p_recv_cb(
+                       (nfc_p2p_target_h)(gdbus_nfc_context.current_target),
+                       ndef_message,
+                       gdbus_nfc_context.on_p2p_recv_user_data);
+
+               net_nfc_free_ndef_message(ndef_message);
+       }
+}
+
+int nfc_p2p_set_data_received_cb(nfc_p2p_target_h target,
+       nfc_p2p_data_recived_cb callback,
+       void *user_data)
+{
+       if (target == NULL || callback == NULL)
+               return _return_invalid_param(__func__);
+
+       if (gdbus_nfc_context.current_target != target)
+               return _return_invalid_param(__func__);
+
+       gdbus_nfc_context.on_p2p_recv_cb = callback;
+       gdbus_nfc_context.on_p2p_recv_user_data = user_data;
+
+       net_nfc_client_p2p_set_data_received(
+               _net_nfc_manager_p2p_set_data_received_cb,
+               NULL);
+
+       return NFC_ERROR_NONE;
+}
+
+int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target)
+{
+       if (target == NULL)
+               return _return_invalid_param(__func__);
+
+       if (gdbus_nfc_context.current_target != target)
+               return _return_invalid_param(__func__);
+
+       net_nfc_client_p2p_unset_data_received();
+
+       gdbus_nfc_context.on_p2p_recv_cb = NULL;
+       gdbus_nfc_context.on_p2p_recv_user_data = NULL;
+
+       return NFC_ERROR_NONE;
+}
+
+int nfc_manager_set_p2p_target_discovered_cb(
+       nfc_p2p_target_discovered_cb callback,
+       void *user_data)
+{
+       if (callback == NULL)
+               return _return_invalid_param(__func__);
+
+       gdbus_nfc_context.on_p2p_target_discovered_cb = callback;
+       gdbus_nfc_context.on_p2p_target_discovered_user_data = user_data;
+
+       return NFC_ERROR_NONE;
+}
+
+void nfc_manager_unset_p2p_target_discovered_cb(void)
+{
+       gdbus_nfc_context.on_p2p_target_discovered_cb = NULL;
+       gdbus_nfc_context.on_p2p_target_discovered_user_data = NULL;
+}
+
+/******************************SNEP***********************************/
+
+static void _net_nfc_manager_snep_start_server(
+       net_nfc_snep_handle_h arg_handle,
+       net_nfc_snep_type_t event,
+       net_nfc_error_e result,
+       nfc_ndef_message_h msg,
+       void *user_data)
+{
+       nfc_snep_event_cb callback;
+       void *user_param;
+
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               nfc_snep_event_e snep_event;
+
+               switch ((int)event) {
+               case NET_NFC_SNEP_GET :
+                       snep_event = NFC_SNEP_EVENT_GET;
+                       break;
+
+               case NET_NFC_SNEP_PUT :
+                       snep_event = NFC_SNEP_EVENT_PUT;
+                       break;
+
+               case NET_NFC_LLCP_REGISTERED :
+                       snep_event = NFC_SNEP_EVENT_REGISTER;
+                       break;
+
+               case NET_NFC_LLCP_UNREGISTERED :
+                       snep_event = NFC_SNEP_EVENT_UNREGISTER;
+                       break;
+
+               case NET_NFC_LLCP_START :
+                       snep_event = NFC_SNEP_EVENT_START;
+                       break;
+
+               case NET_NFC_LLCP_STOP :
+               default :
+                       snep_event = NFC_SNEP_EVENT_STOP;
+                       break;
+               }
+
+               callback(arg_handle, snep_event,
+                       _convert_error_code(__func__, result)
+                       , msg, user_param);
+
+               if (snep_event == NFC_SNEP_EVENT_STOP) {
+                       g_variant_unref(user_data);
+               }
+       }
+}
+
+int nfc_snep_start_server(nfc_p2p_target_h target,
+       const char *san,
+       int sap,
+       nfc_snep_event_cb callback,
+       void *user_data)
+{
+       net_nfc_error_e result;
+       GVariant *parameter;
+
+       if (target == NULL) {
+               return NFC_ERROR_INVALID_PARAMETER;
+       }
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               result = net_nfc_client_snep_start_server(
+                       (net_nfc_target_handle_h)target,
+                       san,
+                       (sap_t)sap,
+                       _net_nfc_manager_snep_start_server,
+                       parameter);
+               if (result != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               result = NET_NFC_ALLOC_FAIL;
+       }
+
+       return _convert_error_code(__func__, result);
+}
+
+static void _net_nfc_manager_snep_start_client(
+       net_nfc_snep_handle_h arg_handle,
+       net_nfc_snep_type_t event,
+       net_nfc_error_e result,
+       nfc_ndef_message_h msg,
+       void *user_data)
+{
+       nfc_snep_event_cb callback;
+       void *user_param;
+
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               nfc_snep_event_e snep_event;
+
+               switch ((int)event) {
+               case NET_NFC_SNEP_GET :
+                       snep_event = NFC_SNEP_EVENT_GET;
+                       break;
+
+               case NET_NFC_SNEP_PUT :
+                       snep_event = NFC_SNEP_EVENT_PUT;
+                       break;
+
+               case NET_NFC_LLCP_REGISTERED :
+                       snep_event = NFC_SNEP_EVENT_REGISTER;
+                       break;
+
+               case NET_NFC_LLCP_UNREGISTERED :
+                       snep_event = NFC_SNEP_EVENT_UNREGISTER;
+                       break;
+
+               case NET_NFC_LLCP_START :
+                       snep_event = NFC_SNEP_EVENT_START;
+                       break;
+
+               case NET_NFC_LLCP_STOP :
+               default :
+                       snep_event = NFC_SNEP_EVENT_STOP;
+                       break;
+               }
+
+               callback(arg_handle, snep_event,
+                       _convert_error_code(__func__, result),
+                       msg, user_param);
+
+               if (snep_event == NFC_SNEP_EVENT_STOP) {
+                       g_variant_unref(user_data);
+               }
+       }
+}
+
+int nfc_snep_start_client(nfc_p2p_target_h target,
+       const char *san,
+       int sap,
+       nfc_snep_event_cb callback,
+       void *user_data)
+{
+       net_nfc_error_e result;
+       GVariant *parameter;
+
+       if (target == NULL) {
+               return NFC_ERROR_INVALID_PARAMETER;
+       }
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               result = net_nfc_client_snep_start_client(
+                       (net_nfc_target_handle_h)target,
+                       san,
+                       (sap_t)sap,
+                       _net_nfc_manager_snep_start_client,
+                       parameter);
+               if (result != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               result = NET_NFC_ALLOC_FAIL;
+       }
+
+       return _convert_error_code(__func__, result);
+}
+
+static void _net_nfc_manager_snep_send_request(
+       net_nfc_snep_handle_h target,
+       net_nfc_snep_type_t event,
+       net_nfc_error_e result,
+       ndef_message_h msg,
+       void *user_data)
+{
+       nfc_snep_event_cb callback;
+       void *user_param;
+
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback((nfc_p2p_snep_h)target,
+                       event,
+                       _convert_error_code(__func__, result),
+                       (nfc_ndef_message_h)msg,
+                       user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_snep_send_client_request(nfc_p2p_snep_h handle,
+       nfc_snep_type_e type,
+       nfc_ndef_message_h msg,
+       nfc_snep_event_cb callback,
+       void *user_data)
+{
+       net_nfc_error_e result;
+       GVariant *parameter;
+
+       if (handle == NULL || msg == NULL) {
+               return NFC_ERROR_INVALID_PARAMETER;
+       }
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               result = net_nfc_client_snep_send_client_request(
+                       (net_nfc_target_handle_h)handle,
+                       type,
+                       msg,
+                       _net_nfc_manager_snep_send_request,
+                       parameter);
+               if (result != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               result = NET_NFC_ALLOC_FAIL;
+       }
+
+       return _convert_error_code(__func__, result);
+}
+
+static void _snep_event_cb(net_nfc_snep_handle_h target,
+       net_nfc_snep_type_t event,
+       net_nfc_error_e result,
+       ndef_message_h msg,
+       void *user_data)
+{
+       nfc_snep_event_cb callback;
+       void *user_param;
+
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               switch ((int)event) {
+               case NET_NFC_SNEP_GET :
+                       event = NFC_SNEP_EVENT_GET;
+                       break;
+
+               case NET_NFC_SNEP_PUT :
+                       event = NFC_SNEP_EVENT_PUT;
+                       break;
+
+               case NET_NFC_LLCP_REGISTERED :
+                       event = NFC_SNEP_EVENT_REGISTER;
+                       break;
+
+               case NET_NFC_LLCP_UNREGISTERED :
+                       event = NFC_SNEP_EVENT_UNREGISTER;
+                       break;
+
+               case NET_NFC_LLCP_START :
+                       event = NFC_SNEP_EVENT_START;
+                       break;
+
+               case NET_NFC_LLCP_STOP :
+                       event = NFC_SNEP_EVENT_STOP;
+                       break;
+               }
+
+               callback(target, event,
+                       _convert_error_code(__func__, result),
+                       (ndef_message_h)msg, user_param);
+       }
+
+       if ((int)event == NFC_SNEP_EVENT_UNREGISTER) {
+               g_variant_unref((GVariant *)user_data);
+       }
+}
+
+int nfc_snep_register_server(const char *san, int sap,
+       nfc_snep_event_cb callback, void *user_data)
+{
+       net_nfc_error_e result;
+       GVariant *parameter;
+
+       if (san == NULL) {
+               return _return_invalid_param(__func__);
+       }
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               result = net_nfc_client_snep_register_server(san, (sap_t)sap,
+                       _snep_event_cb, parameter);
+               if (result != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               result = NET_NFC_ALLOC_FAIL;
+       }
+
+       return _convert_error_code(__func__, result);
+}
+
+int nfc_snep_unregister_server(const char *san, int sap)
+{
+       net_nfc_error_e result;
+
+       result = net_nfc_client_snep_unregister_server(san, (sap_t)sap);
+
+       return _convert_error_code(__func__, result);
+}
+
+int nfc_snep_stop_service(nfc_p2p_target_h target, nfc_p2p_snep_h clients)
+{
+       int ret;
+
+       ret = net_nfc_client_snep_stop_service_sync(target, clients);
+
+       return _convert_error_code(__func__, ret);
+}
+
+/******************************Secure Element***********************************/
+
+static void _net_nfc_manager_set_card_emulation_se_type_cb(
+       net_nfc_error_e result, void *user_data)
+{
+       nfc_set_card_emulation_completed_cb callback;
+       void *user_param;
+
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result),
+                       user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_manager_set_card_emulation_se_type(
+       nfc_se_type_e type,
+       nfc_set_card_emulation_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       net_nfc_se_type_e se_type;
+       GVariant *parameter;
+
+       if ((type < NFC_SE_TYPE_DISABLE) || (type > NFC_SE_TYPE_UICC))
+       {
+               return _return_invalid_param(__func__);
+       }
+
+       if (!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       switch (type)
+       {
+       case NFC_SE_TYPE_DISABLE :
+               se_type = NET_NFC_SE_TYPE_NONE;
+               break;
+       case NFC_SE_TYPE_ESE :
+               se_type = NET_NFC_SE_TYPE_ESE;
+               break;
+       case NFC_SE_TYPE_UICC :
+               se_type = NET_NFC_SE_TYPE_UICC;
+               break;
+       default:
+               break;
+       }
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_se_set_secure_element_type(
+                       se_type,
+                       _net_nfc_manager_set_card_emulation_se_type_cb,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
+       }
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_manager_get_card_emulation_se_type(nfc_se_type_e *type)
+{
+       int ret;
+       int se_type;
+
+       ret = vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_type);
+       if (ret == 0)
+       {
+               if ((se_type >= NFC_SE_TYPE_DISABLE)
+                       && (se_type <= NFC_SE_TYPE_UICC))
+               {
+                       *type = se_type;
+
+                       ret = NFC_ERROR_NONE;
+               }
+               else
+               {
+                       ret = NFC_ERROR_OPERATION_FAILED;
+               }
+       }
+       else
+       {
+               ret = NFC_ERROR_OPERATION_FAILED;
+       }
+
+       return ret;
+}
+
+int nfc_se_open_secure_element(
+       nfc_se_type_e se_type,
+       nfc_se_h *handle)
+{
+       net_nfc_error_e result;
+       net_nfc_se_type_e type;
+       net_nfc_target_handle_h temp = NULL;
+
+       switch (se_type)
+       {
+       case NFC_SE_TYPE_ESE :
+               type = NET_NFC_SE_TYPE_ESE;
+               break;
+
+       case NFC_SE_TYPE_UICC :
+               type = NET_NFC_SE_TYPE_UICC;
+               break;
+
+       default:
+               return NFC_ERROR_INVALID_PARAMETER;
+               break;
+       }
+
+       result = net_nfc_client_se_open_internal_secure_element_sync(
+               type,
+               &temp);
+       if (result == NET_NFC_OK) {
+               *handle = (nfc_se_h)temp;
+       }
 
-       if(record == NULL ||  lang_code == NULL)
-               return _return_invalid_param(__func__);
-       int ret;
-       ret = net_nfc_get_languange_code_string_from_text_record(record, lang_code);
-       return _convert_error_code(__func__, ret);
+       return _convert_error_code(__func__, result);
 }
-int nfc_ndef_record_get_encode_type(nfc_ndef_record_h record, nfc_encode_type_e *encode)
-{
 
-       if(record == NULL ||  encode == NULL  )
-               return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_get_encoding_type_from_text_record(record, (net_nfc_encode_type_e*)encode);
-//     if( ret == NFC_NDEF_RECORD_IS_NOT_EXPECTED_TYPE)
-//             LOGE("%s reord type is not text type");
-       return _convert_error_code(__func__, ret);
-}
-int nfc_ndef_record_get_uri(nfc_ndef_record_h record , char **uri)
+int nfc_se_send_apdu(nfc_se_h handle,
+       unsigned char *cmd,
+       unsigned int cmd_len,
+       unsigned char **resp,
+       unsigned int *resp_len)
 {
+       net_nfc_error_e result;
+       data_s command, *response = NULL;
 
-       if(record == NULL ||  uri == NULL  )
+       if (handle == NULL || cmd == NULL || cmd_len == 0 ||
+               resp == NULL || resp_len == NULL ) {
                return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_create_uri_string_from_uri_record(record, uri);
-       return _convert_error_code(__func__, ret);
-}
+       }
 
-int nfc_ndef_message_create(nfc_ndef_message_h* ndef_message)
-{
+       *resp = NULL;
+       *resp_len = 0;
 
-       if( ndef_message == NULL )
-               return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_create_ndef_message(ndef_message);
-       return _convert_error_code(__func__, ret);
-}
+       command.buffer = cmd;
+       command.length = cmd_len;
 
-int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h* ndef_message, const unsigned char* rawdata, int rawdata_size)
-{
+       result = net_nfc_client_se_send_apdu_sync(
+               (net_nfc_target_handle_h)handle,
+               (data_h)&command,
+               (data_h *)&response);
 
-       if( ndef_message == NULL || rawdata == NULL)
-               return _return_invalid_param(__func__);
-       int ret=0;
-       data_s rawdata_data = {(unsigned char *)rawdata, rawdata_size};
-       ret = net_nfc_create_ndef_message_from_rawdata((ndef_message_h*)ndef_message , (data_h)&rawdata_data);
-       return _convert_error_code(__func__, ret);
-}
+       if (result == NET_NFC_OK && response != NULL
+               && response->buffer != NULL) {
+               if (response->length >= 2) {
+                       *resp = calloc(1, response->length);
+                       if (*resp != NULL) {
+                               memcpy(*resp, response->buffer, response->length);
+                               *resp_len = response->length;
+                       } else {
+                               result = NET_NFC_ALLOC_FAIL;
+                       }
+               } else {
+                       result = NET_NFC_OPERATION_FAIL;
+               }
+       }
 
-int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message)
-{
+       if (response != NULL) {
+               net_nfc_free_data((data_h)response);
+       }
 
-       if( ndef_message == NULL )
-               return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_free_ndef_message(ndef_message);
-       return _convert_error_code(__func__, ret);
+       return _convert_error_code(__func__, result);
 }
 
-int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message , int *count)
+int nfc_se_get_atr(nfc_se_h handle, unsigned char **atr, unsigned int *atr_len)
 {
+       net_nfc_error_e result;
+       data_s *response = NULL;
 
-       if( ndef_message == NULL || count == NULL)
+       if (handle == NULL || atr == NULL || atr_len == NULL) {
                return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_get_ndef_message_record_count(ndef_message , count);
-       return _convert_error_code(__func__, ret);
-}
+       }
 
-int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message , unsigned char ** rawdata , int *rawdata_size)
-{
-       int ret=0;
-       data_s *rawdata_data = NULL;
+       *atr = NULL;
+       *atr_len = 0;
 
-       if (ndef_message == NULL || rawdata == NULL || rawdata_size == NULL )
-               return _return_invalid_param(__func__);
+       result = net_nfc_client_se_get_atr_sync(
+               (net_nfc_target_handle_h)handle,
+               (data_h *)&response);
 
-       *rawdata = NULL;
-       *rawdata_size = 0;
+       if (result == NET_NFC_OK && response != NULL
+               && response->buffer != NULL && response->length > 0) {
+               *atr = calloc(1, response->length);
+               if (*atr != NULL) {
+                       memcpy(*atr, response->buffer, response->length);
+                       *atr_len = response->length;
+               } else {
+                       result = NET_NFC_ALLOC_FAIL;
+               }
+       }
 
-       ret = net_nfc_create_rawdata_from_ndef_message(ndef_message, (data_h *)&rawdata_data);
-       if (rawdata_data)
-       {
-               *rawdata = calloc(1, rawdata_data->length);
-               memcpy(*rawdata, rawdata_data->buffer, rawdata_data->length);
-               *rawdata_size = rawdata_data->length;
-               net_nfc_free_data((data_h)rawdata_data);
+       if (response != NULL) {
+               net_nfc_free_data((data_h)response);
        }
 
-       return _convert_error_code(__func__, ret);
+       return _convert_error_code(__func__, result);
 }
 
-int nfc_ndef_message_get_rawdata_size(nfc_ndef_message_h ndef_message , int *byte_size)
+int nfc_se_close_secure_element(nfc_se_h handle)
 {
+       net_nfc_error_e result;
 
-       if( ndef_message == NULL || byte_size == NULL)
-               return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_get_ndef_message_byte_length(ndef_message , byte_size);
-       return _convert_error_code(__func__, ret);
+       result = net_nfc_client_se_close_internal_secure_element_sync(
+               (net_nfc_target_handle_h)handle);
+
+       return _convert_error_code(__func__, result);
 }
 
-int nfc_ndef_message_append_record(nfc_ndef_message_h ndef_message , nfc_ndef_record_h record)
+int nfc_manager_set_se_event_cb(nfc_se_event_cb callback, void *user_data)
 {
-
-       if( ndef_message == NULL || record == NULL)
+       if (callback == NULL)
                return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_append_record_to_ndef_message(ndef_message , record );
-       return _convert_error_code(__func__, ret);
-}
 
-int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message , int index, nfc_ndef_record_h record)
-{
+       net_nfc_client_se_set_event_cb(
+               (net_nfc_client_se_event)callback,
+               user_data);
 
-       if( ndef_message == NULL || record == NULL )
-               return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_append_record_by_index(ndef_message , index , record);
-       return _convert_error_code(__func__, ret);
+       return NFC_ERROR_NONE;
 }
 
-int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message , int index)
+void nfc_manager_unset_se_event_cb(void)
 {
+       net_nfc_client_se_unset_event_cb();
 
-       if( ndef_message == NULL )
-               return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_remove_record_by_index(ndef_message , index);
-       return _convert_error_code(__func__, ret);
+       gdbus_nfc_context.on_se_transaction_event_cb = NULL;
+       gdbus_nfc_context.on_se_transaction_event_user_data = NULL;
 }
 
-int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message , int index , nfc_ndef_record_h *record)
+static void _se_transaction_event_cb(data_h aid,
+       data_h param,
+       void *user_data)
 {
-
-       if( ndef_message == NULL || record == NULL)
-               return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_get_record_by_index(ndef_message , index , (ndef_record_h*)record);
-       return _convert_error_code(__func__, ret);
+       if (gdbus_nfc_context.on_se_transaction_event_cb != NULL) {
+               gdbus_nfc_context.on_se_transaction_event_cb(
+                       net_nfc_get_data_buffer(aid),
+                       net_nfc_get_data_length(aid),
+                       net_nfc_get_data_buffer(param),
+                       net_nfc_get_data_length(param),
+                       gdbus_nfc_context.on_se_transaction_event_user_data);
+       }
 }
 
-int nfc_tag_get_type( nfc_tag_h tag , nfc_tag_type_e *type)
+int nfc_manager_set_se_transaction_event_cb(
+       nfc_se_transaction_event_cb callback,
+       void *user_data)
 {
-
-       if( tag == NULL || type == NULL)
+       if (callback == NULL)
                return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_get_tag_type( tag, (net_nfc_target_type_e*) type);
-       return _convert_error_code(__func__, ret);
-}
 
-int nfc_tag_is_support_ndef(nfc_tag_h tag, bool * is_support)
-{
+       gdbus_nfc_context.on_se_transaction_event_cb = callback;
+       gdbus_nfc_context.on_se_transaction_event_user_data = user_data;
 
-       if( tag == NULL || is_support== NULL)
-               return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_get_tag_ndef_support(tag , is_support);
-       return _convert_error_code(__func__, ret);
+       net_nfc_client_se_set_transaction_event_cb(_se_transaction_event_cb,
+               NULL);
+
+       return NFC_ERROR_NONE;
 }
 
-int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag , unsigned int * max_size)
+void nfc_manager_unset_se_transaction_event_cb(void)
 {
-
-       if( tag == NULL || max_size == NULL)
-               return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_get_tag_max_data_size(tag , max_size);
-       return _convert_error_code(__func__, ret);
+       net_nfc_client_se_unset_transaction_event_cb();
 }
 
-int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int * actual_data_size)
+/************************************Raw Data- Transceive*********************/
+
+static void _net_nfc_manager_tag_transceive_data(net_nfc_error_e result,
+       data_h arg_data,
+       void *user_data)
 {
+       nfc_tag_transceive_completed_cb callback;
+       void *user_param;
 
-       if( tag == NULL || actual_data_size == NULL)
-               return _return_invalid_param(__func__);
-       int ret=0;
-       ret = net_nfc_get_tag_actual_data_size(tag , actual_data_size);
-       return _convert_error_code(__func__, ret);
-}
+       if (user_data == NULL) {
+               return;
+       }
 
-int nfc_tag_foreach_information(nfc_tag_h tag , nfc_tag_information_cb callback , void * user_data )
-{
-       int i;
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
 
-       net_nfc_tag_info_s *taglist = g_nfc_context.current_tag->tag_info_list;
+       if (callback != NULL) {
+               unsigned char *buffer = NULL;
+               int buffer_size = 0;
 
-       if( tag == NULL || callback == NULL )
-               return _return_invalid_param(__func__);
+               if (result == NET_NFC_OK && arg_data != NULL) {
+                       data_s *data = (data_s *)arg_data;
 
-       for(i=0; i<g_nfc_context.current_tag->number_of_keys; i++){
-               bool cont;
-               cont = callback(taglist[i].key, net_nfc_get_data_buffer(taglist[i].value), net_nfc_get_data_length(taglist[i].value), user_data);
-               if( !cont )
-                       break;
+                       buffer = data->buffer;
+                       buffer_size = data->length;
+               }
+
+               callback(_convert_error_code(__func__, result),
+                       buffer,
+                       buffer_size,
+                       user_param);
        }
 
-       return 0;
+       g_variant_unref((GVariant *)user_data);
 }
 
-int nfc_tag_transceive( nfc_tag_h tag, unsigned char * buffer, int buffer_size,  nfc_tag_transceive_completed_cb callback , void * user_data )
+int nfc_tag_transceive(nfc_tag_h tag,
+       unsigned char *buffer,
+       int buffer_size,
+       nfc_tag_transceive_completed_cb callback,
+       void *user_data)
 {
+       int ret;
+       data_s rawdata = { buffer, buffer_size };
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       GVariant *parameter;
 
-       if( tag == NULL )
+       if (tag == NULL || buffer == NULL || buffer_size <= 0)
                return _return_invalid_param(__func__);
 
-       if(!nfc_manager_is_activated())
+       if (!nfc_manager_is_activated())
        {
                return NFC_ERROR_NOT_ACTIVATED;
        }
 
-       if(_check_app_permission() == false)
+       if (_check_app_permission() == false)
        {
                LOGE("permission check fail");
+
                return NFC_ERROR_SECURITY_RESTRICTED;
        }
 
-       int ret=0;
-       data_s rawdata = { buffer, buffer_size };
-       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
-
-
-       _async_callback_data * trans_data = NULL;
-       if( callback != NULL ){
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
-               trans_data->callback_type = _NFC_CALLBACK_TYPE_DATA;
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_transceive_data(
+                       (net_nfc_target_handle_h)tag_info->handle,
+                       (data_h)&rawdata,
+                       _net_nfc_manager_tag_transceive_data,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
        }
-       ret = net_nfc_transceive((net_nfc_target_handle_h)tag_info->handle , (data_h) &rawdata, trans_data );
-
 
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_tag_read_ndef( nfc_tag_h tag, nfc_tag_read_completed_cb callback , void * user_data)
+/*********************************Mifare*********************************/
+/* FIXME */
+static void _net_nfc_manager_mifare_authenticate_with_keyA(
+       net_nfc_error_e result,
+       void *user_data)
 {
+       nfc_mifare_authenticate_with_keyA_completed_cb callback;
+       void *user_param;
 
-       if( tag == NULL )
-               return _return_invalid_param(__func__);
-
-       if(!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
+       if (user_data == NULL) {
+               return;
        }
 
-       int ret=0;
-       _async_callback_data * trans_data = NULL;
-       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
-
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
 
-       if( callback != NULL ){
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result), user_param);
        }
-       ret = net_nfc_read_tag((net_nfc_target_handle_h)tag_info->handle , trans_data );
-       return _convert_error_code(__func__, ret);
+
+       g_variant_unref((GVariant *)user_data);
 }
 
-int nfc_tag_write_ndef(nfc_tag_h tag, nfc_ndef_message_h msg , nfc_tag_write_completed_cb callback ,  void *user_data)
+int nfc_mifare_authenticate_with_keyA(nfc_tag_h tag,
+       int sector_index,
+       unsigned char *auth_key,
+       nfc_mifare_authenticate_with_keyA_completed_cb callback,
+       void *user_data)
 {
+       int ret;
+       data_s auth_key_data = { auth_key, 6 };
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       GVariant *parameter;
 
-       if( tag == NULL )
+       if (tag == NULL || auth_key == NULL)
                return _return_invalid_param(__func__);
 
-       if(!nfc_manager_is_activated())
+       if (!nfc_manager_is_activated())
        {
                return NFC_ERROR_NOT_ACTIVATED;
        }
 
-       if(_check_app_permission() == false)
-       {
-               LOGE("permission check fail");
-               return NFC_ERROR_SECURITY_RESTRICTED;
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_mifare_authenticate_with_keyA(
+                       (net_nfc_target_handle_h)tag_info->handle,
+                       sector_index,
+                       (data_h)&auth_key_data,
+                       _net_nfc_manager_mifare_authenticate_with_keyA,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
        }
 
-       int ret=0;
-       _async_callback_data * trans_data = NULL;
-       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+       return _convert_error_code(__func__, ret);
+}
 
-       if (tag_info->ndefCardState == NET_NFC_NDEF_CARD_READ_ONLY )
-       {
-               return NFC_ERROR_READ_ONLY_NDEF;
+static void _net_nfc_manager_mifare_authenticate_with_keyB(
+       net_nfc_error_e result,
+       void *user_data)
+{
+       nfc_mifare_authenticate_with_keyB_completed_cb callback;
+       void *user_param;
 
+       if (user_data == NULL) {
+               return;
        }
 
-        int byte_size = 0;
-       nfc_ndef_message_get_rawdata_size(msg , &byte_size);
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
 
-       if(tag_info->maxDataSize < byte_size)
-       {
-               return NFC_ERROR_NO_SPACE_ON_NDEF;
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result), user_param);
        }
 
-
-
-       if( callback != NULL ){
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
-       }
-       ret = net_nfc_write_ndef( (net_nfc_target_handle_h)tag_info->handle , msg , trans_data );
-       return _convert_error_code(__func__, ret);
+       g_variant_unref((GVariant *)user_data);
 }
 
-int nfc_tag_format_ndef(nfc_tag_h tag , unsigned char * key, int key_size , nfc_tag_format_completed_cb callback, void * user_data )
+int nfc_mifare_authenticate_with_keyB(nfc_tag_h tag,
+       int sector_index,
+       unsigned char *auth_key,
+       nfc_mifare_authenticate_with_keyB_completed_cb callback,
+       void *user_data)
 {
+       int ret;
+       data_s auth_key_data = { auth_key, 6 };
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       GVariant *parameter;
 
-       if( tag == NULL )
+       if (tag == NULL || auth_key == NULL)
                return _return_invalid_param(__func__);
 
-       if(!nfc_manager_is_activated())
+       if (!nfc_manager_is_activated())
        {
                return NFC_ERROR_NOT_ACTIVATED;
        }
 
-       if(_check_app_permission() == false)
-       {
-               LOGE("permission check fail");
-               return NFC_ERROR_SECURITY_RESTRICTED;
-       }
-
-       data_s key_data = { key, key_size };
-       int ret=0;
-       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
-
-       _async_callback_data * trans_data = NULL;
-       if( callback != NULL ){
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_mifare_authenticate_with_keyB(
+                       (net_nfc_target_handle_h)tag_info->handle,
+                       sector_index,
+                       (data_h)&auth_key_data,
+                       _net_nfc_manager_mifare_authenticate_with_keyB,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
        }
 
-       ret = net_nfc_format_ndef( (net_nfc_target_handle_h)tag_info->handle, (data_h)&key_data, trans_data );
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_mifare_authenticate_with_keyA(nfc_tag_h tag,  int sector_index, unsigned char * auth_key, nfc_mifare_authenticate_with_keyA_completed_cb callback, void *user_data)
+/* FIXME */
+static void _net_nfc_manager_mifare_read_block(net_nfc_error_e result,
+       data_h data,
+       void *user_data)
 {
+       nfc_mifare_read_block_completed_cb callback;
+       void *user_param;
 
-       if( tag == NULL )
-               return _return_invalid_param(__func__);
-
-       if(!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
+       if (user_data == NULL) {
+               return;
        }
 
-       data_s auth_key_data = { auth_key , 6};
-       int ret = 0;
-       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               uint8_t *buffer = NULL;
+               int length = 0;
+
+               if (result == NET_NFC_OK && data != NULL) {
+                       data_s *temp = (data_s *)data;
+
+                       buffer = temp->buffer;
+                       length = temp->length;
+               }
 
-       _async_callback_data * trans_data = NULL;
-       if( callback != NULL ){
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
-               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+               callback(_convert_error_code(__func__, result),
+                       buffer,
+                       length,
+                       user_param);
        }
 
-       ret = net_nfc_mifare_authenticate_with_keyA( (net_nfc_target_handle_h)tag_info->handle, sector_index, (data_h)&auth_key_data, trans_data);
-       return _convert_error_code(__func__, ret);
+       g_variant_unref((GVariant *)user_data);
 }
 
-int nfc_mifare_authenticate_with_keyB(nfc_tag_h tag,  int sector_index, unsigned char * auth_key, nfc_mifare_authenticate_with_keyB_completed_cb callback, void *user_data)
+int nfc_mifare_read_block(nfc_tag_h tag,
+       int block_index,
+       nfc_mifare_read_block_completed_cb callback,
+       void *user_data)
 {
+       int ret;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       GVariant *parameter;
 
-       if( tag == NULL )
+       if (tag == NULL)
                return _return_invalid_param(__func__);
 
-       if(!nfc_manager_is_activated())
+       if (!nfc_manager_is_activated())
        {
                return NFC_ERROR_NOT_ACTIVATED;
        }
 
-       data_s auth_key_data = { auth_key , 6};
-       int ret = 0;
-       _async_callback_data * trans_data = NULL;
-       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
-
-       if( callback != NULL ){
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
-               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_mifare_read(
+                       (net_nfc_target_handle_h)tag_info->handle,
+                       block_index,
+                       _net_nfc_manager_mifare_read_block,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
        }
 
-       ret = net_nfc_mifare_authenticate_with_keyB( (net_nfc_target_handle_h)tag_info->handle, sector_index, (data_h)&auth_key_data, trans_data);
        return _convert_error_code(__func__, ret);
 }
-
-int nfc_mifare_read_block(nfc_tag_h tag, int block_index, nfc_mifare_read_block_completed_cb callback, void *user_data)
+#if 0
+/* FIXME : ... */
+static void _mifare_read_page(net_nfc_error_e result,
+       data_h data,
+       void *user_data)
 {
+       nfc_mifare_read_page_completed_cb callback;
+       void *user_param;
 
-       if( tag == NULL )
-               return _return_invalid_param(__func__);
-
-       if(!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
+       if (user_data == NULL) {
+               return;
        }
 
-       int ret = 0;
-       _async_callback_data * trans_data = NULL;
-       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
 
-       if( callback != NULL ){
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
-               trans_data->callback_type = _NFC_CALLBACK_TYPE_DATA;
-       }
+       if (callback != NULL) {
+               uint8_t *buffer = NULL;
+               int length = 0;
 
-       ret = net_nfc_mifare_read( (net_nfc_target_handle_h)tag_info->handle, block_index, trans_data);
-       return _convert_error_code(__func__, ret);
-}
+               if (result == NET_NFC_OK && data != NULL) {
+                       data_s *temp = (data_s *)data;
 
-int nfc_mifare_read_page(nfc_tag_h tag, int page_index, nfc_mifare_read_block_completed_cb callback, void *user_data)
-{
-       if(!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
+                       buffer = temp->buffer;
+                       length = temp->length;
+               }
+
+               callback(_convert_error_code(__func__, result),
+                       buffer,
+                       length,
+                       user_param);
        }
 
-       return nfc_mifare_read_block(tag, page_index, callback, user_data);
+       g_variant_unref((GVariant *)user_data);
 }
-
-int nfc_mifare_write_block (nfc_tag_h tag, int block_index, unsigned char* buffer, int buffer_size, nfc_mifare_write_block_completed_cb callback, void* user_data)
+#endif
+int nfc_mifare_read_page(nfc_tag_h tag,
+       int page_index,
+       nfc_mifare_read_page_completed_cb callback,
+       void *user_data)
 {
+       int ret;
+       GVariant *parameter;
 
-       if( tag == NULL )
-               return _return_invalid_param(__func__);
-
-       if(!nfc_manager_is_activated())
+       if (!nfc_manager_is_activated())
        {
                return NFC_ERROR_NOT_ACTIVATED;
        }
 
-       int ret = 0;
-       data_s block_data = { buffer , buffer_size};
-       _async_callback_data * trans_data = NULL;
-       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
-
-       if( callback != NULL ){
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
-               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               /* FIXME : not implemented */
+//             ret = net_nfc_client_mifare_read_block(tag,
+//                     page_index,
+//                     _mifare_read_page,
+//                     parameter);
+//             if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+//             }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
        }
 
-       ret = net_nfc_mifare_write_block( (net_nfc_target_handle_h)tag_info->handle, block_index, (data_h)&block_data, trans_data);
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_mifare_write_page(nfc_tag_h tag, int page_index, unsigned char* buffer, int buffer_size, nfc_mifare_write_block_completed_cb callback, void* user_data)
+static void _net_nfc_manager_mifare_write_block(net_nfc_error_e result,
+       void *user_data)
 {
+       nfc_mifare_write_block_completed_cb callback;
+       void *user_param;
 
-       if( tag == NULL )
-               return _return_invalid_param(__func__);
-
-       if(!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
+       if (user_data == NULL) {
+               return;
        }
 
-       int ret = 0;
-       data_s block_data = { buffer , buffer_size};
-       _async_callback_data * trans_data = NULL;
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
 
-       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
-
-
-       if( callback != NULL ){
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
-               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result), user_param);
        }
 
-       ret = net_nfc_mifare_write_page( (net_nfc_target_handle_h)tag_info->handle, page_index, (data_h)&block_data, trans_data);
-       return _convert_error_code(__func__, ret);
+       g_variant_unref((GVariant *)user_data);
 }
 
-int nfc_mifare_increment(nfc_tag_h tag, int block_index, int value, nfc_mifare_increment_completed_cb callback, void *user_data)
+int nfc_mifare_write_block(nfc_tag_h tag,
+       int block_index,
+       unsigned char *buffer,
+       int buffer_size,
+       nfc_mifare_write_block_completed_cb callback,
+       void *user_data)
 {
+       int ret;
+       data_s block_data = { buffer, buffer_size };
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       GVariant *parameter;
 
-       if( tag == NULL )
+       if (tag == NULL || buffer == NULL || buffer_size <= 0)
                return _return_invalid_param(__func__);
 
-       if(!nfc_manager_is_activated())
+       if (!nfc_manager_is_activated())
        {
                return NFC_ERROR_NOT_ACTIVATED;
        }
 
-       int ret = 0;
-       _async_callback_data * trans_data = NULL;
-       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
-
-       if( callback != NULL ){
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
-               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_mifare_write_block(
+                       (net_nfc_target_handle_h)tag_info->handle,
+                       block_index,
+                       (data_h)&block_data,
+                       _net_nfc_manager_mifare_write_block,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
        }
 
-       ret = net_nfc_mifare_increment( (net_nfc_target_handle_h)tag_info->handle, block_index,value, trans_data);
        return _convert_error_code(__func__, ret);
-
 }
 
-int nfc_mifare_decrement(nfc_tag_h tag, int block_index, int value, nfc_mifare_decrement_completed_cb callback, void *user_data)
+static void _mifare_write_page(net_nfc_error_e result,
+       void *user_data)
 {
+       nfc_mifare_write_page_completed_cb callback;
+       void *user_param;
 
-       if( tag == NULL )
-               return _return_invalid_param(__func__);
-
-       if(!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
+       if (user_data == NULL) {
+               return;
        }
 
-       int ret = 0;
-       _async_callback_data * trans_data = NULL;
-       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
-
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
 
-       if( callback != NULL ){
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
-               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result), user_param);
        }
 
-       ret = net_nfc_mifare_decrement( (net_nfc_target_handle_h)tag_info->handle, block_index,value, trans_data);
-       return _convert_error_code(__func__, ret);
+       g_variant_unref((GVariant *)user_data);
 }
 
-int nfc_mifare_transfer(nfc_tag_h tag, int block_index, nfc_mifare_transfer_completed_cb callback, void *user_data)
+int nfc_mifare_write_page(nfc_tag_h tag,
+       int page_index,
+       unsigned char *buffer,
+       int buffer_size,
+       nfc_mifare_write_page_completed_cb callback,
+       void *user_data)
 {
+       int ret;
+       data_s block_data = { buffer, buffer_size };
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       GVariant *parameter;
 
-       if( tag == NULL )
+       if (tag == NULL || buffer == NULL || buffer_size <= 0)
                return _return_invalid_param(__func__);
 
-       if(!nfc_manager_is_activated())
+       if (!nfc_manager_is_activated())
        {
                return NFC_ERROR_NOT_ACTIVATED;
        }
 
-       int ret = 0;
-       _async_callback_data * trans_data = NULL;
-       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
-
-
-       if( callback != NULL ){
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
-               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_mifare_write_page(
+                       (net_nfc_target_handle_h)tag_info->handle,
+                       page_index,
+                       (data_h)&block_data,
+                       _mifare_write_page,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
        }
 
-       ret = net_nfc_mifare_transfer( (net_nfc_target_handle_h)tag_info->handle, block_index, trans_data);
        return _convert_error_code(__func__, ret);
 }
 
-int nfc_mifare_restore(nfc_tag_h tag, int block_index, nfc_mifare_restore_completed_cb callback, void *user_data)
+static void _net_nfc_manager_mifare_increment(net_nfc_error_e result,
+       void *user_data)
 {
+       nfc_mifare_increment_completed_cb callback;
+       void *user_param;
 
-       if( tag == NULL )
-               return _return_invalid_param(__func__);
-
-       if(!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
+       if (user_data == NULL) {
+               return;
        }
 
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
 
-       int ret = 0;
-       _async_callback_data * trans_data = NULL;
-       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
-
-       if( callback != NULL ){
-               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
-               if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;
-               memset(trans_data , 0 , sizeof(_async_callback_data));
-               trans_data->callback = callback;
-               trans_data->user_data = user_data;
-               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result), user_param);
        }
 
-       ret = net_nfc_mifare_restore( (net_nfc_target_handle_h)tag_info->handle, block_index, trans_data);
-       return _convert_error_code(__func__, ret);
+       g_variant_unref((GVariant *)user_data);
 }
 
-int nfc_p2p_send(nfc_p2p_target_h target , nfc_ndef_message_h message , nfc_p2p_send_completed_cb callback, void *user_data){
+int nfc_mifare_increment(nfc_tag_h tag,
+       int block_index,
+       int value,
+       nfc_mifare_increment_completed_cb callback,
+       void *user_data)
+{
        int ret;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       GVariant *parameter;
 
-       if( target == NULL || message == NULL  )
+       if (tag == NULL )
                return _return_invalid_param(__func__);
 
-       if(!nfc_manager_is_activated())
+       if (!nfc_manager_is_activated())
        {
                return NFC_ERROR_NOT_ACTIVATED;
        }
 
-       if(_check_app_permission() == false)
-       {
-               LOGE("permission check fail");
-               return NFC_ERROR_SECURITY_RESTRICTED;
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_mifare_increment(
+                       (net_nfc_target_handle_h)tag_info->handle,
+                       block_index,
+                       value,
+                       _net_nfc_manager_mifare_increment,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
        }
 
-       net_nfc_exchanger_data_h data_handle;
-       data_h rawdata;
-       net_nfc_create_rawdata_from_ndef_message(message, &rawdata);
-       ret = net_nfc_create_exchanger_data(&data_handle,  rawdata);
-       net_nfc_free_data(rawdata);
-
-
-       if( ret != 0)
-               return _convert_error_code(__func__, ret);
+       return _convert_error_code(__func__, ret);
+}
 
-       ret = net_nfc_send_exchanger_data(data_handle ,(net_nfc_target_handle_h)target, NULL);
+static void _net_nfc_manager_mifare_decrement(net_nfc_error_e result,
+       void *user_data)
+{
+       nfc_mifare_decrement_completed_cb callback;
+       void *user_param;
 
-       if( ret != 0 ){
-               net_nfc_free_exchanger_data(data_handle);
-               return _convert_error_code(__func__, ret);
+       if (user_data == NULL) {
+               return;
        }
 
-       g_nfc_context.on_p2p_send_completed_cb = callback;
-       g_nfc_context.on_p2p_send_completed_user_data = user_data;
-
-       ret = net_nfc_free_exchanger_data(data_handle);
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
 
-       if( ret != 0 ){
-               return _convert_error_code(__func__, ret);
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result), user_param);
        }
 
-       return 0;
+       g_variant_unref((GVariant *)user_data);
 }
 
-int nfc_p2p_send_no_permission(nfc_p2p_target_h target , nfc_ndef_message_h message , nfc_p2p_send_completed_cb callback, void *user_data){
+int nfc_mifare_decrement(nfc_tag_h tag,
+       int block_index,
+       int value,
+       nfc_mifare_decrement_completed_cb callback,
+       void *user_data)
+{
        int ret;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       GVariant *parameter;
 
-       if( target == NULL || message == NULL  )
+       if (tag == NULL)
                return _return_invalid_param(__func__);
 
-       if(!nfc_manager_is_activated())
+       if (!nfc_manager_is_activated())
        {
                return NFC_ERROR_NOT_ACTIVATED;
        }
 
-       net_nfc_exchanger_data_h data_handle;
-       data_h rawdata;
-       net_nfc_create_rawdata_from_ndef_message(message, &rawdata);
-       ret = net_nfc_create_exchanger_data(&data_handle,  rawdata);
-       net_nfc_free_data(rawdata);
-
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_mifare_decrement(
+                       (net_nfc_target_handle_h)tag_info->handle,
+                       block_index,
+                       value,
+                       _net_nfc_manager_mifare_decrement,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
+       }
 
-       if( ret != 0)
-               return _convert_error_code(__func__, ret);
+       return _convert_error_code(__func__, ret);
+}
 
-       ret = net_nfc_send_exchanger_data(data_handle ,(net_nfc_target_handle_h)target, NULL);
+static void _net_nfc_manager_mifare_transfer(net_nfc_error_e result,
+       void *user_data)
+{
+       nfc_mifare_transfer_completed_cb callback;
+       void *user_param;
 
-       if( ret != 0 ){
-               net_nfc_free_exchanger_data(data_handle);
-               return _convert_error_code(__func__, ret);
+       if (user_data == NULL) {
+               return;
        }
 
-       g_nfc_context.on_p2p_send_completed_cb = callback;
-       g_nfc_context.on_p2p_send_completed_user_data = user_data;
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
 
-       ret = net_nfc_free_exchanger_data(data_handle);
-
-       if( ret != 0 ){
-               return _convert_error_code(__func__, ret);
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result), user_param);
        }
 
-       return 0;
+       g_variant_unref((GVariant *)user_data);
 }
 
-int nfc_p2p_connection_handover(nfc_p2p_target_h target , nfc_ac_type_e type, nfc_p2p_connection_handover_completed_cb callback, void *user_data){
+int nfc_mifare_transfer(nfc_tag_h tag,
+       int block_index,
+       nfc_mifare_transfer_completed_cb callback,
+       void *user_data)
+{
        int ret;
-       net_nfc_conn_handover_carrier_type_e net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
-       if( target == NULL  )
-               return _return_invalid_param(__func__);
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       GVariant *parameter;
 
-       if( type > NFC_AC_TYPE_UNKNOWN  )
+       if (tag == NULL)
                return _return_invalid_param(__func__);
 
-       if(!nfc_manager_is_activated())
+       if (!nfc_manager_is_activated())
        {
                return NFC_ERROR_NOT_ACTIVATED;
        }
 
-       switch( type ){
-               case NFC_AC_TYPE_BT:
-                       net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_BT;
-                       break;
-               case NFC_AC_TYPE_WIFI:
-                       net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS;
-                       break;
-               case NFC_AC_TYPE_WIFI_DIRECT:
-                       net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_IBSS;
-                       break;
-               case NFC_AC_TYPE_UNKNOWN :
-                       net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
-                       break;
-
-               default:
-                       break;
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_mifare_transfer(
+                       (net_nfc_target_handle_h)tag_info->handle,
+                       block_index,
+                       _net_nfc_manager_mifare_transfer,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
                }
-       ret = net_nfc_exchanger_request_connection_handover((net_nfc_target_handle_h)target, net_ac_type);
-
-       if( ret != 0 ){
-               return _convert_error_code(__func__, ret);
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
        }
 
-       g_nfc_context.on_p2p_connection_handover_completed_cb = callback;
-       g_nfc_context.on_p2p_connection_handover_completed_user_data = user_data;
-
-       return 0;
+       return _convert_error_code(__func__, ret);
 }
 
-bool nfc_p2p_is_supported_ac_type( nfc_ac_type_e carrior){
-
-       if( carrior > NFC_AC_TYPE_UNKNOWN  )
-               return false;
-
+static void _net_nfc_manager_mifare_restore(net_nfc_error_e result,
+       void *user_data)
+{
+       nfc_mifare_restore_completed_cb callback;
+       void *user_param;
 
-       if( carrior == NFC_AC_TYPE_BT){
-               return true;
+       if (user_data == NULL) {
+               return;
        }
-       else{
-               return false;
-       }
-}
-
-int nfc_p2p_set_data_received_cb(nfc_p2p_target_h target, nfc_p2p_data_recived_cb callback, void *user_data){
-       if( target == NULL || callback == NULL )
-               return _return_invalid_param(__func__);
-
-//     if( g_nfc_context.current_target.connection_id != ((net_nfc_target_handle_s*)target)->connection_id )
-       if(g_nfc_context.current_target != target )
-               return _return_invalid_param(__func__);
-
-       g_nfc_context.on_p2p_recv_cb = callback;
-       g_nfc_context.on_p2p_recv_user_data = user_data;
-       return 0;
-}
-
-int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target){
-       if( target == NULL )
-               return _return_invalid_param(__func__);
 
-//     if( g_nfc_context.current_target.connection_id != ((net_nfc_target_handle_s*)target)->connection_id )
-       if(g_nfc_context.current_target != target )
-               return _return_invalid_param(__func__);
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
 
-       g_nfc_context.on_p2p_recv_cb = NULL;
-       g_nfc_context.on_p2p_recv_user_data = NULL;
-       return 0;
-}
+       if (callback != NULL) {
+               callback(_convert_error_code(__func__, result), user_param);
+       }
 
-int nfc_manager_set_p2p_target_discovered_cb( nfc_p2p_target_discovered_cb callback , void *user_data){
-       if( callback == NULL )
-               return _return_invalid_param(__func__);
-       g_nfc_context.on_p2p_discovered_cb = callback;
-       g_nfc_context.on_p2p_discovered_user_data = user_data;
-       return 0;
+       g_variant_unref((GVariant *)user_data);
 }
 
-void nfc_manager_unset_p2p_target_discovered_cb( void ){
-       g_nfc_context.on_p2p_discovered_cb = NULL;
-       g_nfc_context.on_p2p_discovered_user_data = NULL;
-}
+int nfc_mifare_restore(nfc_tag_h tag,
+       int block_index,
+       nfc_mifare_restore_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s *)tag;
+       GVariant *parameter;
 
-int nfc_manager_set_se_event_cb(nfc_se_event_cb callback, void *user_data){
-       if( callback == NULL )
+       if (tag == NULL)
                return _return_invalid_param(__func__);
-       g_nfc_context.on_se_event_cb = callback;
-       g_nfc_context.on_se_event_user_data = user_data;
-       return 0;
-}
 
-void nfc_manager_unset_se_event_cb(void){
-       g_nfc_context.on_se_event_cb = NULL;
-       g_nfc_context.on_se_event_user_data = NULL;
-}
+       if (!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
 
-int nfc_manager_set_se_transaction_event_cb(nfc_se_transaction_event_cb callback, void *user_data){
-       if( callback == NULL )
-               return _return_invalid_param(__func__);
-       g_nfc_context.on_se_transaction_event_cb = callback;
-       g_nfc_context.on_se_transaction_event_user_data = user_data;
-       return 0;
-}
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_mifare_restore(
+                       (net_nfc_target_handle_h)tag_info->handle,
+                       block_index,
+                       _net_nfc_manager_mifare_restore,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
+       }
 
-void nfc_manager_unset_se_transaction_event_cb(void){
-       g_nfc_context.on_se_transaction_event_cb = NULL;
-       g_nfc_context.on_se_transaction_event_user_data = NULL;
+       return _convert_error_code(__func__, ret);
 }
old mode 100755 (executable)
new mode 100644 (file)