Git init
authorKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:42:49 +0000 (00:42 +0900)
committerKibum Kim <kb0929.kim@samsung.com>
Fri, 6 Jan 2012 15:42:49 +0000 (00:42 +0900)
20 files changed:
.gitignore [new file with mode: 0755]
AUTHORS [new file with mode: 0755]
CMakeLists.txt [new file with mode: 0755]
LICENSE [new file with mode: 0644]
capi-network-nfc.pc.in [new file with mode: 0755]
debian/README [new file with mode: 0755]
debian/capi-network-nfc-dev.install [new file with mode: 0755]
debian/capi-network-nfc-dev.postinst [new file with mode: 0755]
debian/capi-network-nfc.install [new file with mode: 0755]
debian/capi-network-nfc.postinst [new file with mode: 0755]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0755]
debian/control [new file with mode: 0755]
debian/rules [new file with mode: 0755]
include/nfc.h [new file with mode: 0755]
include/nfc_private.h [new file with mode: 0755]
packaging/capi-network-nfc.spec [new file with mode: 0755]
src/nfc.c [new file with mode: 0755]
test/CMakeLists.txt [new file with mode: 0755]
test/network_nfc_test.c [new file with mode: 0755]

diff --git a/.gitignore b/.gitignore
new file mode 100755 (executable)
index 0000000..f884ceb
--- /dev/null
@@ -0,0 +1,26 @@
+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
diff --git a/AUTHORS b/AUTHORS
new file mode 100755 (executable)
index 0000000..a724834
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+Seungkeun Lee <sngn.lee@samsung.com>
+Kangho Hur <kanho.hur@samsung.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..9c2106d
--- /dev/null
@@ -0,0 +1,117 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+SET(Services 
+        "application"
+        "base"
+        "content"
+        "location"
+        "media"
+        "messaging"
+        "network"
+        "social"
+        "telephony"
+        "system"
+   )
+
+
+# project
+SET(project_prefix "capi")
+SET(prefix "/usr")
+SET(version "0.0.1")
+SET(maintainer "Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>")
+SET(description "A NFC library in Tizen Native API")
+SET(service "network")
+SET(submodule "nfc")
+
+# for package file
+SET(dependents "dlog glib-2.0 nfc-common-lib nfc")
+
+# for deb
+SET(deb_dependents "libdlog-0 libnfc-common-lib-0 libnfc-manager-0")
+
+SET(fw_name "${project_prefix}-${service}-${submodule}")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX ${prefix})
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(VERSION ${version})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED ${dependents})
+FOREACH(flag ${${fw_name}_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+    ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DTIZEN_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+aux_source_directory(src SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+INSTALL(TARGETS ${fw_name} DESTINATION lib)
+INSTALL(
+        DIRECTORY ${INC_DIR}/ DESTINATION include/${service}
+        FILES_MATCHING
+        PATTERN "*_private.h" EXCLUDE
+        PATTERN "${INC_DIR}/*.h"
+        )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${dependents})
+SET(PC_LDFLAGS -l${fw_name})
+SET(PC_CFLAGS -I\${includedir}/${service})
+
+CONFIGURE_FILE(
+    ${fw_name}.pc.in
+    ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+    @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION lib/pkgconfig)
+
+#ADD_SUBDIRECTORY(test)
+
+IF(UNIX)
+
+ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
+ADD_CUSTOM_COMMAND(
+        DEPENDS clean 
+        COMMENT "distribution clean"
+        COMMAND find
+        ARGS    . 
+        -not -name config.cmake -and \(
+        -name tester.c -or
+        -name Testing -or
+        -name CMakeFiles -or
+        -name cmake.depends -or
+        -name cmake.check_depends -or
+        -name CMakeCache.txt -or
+        -name cmake.check_cache -or
+        -name *.cmake -or
+        -name Makefile -or
+        -name core -or
+        -name core.* -or
+        -name gmon.out -or
+        -name install_manifest.txt -or
+        -name *.pc -or
+        -name *~ \)
+        | grep -v TC | xargs rm -rf
+        TARGET  distclean
+        VERBATIM
+)
+
+ENDIF(UNIX)
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..bbe9d02
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,206 @@
+Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+\r
+                                 Apache License\r
+                           Version 2.0, January 2004\r
+                        http://www.apache.org/licenses/\r
+\r
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\r
+\r
+   1. Definitions.\r
+\r
+      "License" shall mean the terms and conditions for use, reproduction,\r
+      and distribution as defined by Sections 1 through 9 of this document.\r
+\r
+      "Licensor" shall mean the copyright owner or entity authorized by\r
+      the copyright owner that is granting the License.\r
+\r
+      "Legal Entity" shall mean the union of the acting entity and all\r
+      other entities that control, are controlled by, or are under common\r
+      control with that entity. For the purposes of this definition,\r
+      "control" means (i) the power, direct or indirect, to cause the\r
+      direction or management of such entity, whether by contract or\r
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the\r
+      outstanding shares, or (iii) beneficial ownership of such entity.\r
+\r
+      "You" (or "Your") shall mean an individual or Legal Entity\r
+      exercising permissions granted by this License.\r
+\r
+      "Source" form shall mean the preferred form for making modifications,\r
+      including but not limited to software source code, documentation\r
+      source, and configuration files.\r
+\r
+      "Object" form shall mean any form resulting from mechanical\r
+      transformation or translation of a Source form, including but\r
+      not limited to compiled object code, generated documentation,\r
+      and conversions to other media types.\r
+\r
+      "Work" shall mean the work of authorship, whether in Source or\r
+      Object form, made available under the License, as indicated by a\r
+      copyright notice that is included in or attached to the work\r
+      (an example is provided in the Appendix below).\r
+\r
+      "Derivative Works" shall mean any work, whether in Source or Object\r
+      form, that is based on (or derived from) the Work and for which the\r
+      editorial revisions, annotations, elaborations, or other modifications\r
+      represent, as a whole, an original work of authorship. For the purposes\r
+      of this License, Derivative Works shall not include works that remain\r
+      separable from, or merely link (or bind by name) to the interfaces of,\r
+      the Work and Derivative Works thereof.\r
+\r
+      "Contribution" shall mean any work of authorship, including\r
+      the original version of the Work and any modifications or additions\r
+      to that Work or Derivative Works thereof, that is intentionally\r
+      submitted to Licensor for inclusion in the Work by the copyright owner\r
+      or by an individual or Legal Entity authorized to submit on behalf of\r
+      the copyright owner. For the purposes of this definition, "submitted"\r
+      means any form of electronic, verbal, or written communication sent\r
+      to the Licensor or its representatives, including but not limited to\r
+      communication on electronic mailing lists, source code control systems,\r
+      and issue tracking systems that are managed by, or on behalf of, the\r
+      Licensor for the purpose of discussing and improving the Work, but\r
+      excluding communication that is conspicuously marked or otherwise\r
+      designated in writing by the copyright owner as "Not a Contribution."\r
+\r
+      "Contributor" shall mean Licensor and any individual or Legal Entity\r
+      on behalf of whom a Contribution has been received by Licensor and\r
+      subsequently incorporated within the Work.\r
+\r
+   2. Grant of Copyright License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      copyright license to reproduce, prepare Derivative Works of,\r
+      publicly display, publicly perform, sublicense, and distribute the\r
+      Work and such Derivative Works in Source or Object form.\r
+\r
+   3. Grant of Patent License. Subject to the terms and conditions of\r
+      this License, each Contributor hereby grants to You a perpetual,\r
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\r
+      (except as stated in this section) patent license to make, have made,\r
+      use, offer to sell, sell, import, and otherwise transfer the Work,\r
+      where such license applies only to those patent claims licensable\r
+      by such Contributor that are necessarily infringed by their\r
+      Contribution(s) alone or by combination of their Contribution(s)\r
+      with the Work to which such Contribution(s) was submitted. If You\r
+      institute patent litigation against any entity (including a\r
+      cross-claim or counterclaim in a lawsuit) alleging that the Work\r
+      or a Contribution incorporated within the Work constitutes direct\r
+      or contributory patent infringement, then any patent licenses\r
+      granted to You under this License for that Work shall terminate\r
+      as of the date such litigation is filed.\r
+\r
+   4. Redistribution. You may reproduce and distribute copies of the\r
+      Work or Derivative Works thereof in any medium, with or without\r
+      modifications, and in Source or Object form, provided that You\r
+      meet the following conditions:\r
+\r
+      (a) You must give any other recipients of the Work or\r
+          Derivative Works a copy of this License; and\r
+\r
+      (b) You must cause any modified files to carry prominent notices\r
+          stating that You changed the files; and\r
+\r
+      (c) You must retain, in the Source form of any Derivative Works\r
+          that You distribute, all copyright, patent, trademark, and\r
+          attribution notices from the Source form of the Work,\r
+          excluding those notices that do not pertain to any part of\r
+          the Derivative Works; and\r
+\r
+      (d) If the Work includes a "NOTICE" text file as part of its\r
+          distribution, then any Derivative Works that You distribute must\r
+          include a readable copy of the attribution notices contained\r
+          within such NOTICE file, excluding those notices that do not\r
+          pertain to any part of the Derivative Works, in at least one\r
+          of the following places: within a NOTICE text file distributed\r
+          as part of the Derivative Works; within the Source form or\r
+          documentation, if provided along with the Derivative Works; or,\r
+          within a display generated by the Derivative Works, if and\r
+          wherever such third-party notices normally appear. The contents\r
+          of the NOTICE file are for informational purposes only and\r
+          do not modify the License. You may add Your own attribution\r
+          notices within Derivative Works that You distribute, alongside\r
+          or as an addendum to the NOTICE text from the Work, provided\r
+          that such additional attribution notices cannot be construed\r
+          as modifying the License.\r
+\r
+      You may add Your own copyright statement to Your modifications and\r
+      may provide additional or different license terms and conditions\r
+      for use, reproduction, or distribution of Your modifications, or\r
+      for any such Derivative Works as a whole, provided Your use,\r
+      reproduction, and distribution of the Work otherwise complies with\r
+      the conditions stated in this License.\r
+\r
+   5. Submission of Contributions. Unless You explicitly state otherwise,\r
+      any Contribution intentionally submitted for inclusion in the Work\r
+      by You to the Licensor shall be under the terms and conditions of\r
+      this License, without any additional terms or conditions.\r
+      Notwithstanding the above, nothing herein shall supersede or modify\r
+      the terms of any separate license agreement you may have executed\r
+      with Licensor regarding such Contributions.\r
+\r
+   6. Trademarks. This License does not grant permission to use the trade\r
+      names, trademarks, service marks, or product names of the Licensor,\r
+      except as required for reasonable and customary use in describing the\r
+      origin of the Work and reproducing the content of the NOTICE file.\r
+\r
+   7. Disclaimer of Warranty. Unless required by applicable law or\r
+      agreed to in writing, Licensor provides the Work (and each\r
+      Contributor provides its Contributions) on an "AS IS" BASIS,\r
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\r
+      implied, including, without limitation, any warranties or conditions\r
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\r
+      PARTICULAR PURPOSE. You are solely responsible for determining the\r
+      appropriateness of using or redistributing the Work and assume any\r
+      risks associated with Your exercise of permissions under this License.\r
+\r
+   8. Limitation of Liability. In no event and under no legal theory,\r
+      whether in tort (including negligence), contract, or otherwise,\r
+      unless required by applicable law (such as deliberate and grossly\r
+      negligent acts) or agreed to in writing, shall any Contributor be\r
+      liable to You for damages, including any direct, indirect, special,\r
+      incidental, or consequential damages of any character arising as a\r
+      result of this License or out of the use or inability to use the\r
+      Work (including but not limited to damages for loss of goodwill,\r
+      work stoppage, computer failure or malfunction, or any and all\r
+      other commercial damages or losses), even if such Contributor\r
+      has been advised of the possibility of such damages.\r
+\r
+   9. Accepting Warranty or Additional Liability. While redistributing\r
+      the Work or Derivative Works thereof, You may choose to offer,\r
+      and charge a fee for, acceptance of support, warranty, indemnity,\r
+      or other liability obligations and/or rights consistent with this\r
+      License. However, in accepting such obligations, You may act only\r
+      on Your own behalf and on Your sole responsibility, not on behalf\r
+      of any other Contributor, and only if You agree to indemnify,\r
+      defend, and hold each Contributor harmless for any liability\r
+      incurred by, or claims asserted against, such Contributor by reason\r
+      of your accepting any such warranty or additional liability.\r
+\r
+   END OF TERMS AND CONDITIONS\r
+\r
+   APPENDIX: How to apply the Apache License to your work.\r
+\r
+      To apply the Apache License to your work, attach the following\r
+      boilerplate notice, with the fields enclosed by brackets "[]"\r
+      replaced with your own identifying information. (Don't include\r
+      the brackets!)  The text should be enclosed in the appropriate\r
+      comment syntax for the file format. We also recommend that a\r
+      file or class name and description of purpose be included on the\r
+      same "printed page" as the copyright notice for easier\r
+      identification within third-party archives.\r
+\r
+   Copyright [yyyy] [name of copyright owner]\r
+\r
+   Licensed under the Apache License, Version 2.0 (the "License");\r
+   you may not use this file except in compliance with the License.\r
+   You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+\r
+\r
diff --git a/capi-network-nfc.pc.in b/capi-network-nfc.pc.in
new file mode 100755 (executable)
index 0000000..fd41dbb
--- /dev/null
@@ -0,0 +1,15 @@
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=/usr/include/network
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@ 
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir} @PC_CFLAGS@
+
diff --git a/debian/README b/debian/README
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/debian/capi-network-nfc-dev.install b/debian/capi-network-nfc-dev.install
new file mode 100755 (executable)
index 0000000..761a28b
--- /dev/null
@@ -0,0 +1,4 @@
+/usr/include/*
+/usr/include/*/*
+/usr/lib/pkgconfig/*.pc
+
diff --git a/debian/capi-network-nfc-dev.postinst b/debian/capi-network-nfc-dev.postinst
new file mode 100755 (executable)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/debian/capi-network-nfc.install b/debian/capi-network-nfc.install
new file mode 100755 (executable)
index 0000000..4a755a4
--- /dev/null
@@ -0,0 +1 @@
+/usr/lib/lib*.so*
diff --git a/debian/capi-network-nfc.postinst b/debian/capi-network-nfc.postinst
new file mode 100755 (executable)
index 0000000..1a24852
--- /dev/null
@@ -0,0 +1 @@
+#!/bin/sh
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..06d0722
--- /dev/null
@@ -0,0 +1,11 @@
+capi-network-nfc (0.0.1-5) unstable; urgency=low
+
+  * update version
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>  Thu, 15 Dec 2011 12:50:23 +0900
+
+capi-network-nfc (0.0.1-1) unstable; urgency=low
+
+  * Initial release.
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>  Wed, 07 Dec 2011 12:47:59 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100755 (executable)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755 (executable)
index 0000000..1f3954a
--- /dev/null
@@ -0,0 +1,22 @@
+
+Source: capi-network-nfc
+Section: libs
+Priority: extra
+Maintainer: 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
+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
+Description: A NFC library in Tizen Native API (DEV)
+
+Package: capi-network-nfc-dbg
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-nfc (= ${Source-Version})
+Description: A NFC library in Tizen Native API (DBG)
+
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..9f3bb7f
--- /dev/null
@@ -0,0 +1,65 @@
+#!/usr/bin/make -f
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+       CFLAGS += -O0
+else
+       CFLAGS += -O2
+endif
+CMAKE_ROOT_DIR ?= $(CURDIR)
+CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
+
+configure: configure-stamp
+configure-stamp:
+       dh_testdir
+       mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake ..
+       touch configure-stamp
+
+
+build: build-stamp
+build-stamp: configure-stamp 
+       dh_testdir
+       cd $(CMAKE_BUILD_DIR) && $(MAKE)
+       touch $@
+
+clean:
+       cd $(CMAKE_ROOT_DIR)
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp configure-stamp
+       rm -f 
+       rm -rf $(CMAKE_BUILD_DIR)
+       dh_clean
+       
+install: build
+       dh_testdir
+       dh_testroot
+       dh_clean -k 
+       dh_installdirs
+
+       cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
+
+binary-indep: build install
+
+binary-arch: build install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs 
+       dh_installdocs
+       dh_installexamples
+       dh_install --sourcedir=debian/tmp
+       dh_installman
+       dh_link
+       dh_strip --dbg-package=capi-network-nfc-dbg
+       dh_fixperms
+       dh_makeshlibs
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
+
diff --git a/include/nfc.h b/include/nfc.h
new file mode 100755 (executable)
index 0000000..457e55b
--- /dev/null
@@ -0,0 +1,1657 @@
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. 
+*/
+
+
+#ifndef __NFC_H__
+#define __NFC_H__
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @file nfc.h
+ * @brief This file contains the NFC API.
+ */
+
+#define NFC_ERROR_CLASS TIZEN_ERROR_NETWORK_CLASS | 0x200
+
+
+/**
+ * @brief Error codes reported by the NFC API.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ */
+typedef enum {
+       NFC_ERROR_NONE = TIZEN_ERROR_NONE,      /**< Successful */
+       NFC_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,    /**< Out of memory */
+       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_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_e;
+/**
+ * @brief Enumerations for record TNF (Type Name Format)
+ * @details It is indicate format of type field
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+typedef enum {
+       NFC_RECORD_TNF_EMPTY = 0x00,    /**< Empty */
+       NFC_RECORD_TNF_WELL_KNOWN = 0x01,       /**< RTD(Record Type Definition) type format [NFC RTD] */
+       NFC_RECORD_TNF_MIME_MEDIA= 0x02,        /**< MIME Media types in RFC 2046 [RFC 2046] */
+       NFC_RECORD_TNF_URI = 0x03,      /**< Absolute URI as defined in RFC 3986 [RFC 3986] */
+       NFC_RECORD_TNF_EXTERNAL_RTD = 0x04,     /**< NFC Forum external type [NFC RTD] */
+       NFC_RECORD_TNF_UNKNOWN = 0x05,  /**< Unknown\n The payload type is unknown */
+       NFC_RECORD_TNF_UNCHAGNED = 0x06,        /**< It means the payload is an intermediate or final chunk of a chunked NDEF Record */
+} nfc_record_tnf_e;
+
+
+/**
+ * @brief Enumerations for NFC encode types
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE 
+ */
+typedef enum {
+       NFC_ENCODE_UTF_8 = 0x00,        /**< UTF-8 */
+       NFC_ENCODE_UTF_16,      /**< UTF-16 */
+} nfc_encode_type_e;
+
+/**
+ * @brief Enumerations for NFC tag types
+ * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ */
+typedef enum {
+       NFC_UNKNOWN_TARGET = 0x00U,     /**< Unknown target */
+       NFC_GENERIC_PICC,       /**< GENERIC PICC*/
+       NFC_ISO14443_A_PICC,    /**< ISO14443_A PICC */
+       NFC_ISO14443_4A_PICC,   /**< ISO14443_4A PICC */
+       NFC_ISO14443_3A_PICC,   /**< ISO14443_3A PICC */
+       NFC_MIFARE_MINI_PICC,   /**< MIFARE_MINI_PICC */
+       NFC_MIFARE_1K_PICC,     /**< MIFARE_1K_PICC */
+       NFC_MIFARE_4K_PICC,     /**< MIFARE_4K_PICC */
+       NFC_MIFARE_ULTRA_PICC,  /**< MIFARE_ULTRA_PICC */
+       NFC_MIFARE_DESFIRE_PICC,        /**< MIFARE_DESFIRE_PICC */
+       NFC_ISO14443_B_PICC,    /**< ISO14443_B PICC */
+       NFC_ISO14443_4B_PICC,   /**< ISO14443_4B PICC */
+       NFC_ISO14443_BPRIME_PICC,       /**< ISO14443_BPRIME PICC */
+       NFC_FELICA_PICC,        /**< FELICA PICC */
+       NFC_JEWEL_PICC, /**< JEWEL PICC */
+       NFC_ISO15693_PICC,      /**< ISO15693 PICC */
+       NFC_NFCIP1_TARGET,      /**< NFCIP1_TARGET */
+       NFC_NFCIP1_INITIATOR,   /**< NFCIP1_INITIATOR */
+} nfc_tag_type_e;
+
+
+
+/**
+ * @brief Enumerations for NFC Tag filter
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE 
+ */
+typedef enum {
+       NFC_TAG_FILTER_ALL_DISABLE = 0x0000,    /**< All disable */
+       NFC_TAG_FILTER_ISO14443A_ENABLE = 0x0001,       /**< ISO14443A enable */
+       NFC_TAG_FILTER_ISO14443B_ENABLE = 0x0002,       /**< ISO14443B enable */
+       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_ALL_ENABLE= ~0,  /**< All enable */
+} nfc_tag_filter_e;
+
+/**
+ * @brief Enumerations of polling request code for FeliCa tag
+ * @ingroup CAPI_NETWORK_NFC_TAG_FELICA
+ */
+typedef enum {
+       NFC_TAG_FELICA_POLL_NO_REQUEST = 0x00,  /**< NO REQUEST */
+       NFC_TAG_FELICA_POLL_SYSTEM_CODE_REQUEST= 0x01,  /**< SYSTEM CODE REQUEST */
+       NFC_TAG_FELICA_POLL_COMM_SPEED_REQUEST= 0x02,   /**< COMM SPEED REQUEST */
+} nfc_tag_felica_poll_request_code_e;
+
+
+/**
+ * @brief Enumerations for NFC discovered type
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE 
+ */
+typedef enum {
+       NFC_DISCOVERED_TYPE_ATTACHED,   /**< Attached, discovered, activated event*/
+       NFC_DISCOVERED_TYPE_DETACHED,   /**< detached, disappeared, deactivated event*/
+} nfc_discovered_type_e;
+
+/**
+ * @brief Enumerations for NFC Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event
+ * @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_e;
+
+
+/**
+ * @brief The handle to the NDEF record
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+typedef struct ndef_record_s *nfc_ndef_record_h;
+
+/**
+ * @brief The handle to the NDEF message
+ * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ */
+typedef struct ndef_message_s *nfc_ndef_message_h;
+
+/**
+ * @brief The handle to the NFC tag
+ * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ */
+typedef struct net_nfc_target_info_s *nfc_tag_h;
+
+
+/**
+ * @brief The handle to NFC p2p target
+ * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ */
+typedef void* nfc_p2p_target_h;
+
+
+/**
+ * @brief The default factory key.
+ * @details The key is 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ */
+const unsigned char NFC_TAG_MIFARE_KEY_DEFAULT[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
+/**
+ * @brief The well-known key for tags formatted according to the MIFARE Application Directory (MAD) specification.
+ * @details The key is 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ */
+const unsigned char NFC_TAG_MIFARE_KEY_APPLICATION_DIRECTORY[6] = {0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5};
+
+/**
+ * @brief The well-known key for tags formatted according to the NDEF on Mifare Classic specification.
+ * @details The key is 0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ */
+const unsigned char NFC_TAG_MIFARE_KEY_NFC_FORUM[6] = {0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7};
+
+
+/**
+ * @brief RTD(Record type definition) Type - Smart Poster type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+const unsigned char NFC_RECORD_SMART_POSTER_TYPE[2] = { 'S', 'p' };
+
+/**
+ * @brief  RTD(Record type definition) Type - Text type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+const unsigned char NFC_RECORD_TEXT_TYPE[1] = { 'T' };
+/**
+ * @brief  RTD(Record type definition) Type - URI type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+const unsigned char NFC_RECORD_URI_TYPE[1] = { 'U' };
+/**
+ * @brief  RTD(Record type definition) Type - Alternative Carrier type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+const unsigned char NFC_RECORD_ALTERNATIVE_CARRIER_TYPE[2] = { 'a','c' };
+/**
+ * @brief  RTD(Record type definition) Type - Handover Carrier type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+const unsigned char NFC_RECORD_HANDOVER_CARRIER_TYPE[2] = { 'H','c' };
+/**
+ * @brief  RTD(Record type definition) Type - Handover Request type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+const unsigned char NFC_RECORD_HANDOVER_REQUEST_TYPE[2] = { 'H','r' };
+/**
+ * @brief  RTD(Record type definition) Type - Handover Select type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+const unsigned char NFC_RECORD_HANDOVER_SELECT_TYPE[2] = { 'H','s' };
+
+
+/**
+ * @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] tag The handle to NFC tag
+ * @param [in] user_data The user data passed from the callback registration function
+ *
+ * @see nfc_manager_set_tag_discovered_cb()
+ * @see nfc_manager_unset_tag_discovered_cb()
+ * @see nfc_manager_set_tag_filter()
+ */
+typedef void (* nfc_tag_discovered_cb)(nfc_discovered_type_e type, nfc_tag_h tag, void *user_data);
+
+/**
+ * @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
+ * @param [in] user_data The user data passed from the callback registration function
+ *
+ * @see nfc_manager_set_ndef_discovered_cb()
+ * @see nfc_manager_unset_ndef_discovered_cb()
+ */
+typedef void (* nfc_ndef_discovered_cb)(nfc_ndef_message_h message, void *user_data);
+
+
+/**
+ * @brief Called once for each tag information.
+ * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ *
+ * @remarks @a key and value will be automatically destroyed when the callback function returns. (Do not release @a key and value.)
+ *
+ * @param[in] key The key of information
+ * @param[in] value The value of information
+ * @param[in] value_size The data size in bytes
+ * @param[in] user_data The user data passed from the foreach function
+ *
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break outsp of the loop.
+ * @pre nfc_tag_foreach_informations() invokes this callback.
+ *
+ * @see        nfc_tag_foreach_informations()
+ */
+
+typedef bool (*nfc_tag_information_cb)(const char *key, const unsigned char *value, int value_size, void *user_data);
+
+
+/**
+ * @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
+ * @param [in] user_data The user data passed from nfc_tag_transceive()
+ *
+ * @see nfc_tag_transceive()
+ */
+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. 
+ * @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()
+ *
+ * @see nfc_tag_write_ndef()
+ */
+typedef void (* nfc_tag_write_completed_cb)(nfc_error_e result, void *user_data);
+
+/**
+ * @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() 
+ *
+ * @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. 
+ * @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()
+ *
+ * @see nfc_tag_format_ndef()
+ */
+typedef void (* nfc_tag_format_completed_cb)(nfc_error_e result, void *user_data);
+
+
+/**
+ * @brief Called after nfc_mifare_authenticate_with_keyA() has completed
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ * @param [in] result The result of nfc_mifare_authenticate_with_keyA()
+ * @param [in] user_data The user data passed from nfc_mifare_authenticate_with_keyA()
+ * @see nfc_mifare_authenticate_with_keyA()
+ */
+typedef void (* nfc_mifare_authenticate_with_keyA_completed_cb)(nfc_error_e result, void *user_data);
+
+/**
+ * @brief Called after nfc_mifare_authenticate_with_keyB() has completed
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ * @param [in] result The result of function call
+ * @param [in] user_data The user data passed from nfc_mifare_authenticate_with_keyB()
+ * @see nfc_mifare_authenticate_with_keyB()
+ */
+typedef void (* nfc_mifare_authenticate_with_keyB_completed_cb)(nfc_error_e result, void *user_data);
+
+/**
+ * @brief Called after nfc_mifare_write_block() has completed
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ * @param [in] result The result of nfc_mifare_write_block()
+ * @param [in] user_data The user data passed from nfc_mifare_write_block()
+ * @see nfc_mifare_write_block()
+ */
+typedef void (* nfc_mifare_write_block_completed_cb)(nfc_error_e result, void *user_data);
+
+/**
+ * @brief Called after nfc_mifare_write_page() has completed
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ * @param [in] result The result of function call
+ * @param [in] user_data The user data passed from nfc_mifare_write_page()
+ * @see nfc_mifare_write_page()
+ */
+typedef void (* nfc_mifare_write_page_completed_cb)(nfc_error_e result, void *user_data);
+
+/**
+ * @brief Called after nfc_mifare_read_block() has completed
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_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 Thre read buffer
+ * @param [in] size The size of buffer in bytes
+ * @param [in] user_data The user data passed from nfc_mifare_read_block()
+ * @see nfc_mifare_read_block()
+ */
+typedef void (* nfc_mifare_read_block_completed_cb)(nfc_error_e result, unsigned char *buffer, int bufer_size, void *user_data);
+
+/**
+ * @brief Called after nfc_mifare_read_page() has completed
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ *
+ * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
+ *
+ * @param [in] result The result of nfc_mifare_read_page()
+ * @param [in] buffer The read buffer
+ * @param [in] size The size of read buffer in bytes
+ * @param [in] user_data The user data passed from nfc_mifare_read_page()
+ * @see nfc_mifare_read_page()
+ */
+typedef void (* nfc_mifare_read_page_completed_cb)(nfc_error_e result, unsigned char *buffer, int bufer_size, void *user_data);
+
+/**
+ * @brief Called after nfc_mifare_increment() has completed
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ * @param [in] result The result of nfc_mifare_increment()
+ * @param [in] user_data The user data passed from nfc_mifare_increment()
+ * @see nfc_mifare_increment()
+ */
+typedef void (* nfc_mifare_increment_completed_cb)(nfc_error_e result, void *user_data);
+
+/**
+ * @brief Called after nfc_mifare_decrement() has completed
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ * @param [in] result The result of nfc_mifare_decrement()
+ * @param [in] user_data The user data passed from nfc_mifare_decrement()
+ * @see nfc_mifare_decrement()
+ */
+typedef void (* nfc_mifare_decrement_completed_cb)(nfc_error_e result, void *user_data);
+
+/**
+ * @brief Called after nfc_mifare_transfer() has completed
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ * @param [in] result The result of nfc_mifare_transfer()
+ * @param [in] user_data The user data passed from nfc_mifare_transfer()
+ * @see nfc_mifare_transfer()
+ */
+typedef void (* nfc_mifare_transfer_completed_cb)(nfc_error_e result, void *user_data);
+
+/**
+ * @brief Called after nfc_mifare_restore() has completed
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ * @param [in] result The result of nfc_mifare_restore()
+ * @param [in] user_data The user data passed from nfc_mifare_restore()
+ * @see nfc_mifare_restore()
+ */
+typedef void (* nfc_mifare_restore_completed_cb)(nfc_error_e result, void *user_data);
+
+
+
+/**
+ * @brief Called when NFC peer-to-peer target appeared or disappeared 
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @param [in] type The discovered type attached or detached 
+ * @param [in] target The handle to p2p target
+ * @param [in] user_data The user data passed from nfc_manager_set_p2p_target_discovered_cb()
+ *
+ * @see nfc_manager_set_p2p_target_discovered_cb()
+ * @see nfc_manager_unset_p2p_target_discovered_cb()
+ */
+typedef void (*nfc_p2p_target_discovered_cb)(nfc_discovered_type_e type, nfc_p2p_target_h target, void *user_data);
+
+/**
+ * @brief Called when receiving  Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @param [in] event The Secure Element event
+ * @param [in] user_data The user data passed from nfc_manager_set_se_event_cb()
+ *
+ * @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 after nfc_p2p_send() has completed.
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ * @param [in] result The result of function call
+ * @param [in] user_data The user data passed from nfc_p2p_send()
+ *
+ * @see nfc_p2p_send()
+ */
+typedef void (*nfc_p2p_send_completed_cb)(nfc_error_e result, void *user_data);
+
+
+/**
+ * @brief Called after nfc_p2p_send() has completed.
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
+ *
+ * @param [in] target The handle to p2p target
+ * @param [in] message The recevied message
+ * @param [in] 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() 
+ */
+typedef void (*nfc_p2p_data_recived_cb)(nfc_p2p_target_h target, nfc_ndef_message_h message, void *user_data);
+
+
+/**
+ * @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 
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
+ * @see nfc_manager_deinitialize()
+ */ 
+int nfc_manager_initialize(void);
+
+
+/**
+ * @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
+ * @see nfc_manager_initialize()
+ */
+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] 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_manager_unset_tag_discovered_cb()
+ * @see nfc_tag_discovered_cb()
+ */
+int nfc_manager_set_tag_discovered_cb(nfc_tag_discovered_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * 
+ * @see nfc_manager_set_tag_discovered_cb()
+ * @see nfc_tag_discovered_cb()
+ */
+void nfc_manager_unset_tag_discovered_cb(void);
+
+/**
+ * @brief Registers a callback function for receiving NDEF Message discovered notification
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] callback The callback function called when NDEF Message is discovered
+ * @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_manager_unset_ndef_discovered_cb()
+ * @see nfc_ndef_discovered_cb()
+ */
+int nfc_manager_set_ndef_discovered_cb(nfc_ndef_discovered_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * 
+ * @see nfc_manager_set_ndef_discovered_cb()
+ * @see nfc_ndef_discovered_cb()
+ */
+void nfc_manager_unset_ndef_discovered_cb(void);
+
+/**
+ * @brief Registers a callback function for receiving NFC peer-to-peer target discovered notification.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] callback The callback function called when NFC peer-to-peer target is discovered
+ * @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_manager_unset_ndef_discovered_cb()
+ * @see nfc_p2p_target_discovered_cb()
+ */
+int nfc_manager_set_p2p_target_discovered_cb(nfc_p2p_target_discovered_cb callback, void *user_data);
+
+/**
+ * @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()
+ */
+void nfc_manager_unset_p2p_target_discovered_cb(void);
+
+
+/**
+ * @brief Registers a callback function for receiving  Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] callback The callback function called when occurred Secure Element (SIM/UICC(Universal Integrated Circuit Card)) 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_event_cb()
+ * @see nfc_manager_unset_se_event_cb()
+ */
+
+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.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @remarks This function is used to get the ndef message that was read before launched your application.
+ * @param [out] ndef_message The cached NDEF message
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter 
+ * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE The cached message does not exist
+ *
+ */
+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. 
+ *     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. 
+ * @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 
+ * @return The filter which is set #nfc_tag_filter_e
+ * @see nfc_manager_set_tag_filter()
+ */ 
+int nfc_manager_get_tag_filter(void);
+
+
+/**
+ * @brief Creates a record with given parameter value.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @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
+ * @param [in] type_size The byte size of type
+ * @param [in] id The record ID
+ * @param [in] id_size The byte size of ID
+ * @param [in] payload The payload of this record
+ * @param [in] payload_size The byte size of payload
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @see nfc_ndef_record_create_text()
+ * @see nfc_ndef_record_create_uri()
+ * @see nfc_ndef_record_create_mime()
+ * @see nfc_ndef_record_destroy()
+ */
+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);
+
+
+/**
+ * @brief Creates a record with text type payload
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @remarks This function does not encode the text. @a text will be assumed as that it is already encoded with encode type.\n
+ * The text buffer will be deeply copied.\n
+ * The record is created in this format\n
+ * - TNF : NFC_RECORD_TNF_WELL_KNOWN\n
+ * - type : "T"\n
+ * - payload : encode and header information + language code + text \n
+ * Defined in Record Type Definition Technical Specifications.
+ *
+ * @param [out] record A handle to record
+ * @param [in] text The encoded text
+ * @param [in] lang_code The language code string value followed by IANA[RFC 3066] (ex: en-US, ko-KR)
+ * @param [in] encode The encoding type
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @see nfc_ndef_record_create()
+ * @see nfc_ndef_record_create_uri()
+ * @see nfc_ndef_record_create_mime()
+ * @see nfc_ndef_record_destroy()
+ * @see nfc_ndef_record_get_text()
+ * @see nfc_ndef_record_get_langcode()
+ * @see nfc_ndef_record_get_encode_type()
+ */
+int nfc_ndef_record_create_text(nfc_ndef_record_h *record, const char *text, const char *lang_code, nfc_encode_type_e encode);
+
+/**
+ * @brief Creates a record with URI type payload
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @remarks The uri string will be deep copied.\n
+ * The record is created in this format\n
+ * - TNF : NFC_RECORD_TNF_WELL_KNOWN\n
+ * - type : "U"\n
+ * - payload : procotol scheme + uri\n
+ * Defined in Record Type Definition Technical Specifications.
+ *
+ * @param [out] record A handle to record
+ * @param [in] protocol_scheme The protocol scheme
+ * @param [in] uri     The URI string that will be stored in the payload
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @see nfc_ndef_record_create()
+ * @see nfc_ndef_record_create_text()
+ * @see nfc_ndef_record_create_mime()
+ * @see nfc_ndef_record_destroy()
+ * @see nfc_ndef_record_get_uri()
+ */
+int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char *uri);
+
+
+/**
+ * @brief Creates a record with MIME type payload
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @remarks The data buffer will be deep copied.\n
+ * The data are bytes array(binary data).\n
+ * The mime_type string will deep copied.\n
+ * The record is created in this format\n
+ * - TNF : NFC_RECORD_TNF_MIME_MEDIA\n
+ * - type : mime type\n
+ * - payload : data\n
+ * 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
+ * @param [in] data    The pointer of data
+ * @param [in] data_size       The size of data
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @see nfc_ndef_record_create() 
+ * @see nfc_ndef_record_create_uri()
+ * @see nfc_ndef_record_create_text()
+ * @see nfc_ndef_record_destroy()
+ * @see nfc_ndef_record_get_mime_type()
+ */
+int nfc_ndef_record_create_mime(nfc_ndef_record_h* record, const char *mime_type, const unsigned char *data, int data_size);
+
+
+/**
+ * @brief Destroys the record handle
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @param [in] record The handle to record
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @see nfc_ndef_record_create() 
+ * @see nfc_ndef_record_create_text()
+ * @see nfc_ndef_record_create_uri() 
+ * @see nfc_ndef_record_create_mime()
+ */
+int nfc_ndef_record_destroy(nfc_ndef_record_h record);
+
+/**
+ * @brief Sets record ID
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @remarks The ID buffer are deep copied.
+ *
+ * @param [in] record The handle to record
+ * @param [in] id The record ID
+ * @param [in] id_size The size of ID in bytes
+ * @return 0 on success, otherwise a negative error value.
+ * @retval     #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @see nfc_ndef_record_get_id()
+ */
+int nfc_ndef_record_set_id(nfc_ndef_record_h record, unsigned char *id, int id_size);
+
+/**
+ * @brief Gets record ID
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @remarks It may return NULL pointer if the ID is not exist\n
+ *  This function gives you  the pointer of ID that is contained by record\n
+ *  Do not free the ID. It will be released when @a record is destroyed by nfc_ndef_record_destroy().
+ *
+ * @param [in] record The handle to record
+ * @param [out] id The record ID ( do not free )
+ * @param [out] id_size The size of ID in bytes
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @see nfc_ndef_record_set_id()
+ */
+int nfc_ndef_record_get_id(nfc_ndef_record_h record, unsigned char **id, int *size);
+
+/**
+ * @brief Gets record payload.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @remarks This function gives you  the pointer of pyaload that is contained by record\n
+ * Do not free the payload. it will be freed when @a record is destroyed by nfc_ndef_record_destroy().
+ *
+ * @param [in] record The handle to record
+ * @param [out] payload        The payload  ( do not free this pointer )
+ * @param [out] size the size of payload in byte
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ */
+int nfc_ndef_record_get_payload(nfc_ndef_record_h record, unsigned char ** payload, int *size);
+
+/**
+ * @brief Gets record type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @remarks This function gives you  the pointer of type that is contained by record.\n
+ * Do not free the type. it will be freed when the record is freed.
+ *
+ * @param [in] record The handle to record
+ * @param [out] type   The record type  ( do not free this pointer )
+ * @param [out] size The size of type in byte
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ */
+int nfc_ndef_record_get_type(nfc_ndef_record_h record, unsigned char **type, int *size);
+
+/**
+ * @brief Gets record TNF(Type Name Format) value.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @param [in] record The handle to record
+ * @param [out] tnf The TNF(Type Name Format) value
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ */
+int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e *tnf);
+
+/**
+ * @brief Gets text from text record
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @remarks This function returns newly allocated string, this value must be deallocated by caller.\n
+ * This function is valid only for text type record.\n
+ * The text type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "T"
+ *
+ * @param [in] record The handle to record
+ * @param [out] text The text in record payload ( should be freed by caller )
+ *
+ * @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
+ * @see nfc_ndef_record_create_text()
+ */
+int nfc_ndef_record_get_text(nfc_ndef_record_h record, char **text);
+
+/**
+ * @brief Gets language code from text record
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ * @remarks This function returns newly allocated string, this value must be deallocated by caller.\n
+ * This function is valid only for text type record.\n
+ * The text type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "T"
+ *
+ * @param [in] record  The handle to record
+ * @param [out] lang_code lang code ( should be freed by caller )
+ *
+ * @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 
+ * @see nfc_ndef_record_create_text()
+ */
+int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code);
+
+/**
+ * @brief Gets encoding type from text record
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @remarks  This function is valid only for text type record.\n
+ * The text type record 's tnf is NFC_RECORD_TNF_WELL_KNOWN and it's type is "T"
+ *
+ * @param [in] record  The handle to record
+ * @param [out] encode encode type #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 
+ * @see nfc_ndef_record_create_text()
+ */
+int nfc_ndef_record_get_encode_type(nfc_ndef_record_h record, nfc_encode_type_e *encode);
+
+/**
+ * @brief Gets URI from uri record
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @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" 
+ *
+ * @param [in] record  The handle to record
+ * @param [out] uri    The uri in record payload ( should be freed by caller )
+ *
+ * @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 
+ * @see nfc_ndef_record_create_uri()
+ */
+int nfc_ndef_record_get_uri(nfc_ndef_record_h record, char **uri);
+
+
+/**
+ * @brief Gets mime type from mime type record
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ *
+ * @remarks The function returns newly allocated string, this value must be deallocated by caller.\n
+ * This function is valid only for mime type record.\n
+ * The uri type record 's tnf is NFC_RECORD_TNF_MIME_MEDIA.
+ *
+ * @param [in] record  The handle to record
+ * @param [out] mime_type      The mime type in record payload ( should be freed by caller )
+ *
+ * @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 
+ * @see nfc_ndef_record_create_mime()
+ */
+int nfc_ndef_record_get_mime_type(nfc_ndef_record_h record, char **mime_type);
+
+
+/**
+ * @brief Creates NDEF message handle
+ * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ *
+ * @param [out] ndef_message A handle to NDEF message
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @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. 
+ * @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.
+ *
+ * @param [out] ndef_message The handle to NDEF message
+ * @param [in] rawdata The NDEF message in form of bytes array
+ * @param [in] rawdata_size The size of bytes array
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @see nfc_ndef_message_create()
+ * @see nfc_ndef_message_destroy()
+ * @see nfc_ndef_message_get_rawdata()
+ *
+ */
+int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h *ndef_message, const unsigned char *rawdata, int rawdata_size);
+
+/**
+ * @brief Destroys NDEF message handle
+ * @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_from_rawdata()
+ */
+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);
+
+/**
+ * @brief Gets serial bytes array of NDEF message.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ *
+ * @remarks It gets copy of the rawdata bytes from NDEF message. @a rawdata must be released with free() by you.
+ * 
+ * @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
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE Invalid NDEF message
+ *
+ * @see nfc_ndef_message_create_from_rawdata()
+ */
+int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message, unsigned char **rawdata, int *rawdata_size);
+
+/**
+ * @brief Appends a record into NDEF message
+ * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ *
+ * @remarks Appended record is handled by frameworks. The record is released by frameworks when message is released.
+ *
+ * @param [in] ndef_message The handle to NDEF message
+ * @param [in] record The record that will be appended into NDEF message
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @see nfc_ndef_message_insert_record()
+ * @see nfc_ndef_message_remove_record()
+ */
+int nfc_ndef_message_append_record(nfc_ndef_message_h ndef_message, nfc_ndef_record_h record);
+
+/**
+ * @brief Inserts a record at index into NDEF message
+ * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ *
+ * @remarks Appended record is handled by frameworks. The record is released by frameworks when message is released.\n
+ * The index value should not bigger than nfc_ndef_message_get_record_count()
+ *
+ * @param [in] ndef_message The handle to NDEF message
+ * @param [in] index The index of record ( starts from 0 )
+ * @param [in] record The record that will be appended into NDEF message
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE     Invalid NDEF message
+ * @see nfc_ndef_message_append_record()
+ * @see nfc_ndef_message_remove_record()
+ */
+int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message, int index, nfc_ndef_record_h record);
+
+/**
+ * @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 )
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE     Invalid NDEF message
+ * @see nfc_ndef_message_append_record() 
+ * @see nfc_ndef_message_insert_record()
+ */
+int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message, int index);
+
+/**
+ * @brief Gets record by index.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ *
+ * @remarks This function just return the pointer of record. if you change the record value it directly affects the NDEF message
+ *
+ * @param [in] ndef_message The handle to NDEF message
+ * @param [in] index The index of record ( starts from 0 )
+ * @param [out] record The handle to 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(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
+ *
+ * @param [in] tag The handle to NFC tag
+ * @param [out] type The type of NFC tag
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ */
+int nfc_tag_get_type(nfc_tag_h tag, nfc_tag_type_e *type);
+
+/**
+ * @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
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ * @see nfc_tag_read_ndef()
+ */
+int nfc_tag_is_support_ndef(nfc_tag_h tag, bool *is_supported);
+
+/**
+ * @brief Gets the maximum NDEF message size that can be stored in NFC tag.
+ * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ *
+ * @remarks This max size indicates the maximum size of NDEF message that can be stored in this detected tag.
+ *
+ * @param [in] tag The handle to NFC tag
+ * @param [out] maximum_ndef_bytes_size The maximum bytes size of NDEF message that can be stored in this detected tag.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ */
+int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag, unsigned int *maximum_ndef_bytes_size);
+
+/**
+ * @brief Gets size of NDEF message that stored in the tag
+ * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ *
+ * @param [in] tag The handle to NFC tag
+ * @param [out] ndef_bytes_size The NDEF message bytes size that stored in the tag
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ */
+int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int *ndef_bytes_size);
+
+
+/**
+ * @brief Retrieves all tag information
+ * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ *
+ * @param[in] tag The handle to NFC tag
+ * @param[in] callback The callback function to invoke
+ * @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
+ *
+ */
+int nfc_tag_foreach_information(nfc_tag_h tag, nfc_tag_information_cb callback, void *user_data);
+
+
+/**
+ * @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. 
+* @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+*
+* @param [in] tag The handle to NFC tag
+* @param [in] buffer The binary data for parameter or additional commands
+* @param [in] buffer_size The size of buffer in bytes
+* @param [in] callback The callback function to invoke after this function has completed\n It can be null if a notification is not required
+* @param [in] user_data        The user data to be passed to the callback funcation
+* 
+* @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_INVALID_PARAMETER Invalid parameter
+* @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_transceive_completed_cb() when it has completed to t
+* @see nfc_tag_read_ndef()
+* @see nfc_tag_is_support_ndef()
+*/
+int nfc_tag_transceive(nfc_tag_h tag, unsigned char *buffer, int buffer_size, nfc_tag_transceive_completed_cb callback, void *user_data);
+
+/**
+ * @brief Reads NDEF formatted data from NFC tag.
+ * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ *
+ * @param [in] tag The handle to NFC tag
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback funcation
+ *
+ * @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_INVALID_PARAMETER        Invalid parameter
+ * @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_read_completed_cb() when it has completed to read NDEF formatted data.
+ *
+ * @see nfc_tag_transceive()
+ * @see nfc_tag_is_support_ndef()
+ * @see nfc_tag_write_ndef()
+ */
+int nfc_tag_read_ndef(nfc_tag_h tag, nfc_tag_read_completed_cb callback, void *user_data);
+
+/**
+ * @brief Writes NDEF formatted data.
+ * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ *
+ * @param [in] tag The handle to NFC tag
+ * @param [in] msg The message will be write to the tag
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_dataa The user data to be passed to the callback funcation
+ *
+ * @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_INVALID_PARAMETER        Invalid parameter
+
+ * @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_write_completed_cb() when it has completed to write NDEF data.
+ * @see nfc_tag_is_support_ndef()
+ * @see nfc_tag_read_ndef()
+ */
+int nfc_tag_write_ndef(nfc_tag_h tag, nfc_ndef_message_h msg, nfc_tag_write_completed_cb callback, void *user_data);
+
+/**
+ * @brief Formats the detected tag that can store NDEF message.
+ * @details Some tags are required authentication. If the detected target doesn't need authentication, @a key can be NULL.
+ * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ *
+ * @param [in] tag The handle to NFC tag
+ * @param [in] key The key value that may need to format the tag
+ * @param [in] key_size The size of key in byte
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback funcation
+ *
+ * @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_INVALID_PARAMETER        Invalid parameter
+ * @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()
+ */
+int nfc_tag_format_ndef(nfc_tag_h tag, unsigned char *key, int key_size, nfc_tag_format_completed_cb callback, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ * @brief Authenticates a sector with key A.
+ * @remarks I/O operations(read / write / increment / decrement / transfer / restore) will be available after successful authentication.\n
+ * This function is only available for MIFARE classic.\n
+ *     \n
+ *     MIFARE CLASSIC MINI \n
+ *             => 0 ~ 4 : 5 sectors having 4 block each with block size of 16 bytes \n
+ *     \n
+ *     MIFARE CLASSIC 1K \n
+ *             => 0 ~ 15 : 16 sectors having 4 block each with block size of 16 bytes \n
+ *     \n
+ *     MIFARE CLASSIC 4K \n
+ *             => 0 ~ 31 : 32 sectors having 4 block each with block size of 16 bytes  \n
+ *             => 32 ~ 39 : 8 sectors having 16 block each with block size of 16 bytes
+ *
+ * @param[in] tag The handle to NFC tag
+ * @param[in] sector_index The index of sector to authenticate with key A, starting from 0
+ * @param[in] auth_key 6-byte authentication key
+ * @param[in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param[in] user_data        The user data to be passed to the callback funcation
+ *
+ * @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_INVALID_PARAMETER        Invalid parameter
+ * @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_mifare_authenticate_with_keyA_completed_cb() when it has completed to authenticate the given sector with key A.
+ * @see nfc_mifare_authenticate_with_keyB()
+ * @see nfc_mifare_read_block()
+ * @see nfc_mifare_read_page()
+ * @see nfc_mifare_write_block()
+ * @see nfc_mifare_write_page()
+ * @see nfc_mifare_increment()
+ * @see nfc_mifare_decrement()
+*/
+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);
+
+
+/**
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ * @brief Authenticates a sector with key B.
+ * @remarks I/O operations(read / write / increment / decrement / transfer / restore) will be available after successful authentication.\n
+ * This function is only available for MIFARE classic.\n
+ *     \n
+ *     MIFARE CLASSIC MINI\n
+ *             => 0 ~ 4 : 5 sector and 4 block with 16 bytes\n
+ *     \n
+ *     MIFARE CLASSIC 1K \n
+ *             => 0 ~ 15 : 16 sector and 4 block with 16 bytes\n
+ *     \n
+ *     MIFARE CLASSIC 4K\n
+ *             => 0 ~ 31 : 32 sector and 4 block with 16 bytes \n
+ *             => 32 ~ 39 : 8 sector and 16 block with 16 bytes
+ *
+ * @param [in] tag The handle to NFC tag
+ * @param [in] sector_index The index of sector to authenticate with key B, starting from 0
+ * @param [in] auth_key 6-byte authentication key
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback funcation
+ *
+ * @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_INVALID_PARAMETER        Invalid parameter
+ * @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_mifare_authenticate_with_keyB_completed_cb() when it has completed to authenticate the given sector with key B.
+ * @see nfc_mifare_authenticate_with_keyA()
+ * @see nfc_mifare_read_block()
+ * @see nfc_mifare_read_page()
+ * @see nfc_mifare_write_block()
+ * @see nfc_mifare_write_page()
+ * @see nfc_mifare_increment()
+ * @see nfc_mifare_decrement()
+*/
+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);
+
+
+/**
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ * @brief Reads a 16-byte block.
+ * @remarks This function is only available for MIFARE classic.
+ *
+ * @param [in] tag The handle to NFC tag
+ * @param [in] block_index The block or starting page number
+ * @param [in] callback        The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback funcation
+ *
+ * @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_INVALID_PARAMETER        Invalid parameter
+ * @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_mifare_read_block_completed_cb() when it has completed to read a block.
+ * @see nfc_mifare_read_page()
+ * @see nfc_mifare_write_block()
+*/
+int nfc_mifare_read_block(nfc_tag_h tag, int block_index, nfc_mifare_read_block_completed_cb callback, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
+ * @brief Reads 4 pages(16 bytes).
+ * @remarks This function is only available for MIFARE Ultra light.\n
+ * The MIFARE Ultralight protocol always reads 4 pages at a time, to reduce the number of commands required to read an entire tag.
+ *
+ * @param [in] tag The handle to NFC tag
+ * @param [in] page_index  The index of page to read, starting from 0
+ * @param [in] callback        The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback funcation
+ *
+ *
+ * @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_INVALID_PARAMETER        Invalid parameter
+
+ * @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_mifare_read_page_completed_cb() when it has completed to read a page.
+ * @see nfc_mifare_read_block()
+ * @see nfc_mifare_write_page()
+*/
+int nfc_mifare_read_page(nfc_tag_h tag, int page_index, nfc_mifare_read_page_completed_cb callback, void *user_data);
+
+/**
+ * @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
+ * @param [in] buffer_size The size of buffer in bytes
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback funcation
+ *
+ * @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_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized
+ * @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_mifare_write_block_completed_cb() when it hase completed to write a block.
+ *
+ * @see nfc_mifare_write_page()
+ * @see nfc_mifare_read_block()
+*/
+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);
+
+/**
+ * @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
+ * @param [in] buffer_size The size of buffer in bytes
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback funcation
+ *
+ * @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_INVALID_PARAMETER        Invalid parameter
+
+ * @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_mifare_write_page_completed_cb() when it has completed to write a page.
+ *
+ * @see nfc_mifare_write_block()
+ * @see nfc_mifare_read_page()
+*/
+int nfc_mifare_write_page(nfc_tag_h tag, int page_index, unsigned char *buffer, int buffer_size, nfc_mifare_write_page_completed_cb callback, void *user_data);
+
+/**
+ * @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
+ * @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_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized
+ * @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
+ *
+ * @see nfc_mifare_decrement()
+ * @see nfc_mifare_write_block()
+*/
+int nfc_mifare_increment(nfc_tag_h tag, int block_index, int value, nfc_mifare_increment_completed_cb callback, void *user_data);
+
+/**
+ * @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
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback funcation
+ *
+ * @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_INVALID_PARAMETER        Invalid parameter
+ * @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
+ *
+ * @see nfc_mifare_increment()
+ * @see nfc_mifare_write_block()
+*/
+int nfc_mifare_decrement(nfc_tag_h tag, int block_index, int value, nfc_mifare_decrement_completed_cb callback, void *user_data);
+
+/**
+ * @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
+ * @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
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @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
+ *
+ * @see nfc_mifare_restore()
+*/
+int nfc_mifare_transfer(nfc_tag_h tag, int block_index, nfc_mifare_transfer_completed_cb callback, void *user_data);
+
+/**
+ * @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
+ * @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
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @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
+ *
+ * @see nfc_mifare_transfer()
+*/
+int nfc_mifare_restore(nfc_tag_h tag, int block_index, nfc_mifare_restore_completed_cb callback, void *user_data);
+
+
+/**
+ * @brief Registers a callback function for receiving data from NFC peer-to-peer target.
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @param [in] target The handle to peer target
+ * @param [in] callback The callback function to invoke when an NDEF Message is discovered
+ * @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_p2p_unset_data_received_cb()
+ * @see nfc_p2p_data_recived_cb()
+ * @see nfc_p2p_target_discovered_cb()
+ */
+int nfc_p2p_set_data_received_cb(nfc_p2p_target_h target, nfc_p2p_data_recived_cb callback, void *user_data);
+
+/**
+ * @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 
+ *
+ * @see nfc_p2p_set_data_received_cb()
+ * @see nfc_p2p_data_recived_cb()
+ * @see nfc_p2p_target_discovered_cb()
+ */
+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
+ * @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
+ * @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_send_completed_cb()
+ * @see @see nfc_p2p_target_discovered_cb()
+*/
+int nfc_p2p_send(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* __NFC_H__ */
+
diff --git a/include/nfc_private.h b/include/nfc_private.h
new file mode 100755 (executable)
index 0000000..5868fff
--- /dev/null
@@ -0,0 +1,62 @@
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. 
+*/
+
+#ifndef __NFC_PRIVATE_H__
+#define __NFC_PRIVATE_H__
+#include <net_nfc.h>
+#include <net_nfc_typedef_private.h>
+
+#include <nfc.h>
+
+
+typedef enum {
+       _NFC_CALLBACK_TYPE_RESULT=0,
+       _NFC_CALLBACK_TYPE_DATA=1,      
+} _nfc_callback_type;
+
+
+typedef struct {
+       nfc_tag_discovered_cb                   on_tag_discovered_cb;
+       void *                                                                          on_tag_discovered_user_data;
+       nfc_ndef_discovered_cb          on_ndef_discovered_cb;
+       void *                                                                          on_ndef_discovered_user_data;
+       net_nfc_target_info_s                   current_tag;
+
+       //net_nfc_target_handle_s               current_target;
+       net_nfc_target_handle_h         current_target;
+
+       nfc_p2p_target_discovered_cb    on_p2p_discovered_cb;
+       void *                                                                                  on_p2p_discovered_user_data;
+
+       nfc_se_event_cb                                                 on_se_event_cb;
+       void *                                                                                  on_se_event_user_data;
+       
+       nfc_p2p_send_completed_cb on_p2p_send_completed_cb;
+       void *                                                                          on_p2p_send_completed_user_data;
+
+       nfc_p2p_data_recived_cb         on_p2p_recv_cb;
+       void *                                                                          on_p2p_recv_user_data;
+
+       
+} _nfc_context_s;
+
+typedef struct {
+       void * callback;
+       void * user_data;
+       int callback_type;
+} _async_callback_data;
+
+#endif // __NET_NFC_PRIVATE_H__
diff --git a/packaging/capi-network-nfc.spec b/packaging/capi-network-nfc.spec
new file mode 100755 (executable)
index 0000000..0d80d06
--- /dev/null
@@ -0,0 +1,55 @@
+Name:       capi-network-nfc
+Summary:    A NFC library in Tizen Native API
+Version:    0.0.1
+Release:    1
+Group:      TO_BE/FILLED_IN
+License:    TO BE FILLED IN
+Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(dlog)
+BuildRequires:  pkgconfig(glib-2.0)
+BuildRequires:  pkgconfig(nfc)
+BuildRequires:  pkgconfig(nfc-common-lib)
+BuildRequires:  pkgconfig(capi-base-common)
+Requires(post): /sbin/ldconfig  
+Requires(postun): /sbin/ldconfig
+
+%description
+
+
+%package devel
+Summary:  A NFC library in Tizen Native API (Development)
+Group:    TO_BE/FILLED_IN
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+
+
+
+%prep
+%setup -q
+
+
+%build
+cmake . -DCMAKE_INSTALL_PREFIX=/usr
+
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+%make_install
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%{_libdir}/libcapi-network-nfc.so
+
+%files devel
+%{_includedir}/network/*.h
+%{_libdir}/pkgconfig/*.pc
+
+
diff --git a/src/nfc.c b/src/nfc.c
new file mode 100755 (executable)
index 0000000..329ebe6
--- /dev/null
+++ b/src/nfc.c
@@ -0,0 +1,1182 @@
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. 
+*/
+#include <net_nfc.h>
+#include <net_nfc_typedef_private.h>
+#include <dlog.h>
+#include <nfc.h>
+#include <nfc_private.h>
+#include <net_nfc_exchanger.h>
+
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NFC"
+
+
+static int _return_invalid_param(const char *func){
+       LOGE( "[%s] INVALID_PARAMETER (0x%08x)",func, NFC_ERROR_INVALID_PARAMETER);
+       return NFC_ERROR_INVALID_PARAMETER;
+}
+
+static int _convert_error_code(const char *func, int native_error_code)
+{
+       int error_code = NFC_ERROR_NONE;
+       char * errorstr = NULL;
+       switch(native_error_code){
+               case 0 :
+                       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";
+                       break;
+
+               case NET_NFC_UNKNOWN_ERROR:
+               case NET_NFC_THREAD_CREATE_FAIL:
+               case NET_NFC_INVALID_STATE:
+               case NET_NFC_IPC_FAIL:
+               case NET_NFC_BUFFER_TOO_SMALL:
+               case NET_NFC_COMMUNICATE_WITH_CONTROLLER_FAILED:
+               case NET_NFC_RF_ERROR:
+               case NET_NFC_NOT_SUPPORTED:
+               case NET_NFC_TAG_READ_FAILED:
+               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_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";                 
+                       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:                     
+                       error_code = NFC_ERROR_INVALID_PARAMETER;
+                       errorstr  = "INVALID_PARAMETER";                        
+                       break;
+               case NET_NFC_NDEF_RECORD_IS_NOT_EXPECTED_TYPE:
+                       error_code = NFC_ERROR_INVALID_RECORD_TYPE;
+                       errorstr  = "INVALID_RECORD_TYPE";
+                       break;
+
+               case NET_NFC_ALREADY_INITIALIZED:
+               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";
+                       break;
+               case NET_NFC_INVALID_FORMAT:
+               case NET_NFC_NDEF_TYPE_LENGTH_IS_NOT_OK:
+               case NET_NFC_NDEF_ID_LENGTH_IS_NOT_OK:
+               case NET_NFC_NDEF_BUF_END_WITHOUT_ME:
+               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;                  
+               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;
+
+
+
+void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, void* data, void* user_param, void * trans_data)
+{
+       LOGI("[%s] message %d - start", __func__, message);
+
+       int capi_result = _convert_error_code("EVENT", result);
+
+       switch ( message ){
+               case NET_NFC_MESSAGE_TRANSCEIVE:
+               {
+                       if( trans_data != NULL ){
+                               _async_callback_data *user_cb = (_async_callback_data*)trans_data;
+                               
+                               if( user_cb->callback_type == _NFC_CALLBACK_TYPE_DATA ){
+                                       unsigned char * buffer = NULL;
+                                       int buffer_size = 0;                                    
+                                       if( result == 0 && data != NULL){
+                                               data_s *arg = (data_s*) data;
+                                               buffer = arg->buffer;
+                                               buffer_size = arg->length;
+                                       }                                                       
+                                       void (* data_type_callback)(int result , unsigned char * buffer, int buffer_size,  void * user_data); 
+                                       data_type_callback = user_cb->callback;
+                                       data_type_callback(capi_result, buffer, buffer_size, user_cb->user_data);
+                               }else if ( user_cb->callback_type == _NFC_CALLBACK_TYPE_RESULT){
+                                       void (* result_type_callback)(int result , void * user_data); 
+                                       result_type_callback = user_cb->callback;
+                                       result_type_callback(capi_result, user_cb->user_data);
+                               }
+                               free(user_cb);
+                       }
+                       break;
+               }
+               case NET_NFC_MESSAGE_READ_NDEF:
+               {
+                       if( trans_data != NULL ) {
+                               ndef_message_h ndef_message = (ndef_message_h)data;
+                               _async_callback_data *user_cb = (_async_callback_data*)trans_data;
+                               ((nfc_tag_read_completed_cb)user_cb->callback)(capi_result, ndef_message, user_cb->user_data);
+                               free(user_cb);
+                       }
+                       break;
+               }
+               case NET_NFC_MESSAGE_WRITE_NDEF:
+               {
+                       if( trans_data != NULL ){
+                               _async_callback_data *user_cb = (_async_callback_data*)trans_data;
+                               ((nfc_tag_write_completed_cb)user_cb->callback)(capi_result, user_cb->user_data);
+                               free(user_cb);
+                       }
+                       break;
+               }       
+               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);           
+                               }
+                               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 );
+                       }
+
+                       //ndef discovered cb
+                       if( g_nfc_context.on_ndef_discovered_cb && target_info->raw_data.buffer != NULL ){
+                               ndef_message_h ndef_message ;
+                               net_nfc_create_ndef_message_from_rawdata (&ndef_message, (data_h)&(target_info->raw_data) );
+                               g_nfc_context.on_ndef_discovered_cb(ndef_message , g_nfc_context.on_ndef_discovered_user_data);                         
+                               net_nfc_free_ndef_message(ndef_message);
+                       }
+                       break;
+               }
+               case NET_NFC_MESSAGE_NOTIFY:
+               {
+                       break;
+               }
+               case NET_NFC_MESSAGE_TAG_DETACHED:
+               {
+                       if( g_nfc_context.on_tag_discovered_cb ){
+                               g_nfc_context.on_tag_discovered_cb( NFC_DISCOVERED_TYPE_DETACHED,  (nfc_tag_h)&g_nfc_context.current_tag , g_nfc_context.on_tag_discovered_user_data );
+                       }
+
+                       net_nfc_tag_info_s* list  = g_nfc_context.current_tag.tag_info_list;
+
+                       //delete key list
+                       if(list != NULL)
+                       {
+                               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 );                                     
+                                       if(list[i].value != NULL)
+                                               net_nfc_free_data(list[i].value);
+                               }
+                               free(list);
+                       }
+                       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;
+               }
+               case NET_NFC_MESSAGE_P2P_DISCOVERED:
+               {
+                       g_nfc_context.current_target = (net_nfc_target_handle_h)data;
+                       g_nfc_context.on_p2p_recv_cb = NULL;
+                       g_nfc_context.on_p2p_recv_user_data = NULL;
+                       g_nfc_context.on_p2p_send_completed_cb = NULL;
+                       g_nfc_context.on_p2p_send_completed_user_data = NULL;
+
+                       if( g_nfc_context.on_p2p_discovered_cb ){
+                               g_nfc_context.on_p2p_discovered_cb(NFC_DISCOVERED_TYPE_ATTACHED , (nfc_p2p_target_h)g_nfc_context.current_target, g_nfc_context.on_p2p_discovered_user_data );
+                       }
+                       
+                       break;
+               }
+               case NET_NFC_MESSAGE_P2P_DETACHED:                      
+               {
+                       if( g_nfc_context.on_p2p_discovered_cb ){
+                               g_nfc_context.on_p2p_discovered_cb( NFC_DISCOVERED_TYPE_DETACHED,  (nfc_p2p_target_h)(g_nfc_context.current_target) , g_nfc_context.on_p2p_discovered_user_data );
+                       }
+                       memset(&g_nfc_context.current_target , 0 , sizeof( g_nfc_context.current_target ));
+                       g_nfc_context.on_p2p_recv_cb = NULL;
+                       g_nfc_context.on_p2p_recv_user_data = NULL;
+                       g_nfc_context.on_p2p_send_completed_cb = NULL;
+                       g_nfc_context.on_p2p_send_completed_user_data = NULL;
+                       
+                       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 );
+                               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_RECEIVE :
+               {
+                       if( g_nfc_context.on_p2p_recv_cb != NULL ){
+                               ndef_message_h ndef_message ;
+                               net_nfc_create_ndef_message_from_rawdata (&ndef_message, (data_h)(data) );
+                               g_nfc_context.on_p2p_recv_cb( (nfc_p2p_target_h)(g_nfc_context.current_target) , ndef_message ,g_nfc_context.on_p2p_recv_user_data );
+                               net_nfc_free_ndef_message(ndef_message);
+                       }
+                       
+                       break;
+               }
+               case NET_NFC_MESSAGE_FORMAT_NDEF:
+               {
+                       if( trans_data != NULL) {
+                               _async_callback_data *user_cb = (_async_callback_data*)trans_data;
+                               ((nfc_tag_format_completed_cb)user_cb->callback)(capi_result, user_cb->user_data);
+                               free(user_cb);
+                       }                               
+                       break;
+               }
+               case NET_NFC_MESSAGE_SE_START_TRANSACTION :
+               case NET_NFC_MESSAGE_SE_END_TRANSACTION :
+               case NET_NFC_MESSAGE_SE_CONNECTIVITY :
+               case NET_NFC_MESSAGE_SE_FIELD_ON :
+               case NET_NFC_MESSAGE_SE_FIELD_OFF :
+               {
+                       nfc_se_event_e event = NFC_SE_EVENT_START_TRANSACTION;
+                       switch( message ){
+                               case NET_NFC_MESSAGE_SE_START_TRANSACTION:
+                                       event = NFC_SE_EVENT_START_TRANSACTION;
+                                       break;
+                               case NET_NFC_MESSAGE_SE_END_TRANSACTION:
+                                       event = NFC_SE_EVENT_END_TRANSACTION;
+                                       break;
+                               case NET_NFC_MESSAGE_SE_CONNECTIVITY:
+                                       event = NFC_SE_EVENT_CONNECTIVITY;
+                                       break;
+                               case NET_NFC_MESSAGE_SE_FIELD_ON :
+                                       event = NFC_SE_EVENT_FIELD_ON;
+                                       break;
+                               case NET_NFC_MESSAGE_SE_FIELD_OFF :
+                                       event = NFC_SE_EVENT_FIELD_OFF;
+                                       break;
+                               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);
+                       }                       
+               }
+               
+               default :
+                       break;
+       }
+       
+}
+
+int nfc_manager_initialize (void)
+{
+       int ret;
+       ret = net_nfc_initialize();
+       if( ret != NFC_ERROR_NONE )
+               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);     
+       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);
+}
+
+int nfc_manager_set_tag_discovered_cb( nfc_tag_discovered_cb callback , void * user_data)
+{
+       if( callback == NULL)
+               return _return_invalid_param(__func__);
+       g_nfc_context.on_tag_discovered_cb = callback;
+       g_nfc_context.on_tag_discovered_user_data = user_data;
+       return 0;       
+}
+void nfc_manager_unset_tag_discovered_cb( void )
+{
+       g_nfc_context.on_tag_discovered_cb = NULL;
+       g_nfc_context.on_tag_discovered_user_data = NULL;
+}
+
+int nfc_manager_set_ndef_discovered_cb( nfc_ndef_discovered_cb callback , void *user_data)
+{
+       if( callback == NULL)
+               return _return_invalid_param(__func__);
+       g_nfc_context.on_ndef_discovered_cb= callback;
+       g_nfc_context.on_ndef_discovered_user_data= user_data;
+       return 0;       
+}
+
+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;
+}
+
+
+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_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);      
+}
+
+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__); 
+       int ret;
+       ret = net_nfc_create_text_type_record((ndef_record_h*)record, text, lang_code, encode);
+       return _convert_error_code(__func__, ret);              
+}
+int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char* uri)
+{
+       
+       if(record == NULL ||  uri == NULL)
+               return _return_invalid_param(__func__); 
+       int ret;
+       ret = net_nfc_create_uri_type_record((ndef_record_h*)record , uri , NET_NFC_SCHEMA_FULL_URI);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_create_mime(nfc_ndef_record_h* record, const char * mime_type , const unsigned char * data , int data_size)
+{
+       if(record == NULL ||  mime_type == NULL || data == NULL)
+               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;   
+       if( nfc_ndef_record_get_tnf(record, &tnf ) != 0 || tnf != NFC_RECORD_TNF_MIME_MEDIA ){
+               return NFC_ERROR_INVALID_RECORD_TYPE;   
+       }
+
+       ret = nfc_ndef_record_get_type(record,&typename, &length);
+       if( ret != 0 )
+               return _convert_error_code(__func__, ret);
+       
+       *mime_type = malloc(length+1);
+       if( *mime_type == NULL ){
+               LOGE( "[%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;       
+}
+
+
+int nfc_ndef_record_destroy(nfc_ndef_record_h record)
+{
+       
+       if(record == NULL  )
+               return _return_invalid_param(__func__); 
+       int ret;
+       ret = net_nfc_free_record(record);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_set_id (nfc_ndef_record_h record, unsigned char *id , int id_size)
+{
+       
+       if(record == NULL ||  id == NULL )
+               return _return_invalid_param(__func__); 
+       int ret;
+       data_s id_data = {id, id_size};
+       ret = net_nfc_set_record_id(record, (data_h)&id_data);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_payload (nfc_ndef_record_h record, unsigned char ** payload, int *size)
+{
+       
+       if(record == NULL ||  payload == NULL || size == NULL )
+               return _return_invalid_param(__func__); 
+       int ret ;
+       data_s *payload_data;
+       ret = net_nfc_get_record_payload(record, (data_h*)&payload_data);
+       if( ret == 0){
+               *payload = payload_data->buffer;
+               *size = payload_data->length;
+       }
+       return _convert_error_code(__func__, ret);
+}
+
+
+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);
+       if( ret == 0){
+               *type = type_data->buffer;
+               *size = type_data->length;
+       }
+       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);
+       if( ret == 0){
+               *id = id_data->buffer;
+               *size = id_data->length;
+       }
+       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__); 
+       int ret;
+       ret = net_nfc_get_record_tnf(record, (net_nfc_record_tnf_e*)tnf);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_text(nfc_ndef_record_h record, char** buffer)
+{
+       
+       if(record == NULL ||  buffer == NULL)
+               return _return_invalid_param(__func__); 
+       int ret;
+       ret = net_nfc_create_text_string_from_text_record(record, buffer);
+       return _convert_error_code(__func__, ret);
+}
+
+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__); 
+       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__); 
+       int ret=0;
+       ret = net_nfc_get_encoding_type_from_text_record(record, (net_nfc_encode_type_e*)encode);
+//     if( ret == NFC_NDEF_RECORD_IS_NOT_EXPECTED_TYPE)
+//             LOGE("%s reord type is not text type"); 
+       return _convert_error_code(__func__, ret);      
+}
+int nfc_ndef_record_get_uri(nfc_ndef_record_h record , char **uri)
+{
+       
+       if(record == NULL ||  uri == NULL  )
+               return _return_invalid_param(__func__); 
+       int ret=0;
+       ret = net_nfc_create_uri_string_from_uri_record(record, uri);   
+       return _convert_error_code(__func__, ret);
+}
+
+
+int nfc_ndef_message_create(nfc_ndef_message_h* ndef_message)
+{
+       
+       if( ndef_message == NULL )
+               return _return_invalid_param(__func__);
+       int ret=0;
+       ret = net_nfc_create_ndef_message(ndef_message);
+       return _convert_error_code(__func__, ret);
+}
+
+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__); 
+       int ret=0;
+       data_s rawdata_data = {(unsigned char *)rawdata, rawdata_size};
+       ret = net_nfc_create_ndef_message_from_rawdata((ndef_message_h*)ndef_message , (data_h)&rawdata_data);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message)
+{
+       
+       if( ndef_message == NULL )
+               return _return_invalid_param(__func__); 
+       int ret=0;
+       ret = net_nfc_free_ndef_message(ndef_message);
+       return _convert_error_code(__func__, ret);
+}
+
+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__); 
+       int ret=0;
+       ret = net_nfc_get_ndef_message_record_count(ndef_message , count);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message , unsigned char ** rawdata , int *rawdata_size)
+{
+       
+       if( ndef_message == NULL || rawdata == NULL || rawdata_size == NULL)
+               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);
+       if( ret == 0 )
+       {
+               *rawdata = rawdata_data->buffer;
+               *rawdata_size = rawdata_data->length;
+       }
+       return _convert_error_code(__func__, ret);
+}
+
+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__); 
+       int ret=0;
+       ret = net_nfc_get_ndef_message_byte_length(ndef_message , byte_size);
+       return _convert_error_code(__func__, ret);
+}
+
+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__); 
+       int ret=0;
+       ret = net_nfc_append_record_to_ndef_message(ndef_message , record );
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message , int index, nfc_ndef_record_h record)
+{
+       
+       if( ndef_message == NULL || record == NULL )
+               return _return_invalid_param(__func__); 
+       int ret=0;
+       ret = net_nfc_append_record_by_index(ndef_message , index , record);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message , int index)
+{
+       
+       if( ndef_message == NULL )
+               return _return_invalid_param(__func__); 
+       int ret=0;
+       ret = net_nfc_remove_record_by_index(ndef_message , index);
+       return _convert_error_code(__func__, ret);
+}
+
+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__); 
+       int ret=0;
+       ret = net_nfc_get_record_by_index(ndef_message , index , (ndef_record_h*)record);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_get_type( nfc_tag_h tag , nfc_tag_type_e *type)
+{
+       
+       if( tag == NULL || type == NULL)
+               return _return_invalid_param(__func__); 
+       int ret=0;
+       ret = net_nfc_get_tag_type( tag, (net_nfc_target_type_e*) type);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_is_support_ndef(nfc_tag_h tag, bool * is_support)
+{
+       
+       if( tag == NULL || is_support== NULL)
+               return _return_invalid_param(__func__);         
+       int ret=0;
+       ret = net_nfc_get_tag_ndef_support(tag , is_support);
+       return _convert_error_code(__func__, ret);
+}
+
+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__);         
+       int ret=0;
+       ret = net_nfc_get_tag_max_data_size(tag , max_size);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int * actual_data_size)
+{
+       
+       if( tag == NULL || actual_data_size == NULL)
+               return _return_invalid_param(__func__);         
+       int ret=0;
+       ret = net_nfc_get_tag_actual_data_size(tag , actual_data_size);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_foreach_information(nfc_tag_h tag , nfc_tag_information_cb callback , void * user_data ){
+       char **keys;
+       int number_of_keys;
+       int i;
+       int ret ;
+
+       if( tag == NULL || callback == NULL )
+               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);
+
+       for( i = 0 ; i < number_of_keys ; i++){
+               data_s *tmpdata;
+               ret = net_nfc_get_tag_info_value( tag, keys[i], (data_h*)&tmpdata);
+               if( ret == 0 ){
+                       bool cont;
+                       cont = callback(keys[i], tmpdata->buffer, tmpdata->length, user_data);
+                       if( !cont )
+                               break;
+               }
+       }
+
+       //free(keys);
+
+       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__);         
+       int ret=0;
+       data_s rawdata = { buffer, buffer_size };
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+       
+       
+       _async_callback_data * trans_data = NULL;
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+               trans_data->callback_type = _NFC_CALLBACK_TYPE_DATA;
+       }               
+       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__);                 
+       int ret=0;
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+       
+       
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;         
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+       }               
+       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__);                 
+       int ret=0;
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+       
+       
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;         
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+       }               
+       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__);                 
+       data_s key_data = { key, key_size };
+       int ret=0;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+               
+       _async_callback_data * trans_data = NULL;
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;         
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+       }
+       
+       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__);                 
+       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;         
+               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);      
+}
+
+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__);                 
+       data_s auth_key_data = { auth_key , 6};
+       int ret = 0;
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+               
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;         
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       }
+       
+       ret = net_nfc_mifare_authenticate_with_keyB( (net_nfc_target_handle_h)tag_info->handle, sector_index, (data_h)&auth_key_data, trans_data);
+       return _convert_error_code(__func__, ret);      
+}
+
+int nfc_mifare_read_block(nfc_tag_h tag, int block_index, nfc_mifare_read_block_completed_cb callback, void *user_data)
+{
+       
+       if( tag == NULL )
+               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;         
+               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);      
+}
+
+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);     
+}
+
+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__);                 
+       int ret = 0;
+       data_s block_data = { buffer , buffer_size};
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+               
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;         
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       }
+       
+       ret = net_nfc_mifare_write_block( (net_nfc_target_handle_h)tag_info->handle, block_index, (data_h)&block_data, trans_data);
+       return _convert_error_code(__func__, ret);      
+}
+
+int nfc_mifare_write_page(nfc_tag_h tag, int page_index, unsigned char* buffer, int buffer_size, nfc_mifare_write_block_completed_cb callback, void* user_data)
+{
+       
+       if( tag == NULL )
+               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;         
+               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);      
+}
+
+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__);                 
+       int ret = 0;
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+               
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;         
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       }
+       
+       ret = net_nfc_mifare_increment( (net_nfc_target_handle_h)tag_info->handle, block_index,value, trans_data);
+       return _convert_error_code(__func__, ret);      
+
+}
+
+int nfc_mifare_decrement(nfc_tag_h tag, int block_index, int value, nfc_mifare_decrement_completed_cb callback, void *user_data)
+{
+       
+       if( tag == NULL )
+               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;         
+               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);      
+}
+
+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__);                 
+       int ret = 0;
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+       
+       
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;         
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       }
+       
+       ret = net_nfc_mifare_transfer( (net_nfc_target_handle_h)tag_info->handle, block_index, trans_data);
+       return _convert_error_code(__func__, ret);      
+}
+
+int nfc_mifare_restore(nfc_tag_h tag, int block_index, nfc_mifare_restore_completed_cb callback, void *user_data)
+{
+       
+       if( tag == NULL )
+               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;         
+               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);              
+}
+
+
+
+
+int nfc_p2p_send(nfc_p2p_target_h target , nfc_ndef_message_h message , nfc_p2p_send_completed_cb callback, void *user_data){
+       int ret;
+       if( target == NULL || message == NULL  )
+               return _return_invalid_param(__func__);
+
+       net_nfc_exchanger_data_h data_handle;
+       data_h rawdata;
+       net_nfc_create_rawdata_from_ndef_message(message, &rawdata);
+       ret = net_nfc_create_exchanger_data(&data_handle,  rawdata);
+       net_nfc_free_data(rawdata);
+
+       
+       if( ret != 0)
+               return _convert_error_code(__func__, ret);
+
+       ret = net_nfc_send_exchanger_data(data_handle ,(net_nfc_target_handle_h)target);
+
+       if( ret != 0 ){
+               net_nfc_free_exchanger_data(data_handle);
+               return _convert_error_code(__func__, ret);
+       }
+
+       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_set_data_received_cb(nfc_p2p_target_h target, nfc_p2p_data_recived_cb callback, void *user_data){
+       if( target == NULL || callback == NULL )
+               return _return_invalid_param(__func__);
+
+//     if( g_nfc_context.current_target.connection_id != ((net_nfc_target_handle_s*)target)->connection_id )
+       if(g_nfc_context.current_target != target ) 
+               return _return_invalid_param(__func__);
+       
+       g_nfc_context.on_p2p_recv_cb = callback;
+       g_nfc_context.on_p2p_recv_user_data = user_data;
+       return 0;
+}
+
+int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target){
+       if( target == NULL )
+               return _return_invalid_param(__func__);
+
+//     if( g_nfc_context.current_target.connection_id != ((net_nfc_target_handle_s*)target)->connection_id )
+       if(g_nfc_context.current_target != target ) 
+               return _return_invalid_param(__func__);
+
+       g_nfc_context.on_p2p_recv_cb = NULL;
+       g_nfc_context.on_p2p_recv_user_data = NULL;
+       return 0;       
+}
+
+
+
+
+int nfc_manager_set_p2p_target_discovered_cb( nfc_p2p_target_discovered_cb callback , void *user_data){
+       if( callback == NULL )
+               return _return_invalid_param(__func__);
+       g_nfc_context.on_p2p_discovered_cb = callback;
+       g_nfc_context.on_p2p_discovered_user_data = user_data;
+       return 0;
+}
+
+void nfc_manager_unset_p2p_target_discovered_cb( void ){
+       g_nfc_context.on_p2p_discovered_cb = NULL;
+       g_nfc_context.on_p2p_discovered_user_data = NULL;       
+}
+
+
+
+int nfc_manager_set_se_event_cb(nfc_se_event_cb callback, void *user_data){
+       if( callback == NULL )
+               return _return_invalid_param(__func__);
+       g_nfc_context.on_se_event_cb = callback;
+       g_nfc_context.on_se_event_user_data = user_data;
+       return 0;
+}
+
+void nfc_manager_unset_se_event_cb(void){
+       g_nfc_context.on_se_event_cb = NULL;
+       g_nfc_context.on_se_event_user_data = NULL;     
+}
+
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100755 (executable)
index 0000000..20a03af
--- /dev/null
@@ -0,0 +1,21 @@
+SET(fw_test "${fw_name}-test")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_test} REQUIRED nfc-common-lib nfc dlog elementary evas ecore)
+FOREACH(flag ${${fw_test}_CFLAGS})
+    SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+    MESSAGE(${flag})
+ENDFOREACH()
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
+
+#ADD_EXECUTABLE("system-sensor" system-sensor.c)
+#TARGET_LINK_LIBRARIES("system-sensor" ${fw_name} ${${fw_test}_LDFLAGS})
+
+aux_source_directory(. sources)
+FOREACH(src ${sources})
+    GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
+    MESSAGE("${src_name}")
+    ADD_EXECUTABLE(${src_name} ${src})
+    TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS})
+ENDFOREACH()
diff --git a/test/network_nfc_test.c b/test/network_nfc_test.c
new file mode 100755 (executable)
index 0000000..2499052
--- /dev/null
@@ -0,0 +1,447 @@
+/*
+* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License. 
+*/
+
+#include <Elementary.h>
+#include <Ecore.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <nfc.h>
+#include <pthread.h>
+#include <time.h>
+#include <unistd.h>
+
+pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
+
+int is_terminate = 0;
+int timeout_counter;
+int success;
+
+
+Eina_Bool timeout_handler(void *data){
+       if( timeout_counter == 0 ){
+               is_terminate = 1;
+               printf("Fail, timeout!\n");
+               return 0;
+       }
+       timeout_counter--;
+
+       if( success )
+               return 0;
+
+       return 1;
+}
+
+int print_result(const char * func, int error )
+{
+       printf("%s ret = %x\n", func , error);
+       if( error != 0 )
+               return -1;
+       return 0;
+}
+
+char *byteToString(unsigned char* buffer, int size){
+       static char localbuffer[255];
+       memset(localbuffer, 0, 255);
+       memcpy(localbuffer, buffer, size);
+       return localbuffer;     
+}
+
+void print_ndef_message(nfc_ndef_message_h message){
+       char *tnf_tbl[] = {
+                       "NFC_RECORD_TNF_EMPTY", 
+                       "NFC_RECORD_TNF_WELL_KNOWN",
+                       "NFC_RECORD_TNF_MIME_MEDIA",
+                       "NFC_RECORD_TNF_URI",
+                       "NFC_RECORD_TNF_EXTERNAL_RTD",
+                       "NFC_RECORD_TNF_UNKNOWN",
+                       "NFC_RECORD_TNF_UNCHAGNED"
+               };
+       nfc_record_tnf_e tnf;
+       unsigned char *type;
+       int type_size;
+       unsigned char *payload;
+       int payload_size;
+       nfc_ndef_record_h record;
+       int ret;
+
+       ret = nfc_ndef_message_get_record(message, 0 , &record);
+       if( ret != 0 ){
+               printf("can't found NDEF Record\n");
+               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)    );      
+
+       if( tnf == NFC_RECORD_TNF_WELL_KNOWN && type[0] == 'U' ){
+               char *uri;
+               nfc_ndef_record_get_uri(record, &uri);
+               printf("uri \t: %s\n", uri);
+               free(uri);
+       }
+
+       if( tnf == NFC_RECORD_TNF_WELL_KNOWN && type[0] == 'T' ){
+               char *text;
+               nfc_ndef_record_get_text(record, &text);
+               printf("text \t: %s\n", text);
+               free(text);
+               nfc_ndef_record_get_langcode(record , &text);
+               printf("langcode : %s\n", text);
+               free(text);
+       }
+       
+}
+
+
+int ndef_record_create_test(){
+       int ret=0;
+       char *tnf_tbl[] = {
+                       "NFC_RECORD_TNF_EMPTY", 
+                       "NFC_RECORD_TNF_WELL_KNOWN",
+                       "NFC_RECORD_TNF_MIME_MEDIA",
+                       "NFC_RECORD_TNF_URI",
+                       "NFC_RECORD_TNF_EXTERNAL_RTD",
+                       "NFC_RECORD_TNF_UNKNOWN",
+                       "NFC_RECORD_TNF_UNCHAGNED"
+               };
+       nfc_ndef_record_h record1;
+       nfc_record_tnf_e tnf;
+       unsigned char *type;
+       int type_size;
+       unsigned char *id;
+       int id_size;
+       unsigned char *payload;
+       int payload_size;
+       
+       char *strp = NULL;
+       char *strp2 = NULL;     
+       
+
+       printf("---------------------------------------------------\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_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)    );              
+       
+       nfc_ndef_record_destroy(record1);
+       
+       printf("\n");
+
+       strp = NULL;
+       ret = nfc_ndef_record_create_mime(&record1, "text/plain", (unsigned char*)"the text record", sizeof("the text record"));
+       print_result("nfc_ndef_record_create_mime" , ret);
+
+       nfc_ndef_record_get_tnf(record1, &tnf);
+       nfc_ndef_record_get_mime_type(record1 , &strp);
+       nfc_ndef_record_get_type(record1, &type, &type_size);
+       nfc_ndef_record_get_payload(record1, &payload, &payload_size);
+
+       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)    );              
+
+
+       nfc_ndef_record_destroy(record1);
+       free(strp);
+       
+       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);
+       nfc_ndef_record_get_text(record1, &strp);
+       nfc_ndef_record_get_langcode(record1, &strp2);
+
+       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("text \t: %s\n", strp);
+       printf("langcode: %s\n", strp2);
+       nfc_ndef_record_destroy(record1);
+       free(strp);
+       free(strp2);
+       
+       printf("\n");   
+       
+       ret = nfc_ndef_record_create_uri(&record1,"http://samsung.com");
+       print_result("nfc_ndef_record_create_uri" , 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);
+       nfc_ndef_record_get_uri(record1, &strp);
+
+       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("uri \t: %s\n", strp);
+
+       nfc_ndef_record_destroy(record1);
+       free(strp);
+       
+       printf("\n");   
+
+       
+       ret = nfc_ndef_record_create_uri(&record1,"http://samsung.com");
+       print_result("nfc_ndef_record_create_uri" , ret);
+
+       ret = nfc_ndef_record_get_mime_type(record1, &strp);
+       print_result("nfc_ndef_record_get_mime_type" , ret);
+       ret = nfc_ndef_record_get_text(record1,&strp);
+       print_result("nfc_ndef_record_get_text" , ret);
+       ret = nfc_ndef_record_get_langcode(record1,&strp);
+       print_result("nfc_ndef_record_get_langcode" , ret);
+       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;
+       
+}
+
+
+
+void _ndef_discovered_cb(nfc_ndef_message_h message, void * user_data){
+       printf("Discovered NDEF Message!\n");
+       print_ndef_message(message);
+       success = 1;
+       is_terminate = 1;
+}
+
+void read_ndef_from_tag_using_ndef_discovered(){
+       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;   
+       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;
+               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);              
+       }
+}
+
+
+void write_ndef_to_tag(){
+       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;   
+       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);
+       printf("Send Request!\n");
+       timeout_counter =30;
+       nfc_p2p_send(target, message , _send_completed_cb, NULL);
+       nfc_ndef_message_destroy(message);
+       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(){
+       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 _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;   
+       is_terminate = 1;
+}
+
+
+void _target_discovered_cb2(nfc_discovered_type_e type, nfc_p2p_target_h target, void * user_data){
+       if( type == NFC_DISCOVERED_TYPE_ATTACHED){
+               printf("Discovered new target!\n");
+               printf("I wait a new Message.......\n");
+               timeout_counter = 30;
+               nfc_p2p_set_data_received_cb(target, _p2p_recv_cb,NULL);
+       }else{
+               printf("Peer target is detached!!!!\n");
+       }
+}
+
+
+void recv_ndef_from_peer(){
+       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);
+       
+}
+
+
+
+Eina_Bool check_terminate(void *data){
+       if( is_terminate ){
+               nfc_manager_deinitialize();
+               elm_exit();
+               return 0;
+       }
+       return 1;
+}
+
+
+char *menu = 
+       "------------------\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"
+       "------------------\n"
+       ">";
+       
+
+
+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 'a':
+                       ndef_record_create_test();                      
+                       break;
+               case 'b':
+                       read_ndef_from_tag_using_ndef_discovered();
+                       break;          
+               case 'c':
+                       write_ndef_to_tag();
+                       break;
+               case 'd':
+                       send_ndef_to_peer();
+                       break;
+               case 'e':
+                       recv_ndef_from_peer();
+                       break;                  
+               default:
+                       printf("wrong selection!\n");
+                       is_terminate = 1;
+       }
+
+       
+               
+       ecore_timer_add(1, check_terminate, NULL);
+
+       elm_run();
+       elm_shutdown();
+       
+
+       return 0;
+}