upload tizen1.0 source
authorKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 07:58:28 +0000 (16:58 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 07:58:28 +0000 (16:58 +0900)
.gitignore [deleted file]
CMakeLists.txt
capi-network-nfc.pc.in
debian/changelog
debian/control
include/nfc.h
include/nfc_private.h
packaging/capi-network-nfc.spec
src/nfc.c
test/network_nfc_test.c

diff --git a/.gitignore b/.gitignore
deleted file mode 100755 (executable)
index f884ceb..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-CMakeCache.txt
-*/CMakeFiles/*
-*.cmake
-CMakeFiles*
-*.a
-*.so
-Testing
-cmake.depends
-cmake.check_depends
-cmake.check_cache
-core
-core.*
-gmon.out
-install_manifest.txt
-*~
-.kdev_include_paths
-src.kdev4
-.cproject
-.project
-tet_captured
-tet_lock
-*.pc
-*-test
-*-test_*
-*tester.c
-TC/config
index f3a5567..dbdddeb 100755 (executable)
@@ -1,6 +1,6 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 
-SET(Services 
+SET(Services
         "application"
         "base"
         "content"
@@ -24,10 +24,8 @@ SET(service "network")
 SET(submodule "nfc")
 
 # for package file
-SET(dependents "dlog glib-2.0 nfc-common-lib nfc")
-
-# for deb
-SET(deb_dependents "libdlog-0 libnfc-common-lib-0 libnfc-manager-0")
+SET(dependents "dlog glib-2.0 nfc-common-lib nfc capi-base-common")
+SET(pc_dependents "capi-base-common")
 
 SET(fw_name "${project_prefix}-${service}-${submodule}")
 
@@ -79,9 +77,8 @@ INSTALL(
         )
 
 SET(PC_NAME ${fw_name})
-SET(PC_REQUIRED ${dependents})
+SET(PC_REQUIRED ${pc_dependents})
 SET(PC_LDFLAGS -l${fw_name})
-SET(PC_CFLAGS -I\${includedir}/${service})
 
 CONFIGURE_FILE(
     ${fw_name}.pc.in
@@ -96,10 +93,10 @@ IF(UNIX)
 
 ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
 ADD_CUSTOM_COMMAND(
-        DEPENDS clean 
+        DEPENDS clean
         COMMENT "distribution clean"
         COMMAND find
-        ARGS    . 
+        ARGS    .
         -not -name config.cmake -and \(
         -name tester.c -or
         -name Testing -or
index fd41dbb..8792e0a 100755 (executable)
@@ -11,5 +11,5 @@ Description: @PACKAGE_DESCRIPTION@
 Version: @VERSION@
 Requires: @PC_REQUIRED@ 
 Libs: -L${libdir} @PC_LDFLAGS@
-Cflags: -I${includedir} @PC_CFLAGS@
+Cflags: -I${includedir}
 
index 8b77f34..264981a 100755 (executable)
@@ -1,3 +1,43 @@
+capi-network-nfc (0.0.1-12) unstable; urgency=low
+
+  * add NFC tag write exception
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-12
+
+ -- Sechang Sohn <sc.sohn@samsung.com>  Thu, 29 Mar 2012 14:28:33 +0900
+
+capi-network-nfc (0.0.1-11) unstable; urgency=low
+
+  * add SE event API
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-11
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>  Tue, 20 Mar 2012 13:23:01 +0900
+
+capi-network-nfc (0.0.1-10) unstable; urgency=low
+
+  * add NFC API added
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-10
+
+ -- Sechang Sohn <sc.sohn@samsung.com>  Mon, 12 Mar 2012 18:44:59 +0900
+
+capi-network-nfc (0.0.1-9) unstable; urgency=low
+
+  * Type casting bug fix
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-9
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Mon, 12 Mar 2012 15:50:05 +0900
+
+capi-network-nfc (0.0.1-8) unstable; urgency=low
+
+  * add NFC Handover API
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-8
+
+ -- Sechang Sohn <sc.sohn@samsung.com>  Mon, 27 Feb 2012 18:28:58 +0900
+
 capi-network-nfc (0.0.1-7) unstable; urgency=low
 
   * add so version
@@ -8,18 +48,48 @@ capi-network-nfc (0.0.1-7) unstable; urgency=low
 
 capi-network-nfc (0.0.1-6) unstable; urgency=low
 
-  * declare extern variable
+  * add extern
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-6
 
- -- Seungkeun Lee <sngn.lee@samsung.com>  Tue, 07 Feb 2012 13:20:25 +0900
+ -- Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>  Mon, 06 Feb 2012 15:56:17 +0900
 
 capi-network-nfc (0.0.1-5) unstable; urgency=low
 
-  * update version
+  * Update bug fix
+  * Git: 165.213.149.219:29418/slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-5
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>  Wed, 14 Dec 2011 13:43:26 +0900
+
+capi-network-nfc (0.0.1-4) unstable; urgency=low
+
+  * update error none value
+  * Git: slp-source.sec.samsung.net:slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-4
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>  Mon, 05 Dec 2011 11:12:56 +0900
+
+capi-network-nfc (0.0.1-3) unstable; urgency=low
+
+  * Update New NFC API
+  * Git: slp-source.sec.samsung.net:slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-3 
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>  Wed, 30 Nov 2011 17:59:15 +0900
+
+capi-network-nfc (0.0.1-2) unstable; urgency=low
+
+  * Update package dependancy 
+  * Git: slp-source.sec.samsung.net:slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-2
 
- -- Seungkeun Lee <sngn.lee@samsung.com>  Thu, 15 Dec 2011 12:50:23 +0900
+ -- Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>  Mon, 29 Aug 2011 10:38:48 +0900
 
 capi-network-nfc (0.0.1-1) unstable; urgency=low
 
-  * Initial release.
+  * Initial upload
+  * Git: slp-source.sec.samsung.net:slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-1
 
- -- Seungkeun Lee <sngn.lee@samsung.com>  Wed, 07 Dec 2011 12:47:59 +0900
+ -- Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>  Thu, 04 Aug 2011 17:46:48 +0900
index 1f3954a..884fca6 100755 (executable)
@@ -2,17 +2,17 @@
 Source: capi-network-nfc
 Section: libs
 Priority: extra
-Maintainer: Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>
+Maintainer: Sechang Sohn <sc.sohn@samsung.com>, Sungjae Lim <sungjae.lim@samsung.com>, Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>
 Build-Depends: debhelper (>= 5), libnfc-common-lib-dev, libnfc-manager-dev, dlog-dev, capi-base-common-dev, libglib2.0-dev
 
 Package: capi-network-nfc
 Architecture: any
-Depends: ${shilbs:Depends}, ${misc:Depends}, libnfc-common-lib-0, libnfc-manager-0
+Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: A NFC library in Tizen Native API
 
 Package: capi-network-nfc-dev
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-nfc (= ${Source-Version}), dlog-dev, capi-base-common-dev, libnfc-common-lib-dev, libnfc-manager-dev
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-nfc (= ${Source-Version}), capi-base-common-dev
 Description: A NFC library in Tizen Native API (DEV)
 
 Package: capi-network-nfc-dbg
index 82232ec..d546179 100755 (executable)
@@ -11,7 +11,7 @@
 * 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. 
+* limitations under the License.
 */
 
 
@@ -42,11 +42,18 @@ typedef enum {
        NFC_ERROR_OPERATION_FAILED = NFC_ERROR_CLASS | 0x01,    /**< Operation failed*/
        NFC_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,    /**< Invalid parameter */
        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_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_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 NFC */
+       NFC_ERROR_ALREADY_ACTIVATED = NFC_ERROR_CLASS | 0x07, /**< Already activated */
+       NFC_ERROR_ALREADY_DEACTIVATED = NFC_ERROR_CLASS | 0x08, /**< Already deactivated */
+       NFC_ERROR_READ_ONLY_NDEF = NFC_ERROR_CLASS | 0x09, /**< Read only tag */
+       NFC_ERROR_NO_SPACE_ON_NDEF = NFC_ERROR_CLASS | 0x0a /**< No enough space on tag */
 } nfc_error_e;
+
 /**
  * @brief Enumerations for record TNF (Type Name Format)
  * @details It is indicate format of type field
@@ -65,7 +72,7 @@ typedef enum {
 
 /**
  * @brief Enumerations for NFC encode types
- * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE 
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  */
 typedef enum {
        NFC_ENCODE_UTF_8 = 0x00,        /**< UTF-8 */
@@ -101,7 +108,7 @@ typedef enum {
 
 /**
  * @brief Enumerations for NFC Tag filter
- * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE 
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  */
 typedef enum {
        NFC_TAG_FILTER_ALL_DISABLE = 0x0000,    /**< All disable */
@@ -110,7 +117,7 @@ typedef enum {
        NFC_TAG_FILTER_ISO15693_ENABLE = 0x0004,        /**< ISO15693 enable */
        NFC_TAG_FILTER_FELICA_ENABLE = 0x0008,  /**< FELICA enable */
        NFC_TAG_FILTER_JEWEL_ENABLE = 0x0010,   /**< JEWEL enable */
-       NFC_TAG_FILTER_IP_ENABLE = 0x0020,      /**< IP enable */       
+       NFC_TAG_FILTER_IP_ENABLE = 0x0020,      /**< IP enable */
        NFC_TAG_FILTER_ALL_ENABLE= ~0,  /**< All enable */
 } nfc_tag_filter_e;
 
@@ -127,7 +134,7 @@ typedef enum {
 
 /**
  * @brief Enumerations for NFC discovered type
- * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE 
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  */
 typedef enum {
        NFC_DISCOVERED_TYPE_ATTACHED,   /**< Attached, discovered, activated event*/
@@ -136,18 +143,33 @@ typedef enum {
 
 /**
  * @brief Enumerations for NFC Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event
- * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE 
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  */
 typedef enum{
        NFC_SE_EVENT_START_TRANSACTION, /**< This event notifies the terminal host that it shall launch an application associated to an NFC application in a UICC(Universal Integrated Circuit Card) host. */
        NFC_SE_EVENT_END_TRANSACTION,   /**< This event notifies the terminal host that current transaction in process was ended. */
        NFC_SE_EVENT_CONNECTIVITY, /**< It's ready signal to communicate UICC(Universal Integrated Circuit Card) with terminal host. \nUICC(Universal Integrated Circuit Card) create pipe and open the pipe chanel.\nThen it sends the signal to terminal host or host controller. */
        NFC_SE_EVENT_FIELD_ON, /**< When the CLF(Contactless Front-end) detects a RF field, the card RF gate sends the event #NFC_SE_EVENT_FIELD_ON to the card application gate.\nWhen there are multiple open card RF gates the CLF shall send the #NFC_SE_EVENT_FIELD_ON on all open pipes to these gates.Next the CLF starts the initialization and anti-collision process as defined in ISO/IEC 14443-3 [6]*/
-       NFC_SE_EVENT_FIELD_OFF  /**< When the CLF(Contactless Front-end) detects that the RF field is off, the card RF gate shall send #NFC_SE_EVENT_FIELD_OFF to the card application gate.\nWhen there are multiple open card RF gates the CLF shall send the #NFC_SE_EVENT_FIELD_OFF to one gate only.*/
+       NFC_SE_EVENT_FIELD_OFF, /**< When the CLF(Contactless Front-end) detects that the RF field is off, the card RF gate shall send #NFC_SE_EVENT_FIELD_OFF to the card application gate.\nWhen there are multiple open card RF gates the CLF shall send the #NFC_SE_EVENT_FIELD_OFF to one gate only.*/
+       NFC_SE_EVENT_TRANSACTION /**< This event  notifies , external reader trys to access secure element */
 } nfc_se_event_e;
 
 
 /**
+ * @brief Enumerations for NFC AC(Alternative Carrior)
+ * @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_e ;
+
+
+
+
+/**
  * @brief The handle to the NDEF record
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  */
@@ -172,7 +194,6 @@ typedef struct net_nfc_target_info_s *nfc_tag_h;
  */
 typedef void* nfc_p2p_target_h;
 
-
 /**
  * @brief The default factory key.
  * @details The key is 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
@@ -232,15 +253,37 @@ extern const unsigned char NFC_RECORD_HANDOVER_REQUEST_TYPE[2];
  */
 extern const unsigned char NFC_RECORD_HANDOVER_SELECT_TYPE[2];
 
+/**
+ * @brief Called after nfc_manager_set_activation() has completed.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] error The result
+ * @param [in] user_data The user data passed from the callback registration function
+ *
+ * @see nfc_manager_set_activation()
+ */
+typedef void (* nfc_set_activation_completed_cb)(nfc_error_e error, void *user_data);
+
+/**
+ * @brief Called after nfc_manager_initialize() has completed.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] error The result
+ * @param [in] user_data The user data passed from the callback registration function
+ *
+ * @see nfc_manager_initialize()
+ */
+typedef void (* nfc_initialize_completed_cb)(nfc_error_e error, void *user_data);
+
 
 /**
  * @brief Called when an NFC tag appears or disappears
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
- * 
+ *
  * @remarks  The tag handle does not have detail target info when an NFC tag disappeared.\n
  *     So then do not use nfc_tag_get_keys().
- * 
- * @param [in] type The discovered type attached or detached 
+ *
+ * @param [in] type The discovered type attached or detached
  * @param [in] tag The handle to NFC tag
  * @param [in] user_data The user data passed from the callback registration function
  *
@@ -253,7 +296,7 @@ typedef void (* nfc_tag_discovered_cb)(nfc_discovered_type_e type, nfc_tag_h tag
 /**
  * @brief Called when an NDEF Message is discovered
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
- * 
+ *
  * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
  *
  * @param [in] message The handle to NDEF message
@@ -286,11 +329,11 @@ typedef bool (*nfc_tag_information_cb)(const char *key, const unsigned char *val
 
 
 /**
- * @brief Called after nfc_tag_transceive() has completed. 
+ * @brief Called after nfc_tag_transceive() has completed.
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
  *
  * @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  The result data
  * @param [in] buffer_size The size of buffer in bytes
@@ -301,9 +344,9 @@ typedef bool (*nfc_tag_information_cb)(const char *key, const unsigned char *val
 typedef void (* nfc_tag_transceive_completed_cb)(nfc_error_e result, unsigned char *buffer, int buffer_size, void *user_data);
 
 /**
- * @brief Called after the nfc_tag_write_ndef() has completed. 
+ * @brief Called after the nfc_tag_write_ndef() has completed.
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
- * 
+ *
  * @param [in] result The result of function call
  * @param [in] user_data The user data passed from nfc_manager_initialize()
  *
@@ -312,23 +355,23 @@ typedef void (* nfc_tag_transceive_completed_cb)(nfc_error_e result, unsigned ch
 typedef void (* nfc_tag_write_completed_cb)(nfc_error_e result, void *user_data);
 
 /**
- * @brief Called after the nfc_tag_read_ndef() has completed. 
+ * @brief Called after the nfc_tag_read_ndef() has completed.
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
  *
  * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
- * 
+ *
  * @param [in] result The result of function call
  * @param [in] message The NDEF message
- * @param [in] user_data The user data passed from nfc_tag_read_ndef() 
+ * @param [in] user_data The user data passed from nfc_tag_read_ndef()
  *
  * @see nfc_tag_read_ndef()
  */
 typedef void (* nfc_tag_read_completed_cb)(nfc_error_e result, nfc_ndef_message_h message, void *user_data);
 
 /**
- * @brief   Called after the nfc_tag_format_ndef() has completed. 
+ * @brief   Called after the nfc_tag_format_ndef() has completed.
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
- * 
+ *
  * @param [in] result The result of function call
  * @param [in] user_data The user data passed from nfc_tag_format_ndef()
  *
@@ -440,9 +483,9 @@ typedef void (* nfc_mifare_restore_completed_cb)(nfc_error_e result, void *user_
 
 
 /**
- * @brief Called when NFC peer-to-peer target appeared or disappeared 
+ * @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] 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()
  *
@@ -460,10 +503,25 @@ typedef void (*nfc_p2p_target_discovered_cb)(nfc_discovered_type_e type, nfc_p2p
  * @see nfc_manager_set_se_event_cb()
  * @see nfc_manager_unset_se_event_cb()
  */
-
 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
+ * @param [in] param The size of param (0~65535)
+ * @param [in] user_data The user data passed from nfc_manager_set_se_transaction_event_cb()
+ *
+ * @see nfc_manager_set_se_transaction_event_cb()
+ * @see nfc_manager_unset_se_transaction_event_cb()
+ */
+typedef void (*nfc_se_transaction_event_cb)(unsigned char* aid, int aid_size , unsigned char* param, int param_size,  void *user_data);
+
+
 
 /**
  * @brief Called after nfc_p2p_send() has completed.
@@ -487,31 +545,86 @@ typedef void (*nfc_p2p_send_completed_cb)(nfc_error_e result, void *user_data);
  * @param [in] user_data The user data passed from nfc_p2p_set_recv_cb()
  *
  * @see nfc_p2p_set_data_received_cb()
- * @see nfc_p2p_unset_data_received_cb() 
+ * @see nfc_p2p_unset_data_received_cb()
  */
 typedef void (*nfc_p2p_data_recived_cb)(nfc_p2p_target_h target, nfc_ndef_message_h message, void *user_data);
 
 
 /**
- * @brief Initializes NFC Manager.
+ * @brief Called after nfc_p2p_connection_handover() has completed.
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @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.
+ *
+ * @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] 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 Sets NFC Activation
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @remarks This function can executed Regardless of nfc_manager_initialize state.
+ *
+ * @param [in] activation The NFC state for setting
+ * @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_OPERATION_FAILED Operation fail
+ * @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_set_activation_completed_cb()
+ */
+int nfc_manager_set_activation(bool activation, nfc_set_activation_completed_cb callback, void *user_data);
+
+/**
+ * @brief Gets NFC Activation state
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
- * @remarks This function must be called before proceeding any other nfc functions.\n
+ * @remarks This function can executed Regardless of nfc_manager_initialize state.
+ *
+ * @return true on NFC activated,  otherwise false
+ * @see nfc_manager_set_activation()
+ */
+
+bool nfc_manager_is_activated(void);
+
+/**
+ * @brief Initializes NFC Manager.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @remarks This function must be called before proceeding any other nfc functions\n
  *     Internally it makes socket connection to NFC manager.\n
- *     When an application crashes or exits without the deinitialization. NFC manager automatically deinitializes the process itself.\n 
+ *     When an application crashes or exits without the deinitialization. NFC manager automatically deinitializes the process itself.\n
+ *
+ * @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_OPERATION_FAILED Operation fail
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
  * @see nfc_manager_deinitialize()
- */ 
-int nfc_manager_initialize(void);
+ */
+int nfc_manager_initialize(nfc_initialize_completed_cb callback, void *user_data);
 
 
 /**
  * @brief Releases all the resource of the NFC Manager and disconnecst 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
@@ -523,12 +636,12 @@ int nfc_manager_deinitialize(void);
  * @brief Registers a callback function for receiving tag discovered notification.
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
- * @param [in] callback The callback function called when a tag is appeared or disappeared 
+ * @param [in] callback The callback function called when a tag is appeared or disappeared
  * @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_INVALID_PARAMETER        Invalid parameter 
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @see nfc_manager_unset_tag_discovered_cb()
  * @see nfc_tag_discovered_cb()
  */
@@ -537,7 +650,7 @@ int nfc_manager_set_tag_discovered_cb(nfc_tag_discovered_cb callback, void *user
 /**
  * @brief Unregisters the callback function.
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
- * 
+ *
  * @see nfc_manager_set_tag_discovered_cb()
  * @see nfc_tag_discovered_cb()
  */
@@ -552,7 +665,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 
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @see nfc_manager_unset_ndef_discovered_cb()
  * @see nfc_ndef_discovered_cb()
  */
@@ -561,7 +674,7 @@ int nfc_manager_set_ndef_discovered_cb(nfc_ndef_discovered_cb callback, void *us
 /**
  * @brief Unregisters the callback function.
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
- * 
+ *
  * @see nfc_manager_set_ndef_discovered_cb()
  * @see nfc_ndef_discovered_cb()
  */
@@ -576,7 +689,7 @@ void nfc_manager_unset_ndef_discovered_cb(void);
  *
  * @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_PARAMETER        Invalid parameter
  *
  * @see nfc_manager_unset_ndef_discovered_cb()
  * @see nfc_p2p_target_discovered_cb()
@@ -586,7 +699,7 @@ int nfc_manager_set_p2p_target_discovered_cb(nfc_p2p_target_discovered_cb callba
 /**
  * @brief Unregisters the callback function.
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
- * 
+ *
  * @see nfc_manager_set_p2p_target_discovered_cb()
  * @see nfc_p2p_target_discovered_cb()
  */
@@ -602,7 +715,7 @@ void nfc_manager_unset_p2p_target_discovered_cb(void);
  *
  * @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_PARAMETER        Invalid parameter
  *
  * @see nfc_se_event_cb()
  * @see nfc_manager_unset_se_event_cb()
@@ -613,14 +726,39 @@ int nfc_manager_set_se_event_cb(nfc_se_event_cb callback, void *user_data);
 /**
  * @brief Unregisters the callback function.
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
- * 
+ *
  * @see nfc_se_event_cb()
  * @see nfc_manager_set_se_event_cb()
  */
 void nfc_manager_unset_se_event_cb(void);
 
 /**
- * @brief Gets NDEF message cached when the tag is detected.
+ * @brief Registers a callback function for receiving  Secure Element (SIM/UICC(Universal Integrated Circuit Card)) transaction event(#NFC_SE_EVENT_TRANSACTION) data.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] callback The callback function called when occurred SE transaction event.
+ * @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_INVALID_PARAMETER        Invalid parameter
+ *
+ * @see nfc_se_transaction_event_cb()
+ * @see nfc_manager_unset_se_transaction_event_cb()
+ */
+int nfc_manager_set_se_transaction_event_cb(nfc_se_transaction_event_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @see nfc_se_transaction_event_cb()
+ * @see nfc_manager_set_se_transaction_event_cb()
+ */
+void nfc_manager_unset_se_transaction_event_cb(void);
+
+/**
+ * @brief Gets NDEF message cached when the tag is detected or when data received from NFC peer-to-peer target.
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @remarks This function is used to get the ndef message that was read before launched your application.
@@ -628,7 +766,7 @@ void nfc_manager_unset_se_event_cb(void);
  *
  * @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_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE The cached message does not exist
  *
  */
@@ -639,28 +777,83 @@ 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)
- *     or you may choose "NFC_TAG_ALL_ENABLE" enum value to get all result. 
+ *     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.
  *
  * @param [in] filter The filter value with bits operation #nfc_tag_filter_e
- * 
+ *
  * @see nfc_manager_get_tag_filter()
  * @see nfc_tag_discovered_cb()
  */
 void nfc_manager_set_tag_filter(int filter);
 
 /**
- * @brief Gets the current filter status. 
+ * @brief Gets the current filter status.
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @remarks Bit operation OR(|) is used in return data\n
- * The default value is NFC_TAG_FILTER_ALL_ENABLE 
+ * 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);
 
+/**
+ * @brief Gets current connected tag.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [out] tag The connected tag
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @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);
+
+/**
+ * @brief Gets current connected p2p target
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [out] target The connected target
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @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);
+
+
+/**
+ * @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.
+ *
+ * @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(bool enable);
+
+/**
+ * @brief Gets the state of the system handler
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @remarks In default, The system handling is enabled.
+ *
+ * @return true on enabled, otherwise false.
+ *
+ * @see nfc_manager_set_system_handler_enable()
+ */
+bool nfc_manager_is_system_handler_enabled(void);
+
 
 /**
  * @brief Creates a record with given parameter value.
@@ -668,7 +861,7 @@ int nfc_manager_get_tag_filter(void);
  *
  * @remarks Every data buffer is deeply copied.\n
  * Every data is a byte array(binary data).
- * 
+ *
  * @param [out] record A handle to record
  * @param [in] tnf The type name format
  * @param [in] type The specified type name
@@ -760,7 +953,7 @@ int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char *uri);
  * - TNF : NFC_RECORD_TNF_MIME_MEDIA\n
  * - type : mime type\n
  * - payload : data\n
- * Defined in Record Type Definition Technical Specifications. 
+ * Defined in Record Type Definition Technical Specifications.
  *
  * @param [out] record A handle to record
  * @param [in] mime_type       The mime type [RFC 2046] (ex. text/plain, image/jpeg )\nThis value is stored in type field
@@ -771,7 +964,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()
  * @see nfc_ndef_record_create_uri()
  * @see nfc_ndef_record_create_text()
  * @see nfc_ndef_record_destroy()
@@ -789,9 +982,9 @@ 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()
  * @see nfc_ndef_record_create_text()
- * @see nfc_ndef_record_create_uri() 
+ * @see nfc_ndef_record_create_uri()
  * @see nfc_ndef_record_create_mime()
  */
 int nfc_ndef_record_destroy(nfc_ndef_record_h record);
@@ -910,7 +1103,7 @@ int nfc_ndef_record_get_text(nfc_ndef_record_h record, char **text);
  * @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_RECORD_TYPE Invalid record type 
+ * @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);
@@ -928,7 +1121,7 @@ int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code);
  * @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_RECORD_TYPE Invalid record type 
+ * @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);
@@ -939,7 +1132,7 @@ int nfc_ndef_record_get_encode_type(nfc_ndef_record_h record, nfc_encode_type_e
  *
  * @remarks The function returns newly allocated string, this value must be deallocated by caller.\n
  * This function is valid only for uri type record.
- * The uri type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "U" 
+ * The uri type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "U"
  *
  * @param [in] record  The handle to record
  * @param [out] uri    The uri in record payload ( should be freed by caller )
@@ -947,7 +1140,7 @@ int nfc_ndef_record_get_encode_type(nfc_ndef_record_h record, nfc_encode_type_e
  * @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_RECORD_TYPE Invalid record type 
+ * @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);
@@ -967,7 +1160,7 @@ int nfc_ndef_record_get_uri(nfc_ndef_record_h record, char **uri);
  * @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_RECORD_TYPE Invalid record type 
+ * @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);
@@ -985,14 +1178,14 @@ int nfc_ndef_record_get_mime_type(nfc_ndef_record_h record, char **mime_type);
  * @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);
 
 /**
- * @brief Creates NDEF message handle from raw serial bytes. 
+ * @brief Creates NDEF message handle from raw serial bytes.
  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
- * 
+ *
  * @remarks It consumes the bytes array until get the ME(Message End) flag*. It returns error if the bytes array does not have ME flag.\n
  * *The ME flag is a 1-bit field that when set indicates the end of an NDEF message.
  *
@@ -1016,13 +1209,13 @@ int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h *ndef_message, const
  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
  *
  * @remarks This function will free all these memory including record handles.
- * 
+ *
  * @param [in] ndef_message The handle to NDEF message to destroy
  *
  * @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()
  * @see nfc_ndef_message_create_from_rawdata()
  */
 int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message);
@@ -1030,14 +1223,14 @@ int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message);
 /**
  * @brief Gets the number of record in NDEF message
  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
- * 
+ *
  * @param [in] ndef_message The handle to NDEF message
  * @param [out] count The number of record
  *
  * @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);
 
@@ -1046,7 +1239,7 @@ int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message, int *coun
  * @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.
- * 
+ *
  * @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
@@ -1101,7 +1294,7 @@ int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message, int index, n
 /**
  * @brief Removes the record that indicated by index number and this deleted record will be freed.
  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
- * 
+ *
  * @param [in] ndef_message The handle to NDEF message
  * @param [in] index   The index of record ( starts from 0 )
  *
@@ -1109,7 +1302,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_append_record()
  * @see nfc_ndef_message_insert_record()
  */
 int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message, int index);
@@ -1131,7 +1324,7 @@ int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message, int index);
  */
 int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message, int index, nfc_ndef_record_h *record);
 
-/** 
+/**
  * @brief Gets the type of NFC tag
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
  *
@@ -1148,7 +1341,7 @@ int nfc_tag_get_type(nfc_tag_h tag, nfc_tag_type_e *type);
 /**
  * @brief Checks whether the given NFC tag supports NDEF messages.
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
- * 
+ *
  * @param [in] tag The handle to NFC tag
  * @param [out] is_supported @c true when NFC tag supports NDEF messages, otherwise @c false
  *
@@ -1211,7 +1404,7 @@ 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 knowlege of each tag technology.
 * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
 *
 * @param [in] tag The handle to NFC tag
@@ -1219,7 +1412,7 @@ int nfc_tag_foreach_information(nfc_tag_h tag, nfc_tag_information_cb callback,
 * @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
-* 
+*
 * @return 0 on success, otherwise a negative error value.
 * @retval #NFC_ERROR_NONE Successful
 * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
@@ -1300,7 +1493,7 @@ int nfc_tag_write_ndef(nfc_tag_h tag, nfc_ndef_message_h msg, nfc_tag_write_comp
  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
  * @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
- * 
+ *
  * @post It invokes nfc_tag_format_completed_cb() when it has completed to format the NFC tag.
  *
  * @see nfc_tag_is_support_ndef()
@@ -1446,7 +1639,7 @@ int nfc_mifare_read_page(nfc_tag_h tag, int page_index, nfc_mifare_read_page_com
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  * @brief Writes block (16 byte) of data to the tag at a given block index.
  * @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 read, starting from 0
  * @param [in] buffer 16 bytes of data to write
@@ -1474,7 +1667,7 @@ int nfc_mifare_write_block(nfc_tag_h tag, int block_index, unsigned char *buffer
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  * @brief Writes a page (4 bytes) of data to the tag at a given page index
  * @remarks This function is only available for MIFARE Ultra light
- * 
+ *
  * @param [in] tag The handle to NFC tag
  * @param [in] page_index The index of page to write, starting from 0
  * @param [in] buffer 4 bytes of data to write
@@ -1502,7 +1695,7 @@ int nfc_mifare_write_page(nfc_tag_h tag, int page_index, unsigned char *buffer,
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  * @brief Increases a value block, storing the result in the temporary block on the tag.
  * @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 increase, starting from 0
  * @param [in] value Non-negative to increment by
@@ -1527,7 +1720,7 @@ int nfc_mifare_increment(nfc_tag_h tag, int block_index, int value, nfc_mifare_i
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  * @brief Decreases a value block, storing the result in the temporary block on the tag.
  * @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 decrease, starting from 0
  * @param [in] value non-negative to decrement by
@@ -1551,7 +1744,7 @@ 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.
  * @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
@@ -1573,7 +1766,7 @@ 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.
  * @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
@@ -1602,7 +1795,7 @@ int nfc_mifare_restore(nfc_tag_h tag, int block_index, nfc_mifare_restore_comple
  *
  * @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_PARAMETER        Invalid parameter
  *
  * @see nfc_p2p_unset_data_received_cb()
  * @see nfc_p2p_data_recived_cb()
@@ -1613,12 +1806,12 @@ int nfc_p2p_set_data_received_cb(nfc_p2p_target_h target, nfc_p2p_data_recived_c
 /**
  * @brief Unregisters the callback function.
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
- * 
+ *
  * @param [in] target The handle to peer target
  *
  * @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_PARAMETER        Invalid parameter
  *
  * @see nfc_p2p_set_data_received_cb()
  * @see nfc_p2p_data_recived_cb()
@@ -1629,7 +1822,7 @@ int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target);
 /**
  * @brief Sends data to NFC peer-to-peer target
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
- * 
+ *
  * @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
@@ -1638,7 +1831,7 @@ int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target);
  * @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_OPERATION_FAILED Operation failed
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
  *
@@ -1648,6 +1841,47 @@ int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target);
 int nfc_p2p_send(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
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @param [in] target The handle to NFC device
+ * @param [in] type Prepered Alternative Carrior
+ * @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
+ *
+ * @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
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @param [in] carrior Alternative Carrior whan 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);
+
+
 #ifdef __cplusplus
 }
 #endif
index 5868fff..736f72e 100755 (executable)
@@ -11,7 +11,7 @@
 * 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. 
+* limitations under the License.
 */
 
 #ifndef __NFC_PRIVATE_H__
@@ -24,7 +24,7 @@
 
 typedef enum {
        _NFC_CALLBACK_TYPE_RESULT=0,
-       _NFC_CALLBACK_TYPE_DATA=1,      
+       _NFC_CALLBACK_TYPE_DATA=1,
 } _nfc_callback_type;
 
 
@@ -43,14 +43,20 @@ typedef struct {
 
        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_context_s;
 
 typedef struct {
index 3f66b29..a51be91 100755 (executable)
@@ -1,5 +1,6 @@
+#sbs-git:slp/api/nfc capi-network-nfc 0.0.1 14f15050f8f6ff8217421da04fa5d66e834e2016
 Name:       capi-network-nfc
-Summary:    A NFC library in Tizen Native API
+Summary:    A NFC library in SLP C API
 Version:    0.0.1
 Release:    1
 Group:      TO_BE/FILLED_IN
@@ -18,7 +19,7 @@ Requires(postun): /sbin/ldconfig
 
 
 %package devel
-Summary:  A NFC library in Tizen Native API (Development)
+Summary:  A NFC library in SLP C API (Development)
 Group:    TO_BE/FILLED_IN
 Requires: %{name} = %{version}-%{release}
 
@@ -31,9 +32,8 @@ Requires: %{name} = %{version}-%{release}
 
 
 %build
-FULLVER=%{version}
-MAJORVER=`echo ${FULLVER} | cut -d '.' -f 1`
-cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`  
+cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}  
 
 
 make %{?jobs:-j%jobs}
@@ -48,10 +48,10 @@ rm -rf %{buildroot}
 
 
 %files
-%{_libdir}/libcapi-network-nfc.so*
+%{_libdir}/libcapi-network-nfc.so.0
+%{_libdir}/libcapi-network-nfc.so.0.0.1
 
 %files devel
 %{_includedir}/network/*.h
 %{_libdir}/pkgconfig/*.pc
-
-
+%{_libdir}/libcapi-network-nfc.so
index a095d08..7b1578c 100755 (executable)
--- a/src/nfc.c
+++ b/src/nfc.c
@@ -11,9 +11,9 @@
 * 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. 
+* limitations under the License.
 */
+
 #include <net_nfc.h>
 #include <net_nfc_typedef_private.h>
 #include <dlog.h>
@@ -102,7 +102,7 @@ static int _convert_error_code(const char *func, int native_error_code)
                        error_code = NFC_ERROR_NONE;
                        errorstr  = "ERROR_NONE";
                        break;
-                       
+
                case NET_NFC_ALLOC_FAIL:
                        error_code = NFC_ERROR_OUT_OF_MEMORY;
                        errorstr  = "OUT_OF_MEMORY";
@@ -120,22 +120,22 @@ static int _convert_error_code(const char *func, int native_error_code)
                case NET_NFC_TAG_WRITE_FAILED:
                case NET_NFC_OPERATION_FAIL:
                case NET_NFC_SECURITY_FAIL:
-               case NET_NFC_NO_NDEF_SUPPORT:                   
+               case NET_NFC_NO_NDEF_SUPPORT:
                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:
                case NET_NFC_NULL_PARAMETER:
                case NET_NFC_NOT_ALLOWED_OPERATION:
-               case NET_NFC_LLCP_INVALID_SOCKET:       
-               case NET_NFC_NO_DATA_FOUND:                     
+               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;
@@ -143,11 +143,11 @@ static int _convert_error_code(const char *func, int native_error_code)
                        break;
 
                case NET_NFC_ALREADY_INITIALIZED:
-               case NET_NFC_ALREADY_REGISTERED:                        
+               case NET_NFC_ALREADY_REGISTERED:
                        error_code = NFC_ERROR_NONE;
                        errorstr  = "ERROR_NONE";
                        break;
-                       
+
                case NET_NFC_RF_TIMEOUT:
                        error_code = NFC_ERROR_TIMED_OUT;
                        errorstr  = "TIMED_OUT";
@@ -156,27 +156,27 @@ static int _convert_error_code(const char *func, int native_error_code)
                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:
-               case NET_NFC_NO_NDEF_MESSAGE:                   
+               case NET_NFC_NO_NDEF_MESSAGE:
                        error_code = NFC_ERROR_INVALID_NDEF_MESSAGE;
                        errorstr  = "INVALID_NDEF_MESSAGE";
                        break;
                case NET_NFC_BUSY :
                        error_code = NFC_ERROR_DEVICE_BUSY;
                        errorstr  = "DEVICE_BUSY";
-                       break;                  
+                       break;
                default :
                        error_code = NFC_ERROR_OPERATION_FAILED;
                        errorstr  = "OPERATION_FAILED";
        }
 
        LOGE( "[%s] %s(0x%08x)",func, errorstr, error_code);
-       
+
        return error_code;
-       
+
 }
 
 _nfc_context_s g_nfc_context;
-
+static nfc_set_activation_completed_cb g_nfc_set_activation_completed_cb = NULL;
 
 
 void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, void* data, void* user_param, void * trans_data)
@@ -190,20 +190,20 @@ void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, vo
                {
                        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;                                    
+                                       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); 
+                                       }
+                                       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); 
+                                       void (* result_type_callback)(int result , void * user_data);
                                        result_type_callback = user_cb->callback;
                                        result_type_callback(capi_result, user_cb->user_data);
                                }
@@ -229,31 +229,32 @@ void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, vo
                                free(user_cb);
                        }
                        break;
-               }       
+               }
                case NET_NFC_MESSAGE_TAG_DISCOVERED:
                {
                        int i;
                        net_nfc_target_info_s *target_info = (net_nfc_target_info_s*)data;
-                       
+
                        memset(&g_nfc_context.current_tag , 0 , sizeof( g_nfc_context.current_tag ));
                        g_nfc_context.current_tag = * target_info;
                        net_nfc_tag_info_s *list = g_nfc_context.current_tag.tag_info_list;
                        net_nfc_tag_info_s *newlist ;
                        newlist = (net_nfc_tag_info_s *)calloc(g_nfc_context.current_tag.number_of_keys, sizeof(net_nfc_tag_info_s));
 
+
                        //copy info list
                        for(i = 0; i < g_nfc_context.current_tag.number_of_keys ; i++){
                                if( list[i].key ){
-                                       newlist[i].key = strdup(list[i].key);           
+                                       newlist[i].key = strdup(list[i].key);
                                }
                                if ( list[i].value ){
                                        net_nfc_create_data(&newlist[i].value , ((data_s*)list[i].value)->buffer, ((data_s*)list[i].value)->length);
                                }
                        }
                        g_nfc_context.current_tag.tag_info_list = newlist;
-                       
+
                        if( g_nfc_context.on_tag_discovered_cb ){
-                               
+
                                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 );
                        }
 
@@ -261,7 +262,7 @@ void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, vo
                        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);                         
+                               g_nfc_context.on_ndef_discovered_cb(ndef_message , g_nfc_context.on_ndef_discovered_user_data);
                                net_nfc_free_ndef_message(ndef_message);
                        }
                        break;
@@ -284,7 +285,7 @@ void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, vo
                                int i = 0;
                                for(i=0 ; i < g_nfc_context.current_tag.number_of_keys ; i++)   {
                                        if(list[i].key != NULL)
-                                               free(list[i].key );                                     
+                                               free(list[i].key );
                                        if(list[i].value != NULL)
                                                net_nfc_free_data(list[i].value);
                                }
@@ -292,7 +293,7 @@ void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, vo
                        }
                        if(  g_nfc_context.current_tag.keylist != NULL )
                                free( g_nfc_context.current_tag.keylist);
-                       
+
                        memset(&g_nfc_context.current_tag , 0 , sizeof( g_nfc_context.current_tag ));
                        break;
                }
@@ -307,10 +308,10 @@ void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, vo
                        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:                      
+               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 );
@@ -320,18 +321,20 @@ void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, vo
                        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;
-                       
+
                        break;
                }
                case NET_NFC_MESSAGE_P2P_SEND :
                {
                        if( g_nfc_context.on_p2p_send_completed_cb != NULL ){
-                               
-                               g_nfc_context.on_p2p_send_completed_cb(result , g_nfc_context.on_p2p_send_completed_user_data );
+
+                               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;                           
+                               g_nfc_context.on_p2p_send_completed_user_data = NULL;
+                               cb(result , user_data );
                        }
-                       break;                  
+                       break;
                }
                case NET_NFC_MESSAGE_P2P_RECEIVE :
                {
@@ -341,7 +344,7 @@ void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, vo
                                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);
                        }
-                       
+
                        break;
                }
                case NET_NFC_MESSAGE_FORMAT_NDEF:
@@ -350,11 +353,138 @@ void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, vo
                                _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;
+               }
+
+               case NET_NFC_MESSAGE_CONNECTION_HANDOVER :
+               {
+                       if( g_nfc_context.on_p2p_connection_handover_completed_cb != NULL ){
+
+                               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;
+
+
+                               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);
+                                       }
+                               }
+
+                               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(result , carrior_type, (void *)ac_data, ac_data_size, user_data );
+
+                               net_nfc_exchanger_free_alternative_carrier_data((net_nfc_connection_handover_info_h)data);
+                               free(ac_data);
+                       }
+                       break;
+               }
+
+
+               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( 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( result,trans_data );
+                               }
+                       }
+                       break;
+               }
+
+               case NET_NFC_MESSAGE_GET_CURRENT_TAG_INFO :
+               {
+                       int i;
+                       net_nfc_target_info_s *target_info = (net_nfc_target_info_s*)data;
+
+                       memset(&g_nfc_context.current_tag , 0 , sizeof( g_nfc_context.current_tag ));
+
+                       if(result == NET_NFC_OK)
+                       {
+                               g_nfc_context.current_tag = * target_info;
+                               net_nfc_tag_info_s *list = g_nfc_context.current_tag.tag_info_list;
+                               net_nfc_tag_info_s *newlist ;
+                               newlist = (net_nfc_tag_info_s *)calloc(g_nfc_context.current_tag.number_of_keys, sizeof(net_nfc_tag_info_s));
+
+                               //copy info list
+                               for(i = 0; i < g_nfc_context.current_tag.number_of_keys ; i++){
+                                       if( list[i].key ){
+                                               newlist[i].key = strdup(list[i].key);
+                                       }
+                                       if ( list[i].value ){
+                                               net_nfc_create_data(&newlist[i].value , ((data_s*)list[i].value)->buffer, ((data_s*)list[i].value)->length);
+                                       }
+                               }
+                               g_nfc_context.current_tag.tag_info_list = newlist;
+
+                       }
+
+                       nfc_initialize_completed_cb             cb = g_nfc_context.on_initialize_completed_cb;
+                       g_nfc_context.on_initialize_completed_cb = NULL;
+                       if( cb ){
+                               cb( result, trans_data );
+                       }
                        break;
                }
+
+               case NET_NFC_MESSAGE_GET_CURRENT_TARGET_HANDLE :
+               {
+                       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;
+
+                       if(result == NET_NFC_OK)
+                       {
+                               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( result, trans_data );
+                       }
+
+                       break;
+               }
+
                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 :
@@ -376,46 +506,139 @@ void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, vo
                                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;
                                default:
                                        break;
                        }
 
                        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);
+                               }
+                       }
                }
-               
+
                default :
                        break;
        }
-       
+
+}
+
+static void __nfc_set_activation_completed(net_nfc_error_e error, void *user_data)
+{
+       int capi_result = _convert_error_code("nfc_set_activation_completed", error);
+
+       nfc_set_activation_completed_cb cb = g_nfc_set_activation_completed_cb;
+       g_nfc_set_activation_completed_cb = NULL;
+       if(cb)
+       {
+               cb(capi_result, user_data);
+       }
+       return ;
+
+}
+
+
+int nfc_manager_set_activation(bool activation, nfc_set_activation_completed_cb callback, void *user_data)
+{
+       int ret = 0;
+       int nfc_supported = 0;
+
+       net_nfc_is_supported(&nfc_supported);
+
+       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;
+                       }
+               }
+               else
+               {
+                       g_nfc_set_activation_completed_cb = callback;
+                       ret = net_nfc_set_state(activation, __nfc_set_activation_completed);
+                       if (ret)
+                       {
+                               ret =   NFC_ERROR_OPERATION_FAILED;
+                       }
+                       else
+                       {
+                               ret =   NFC_ERROR_NONE;
+                       }
+               }
+       }
+       return ret;
+
 }
 
-int nfc_manager_initialize (void)
+
+bool nfc_manager_is_activated(void)
+{
+       int activated = 0;
+
+       net_nfc_get_state(&activated);
+
+       if(activated)
+       {
+               return true;
+       }
+       else
+       {
+               return false;
+       }
+
+}
+
+int nfc_manager_initialize (nfc_initialize_completed_cb callback, void *user_data)
 {
        int ret;
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
        ret = net_nfc_initialize();
-       if( ret != NFC_ERROR_NONE )
+       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);
+       net_nfc_state_activate (1);
+       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);
 
-       net_nfc_state_activate (1);     
        return NFC_ERROR_NONE;
 }
 int nfc_manager_deinitialize (void)
 {
        int ret;
        ret = net_nfc_deinitialize();
-       
+
 
        if( ret == 0)
                net_nfc_unset_response_callback();
 
        net_nfc_state_deactivate();
-       
+
        return _convert_error_code(__func__, ret);
 }
 
@@ -425,7 +648,7 @@ int nfc_manager_set_tag_discovered_cb( nfc_tag_discovered_cb callback , void * u
                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;       
+       return 0;
 }
 void nfc_manager_unset_tag_discovered_cb( void )
 {
@@ -439,12 +662,12 @@ int nfc_manager_set_ndef_discovered_cb( nfc_ndef_discovered_cb callback , void *
                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;       
+       return 0;
 }
 
 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;
 }
@@ -452,53 +675,115 @@ void nfc_manager_unset_ndef_discovered_cb( void )
 
 void nfc_manager_set_tag_filter(int filter )
 {
-       
+
        int ret ;
        ret = net_nfc_set_tag_filter(filter);
 }
 
 int nfc_manager_get_tag_filter(void)
 {
-       
+
        return net_nfc_get_tag_filter();
 }
 
+
+int nfc_manager_get_connected_tag(nfc_tag_h * tag)
+{
+       int ret;
+       if( tag == NULL )
+               return _return_invalid_param(__func__);
+
+       if(g_nfc_context.current_tag.handle == NULL)
+       {
+               ret = NFC_ERROR_NO_DEVICE;
+       }
+       else
+       {
+               *tag = (nfc_tag_h)&g_nfc_context.current_tag;
+               ret = NFC_ERROR_NONE;
+       }
+       return ret;
+}
+
+int nfc_manager_get_connected_target(nfc_p2p_target_h *target)
+{
+       int ret;
+       if( target == NULL )
+               return _return_invalid_param(__func__);
+
+       if(g_nfc_context.current_target == NULL)
+       {
+               ret = NFC_ERROR_NO_DEVICE;
+       }
+       else
+       {
+               *target = (nfc_p2p_target_h)g_nfc_context.current_target;
+               ret = NFC_ERROR_NONE;
+       }
+
+       return ret;
+}
+
+
+int nfc_manager_set_system_handler_enable(bool enable)
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = net_nfc_set_launch_popup_state(enable);
+
+       if( ret != NET_NFC_OK )
+               return _convert_error_code(__func__, ret);
+       else
+               return ret;
+
+
+}
+
+bool nfc_manager_is_system_handler_enabled(void)
+{
+       return net_nfc_get_launch_popup_state();
+
+}
+
+
+
+
 int nfc_manager_get_cached_message(nfc_ndef_message_h *ndef_message){
        int ret;
        if( ndef_message == NULL )
                return _return_invalid_param(__func__);
        ret = net_nfc_retrieve_current_ndef_message(ndef_message);
-       return _convert_error_code(__func__, ret);      
+       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)
 {
-       
+
        if(record == NULL  )
                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);
-       
+
        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 )
 {
-       
+
        if(record == NULL ||  text == NULL || lang_code == NULL )
-               return _return_invalid_param(__func__); 
+               return _return_invalid_param(__func__);
        int ret;
        ret = net_nfc_create_text_type_record((ndef_record_h*)record, text, lang_code, encode);
-       return _convert_error_code(__func__, ret);              
+       return _convert_error_code(__func__, ret);
 }
 int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char* uri)
 {
-       
+
        if(record == NULL ||  uri == NULL)
-               return _return_invalid_param(__func__); 
+               return _return_invalid_param(__func__);
        int ret;
        ret = net_nfc_create_uri_type_record((ndef_record_h*)record , uri , NET_NFC_SCHEMA_FULL_URI);
        return _convert_error_code(__func__, ret);
@@ -507,44 +792,44 @@ int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char* uri)
 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)
-               return _return_invalid_param(__func__); 
+               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){
-       
+
        int ret;
        unsigned char *typename;
        int length;
-       
+
        if(record == NULL ||  mime_type == NULL)
-               return _return_invalid_param(__func__); 
-       nfc_record_tnf_e tnf;   
+               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 ){
-               return NFC_ERROR_INVALID_RECORD_TYPE;   
+               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( "[%s] OUT_OF_MEMORY (0x%08x)",__func__ , NFC_ERROR_OUT_OF_MEMORY);
                return NFC_ERROR_OUT_OF_MEMORY;
        }
-               
+
        memset(*mime_type, 0 , length+1);
        memcpy(*mime_type, typename , length );
-       return 0;       
+       return 0;
 }
 
 
 int nfc_ndef_record_destroy(nfc_ndef_record_h record)
 {
-       
+
        if(record == NULL  )
-               return _return_invalid_param(__func__); 
+               return _return_invalid_param(__func__);
        int ret;
        ret = net_nfc_free_record(record);
        return _convert_error_code(__func__, ret);
@@ -552,9 +837,9 @@ int nfc_ndef_record_destroy(nfc_ndef_record_h record)
 
 int nfc_ndef_record_set_id (nfc_ndef_record_h record, unsigned char *id , int id_size)
 {
-       
+
        if(record == NULL ||  id == NULL )
-               return _return_invalid_param(__func__); 
+               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);
@@ -563,9 +848,9 @@ int nfc_ndef_record_set_id (nfc_ndef_record_h record, unsigned char *id , int id
 
 int nfc_ndef_record_get_payload (nfc_ndef_record_h record, unsigned char ** payload, int *size)
 {
-       
+
        if(record == NULL ||  payload == NULL || size == NULL )
-               return _return_invalid_param(__func__); 
+               return _return_invalid_param(__func__);
        int ret ;
        data_s *payload_data;
        ret = net_nfc_get_record_payload(record, (data_h*)&payload_data);
@@ -579,7 +864,7 @@ int nfc_ndef_record_get_payload (nfc_ndef_record_h record, unsigned char ** payl
 
 int nfc_ndef_record_get_type (nfc_ndef_record_h record, unsigned char ** type, int *size)
 {
-       
+
        int ret ;
        data_s *type_data;
        ret = net_nfc_get_record_type(record, (data_h*)&type_data);
@@ -587,15 +872,15 @@ int nfc_ndef_record_get_type (nfc_ndef_record_h record, unsigned char ** type, i
                *type = type_data->buffer;
                *size = type_data->length;
        }
-       return _convert_error_code(__func__, ret);      
+       return _convert_error_code(__func__, ret);
 }
 
 int nfc_ndef_record_get_id (nfc_ndef_record_h record, unsigned char **id , int *size)
 {
-       
+
        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);
@@ -603,14 +888,14 @@ int nfc_ndef_record_get_id (nfc_ndef_record_h record, unsigned char **id , int *
                *id = id_data->buffer;
                *size = id_data->length;
        }
-       return _convert_error_code(__func__, ret);      
+       return _convert_error_code(__func__, ret);
 }
 
 int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e * tnf)
 {
-       
+
        if(record == NULL ||  tnf == NULL )
-               return _return_invalid_param(__func__); 
+               return _return_invalid_param(__func__);
        int ret;
        ret = net_nfc_get_record_tnf(record, (net_nfc_record_tnf_e*)tnf);
        return _convert_error_code(__func__, ret);
@@ -618,9 +903,9 @@ int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e * tnf)
 
 int nfc_ndef_record_get_text(nfc_ndef_record_h record, char** buffer)
 {
-       
+
        if(record == NULL ||  buffer == NULL)
-               return _return_invalid_param(__func__); 
+               return _return_invalid_param(__func__);
        int ret;
        ret = net_nfc_create_text_string_from_text_record(record, buffer);
        return _convert_error_code(__func__, ret);
@@ -628,38 +913,38 @@ int nfc_ndef_record_get_text(nfc_ndef_record_h record, char** buffer)
 
 int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code)
 {
-       
+
        if(record == NULL ||  lang_code == NULL)
-               return _return_invalid_param(__func__); 
+               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);
 }
 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__); 
+               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);      
+//             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)
 {
-       
+
        if(record == NULL ||  uri == NULL  )
-               return _return_invalid_param(__func__); 
+               return _return_invalid_param(__func__);
        int ret=0;
-       ret = net_nfc_create_uri_string_from_uri_record(record, uri);   
+       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)
 {
-       
+
        if( ndef_message == NULL )
                return _return_invalid_param(__func__);
        int ret=0;
@@ -669,9 +954,9 @@ int nfc_ndef_message_create(nfc_ndef_message_h* ndef_message)
 
 int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h* ndef_message, const unsigned char* rawdata, int rawdata_size)
 {
-       
+
        if( ndef_message == NULL || rawdata == NULL)
-               return _return_invalid_param(__func__); 
+               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);
@@ -680,9 +965,9 @@ int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h* ndef_message, const
 
 int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message)
 {
-       
+
        if( ndef_message == NULL )
-               return _return_invalid_param(__func__); 
+               return _return_invalid_param(__func__);
        int ret=0;
        ret = net_nfc_free_ndef_message(ndef_message);
        return _convert_error_code(__func__, ret);
@@ -690,9 +975,9 @@ int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message)
 
 int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message , int *count)
 {
-       
+
        if( ndef_message == NULL || count == NULL)
-               return _return_invalid_param(__func__); 
+               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);
@@ -700,9 +985,9 @@ int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message , int *cou
 
 int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message , unsigned char ** rawdata , int *rawdata_size)
 {
-       
+
        if( ndef_message == NULL || rawdata == NULL || rawdata_size == NULL)
-               return _return_invalid_param(__func__); 
+               return _return_invalid_param(__func__);
        int ret=0;
        data_s *rawdata_data;
        ret = net_nfc_create_rawdata_from_ndef_message(ndef_message , (data_h*)&rawdata_data);
@@ -716,9 +1001,9 @@ int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message , unsigned char
 
 int nfc_ndef_message_get_rawdata_size(nfc_ndef_message_h ndef_message , int *byte_size)
 {
-       
+
        if( ndef_message == NULL || byte_size == NULL)
-               return _return_invalid_param(__func__); 
+               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);
@@ -726,9 +1011,9 @@ int nfc_ndef_message_get_rawdata_size(nfc_ndef_message_h ndef_message , int *byt
 
 int nfc_ndef_message_append_record(nfc_ndef_message_h ndef_message , nfc_ndef_record_h record)
 {
-       
+
        if( ndef_message == NULL || record == NULL)
-               return _return_invalid_param(__func__); 
+               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);
@@ -736,9 +1021,9 @@ int nfc_ndef_message_append_record(nfc_ndef_message_h ndef_message , nfc_ndef_re
 
 int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message , int index, nfc_ndef_record_h record)
 {
-       
+
        if( ndef_message == NULL || record == NULL )
-               return _return_invalid_param(__func__); 
+               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);
@@ -746,9 +1031,9 @@ int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message , int index,
 
 int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message , int index)
 {
-       
+
        if( ndef_message == NULL )
-               return _return_invalid_param(__func__); 
+               return _return_invalid_param(__func__);
        int ret=0;
        ret = net_nfc_remove_record_by_index(ndef_message , index);
        return _convert_error_code(__func__, ret);
@@ -756,9 +1041,9 @@ int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message , int index)
 
 int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message , int index , nfc_ndef_record_h *record)
 {
-       
+
        if( ndef_message == NULL || record == NULL)
-               return _return_invalid_param(__func__); 
+               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);
@@ -766,9 +1051,9 @@ int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message , int index , nf
 
 int nfc_tag_get_type( nfc_tag_h tag , nfc_tag_type_e *type)
 {
-       
+
        if( tag == NULL || type == NULL)
-               return _return_invalid_param(__func__); 
+               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);
@@ -776,9 +1061,9 @@ int nfc_tag_get_type( nfc_tag_h tag , nfc_tag_type_e *type)
 
 int nfc_tag_is_support_ndef(nfc_tag_h tag, bool * is_support)
 {
-       
+
        if( tag == NULL || is_support== NULL)
-               return _return_invalid_param(__func__);         
+               return _return_invalid_param(__func__);
        int ret=0;
        ret = net_nfc_get_tag_ndef_support(tag , is_support);
        return _convert_error_code(__func__, ret);
@@ -786,9 +1071,9 @@ int nfc_tag_is_support_ndef(nfc_tag_h tag, bool * is_support)
 
 int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag , unsigned int * max_size)
 {
-       
+
        if( tag == NULL || max_size == NULL)
-               return _return_invalid_param(__func__);         
+               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);
@@ -796,9 +1081,9 @@ int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag , unsigned int * max_size)
 
 int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int * actual_data_size)
 {
-       
+
        if( tag == NULL || actual_data_size == NULL)
-               return _return_invalid_param(__func__);         
+               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);
@@ -811,8 +1096,8 @@ int nfc_tag_foreach_information(nfc_tag_h tag , nfc_tag_information_cb callback
        int ret ;
 
        if( tag == NULL || callback == NULL )
-               return _return_invalid_param(__func__);         
-       
+               return _return_invalid_param(__func__);
+
        ret = net_nfc_get_tag_info_keys(tag, &keys , &number_of_keys);
        if( ret != 0 )
                return _convert_error_code(__func__, ret);
@@ -830,21 +1115,21 @@ int nfc_tag_foreach_information(nfc_tag_h tag , nfc_tag_information_cb callback
 
        //free(keys);
 
-       return 0;       
-        
+       return 0;
+
 }
 
 
 int nfc_tag_transceive( nfc_tag_h tag, unsigned char * buffer, int buffer_size,  nfc_tag_transceive_completed_cb callback , void * user_data )
 {
-       
+
        if( tag == NULL )
-               return _return_invalid_param(__func__);         
+               return _return_invalid_param(__func__);
        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));
@@ -854,302 +1139,317 @@ int nfc_tag_transceive( nfc_tag_h tag, unsigned char * buffer, int buffer_size,
                trans_data->callback = callback;
                trans_data->user_data = user_data;
                trans_data->callback_type = _NFC_CALLBACK_TYPE_DATA;
-       }               
+       }
        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)
 {
-       
+
        if( tag == NULL )
-               return _return_invalid_param(__func__);                 
+               return _return_invalid_param(__func__);
        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;         
+                       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_read_tag((net_nfc_target_handle_h)tag_info->handle , trans_data );
        return _convert_error_code(__func__, ret);
 }
 int nfc_tag_write_ndef(nfc_tag_h tag, nfc_ndef_message_h msg , nfc_tag_write_completed_cb callback ,  void *user_data)
 {
-       
+
        if( tag == NULL )
-               return _return_invalid_param(__func__);                 
+               return _return_invalid_param(__func__);
        int ret=0;
        _async_callback_data * trans_data = NULL;
        net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
-       
-       
+
+       if (tag_info->ndefCardState == NET_NFC_NDEF_CARD_READ_ONLY )
+       {
+               return NFC_ERROR_READ_ONLY_NDEF;
+
+       }
+
+        int byte_size = 0;
+       nfc_ndef_message_get_rawdata_size(msg , &byte_size);
+
+       if(tag_info->maxDataSize < byte_size)
+       {
+               return NFC_ERROR_NO_SPACE_ON_NDEF;
+       }
+
+
+
        if( callback != NULL ){
                trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
                if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;         
+                       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 );               
+       }
+       ret = net_nfc_write_ndef( (net_nfc_target_handle_h)tag_info->handle , msg , trans_data );
        return _convert_error_code(__func__, ret);
 }
 
 int nfc_tag_format_ndef(nfc_tag_h tag , unsigned char * key, int key_size , nfc_tag_format_completed_cb callback, void * user_data )
 {
-       
+
        if( tag == NULL )
-               return _return_invalid_param(__func__);                 
+               return _return_invalid_param(__func__);
        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;         
+                       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_format_ndef( (net_nfc_target_handle_h)tag_info->handle, (data_h)&key_data, trans_data );  
+
+       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)
 {
-       
+
        if( tag == NULL )
-               return _return_invalid_param(__func__);                 
+               return _return_invalid_param(__func__);
        data_s auth_key_data = { auth_key , 6};
        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;         
+                       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;
        }
-       
+
        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);      
+       return _convert_error_code(__func__, ret);
 }
 
 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)
 {
-       
+
        if( tag == NULL )
-               return _return_invalid_param(__func__);                 
+               return _return_invalid_param(__func__);
        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;         
+                       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;
        }
-       
+
        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);      
+       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( tag == NULL )
-               return _return_invalid_param(__func__);                 
+               return _return_invalid_param(__func__);
        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;         
+                       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;
        }
-       
+
        ret = net_nfc_mifare_read( (net_nfc_target_handle_h)tag_info->handle, block_index, trans_data);
-       return _convert_error_code(__func__, ret);      
+       return _convert_error_code(__func__, ret);
 }
 
 int nfc_mifare_read_page(nfc_tag_h tag, int page_index, nfc_mifare_read_block_completed_cb callback, void *user_data)
 {
-       
-       return nfc_mifare_read_block(tag, page_index, callback, user_data);     
+
+       return nfc_mifare_read_block(tag, page_index, callback, 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)
 {
-       
+
        if( tag == NULL )
-               return _return_invalid_param(__func__);                 
+               return _return_invalid_param(__func__);
        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;         
+                       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;
        }
-       
+
        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);      
+       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)
 {
-       
+
        if( tag == NULL )
-               return _return_invalid_param(__func__);                 
+               return _return_invalid_param(__func__);
        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;         
+                       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;
        }
-       
+
        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);      
+       return _convert_error_code(__func__, ret);
 }
 
 int nfc_mifare_increment(nfc_tag_h tag, int block_index, int value, nfc_mifare_increment_completed_cb callback, void *user_data)
 {
-       
+
        if( tag == NULL )
-               return _return_invalid_param(__func__);                 
+               return _return_invalid_param(__func__);
        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;         
+                       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;
        }
-       
+
        ret = net_nfc_mifare_increment( (net_nfc_target_handle_h)tag_info->handle, block_index,value, trans_data);
-       return _convert_error_code(__func__, ret);      
+       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)
 {
-       
+
        if( tag == NULL )
-               return _return_invalid_param(__func__);                 
+               return _return_invalid_param(__func__);
        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;         
+                       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;
        }
-       
+
        ret = net_nfc_mifare_decrement( (net_nfc_target_handle_h)tag_info->handle, block_index,value, trans_data);
-       return _convert_error_code(__func__, ret);      
+       return _convert_error_code(__func__, ret);
 }
 
 int nfc_mifare_transfer(nfc_tag_h tag, int block_index, nfc_mifare_transfer_completed_cb callback, void *user_data)
 {
-       
+
        if( tag == NULL )
-               return _return_invalid_param(__func__);                 
+               return _return_invalid_param(__func__);
        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;         
+                       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;
        }
-       
+
        ret = net_nfc_mifare_transfer( (net_nfc_target_handle_h)tag_info->handle, block_index, trans_data);
-       return _convert_error_code(__func__, ret);      
+       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)
 {
-       
+
        if( tag == NULL )
-               return _return_invalid_param(__func__);                 
+               return _return_invalid_param(__func__);
        int ret = 0;
        _async_callback_data * trans_data = NULL;
        net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
        if( tag_info == NULL )
                return _return_invalid_param(__func__);
-               
+
        if( callback != NULL ){
                trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
                if(trans_data == NULL )
-                       return NFC_ERROR_OUT_OF_MEMORY;         
+                       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;
        }
-       
+
        ret = net_nfc_mifare_restore( (net_nfc_target_handle_h)tag_info->handle, block_index, trans_data);
-       return _convert_error_code(__func__, ret);              
+       return _convert_error_code(__func__, ret);
 }
 
 
@@ -1166,7 +1466,7 @@ int nfc_p2p_send(nfc_p2p_target_h target , nfc_ndef_message_h message , nfc_p2p_
        ret = net_nfc_create_exchanger_data(&data_handle,  rawdata);
        net_nfc_free_data(rawdata);
 
-       
+
        if( ret != 0)
                return _convert_error_code(__func__, ret);
 
@@ -1179,18 +1479,73 @@ int nfc_p2p_send(nfc_p2p_target_h target , nfc_ndef_message_h message , nfc_p2p_
 
        g_nfc_context.on_p2p_send_completed_cb = callback;
        g_nfc_context.on_p2p_send_completed_user_data = user_data;
-       
+
+       return 0;
+}
+
+
+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;
+       if( target == NULL  )
+               return _return_invalid_param(__func__);
+
+       if( type > NFC_AC_TYPE_UNKNOWN  )
+               return _return_invalid_param(__func__);
+
+       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;
+               }
+       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);
+       }
+
+       g_nfc_context.on_p2p_connection_handover_completed_cb = callback;
+       g_nfc_context.on_p2p_connection_handover_completed_user_data = user_data;
+
        return 0;
 }
 
+
+
+bool nfc_p2p_is_supported_ac_type( nfc_ac_type_e carrior){
+
+       if( carrior > NFC_AC_TYPE_UNKNOWN  )
+               return false;
+
+
+       if( carrior == NFC_AC_TYPE_BT){
+               return true;
+       }
+       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 ) 
+       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;
@@ -1201,12 +1556,12 @@ int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target){
                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 ) 
+       if(g_nfc_context.current_target != target )
                return _return_invalid_param(__func__);
 
        g_nfc_context.on_p2p_recv_cb = NULL;
        g_nfc_context.on_p2p_recv_user_data = NULL;
-       return 0;       
+       return 0;
 }
 
 
@@ -1222,7 +1577,7 @@ int nfc_manager_set_p2p_target_discovered_cb( nfc_p2p_target_discovered_cb callb
 
 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;       
+       g_nfc_context.on_p2p_discovered_user_data = NULL;
 }
 
 
@@ -1237,6 +1592,18 @@ int nfc_manager_set_se_event_cb(nfc_se_event_cb callback, void *user_data){
 
 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;     
+       g_nfc_context.on_se_event_user_data = NULL;
 }
 
+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;
+}
+
+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;
+}
index 2499052..a5fa3e5 100755 (executable)
@@ -11,7 +11,7 @@
 * 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. 
+* limitations under the License.
 */
 
 #include <Elementary.h>
@@ -59,12 +59,12 @@ char *byteToString(unsigned char* buffer, int size){
        static char localbuffer[255];
        memset(localbuffer, 0, 255);
        memcpy(localbuffer, buffer, size);
-       return localbuffer;     
+       return localbuffer;
 }
 
 void print_ndef_message(nfc_ndef_message_h message){
        char *tnf_tbl[] = {
-                       "NFC_RECORD_TNF_EMPTY", 
+                       "NFC_RECORD_TNF_EMPTY",
                        "NFC_RECORD_TNF_WELL_KNOWN",
                        "NFC_RECORD_TNF_MIME_MEDIA",
                        "NFC_RECORD_TNF_URI",
@@ -86,14 +86,14 @@ void print_ndef_message(nfc_ndef_message_h message){
                return;
        }
 
-               
+
        nfc_ndef_record_get_tnf(record, &tnf);
        nfc_ndef_record_get_type(record, &type, &type_size);
        nfc_ndef_record_get_payload(record, &payload, &payload_size);
-       
+
        printf("tnf \t: %s\n", tnf_tbl[tnf]);
        printf("type \t: %s\n", byteToString(type, type_size));
-       printf("payload : %s\n", byteToString(payload, payload_size)    );      
+       printf("payload : %s\n", byteToString(payload, payload_size)    );
 
        if( tnf == NFC_RECORD_TNF_WELL_KNOWN && type[0] == 'U' ){
                char *uri;
@@ -111,14 +111,14 @@ void print_ndef_message(nfc_ndef_message_h message){
                printf("langcode : %s\n", text);
                free(text);
        }
-       
+
 }
 
 
-int ndef_record_create_test(){
+void ndef_record_create_test(nfc_error_e error, void *user_data){
        int ret=0;
        char *tnf_tbl[] = {
-                       "NFC_RECORD_TNF_EMPTY", 
+                       "NFC_RECORD_TNF_EMPTY",
                        "NFC_RECORD_TNF_WELL_KNOWN",
                        "NFC_RECORD_TNF_MIME_MEDIA",
                        "NFC_RECORD_TNF_URI",
@@ -134,29 +134,29 @@ int ndef_record_create_test(){
        int id_size;
        unsigned char *payload;
        int payload_size;
-       
+
        char *strp = NULL;
-       char *strp2 = NULL;     
-       
+       char *strp2 = NULL;
+
 
        printf("---------------------------------------------------\n");
-       printf(" NEF Record Create Test\n");    
-       
+       printf(" NEF Record Create Test\n");
+
        ret = nfc_ndef_record_create(&record1, NFC_RECORD_TNF_WELL_KNOWN, NFC_RECORD_SMART_POSTER_TYPE, sizeof(NFC_RECORD_SMART_POSTER_TYPE), (unsigned char*)"id", strlen("id"), (unsigned char*)"testpayload", strlen("testpayload"));
        print_result("nfc_ndef_record_create" , ret);
-       
+
        nfc_ndef_record_get_tnf(record1, &tnf);
        nfc_ndef_record_get_type(record1, &type, &type_size);
-       nfc_ndef_record_get_id(record1, &id, &id_size); 
+       nfc_ndef_record_get_id(record1, &id, &id_size);
        nfc_ndef_record_get_payload(record1, &payload, &payload_size);
 
        printf("tnf \t: %s\n", tnf_tbl[tnf]);
        printf("type \t: %s\n", byteToString(type, type_size));
        printf("id \t: %s\n" , byteToString(id, id_size) );
-       printf("payload : %s\n", byteToString(payload, payload_size)    );              
-       
+       printf("payload : %s\n", byteToString(payload, payload_size)    );
+
        nfc_ndef_record_destroy(record1);
-       
+
        printf("\n");
 
        strp = NULL;
@@ -171,17 +171,17 @@ int ndef_record_create_test(){
        printf("tnf \t: %s\n", tnf_tbl[tnf]);
        printf("mimetype: %s\n", strp);
        printf("type \t: %s\n", byteToString(type, type_size));
-       printf("payload : %s\n", byteToString(payload, payload_size)    );              
+       printf("payload : %s\n", byteToString(payload, payload_size)    );
 
 
        nfc_ndef_record_destroy(record1);
        free(strp);
-       
-       printf("\n");   
-       
+
+       printf("\n");
+
        ret = nfc_ndef_record_create_text(&record1, "the text record", "us-en", NFC_ENCODE_UTF_8);
        print_result("nfc_ndef_record_create_text" , ret);
-       
+
        nfc_ndef_record_get_tnf(record1, &tnf);
        nfc_ndef_record_get_type(record1, &type, &type_size);
        nfc_ndef_record_get_payload(record1, &payload, &payload_size);
@@ -190,15 +190,15 @@ int ndef_record_create_test(){
 
        printf("tnf \t: %s\n", tnf_tbl[tnf]);
        printf("type \t: %s\n", byteToString(type, type_size));
-       printf("payload : %s\n", byteToString(payload, payload_size)    );              
+       printf("payload : %s\n", byteToString(payload, payload_size)    );
        printf("text \t: %s\n", strp);
        printf("langcode: %s\n", strp2);
        nfc_ndef_record_destroy(record1);
        free(strp);
        free(strp2);
-       
-       printf("\n");   
-       
+
+       printf("\n");
+
        ret = nfc_ndef_record_create_uri(&record1,"http://samsung.com");
        print_result("nfc_ndef_record_create_uri" , ret);
 
@@ -210,15 +210,15 @@ int ndef_record_create_test(){
 
        printf("tnf \t: %s\n", tnf_tbl[tnf]);
        printf("type \t: %s\n", byteToString(type, type_size));
-       printf("payload : %s\n", byteToString(payload, payload_size)    );              
+       printf("payload : %s\n", byteToString(payload, payload_size)    );
        printf("uri \t: %s\n", strp);
 
        nfc_ndef_record_destroy(record1);
        free(strp);
-       
-       printf("\n");   
 
-       
+       printf("\n");
+
+
        ret = nfc_ndef_record_create_uri(&record1,"http://samsung.com");
        print_result("nfc_ndef_record_create_uri" , ret);
 
@@ -231,14 +231,14 @@ int ndef_record_create_test(){
        ret = nfc_ndef_record_get_uri(record1,&strp);
        print_result("nfc_ndef_record_get_uri" , ret);
        free(strp);
-       
+
        nfc_ndef_record_destroy(record1);
 
        printf("---------------------------------------------------\n");
        printf("\n");
        is_terminate = 1;
-       return 0;
-       
+       return ;
+
 }
 
 
@@ -250,30 +250,30 @@ void _ndef_discovered_cb(nfc_ndef_message_h message, void * user_data){
        is_terminate = 1;
 }
 
-void read_ndef_from_tag_using_ndef_discovered(){
+void read_ndef_from_tag_using_ndef_discovered(nfc_error_e error, void *user_data){
        int ret;
-       
+
        success = 0;
        timeout_counter = 30;
-       
+
        ret = nfc_manager_set_ndef_discovered_cb(_ndef_discovered_cb , NULL);
        print_result("nfc_manager_set_ndef_discovered_cb", ret);
        printf("Now, Bring the tag closer.\n");
        ecore_timer_add(1, timeout_handler, NULL);
-       
+
 }
 
 void _write_completed_cb(nfc_error_e result ,  void * user_data){
 
        printf("write completed!result %s\n" , result == 0 ? "Success": "Fail");
-       success  = 1;   
+       success  = 1;
        is_terminate = 1;
 }
 
 
 void _tag_discovered_cb(nfc_discovered_type_e type, nfc_tag_h tag, void * user_data){
        if( type == NFC_DISCOVERED_TYPE_ATTACHED ){
-               
+
                printf("Discovered Tag!\n");
                //write NDEF Message
                nfc_ndef_record_h record;
@@ -284,39 +284,79 @@ void _tag_discovered_cb(nfc_discovered_type_e type, nfc_tag_h tag, void * user_d
                printf("Write request!\n");
                timeout_counter = 30;
                nfc_tag_write_ndef(tag, message , _write_completed_cb , NULL);
-               nfc_ndef_message_destroy(message);              
+               nfc_ndef_message_destroy(message);
        }
 }
 
 
-void write_ndef_to_tag(){
+void write_ndef_to_tag(nfc_error_e error, void *user_data){
+
+       nfc_tag_h  tag;
+       int ret ;
+
+       printf("write_ndef_to_tag\n");
+       ret = nfc_manager_get_connected_tag(&tag);
+       printf("nfc_manager_get_connected_tag ret(0x%08x)  !\n",ret);
+
+
+       if ( ret == NFC_ERROR_NONE)
+       {
+               printf("tag alread attached !\n");
+               //write NDEF Message
+               nfc_ndef_record_h record;
+               nfc_ndef_message_h message;
+               nfc_ndef_record_create_uri(&record, "http://samsung.com");
+               nfc_ndef_message_create(&message);
+               nfc_ndef_message_append_record(message, record);
+               printf("Write request!\n");
+               timeout_counter = 30;
+               nfc_tag_write_ndef(tag, message , _write_completed_cb , NULL);
+               nfc_ndef_message_destroy(message);
+       }
+       else
+       {
+
        int ret;
 
        success = 0;
        timeout_counter = 30;
-       
+
        ret = nfc_manager_set_tag_discovered_cb( _tag_discovered_cb , NULL);
        print_result("nfc_manager_set_tag_discovered_cb", ret);
 
        printf("Now, Bring the tag closer. Will be writen a new NDEF Message\n");
        ecore_timer_add(1, timeout_handler, NULL);
-               
+
+       }
 }
 
 
 void _send_completed_cb(nfc_error_e result , void *user_data){
        printf("send completed!result %s\n" , result == 0 ? "Success": "Fail");
-       success  = 1;   
+       success  = 1;
        is_terminate = 1;
 }
 
 
+
+void _handover_completed_cb(nfc_error_e result, nfc_ac_type_e carrior, void * ac_data, int ac_data_size , void *user_data){
+
+       char * address =(char *) (strdup(ac_data));
+
+       printf("handover completed!result %d AC type is [%d] \n" , result,carrior);
+       printf("address [%s] address size[%d]\n" , address, ac_data_size);
+
+       free(address);
+       success  = 1;
+       is_terminate = 1;
+}
+
 Eina_Bool send_test(void *data){
 
        nfc_p2p_target_h target = (nfc_p2p_target_h)data;
        nfc_ndef_message_h message;
        nfc_ndef_record_h record;
-       
+
        nfc_ndef_record_create_uri(&record, "http://samsung.com");
        nfc_ndef_message_create(&message);
        nfc_ndef_message_append_record(message, record);
@@ -327,29 +367,74 @@ Eina_Bool send_test(void *data){
        return 0;
 }
 
+
+Eina_Bool handover_test(void *data){
+
+       nfc_p2p_target_h target = (nfc_p2p_target_h)data;
+       nfc_ac_type_e type = NFC_AC_TYPE_BT;
+
+       if(nfc_p2p_is_supported_ac_type(type))
+               printf("NFC_AC_TYPE_BT supported\n");
+
+       nfc_p2p_connection_handover(target, type , _handover_completed_cb, NULL);
+
+       return 0;
+}
+
 void _target_discovered_cb(nfc_discovered_type_e type, nfc_p2p_target_h target, void * user_data){
        if( type == NFC_DISCOVERED_TYPE_ATTACHED){
                printf("Discovered new target!\n");
                ecore_idler_add(send_test, target);
-       }       
+       }
 }
 
-void send_ndef_to_peer(){
+void _target_discovered_for_connect_handover_cb(nfc_discovered_type_e type, nfc_p2p_target_h target, void * user_data){
+       if( type == NFC_DISCOVERED_TYPE_ATTACHED){
+               printf("Discovered new target!\n");
+               ecore_idler_add(handover_test, target);
+       }
+}
+
+void send_ndef_to_peer(nfc_error_e error, void *user_data){
+
+       nfc_p2p_target_h target;
+       int ret ;
+
+       printf("send_ndef_to_peer\n");
+
+       ret = nfc_manager_get_connected_target(&target);
+       if ( ret == NFC_ERROR_NONE)
+       {
+               printf("target already attached!\n");
+               ecore_idler_add(send_test, target);
+       }
+       else
+       {
+
        int ret ;
        success = 0;
        timeout_counter =30;
        ret = nfc_manager_set_p2p_target_discovered_cb(_target_discovered_cb , NULL);
        printf("Now, Bring the target closer. Will be sent a new NDEF Message\n");
        ecore_timer_add(1, timeout_handler, NULL);
+       }
 }
 
+void connect_handover_to_peer(nfc_error_e error, void *user_data){
+       int ret ;
+       success = 0;
+       timeout_counter =30;
+       ret = nfc_manager_set_p2p_target_discovered_cb(_target_discovered_for_connect_handover_cb , NULL);
+       printf("Now, Bring the target closer. Will be tried to connect handover\n");
+       ecore_timer_add(1, timeout_handler, NULL);
+}
 
 void _p2p_recv_cb(nfc_p2p_target_h target , nfc_ndef_message_h message, void *user_data){
 
        printf("recevie a new message!\n");
        print_ndef_message(message);
 
-       success  = 1;   
+       success  = 1;
        is_terminate = 1;
 }
 
@@ -366,14 +451,14 @@ void _target_discovered_cb2(nfc_discovered_type_e type, nfc_p2p_target_h target,
 }
 
 
-void recv_ndef_from_peer(){
+void recv_ndef_from_peer(nfc_error_e error, void *user_data){
        int ret ;
        success = 0;
        timeout_counter = 30;
        ret = nfc_manager_set_p2p_target_discovered_cb(_target_discovered_cb2 , NULL);
        printf("Now, Bring the target closer. and send a new NDEF Message to the this target\n");
        ecore_timer_add(1, timeout_handler, NULL);
-       
+
 }
 
 
@@ -388,60 +473,149 @@ Eina_Bool check_terminate(void *data){
 }
 
 
-char *menu = 
+char *menu =
        "------------------\n"
+       " 0. NFC OFF\n"
+       " 1. NFC ON\n"
+       "------------------\n"
+
        " a. ndef record test\n"
        " b. ndef discoverd cb test\n"
        " c. write ndef to tag \n"
        " d. send ndef to peer \n"
        " e. recv ndef from peer\n"
+       " f. connect handover to peer\n"
+       "------------------\n"
+
+       " g. ON nfc_manager_enable_system_handler\n"
+       " h. OFF nfc_manager_enable_system_handler\n"
+
+
        "------------------\n"
        ">";
-       
 
+ void  set_activation_completed_cb(nfc_error_e error, void *user_data)
+{
+       printf("set_activation_completed_cb  ret(%d) \n", error);
+
+}
 
 int main(int argc, char ** argv)
-{      
+{
        elm_init(argc, argv);
        is_terminate = 0;
        char select[255];
        int ret;
-       
-       ret = nfc_manager_initialize();
-       print_result("nfc_manager_initialize", ret);
 
-       
+
        printf( menu );
        gets(select);
 
        switch(select[0]){
+
+               case '0':
+                       ret =  nfc_manager_set_activation(0, set_activation_completed_cb, NULL);
+                       printf("nfc_manager_set_activation set off  ret(0x%08x) \n", ret);
+
+                       if (ret == NFC_ERROR_NOT_SUPPORTED)
+                       {
+                               printf("NFC_ERROR_NOT_SUPPORTED \n");
+                       }
+                       else if (ret == NFC_ERROR_ALREADY_ACTIVATED)
+                       {
+                               printf("NFC_ERROR_ALREADY_ACTIVATED \n");
+
+                       }
+                       else if (ret == NFC_ERROR_ALREADY_DEACTIVATED)
+                       {
+                               printf("NFC_ERROR_ALREADY_DEACTIVATED \n");
+
+                       }
+                       else if (ret == NFC_ERROR_OPERATION_FAILED)
+                       {
+                               printf("NFC_ERROR_OPERATION_FAILED \n");
+
+                       }
+                       elm_shutdown();
+                       return 0;
+
+               case '1':
+                       ret =  nfc_manager_set_activation(1, set_activation_completed_cb, NULL);
+                       printf("nfc_manager_set_activation set off  ret(0x%08x) \n", ret);
+
+                       if (ret == NFC_ERROR_NOT_SUPPORTED)
+                       {
+                               printf("NFC_ERROR_NOT_SUPPORTED \n");
+                       }
+                       else if (ret == NFC_ERROR_ALREADY_ACTIVATED)
+                       {
+                               printf("NFC_ERROR_ALREADY_ACTIVATED \n");
+
+                       }
+                       else if (ret == NFC_ERROR_ALREADY_DEACTIVATED)
+                       {
+                               printf("NFC_ERROR_ALREADY_DEACTIVATED \n");
+
+                       }
+                       else if (ret == NFC_ERROR_OPERATION_FAILED)
+                       {
+                               printf("NFC_ERROR_OPERATION_FAILED \n");
+
+                       }
+                       elm_shutdown();
+                       return 0;
+
                case 'a':
-                       ndef_record_create_test();                      
+                       ret = nfc_manager_initialize(ndef_record_create_test,NULL);
+                       print_result("nfc_manager_initialize", ret);
                        break;
                case 'b':
-                       read_ndef_from_tag_using_ndef_discovered();
-                       break;          
+                       ret = nfc_manager_initialize(read_ndef_from_tag_using_ndef_discovered,NULL);
+                       print_result("nfc_manager_initialize", ret);
+                       break;
                case 'c':
-                       write_ndef_to_tag();
+                       ret = nfc_manager_initialize(write_ndef_to_tag,NULL);
+                       print_result("nfc_manager_initialize", ret);
                        break;
                case 'd':
-                       send_ndef_to_peer();
+                       ret = nfc_manager_initialize(send_ndef_to_peer,NULL);
+                       print_result("nfc_manager_initialize", ret);
                        break;
                case 'e':
-                       recv_ndef_from_peer();
-                       break;                  
+                       ret = nfc_manager_initialize(recv_ndef_from_peer,NULL);
+                       print_result("nfc_manager_initialize", ret);
+                       break;
+               case 'f':
+                       ret = nfc_manager_initialize(connect_handover_to_peer,NULL);
+                       print_result("nfc_manager_initialize", ret);
+                       break;
+
+
+               case 'g':
+                       ret = nfc_manager_set_system_handler_enable(true);
+
+                       printf("nfc_manager_set_system_handler_enable(true) ret [%d] current [%d]\n", ret,nfc_manager_is_system_handler_enabled());
+                       elm_shutdown();
+                       return 0;
+               case 'h':
+                       ret = nfc_manager_set_system_handler_enable(false);
+                       printf("nfc_manager_set_system_handler_enable(false) ret [%d] current [%d]\n", ret,nfc_manager_is_system_handler_enabled());
+                       elm_shutdown();
+                       return 0;
+
+
                default:
                        printf("wrong selection!\n");
                        is_terminate = 1;
        }
 
-       
-               
+
+
        ecore_timer_add(1, check_terminate, NULL);
 
        elm_run();
        elm_shutdown();
-       
+
 
        return 0;
 }