Initialize Tizen 2.3 2.3a_release submit/tizen_2.3/20140531.063057
authorSehong Na <sehong.na@samsung.com>
Sat, 31 May 2014 03:33:59 +0000 (12:33 +0900)
committerSehong Na <sehong.na@samsung.com>
Sat, 31 May 2014 03:33:59 +0000 (12:33 +0900)
36 files changed:
AUTHORS [new file with mode: 0644]
CMakeLists.txt [new file with mode: 0644]
LICENSE.APLv2 [new file with mode: 0644]
NOTICE [new file with mode: 0644]
TC/_export_env.sh [new file with mode: 0755]
TC/_export_target_env.sh [new file with mode: 0755]
TC/build.sh [new file with mode: 0755]
TC/clean.sh [new file with mode: 0755]
TC/config.default [new file with mode: 0644]
TC/execute.sh [new file with mode: 0755]
TC/testcase/Makefile [new file with mode: 0755]
TC/testcase/tslist [new file with mode: 0755]
TC/testcase/utc_network_nfc.c [new file with mode: 0755]
TC/testcase/utc_network_nfc_ndef_message.c [new file with mode: 0755]
TC/testcase/utc_network_nfc_ndef_record.c [new file with mode: 0755]
TC/tet_scen [new file with mode: 0755]
TC/tetbuild.cfg [new file with mode: 0644]
TC/tetclean.cfg [new file with mode: 0644]
TC/tetexec.cfg [new file with mode: 0644]
capi-network-nfc.manifest [new file with mode: 0644]
capi-network-nfc.pc.in [new file with mode: 0644]
debian/README [new file with mode: 0644]
debian/capi-network-nfc-dev.install [new file with mode: 0644]
debian/capi-network-nfc-dev.postinst [new file with mode: 0644]
debian/capi-network-nfc.install [new file with mode: 0644]
debian/capi-network-nfc.postinst [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
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: 0644]
src/nfc.c [new file with mode: 0755]
test/CMakeLists.txt [new file with mode: 0644]
test/network_nfc_test.c [new file with mode: 0755]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..9596a93
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,9 @@
+Lee Sangsoo <constant.lee at samsung dot com>
+Junyong Sim <junyong.sim at samsung dot com>
+Wonkyu Kwon <wonkyu.kwon at samsung dot com>
+Sungjae Lim <neueziel.lim at samsung dot com>
+Sechang Sohn <sc.sohn at samsung dot com>
+Jinmin Chung <jinmin at samsung dot com>
+Jaekyun Lee <jkyun.lee at samsung dot com>
+Seungkeun Lee <sngn.lee at samsung dot com>
+Kangho Hur <kanho.hur at samsung dot com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644 (file)
index 0000000..ae7c612
--- /dev/null
@@ -0,0 +1,121 @@
+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.3")
+SET(maintainer "Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>")
+SET(description "A NFC library in Tizen Native API")
+SET(service "network")
+SET(submodule "nfc")
+
+# for package file
+SET(dependents "dlog glib-2.0 nfc-common-lib nfc capi-base-common vconf ecore-x")
+SET(pc_dependents "capi-base-common")
+
+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=${LIB_INSTALL_DIR}")
+
+SET(SOURCES src/nfc.c)
+
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+SET_TARGET_PROPERTIES(${fw_name}
+     PROPERTIES
+     VERSION ${FULLVER}
+     SOVERSION ${MAJORVER}
+     CLEAN_DIRECT_OUTPUT 1
+)
+
+INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
+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 ${pc_dependents})
+SET(PC_LDFLAGS -l${fw_name})
+
+CONFIGURE_FILE(
+    ${fw_name}.pc.in
+    ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+    @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+
+#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.APLv2 b/LICENSE.APLv2
new file mode 100644 (file)
index 0000000..ec68963
--- /dev/null
@@ -0,0 +1,206 @@
+Copyright (c) 2000 - 2012 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/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..0e0f016
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE.APLv2 file for Apache License terms and conditions.
diff --git a/TC/_export_env.sh b/TC/_export_env.sh
new file mode 100755 (executable)
index 0000000..72a11ec
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh
new file mode 100755 (executable)
index 0000000..5ddaa53
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/build.sh b/TC/build.sh
new file mode 100755 (executable)
index 0000000..72aad6c
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. ./_export_env.sh                              # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/clean.sh b/TC/clean.sh
new file mode 100755 (executable)
index 0000000..29743e0
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. ./_export_env.sh                              # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+RESULT_DIR=results
+
+tcc -c -p ./                                # executing tcc, with clean option (-c)
+rm -r $RESULT_DIR
+rm -r tet_tmp_dir
+rm testcase/tet_captured
diff --git a/TC/config.default b/TC/config.default
new file mode 100644 (file)
index 0000000..12ac1e2
--- /dev/null
@@ -0,0 +1,3 @@
+CAPI_PROJECT_ROOT=/home/abyss/capi
+TET_INSTALL_HOST_PATH=/home/abyss/TETware
+TET_INSTALL_TARGET_PATH=/mnt/nfs/TETware
diff --git a/TC/execute.sh b/TC/execute.sh
new file mode 100755 (executable)
index 0000000..a4f6095
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+. ./_export_target_env.sh                    # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile
new file mode 100755 (executable)
index 0000000..afde4ee
--- /dev/null
@@ -0,0 +1,24 @@
+CC ?= gcc
+
+C_FILES = $(shell ls *.c)
+       
+PKGS = capi-network-nfc
+
+LDFLAGS = `pkg-config --libs $(PKGS)`
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+TCS := $(shell ls -1 *.c | cut -d. -f1)
+
+all: $(TCS)
+
+%: %.c
+       $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+       rm -f $(TCS)
diff --git a/TC/testcase/tslist b/TC/testcase/tslist
new file mode 100755 (executable)
index 0000000..0571a2c
--- /dev/null
@@ -0,0 +1,4 @@
+/testcase/utc_network_nfc_ndef_record
+/testcase/utc_network_nfc_ndef_message
+/testcase/utc_network_nfc
+
diff --git a/TC/testcase/utc_network_nfc.c b/TC/testcase/utc_network_nfc.c
new file mode 100755 (executable)
index 0000000..d42271d
--- /dev/null
@@ -0,0 +1,309 @@
+/*
+* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <tet_api.h>
+#include <nfc.h>
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+#define MY_ASSERT( fun , test , msg ) \
+{\
+       if( !test ) \
+               dts_fail(fun , msg ); \
+}
+
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void nfc_manager_set_activation_changed_cb_p(void);
+static void nfc_manager_set_activation_changed_cb_n(void);
+static void nfc_manager_set_activation_p(void);
+static void nfc_manager_set_activation_n(void);
+static void nfc_manager_initialize_p(void);
+static void nfc_manager_initialize_n(void);
+static void nfc_manager_deinitialize_p(void);
+static void nfc_manager_deinitialize_n(void);
+static void nfc_manager_set_tag_discovered_cb_p(void);
+static void nfc_manager_set_tag_discovered_cb_n(void);
+static void nfc_manager_set_ndef_discovered_cb_p(void);
+static void nfc_manager_set_ndef_discovered_cb_n(void);
+static void nfc_manager_set_p2p_target_discovered_cb_p(void);
+static void nfc_manager_set_p2p_target_discovered_cb_n(void);
+static void nfc_manager_set_se_event_cb_p(void);
+static void nfc_manager_set_se_event_cb_n(void);
+static void nfc_manager_set_se_transaction_event_cb_p(void);
+static void nfc_manager_set_se_transaction_event_cb_n(void);
+static void nfc_manager_set_system_handler_enable_p(void);
+static void nfc_manager_set_system_handler_enable_n(void);
+
+
+void _activation_changed_cb(bool activated , void *user_data);
+void _activation_completed_cb(int error, void *user_data);
+void utc_test_cb(void * user_data);
+
+
+
+
+
+struct tet_testlist tet_testlist[] = {
+       { nfc_manager_set_activation_changed_cb_p , POSITIVE_TC_IDX },
+       { nfc_manager_set_activation_changed_cb_n , NEGATIVE_TC_IDX },
+       { nfc_manager_set_activation_p , POSITIVE_TC_IDX },
+       { nfc_manager_set_activation_n , NEGATIVE_TC_IDX },
+       { nfc_manager_initialize_p , POSITIVE_TC_IDX },
+       { nfc_manager_initialize_n , NEGATIVE_TC_IDX },
+       { nfc_manager_deinitialize_p , POSITIVE_TC_IDX },
+       { nfc_manager_deinitialize_n , NEGATIVE_TC_IDX },
+       { nfc_manager_set_tag_discovered_cb_p , POSITIVE_TC_IDX },
+       { nfc_manager_set_tag_discovered_cb_n , NEGATIVE_TC_IDX },
+       { nfc_manager_set_ndef_discovered_cb_p , POSITIVE_TC_IDX },
+       { nfc_manager_set_ndef_discovered_cb_n , NEGATIVE_TC_IDX },
+       { nfc_manager_set_p2p_target_discovered_cb_p , POSITIVE_TC_IDX },
+       { nfc_manager_set_p2p_target_discovered_cb_n , NEGATIVE_TC_IDX },
+       { nfc_manager_set_se_event_cb_p , POSITIVE_TC_IDX },
+       { nfc_manager_set_se_event_cb_n , NEGATIVE_TC_IDX },
+       { nfc_manager_set_se_transaction_event_cb_p , POSITIVE_TC_IDX },
+       { nfc_manager_set_se_transaction_event_cb_n , NEGATIVE_TC_IDX },
+       { nfc_manager_set_system_handler_enable_p , POSITIVE_TC_IDX },
+       { nfc_manager_set_system_handler_enable_n , NEGATIVE_TC_IDX },
+
+       { NULL, 0 },
+};
+
+//this method is called only once in start
+static void startup(void)
+{
+       /* start of TC */
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+void _activation_changed_cb(bool activated , void *user_data)
+{
+       if( activated == true)
+       {
+       }
+       else if( activated == false)
+       {
+       }
+}
+
+void  _activation_completed_cb(int error, void *user_data)
+{
+       error = 0;
+       return error;
+}
+
+void utc_test_cb(void *user_data)
+{
+       return true;
+}
+
+
+static void nfc_manager_set_activation_changed_cb_p(void)
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_activation_changed_cb(_activation_changed_cb , NULL);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_activation_changed_cb_p is faild");
+}
+
+static void nfc_manager_set_activation_changed_cb_n(void)
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_activation_changed_cb(NULL , NULL);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_activation_changed_cb_n not allow null");
+}
+
+static void nfc_manager_set_activation_p()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_activation(1, _activation_completed_cb, NULL);
+
+       dts_pass(__func__, "PASS");
+}
+
+static void nfc_manager_set_activation_n()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_activation(1, NULL, NULL);
+
+       dts_pass(__func__, "PASS");
+}
+
+static void nfc_manager_initialize_p()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_initialize(NULL, NULL);
+
+       nfc_manager_deinitialize();
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_initialize_p is faild");
+}
+
+static void nfc_manager_initialize_n()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_initialize(NULL, NULL);
+
+       dts_pass(__func__, "PASS");
+}
+
+static void nfc_manager_deinitialize_p()
+{
+       int ret = NFC_ERROR_NONE;
+
+       nfc_manager_initialize(NULL, NULL);
+
+       ret = nfc_manager_deinitialize();
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_initialize_p is faild");
+}
+
+static void nfc_manager_deinitialize_n()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_deinitialize();
+
+       dts_pass(__func__, "PASS");
+}
+
+static void nfc_manager_set_tag_discovered_cb_p()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_tag_discovered_cb(utc_test_cb, NULL);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_tag_discovered_cb_p is faild");
+}
+
+static void nfc_manager_set_tag_discovered_cb_n()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_tag_discovered_cb(NULL, NULL);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_tag_discovered_cb_n not allow null");
+}
+
+static void nfc_manager_set_ndef_discovered_cb_p()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_ndef_discovered_cb(utc_test_cb , NULL);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_ndef_discovered_cb_p is faild");
+}
+
+static void nfc_manager_set_ndef_discovered_cb_n()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_ndef_discovered_cb(NULL, NULL);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_ndef_discovered_cb_n not allow null");
+}
+
+static void nfc_manager_set_p2p_target_discovered_cb_p()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_p2p_target_discovered_cb(utc_test_cb , NULL);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_p2p_target_discovered_cb_p is faild");
+}
+
+static void nfc_manager_set_p2p_target_discovered_cb_n()
+{
+       int ret;
+
+       ret = nfc_manager_set_p2p_target_discovered_cb(NULL, NULL);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_p2p_target_discovered_cb_n not allow null");
+}
+
+static void nfc_manager_set_se_event_cb_p()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_se_event_cb(utc_test_cb , NULL);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_event_cb_p is faild");
+}
+
+static void nfc_manager_set_se_event_cb_n ()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_se_event_cb(NULL, NULL);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_event_cb_n not allow null");
+}
+
+static void nfc_manager_set_se_transaction_event_cb_p()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_se_transaction_event_cb(utc_test_cb , NULL);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_transaction_event_cb_p is faild");
+}
+
+static void nfc_manager_set_se_transaction_event_cb_n ()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_se_transaction_event_cb(NULL, NULL);
+
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_transaction_event_cb_n not allow null");
+}
+
+static void nfc_manager_set_system_handler_enable_p()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_system_handler_enable(true);
+
+       dts_pass(__func__, "PASS");
+
+}
+
+static void nfc_manager_set_system_handler_enable_n ()
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = nfc_manager_set_system_handler_enable(NULL);
+
+       dts_pass(__func__, "PASS");
+}
diff --git a/TC/testcase/utc_network_nfc_ndef_message.c b/TC/testcase/utc_network_nfc_ndef_message.c
new file mode 100755 (executable)
index 0000000..84d2265
--- /dev/null
@@ -0,0 +1,282 @@
+/*
+* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <tet_api.h>
+#include <nfc.h>
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+
+#define MY_ASSERT( fun , test , msg ) \
+{\
+       if( !test ) \
+               dts_fail(fun , msg ); \
+}
+
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_nfc_ndef_message_create_p(void);
+static void utc_nfc_ndef_message_create_n(void);
+static void utc_nfc_ndef_message_create_from_rawdata_p(void);
+static void utc_nfc_ndef_message_create_from_rawdata_n(void);
+static void utc_nfc_ndef_message_destroy_p(void);
+static void utc_nfc_ndef_message_destroy_n(void);
+static void utc_nfc_ndef_message_get_record_count_p(void);
+static void utc_nfc_ndef_message_get_record_count_n(void);
+static void utc_nfc_ndef_message_get_rawdata_p(void);
+static void utc_nfc_ndef_message_get_rawdata_n(void);
+static void utc_nfc_ndef_message_append_record_p(void);
+static void utc_nfc_ndef_message_append_record_n(void);
+static void utc_nfc_ndef_message_insert_record_p(void);
+static void utc_nfc_ndef_message_insert_record_n(void);
+static void utc_nfc_ndef_message_remove_record_p(void);
+static void utc_nfc_ndef_message_remove_record_n(void);
+static void utc_nfc_ndef_message_get_record_p(void);
+static void utc_nfc_ndef_message_get_record_n(void);
+
+
+struct tet_testlist tet_testlist[] = {
+       { utc_nfc_ndef_message_create_p , POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_create_n , NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_create_from_rawdata_p , POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_create_from_rawdata_n , NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_destroy_p , POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_destroy_n , NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_get_record_count_p , POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_get_record_count_n , NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_get_rawdata_p , POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_get_rawdata_n , NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_append_record_p , POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_append_record_n , NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_insert_record_p , POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_insert_record_n , NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_remove_record_p , POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_remove_record_n , NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_message_get_record_p , POSITIVE_TC_IDX },
+       { utc_nfc_ndef_message_get_record_n , NEGATIVE_TC_IDX },
+
+       { NULL, 0 },
+};
+
+//this method is called only once in start
+static void startup(void)
+{
+       /* start of TC */
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+
+
+static void utc_nfc_ndef_message_create_p(void)
+{
+       int ret ;
+       nfc_ndef_message_h message;
+       ret = nfc_ndef_message_create(&message);
+       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+       nfc_ndef_message_destroy(message);
+       dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_create_n(void)
+{
+       int ret ;
+       ret = nfc_ndef_message_create(NULL);
+       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
+       dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_create_from_rawdata_p(void)
+{
+       int ret ;
+       unsigned char *buffer;
+       uint32_t size;
+       nfc_ndef_message_h message;
+       nfc_ndef_message_h message2;
+       nfc_ndef_record_h record1;
+       ret = nfc_ndef_message_create(&message);
+       nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+       nfc_ndef_message_append_record(message, record1);
+       nfc_ndef_message_get_rawdata(message, &buffer, &size);
+       ret = nfc_ndef_message_create_from_rawdata(&message2, buffer,size);
+
+       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+       nfc_ndef_message_destroy(message2);
+       nfc_ndef_message_destroy(message);
+       free(buffer);
+       dts_pass(__func__, "PASS");
+
+}
+static void utc_nfc_ndef_message_create_from_rawdata_n(void)
+{
+       int ret ;
+       ret = nfc_ndef_message_create_from_rawdata(NULL, NULL, 0);
+       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
+       dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_destroy_p(void)
+{
+       int ret ;
+       nfc_ndef_message_h message;
+       ret = nfc_ndef_message_create(&message);
+       ret = nfc_ndef_message_destroy(message);
+       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+       dts_pass(__func__, "PASS");
+
+}
+static void utc_nfc_ndef_message_destroy_n(void)
+{
+       int ret ;
+       ret = nfc_ndef_message_destroy(NULL);
+       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
+       dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_get_record_count_p(void)
+{
+       int ret ;
+       int count;
+       nfc_ndef_message_h message;
+       nfc_ndef_record_h record1;
+       ret = nfc_ndef_message_create(&message);
+       nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+       nfc_ndef_message_append_record(message, record1);
+       ret = nfc_ndef_message_get_record_count(message, &count);
+
+       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+       nfc_ndef_message_destroy(message);
+       dts_pass(__func__, "PASS");
+
+}
+static void utc_nfc_ndef_message_get_record_count_n(void)
+{
+       int ret ;
+       ret = nfc_ndef_message_get_record_count(NULL, NULL);
+       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
+       dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_get_rawdata_p(void)
+{
+       int ret ;
+       unsigned char *buffer;
+       uint32_t size;
+       nfc_ndef_message_h message;
+       nfc_ndef_record_h record1;
+       ret = nfc_ndef_message_create(&message);
+       nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+       nfc_ndef_message_append_record(message, record1);
+       ret= nfc_ndef_message_get_rawdata(message, &buffer, &size);
+
+       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+       nfc_ndef_message_destroy(message);
+       free(buffer);
+       dts_pass(__func__, "PASS");
+
+}
+static void utc_nfc_ndef_message_get_rawdata_n(void)
+{
+       int ret ;
+       ret = nfc_ndef_message_get_rawdata(NULL, NULL, NULL);
+       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
+       dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_append_record_p(void)
+{
+       int ret ;
+       nfc_ndef_message_h message;
+       nfc_ndef_record_h record1;
+       ret = nfc_ndef_message_create(&message);
+       nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+       ret = nfc_ndef_message_append_record(message, record1);
+       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+       nfc_ndef_message_destroy(message);
+       dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_append_record_n(void)
+{
+       int ret ;
+       ret = nfc_ndef_message_append_record(NULL, NULL);
+       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
+       dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_insert_record_p(void)
+{
+       int ret ;
+       nfc_ndef_message_h message;
+       nfc_ndef_record_h record1;
+       ret = nfc_ndef_message_create(&message);
+       nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+       ret = nfc_ndef_message_insert_record(message,0, record1);
+       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+       nfc_ndef_message_destroy(message);
+       dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_insert_record_n(void)
+{
+       int ret ;
+       ret = nfc_ndef_message_insert_record(NULL, 0 , NULL);
+       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
+       dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_remove_record_p(void)
+{
+       int ret ;
+       nfc_ndef_message_h message;
+       nfc_ndef_record_h record1;
+       ret = nfc_ndef_message_create(&message);
+       nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+       ret = nfc_ndef_message_insert_record(message,0, record1);
+       ret = nfc_ndef_message_remove_record(message, 0);
+       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+       nfc_ndef_message_destroy(message);
+       dts_pass(__func__, "PASS");
+
+}
+static void utc_nfc_ndef_message_remove_record_n(void)
+{
+       int ret ;
+       ret = nfc_ndef_message_remove_record(NULL, 0);
+       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
+       dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_get_record_p(void)
+{
+       int ret ;
+       nfc_ndef_message_h message;
+       nfc_ndef_record_h record1, record2;
+       ret = nfc_ndef_message_create(&message);
+       nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+       ret = nfc_ndef_message_insert_record(message,0, record1);
+       ret = nfc_ndef_message_get_record(message, 0, &record2);
+       MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+       nfc_ndef_message_destroy(message);
+       dts_pass(__func__, "PASS");
+
+}
+static void utc_nfc_ndef_message_get_record_n(void)
+{
+       int ret ;
+       ret = nfc_ndef_message_get_record(NULL, 0 , NULL);
+       MY_ASSERT(__func__,  ret != NFC_ERROR_NONE , "FAIL");
+       dts_pass(__func__, "PASS");
+}
+
diff --git a/TC/testcase/utc_network_nfc_ndef_record.c b/TC/testcase/utc_network_nfc_ndef_record.c
new file mode 100755 (executable)
index 0000000..8ac2ec2
--- /dev/null
@@ -0,0 +1,408 @@
+/*
+* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <tet_api.h>
+#include <nfc.h>
+
+enum {
+       POSITIVE_TC_IDX = 0x01,
+       NEGATIVE_TC_IDX,
+};
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_nfc_ndef_record_create_p(void);
+static void utc_nfc_ndef_record_create_n(void);
+static void utc_nfc_ndef_record_create_text_p(void);
+static void utc_nfc_ndef_record_create_text_n(void);
+static void utc_nfc_ndef_record_create_uri_p(void);
+static void utc_nfc_ndef_record_create_uri_n(void);
+static void utc_nfc_ndef_record_create_mime_p(void);
+static void utc_nfc_ndef_record_create_mime_n_1(void);
+static void utc_nfc_ndef_record_create_mime_n_2(void);
+static void utc_nfc_ndef_record_create_mime_n_3(void);
+static void utc_nfc_ndef_record_destroy_p(void);
+static void utc_nfc_ndef_record_destroy_n(void);
+static void utc_nfc_ndef_record_set_id_p(void);
+static void utc_nfc_ndef_record_set_id_n(void);
+static void utc_nfc_ndef_record_get_id_p(void);
+static void utc_nfc_ndef_record_get_id_n(void);
+static void utc_nfc_ndef_record_get_payload_p(void);
+static void utc_nfc_ndef_record_get_payload_n(void);
+static void utc_nfc_ndef_record_get_type_p(void);
+static void utc_nfc_ndef_record_get_type_n(void);
+static void utc_nfc_ndef_record_get_tnf_p(void);
+static void utc_nfc_ndef_record_get_tnf_n(void);
+static void utc_nfc_ndef_record_get_text_p(void);
+static void utc_nfc_ndef_record_get_text_n(void);
+static void utc_nfc_ndef_record_get_langcode_p(void);
+static void utc_nfc_ndef_record_get_langcode_n(void);
+static void utc_nfc_ndef_record_get_encode_type_p(void);
+static void utc_nfc_ndef_record_get_encode_type_n(void);
+static void utc_nfc_ndef_record_get_uri_p(void);
+static void utc_nfc_ndef_record_get_uri_n(void);
+static void utc_nfc_ndef_record_get_mime_type_p(void);
+static void utc_nfc_ndef_record_get_mime_type_n(void);
+
+struct tet_testlist tet_testlist[] = {
+       { utc_nfc_ndef_record_create_p , POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_create_n , NEGATIVE_TC_IDX },
+       { utc_nfc_ndef_record_create_text_p, POSITIVE_TC_IDX },
+       { utc_nfc_ndef_record_create_text_n , NEGATIVE_TC_IDX},
+       { utc_nfc_ndef_record_create_uri_p, 1},
+       { utc_nfc_ndef_record_create_uri_n, 2 },
+       { utc_nfc_ndef_record_create_mime_p, 1},
+       { utc_nfc_ndef_record_create_mime_n_1, 2 },
+       { utc_nfc_ndef_record_create_mime_n_2, 2 },
+       { utc_nfc_ndef_record_create_mime_n_3, 2 },
+       { utc_nfc_ndef_record_destroy_p, 1},
+       { utc_nfc_ndef_record_destroy_n, 2},
+       { utc_nfc_ndef_record_set_id_p, 1 },
+       { utc_nfc_ndef_record_set_id_n, 2 },
+       { utc_nfc_ndef_record_get_id_p, 1 },
+       { utc_nfc_ndef_record_get_id_n, 2 },
+       { utc_nfc_ndef_record_get_payload_p, 1},
+       { utc_nfc_ndef_record_get_payload_n, 2},
+       { utc_nfc_ndef_record_get_type_p, 1},
+       { utc_nfc_ndef_record_get_type_n, 2},
+       { utc_nfc_ndef_record_get_tnf_p, 1},
+       { utc_nfc_ndef_record_get_tnf_n, 2},
+       { utc_nfc_ndef_record_get_text_p, 1},
+       { utc_nfc_ndef_record_get_text_n, 2},
+       { utc_nfc_ndef_record_get_langcode_p, 1},
+       { utc_nfc_ndef_record_get_langcode_n, 2},
+       { utc_nfc_ndef_record_get_encode_type_p, 1},
+       { utc_nfc_ndef_record_get_encode_type_n, 2},
+       { utc_nfc_ndef_record_get_uri_p, 1},
+       { utc_nfc_ndef_record_get_uri_n, 2},
+       { utc_nfc_ndef_record_get_mime_type_p, 1},
+       { utc_nfc_ndef_record_get_mime_type_n, 2},
+       { NULL, 0 },
+};
+
+//this method is called only once in start
+static void startup(void)
+{
+       /* start of TC */
+}
+
+static void cleanup(void)
+{
+       /* end of TC */
+}
+static void utc_nfc_ndef_record_create_p(void)
+{
+       int ret=0;
+       nfc_ndef_record_h record;
+       unsigned char testbuffer[]  = "TEST";
+
+       ret = nfc_ndef_record_create(&record, NFC_RECORD_TNF_WELL_KNOWN, testbuffer,1, testbuffer, 4, testbuffer, 4);
+       if( ret == 0 )
+               nfc_ndef_record_destroy(record);
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create is faild");
+}
+
+static void utc_nfc_ndef_record_create_n(void)
+{
+       int ret=0;
+       unsigned char testbuffer[]  = "TEST";
+
+       ret = nfc_ndef_record_create(NULL, NFC_RECORD_TNF_WELL_KNOWN, testbuffer,1, testbuffer, 4, testbuffer, 4);
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+}
+static void utc_nfc_ndef_record_create_text_p(void)
+{
+       int ret = 0;
+       nfc_ndef_record_h record;
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+       if( ret == 0 )
+               nfc_ndef_record_destroy(record);
+
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create_text is faild");
+}
+static void utc_nfc_ndef_record_create_text_n(void)
+{
+       int ret = 0;
+       ret = nfc_ndef_record_create_text(NULL, "test", "en-US", NFC_ENCODE_UTF_8 );
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_create_uri_p(void)
+{
+       int ret = 0;
+       nfc_ndef_record_h record;
+       ret = nfc_ndef_record_create_uri(&record , "http://test.com");
+       if( ret == 0)
+               nfc_ndef_record_destroy(record);
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create_uri is faild");
+}
+static void utc_nfc_ndef_record_create_uri_n(void)
+{
+       int ret = 0;
+       ret = nfc_ndef_record_create_uri(NULL , "http://test.com");
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+
+static void utc_nfc_ndef_record_create_mime_p(void)
+{
+    int ret = NFC_ERROR_NONE;
+    nfc_ndef_record_h record;
+
+    ret = nfc_ndef_record_create_mime(&record, "text/plain", (unsigned char*)"the text record", sizeof("the text record"));
+    if( ret == NFC_ERROR_NONE)
+        nfc_ndef_record_destroy(record);
+    dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create_mime is faild");
+}
+
+static void utc_nfc_ndef_record_create_mime_n_1(void)
+{
+    int ret = NFC_ERROR_NONE;
+
+    ret = nfc_ndef_record_create_mime(NULL, "text/plain", (unsigned char*)"the text record", sizeof("the text record"));
+    dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "nfc_ndef_record_h null not allowed");
+}
+
+static void utc_nfc_ndef_record_create_mime_n_2(void)
+{
+    int ret = NFC_ERROR_NONE;
+    nfc_ndef_record_h record;
+
+    ret = nfc_ndef_record_create_mime(&record, NULL, (unsigned char*)"the text record", sizeof("the text record"));
+    if( ret == NFC_ERROR_NONE)
+        nfc_ndef_record_destroy(record);
+
+    dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "mime_type null not allowed");
+}
+
+static void utc_nfc_ndef_record_create_mime_n_3(void)
+{
+    int ret = NFC_ERROR_NONE;
+    nfc_ndef_record_h record;
+
+    ret = nfc_ndef_record_create_mime(&record, "text/plain", NULL, sizeof("the text record"));
+    if( ret == NFC_ERROR_NONE)
+        nfc_ndef_record_destroy(record);
+
+    dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "data null not allowed");
+}
+
+static void utc_nfc_ndef_record_destroy_p(void)
+{
+       int ret = 0;
+       nfc_ndef_record_h record;
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+       if( ret != 0){
+                       dts_fail(__func__, "can't create record\n");
+       }
+       ret = nfc_ndef_record_destroy(record);
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_destroy is faild");
+}
+static void utc_nfc_ndef_record_destroy_n(void)
+{
+       int ret = 0;
+       ret = nfc_ndef_record_destroy(NULL);
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+}
+static void utc_nfc_ndef_record_set_id_p(void)
+{
+       int ret = 0;
+       nfc_ndef_record_h record;
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+       ret = nfc_ndef_record_set_id(record, (unsigned char *)"test", 4);
+       nfc_ndef_record_destroy(record);
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_set_id is faild");
+}
+static void utc_nfc_ndef_record_set_id_n(void)
+{
+       int ret;
+       ret = nfc_ndef_record_set_id(NULL, (unsigned char *)"test", 4);
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+}
+static void utc_nfc_ndef_record_get_id_p(void)
+{
+       int ret = 0;
+       int size;
+       nfc_ndef_record_h record;
+       unsigned char *id;
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+       ret = nfc_ndef_record_set_id(record, (unsigned char *)"test", 4);
+       ret = nfc_ndef_record_get_id(record, &id, &size);
+       nfc_ndef_record_destroy(record);
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_id is faild");
+
+}
+static void utc_nfc_ndef_record_get_id_n(void)
+{
+       int ret;
+       ret = nfc_ndef_record_get_id(NULL,NULL, NULL);
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+}
+static void utc_nfc_ndef_record_get_payload_p(void)
+{
+       int ret = 0;
+       uint32_t size;
+       nfc_ndef_record_h record;
+       unsigned char *payload;
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+       ret = nfc_ndef_record_get_payload(record, &payload, &size);
+       nfc_ndef_record_destroy(record);
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_payload is faild");
+}
+static void utc_nfc_ndef_record_get_payload_n(void)
+{
+       int ret;
+       ret = nfc_ndef_record_set_id(NULL, (unsigned char *)"test", 4);
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_get_type_p(void)
+{
+       int ret = 0;
+       int size;
+       nfc_ndef_record_h record;
+       unsigned char *data;
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+       ret = nfc_ndef_record_get_type(record, &data, &size);
+       nfc_ndef_record_destroy(record);
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_type is faild");
+}
+static void utc_nfc_ndef_record_get_type_n(void)
+{
+       int ret;
+       ret = nfc_ndef_record_get_type(NULL, NULL, NULL);
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_get_tnf_p(void)
+{
+       int ret = 0;
+
+       nfc_ndef_record_h record;
+       nfc_record_tnf_e tnf;
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+       ret = nfc_ndef_record_get_tnf(record, &tnf);
+       nfc_ndef_record_destroy(record);
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is faild");
+}
+static void utc_nfc_ndef_record_get_tnf_n(void)
+{
+       int ret;
+       ret = nfc_ndef_record_get_tnf(NULL, NULL);
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_get_text_p(void)
+{
+       int ret = 0;
+       char *text;
+       nfc_ndef_record_h record;
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+       ret = nfc_ndef_record_get_text(record, &text);
+       free(text);
+       nfc_ndef_record_destroy(record);
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is faild");
+
+}
+static void utc_nfc_ndef_record_get_text_n(void)
+{
+       int ret;
+       ret = nfc_ndef_record_get_text(NULL, NULL);
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_get_langcode_p(void)
+{
+       int ret = 0;
+       char *text;
+       nfc_ndef_record_h record;
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+       ret = nfc_ndef_record_get_langcode(record, &text);
+       free(text);
+       nfc_ndef_record_destroy(record);
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is faild");
+
+}
+static void utc_nfc_ndef_record_get_langcode_n(void)
+{
+       int ret;
+       ret = nfc_ndef_record_get_langcode(NULL, NULL);
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_get_encode_type_p(void)
+{
+       int ret = 0;
+       nfc_encode_type_e type;
+       nfc_ndef_record_h record;
+       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+       ret = nfc_ndef_record_get_encode_type(record, &type);
+       nfc_ndef_record_destroy(record);
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_encode_type is faild");
+
+}
+static void utc_nfc_ndef_record_get_encode_type_n(void)
+{
+       int ret;
+       ret = nfc_ndef_record_get_encode_type(NULL, NULL);
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_get_uri_p(void)
+{
+       int ret = 0;
+       char *uri;
+       nfc_ndef_record_h record;
+       ret = nfc_ndef_record_create_uri(&record, "http://test.com");
+       ret = nfc_ndef_record_get_uri(record, &uri);
+       if(ret == 0 ){
+               free(uri);
+               nfc_ndef_record_destroy(record);
+       }
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_uri is faild");
+}
+static void utc_nfc_ndef_record_get_uri_n(void)
+{
+       int ret;
+       ret = nfc_ndef_record_get_uri(NULL, NULL);
+       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+
+static void utc_nfc_ndef_record_get_mime_type_p(void)
+{
+       int ret = NFC_ERROR_NONE;
+       char *mime_type;
+
+       nfc_ndef_record_h record;
+       ret = nfc_ndef_record_create_mime(&record, "text/plain", (unsigned char*)"the text record", sizeof("the text record"));
+       ret = nfc_ndef_record_get_mime_type(record, &mime_type);
+       if(ret == NFC_ERROR_NONE ){
+               free(mime_type);
+               nfc_ndef_record_destroy(record);
+       }
+       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_mime_type is faild");
+}
+static void utc_nfc_ndef_record_get_mime_type_n(void)
+{
+    int ret;
+
+    ret = nfc_ndef_record_get_mime_type(NULL, NULL);
+    dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "nfc_ndef_record_h not allow null");
+}
diff --git a/TC/tet_scen b/TC/tet_scen
new file mode 100755 (executable)
index 0000000..03f029a
--- /dev/null
@@ -0,0 +1,7 @@
+all
+       ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+       :include:/testcase/tslist
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
new file mode 100644 (file)
index 0000000..f7eda55
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option for build operation checking
+TET_BUILD_TOOL=make # build with using make command
+TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
+TET_API_COMPLIANT=True # use TET API in Test Case ?
+TET_PASS_TC_NAME=True # report passed TC name in Journal file?
diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg
new file mode 100644 (file)
index 0000000..02d7030
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option
+TET_CLEAN_TOOL= make clean # clean tool
+TET_CLEAN_FILE= Makefile # file for clean
+TET_API_COMPLIANT=True # TET API useage 
+TET_PASS_TC_NAME=True # showing name , passed TC
diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg
new file mode 100644 (file)
index 0000000..ef3e452
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capturing execution or not
+TET_EXEC_TOOL=  # ex) exec : execution tool set up/ Optional
+TET_EXEC_FILE=   # ex) exectool : execution file/ Optional
+TET_API_COMPLIANT=True # Test case or Tool usesTET API?
+TET_PASS_TC_NAME=True # showing Passed TC name ?
diff --git a/capi-network-nfc.manifest b/capi-network-nfc.manifest
new file mode 100644 (file)
index 0000000..ca37499
--- /dev/null
@@ -0,0 +1,6 @@
+<manifest>
+       <request>
+               <domain name="_" />
+       </request>
+</manifest>
+
diff --git a/capi-network-nfc.pc.in b/capi-network-nfc.pc.in
new file mode 100644 (file)
index 0000000..2b11cf6
--- /dev/null
@@ -0,0 +1,15 @@
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=@LIB_INSTALL_DIR@
+includedir=/usr/include/network
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@ 
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
+
diff --git a/debian/README b/debian/README
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/debian/capi-network-nfc-dev.install b/debian/capi-network-nfc-dev.install
new file mode 100644 (file)
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 100644 (file)
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 100644 (file)
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 100644 (file)
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..9220c26
--- /dev/null
@@ -0,0 +1,159 @@
+capi-network-nfc (0.0.1-20) unstable; urgency=low
+
+  * Modify the nfc set state function
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-20
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Wed, 11 July 2012 12:20:08 +0900
+
+capi-network-nfc (0.0.1-19) unstable; urgency=low
+
+  * ADD NFC Err case for empty tag and not ndef format
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-19
+
+ -- Sechang Sohn <sc.sohn@samsung.com>  Fri, 18 May 2012 14:20:08 +0900
+
+capi-network-nfc (0.0.1-18) unstable; urgency=low
+
+  * Patch for NFC Err case pssing issue 
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-18
+
+ -- Sechang Sohn <sc.sohn@samsung.com>  Fri, 11 May 2012 14:45:44 +0900
+
+capi-network-nfc (0.0.1-17) unstable; urgency=low
+
+  * prevent NFC set state CB reset 
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-17
+
+ -- Sechang Sohn <sc.sohn@samsung.com>  Wed, 18 Apr 2012 17:21:56 +0900
+
+capi-network-nfc (0.0.1-16) unstable; urgency=low
+
+  * make transfer NFC set state user data
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-16
+
+ -- Sechang Sohn <sc.sohn@samsung.com>  Tue, 10 Apr 2012 15:05:24 +0900
+
+capi-network-nfc (0.0.1-15) unstable; urgency=low
+
+  * Adjust the calling sequence of callback
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-15
+
+ -- Wonkyu Kwon <wonkyu.kwon@samsung.com>  Mon, 09 Apr 2012 15:50:00 +0900
+
+capi-network-nfc (0.0.1-14) unstable; urgency=low
+
+  * add NFC nfc_manager_is_supported added
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-14
+
+ -- Sechang Sohn <sc.sohn@samsung.com>  Mon, 09 Apr 2012 12:18:51 +0900
+
+capi-network-nfc (0.0.1-13) unstable; urgency=low
+
+  * add NFC init/deinit CB
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-13
+
+ -- Sechang Sohn <sc.sohn@samsung.com>  Thu, 05 Apr 2012 14:15:52 +0900
+
+capi-network-nfc (0.0.1-12) unstable; urgency=low
+
+  * add NFC tag write exception
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-12
+
+ -- Sechang Sohn <sc.sohn@samsung.com>  Thu, 29 Mar 2012 14:28:33 +0900
+
+capi-network-nfc (0.0.1-11) unstable; urgency=low
+
+  * add SE event API
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-11
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>  Tue, 20 Mar 2012 13:23:01 +0900
+
+capi-network-nfc (0.0.1-10) unstable; urgency=low
+
+  * add NFC API added
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-10
+
+ -- Sechang Sohn <sc.sohn@samsung.com>  Mon, 12 Mar 2012 18:44:59 +0900
+
+capi-network-nfc (0.0.1-9) unstable; urgency=low
+
+  * Type casting bug fix
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-9
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Mon, 12 Mar 2012 15:50:05 +0900
+
+capi-network-nfc (0.0.1-8) unstable; urgency=low
+
+  * add NFC Handover API
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-8
+
+ -- Sechang Sohn <sc.sohn@samsung.com>  Mon, 27 Feb 2012 18:28:58 +0900
+
+capi-network-nfc (0.0.1-7) unstable; urgency=low
+
+  * add so version
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-7
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>  Tue, 14 Feb 2012 16:49:32 +0900
+
+capi-network-nfc (0.0.1-6) unstable; urgency=low
+
+  * add extern
+  * Git: slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-6
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>  Mon, 06 Feb 2012 15:56:17 +0900
+
+capi-network-nfc (0.0.1-5) unstable; urgency=low
+
+  * Update bug fix
+  * Git: 165.213.149.219:29418/slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-5
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>  Wed, 14 Dec 2011 13:43:26 +0900
+
+capi-network-nfc (0.0.1-4) unstable; urgency=low
+
+  * update error none value
+  * Git: slp-source.sec.samsung.net:slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-4
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>  Mon, 05 Dec 2011 11:12:56 +0900
+
+capi-network-nfc (0.0.1-3) unstable; urgency=low
+
+  * Update New NFC API
+  * Git: slp-source.sec.samsung.net:slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-3 
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>  Wed, 30 Nov 2011 17:59:15 +0900
+
+capi-network-nfc (0.0.1-2) unstable; urgency=low
+
+  * Update package dependancy 
+  * Git: slp-source.sec.samsung.net:slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-2
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>  Mon, 29 Aug 2011 10:38:48 +0900
+
+capi-network-nfc (0.0.1-1) unstable; urgency=low
+
+  * Initial upload
+  * Git: slp-source.sec.samsung.net:slp/api/nfc
+  * Tag: capi-network-nfc_0.0.1-1
+
+ -- Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>  Thu, 04 Aug 2011 17:46:48 +0900
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7ed6ff8
--- /dev/null
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100755 (executable)
index 0000000..884fca6
--- /dev/null
@@ -0,0 +1,22 @@
+
+Source: capi-network-nfc
+Section: libs
+Priority: extra
+Maintainer: Sechang Sohn <sc.sohn@samsung.com>, Sungjae Lim <sungjae.lim@samsung.com>, Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>
+Build-Depends: debhelper (>= 5), libnfc-common-lib-dev, libnfc-manager-dev, dlog-dev, capi-base-common-dev, libglib2.0-dev
+
+Package: capi-network-nfc
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: A NFC library in Tizen Native API
+
+Package: capi-network-nfc-dev
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-nfc (= ${Source-Version}), capi-base-common-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..d075260
--- /dev/null
@@ -0,0 +1,68 @@
+#!/usr/bin/make -f
+
+CFLAGS = -Wall -g
+
+FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
+MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1)
+
+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 .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
+       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..5871967
--- /dev/null
@@ -0,0 +1,2102 @@
+/*
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef __NFC_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 operation is not finished still busy */
+       NFC_ERROR_NO_DEVICE = NFC_ERROR_CLASS | 0x04, /**< no device */
+       NFC_ERROR_NOT_ACTIVATED = NFC_ERROR_CLASS | 0x05, /**< NFC is not activated */
+       NFC_ERROR_NOT_SUPPORTED = NFC_ERROR_CLASS | 0x06, /**< Not supported */
+       NFC_ERROR_ALREADY_ACTIVATED = NFC_ERROR_CLASS | 0x07, /**< Already activated */
+       NFC_ERROR_ALREADY_DEACTIVATED = NFC_ERROR_CLASS | 0x08, /**< Already deactivated */
+       NFC_ERROR_READ_ONLY_NDEF = NFC_ERROR_CLASS | 0x09, /**< Read only tag */
+       NFC_ERROR_NO_SPACE_ON_NDEF = NFC_ERROR_CLASS | 0x0a, /**< No enough space on tag */
+       NFC_ERROR_NO_NDEF_MESSAGE = NFC_ERROR_CLASS | 0x0b, /**< No NDEF Message on Tag */
+       NFC_ERROR_NOT_NDEF_FORMAT = NFC_ERROR_CLASS | 0x0c, /**< Not NDEF format Tag */
+       NFC_ERROR_SECURITY_RESTRICTED = NFC_ERROR_CLASS | 0x0d /**<  Restricted by security system policy */
+} 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_TRANSACTION, /**< This event  notifies , external reader trys to access secure element */
+       NFC_SE_EVENT_SE_TYPE_CHANGED, /**< This event notifies, changing the emulated secure element type */
+       NFC_SE_EVENT_SE_CARD_EMULATION_CHANGED
+} nfc_se_event_e;
+
+/**
+ * @brief Enumerations for NFC Secure Element (SIM/UICC(Universal Integrated Circuit Card)) type
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ */
+typedef enum{
+       NFC_SE_TYPE_DISABLE = 0x00, /**< Disable card emulation */
+       NFC_SE_TYPE_ESE = 0x01, /**< SmartMX type card emulation */
+       NFC_SE_TYPE_UICC = 0x02 /**< UICC type card emulation */
+} nfc_se_type_e;
+
+/**
+ *  * @brief Enumerations for NFC Card Emulation Mode type
+ *   * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *    */
+typedef enum{
+       NFC_SE_CARD_EMULATION_MODE_OFF = 0x00, /**< Card Emulation mode OFF */
+       NFC_SE_CARD_EMULATION_MODE_ON = 0x01, /**< Card Emulation mode ON */
+} nfc_se_card_emulation_mode_type_e;
+
+/**
+ * @brief Enumerations for NFC AC(Alternative Carrier)
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ */
+typedef enum {
+       NFC_AC_TYPE_BT = 0x00, /**< Bluetooth AC*/
+       NFC_AC_TYPE_WIFI, /**<Wifi AC*/
+       NFC_AC_TYPE_WIFI_DIRECT,/**<Wifi-direct AC*/
+       NFC_AC_TYPE_UNKNOWN, /* No selected preferred AC */
+} nfc_ac_type_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_P2P_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
+ */
+extern const unsigned char NFC_TAG_MIFARE_KEY_DEFAULT[6];
+
+/**
+ * @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
+ */
+extern const unsigned char NFC_TAG_MIFARE_KEY_APPLICATION_DIRECTORY[6];
+
+/**
+ * @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
+ */
+extern const unsigned char NFC_TAG_MIFARE_KEY_NFC_FORUM[6];
+
+
+/**
+ * @brief RTD(Record type definition) Type - Smart Poster type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+extern const unsigned char NFC_RECORD_SMART_POSTER_TYPE[2];
+
+/**
+ * @brief  RTD(Record type definition) Type - Text type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+extern const unsigned char NFC_RECORD_TEXT_TYPE[1];
+/**
+ * @brief  RTD(Record type definition) Type - URI type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+extern const unsigned char NFC_RECORD_URI_TYPE[1];
+/**
+ * @brief  RTD(Record type definition) Type - Alternative Carrier type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+extern const unsigned char NFC_RECORD_ALTERNATIVE_CARRIER_TYPE[2];
+/**
+ * @brief  RTD(Record type definition) Type - Handover Carrier type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+extern const unsigned char NFC_RECORD_HANDOVER_CARRIER_TYPE[2];
+/**
+ * @brief  RTD(Record type definition) Type - Handover Request type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+extern const unsigned char NFC_RECORD_HANDOVER_REQUEST_TYPE[2];
+/**
+ * @brief  RTD(Record type definition) Type - Handover Select type.
+ * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
+ */
+extern const unsigned char NFC_RECORD_HANDOVER_SELECT_TYPE[2];
+
+/**
+ * @brief Called after nfc_manager_set_activation() has completed.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] error The result
+ * @param [in] user_data The user data passed from the callback registration function
+ *
+ * @see nfc_manager_set_activation()
+ */
+typedef void (* nfc_activation_completed_cb)(nfc_error_e error, void *user_data);
+
+/**
+ * @brief Called when nfc activation state is changed.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] activated The activation state
+ * @param [in] user_data The user data passed from the callback registration function
+ *
+ * @see nfc_manager_set_activation_changed_cb()
+ */
+typedef void (*nfc_activation_changed_cb)(bool activated , void *user_data);
+
+/**
+ * @brief Called after nfc_manager_initialize() has completed.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] error The result
+ * @param [in] user_data The user data passed from the callback registration function
+ *
+ * @see nfc_manager_initialize()
+ */
+typedef void (* nfc_initialize_completed_cb)(nfc_error_e error, void *user_data);
+
+
+/**
+ * @brief Called after nfc_manager_set_card_emulation_se_type() has completed.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] error The result
+ * @param [in] user_data The user data passed from the callback registration function
+ *
+ * @see nfc_manager_set_card_emulation_se_type()
+ */
+typedef void (* nfc_set_card_emulation_completed_cb)(nfc_error_e error, void *user_data);
+
+/**
+ * @brief Called when an NFC tag appears or disappears
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @remarks  The tag handle does not have detail target info when an NFC tag disappeared.\n
+ *     So then do not use nfc_tag_get_keys().
+ *
+ * @param [in] type The discovered type attached or detached
+ * @param [in] 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 out 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 The read buffer
+ * @param [in] size The size of buffer in bytes
+ * @param [in] user_data The user data passed from nfc_mifare_read_block()
+ *
+ * @see nfc_mifare_read_block()
+ */
+typedef void (* nfc_mifare_read_block_completed_cb)(nfc_error_e result, unsigned char *buffer, int bufer_size, void *user_data);
+
+/**
+ * @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 when receiving Secure Element(SIM/UICC(Universal Integrated Circuit Card)) transaction event data
+ * @remarks This event  notifies , external reader trys to access secure element.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] se type
+ * @param [in] aid Application Id, specified in ISO/IEC 7816-4
+ * @param [in] aid_size The size of aid (5~16)
+ * @param [in] param The parameter list, specified in ISO/IEC 8825-1
+ * @param [in] param The size of param (0~65535)
+ * @param [in] user_data The user data passed from nfc_manager_set_se_transaction_event_cb()
+ *
+ * @see nfc_manager_set_se_transaction_event_cb()
+ * @see nfc_manager_unset_se_transaction_event_cb()
+ */
+typedef void (*nfc_se_transaction_event_cb)(nfc_se_type_e se_type, unsigned char* aid, int aid_size , unsigned char* param, int param_size,  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 received 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 Called after nfc_p2p_connection_handover() has completed.
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @remark To use the @a ac_data outside this function, copy the @a ac_data.
+ * @remark @a ac_data could be NULL, if nfc_p2p_connection_handover failed.
+ * @remark If @a carrier is #NFC_AC_TYPE_BT, @ac_data should be converted to 'char *' type. This is bluetooth address information.
+ *
+ * @param [in] result The result of function call
+ * @param [in] carrier The type of Alternative Carrier
+ * @param [in] ac_data The connected remote device AC(Alternative Carrier) information data
+ * @param [in] ac_data_size The connected remote device AC(Alternative Carrier) information data size
+ * @param [in] user_data The user data passed from nfc_p2p_connection_handover()
+ *
+ * @see nfc_p2p_connection_handover()
+ */
+typedef void (*nfc_p2p_connection_handover_completed_cb)(nfc_error_e result, nfc_ac_type_e carrior, void * ac_data, int ac_data_size , void *user_data);
+
+/**
+ * @brief Gets the value that indicates whether NFC is supported.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @remarks This function can executed Regardless of nfc_manager_initialize state.
+ *
+ * @return true on NFC supported,  otherwise false
+ *
+ * @see nfc_manager_set_activation()
+ */
+
+bool nfc_manager_is_supported(void);
+
+/**
+ * @brief Sets NFC Activation
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] activation The NFC state for setting
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_ALREADY_ACTIVATED Already activated
+ * @retval #NFC_ERROR_ALREADY_DEACTIVATED Already deactivated
+ *
+ * @see nfc_manager_is_activated()
+ * @see nfc_activation_completed_cb()
+ */
+int nfc_manager_set_activation(bool activation, nfc_activation_completed_cb callback, void *user_data);
+
+/**
+ * @brief Set NFC Activation state changed callback
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] callback The callback function to invoke when activation state is changed.
+ * @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_activation_changed_cb()
+ * @see nfc_manager_unset_activation_changed_cb()
+ */
+int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback , void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @see nfc_manager_set_activation_changed_cb()
+ * @see nfc_activation_changed_cb()
+ */
+void nfc_manager_unset_activation_changed_cb(void);
+
+
+/**
+ * @brief Gets NFC Activation state
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @remarks This function can executed Regardless of nfc_manager_initialize state.
+ *
+ * @return true on NFC activated,  otherwise false
+ *
+ * @see nfc_manager_set_activation()
+ */
+
+bool nfc_manager_is_activated(void);
+
+/**
+ * @brief Initializes NFC Manager.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @remarks This function must be called before proceeding any other nfc functions\n
+ *     Internally it makes socket connection to NFC manager.\n
+ *     When an application crashes or exits without the deinitialization. NFC manager automatically deinitializes the process itself.\n
+ *     This function is asynchronous.
+ *
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
+ *
+ * @see nfc_manager_initialize_sync()
+ * @see nfc_manager_deinitialize()
+ */
+int nfc_manager_initialize(nfc_initialize_completed_cb callback, 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
+ *     This function is synchronous.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
+ *
+ * @see nfc_manager_initialize()
+ * @see nfc_manager_deinitialize()
+ */
+int nfc_manager_initialize_sync();
+
+
+/**
+ * @brief Releases all the resource of the NFC Manager and disconnect the session between an application and NFC Manager.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
+ *
+ * @see nfc_manager_initialize()
+ */
+int nfc_manager_deinitialize(void);
+
+/**
+ * @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 Registers a callback function for receiving  Secure Element (SIM/UICC(Universal Integrated Circuit Card)) transaction event(#NFC_SE_EVENT_TRANSACTION) data.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] se_type The type os secure element
+ * @param [in] callback The callback function called when occurred SE transaction event.
+ * @param [in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ * @see nfc_se_transaction_event_cb()
+ * @see nfc_manager_unset_se_transaction_event_cb()
+ */
+int nfc_manager_set_se_transaction_event_cb(nfc_se_type_e se_type,
+               nfc_se_transaction_event_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] se_type The type of secure element.
+ *
+ * @see nfc_se_transaction_event_cb()
+ * @see nfc_manager_set_se_transaction_event_cb()
+ */
+void nfc_manager_unset_se_transaction_event_cb(nfc_se_type_e se_type);
+
+/**
+ * @brief Gets NDEF message cached when the tag is detected or when data received from NFC peer-to-peer target.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @remarks This function is used to get the ndef message that was read before launched your application.
+ * @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 configure parameter (like  NFC_TAG_FILTER_ISO14443A_ENABLE | NFC_TAG_FILTER_ISO14443B_ENABLE)
+ *     or you may choose "NFC_TAG_ALL_ENABLE" enum value to get all result.
+ *     It prevent getting tag types from RF level.
+ *     If the client api does call this function, default is always NFC_TAG_ALL_ENABLE.
+ *
+ * @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 Gets current connected tag.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [out] tag The connected tag
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_NO_DEVICE There is no connected tag
+ */
+int nfc_manager_get_connected_tag(nfc_tag_h *tag);
+
+/**
+ * @brief Gets current connected p2p target
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [out] target The connected target
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_NO_DEVICE There is no connected target
+ */
+int nfc_manager_get_connected_target(nfc_p2p_target_h *target);
+
+
+/**
+ * @brief Enable or disable the system handling for tag and target discovered event
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @remarks In default, The system handling is enabled.
+ *
+ * @param [in] enable The state of enable
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ * @see nfc_manager_is_system_handler_enabled()
+ */
+int nfc_manager_set_system_handler_enable(bool enable);
+
+/**
+ * @brief Gets the state of the system handler
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @remarks In default, The system handling is enabled.
+ *
+ * @return true on enabled, otherwise false.
+ *
+ * @see nfc_manager_set_system_handler_enable()
+ */
+bool nfc_manager_is_system_handler_enabled(void);
+
+/**
+ * @brief Sets the card emulation Secure Element type
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @remarks To disable card emulation mode, set NFC_SE_TYPE_DISABLE\n
+ * This API is asynchronous function, This operation is completed when NFC_SE_EVENT_SE_TYPE_CHANGED event or nfc_set_card_emulation_completed_cb was invoked.
+ *
+ * @param [in] type The type of Secure Element
+ * @param [in] callback The callback function to invoke after this function has completed\nIt can be null if notification is not required
+ * @param [in] 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_get_card_emulation_se_type()
+ */
+int nfc_manager_set_card_emulation_se_type(nfc_se_type_e type, nfc_set_card_emulation_completed_cb callback, void* user_data);
+
+/**
+ * @brief Gets the card emulation Secure Element type
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [out] type The type of Secure Element
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ * @see nfc_manager_set_card_emulation_se_type()
+ */
+int nfc_manager_get_card_emulation_se_type(nfc_se_type_e* type);
+
+/**
+ * @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 : protocol 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 payload that is contained by record\n
+ * Do not free the payload. it will be freed when @a record is destroyed by nfc_ndef_record_destroy().
+ *
+ * @param [in] record The handle to record
+ * @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, unsigned 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, unsigned 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 bytes array from NDEF message. @a rawdata must be released with free() by you.
+ *
+ * @param [in] ndef_message The handle to NDEF message
+ * @param [out] rawdata The bytes array of bytes array
+ * @param [out] rawdata_size The size of bytes array in byte
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @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, unsigned 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 knowledge of each tag technology.
+* @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+*
+* @param [in] tag The handle to NFC tag
+* @param [in] buffer The binary data for parameter or additional commands
+* @param [in] buffer_size The size of buffer in bytes
+* @param [in] callback The callback function to invoke after this function has completed\n It can be null if a notification is not required
+* @param [in] user_data        The user data to be passed to the callback 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_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
+* @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+*
+* @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 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_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
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format 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 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_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
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format 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 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_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
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format 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 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_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
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @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 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_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
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @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 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_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
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @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 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_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
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @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 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
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @post It invokes nfc_mifare_write_block_completed_cb() when it has completed to write a block.
+ *
+ * @see nfc_mifare_write_page()
+ * @see nfc_mifare_read_block()
+*/
+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 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_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
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @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
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @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 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_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
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @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 Copy from the temporary block to the specified block.
+ * @remarks This function is only available for MIFARE classic
+ *
+ * @param [in] tag The handle to NFC tag
+ * @param [in] block_index The index of block to copy to, starting from 0
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback 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_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
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @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 Copy from a value block to the temporary block.
+ * @remarks This function is only available for MIFARE classic
+ *
+ * @param [in] tag The handle to NFC tag
+ * @param [in] block_index The index of block to copy from, starting from 0
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback 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_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
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @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 function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @see nfc_p2p_send_completed_cb()
+ * @see nfc_p2p_target_discovered_cb()
+*/
+int nfc_p2p_send(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data);
+
+
+/**
+ * @brief Sends data to NFC peer-to-peer target without permission check
+ * @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 function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @see nfc_p2p_send_completed_cb()
+ * @see nfc_p2p_target_discovered_cb()
+*/
+int nfc_p2p_send_no_permission(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data);
+
+
+
+/**
+ * @brief NFC Connection handover between NFC peer-to-peer target
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @param [in] target The handle to NFC device
+ * @param [in] type Preferred Alternative Carrier
+ * @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
+ * @param [in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ *
+ * @see nfc_p2p_connection_handover_completed_cb()
+*/
+int nfc_p2p_connection_handover(nfc_p2p_target_h target , nfc_ac_type_e type, nfc_p2p_connection_handover_completed_cb callback, void *user_data);
+
+/**
+ * @brief Check available Alternative Carrier(AC) for NFC handover between NFC peer-to-peer target
+ * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
+ *
+ * @param [in] carrier Alternative Carrier when to be checked whether supported or not
+ *
+ * @retval #true Supported
+ * @retval #false Not Supported
+ *
+ * @see nfc_p2p_is_supported_ac_type()
+*/
+bool nfc_p2p_is_supported_ac_type( nfc_ac_type_e carrior);
+
+
+#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..cf082ce
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#ifndef __NFC_PRIVATE_H__
+#define __NFC_PRIVATE_H__
+#include <net_nfc.h>
+#include <net_nfc_typedef_private.h>
+
+#include "nfc.h"
+
+
+typedef enum {
+       _NFC_CALLBACK_TYPE_RESULT=0,
+       _NFC_CALLBACK_TYPE_DATA=1,
+} _nfc_callback_type;
+
+
+typedef struct {
+       bool initialized;
+
+       nfc_tag_discovered_cb                   on_tag_discovered_cb;
+       void *                                          on_tag_discovered_user_data;
+       nfc_ndef_discovered_cb          on_ndef_discovered_cb;
+       void *                                          on_ndef_discovered_user_data;
+       net_nfc_target_info_s                   *current_tag;
+
+       //net_nfc_target_handle_s               current_target;
+       net_nfc_target_handle_h         current_target;
+
+       nfc_p2p_target_discovered_cb    on_p2p_discovered_cb;
+       void *                                          on_p2p_discovered_user_data;
+
+       nfc_se_event_cb                         on_se_event_cb;
+       void *                                          on_se_event_user_data;
+
+       nfc_p2p_send_completed_cb       on_p2p_send_completed_cb;
+       void *                                          on_p2p_send_completed_user_data;
+
+       nfc_p2p_data_recived_cb         on_p2p_recv_cb;
+       void *                                          on_p2p_recv_user_data;
+
+       nfc_p2p_connection_handover_completed_cb                on_p2p_connection_handover_completed_cb;
+       void *                                                                          on_p2p_connection_handover_completed_user_data;
+
+       nfc_initialize_completed_cb             on_initialize_completed_cb;
+
+       //nfc_se_transaction_event_cb           on_se_transaction_event_cb;
+       //void *                                                on_se_transaction_event_user_data;
+
+       nfc_se_transaction_event_cb             on_eSE_transaction_event_cb;
+       void *                                          on_eSE_transaction_event_user_data;
+
+       nfc_se_transaction_event_cb             on_UICC_transaction_event_cb;
+       void *                                          on_UICC_transaction_event_user_data;
+
+       net_nfc_se_type_e                                               on_se_type;
+
+       nfc_activation_changed_cb       on_activation_changed_cb;
+       void *                                          on_activation_changed_user_data;
+
+       nfc_activation_completed_cb     on_activation_completed_cb;
+       void *                                          on_activation_completed_user_data;
+       bool                        on_activation_doing;
+
+} _nfc_context_s;
+
+typedef struct {
+       void * callback;
+       void * user_data;
+       int callback_type;
+} _async_callback_data;
+
+#endif // __NFC_PRIVATE_H__
diff --git a/packaging/capi-network-nfc.spec b/packaging/capi-network-nfc.spec
new file mode 100644 (file)
index 0000000..d60bc6e
--- /dev/null
@@ -0,0 +1,63 @@
+#sbs-git:slp/api/nfc capi-network-nfc 0.0.1 14f15050f8f6ff8217421da04fa5d66e834e2016
+Name:       capi-network-nfc
+Summary:    A NFC library in SLP C API
+Version:    0.0.11
+Release:    0
+Group:      API/C API
+License:    Apache-2.0
+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)
+BuildRequires:  pkgconfig(vconf)
+BuildRequires:  pkgconfig(ecore-x)
+
+%description
+A NFC library in SLP C API.
+
+
+%package devel
+Summary:  A NFC library in SLP C API -- Development Files
+Group:    API/C API
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+A NFC library in SLP C API.
+
+This package contains the development files for %{name}.
+
+
+%prep
+%setup -q
+
+
+%build
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+
+make %{?jobs:-j%jobs}
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp -af LICENSE.APLv2 %{buildroot}/usr/share/license/%{name}
+
+%make_install
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+
+%files
+%manifest capi-network-nfc.manifest
+%{_libdir}/libcapi-network-nfc.so*
+/usr/share/license/capi-network-nfc
+
+%files devel
+%{_includedir}/network/*.h
+%{_libdir}/pkgconfig/*.pc
+%{_libdir}/libcapi-network-nfc.so
diff --git a/src/nfc.c b/src/nfc.c
new file mode 100755 (executable)
index 0000000..5f0ba6c
--- /dev/null
+++ b/src/nfc.c
@@ -0,0 +1,2237 @@
+/*
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <unistd.h>
+
+#include <net_nfc.h>
+#include <net_nfc_typedef_private.h>
+#include <dlog.h>
+#include <nfc.h>
+#include <nfc_private.h>
+#include <net_nfc_exchanger.h>
+#include <vconf.h>
+#include <Ecore_X.h>
+#include <glib.h>
+#include "net_nfc_internal_se.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' };
+
+typedef struct _init_context_t
+{
+       nfc_initialize_completed_cb cb;
+       int ret;
+       void* user_data;
+}init_context_t;
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "CAPI_NETWORK_NFC"
+
+static int _init_callback(init_context_t *context)
+{
+       if (context == NULL) {
+               return 0;
+       }
+
+       if(context->cb != NULL)
+               context->cb(context->ret, context->user_data);
+
+       free(context);
+
+       return 0;
+}
+
+static pid_t _get_focus_app_pid()
+{
+       Ecore_X_Window focus;
+       pid_t pid;
+
+       ecore_x_init(NULL);
+
+       focus = ecore_x_window_focus_get();
+       if (ecore_x_netwm_pid_get(focus, &pid))
+               return pid;
+
+       return -1;
+}
+
+static bool _check_app_permission()
+{
+       pid_t focus_app_pid, current_app_pid;
+
+       focus_app_pid = _get_focus_app_pid();
+       current_app_pid = getpgid(getpid());
+
+       LOGE( "[check app permission] focus_app_pid [%d],  current_app_pid [%d]", focus_app_pid, current_app_pid);
+
+       return (focus_app_pid == current_app_pid) ? true : false;
+}
+
+static int _return_invalid_param(const char *func)
+{
+       LOGE( "INVALID_PARAMETER (0x%08x)", NFC_ERROR_INVALID_PARAMETER);
+       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_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:
+               error_code = NFC_ERROR_INVALID_NDEF_MESSAGE;
+               errorstr  = "INVALID_NDEF_MESSAGE";
+               break;
+       case NET_NFC_NO_NDEF_MESSAGE:
+               error_code = NFC_ERROR_NO_NDEF_MESSAGE;
+               errorstr  = "NO_NDEF_MESSAGE";
+               break;
+       case NET_NFC_BUSY :
+               error_code = NFC_ERROR_DEVICE_BUSY;
+               errorstr  = "DEVICE_BUSY";
+               break;
+       case NET_NFC_NO_NDEF_SUPPORT:
+               error_code = NFC_ERROR_NOT_NDEF_FORMAT;
+               errorstr  = "NOT_SUPPORTED";
+               break;
+       default :
+               error_code = NFC_ERROR_OPERATION_FAILED;
+               errorstr  = "OPERATION_FAILED";
+       }
+
+       LOGE( "NFC %s(0x%08x)", errorstr, error_code);
+
+       return error_code;
+
+}
+
+static _nfc_context_s g_nfc_context;
+
+static void _clear_context()
+{
+       if (g_nfc_context.current_tag != NULL)
+       {
+               net_nfc_release_tag_info((net_nfc_target_info_h)g_nfc_context.current_tag);
+       }
+
+       memset(&g_nfc_context, 0, sizeof(g_nfc_context));
+}
+
+static void nfc_manager_set_activation_completed_cb(nfc_activation_completed_cb callback , void *user_data)
+{
+       g_nfc_context.on_activation_completed_cb = callback;
+       g_nfc_context.on_activation_completed_user_data = user_data;
+       g_nfc_context.on_activation_doing = true;
+}
+
+static void nfc_manager_unset_activation_completed_cb(void)
+{
+       g_nfc_context.on_activation_completed_cb = NULL;
+       g_nfc_context.on_activation_completed_user_data = NULL;
+       g_nfc_context.on_activation_doing = false;
+}
+
+static bool nfc_manager_check_activation(void)
+{
+       return g_nfc_context.on_activation_doing;
+}
+
+
+void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, void* data, void* user_param, void * trans_data)
+{
+       LOGI("NFC message %d - start result[%d] ", message, result);
+
+       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:
+               {
+                       net_nfc_target_info_s *target_info = (net_nfc_target_info_s *)data;
+
+                       if (g_nfc_context.current_tag != NULL)
+                       {
+                               net_nfc_release_tag_info((net_nfc_target_info_h)g_nfc_context.current_tag);
+                               g_nfc_context.current_tag = NULL;
+                       }
+
+                       net_nfc_duplicate_target_info((net_nfc_target_info_h)target_info, (net_nfc_target_info_h *)&g_nfc_context.current_tag);
+
+                       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 );
+                       }
+
+                       if (g_nfc_context.current_tag != NULL)
+                       {
+                               net_nfc_release_tag_info((net_nfc_target_info_h)g_nfc_context.current_tag);
+                               g_nfc_context.current_tag = NULL;
+                       }
+                       break;
+               }
+       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 ){
+
+                               nfc_p2p_send_completed_cb       cb = g_nfc_context.on_p2p_send_completed_cb;
+                               void *                                          user_data = g_nfc_context.on_p2p_send_completed_user_data;
+                               g_nfc_context.on_p2p_send_completed_cb = NULL;
+                               g_nfc_context.on_p2p_send_completed_user_data = NULL;
+                               cb(capi_result , user_data );
+                       }
+                       break;
+               }
+       case NET_NFC_MESSAGE_P2P_RECEIVE :
+               {
+                       if( g_nfc_context.on_p2p_recv_cb != NULL ){
+                               ndef_message_h ndef_message ;
+                               net_nfc_create_ndef_message_from_rawdata (&ndef_message, (data_h)(data) );
+                               g_nfc_context.on_p2p_recv_cb( (nfc_p2p_target_h)(g_nfc_context.current_target) , ndef_message ,g_nfc_context.on_p2p_recv_user_data );
+                               net_nfc_free_ndef_message(ndef_message);
+                       }
+
+                       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_CONNECTION_HANDOVER :
+               {
+                       if( g_nfc_context.on_p2p_connection_handover_completed_cb != NULL ){
+
+                               net_nfc_conn_handover_carrier_type_e type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+                               nfc_ac_type_e carrior_type = NFC_AC_TYPE_UNKNOWN;
+                               char * ac_data = NULL;
+                               int ac_data_size = 0;
+                               char * temp = NULL;
+                               char buffer[50] = {0,};
+                               data_h ac_info = NULL;
+
+
+                               net_nfc_exchanger_get_alternative_carrier_type((net_nfc_connection_handover_info_h)data, &type);
+                               if (type == NET_NFC_CONN_HANDOVER_CARRIER_BT)
+                               {
+                                       carrior_type = NFC_AC_TYPE_BT;
+                                       if(net_nfc_exchanger_get_alternative_carrier_data((net_nfc_connection_handover_info_h)data, &ac_info)== 0)
+                                       {
+                                               temp = (char *)net_nfc_get_data_buffer(ac_info);
+                                               if( temp != NULL)
+                                               {
+
+                                                       snprintf(buffer, 50, "%02x:%02x:%02x:%02x:%02x:%02x",temp[0], temp[1], temp[2], temp[3], temp[4], temp[5]);
+
+                                                       ac_data = (strdup(buffer));
+                                                       ac_data_size = strlen(ac_data ) +1;
+                                               }
+                                               net_nfc_free_data(ac_info);
+                                       }
+                               }
+
+                               nfc_p2p_connection_handover_completed_cb        cb = g_nfc_context.on_p2p_connection_handover_completed_cb;
+                               void *                                                                          user_data = g_nfc_context.on_p2p_connection_handover_completed_user_data;
+                               g_nfc_context.on_p2p_connection_handover_completed_cb = NULL;
+                               g_nfc_context.on_p2p_connection_handover_completed_user_data = NULL;
+                               cb(capi_result , carrior_type, (void *)ac_data, ac_data_size, user_data );
+
+                               net_nfc_exchanger_free_alternative_carrier_data((net_nfc_connection_handover_info_h)data);
+                               free(ac_data);
+                       }
+                       break;
+               }
+
+
+       case NET_NFC_MESSAGE_IS_TAG_CONNECTED :
+               {
+                       net_nfc_target_type_e  devType = *(net_nfc_target_type_e *)data;
+
+                       if( (devType == NET_NFC_NFCIP1_TARGET )||(devType == NET_NFC_NFCIP1_INITIATOR ))
+                       {
+                               net_nfc_get_current_target_handle(trans_data);
+                       }
+                       else if( (devType > NET_NFC_UNKNOWN_TARGET )&&(devType < NET_NFC_NFCIP1_TARGET ))
+                       {
+                               net_nfc_get_current_tag_info(trans_data);
+                       }
+                       else
+                       {
+                               if (result == NET_NFC_NOT_CONNECTED)
+                               {
+                                       capi_result = NFC_ERROR_NONE;
+                               }
+
+                               if( g_nfc_context.on_initialize_completed_cb ){
+                                       nfc_initialize_completed_cb             cb = g_nfc_context.on_initialize_completed_cb;
+                                       g_nfc_context.on_initialize_completed_cb = NULL;
+                                       cb( capi_result,trans_data );
+                               }
+                       }
+                       break;
+               }
+
+       case NET_NFC_MESSAGE_GET_CURRENT_TAG_INFO :
+               {
+                       net_nfc_target_info_s *target_info = (net_nfc_target_info_s *)data;
+
+                       if (target_info != NULL)
+                       {
+                               if (g_nfc_context.current_tag != NULL)
+                               {
+                                       net_nfc_release_tag_info((net_nfc_target_info_h)g_nfc_context.current_tag);
+                                       g_nfc_context.current_tag = NULL;
+                               }
+
+                               net_nfc_duplicate_target_info((net_nfc_target_info_h)target_info, (net_nfc_target_info_h *)&g_nfc_context.current_tag);
+                       }
+
+                       nfc_initialize_completed_cb cb = g_nfc_context.on_initialize_completed_cb;
+                       g_nfc_context.on_initialize_completed_cb = NULL;
+                       if (cb)
+                       {
+                               cb(capi_result, trans_data);
+                       }
+                       break;
+               }
+
+       case NET_NFC_MESSAGE_GET_CURRENT_TARGET_HANDLE :
+               {
+                       g_nfc_context.current_target = (net_nfc_target_handle_h)data;
+
+                       nfc_initialize_completed_cb             cb = g_nfc_context.on_initialize_completed_cb;
+                       g_nfc_context.on_initialize_completed_cb = NULL;
+                       if( cb ){
+                               cb( capi_result, trans_data );
+                       }
+
+                       break;
+               }
+
+       case NET_NFC_MESSAGE_INIT :
+               {
+                       bool activated = true;
+
+                       LOGE( "_nfc_response_handler NET_NFC_MESSAGE_INIT\n");
+
+                       if (result == NET_NFC_OK){
+                               if( g_nfc_context.on_activation_changed_cb != NULL ){
+                                       g_nfc_context.on_activation_changed_cb(activated , g_nfc_context.on_activation_changed_user_data);
+                                       LOGE( "_nfc_response_handler changed call back NET_NFC_MESSAGE_INIT NET_NFC_OK\n");
+                               }
+
+                               if( g_nfc_context.on_activation_completed_cb != NULL ){
+                                       g_nfc_context.on_activation_completed_cb(result , g_nfc_context.on_activation_completed_user_data);
+                                       LOGE( "_nfc_response_handler completed call back NET_NFC_MESSAGE_INIT NET_NFC_OK\n");
+
+                                       nfc_manager_unset_activation_completed_cb();
+                               }
+                               else
+                               {
+                                       g_nfc_context.on_activation_doing = false;
+                                       LOGE( "g_nfc_context.on_activation_doing\n");
+                               }
+                       }
+
+                       break;
+               }
+
+       case NET_NFC_MESSAGE_DEINIT :
+               {
+                       bool activated = false;
+
+                       if (result == NET_NFC_OK){
+                               if( g_nfc_context.on_activation_changed_cb != NULL ){
+                                       g_nfc_context.on_activation_changed_cb(activated , g_nfc_context.on_activation_changed_user_data);
+                                       LOGE( "_nfc_response_handler NET_NFC_MESSAGE_DEINIT NET_NFC_OK\n");
+                               }
+
+                               if( g_nfc_context.on_activation_completed_cb != NULL ){
+                                       g_nfc_context.on_activation_completed_cb(result , g_nfc_context.on_activation_completed_user_data);
+                                       LOGE( "_nfc_response_handler completed call back NET_NFC_MESSAGE_INIT NET_NFC_OK\n");
+
+                                       nfc_manager_unset_activation_completed_cb();
+                               }
+                               else
+                               {
+                                       g_nfc_context.on_activation_doing = false;
+                                       LOGE( "g_nfc_context.on_activation_doing\n");
+                               }
+                       }
+
+                       break;
+               }
+
+       case NET_NFC_MESSAGE_SET_SE :
+               {
+                       if( trans_data != NULL ){
+                               _async_callback_data *user_cb = (_async_callback_data*)trans_data;
+                               ((nfc_set_card_emulation_completed_cb)user_cb->callback)(capi_result, user_cb->user_data);
+                               free(user_cb);
+                       }
+                       break;
+               }
+
+       case NET_NFC_MESSAGE_SE_START_TRANSACTION :
+       case NET_NFC_MESSAGE_SE_END_TRANSACTION :
+       case NET_NFC_MESSAGE_SE_TYPE_TRANSACTION:
+       case NET_NFC_MESSAGE_SE_CONNECTIVITY :
+       case NET_NFC_MESSAGE_SE_FIELD_ON :
+       case NET_NFC_MESSAGE_SE_FIELD_OFF :
+       case NET_NFC_MESSAGE_SE_TYPE_CHANGED :
+       case NET_NFC_MESSAGE_SE_CARD_EMULATION_CHANGED :
+               {
+                       nfc_se_event_e event = NFC_SE_EVENT_START_TRANSACTION;
+                       switch( message ){
+                       case NET_NFC_MESSAGE_SE_START_TRANSACTION:
+                               event = NFC_SE_EVENT_START_TRANSACTION;
+                               break;
+                       case NET_NFC_MESSAGE_SE_END_TRANSACTION:
+                               event = NFC_SE_EVENT_END_TRANSACTION;
+                               break;
+                       case NET_NFC_MESSAGE_SE_CONNECTIVITY:
+                               event = NFC_SE_EVENT_CONNECTIVITY;
+                               break;
+                       case NET_NFC_MESSAGE_SE_FIELD_ON :
+                               event = NFC_SE_EVENT_FIELD_ON;
+                               break;
+                       case NET_NFC_MESSAGE_SE_FIELD_OFF :
+                               event = NFC_SE_EVENT_FIELD_OFF;
+                               break;
+                       case NET_NFC_MESSAGE_SE_TYPE_TRANSACTION:
+                               event = NFC_SE_EVENT_TRANSACTION;
+                               break;
+                       case NET_NFC_MESSAGE_SE_TYPE_CHANGED:
+                               event = NFC_SE_EVENT_SE_TYPE_CHANGED;
+                               break;
+                       case NET_NFC_MESSAGE_SE_CARD_EMULATION_CHANGED:
+                               event = NFC_SE_EVENT_SE_CARD_EMULATION_CHANGED;
+                       default:
+                               break;
+                       }
+
+                       if( g_nfc_context.on_se_event_cb ){
+                               g_nfc_context.on_se_event_cb(event, g_nfc_context.on_se_event_user_data);
+                       }
+                       if( message == NET_NFC_MESSAGE_SE_TYPE_TRANSACTION){
+                               net_nfc_se_event_info_s* transaction_data = (net_nfc_se_event_info_s*)data;
+
+                               bool fg_dispatch = transaction_data->fg_dispatch;
+                               net_nfc_se_type_e se_type = transaction_data->se_type;
+                               pid_t focus_app_pid = transaction_data->focus_app_pid;
+
+                               if(g_nfc_context.on_se_type == se_type)
+                               {
+                                       pid_t mypid = getpid();
+
+                                       if(fg_dispatch == false ||
+                                                       (fg_dispatch == true && focus_app_pid == (getpgid(mypid))))
+                                       {
+                                               if( NET_NFC_SE_TYPE_ESE == g_nfc_context.on_se_type)
+                                               {
+                                                       if( g_nfc_context.on_eSE_transaction_event_cb && transaction_data != NULL)
+                                                       {
+                                                               g_nfc_context.on_eSE_transaction_event_cb(
+                                                                       se_type,
+                                                                       transaction_data->aid.buffer,transaction_data->aid.length,
+                                                                       transaction_data->param.buffer,transaction_data->param.length,
+                                                                       g_nfc_context.on_eSE_transaction_event_user_data);
+                                                       }
+                                               }
+                                               else if( NET_NFC_SE_TYPE_UICC == g_nfc_context.on_se_type)
+                                               {
+                                                       if( g_nfc_context.on_UICC_transaction_event_cb && transaction_data != NULL)
+                                                       {
+                                                               g_nfc_context.on_UICC_transaction_event_cb(
+                                                                       se_type,
+                                                                       transaction_data->aid.buffer,transaction_data->aid.length,
+                                                                       transaction_data->param.buffer,transaction_data->param.length,
+                                                                       g_nfc_context.on_UICC_transaction_event_user_data);
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+       default :
+               break;
+       }
+
+}
+
+
+bool nfc_manager_is_supported(void)
+{
+       int nfc_supported = 0;
+
+       net_nfc_is_supported(&nfc_supported);
+
+       return nfc_supported;
+}
+
+
+int nfc_manager_set_activation(bool activation, nfc_activation_completed_cb callback, void *user_data)
+{
+       int ret = 0;
+       int nfc_supported = 0;
+       bool nfc_check_activation = 0;
+
+       nfc_check_activation = nfc_manager_check_activation();
+
+       if (nfc_check_activation == true)
+       {
+               LOGE( "nfc_manager_check_activation BUSY!!!!!");
+               return NFC_ERROR_DEVICE_BUSY;
+       }
+
+       net_nfc_is_supported(&nfc_supported);
+
+       if (!nfc_supported)
+       {
+               ret = NFC_ERROR_NOT_SUPPORTED;
+       }
+       else
+       {
+               if (nfc_manager_is_activated() == activation)
+               {
+                       if (activation)
+                       {
+                               ret = NFC_ERROR_ALREADY_ACTIVATED;
+                       }
+                       else
+                       {
+                               ret = NFC_ERROR_ALREADY_DEACTIVATED;
+                       }
+               }
+               else
+               {
+                       nfc_manager_set_activation_completed_cb(callback, user_data);
+
+                       ret = net_nfc_set_state(activation, NULL);
+
+                       if (ret == NET_NFC_OK)
+                       {
+                               ret = NFC_ERROR_NONE;
+                               LOGE( "nfc_manager_set_activation net_nfc_set_state success\n");
+                       }
+                       else
+                       {
+                               nfc_manager_unset_activation_completed_cb();
+                               ret = NFC_ERROR_OPERATION_FAILED;
+                               LOGE( "nfc_manager_set_activation net_nfc_set_state fail\n");
+                       }
+               }
+       }
+       return ret;
+
+}
+
+int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback , void *user_data)
+{
+       if( callback == NULL)
+               return _return_invalid_param(__func__);
+
+       g_nfc_context.on_activation_changed_cb = callback;
+       g_nfc_context.on_activation_changed_user_data = user_data;
+       return 0;
+}
+
+void nfc_manager_unset_activation_changed_cb(void)
+{
+       g_nfc_context.on_activation_changed_cb = NULL;
+       g_nfc_context.on_activation_changed_user_data = NULL;
+}
+
+bool nfc_manager_is_activated(void)
+{
+       int activated = 0;
+
+       net_nfc_get_state(&activated);
+
+       if(activated)
+       {
+               return true;
+       }
+       else
+       {
+               return false;
+       }
+}
+
+static bool _is_initialized()
+{
+       return g_nfc_context.initialized;
+}
+
+int nfc_manager_initialize (nfc_initialize_completed_cb callback, void *user_data)
+{
+       int ret;
+       int nfc_supported = 0;
+       init_context_t*  context;
+
+       net_nfc_is_supported(&nfc_supported);
+
+       if(!nfc_supported)
+       {
+               LOGE( "nfc_manager_initialize  NFC_ERROR_NOT_SUPPORTED \n");
+               return  NFC_ERROR_NOT_SUPPORTED;
+       }
+
+       if (!_is_initialized())
+       {
+               int type;
+
+               ret = net_nfc_initialize();
+               if( ret != NET_NFC_OK )
+                       return _convert_error_code(__func__, ret);
+
+               _clear_context();
+               net_nfc_set_response_callback( _nfc_response_handler , &g_nfc_context);
+
+               if (net_nfc_is_tag_connected_sync(&type) == NET_NFC_OK)
+               {
+                       if (type == NET_NFC_NFCIP1_INITIATOR ||
+                                       type == NET_NFC_NFCIP1_TARGET)
+                       {
+                               net_nfc_get_current_target_handle_sync(&g_nfc_context.current_target);
+                       }
+                       else
+                       {
+                               net_nfc_get_current_tag_info_sync((net_nfc_target_info_h *)&g_nfc_context.current_tag);
+                       }
+               }
+
+               g_nfc_context.initialized = true;
+
+               if (callback != NULL)
+               {
+                       context = (init_context_t*)malloc( sizeof(init_context_t));
+
+                       if(context == NULL )
+                               return NFC_ERROR_OUT_OF_MEMORY;
+
+                       memset(context , 0 , sizeof(init_context_t));
+                       context->cb = callback;
+                       context->ret = ret;
+                       context->user_data = user_data;
+                       g_idle_add((GSourceFunc)_init_callback, (gpointer)context);
+               }
+
+       }
+
+       return NFC_ERROR_NONE;
+}
+
+int nfc_manager_initialize_sync()
+{
+       int ret;
+       int nfc_supported = 0;
+
+       net_nfc_is_supported(&nfc_supported);
+       if (!nfc_supported)
+       {
+               LOGE("nfc_manager_initialize  NFC_ERROR_NOT_SUPPORTED \n");
+               return NFC_ERROR_NOT_SUPPORTED;
+       }
+
+       if (!_is_initialized())
+       {
+               int type;
+
+               ret = net_nfc_initialize();
+               if (ret != NET_NFC_OK)
+                       return _convert_error_code(__func__, ret);
+
+               _clear_context();
+               net_nfc_set_response_callback(_nfc_response_handler, &g_nfc_context);
+               if (net_nfc_is_tag_connected_sync(&type) == NET_NFC_OK)
+               {
+                       if (type == NET_NFC_NFCIP1_INITIATOR ||
+                                       type == NET_NFC_NFCIP1_TARGET)
+                       {
+                               net_nfc_get_current_target_handle_sync(&g_nfc_context.current_target);
+                       }
+                       else
+                       {
+                               net_nfc_get_current_tag_info_sync((net_nfc_target_info_h *)&g_nfc_context.current_tag);
+                       }
+               }
+
+               g_nfc_context.initialized = true;
+
+       }
+
+       return NFC_ERROR_NONE;
+}
+
+int nfc_manager_deinitialize (void)
+{
+       int ret = NFC_ERROR_NONE;
+
+       if (_is_initialized())
+       {
+#if 0
+               net_nfc_state_deactivate();
+#endif
+               if (ret == 0)
+                       net_nfc_unset_response_callback();
+
+               ret = net_nfc_deinitialize();
+
+               net_nfc_release_tag_info((net_nfc_target_info_h)g_nfc_context.current_tag);
+               memset(&g_nfc_context, 0, sizeof(g_nfc_context));
+       }
+
+       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 )
+{
+       net_nfc_set_tag_filter(filter);
+}
+
+int nfc_manager_get_tag_filter(void)
+{
+       return net_nfc_get_tag_filter();
+}
+
+int nfc_manager_get_connected_tag(nfc_tag_h * tag)
+{
+       int ret;
+       if( tag == NULL )
+               return _return_invalid_param(__func__);
+
+       if(g_nfc_context.current_tag == NULL)
+       {
+               return NFC_ERROR_NO_DEVICE;
+       }
+
+       if(g_nfc_context.current_tag->handle == NULL)
+       {
+               ret = NFC_ERROR_NO_DEVICE;
+       }
+       else
+       {
+               *tag = (nfc_tag_h)g_nfc_context.current_tag;
+               ret = NFC_ERROR_NONE;
+       }
+       return ret;
+}
+
+int nfc_manager_get_connected_target(nfc_p2p_target_h *target)
+{
+       int ret;
+
+       if( target == NULL )
+               return _return_invalid_param(__func__);
+
+       if(g_nfc_context.current_target == NULL)
+       {
+               ret = NFC_ERROR_NO_DEVICE;
+       }
+       else
+       {
+               *target = (nfc_p2p_target_h)g_nfc_context.current_target;
+               ret = NFC_ERROR_NONE;
+       }
+
+       return ret;
+}
+
+int nfc_manager_set_system_handler_enable(bool enable)
+{
+       int ret = NFC_ERROR_NONE;
+
+       ret = net_nfc_set_launch_popup_state(enable);
+
+       if( ret != NET_NFC_OK )
+               return _convert_error_code(__func__, ret);
+       else
+               return ret;
+}
+
+bool nfc_manager_is_system_handler_enabled(void)
+{
+       int state = 0;
+
+       net_nfc_get_launch_popup_state(&state);
+
+       return state;
+}
+
+int nfc_manager_set_card_emulation_se_type(nfc_se_type_e type, nfc_set_card_emulation_completed_cb callback, void* user_data)
+{
+       if ((type < NFC_SE_TYPE_DISABLE) || (type > NFC_SE_TYPE_UICC))
+       {
+               return _return_invalid_param(__func__);
+       }
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       _async_callback_data *trans_data = NULL;
+       int ret=0;
+       net_nfc_se_type_e se_type;
+
+       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;
+       }
+
+       switch(type)
+       {
+       case NFC_SE_TYPE_DISABLE:
+               se_type = NET_NFC_SE_TYPE_NONE;
+               break;
+       case NFC_SE_TYPE_ESE:
+               se_type = NET_NFC_SE_TYPE_ESE;
+               break;
+       case NFC_SE_TYPE_UICC:
+               se_type = NET_NFC_SE_TYPE_UICC;
+               break;
+       default:
+               break;
+       }
+
+       ret = net_nfc_set_secure_element_type(se_type, (void *)trans_data);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_manager_set_se_type(nfc_se_type_e type)
+{
+       int ret;
+       net_nfc_se_type_e se_type = NET_NFC_SE_TYPE_NONE;
+
+       if ((type < NFC_SE_TYPE_DISABLE) || (type > NFC_SE_TYPE_UICC))
+       {
+               return _return_invalid_param(__func__);
+       }
+
+       if (!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       switch (type)
+       {
+       case NFC_SE_TYPE_DISABLE :
+               se_type = NET_NFC_SE_TYPE_NONE;
+               break;
+       case NFC_SE_TYPE_ESE :
+               se_type = NET_NFC_SE_TYPE_ESE;
+               break;
+       case NFC_SE_TYPE_UICC :
+               se_type = NET_NFC_SE_TYPE_UICC;
+               break;
+       }
+
+       ret = net_nfc_set_secure_element_type_sync(se_type);
+
+       return _convert_error_code(__func__, ret);
+}
+
+
+int nfc_manager_get_card_emulation_se_type(nfc_se_type_e* type)
+{
+       int ret = NFC_ERROR_NONE;
+       int se_type;
+
+       if (type == NULL)
+               return _return_invalid_param(__func__);
+
+       if ((ret = vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_type)) != 0)
+       {
+               ret = NFC_ERROR_OPERATION_FAILED;
+               return ret;
+       }
+       else
+       {
+               if ((se_type >= NFC_SE_TYPE_DISABLE) && (se_type <= NFC_SE_TYPE_UICC))
+                       *type =         se_type;
+               else
+                       ret = NFC_ERROR_OPERATION_FAILED;
+       }
+
+       return ret;
+}
+
+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 )
+{
+       int ret;
+
+       if(record == NULL ||  text == NULL || lang_code == NULL )
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_create_text_type_record((ndef_record_h*)record, text, lang_code, encode);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char* uri)
+{
+       int ret;
+
+       if(record == NULL ||  uri == NULL)
+               return _return_invalid_param(__func__);
+
+       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( "OUT_OF_MEMORY (0x%08x)", 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)
+{
+       int ret;
+
+       if(record == NULL  )
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_free_record(record);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_set_id (nfc_ndef_record_h record, unsigned char *id , int id_size)
+{
+       int ret;
+
+       if (record == NULL || id == NULL || id_size <= 0)
+               return _return_invalid_param(__func__);
+
+       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, unsigned int *size)
+{
+       int ret ;
+
+       if(record == NULL ||  payload == NULL || size == NULL )
+               return _return_invalid_param(__func__);
+
+       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;
+
+       if (record == NULL || type == NULL || size == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_record_type(record, (data_h*)&type_data);
+       if( ret == 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)
+{
+       int ret ;
+       data_s *id_data;
+
+       if(record == NULL ||  id == NULL || size == NULL )
+               return _return_invalid_param(__func__);
+
+       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)
+{
+       int ret;
+
+       if(record == NULL ||  tnf == NULL )
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_record_tnf(record, (net_nfc_record_tnf_e*)tnf);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_text(nfc_ndef_record_h record, char** buffer)
+{
+       int ret;
+
+       if(record == NULL ||  buffer == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_create_text_string_from_text_record(record, buffer);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code)
+{
+       int ret;
+
+       if(record == NULL ||  lang_code == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_languange_code_string_from_text_record(record, lang_code);
+       return _convert_error_code(__func__, ret);
+}
+int nfc_ndef_record_get_encode_type(nfc_ndef_record_h record, nfc_encode_type_e *encode)
+{
+       int ret=0;
+
+       if(record == NULL ||  encode == NULL  )
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_encoding_type_from_text_record(record, (net_nfc_encode_type_e*)encode);
+       //      if( ret == NFC_NDEF_RECORD_IS_NOT_EXPECTED_TYPE)
+       //              LOGE("%s reord type is not text type");
+       return _convert_error_code(__func__, ret);
+}
+int nfc_ndef_record_get_uri(nfc_ndef_record_h record , char **uri)
+{
+       int ret=0;
+
+       if(record == NULL ||  uri == NULL  )
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_create_uri_string_from_uri_record(record, uri);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_create(nfc_ndef_message_h* ndef_message)
+{
+       int ret = 0;
+
+       if( ndef_message == NULL )
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_create_ndef_message(ndef_message);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h* ndef_message,
+               const unsigned char* rawdata, unsigned int rawdata_size)
+{
+       int ret = 0;
+
+       if (ndef_message == NULL || rawdata == NULL || rawdata_size <= 0)
+               return _return_invalid_param(__func__);
+
+       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)
+{
+       int ret = 0;
+
+       if( ndef_message == NULL )
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_free_ndef_message(ndef_message);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message , int *count)
+{
+       int ret = 0;
+
+       if( ndef_message == NULL || count == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_ndef_message_record_count(ndef_message , count);
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message ,
+               unsigned char ** rawdata , unsigned int *rawdata_size)
+{
+       int ret=0;
+       data_s *rawdata_data = NULL;
+
+       if (ndef_message == NULL || rawdata == NULL || rawdata_size == NULL )
+               return _return_invalid_param(__func__);
+
+       *rawdata = NULL;
+       *rawdata_size = 0;
+
+       ret = net_nfc_create_rawdata_from_ndef_message(ndef_message, (data_h *)&rawdata_data);
+       if (ret == NET_NFC_OK) {
+               *rawdata = calloc(1, rawdata_data->length);
+               if (*rawdata != NULL) {
+                       memcpy(*rawdata, rawdata_data->buffer, rawdata_data->length);
+                       *rawdata_size = rawdata_data->length;
+               } else {
+                       ret = NET_NFC_ALLOC_FAIL;
+               }
+               net_nfc_free_data((data_h)rawdata_data);
+       }
+
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_get_rawdata_size(nfc_ndef_message_h ndef_message,
+               unsigned int *byte_size)
+{
+       int ret = 0;
+
+       if( ndef_message == NULL || byte_size == NULL)
+               return _return_invalid_param(__func__);
+
+       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)
+{
+       int ret=0;
+
+       if( ndef_message == NULL || record == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_append_record_to_ndef_message(ndef_message , record );
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message , int index, nfc_ndef_record_h record)
+{
+       int ret=0;
+
+       if( ndef_message == NULL || record == NULL )
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_append_record_by_index(ndef_message , index , record);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message , int index)
+{
+       int ret=0;
+
+       if( ndef_message == NULL )
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_remove_record_by_index(ndef_message , index);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message , int index , nfc_ndef_record_h *record)
+{
+       int ret=0;
+
+       if( ndef_message == NULL || record == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_record_by_index(ndef_message , index , (ndef_record_h*)record);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_get_type( nfc_tag_h tag , nfc_tag_type_e *type)
+{
+       int ret=0;
+
+       if( tag == NULL || type == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_tag_type( tag, (net_nfc_target_type_e*) type);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_is_support_ndef(nfc_tag_h tag, bool * is_support)
+{
+       int ret=0;
+
+       if( tag == NULL || is_support== NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_tag_ndef_support(tag , is_support);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag , unsigned int * max_size)
+{
+       int ret=0;
+
+       if( tag == NULL || max_size == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_tag_max_data_size(tag , max_size);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int * actual_data_size)
+{
+       int ret=0;
+
+       if( tag == NULL || actual_data_size == NULL)
+               return _return_invalid_param(__func__);
+
+       ret = net_nfc_get_tag_actual_data_size(tag , actual_data_size);
+       return _convert_error_code(__func__, ret);
+}
+
+int nfc_tag_foreach_information(nfc_tag_h tag , nfc_tag_information_cb callback , void * user_data )
+{
+       int i;
+       net_nfc_tag_info_s *taglist = g_nfc_context.current_tag->tag_info_list;
+
+       if( tag == NULL || callback == NULL )
+               return _return_invalid_param(__func__);
+
+       for(i=0; i<g_nfc_context.current_tag->number_of_keys; i++){
+               bool cont;
+               cont = callback(taglist[i].key, net_nfc_get_data_buffer(taglist[i].value), net_nfc_get_data_length(taglist[i].value), user_data);
+               if( !cont )
+                       break;
+       }
+
+       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 || buffer == NULL || buffer_size <= 0)
+               return _return_invalid_param(__func__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       if(_check_app_permission() == false)
+       {
+               LOGE("permission check fail");
+               return NFC_ERROR_SECURITY_RESTRICTED;
+       }
+
+       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__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       int ret=0;
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+
+
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+       }
+       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)
+{
+
+       int ret=0;
+       unsigned int byte_size = 0;
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+
+       if (tag == NULL || msg == NULL)
+               return _return_invalid_param(__func__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       if(_check_app_permission() == false)
+       {
+               LOGE("permission check fail");
+               return NFC_ERROR_SECURITY_RESTRICTED;
+       }
+
+
+       if (tag_info->ndefCardState == NET_NFC_NDEF_CARD_READ_ONLY )
+       {
+               return NFC_ERROR_READ_ONLY_NDEF;
+
+       }
+
+       nfc_ndef_message_get_rawdata_size(msg , &byte_size);
+
+       if(tag_info->maxDataSize < byte_size)
+       {
+               return NFC_ERROR_NO_SPACE_ON_NDEF;
+       }
+
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;
+               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 || key == NULL || key_size <= 0)
+               return _return_invalid_param(__func__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       if(_check_app_permission() == false)
+       {
+               LOGE("permission check fail");
+               return NFC_ERROR_SECURITY_RESTRICTED;
+       }
+
+       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 || auth_key == NULL)
+               return _return_invalid_param(__func__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       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 || auth_key == NULL)
+               return _return_invalid_param(__func__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       data_s auth_key_data = { auth_key , 6};
+       int ret = 0;
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       }
+
+       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__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       int ret = 0;
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+               trans_data->callback_type = _NFC_CALLBACK_TYPE_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)
+{
+       if (tag == NULL)
+               return _return_invalid_param(__func__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       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 || buffer == NULL || buffer_size <= 0)
+               return _return_invalid_param(__func__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       int ret = 0;
+       data_s block_data = { buffer , buffer_size};
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       }
+
+       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 || buffer == NULL || buffer_size <= 0)
+               return _return_invalid_param(__func__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       int ret = 0;
+       data_s block_data = { buffer , buffer_size};
+       _async_callback_data * trans_data = NULL;
+
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+
+
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       }
+
+       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__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       int ret = 0;
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       }
+
+       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__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       int ret = 0;
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+
+
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       }
+
+       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__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       int ret = 0;
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+
+
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       }
+
+       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__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+
+       int ret = 0;
+       _async_callback_data * trans_data = NULL;
+       net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
+
+       if( callback != NULL ){
+               trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
+               if(trans_data == NULL )
+                       return NFC_ERROR_OUT_OF_MEMORY;
+               memset(trans_data , 0 , sizeof(_async_callback_data));
+               trans_data->callback = callback;
+               trans_data->user_data = user_data;
+               trans_data->callback_type = _NFC_CALLBACK_TYPE_RESULT;
+       }
+
+       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__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       if(_check_app_permission() == false)
+       {
+               LOGE("permission check fail");
+               return NFC_ERROR_SECURITY_RESTRICTED;
+       }
+
+       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, NULL);
+
+       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;
+
+       ret = net_nfc_free_exchanger_data(data_handle);
+
+       if( ret != 0 ){
+               return _convert_error_code(__func__, ret);
+       }
+
+       return 0;
+}
+
+int nfc_p2p_send_no_permission(nfc_p2p_target_h target , nfc_ndef_message_h message , nfc_p2p_send_completed_cb callback, void *user_data)
+{
+       int ret;
+
+       if( target == NULL || message == NULL  )
+               return _return_invalid_param(__func__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       net_nfc_exchanger_data_h data_handle;
+       data_h rawdata;
+       net_nfc_create_rawdata_from_ndef_message(message, &rawdata);
+       ret = net_nfc_create_exchanger_data(&data_handle,  rawdata);
+       net_nfc_free_data(rawdata);
+
+
+       if( ret != 0)
+               return _convert_error_code(__func__, ret);
+
+       ret = net_nfc_send_exchanger_data(data_handle ,(net_nfc_target_handle_h)target, NULL);
+
+       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;
+
+       ret = net_nfc_free_exchanger_data(data_handle);
+
+       if( ret != 0 ){
+               return _convert_error_code(__func__, ret);
+       }
+
+       return 0;
+}
+
+int nfc_p2p_connection_handover(nfc_p2p_target_h target , nfc_ac_type_e type, nfc_p2p_connection_handover_completed_cb callback, void *user_data){
+       int ret;
+       net_nfc_conn_handover_carrier_type_e net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+
+       if( target == NULL  )
+               return _return_invalid_param(__func__);
+
+       if( type > NFC_AC_TYPE_UNKNOWN  )
+               return _return_invalid_param(__func__);
+
+       if(!nfc_manager_is_activated())
+       {
+               return NFC_ERROR_NOT_ACTIVATED;
+       }
+
+       switch( type ){
+       case NFC_AC_TYPE_BT:
+               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_BT;
+               break;
+       case NFC_AC_TYPE_WIFI:
+               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS;
+               break;
+       case NFC_AC_TYPE_WIFI_DIRECT:
+               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_IBSS;
+               break;
+       case NFC_AC_TYPE_UNKNOWN :
+               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+               break;
+
+       default:
+               break;
+       }
+       ret = net_nfc_exchanger_request_connection_handover((net_nfc_target_handle_h)target, net_ac_type);
+
+       if( ret != 0 ){
+               return _convert_error_code(__func__, ret);
+       }
+
+       g_nfc_context.on_p2p_connection_handover_completed_cb = callback;
+       g_nfc_context.on_p2p_connection_handover_completed_user_data = user_data;
+
+       return 0;
+}
+
+bool nfc_p2p_is_supported_ac_type( nfc_ac_type_e carrior)
+{
+       if( carrior > NFC_AC_TYPE_UNKNOWN  )
+               return false;
+
+       if( carrior == NFC_AC_TYPE_BT){
+               return true;
+       }
+       else{
+               return false;
+       }
+}
+
+int nfc_p2p_set_data_received_cb(nfc_p2p_target_h target, nfc_p2p_data_recived_cb callback, void *user_data)
+{
+       if( target == NULL || callback == NULL )
+               return _return_invalid_param(__func__);
+
+       //      if( g_nfc_context.current_target.connection_id != ((net_nfc_target_handle_s*)target)->connection_id )
+       if(g_nfc_context.current_target != target )
+               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_se_enable_card_emulation()
+{
+       net_nfc_error_e result;
+
+       result = net_nfc_set_card_emulation_mode_sync(NET_NFC_CARD_EMELATION_ENABLE);
+
+       return _convert_error_code(__func__, result);
+}
+
+int nfc_se_disable_card_emulation()
+{
+       net_nfc_error_e result;
+
+       result = net_nfc_set_card_emulation_mode_sync(NET_NFC_CARD_EMULATION_DISABLE);
+
+       return _convert_error_code(__func__, result);
+}
+
+int nfc_se_get_card_emulation_mode(nfc_se_card_emulation_mode_type_e *type)
+{
+       int ret;
+       int se_type;
+
+       ret = vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_type);
+       if (ret == 0)
+       {
+               if(se_type == NFC_SE_TYPE_DISABLE)
+               {
+                       *type = NFC_SE_CARD_EMULATION_MODE_OFF;
+                       ret = NFC_ERROR_NONE;
+
+               }
+               else if(se_type >= NFC_SE_TYPE_ESE && se_type <= NFC_SE_TYPE_UICC)
+               {
+                       *type = NFC_SE_CARD_EMULATION_MODE_ON;
+                       ret = NFC_ERROR_NONE;
+               }
+               else
+               {
+                       ret = NFC_ERROR_OPERATION_FAILED;
+               }
+       }
+       else
+       {
+               ret = NFC_ERROR_OPERATION_FAILED;
+       }
+
+       return ret;
+}
+
+
+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_type = NET_NFC_SE_TYPE_NONE;
+       g_nfc_context.on_se_event_cb = NULL;
+       g_nfc_context.on_se_event_user_data = NULL;
+}
+
+int nfc_manager_set_se_transaction_event_cb(nfc_se_type_e se_type,
+               nfc_se_transaction_event_cb callback, void *user_data)
+{
+       if( callback == NULL )
+               return _return_invalid_param(__func__);
+
+       g_nfc_context.on_se_type = se_type;
+
+       if(se_type == NFC_SE_TYPE_ESE)
+       {
+               g_nfc_context.on_eSE_transaction_event_cb = callback;
+               g_nfc_context.on_eSE_transaction_event_user_data = user_data;
+       }
+       else if(se_type == NFC_SE_TYPE_UICC)
+       {
+               g_nfc_context.on_UICC_transaction_event_cb = callback;
+               g_nfc_context.on_UICC_transaction_event_user_data = user_data;
+       }
+
+       return 0;
+}
+
+void nfc_manager_unset_se_transaction_event_cb(nfc_se_type_e se_type)
+{
+       if(se_type == NFC_SE_TYPE_ESE)
+       {
+               g_nfc_context.on_eSE_transaction_event_cb = NULL;
+               g_nfc_context.on_eSE_transaction_event_user_data = NULL;
+       }
+       else if(se_type == NFC_SE_TYPE_UICC)
+       {
+               g_nfc_context.on_UICC_transaction_event_cb = NULL;
+               g_nfc_context.on_UICC_transaction_event_user_data = NULL;
+       }
+}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
new file mode 100644 (file)
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..ac64c77
--- /dev/null
@@ -0,0 +1,679 @@
+/*
+* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#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;
+       uint32_t 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);
+       }
+
+}
+
+
+void ndef_record_create_test(nfc_error_e error, void *user_data){
+       int ret=0;
+       char *tnf_tbl[] = {
+                       "NFC_RECORD_TNF_EMPTY",
+                       "NFC_RECORD_TNF_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;
+       unsigned 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 ;
+
+}
+
+
+
+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(nfc_error_e error, void *user_data){
+       int ret;
+
+       success = 0;
+       timeout_counter = 30;
+
+       ret = nfc_manager_set_ndef_discovered_cb(_ndef_discovered_cb , NULL);
+       print_result("nfc_manager_set_ndef_discovered_cb", ret);
+       printf("Now, Bring the tag closer.\n");
+       ecore_timer_add(1, timeout_handler, NULL);
+
+}
+
+void _write_completed_cb(nfc_error_e result ,  void * user_data){
+
+       printf("write completed!result %s\n" , result == 0 ? "Success": "Fail");
+       success  = 1;
+       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(nfc_error_e error, void *user_data){
+
+       nfc_tag_h  tag;
+       int ret ;
+
+       printf("write_ndef_to_tag\n");
+       ret = nfc_manager_get_connected_tag(&tag);
+       printf("nfc_manager_get_connected_tag ret(0x%08x)  !\n",ret);
+
+
+       if ( ret == NFC_ERROR_NONE)
+       {
+               printf("tag alread attached !\n");
+               //write NDEF Message
+               nfc_ndef_record_h record;
+               nfc_ndef_message_h message;
+               nfc_ndef_record_create_uri(&record, "http://samsung.com");
+               nfc_ndef_message_create(&message);
+               nfc_ndef_message_append_record(message, record);
+               printf("Write request!\n");
+               timeout_counter = 30;
+               nfc_tag_write_ndef(tag, message , _write_completed_cb , NULL);
+               nfc_ndef_message_destroy(message);
+       }
+       else
+       {
+
+       int ret;
+
+       success = 0;
+       timeout_counter = 30;
+
+       ret = nfc_manager_set_tag_discovered_cb( _tag_discovered_cb , NULL);
+       print_result("nfc_manager_set_tag_discovered_cb", ret);
+
+       printf("Now, Bring the tag closer. Will be writen a new NDEF Message\n");
+       ecore_timer_add(1, timeout_handler, NULL);
+
+       }
+}
+
+
+void _send_completed_cb(nfc_error_e result , void *user_data){
+       printf("send completed!result %s\n" , result == 0 ? "Success": "Fail");
+       success  = 1;
+       is_terminate = 1;
+}
+
+
+
+void _handover_completed_cb(nfc_error_e result, nfc_ac_type_e carrior, void * ac_data, int ac_data_size , void *user_data){
+
+       char * address =(char *) (strdup(ac_data));
+
+       printf("handover completed!result %d AC type is [%d] \n" , result,carrior);
+       printf("address [%s] address size[%d]\n" , address, ac_data_size);
+
+       free(address);
+       success  = 1;
+       is_terminate = 1;
+}
+
+Eina_Bool send_test(void *data){
+
+       nfc_p2p_target_h target = (nfc_p2p_target_h)data;
+       nfc_ndef_message_h message;
+       nfc_ndef_record_h record;
+
+       nfc_ndef_record_create_uri(&record, "http://samsung.com");
+       nfc_ndef_message_create(&message);
+       nfc_ndef_message_append_record(message, record);
+       printf("Send Request!\n");
+       timeout_counter =30;
+       nfc_p2p_send(target, message , _send_completed_cb, NULL);
+       nfc_ndef_message_destroy(message);
+       return 0;
+}
+
+
+Eina_Bool handover_test(void *data){
+
+       nfc_p2p_target_h target = (nfc_p2p_target_h)data;
+       nfc_ac_type_e type = NFC_AC_TYPE_BT;
+
+       if(nfc_p2p_is_supported_ac_type(type))
+               printf("NFC_AC_TYPE_BT supported\n");
+
+       nfc_p2p_connection_handover(target, type , _handover_completed_cb, NULL);
+
+       return 0;
+}
+
+void _target_discovered_cb(nfc_discovered_type_e type, nfc_p2p_target_h target, void * user_data){
+       if( type == NFC_DISCOVERED_TYPE_ATTACHED){
+               printf("Discovered new target!\n");
+               ecore_idler_add(send_test, target);
+       }
+}
+
+void _target_discovered_for_connect_handover_cb(nfc_discovered_type_e type, nfc_p2p_target_h target, void * user_data){
+       if( type == NFC_DISCOVERED_TYPE_ATTACHED){
+               printf("Discovered new target!\n");
+               ecore_idler_add(handover_test, target);
+       }
+}
+void _card_emulation_changed_cb(nfc_se_event_e event , void *user_data){
+       if(NFC_SE_EVENT_SE_CARD_EMULATION_CHANGED == event)
+       {
+               printf("CARD_EMULATION_CHANGED arrived!!!!\n");
+       }
+}
+
+void send_ndef_to_peer(nfc_error_e error, void *user_data){
+
+       nfc_p2p_target_h target;
+       int ret ;
+
+       printf("send_ndef_to_peer\n");
+
+       ret = nfc_manager_get_connected_target(&target);
+       if ( ret == NFC_ERROR_NONE)
+       {
+               printf("target already attached!\n");
+               ecore_idler_add(send_test, target);
+       }
+       else
+       {
+
+       int ret ;
+       success = 0;
+       timeout_counter =30;
+       ret = nfc_manager_set_p2p_target_discovered_cb(_target_discovered_cb , NULL);
+       printf("Now, Bring the target closer. Will be sent a new NDEF Message\n");
+       ecore_timer_add(1, timeout_handler, NULL);
+       }
+}
+
+void connect_handover_to_peer(nfc_error_e error, void *user_data){
+       int ret ;
+       success = 0;
+       timeout_counter =30;
+       ret = nfc_manager_set_p2p_target_discovered_cb(_target_discovered_for_connect_handover_cb , NULL);
+       printf("Now, Bring the target closer. Will be tried to connect handover\n");
+       ecore_timer_add(1, timeout_handler, NULL);
+}
+
+
+void set_card_emulation_cb_test(nfc_error_e error, void *user_data){
+       int ret ;
+       success = 0;
+       timeout_counter =30;
+
+       ret = nfc_manager_set_se_event_cb(_card_emulation_changed_cb, NULL);
+       if(0 == ret)
+       {
+               printf("card emulation cb registered. Will be tried to card emulation change\n");
+
+       }
+
+       ret = nfc_se_enable_card_emulation();
+
+       printf("card emulation result is = %d\n", ret);
+       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(nfc_error_e error, void *user_data){
+       int ret ;
+       success = 0;
+       timeout_counter = 30;
+       ret = nfc_manager_set_p2p_target_discovered_cb(_target_discovered_cb2 , NULL);
+       printf("Now, Bring the target closer. and send a new NDEF Message to the this target\n");
+       ecore_timer_add(1, timeout_handler, NULL);
+
+}
+
+
+void _activation_changed_cb(bool activated , void *user_data){
+       if( activated == true){
+               printf("NET_NFC_MESSAGE_INIT received\n");
+       }else if( activated == false){
+               printf("NET_NFC_MESSAGE_DEINIT received\n");
+       }
+}
+
+
+void on_activation_changed_cb_test(nfc_error_e error, void *user_data){
+       int ret ;
+       success = 0;
+       timeout_counter = 30;
+       ret = nfc_manager_set_activation_changed_cb(_activation_changed_cb , NULL);
+       printf("Now, wait NET_NFC_MESSAGE_INIT or NET_NFC_MESSAGE_DEINIT\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"
+       " 0. NFC OFF\n"
+       " 1. NFC ON\n"
+       " 2. ON/OFF on_activation_changed_cb check\n"
+       "------------------\n"
+
+       " a. ndef record test\n"
+       " b. ndef discoverd cb test\n"
+       " c. write ndef to tag \n"
+       " d. send ndef to peer \n"
+       " e. recv ndef from peer\n"
+       " f. connect handover to peer\n"
+       "------------------\n"
+
+       " g. ON nfc_manager_enable_system_handler\n"
+       " h. OFF nfc_manager_enable_system_handler\n"
+       " i. connect handover to peer\n"
+
+       "------------------\n"
+       ">";
+
+ void  set_activation_completed_cb(nfc_error_e error, void *user_data)
+{
+       printf("set_activation_completed_cb  ret(%d) \n", error);
+
+}
+
+int main(int argc, char ** argv)
+{
+       elm_init(argc, argv);
+       is_terminate = 0;
+       char select;
+       int ret;
+
+
+       printf("%s", menu );
+       ret = scanf("%c", &select);
+
+       switch(select){
+
+               case '0':
+                       ret =  nfc_manager_set_activation(0, set_activation_completed_cb, NULL);
+                       printf("nfc_manager_set_activation set off  ret(0x%08x) \n", ret);
+
+                       if (ret == NFC_ERROR_NOT_SUPPORTED)
+                       {
+                               printf("NFC_ERROR_NOT_SUPPORTED \n");
+                       }
+                       else if (ret == NFC_ERROR_ALREADY_ACTIVATED)
+                       {
+                               printf("NFC_ERROR_ALREADY_ACTIVATED \n");
+
+                       }
+                       else if (ret == NFC_ERROR_ALREADY_DEACTIVATED)
+                       {
+                               printf("NFC_ERROR_ALREADY_DEACTIVATED \n");
+
+                       }
+                       else if (ret == NFC_ERROR_OPERATION_FAILED)
+                       {
+                               printf("NFC_ERROR_OPERATION_FAILED \n");
+
+                       }
+                       elm_shutdown();
+                       return 0;
+
+               case '1':
+                       ret =  nfc_manager_set_activation(1, set_activation_completed_cb, NULL);
+                       printf("nfc_manager_set_activation set off  ret(0x%08x) \n", ret);
+
+                       if (ret == NFC_ERROR_NOT_SUPPORTED)
+                       {
+                               printf("NFC_ERROR_NOT_SUPPORTED \n");
+                       }
+                       else if (ret == NFC_ERROR_ALREADY_ACTIVATED)
+                       {
+                               printf("NFC_ERROR_ALREADY_ACTIVATED \n");
+
+                       }
+                       else if (ret == NFC_ERROR_ALREADY_DEACTIVATED)
+                       {
+                               printf("NFC_ERROR_ALREADY_DEACTIVATED \n");
+
+                       }
+                       else if (ret == NFC_ERROR_OPERATION_FAILED)
+                       {
+                               printf("NFC_ERROR_OPERATION_FAILED \n");
+
+                       }
+                       elm_shutdown();
+                       return 0;
+
+               case '2':
+                       ret = nfc_manager_initialize(on_activation_changed_cb_test,NULL);
+                       print_result("on_activation_changed_cb", ret);
+                       break;
+
+               case 'a':
+                       ret = nfc_manager_initialize(ndef_record_create_test,NULL);
+                       print_result("nfc_manager_initialize", ret);
+                       break;
+               case 'b':
+                       ret = nfc_manager_initialize(read_ndef_from_tag_using_ndef_discovered,NULL);
+                       print_result("nfc_manager_initialize", ret);
+                       break;
+               case 'c':
+                       ret = nfc_manager_initialize(write_ndef_to_tag,NULL);
+                       print_result("nfc_manager_initialize", ret);
+                       break;
+               case 'd':
+                       ret = nfc_manager_initialize(send_ndef_to_peer,NULL);
+                       print_result("nfc_manager_initialize", ret);
+                       break;
+               case 'e':
+                       ret = nfc_manager_initialize(recv_ndef_from_peer,NULL);
+                       print_result("nfc_manager_initialize", ret);
+                       break;
+               case 'f':
+                       ret = nfc_manager_initialize(connect_handover_to_peer,NULL);
+                       print_result("nfc_manager_initialize", ret);
+                       break;
+
+
+               case 'g':
+                       ret = nfc_manager_set_system_handler_enable(true);
+
+                       printf("nfc_manager_set_system_handler_enable(true) ret [%d] current [%d]\n", ret,nfc_manager_is_system_handler_enabled());
+                       elm_shutdown();
+                       return 0;
+               case 'h':
+                       ret = nfc_manager_set_system_handler_enable(false);
+                       printf("nfc_manager_set_system_handler_enable(false) ret [%d] current [%d]\n", ret,nfc_manager_is_system_handler_enabled());
+                       elm_shutdown();
+                       return 0;
+
+               case 'i':
+                       ret = nfc_manager_initialize(set_card_emulation_cb_test,NULL);
+                       print_result("nfc_manager_initialize", ret);
+                       break;
+
+               default:
+                       printf("wrong selection!\n");
+                       is_terminate = 1;
+       }
+
+
+
+       ecore_timer_add(1, check_terminate, NULL);
+
+       elm_run();
+       elm_shutdown();
+
+
+       return 0;
+}