Apply Tizen 2.4 nfc api 88/41388/1 tizen_3.0.m1_mobile tizen_3.0.m1_tv accepted/tizen/mobile/20150617.082148 accepted/tizen/tv/20150617.082158 accepted/tizen/wearable/20150617.082209 submit/tizen/20150617.022523 submit/tizen/20150617.050123 submit/tizen_common/20151015.190624 submit/tizen_common/20151019.135620 submit/tizen_common/20151023.083358 submit/tizen_common/20151026.085049 tizen_3.0.m1_mobile_release tizen_3.0.m1_tv_release tizen_3.0.m2.a1_mobile_release tizen_3.0.m2.a1_tv_release
authorJihoon Jung <jh8801.jung@samsung.com>
Mon, 15 Jun 2015 02:46:40 +0000 (11:46 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Mon, 15 Jun 2015 02:47:21 +0000 (11:47 +0900)
Signed-off-by: Ji-hoon Jung <jh8801.jung@samsung.com>
Change-Id: If624822f8dc4a4b424afe1a299d833b603c49414

50 files changed:
CMakeLists.txt
LICENSE.APLv2
TC/_export_env.sh [deleted file]
TC/_export_target_env.sh [deleted file]
TC/build.sh [deleted file]
TC/clean.sh [deleted file]
TC/config [deleted file]
TC/push.sh [deleted file]
TC/run.sh [deleted file]
TC/testcase/Makefile [deleted file]
TC/testcase/tslist [deleted file]
TC/testcase/utc_network_nfc.c [deleted file]
TC/testcase/utc_network_nfc_ndef_message.c [deleted file]
TC/testcase/utc_network_nfc_ndef_record.c [deleted file]
TC/testcase/utc_network_nfc_se.c [deleted file]
TC/testcase/utc_network_nfc_snep.c [deleted file]
TC/tet_scen [deleted file]
TC/tetbuild.cfg [deleted file]
TC/tetclean.cfg [deleted file]
TC/tetexec.cfg [deleted file]
capi-network-nfc.manifest [new file with mode: 0644]
capi-network-nfc.pc.in
debian/README [deleted file]
debian/capi-network-nfc-dev.install [deleted file]
debian/capi-network-nfc-dev.postinst [deleted file]
debian/capi-network-nfc.install [deleted file]
debian/capi-network-nfc.postinst [deleted file]
debian/changelog [deleted file]
debian/compat [deleted file]
debian/control [deleted file]
debian/rules [deleted file]
doc/nfc_doc.h [new file with mode: 0755]
include/nfc.h [changed mode: 0644->0755]
include/nfc_common.h [new file with mode: 0644]
include/nfc_internal.h [changed mode: 0644->0755]
include/nfc_private.h [deleted file]
packaging/capi-network-nfc [new file with mode: 0644]
packaging/capi-network-nfc.manifest [deleted file]
packaging/capi-network-nfc.spec
src/nfc.c [deleted file]
src/nfc_card_emulation.c [new file with mode: 0644]
src/nfc_common.c [new file with mode: 0644]
src/nfc_manager.c [new file with mode: 0644]
src/nfc_ndef.c [new file with mode: 0644]
src/nfc_p2p.c [new file with mode: 0644]
src/nfc_p2p_handover.c [new file with mode: 0644]
src/nfc_tag.c [new file with mode: 0644]
test/CMakeLists.txt
test/network_nfc_test.c [deleted file]
test/nfc_unit_test.c [new file with mode: 0644]

index 6b4d14f..5f623ad 100644 (file)
@@ -11,27 +11,36 @@ SET(Services
         "social"
         "telephony"
         "system"
-)
+   )
 
 # project
 SET(project_prefix "capi")
+SET(prefix "/usr")
+SET(version "0.0.3")
+SET(maintainer "Seungkeun Lee <sngn.lee@samsung.com>, Kangho Hur<kagho.hur@samsung.com>")
+SET(description "A NFC library in Tizen Native API")
 SET(service "network")
 SET(submodule "nfc")
 
+# for package file
+SET(dependents "dlog glib-2.0 gio-2.0 nfc capi-base-common vconf capi-system-info")
+SET(pc_dependents "capi-base-common")
+
 SET(fw_name "${project_prefix}-${service}-${submodule}")
-PROJECT(${fw_name} C)
 
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX ${prefix})
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(LIBDIR ${CMAKE_LIB_DIR})
+SET(VERSION ${version})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR})
 
 INCLUDE(FindPkgConfig)
-IF(X11_SUPPORT)
-pkg_check_modules(pkgs REQUIRED dlog glib-2.0 gio-2.0 nfc-common nfc capi-base-common
-       vconf ecore-x)
-ELSE()
-pkg_check_modules(pkgs REQUIRED dlog glib-2.0 gio-2.0 nfc-common nfc capi-base-common
-       vconf)
-ENDIF(X11_SUPPORT)
-FOREACH(flag ${pkgs_CFLAGS})
+pkg_check_modules(${fw_name} REQUIRED ${dependents})
+FOREACH(flag ${${fw_name}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
 
@@ -42,35 +51,48 @@ IF("${ARCH}" STREQUAL "arm")
     ADD_DEFINITIONS("-DTARGET")
 ENDIF("${ARCH}" STREQUAL "arm")
 
-IF(X11_SUPPORT)
-    ADD_DEFINITIONS("-DHAVE_X11")
-ENDIF(X11_SUPPORT)
 ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DTIZEN_DEBUG")
 
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIBDIR}")
 
-SET(SOURCES src/nfc.c)
+SET(SOURCES src/nfc_p2p.c
+                       src/nfc_p2p_handover.c
+                       src/nfc_tag.c
+                       src/nfc_card_emulation.c
+                       src/nfc_manager.c
+                       src/nfc_common.c
+                       src/nfc_ndef.c)
 
 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
-TARGET_LINK_LIBRARIES(${fw_name} ${pkgs_LDFLAGS})
-SET_TARGET_PROPERTIES(${fw_name} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
 
-INSTALL(TARGETS ${fw_name} DESTINATION ${LIB_INSTALL_DIR})
+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 ${LIBDIR})
 INSTALL(
-        DIRECTORY include/ DESTINATION include/${service}
+        DIRECTORY ${INC_DIR}/ DESTINATION include/${service}
         FILES_MATCHING
-        PATTERN "*_internal.h" EXCLUDE
-        PATTERN "include/*.h"
+        PATTERN "*_common.h" EXCLUDE
+        PATTERN "${INC_DIR}/*.h"
         )
 
 SET(PC_NAME ${fw_name})
-SET(PC_REQUIRED "capi-base-common")
+SET(PC_REQUIRED ${pc_dependents})
 SET(PC_LDFLAGS -l${fw_name})
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(VERSION ${FULLVER})
 
-CONFIGURE_FILE(${fw_name}.pc.in ${fw_name}.pc @ONLY)
-INSTALL(FILES ${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+CONFIGURE_FILE(
+    ${fw_name}.pc.in
+    ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc
+    @ONLY
+)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIBDIR}/pkgconfig)
 
 #ADD_SUBDIRECTORY(test)
 
index ec68963..2e43946 100644 (file)
-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
+Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+
+
+
diff --git a/TC/_export_env.sh b/TC/_export_env.sh
deleted file mode 100755 (executable)
index 7a317f8..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-source ./config
-
-export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
-#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator # tetware target 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
deleted file mode 100755 (executable)
index 3fd8e3f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-. ./config
-
-export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
-#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator 
-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
deleted file mode 100755 (executable)
index 72aad6c..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/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
deleted file mode 100755 (executable)
index 29743e0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/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 b/TC/config
deleted file mode 100644 (file)
index ecb0344..0000000
--- a/TC/config
+++ /dev/null
@@ -1,3 +0,0 @@
-PKG_NAME=capi-network-nfc
-TET_INSTALL_HOST_PATH=/var/tmp/TETware
-TET_INSTALL_TARGET_PATH=/TETware
diff --git a/TC/push.sh b/TC/push.sh
deleted file mode 100755 (executable)
index 5eb9510..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-. ./config
-
-TC_PATH=/opt/home/$PKG_NAME
-
-echo $TC_PATH
-
-sdb shell "mkdir -p $TC_PATH"
-
-sdb push . $TC_PATH
-
-
diff --git a/TC/run.sh b/TC/run.sh
deleted file mode 100755 (executable)
index cec5778..0000000
--- a/TC/run.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-source ./_export_target_env.sh
-
-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 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile
deleted file mode 100644 (file)
index a7c9b44..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-CC ?= gcc
-
-C_FILES = $(shell ls *.c)
-
-PKGS = glib-2.0 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
deleted file mode 100644 (file)
index c32b2cd..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/testcase/utc_network_nfc
-/testcase/utc_network_nfc_ndef_record
-/testcase/utc_network_nfc_ndef_message
-/testcase/utc_network_nfc_se
-/testcase/utc_network_nfc_snep
diff --git a/TC/testcase/utc_network_nfc.c b/TC/testcase/utc_network_nfc.c
deleted file mode 100644 (file)
index 0d8a737..0000000
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#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 nfc_manager_is_supported_p(void);
-static void nfc_manager_is_supported_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_activation_changed_cb_p(void);
-static void nfc_manager_set_activation_changed_cb_n(void);
-static void nfc_manager_is_activated_p(void);
-static void nfc_manager_is_activated_n(void);
-static void nfc_manager_set_activation_p(void);
-static void nfc_manager_set_activation_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);
-static void nfc_manager_set_system_handler_enable_force_p(void);
-static void nfc_manager_set_system_handler_enable_force_n(void);
-static void nfc_manager_set_card_emulation_se_type_p(void);
-static void nfc_manager_set_card_emulation_se_type_n(void);
-static void nfc_manager_get_card_emulation_se_type_p(void);
-static void nfc_manager_get_card_emulation_se_type_n(void);
-
-static void _activation_changed_cb(bool activated, void *user_data);
-static void _activation_completed_cb(int error, void *user_data);
-static void utc_test_cb(void * user_data);
-
-struct tet_testlist tet_testlist[] =
-{
-       { nfc_manager_is_supported_p, POSITIVE_TC_IDX },
-       { nfc_manager_is_supported_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_activation_changed_cb_p, POSITIVE_TC_IDX },
-       { nfc_manager_set_activation_changed_cb_n, NEGATIVE_TC_IDX },
-       { nfc_manager_is_activated_p, POSITIVE_TC_IDX },
-       { nfc_manager_is_activated_n, NEGATIVE_TC_IDX },
-       { nfc_manager_set_activation_p, POSITIVE_TC_IDX },
-       { nfc_manager_set_activation_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_p2p_target_discovered_cb_p, POSITIVE_TC_IDX },
-       { nfc_manager_set_p2p_target_discovered_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 },
-       { nfc_manager_set_system_handler_enable_force_p, POSITIVE_TC_IDX },
-       { nfc_manager_set_system_handler_enable_force_n, NEGATIVE_TC_IDX },
-       { nfc_manager_set_card_emulation_se_type_p, POSITIVE_TC_IDX },
-       { nfc_manager_set_card_emulation_se_type_n, NEGATIVE_TC_IDX },
-       { nfc_manager_get_card_emulation_se_type_p, POSITIVE_TC_IDX },
-       { nfc_manager_get_card_emulation_se_type_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 _activation_changed_cb(bool activated, void *user_data)
-{
-       if (activated == true)
-       {
-       }
-       else if (activated == false)
-       {
-       }
-}
-
-static void _activation_completed_cb(int error, void *user_data)
-{
-}
-
-static void utc_test_cb(void *user_data)
-{
-}
-
-static void nfc_manager_is_supported_p(void)
-{
-       bool result;
-
-       result = nfc_manager_is_supported();
-
-       dts_check_eq(__func__, result, true, "nfc_manager_is_supported is failed");
-}
-
-static void nfc_manager_is_supported_n(void)
-{
-       dts_pass(__func__, "PASS");
-}
-
-static void nfc_manager_initialize_p()
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-
-       nfc_manager_deinitialize();
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_initialize_p is failed");
-}
-
-static void nfc_manager_initialize_n()
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-
-       dts_pass(__func__, "PASS");
-}
-
-static void nfc_manager_deinitialize_p()
-{
-       int ret;
-
-       nfc_manager_initialize(NULL, NULL);
-
-       ret = nfc_manager_deinitialize();
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_initialize_p is failed");
-}
-
-static void nfc_manager_deinitialize_n()
-{
-       int ret;
-
-       ret = nfc_manager_deinitialize();
-
-       dts_pass(__func__, "PASS");
-}
-
-static void nfc_manager_set_activation_changed_cb_p(void)
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_activation_changed_cb(_activation_changed_cb, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_activation_changed_cb_p is failed");
-}
-
-static void nfc_manager_set_activation_changed_cb_n(void)
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_activation_changed_cb(NULL, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_activation_changed_cb_n not allow null");
-}
-
-static void nfc_manager_is_activated_p(void)
-{
-       int ret;
-       bool result;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               result = nfc_manager_is_activated();
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_eq(__func__, result, true, "nfc_manager_is_activated is failed");
-}
-
-static void nfc_manager_is_activated_n(void)
-{
-       dts_pass(__func__, "PASS");
-}
-
-static void nfc_manager_set_activation_p()
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_activation(1, _activation_completed_cb, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_pass(__func__, "PASS");
-}
-
-static void nfc_manager_set_activation_n()
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_activation(1, NULL, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_pass(__func__, "PASS");
-}
-
-static void nfc_manager_set_tag_discovered_cb_p()
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_tag_discovered_cb(utc_test_cb, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_tag_discovered_cb_p is failed");
-}
-
-static void nfc_manager_set_tag_discovered_cb_n()
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_tag_discovered_cb(NULL, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       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;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_ndef_discovered_cb(utc_test_cb, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_ndef_discovered_cb_p is failed");
-}
-
-static void nfc_manager_set_ndef_discovered_cb_n()
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_ndef_discovered_cb(NULL, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       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;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_p2p_target_discovered_cb(utc_test_cb, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_p2p_target_discovered_cb_p is failed");
-}
-
-static void nfc_manager_set_p2p_target_discovered_cb_n()
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_p2p_target_discovered_cb(NULL, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       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;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_se_event_cb(utc_test_cb, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_event_cb_p is failed");
-}
-
-static void nfc_manager_set_se_event_cb_n()
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_se_event_cb(NULL, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       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;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_se_transaction_event_cb(utc_test_cb, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_transaction_event_cb_p is failed");
-}
-
-static void nfc_manager_set_se_transaction_event_cb_n()
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_se_transaction_event_cb(NULL, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       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;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_system_handler_enable(true);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_system_handler_enable is failed");
-}
-
-static void nfc_manager_set_system_handler_enable_n()
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_system_handler_enable(false);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_pass(__func__, "PASS");
-}
-
-static void nfc_manager_set_system_handler_enable_force_p(void)
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_system_handler_enable_force(true);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_system_handler_enable_force is failed");
-}
-
-static void nfc_manager_set_system_handler_enable_force_n(void)
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_system_handler_enable_force(false);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_pass(__func__, "PASS");
-}
-
-static void nfc_manager_set_card_emulation_se_type_p(void)
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_card_emulation_se_type(NFC_SE_TYPE_ESE, NULL, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_card_emulation_se_type is failed");
-}
-
-static void nfc_manager_set_card_emulation_se_type_n(void)
-{
-       int ret;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_set_card_emulation_se_type((nfc_se_type_e)0xff, NULL, NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_card_emulation_se_type not allow null");
-}
-
-static void nfc_manager_get_card_emulation_se_type_p(void)
-{
-       int ret;
-       nfc_se_type_e type;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_get_card_emulation_se_type(&type);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_get_card_emulation_se_type is failed");
-}
-
-static void nfc_manager_get_card_emulation_se_type_n(void)
-{
-       int ret;
-       nfc_se_type_e type;
-
-       ret = nfc_manager_initialize(NULL, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_manager_get_card_emulation_se_type(NULL);
-
-               nfc_manager_deinitialize();
-       }
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_get_card_emulation_se_type not allow null");
-}
diff --git a/TC/testcase/utc_network_nfc_ndef_message.c b/TC/testcase/utc_network_nfc_ndef_message.c
deleted file mode 100644 (file)
index 0c5b101..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#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_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);
-       nfc_ndef_message_destroy(message);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_create is failed");
-}
-
-static void utc_nfc_ndef_message_create_n(void)
-{
-       int ret;
-
-       ret = nfc_ndef_message_create(NULL);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_create not allow null");
-}
-
-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);
-
-       nfc_ndef_message_destroy(message2);
-       nfc_ndef_message_destroy(message);
-       free(buffer);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_create_from_rawdata is failed");
-}
-
-static void utc_nfc_ndef_message_create_from_rawdata_n(void)
-{
-       int ret;
-
-       ret = nfc_ndef_message_create_from_rawdata(NULL, NULL, 0);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_create_from_rawdata not allow null");
-}
-
-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);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_destroy is failed");
-}
-
-static void utc_nfc_ndef_message_destroy_n(void)
-{
-       int ret;
-
-       ret = nfc_ndef_message_destroy(NULL);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_destroy not allow null");
-}
-
-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);
-       nfc_ndef_message_destroy(message);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_get_record_count is failed");
-}
-
-static void utc_nfc_ndef_message_get_record_count_n(void)
-{
-       int ret;
-
-       ret = nfc_ndef_message_get_record_count(NULL, NULL);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_get_record_count not allow null");
-}
-
-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);
-       nfc_ndef_message_destroy(message);
-       free(buffer);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_get_rawdata is failed");
-}
-
-static void utc_nfc_ndef_message_get_rawdata_n(void)
-{
-       int ret;
-
-       ret = nfc_ndef_message_get_rawdata(NULL, NULL, NULL);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_get_rawdata not allow null");
-}
-
-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);
-       nfc_ndef_message_destroy(message);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_append_record is failed");
-}
-
-static void utc_nfc_ndef_message_append_record_n(void)
-{
-       int ret;
-
-       ret = nfc_ndef_message_append_record(NULL, NULL);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_append_record not allow null");
-}
-
-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);
-       nfc_ndef_message_destroy(message);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_insert_record is failed");
-}
-
-static void utc_nfc_ndef_message_insert_record_n(void)
-{
-       int ret;
-
-       ret = nfc_ndef_message_insert_record(NULL, 0, NULL);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_insert_record not allow null");
-}
-
-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);
-       nfc_ndef_message_destroy(message);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_remove_record is failed");
-}
-
-static void utc_nfc_ndef_message_remove_record_n(void)
-{
-       int ret;
-
-       ret = nfc_ndef_message_remove_record(NULL, 0);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_remove_record not allow null");
-}
-
-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);
-       nfc_ndef_message_destroy(message);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_get_record is failed");
-}
-
-static void utc_nfc_ndef_message_get_record_n(void)
-{
-       int ret;
-
-       ret = nfc_ndef_message_get_record(NULL, 0, NULL);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_message_get_record not allow null");
-}
diff --git a/TC/testcase/utc_network_nfc_ndef_record.c b/TC/testcase/utc_network_nfc_ndef_record.c
deleted file mode 100644 (file)
index 0c386db..0000000
+++ /dev/null
@@ -1,545 +0,0 @@
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#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, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_create_uri_n, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_create_mime_p, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_create_mime_n_1, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_create_mime_n_2, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_create_mime_n_3, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_destroy_p, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_destroy_n, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_set_id_p, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_set_id_n, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_id_p, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_id_n, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_payload_p, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_payload_n, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_type_p, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_type_n, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_tnf_p, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_tnf_n, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_text_p, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_text_n, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_langcode_p, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_langcode_n, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_encode_type_p, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_encode_type_n, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_uri_p, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_uri_n, NEGATIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_mime_type_p, POSITIVE_TC_IDX },
-       { utc_nfc_ndef_record_get_mime_type_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_record_create_p(void)
-{
-       int ret;
-       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 failed");
-}
-
-static void utc_nfc_ndef_record_create_n(void)
-{
-       int ret;
-       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;
-       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 failed");
-}
-
-static void utc_nfc_ndef_record_create_text_n(void)
-{
-       int ret;
-
-       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;
-       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 failed");
-}
-
-static void utc_nfc_ndef_record_create_uri_n(void)
-{
-       int ret;
-
-       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_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 failed");
-}
-
-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_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_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;
-       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");
-               return;
-       }
-
-       ret = nfc_ndef_record_destroy(record);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_destroy is failed");
-}
-
-static void utc_nfc_ndef_record_destroy_n(void)
-{
-       int ret;
-
-       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;
-       nfc_ndef_record_h record;
-
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
-       if (ret != NFC_ERROR_NONE) {
-               dts_fail(__func__, "can't create record\n");
-               return;
-       }
-
-       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 failed");
-}
-
-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;
-       int size;
-       nfc_ndef_record_h record;
-       unsigned char *id;
-
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
-       if (ret != NFC_ERROR_NONE) {
-               dts_fail(__func__, "can't create record\n");
-               return;
-       }
-
-       ret = nfc_ndef_record_set_id(record, (unsigned char *)"test", 4);
-       if (ret != NFC_ERROR_NONE) {
-               dts_fail(__func__, "can't set id\n");
-               return;
-       }
-
-       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 failed");
-}
-
-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);
-       if (ret != NFC_ERROR_NONE) {
-               dts_fail(__func__, "can't create record\n");
-               return;
-       }
-
-       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 failed");
-}
-
-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;
-       int size;
-       nfc_ndef_record_h record;
-       unsigned char *data;
-
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
-       if (ret != NFC_ERROR_NONE) {
-               dts_fail(__func__, "can't create record\n");
-               return;
-       }
-
-       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 failed");
-}
-
-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;
-       nfc_ndef_record_h record;
-       nfc_record_tnf_e tnf;
-
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
-       if (ret != NFC_ERROR_NONE) {
-               dts_fail(__func__, "can't create record\n");
-               return;
-       }
-
-       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 failed");
-}
-
-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;
-       char *text;
-       nfc_ndef_record_h record;
-
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
-       if (ret != NFC_ERROR_NONE) {
-               dts_fail(__func__, "can't create record\n");
-               return;
-       }
-
-       ret = nfc_ndef_record_get_text(record, &text);
-       if (ret == 0) {
-               free(text);
-       }
-
-       nfc_ndef_record_destroy(record);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is failed");
-}
-
-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;
-       char *text;
-       nfc_ndef_record_h record;
-
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
-       if (ret != NFC_ERROR_NONE) {
-               dts_fail(__func__, "can't create record\n");
-               return;
-       }
-
-       ret = nfc_ndef_record_get_langcode(record, &text);
-       if (ret == 0) {
-               free(text);
-       }
-
-       nfc_ndef_record_destroy(record);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is failed");
-
-}
-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;
-       nfc_encode_type_e type;
-       nfc_ndef_record_h record;
-
-       ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8);
-       if (ret != NFC_ERROR_NONE) {
-               dts_fail(__func__, "can't create record\n");
-               return;
-       }
-
-       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 failed");
-}
-
-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;
-       char *uri;
-       nfc_ndef_record_h record;
-
-       ret = nfc_ndef_record_create_uri(&record, "http://test.com");
-       if (ret != NFC_ERROR_NONE) {
-               dts_fail(__func__, "can't create record\n");
-               return;
-       }
-
-       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 failed");
-}
-
-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;
-       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"));
-       if (ret != NFC_ERROR_NONE) {
-               dts_fail(__func__, "can't create record\n");
-               return;
-       }
-
-       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 failed");
-}
-
-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/testcase/utc_network_nfc_se.c b/TC/testcase/utc_network_nfc_se.c
deleted file mode 100644 (file)
index 7181f2e..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#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 nfc_se_open_secure_element_p(void);
-static void nfc_se_open_secure_element_n(void);
-static void nfc_se_get_atr_p(void);
-static void nfc_se_get_atr_n(void);
-static void nfc_se_send_apdu_p(void);
-static void nfc_se_send_apdu_n(void);
-static void nfc_se_close_secure_element_p(void);
-static void nfc_se_close_secure_element_n(void);
-
-struct tet_testlist tet_testlist[] =
-{
-       { nfc_se_open_secure_element_p, POSITIVE_TC_IDX },
-       { nfc_se_open_secure_element_n, NEGATIVE_TC_IDX },
-       { nfc_se_get_atr_p, POSITIVE_TC_IDX },
-       { nfc_se_get_atr_n, NEGATIVE_TC_IDX },
-       { nfc_se_send_apdu_p, POSITIVE_TC_IDX },
-       { nfc_se_send_apdu_n, NEGATIVE_TC_IDX },
-       { nfc_se_close_secure_element_p, POSITIVE_TC_IDX },
-       { nfc_se_close_secure_element_n, NEGATIVE_TC_IDX },
-
-       { NULL, 0 },
-};
-
-//this method is called only once in start
-static void startup(void)
-{
-       /* start of TC */
-       nfc_manager_initialize(NULL, NULL);
-}
-
-static void cleanup(void)
-{
-       /* end of TC */
-       nfc_manager_deinitialize();
-}
-
-static nfc_se_h se_handle;
-
-static void nfc_se_open_secure_element_p(void)
-{
-       int ret;
-
-       ret = nfc_se_open_secure_element(NFC_SE_TYPE_ESE, &se_handle);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_se_open_secure_element is failed");
-}
-
-static void nfc_se_open_secure_element_n(void)
-{
-       int ret;
-
-       ret = nfc_se_open_secure_element((nfc_se_type_e)0xff, NULL);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_se_open_secure_element not allow null");
-}
-
-static void nfc_se_get_atr_p(void)
-{
-       int ret;
-       unsigned char *atr;
-       unsigned int atr_len;
-
-       ret = nfc_se_get_atr(se_handle, &atr, &atr_len);
-       if (ret == NFC_ERROR_NONE) {
-               free(atr);
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_se_get_atr is failed");
-}
-
-static void nfc_se_get_atr_n(void)
-{
-       int ret;
-
-       ret = nfc_se_get_atr(NULL, NULL, NULL);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_se_get_atr not allow null");
-}
-
-static void nfc_se_send_apdu_p(void)
-{
-       int ret;
-       unsigned char cmd[] = { 0x00, 0x70, 0x00, 0x00, 0x00 };
-       unsigned char *resp;
-       unsigned int resp_len;
-
-       ret = nfc_se_send_apdu(se_handle, cmd, sizeof(cmd), &resp, &resp_len);
-       if (ret == NFC_ERROR_NONE) {
-               free(resp);
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_se_send_apdu is failed");
-}
-
-static void nfc_se_send_apdu_n(void)
-{
-       int ret;
-
-       ret = nfc_se_send_apdu(NULL, NULL, 0, NULL, NULL);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_se_send_apdu not allow null");
-}
-
-static void nfc_se_close_secure_element_p(void)
-{
-       int ret;
-
-       ret = nfc_se_close_secure_element(se_handle);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_se_close_secure_element is failed");
-}
-
-static void nfc_se_close_secure_element_n(void)
-{
-       int ret;
-
-       ret = nfc_se_close_secure_element(NULL);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_se_close_secure_element not allow null");
-}
diff --git a/TC/testcase/utc_network_nfc_snep.c b/TC/testcase/utc_network_nfc_snep.c
deleted file mode 100644 (file)
index 602825e..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <glib.h>
-#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 nfc_snep_register_server_p(void);
-static void nfc_snep_register_server_n(void);
-static void nfc_snep_unregister_server_p(void);
-static void nfc_snep_unregister_server_n(void);
-
-struct tet_testlist tet_testlist[] =
-{
-       { nfc_snep_register_server_p, POSITIVE_TC_IDX },
-       { nfc_snep_register_server_n, NEGATIVE_TC_IDX },
-       { nfc_snep_unregister_server_p, POSITIVE_TC_IDX },
-       { nfc_snep_unregister_server_n, NEGATIVE_TC_IDX },
-
-       { NULL, 0 },
-};
-
-static void _activation_completed_cb(nfc_error_e error, void *user_data)
-{
-       g_main_loop_quit((GMainLoop *)user_data);
-}
-
-//this method is called only once in start
-static void startup(void)
-{
-       /* start of TC */
-       nfc_manager_initialize(NULL, NULL);
-
-       if (nfc_manager_is_activated() == false) {
-               GMainLoop *loop;
-
-               loop = g_main_loop_new(NULL, false);
-
-               nfc_manager_set_activation(true, _activation_completed_cb, loop);
-
-               g_main_loop_run(loop);
-       }
-}
-
-static void cleanup(void)
-{
-       /* end of TC */
-       nfc_manager_deinitialize();
-}
-
-static const char *san = "abcd:efgh";
-static int sap = 0x22;
-
-static void _snep_event_cb(nfc_p2p_snep_h handle,
-       nfc_snep_event_e event, nfc_error_e result,
-       nfc_ndef_message_h msg, void *user_data)
-{
-
-}
-
-static void nfc_snep_register_server_p(void)
-{
-       int ret;
-
-       ret = nfc_snep_register_server(san, sap, _snep_event_cb, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               nfc_snep_unregister_server(san, sap);
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_snep_register_server is failed");
-}
-
-static void nfc_snep_register_server_n(void)
-{
-       int ret;
-
-       ret = nfc_snep_register_server(NULL, 0, NULL, NULL);
-
-       dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_snep_register_server not allowed");
-}
-
-static void nfc_snep_unregister_server_p(void)
-{
-       int ret;
-
-       ret = nfc_snep_register_server(san, sap, _snep_event_cb, NULL);
-       if (ret == NFC_ERROR_NONE) {
-               ret = nfc_snep_unregister_server(san, sap);
-       }
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_snep_register_server is failed");
-}
-
-static void nfc_snep_unregister_server_n(void)
-{
-       int ret;
-
-       ret = nfc_snep_unregister_server(san, sap);
-
-       dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_snep_register_server is failed");
-}
diff --git a/TC/tet_scen b/TC/tet_scen
deleted file mode 100644 (file)
index 03f029a..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-all
-       ^TEST
-##### Scenarios for TEST #####
-
-# Test scenario
-TEST
-       :include:/testcase/tslist
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
deleted file mode 100644 (file)
index f7eda55..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644 (file)
index 02d7030..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644 (file)
index ef3e452..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-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>
+
index 653e6e2..8792e0a 100644 (file)
@@ -1,14 +1,15 @@
+
 # Package Information for pkg-config
 
 prefix=@PREFIX@
 exec_prefix=/usr
-libdir=@LIB_INSTALL_DIR@
-includedir=@INCLUDE_INSTALL_DIR@/@service@
+libdir=/usr/lib
+includedir=/usr/include/network
 
 Name: @PC_NAME@
-Description: A NFC library in Tizen core API
+Description: @PACKAGE_DESCRIPTION@
 Version: @VERSION@
-Requires: @PC_REQUIRED@
+Requires: @PC_REQUIRED@ 
 Libs: -L${libdir} @PC_LDFLAGS@
 Cflags: -I${includedir}
 
diff --git a/debian/README b/debian/README
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/debian/capi-network-nfc-dev.install b/debian/capi-network-nfc-dev.install
deleted file mode 100644 (file)
index 761a28b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/usr/include/*
-/usr/include/*/*
-/usr/lib/pkgconfig/*.pc
-
diff --git a/debian/capi-network-nfc-dev.postinst b/debian/capi-network-nfc-dev.postinst
deleted file mode 100644 (file)
index 1a24852..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#!/bin/sh
diff --git a/debian/capi-network-nfc.install b/debian/capi-network-nfc.install
deleted file mode 100644 (file)
index 4a755a4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/usr/lib/lib*.so*
diff --git a/debian/capi-network-nfc.postinst b/debian/capi-network-nfc.postinst
deleted file mode 100644 (file)
index 1a24852..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#!/bin/sh
diff --git a/debian/changelog b/debian/changelog
deleted file mode 100644 (file)
index 9220c26..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-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
deleted file mode 100644 (file)
index 7ed6ff8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-5
diff --git a/debian/control b/debian/control
deleted file mode 100644 (file)
index 884fca6..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-
-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
deleted file mode 100755 (executable)
index d075260..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/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/doc/nfc_doc.h b/doc/nfc_doc.h
new file mode 100755 (executable)
index 0000000..2cb660d
--- /dev/null
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+ /**
+ * @file nfc_doc.h
+ * @brief  This file contains high level documentation the NFC API.
+ */
+
+/**
+ * @defgroup CAPI_NETWORK_NFC_MODULE NFC
+ * @brief The NFC API provides very short-range radio communication technology.
+ * @ingroup CAPI_NETWORK_FRAMEWORK
+ *
+ * @par
+ * @section CAPI_NETWORK_NFC_MODULE_HEADER     Required Header
+ * \#include <nfc.h>
+ * @section CAPI_NETWORK_NFC_MODULE_OVERVIEW Overview
+ * NFC Service enables applications to\n
+ * - set up nfc manager\n
+ * - read / write ndef message or raw data and get attribute of tag\n
+ * - create NDEF(NFC Data Exchange Format) message or NDEF record\n
+ * - receive/send ndef message to the peer target\n
+ * - read / write data to the Secure Element for Card Emulation mode\n
+ *
+ * @subsection CAPI_NETWORK_NFC_MANAGER_MODULE_DESCRIPTION nfc-manager
+ * The nfc manager api provides functions to connect nfc-server and register event listener\n
+ * - control connection with nfc-server. \n
+ * - register / deregister event listeners for detecting tag, ndef, llcp, secure element \n
+ * - set / unset tag filter to be listened only in case of specific tag. \n
+ *
+ * @subsection CAPI_NETWORK_NFC_NDEF_MODULE_DESCRIPTION NDEF(NFC Data Exchange Format)
+ *  The NDEF(NFC Data Exchange Format) api provides functions to make NDEF record and NDEF message.\n
+ * - create NDEF record and retrieve specific field of NDEF record\n
+ * - create NDEF message with NDEF records\n
+ *
+ * @subsection CAPI_NETWORK_NFC_TAG_MODULE_DESCRIPTION TAG
+ * The TAG api provide functions to read or write NDEF(NFC Data Exchange Format) and also low level transaction API with Non NDEF tag. \n
+ * - read NDEF from NDEF compatible TAG\n
+ * - write NDEF to NDEF compatible TAG\n
+ * - check whether tag has NDEF or not\n
+ * - format NFC forum tag to be compatible with NDEF\n
+ * - read specific attributes from tag by ISO14443\n
+ * - low level api of MIFARE classic and MIFARE ultra light\n
+ *
+ * @subsection CAPI_NETWORK_NFC_P2P_MODULE_DESCRIPTION Peer to Peer
+ * The Peer to Peer api provide functions to exchange NDEF data with peer target.
+ * - send ndef message\n
+ * - receive ndef message\n
+ *
+ * @subsection CAPI_NETWORK_NFC_SE_MODULE_DESCRIPTION Card Emulation
+ * The Card Emulation api provide functions to exchange data with Secure Element.
+ * - send apdu to secure element\n
+ * - get atr from secure element\n
+ */
+
+/**
+ * @defgroup CAPI_NETWORK_NFC_MANAGER_MODULE Manager
+ * @brief NFC Manager API provides access to NFC Events.
+ * @ingroup CAPI_NETWORK_NFC_MODULE
+ *
+ * @section CAPI_NETWORK_NFC_MANAGER_MODULE_HEADER     Required Header
+ * \#include <nfc.h>
+ * @section CAPI_NETWORK_NFC_MANAGER_MODULE_OVERVIEW Overview
+ * The nfc manager api provides functions to connect nfc-server and register event listener\n
+ * - control connection with nfc-server. \n
+ * - register / deregister event listeners for detecting tag, ndef, llcp, secure element \n
+ * - set / unset tag filter to be listened only in case of specific tag. \n
+ * @section CAPI_NETWORK_NFC_MANAGER_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/network.nfc\n
+ * - http://tizen.org/feature/network.nfc.tag\n
+ * - http://tizen.org/feature/network.nfc.p2p\n
+ * - http://tizen.org/feature/network.nfc.card_emulation\n
+ * - http://tizen.org/feature/network.secure_element.uicc\n
+ * - http://tizen.org/feature/network.secure_element.ese\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a devrice supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+ */
+
+
+/**
+ * @defgroup CAPI_NETWORK_NFC_NDEF_MODULE NDEF
+ * @brief The NDEF api provides functions to make NDEF record and NDEF message.
+ * @ingroup CAPI_NETWORK_NFC_MODULE
+ * @section CAPI_NETWORK_NFC_NDEF_MODULE_HEADER        Required Header
+ * \#include <nfc.h>
+ * @section CAPI_NETWORK_NFC_NDEF_MODULE_OVERVIEW Overview
+ *  The NDEF api provides functions to make NDEF record and NDEF message.\n
+ * - create NDEF record and retrieve specific field of NDEF record\n
+ * - create NDEF message with NDEF records\n
+ *
+ * <table>
+ * <tr>
+ *  <th> APIs </th>
+ *  <th> Description </th>
+ * </tr>
+ * <tr>
+ *  <td> @ref CAPI_NETWORK_NFC_NDEF_RECORD_MODULE </td>
+ *  <td> Record API provides NDEF record and retrieve specific field of NDEF record </td>
+ * </tr>
+ * <tr>
+ *  <td>  @ref CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE  </td>
+ *  <td>Message API provides functions to create NDEF message and insert/remove records in NDEF message</td>
+ * </tr>
+ * </table>
+ *
+ */
+
+/**
+ * @defgroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE Record
+ * @ingroup CAPI_NETWORK_NFC_NDEF_MODULE
+ * @brief Record API provides an NDEF record.
+ * @section CAPI_NETWORK_NFC_NDEF_RECORD_MODULE_HEADER Required Header
+ * \#include <nfc.h>
+ *
+ * @section CAPI_NETWORK_NFC_NDEF_RECORD_MODULE_OVERVIEW Overview
+ * The NDEF record api provides functions to make NDEF record\n
+ * - create / destroy NDEF record\n
+ * - set / get elements from NDEF record\n
+ *
+ * @section CAPI_NETWORK_NFC_NDEF_RECORD_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/network.nfc\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a devrice supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+ */
+
+/**
+ * @defgroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE Message
+ * @ingroup CAPI_NETWORK_NFC_NDEF_MODULE
+ * @brief Message API provides functions to create NDEF message and insert/remove records in NDEF message
+ * @section CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE_HEADER        Required Header
+ * \#include <nfc.h>
+ *
+ * @section CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE_OVERVIEW Overview
+ * The NDEF message api provides functions to make NDEF message\n
+ * - create / destroy NDEF message\n
+ * - insert / remove NDEF record\n
+ * - get NDEF record from NDEF message\n
+ *
+ * @section CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/network.nfc\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a devrice supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+ */
+
+/**
+ * @defgroup CAPI_NETWORK_NFC_TAG_MODULE TAG
+ * @ingroup CAPI_NETWORK_NFC_MODULE
+ * @brief TAG API provide functions for read/write operation on NDEF and also provide low level API of Mifare
+ * @section CAPI_NETWORK_NFC_TAG_MODULE_HEADER Required Header
+ * \#include <nfc.h>
+ * @section CAPI_NETWORK_NFC_TAG_MODULE_OVERVIEW Overview
+ * The TAG api provides functions to read or write NDEF and low level transaction APIs with Non NDEF tag. \n
+ * - read NDEF from NDEF compatible TAG\n
+ * - write NDEF to NDEF compatible TAG\n
+ * - check whether tag has NDEF or not\n
+ * - format NFC forum tag to be compatible with NDEF\n
+ * - read specific attributes from tag by ISO14443\n
+ * - low level api of MIFARE classic and MIFARE ultra light\n
+ * @section CAPI_NETWORK_NFC_TAG_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/network.nfc\n
+ * - http://tizen.org/feature/network.nfc.tag\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a devrice supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+ */
+
+/**
+ * @defgroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE Mifare
+ * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ * @brief API provides access to MIFARE specific I/O operations on a Tag.
+ * @section CAPI_NETWORK_NFC_TAG_MIFARE_MODULE_HEADER  Required Header
+ * \#include <nfc.h>
+ * @section CAPI_NETWORK_NFC_TAG_MIFARE_MODULE_OVERVIEW Overview
+
+       MIFARE Classic is also known as MIFARE Standard.\n
+       MIFARE Classic tags are divided into sectors, and each sector is sub-divided into blocks. Block size is always 16 bytes.\n
+
+       MIFARE Classic Mini are 320 bytes (SIZE_MINI), with 5 sectors each of 4 blocks.\n
+       MIFARE Classic 1k are 1024 bytes (SIZE_1K), with 16 sectors each of 4 blocks.\n
+       MIFARE Classic 2k are 2048 bytes (SIZE_2K), with 32 sectors each of 4 blocks.\n
+       MIFARE Classic 4k are 4096 bytes (SIZE_4K). The first 32 sectors contain 4 blocks and the last 8 sectors contain 16 blocks.\n
+
+       MIFARE Classic tags require authentication on a per-sector basis before any other I/O operations on that sector can be performed. \n
+       There are two keys per sector, and ACL bits determine what I/O operations are allowed on that sector after authenticating with a key\n
+ * @section CAPI_NETWORK_NFC_TAG_MIFARE_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/network.nfc\n
+ * - http://tizen.org/feature/network.nfc.tag\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a devrice supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+ */
+
+
+ /**
+ * @defgroup CAPI_NETWORK_NFC_P2P_MODULE Peer to Peer
+ * @ingroup CAPI_NETWORK_NFC_MODULE
+ * @brief The peer to peer api provide functions to exchange NDEF data with peer target.
+ * @section CAPI_NETWORK_NFC_P2P_MODULE_HEADER Required Header
+ * \#include <nfc.h>
+ * @section CAPI_NETWORK_NFC_P2P_MODULE_OVERVIEW Overview
+ * The peer to peer api provides functions to exchange NDEF data with the peer target. \n
+ * - send ndef message
+ * - receive ndef message
+ * @section CAPI_NETWORK_NFC_P2P_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/network.nfc\n
+ * - http://tizen.org/feature/network.nfc.p2p\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a devrice supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+ */
+
+ /**
+ * @defgroup CAPI_NETWORK_NFC_SE_MODULE Card Emulation
+ * @ingroup CAPI_NETWORK_NFC_MODULE
+ * @brief The Card Emulation api provide functions to exchange data with Secure Element.
+ * @section CAPI_NETWORK_NFC_SE_MODULE_HEADER  Required Header
+ * \#include <nfc.h>
+ * @section CAPI_NETWORK_NFC_SE_MODULE_OVERVIEW Overview
+ * The Card Emulation api provide functions to exchange data with Secure Element. \n
+ * - send apdu to secure element
+ * - get atr from secure element
+ * @section CAPI_NETWORK_NFC_SE_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/network.nfc\n
+ * - http://tizen.org/feature/network.nfc.card_emulation\n
+ * - http://tizen.org/feature/network.nfc.card_emulation.hce\n
+ * - http://tizen.org/feature/network.secure_element.uicc\n
+ * - http://tizen.org/feature/network.secure_element.ese\n
+ *
+ * It is recommended to design feature related codes in your application for reliability.\n
+ *
+ * You can check if a devrice supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, thereby controlling the procedure of your application.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="../org.tizen.mobile.native.appprogramming/html/ide_sdk_tools/feature_element.htm"><b>Feature Element</b>.</a>
+ *
+ */
old mode 100644 (file)
new mode 100755 (executable)
index 0b2c5ac..4176e41
@@ -29,11 +29,11 @@ extern "C" {
  * @brief This file contains the NFC API.
  */
 
-#define NFC_ERROR_CLASS TIZEN_ERROR_NETWORK_CLASS | 0x200
-
+#define NFC_ERROR_CLASS TIZEN_ERROR_NFC
 
 /**
  * @brief Error codes reported by the NFC API.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  */
 typedef enum {
@@ -47,18 +47,24 @@ typedef enum {
        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_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
+       NFC_ERROR_ALREADY_ACTIVATED = NFC_ERROR_CLASS | 0x06, /**< Already activated */
+       NFC_ERROR_ALREADY_DEACTIVATED = NFC_ERROR_CLASS | 0x07, /**< Already deactivated */
+       NFC_ERROR_READ_ONLY_NDEF = NFC_ERROR_CLASS | 0x08, /**< Read only tag */
+       NFC_ERROR_NO_SPACE_ON_NDEF = NFC_ERROR_CLASS | 0x09, /**< No enough space on tag */
+       NFC_ERROR_NO_NDEF_MESSAGE = NFC_ERROR_CLASS | 0x0a, /**< No NDEF Message on Tag */
+       NFC_ERROR_NOT_NDEF_FORMAT = NFC_ERROR_CLASS | 0x0b, /**< Not NDEF format Tag */
+       NFC_ERROR_SECURITY_RESTRICTED = NFC_ERROR_CLASS | 0x0c, /**<  Restricted by access control */
+       NFC_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Restricted by Smack */
+       NFC_ERROR_ILLEGAL_STATE = NFC_ERROR_CLASS | 0x0d, /**<  The state is wrong */
+       NFC_ERROR_NOT_INITIALIZED = NFC_ERROR_CLASS | 0x0e, /**< NFC is not initialized */
+       NFC_ERROR_TAG_NOT_SUPPORTED = NFC_ERROR_CLASS | 0x0f, /**< Tag is not supported */
+       NFC_ERROR_AID_ALREADY_REGISTERED = NFC_ERROR_CLASS | 0x10 /**< AID already registered (@b Since: 2.3.1) */
 } nfc_error_e;
 
 /**
  * @brief Enumerations for record TNF (Type Name Format)
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @details It is indicate format of type field
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  */
@@ -75,6 +81,7 @@ typedef enum {
 
 /**
  * @brief Enumerations for NFC encode types
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  */
 typedef enum {
@@ -84,6 +91,7 @@ typedef enum {
 
 /**
  * @brief Enumerations for NFC tag types
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
  */
 typedef enum {
@@ -92,9 +100,9 @@ typedef enum {
        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_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 */
@@ -103,14 +111,16 @@ typedef enum {
        NFC_FELICA_PICC,        /**< FELICA PICC */
        NFC_JEWEL_PICC, /**< JEWEL PICC */
        NFC_ISO15693_PICC,      /**< ISO15693 PICC */
+       NFC_BARCODE_128_PICC, /**< BARCODE_128 PICC */
+       NFC_BARCODE_256_PICC, /**< BARCODE_256 PICC */
+
        NFC_NFCIP1_TARGET,      /**< NFCIP1_TARGET */
        NFC_NFCIP1_INITIATOR,   /**< NFCIP1_INITIATOR */
 } nfc_tag_type_e;
 
-
-
 /**
  * @brief Enumerations for NFC Tag filter
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  */
 typedef enum {
@@ -125,18 +135,8 @@ typedef enum {
 } 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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  */
 typedef enum {
@@ -146,14 +146,15 @@ typedef enum {
 
 /**
  * @brief Enumerations for NFC Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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_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. UICC(Universal Integrated Circuit Card) create pipe and open the pipe chanel. Then 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. When 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. When 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_CARD_EMULATION_CHANGED, /**< This event notifies, changing the card emulation mode */
@@ -161,16 +162,20 @@ typedef enum{
 
 /**
  * @brief Enumerations for NFC Secure Element (SIM/UICC(Universal Integrated Circuit Card)) type
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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_UICC = 0x02, /**< UICC type card emulation */
+       NFC_SE_TYPE_SDCARD = 0x03, /**< SDCARD card emulation (Not yet supported on Tizen) (@b Since: 2.3.1)  */
+       NFC_SE_TYPE_HCE = 0x04 /**< Host based card emulation (@b Since: 2.3.1) */
 } nfc_se_type_e;
 
 /**
  * @brief Enumerations for NFC Card Emulation Mode type
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  */
 typedef enum{
@@ -179,18 +184,8 @@ typedef enum{
 } 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 Enumerations for SNEP event
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  */
 typedef enum {
@@ -204,6 +199,7 @@ typedef enum {
 
 /**
  * @brief Enumerations for SNEP request type
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  */
 typedef enum {
@@ -212,66 +208,71 @@ typedef enum {
 } nfc_snep_type_e;
 
 /**
- * @brief Enumerations for PRBS technology type
- * @ingroup CAPI_NETWORK_NFC_TEST_MODULE
+ * @brief Enumerations for NFC Card Emulation Category type
+ * @since_tizen 2.3.1
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
  */
-typedef enum {
-       NFC_PRBS_TECH_NONE = 0x00, /**< Unknown NFC technology */
-       NFC_PRBS_TECH_A = 0x01, /**< NFC technology A */
-       NFC_PRBS_TECH_B = 0x02, /**< NFC technology B */
-       NFC_PRBS_TECH_F = 0x03, /**< NFC technology F */
-} nfc_prbs_tech_e;
+typedef enum{
+       NFC_CARD_EMULATION_CATEGORY_PAYMENT = 0x01, /**< Category used for NFC payment services */
+       NFC_CARD_EMULATION_CATEGORY_OTHER = 0x02, /**< Category that can be used for all other card emulation services */
+} nfc_card_emulation_category_type_e;
 
 /**
- * @brief Enumerations for PRBS speed rate type
- * @ingroup CAPI_NETWORK_NFC_TEST_MODULE
+ * @brief Enumerations for NFC Card Emulation HCE event type
+ * @since_tizen 2.3.1
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
  */
-typedef enum {
-       NFC_PRBS_RATE_NONE = 0x00, /**< Unknown NFC speed */
-       NFC_PRBS_RATE_106K = 0x01, /**< 106kbps */
-       NFC_PRBS_RATE_212K = 0x02, /**< 212kbps */
-       NFC_PRBS_RATE_424K = 0x03, /**< 424kbps */
-} nfc_prbs_rate_e;
+typedef enum{
+       NFC_HCE_EVENT_DEACTIVATED = 0x00, /**< HCE Deactivated */
+       NFC_HCE_EVENT_ACTIVATED = 0x01, /**< HCE Activated */
+       NFC_HCE_EVENT_APDU_RECEIVED = 0x02, /**< HCE APDU Received */
+} nfc_hce_event_type_e;
 
 /**
  * @brief The handle to the NDEF record
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  */
 typedef struct _ndef_record_s *nfc_ndef_record_h;
 
 /**
  * @brief The handle to the NDEF message
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
  */
 typedef struct _ndef_message_s *nfc_ndef_message_h;
 
 /**
  * @brief The handle to the NFC tag
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
  */
 typedef struct _net_nfc_target_info_s *nfc_tag_h;
 
-
 /**
  * @brief The handle to NFC p2p target
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  */
 typedef void *nfc_p2p_target_h;
 
 /**
  * @brief The handle to NFC p2p snep instance
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  */
 typedef struct _nfc_p2p_snep_s *nfc_p2p_snep_h;
 
 /**
  * @brief The handle to NFC secure element instance
- * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
  */
 typedef void *nfc_se_h;
 
 /**
  * @brief The default factory key.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @details The key is 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  */
@@ -279,6 +280,7 @@ 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @details The key is 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  */
@@ -286,6 +288,7 @@ 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @details The key is 0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  */
@@ -294,43 +297,52 @@ extern const unsigned char NFC_TAG_MIFARE_KEY_NFC_FORUM[6];
 
 /**
  * @brief RTD(Record type definition) Type - Smart Poster type.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  */
 extern const unsigned char NFC_RECORD_TEXT_TYPE[1];
 /**
  * @brief  RTD(Record type definition) Type - URI type.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @platform
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @param [in] error The result
@@ -342,6 +354,7 @@ typedef void (* nfc_activation_completed_cb)(nfc_error_e error, void *user_data)
 
 /**
  * @brief Called when nfc activation state is changed.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @param [in] activated The activation state
@@ -352,34 +365,12 @@ typedef void (* nfc_activation_completed_cb)(nfc_error_e error, void *user_data)
 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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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().
+ *     So then do not use tag functions which use tag handle.
  *
  * @param [in] type The discovered type attached or detached
  * @param [in] tag The handle to NFC tag
@@ -393,6 +384,7 @@ typedef void (* nfc_tag_discovered_cb)(nfc_discovered_type_e type, nfc_tag_h tag
 
 /**
  * @brief Called when an NDEF Message is discovered
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
@@ -408,6 +400,7 @@ typedef void (* nfc_ndef_discovered_cb)(nfc_ndef_message_h message, void *user_d
 
 /**
  * @brief Called once for each tag information.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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.)
@@ -418,9 +411,9 @@ typedef void (* nfc_ndef_discovered_cb)(nfc_ndef_message_h message, void *user_d
  * @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.
+ * @pre nfc_tag_foreach_information() invokes this callback.
  *
- * @see        nfc_tag_foreach_informations()
+ * @see        nfc_tag_foreach_information()
  */
 
 typedef bool (*nfc_tag_information_cb)(const char *key, const unsigned char *value, int value_size, void *user_data);
@@ -428,12 +421,13 @@ typedef bool (*nfc_tag_information_cb)(const char *key, const unsigned char *val
 
 /**
  * @brief Called after nfc_tag_transceive() has completed.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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 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()
  *
@@ -443,6 +437,7 @@ typedef void (* nfc_tag_transceive_completed_cb)(nfc_error_e result, unsigned ch
 
 /**
  * @brief Called after the nfc_tag_write_ndef() has completed.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
  *
  * @param [in] result The result of function call
@@ -454,6 +449,7 @@ typedef void (* nfc_tag_write_completed_cb)(nfc_error_e result, void *user_data)
 
 /**
  * @brief Called after the nfc_tag_read_ndef() has completed.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
  *
  * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
@@ -468,6 +464,7 @@ typedef void (* nfc_tag_read_completed_cb)(nfc_error_e result, nfc_ndef_message_
 
 /**
  * @brief   Called after the nfc_tag_format_ndef() has completed.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
  *
  * @param [in] result The result of function call
@@ -480,6 +477,7 @@ typedef void (* nfc_tag_format_completed_cb)(nfc_error_e result, void *user_data
 
 /**
  * @brief Called after nfc_mifare_authenticate_with_keyA() has completed
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  *
  * @param [in] result The result of nfc_mifare_authenticate_with_keyA()
@@ -491,6 +489,7 @@ typedef void (* nfc_mifare_authenticate_with_keyA_completed_cb)(nfc_error_e resu
 
 /**
  * @brief Called after nfc_mifare_authenticate_with_keyB() has completed
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  *
  * @param [in] result The result of function call
@@ -502,6 +501,7 @@ typedef void (* nfc_mifare_authenticate_with_keyB_completed_cb)(nfc_error_e resu
 
 /**
  * @brief Called after nfc_mifare_write_block() has completed
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  *
  * @param [in] result The result of nfc_mifare_write_block()
@@ -513,6 +513,7 @@ typedef void (* nfc_mifare_write_block_completed_cb)(nfc_error_e result, void *u
 
 /**
  * @brief Called after nfc_mifare_write_page() has completed
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  *
  * @param [in] result The result of function call
@@ -524,6 +525,7 @@ typedef void (* nfc_mifare_write_page_completed_cb)(nfc_error_e result, void *us
 
 /**
  * @brief Called after nfc_mifare_read_block() has completed
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  *
  * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
@@ -539,6 +541,7 @@ typedef void (* nfc_mifare_read_block_completed_cb)(nfc_error_e result, unsigned
 
 /**
  * @brief Called after nfc_mifare_read_page() has completed
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  *
  * @remarks @a buffer will be automatically destroyed when the callback function returns. (Do not release @a buffer.)
@@ -554,6 +557,7 @@ typedef void (* nfc_mifare_read_page_completed_cb)(nfc_error_e result, unsigned
 
 /**
  * @brief Called after nfc_mifare_increment() has completed
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  *
  * @param [in] result The result of nfc_mifare_increment()
@@ -565,6 +569,7 @@ typedef void (* nfc_mifare_increment_completed_cb)(nfc_error_e result, void *use
 
 /**
  * @brief Called after nfc_mifare_decrement() has completed
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  *
  * @param [in] result The result of nfc_mifare_decrement()
@@ -576,6 +581,7 @@ typedef void (* nfc_mifare_decrement_completed_cb)(nfc_error_e result, void *use
 
 /**
  * @brief Called after nfc_mifare_transfer() has completed
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  *
  * @param [in] result The result of nfc_mifare_transfer()
@@ -587,6 +593,7 @@ typedef void (* nfc_mifare_transfer_completed_cb)(nfc_error_e result, void *user
 
 /**
  * @brief Called after nfc_mifare_restore() has completed
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  *
  * @param [in] result The result of nfc_mifare_restore()
@@ -600,6 +607,7 @@ typedef void (* nfc_mifare_restore_completed_cb)(nfc_error_e result, void *user_
 
 /**
  * @brief Called when NFC peer-to-peer target appeared or disappeared
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @param [in] type The discovered type attached or detached
@@ -613,6 +621,7 @@ typedef void (*nfc_p2p_target_discovered_cb)(nfc_discovered_type_e type, nfc_p2p
 
 /**
  * @brief Called when receiving  Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @param [in] event The Secure Element event
@@ -626,6 +635,7 @@ typedef void (*nfc_se_event_cb)(nfc_se_event_e event , void *user_data);
 
 /**
  * @brief Called when receiving Secure Element(SIM/UICC(Universal Integrated Circuit Card)) transaction event data
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @remarks This event  notifies , external reader trys to access secure element.
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
@@ -645,6 +655,7 @@ typedef void (*nfc_se_transaction_event_cb)(nfc_se_type_e se_type, unsigned char
 
 /**
  * @brief Called after nfc_p2p_send() has completed.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  *
  * @param [in] result The result of function call
@@ -657,6 +668,7 @@ typedef void (*nfc_p2p_send_completed_cb)(nfc_error_e result, void *user_data);
 
 /**
  * @brief Called after nfc_p2p_send() has completed.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  *
  * @remarks @a message will be automatically destroyed when the callback function returns. (Do not release @a message.)
@@ -668,30 +680,11 @@ typedef void (*nfc_p2p_send_completed_cb)(nfc_error_e result, void *user_data);
  * @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);
-
+typedef void (*nfc_p2p_data_received_cb)(nfc_p2p_target_h target, nfc_ndef_message_h message, void *user_data);
 
 /**
  * @brief Called when SNEP event is raised
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  *
  * @param [in] handle The handle of current snep instance
@@ -701,46 +694,63 @@ typedef void (*nfc_p2p_connection_handover_completed_cb)(nfc_error_e result, nfc
  * @param [in] user_data The user data passed from snep apis.
  *
  * @see nfc_snep_start_server()
- * @see nfc_snep_send_request()
+ * @see nfc_snep_send_client_request()
  */
 typedef void (*nfc_snep_event_cb)(nfc_p2p_snep_h handle,
        nfc_snep_event_e event, nfc_error_e result,
        nfc_ndef_message_h msg, void *user_data);
 
 /**
- * @brief Gets the value that indicates whether NFC is supported.
- * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @brief Called when receiving HCE(Host Card Emulation) event.
+ * @since_tizen 2.3.1
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
+ * @remarks If the event type is NFC_HCE_EVENT_DEACTIVATED or NFC_HCE_EVENT_ACTIVATED, then apdu and apdu_len is NULL and 0.
  *
- * @remarks This function can executed Regardless of nfc_manager_initialize state.
+ * @param [in] handle The handle of connected secure element
+ * @param [in] event The HCE event type
+ * @param [in] apdu The bytes array of apdu command data
+ * @param [in] apdu_len The size of apdu command bytes array
+ * @param [in] user_data The user data passed from nfc_manager_set_hce_event_cb()
  *
- * @return true on NFC supported,  otherwise false
+ * @see nfc_manager_set_hce_event_cb()
+ * @see nfc_manager_unset_hce_event_cb()
+ */
+typedef void (*nfc_hce_event_cb)(nfc_se_h handle, nfc_hce_event_type_e event, unsigned char *apdu, unsigned int apdu_len, void *user_data);
+
+/**
+ * @brief Called once for each registered AID.
+ * @since_tizen 2.3.1
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
  *
- * @see nfc_manager_set_activation()
+ * @param [in] se_type The type of Secure Element
+ * @param [in] aid Application Id, specified in ISO/IEC 7816-4
+ * @param [in] read_only @c true an aid is on read only mode, otherwise @c false
+ * @param [in] user_data The user data passed from the foreach function
+ *
+ * @see nfc_se_foreach_registered_aids()
  */
-bool nfc_manager_is_supported(void);
+typedef void (*nfc_se_registered_aid_cb)(nfc_se_type_e se_type,        const char *aid, bool read_only, void *user_data);
 
 /**
- * @brief Sets NFC Activation
+ * @brief Gets the value that indicates whether NFC is supported.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @remarks This function can executed Regardless of nfc_manager_initialize state.
  *
- * @see nfc_manager_is_activated()
- * @see nfc_activation_completed_cb()
+ * @return true on NFC supported,  otherwise false
+ * @exception #NFC_ERROR_NONE Success
+ * @exception #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @exception #NFC_ERROR_ILLEGAL_STATE Illegal state
+ * @exception #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #NFC_ERROR_OPERATION_FAILED Operation fail
  */
-int nfc_manager_set_activation(bool activation, nfc_activation_completed_cb callback, void *user_data);
+bool nfc_manager_is_supported(void);
 
 /**
  * @brief Set NFC Activation state changed callback
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @param [in] callback The callback function to invoke when activation state is changed.
@@ -748,80 +758,103 @@ int nfc_manager_set_activation(bool activation, nfc_activation_completed_cb call
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
  *
  * @see nfc_activation_changed_cb()
  * @see nfc_manager_unset_activation_changed_cb()
+ * @see nfc_manager_initialize()
  */
 int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback , void *user_data);
 
 /**
  * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ *
+ * @exception #NFC_ERROR_NONE Success
+ * @exception #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @exception #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ *
  * @see nfc_manager_set_activation_changed_cb()
  * @see nfc_activation_changed_cb()
+ * @see nfc_manager_initialize()
  */
 void nfc_manager_unset_activation_changed_cb(void);
 
-
 /**
- * @brief Gets NFC Activation state
+ * @brief Sets NFC Activation
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/nfc.admin
+ * @platform
  * @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] 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
  *
+ * @post It invokes nfc_activation_completed_cb() when it has completed to set activation.\n
+ * The Callback can receive error code when process is done.
+ *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_ALREADY_ACTIVATED Already activated
+ * @retval #NFC_ERROR_ALREADY_DEACTIVATED Already deactivated
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
  *
- * @see nfc_manager_initialize_sync()
- * @see nfc_manager_deinitialize()
+ * @see nfc_manager_is_activated()
+ * @see nfc_activation_completed_cb()
+ * @see nfc_manager_initialize()
+*/
+int nfc_manager_set_activation(bool activation, nfc_activation_completed_cb callback, void *user_data);
+
+/**
+ * @brief Gets NFC Activation state
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ * @remarks This function can executed Regardless of nfc_manager_initialize state.
+ *
+ * @return true on NFC activated,  otherwise false
+ * @exception #NFC_ERROR_NONE Success
+ * @exception #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @exception #NFC_ERROR_ILLEGAL_STATE Illegal state
+ * @exception #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #NFC_ERROR_OPERATION_FAILED Operation fail
  */
-int nfc_manager_initialize(nfc_initialize_completed_cb callback, void *user_data);
+bool nfc_manager_is_activated(void);
 
 /**
  * @brief Initializes NFC Manager.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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_NOT_SUPPORTED Not supported NFC
  * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
  *
- * @see nfc_manager_initialize()
  * @see nfc_manager_deinitialize()
  */
-int nfc_manager_initialize_sync();
-
+int nfc_manager_initialize();
 
 /**
  * @brief Releases all the resource of the NFC Manager and disconnect the session between an application and NFC Manager.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
  * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
  *
  * @see nfc_manager_initialize()
@@ -837,24 +870,36 @@ int nfc_manager_deinitialize(void);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  *
  * @see nfc_manager_unset_tag_discovered_cb()
  * @see nfc_tag_discovered_cb()
+ * @see nfc_manager_initialize()
  */
 int nfc_manager_set_tag_discovered_cb(nfc_tag_discovered_cb callback, void *user_data);
 
 /**
  * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ *
+ * @exception #NFC_ERROR_NONE Success
+ * @exception #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @exception #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ *
  * @see nfc_manager_set_tag_discovered_cb()
  * @see nfc_tag_discovered_cb()
+ * @see nfc_manager_initialize()
  */
 void nfc_manager_unset_tag_discovered_cb(void);
 
 /**
  * @brief Registers a callback function for receiving NDEF Message discovered notification
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @param [in] callback The callback function called when NDEF Message is discovered
@@ -862,24 +907,36 @@ void nfc_manager_unset_tag_discovered_cb(void);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  *
  * @see nfc_manager_unset_ndef_discovered_cb()
  * @see nfc_ndef_discovered_cb()
+ * @see nfc_manager_initialize()
  */
 int nfc_manager_set_ndef_discovered_cb(nfc_ndef_discovered_cb callback, void *user_data);
 
 /**
  * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ *
+ * @exception #NFC_ERROR_NONE Success
+ * @exception #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @exception #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ *
  * @see nfc_manager_set_ndef_discovered_cb()
  * @see nfc_ndef_discovered_cb()
+ * @see nfc_manager_initialize()
  */
 void nfc_manager_unset_ndef_discovered_cb(void);
 
 /**
  * @brief Registers a callback function for receiving NFC peer-to-peer target discovered notification.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @param [in] callback The callback function called when NFC peer-to-peer target is discovered
@@ -887,25 +944,37 @@ void nfc_manager_unset_ndef_discovered_cb(void);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  *
  * @see nfc_manager_unset_ndef_discovered_cb()
  * @see nfc_p2p_target_discovered_cb()
+ * @see nfc_manager_initialize()
  */
 int nfc_manager_set_p2p_target_discovered_cb(nfc_p2p_target_discovered_cb callback, void *user_data);
 
 /**
  * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ *
+ * @exception #NFC_ERROR_NONE Success
+ * @exception #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @exception #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ *
  * @see nfc_manager_set_p2p_target_discovered_cb()
  * @see nfc_p2p_target_discovered_cb()
+ * @see nfc_manager_initialize()
  */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @param [in] callback The callback function called when occurred Secure Element (SIM/UICC(Universal Integrated Circuit Card)) event.
@@ -913,25 +982,37 @@ void nfc_manager_unset_p2p_target_discovered_cb(void);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  *
  * @see nfc_se_event_cb()
  * @see nfc_manager_unset_se_event_cb()
+ * @see nfc_manager_initialize()
  */
 
 int nfc_manager_set_se_event_cb(nfc_se_event_cb callback, void *user_data);
 
 /**
  * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ *
+ * @exception #NFC_ERROR_NONE Success
+ * @exception #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @exception #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ *
  * @see nfc_se_event_cb()
  * @see nfc_manager_set_se_event_cb()
+ * @see nfc_manager_initialize()
  */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @param [in] se_type The type of secure element.
@@ -940,27 +1021,137 @@ void nfc_manager_unset_se_event_cb(void);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  *
  * @see nfc_se_transaction_event_cb()
  * @see nfc_manager_unset_se_transaction_event_cb()
+ * @see nfc_manager_initialize()
  */
-int nfc_manager_set_se_transaction_event_cb(nfc_se_type_e se_type, 
-               nfc_se_transaction_event_cb callback, void *user_data);
+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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @param [in] se_type The type of secure element.
  *
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ *
+ * @exception #NFC_ERROR_NONE Success
+ * @exception #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @exception #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ *
  * @see nfc_se_transaction_event_cb()
  * @see nfc_manager_set_se_transaction_event_cb()
+ * @see nfc_manager_initialize()
  */
 void nfc_manager_unset_se_transaction_event_cb(nfc_se_type_e se_type);
 
 /**
+ * @brief Registers a callback function for receiving HCE(Host Card Emulation) event.
+ * @since_tizen 2.3.1
+ * @privlevel   public
+ * @privilege   %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] callback The callback function called when HCE(Host Card Emulation) event occurred.
+ * @param [in] user_data The user data to be passed to the callback function
+ *
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_PERMISSION_DENIED        Permission denied
+ *
+ * @see nfc_hce_event_cb()
+ * @see nfc_manager_unset_hce_event_cb()
+ * @see nfc_manager_initialize()
+ */
+int nfc_manager_set_hce_event_cb(nfc_hce_event_cb callback, void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @since_tizen 2.3.1
+ * @privlevel   public
+ * @privilege   %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ *
+ * @exception #NFC_ERROR_NONE Success
+ * @exception #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @exception #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @exception #NFC_ERROR_PERMISSION_DENIED     Permission denied
+ *
+ * @see nfc_hce_event_cb()
+ * @see nfc_manager_set_hce_event_cb()
+ * @see nfc_manager_initialize()
+ */
+void nfc_manager_unset_hce_event_cb(void);
+
+/**
+ * @brief give the priority to the foreground application when dispatching transaction event.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @remarks This function must be called only when the application is in the foreground. \n
+ *     If the application go out from foreground, application must call "nfc_manager_disable_transaction_fg_dispatch" to disable foreground dispatch \n\n
+ * @remarks Security level can be determined by the manufacturer usage.\n
+ * If a security issue is occurred, contact with the manufacturer of the product.\n
+ * If you want to know about security level in detail, See the GSMA specification.\n
+ * (http://www.gsma.com/digitalcommerce/wp-content/uploads/2013/12/GSMA-NFC05-NFC-Handset-APIs-Requirement-Specification-version-4-1.pdf)
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_PERMISSION_DENIED Security restricted by SMACK
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_SECURITY_RESTRICTED Security restricted by Access Control
+ * @retval #NFC_ERROR_ILLEGAL_STATE Illegal state
+ * @retval #NFC_ERROR_OPERATION_FAILED IPC fail
+ *
+ * @see nfc_manager_disable_transaction_fg_dispatch()
+ * @see nfc_manager_initialize()
+ */
+int nfc_manager_enable_transaction_fg_dispatch();
+
+/**
+ * @brief disable foreground dispatch for "EVT_TRANSACTION" to the givin application.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @remarks After calling "nfc_manager_enable_transaction_fg_dispatch", an application must call this api when it go out from foureground.  \n\n
+ * @remarks Security level can be determined by the manufacturer usage.\n
+ * If a security issue is occurred, contact with the manufacturer of the product.\n
+ * If you want to know about security level in detail, See the GSMA specification.\n
+ * (http://www.gsma.com/digitalcommerce/wp-content/uploads/2013/12/GSMA-NFC05-NFC-Handset-APIs-Requirement-Specification-version-4-1.pdf)
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_PERMISSION_DENIED Security restricted by SMACK
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_SECURITY_RESTRICTED Security restricted by Access Control
+ * @retval #NFC_ERROR_ILLEGAL_STATE Illegal state
+ * @retval #NFC_ERROR_OPERATION_FAILED IPC fail
+ *
+ * @see nfc_manager_enable_transaction_fg_dispatch()
+ * @see nfc_manager_initialize()
+ */
+int nfc_manager_disable_transaction_fg_dispatch();
+
+/**
  * @brief Gets NDEF message cached when the tag is detected or when data received from NFC peer-to-peer target.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
  *
  * @remarks This function is used to get the ndef message that was read before launched your application.
@@ -968,14 +1159,21 @@ void nfc_manager_unset_se_transaction_event_cb(nfc_se_type_e se_type);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
- * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE The cached message does not exist
+ * @retval #NFC_ERROR_NO_NDEF_MESSAGE The cached message does not exist
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @see nfc_manager_initialize()
+ *
  */
 int nfc_manager_get_cached_message(nfc_ndef_message_h *ndef_message);
 
-
 /**
  * @brief Sets filter of target types.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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.
@@ -984,139 +1182,196 @@ int nfc_manager_get_cached_message(nfc_ndef_message_h *ndef_message);
  *
  * @param [in] filter The filter value with bits operation #nfc_tag_filter_e
  *
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
+ *
+ * @exception #NFC_ERROR_NONE Success
+ * @exception #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @exception #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @exception #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
  * @see nfc_manager_get_tag_filter()
  * @see nfc_tag_discovered_cb()
+ * @see nfc_manager_initialize()
  */
 void nfc_manager_set_tag_filter(int filter);
 
 /**
  * @brief Gets the current filter status.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
  *
  * @return The filter which is set #nfc_tag_filter_e
  *
+ * @exception #NFC_ERROR_NONE Success
+ * @exception #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @exception #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ *
  * @see nfc_manager_set_tag_filter()
+ * @see nfc_manager_initialize()
  */
 int nfc_manager_get_tag_filter(void);
 
 /**
  * @brief Gets current connected tag.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @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_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_NO_DEVICE There is no connected target
+ * @retval #NFC_ERROR_PERMISSION_DENIED Security restricted by SMACK
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
  * @retval #NFC_ERROR_NO_DEVICE There is no connected tag
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @see nfc_manager_initialize()
  */
 int nfc_manager_get_connected_tag(nfc_tag_h *tag);
 
 /**
  * @brief Gets current connected p2p target
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @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_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
  * @retval #NFC_ERROR_NO_DEVICE There is no connected target
+ * @retval #NFC_ERROR_PERMISSION_DENIED Security restricted by SMACK
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_NO_DEVICE There is no connected tag
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @see nfc_manager_initialize()
  */
 int nfc_manager_get_connected_target(nfc_p2p_target_h *target);
 
 
 /**
  * @brief Enable or disable the system handling for tag and target discovered event
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
- * @remarks By default, The system handling is enabled.
+ * @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
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_PERMISSION_DENIED Security restricted by SMACK
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
  *
  * @see nfc_manager_is_system_handler_enabled()
+ * @see nfc_manager_initialize()
  */
 int nfc_manager_set_system_handler_enable(bool enable);
 
 /**
- * @brief Enable or disable the system handling for tag and target discovered event
- * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
- * @remarks By default, The system handling is enabled.
- *
- * @param [in] enable The state of enable
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #NFC_ERROR_NONE Successful
- * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
- *
- * @see nfc_manager_is_system_handler_enabled()
- */
-int nfc_manager_set_system_handler_enable_force(bool enable);
-
-/**
  * @brief Gets the state of the system handler
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
- * @remarks By default, The system handling is enabled.
+ * @remarks In default, The system handling is enabled.
+ * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
  *
  * @return true on enabled, otherwise false.
  *
+ * @exception #NFC_ERROR_NONE Success
+ * @exception #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @exception #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @exception #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @exception #NFC_ERROR_PERMISSION_DENIED Security restricted by SMACK
+ * @exception #NFC_ERROR_OPERATION_FAILED Operation failed
+ *
  * @see nfc_manager_set_system_handler_enable()
+ * @see nfc_manager_initialize()
  */
 bool nfc_manager_is_system_handler_enabled(void);
 
 /**
  * @brief Sets the card emulation Secure Element type
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc.cardemulation
  * @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.
+ * @remarks Security level can be determined by the manufacturer usage.\n
+ * If a security issue is occurred, contact with the manufacturer of the product.\n
+ * If you want to know about security level in detail, See the GSMA specification.\n
+ * (http://www.gsma.com/digitalcommerce/wp-content/uploads/2013/12/GSMA-NFC05-NFC-Handset-APIs-Requirement-Specification-version-4-1.pdf)
  *
  * @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_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_PERMISSION_DENIED Security restricted by SMACK
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_SECURITY_RESTRICTED Security restricted by Access Control
+ * @retval #NFC_ERROR_ILLEGAL_STATE Illegal state
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
  *
- * @see nfc_manager_get_card_emulation_se_type()
+ * @see nfc_manager_initialize()
  */
-int nfc_manager_set_card_emulation_se_type(nfc_se_type_e type, nfc_set_card_emulation_completed_cb callback, void* user_data);
+int nfc_manager_set_se_type(nfc_se_type_e type);
 
 /**
  * @brief Gets the card emulation Secure Element type
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc.cardemulation
  * @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_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_PERMISSION_DENIED Security restricted by SMACK
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
  *
- * @see nfc_manager_set_card_emulation_se_type()
+ * @see nfc_manager_initialize()
  */
-int nfc_manager_get_card_emulation_se_type(nfc_se_type_e* type);
-
-/**
- * @brief Gets the card emulation Secure Element type
- * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
- *
- * @param [in] 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
- *
- */
-int nfc_manager_set_se_type(nfc_se_type_e type);
+int nfc_manager_get_se_type(nfc_se_type_e *type);
 
 /**
  * @brief Creates a record with given parameter value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  *
  * @remarks Every data buffer is deeply copied.\n
@@ -1133,6 +1388,8 @@ int nfc_manager_set_se_type(nfc_se_type_e type);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
  *
@@ -1140,12 +1397,14 @@ int nfc_manager_set_se_type(nfc_se_type_e type);
  * @see nfc_ndef_record_create_uri()
  * @see nfc_ndef_record_create_mime()
  * @see nfc_ndef_record_destroy()
+ * @see nfc_manager_initialize()
  */
-int nfc_ndef_record_create(nfc_ndef_record_h *record, nfc_record_tnf_e tnf, const unsigned char *type, int type_size, const unsigned char *id, int id_size, const unsigned char *payload, int payload_size);
+int nfc_ndef_record_create(nfc_ndef_record_h *record, nfc_record_tnf_e tnf, const unsigned char *type, int type_size, const unsigned char *id, int id_size, const unsigned char *payload, unsigned int payload_size);
 
 
 /**
  * @brief Creates a record with text type payload
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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
@@ -1163,6 +1422,8 @@ int nfc_ndef_record_create(nfc_ndef_record_h *record, nfc_record_tnf_e tnf, cons
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
  *
@@ -1173,11 +1434,13 @@ int nfc_ndef_record_create(nfc_ndef_record_h *record, nfc_record_tnf_e tnf, cons
  * @see nfc_ndef_record_get_text()
  * @see nfc_ndef_record_get_langcode()
  * @see nfc_ndef_record_get_encode_type()
+ * @see nfc_manager_initialize()
  */
 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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  *
  * @remarks The uri string will be deep copied.\n
@@ -1188,11 +1451,12 @@ int nfc_ndef_record_create_text(nfc_ndef_record_h *record, const char *text, con
  * 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_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
  *
@@ -1201,12 +1465,14 @@ int nfc_ndef_record_create_text(nfc_ndef_record_h *record, const char *text, con
  * @see nfc_ndef_record_create_mime()
  * @see nfc_ndef_record_destroy()
  * @see nfc_ndef_record_get_uri()
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char *uri);
 
 
 /**
  * @brief Creates a record with MIME type payload
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  *
  * @remarks The data buffer will be deep copied.\n
@@ -1219,12 +1485,14 @@ int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char *uri);
  * 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] mime_type       The mime type [RFC 2046] (ex. text/plain, image/jpeg ) This 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_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
  *
@@ -1233,29 +1501,35 @@ int nfc_ndef_record_create_uri(nfc_ndef_record_h* record, const char *uri);
  * @see nfc_ndef_record_create_text()
  * @see nfc_ndef_record_destroy()
  * @see nfc_ndef_record_get_mime_type()
+ * @see nfc_manager_initialize()
  */
-int nfc_ndef_record_create_mime(nfc_ndef_record_h* record, const char *mime_type, const unsigned char *data, int data_size);
+int nfc_ndef_record_create_mime(nfc_ndef_record_h* record, const char *mime_type, const unsigned char *data, unsigned int data_size);
 
 
 /**
  * @brief Destroys the record handle
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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()
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_record_destroy(nfc_ndef_record_h record);
 
 /**
  * @brief Sets record ID
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  *
  * @remarks The ID buffer are deep copied.
@@ -1265,15 +1539,19 @@ int nfc_ndef_record_destroy(nfc_ndef_record_h record);
  * @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_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  *
  * @see nfc_ndef_record_get_id()
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_record_set_id(nfc_ndef_record_h record, unsigned char *id, int id_size);
 
 /**
  * @brief Gets record ID
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  *
  * @remarks It may return NULL pointer if the ID is not exist\n
@@ -1282,18 +1560,22 @@ int nfc_ndef_record_set_id(nfc_ndef_record_h record, unsigned char *id, int id_s
  *
  * @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
+ * @param [out] size The size of ID in bytes
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  *
  * @see nfc_ndef_record_set_id()
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_record_get_id(nfc_ndef_record_h record, unsigned char **id, int *size);
 
 /**
  * @brief Gets record payload.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  *
  * @remarks This function gives you  the pointer of payload that is contained by record\n
@@ -1305,12 +1587,17 @@ int nfc_ndef_record_get_id(nfc_ndef_record_h record, unsigned char **id, int *si
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_record_get_payload(nfc_ndef_record_h record, unsigned char ** payload, unsigned int *size);
 
 /**
  * @brief Gets record type.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  *
  * @remarks This function gives you  the pointer of type that is contained by record.\n
@@ -1322,12 +1609,17 @@ int nfc_ndef_record_get_payload(nfc_ndef_record_h record, unsigned char ** paylo
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_record_get_type(nfc_ndef_record_h record, unsigned char **type, int *size);
 
 /**
  * @brief Gets record TNF(Type Name Format) value.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  *
  * @param [in] record The handle to record
@@ -1335,12 +1627,17 @@ int nfc_ndef_record_get_type(nfc_ndef_record_h record, unsigned char **type, int
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e *tnf);
 
 /**
  * @brief Gets text from text record
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  *
  * @remarks This function returns newly allocated string, this value must be deallocated by caller.\n
@@ -1352,15 +1649,19 @@ int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e *tnf);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
  *
  * @see nfc_ndef_record_create_text()
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_record_get_text(nfc_ndef_record_h record, char **text);
 
 /**
  * @brief Gets language code from text record
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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
@@ -1371,15 +1672,19 @@ int nfc_ndef_record_get_text(nfc_ndef_record_h record, char **text);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
  *
  * @see nfc_ndef_record_create_text()
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code);
 
 /**
  * @brief Gets encoding type from text record
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  *
  * @remarks  This function is valid only for text type record.\n
@@ -1390,15 +1695,19 @@ int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
  *
  * @see nfc_ndef_record_create_text()
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_record_get_encode_type(nfc_ndef_record_h record, nfc_encode_type_e *encode);
 
 /**
  * @brief Gets URI from uri record
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  *
  * @remarks The function returns newly allocated string, this value must be deallocated by caller.\n
@@ -1410,16 +1719,20 @@ int nfc_ndef_record_get_encode_type(nfc_ndef_record_h record, nfc_encode_type_e
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
  *
  * @see nfc_ndef_record_create_uri()
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_record_get_uri(nfc_ndef_record_h record, char **uri);
 
 
 /**
  * @brief Gets mime type from mime type record
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_RECORD_MODULE
  *
  * @remarks The function returns newly allocated string, this value must be deallocated by caller.\n
@@ -1431,32 +1744,40 @@ int nfc_ndef_record_get_uri(nfc_ndef_record_h record, char **uri);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_INVALID_RECORD_TYPE Invalid record type
  *
  * @see nfc_ndef_record_create_mime()
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_record_get_mime_type(nfc_ndef_record_h record, char **mime_type);
 
 
 /**
  * @brief Creates NDEF message handle
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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()
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_message_create(nfc_ndef_message_h *ndef_message);
 
 /**
  * @brief Creates NDEF message handle from raw serial bytes.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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
@@ -1468,18 +1789,21 @@ int nfc_ndef_message_create(nfc_ndef_message_h *ndef_message);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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()
+ * @see nfc_manager_initialize()
  */
-int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h *ndef_message,
-               const unsigned char *rawdata, unsigned int rawdata_size);
+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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
  *
  * @remarks This function will free all these memory including record handles.
@@ -1488,15 +1812,19 @@ int nfc_ndef_message_create_from_rawdata(nfc_ndef_message_h *ndef_message,
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  *
  * @see nfc_ndef_message_create()
  * @see nfc_ndef_message_create_from_rawdata()
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message);
 
 /**
  * @brief Gets the number of record in NDEF message
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
  *
  * @param [in] ndef_message The handle to NDEF message
@@ -1504,12 +1832,17 @@ int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message, int *count);
 
 /**
  * @brief Gets serial bytes array of NDEF message.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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.
@@ -1520,17 +1853,20 @@ int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message, int *coun
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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()
+ * @see nfc_manager_initialize()
  */
-int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message,
-               unsigned char **rawdata, unsigned int *rawdata_size);
+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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
  *
  * @remarks Appended record is handled by frameworks. The record is released by frameworks when message is released.
@@ -1540,15 +1876,19 @@ int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message,
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  *
  * @see nfc_ndef_message_insert_record()
  * @see nfc_ndef_message_remove_record()
+ * @see nfc_manager_initialize()
  */
 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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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
@@ -1560,16 +1900,20 @@ int nfc_ndef_message_append_record(nfc_ndef_message_h ndef_message, nfc_ndef_rec
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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()
+ * @see nfc_manager_initialize()
  */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
  *
  * @param [in] ndef_message The handle to NDEF message
@@ -1577,16 +1921,20 @@ int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message, int index, n
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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()
+ * @see nfc_manager_initialize()
  */
 int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message, int index);
 
 /**
  * @brief Gets record by index.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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
@@ -1597,12 +1945,17 @@ int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message, int index);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ * @see nfc_manager_initialize()
  */
 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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
  *
  * @param [in] tag The handle to NFC tag
@@ -1610,12 +1963,18 @@ int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message, int index, nfc_
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @see nfc_manager_initialize()
  */
 int nfc_tag_get_type(nfc_tag_h tag, nfc_tag_type_e *type);
 
 /**
  * @brief Checks whether the given NFC tag supports NDEF messages.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
  *
  * @param [in] tag The handle to NFC tag
@@ -1623,14 +1982,18 @@ int nfc_tag_get_type(nfc_tag_h tag, nfc_tag_type_e *type);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  *
  * @see nfc_tag_read_ndef()
+ * @see nfc_manager_initialize()
  */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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.
@@ -1640,12 +2003,17 @@ int nfc_tag_is_support_ndef(nfc_tag_h tag, bool *is_supported);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ *
+ * @see nfc_manager_initialize()
  */
 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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
  *
  * @param [in] tag The handle to NFC tag
@@ -1653,14 +2021,18 @@ int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag, unsigned int *maximum_ndef_byte
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  *
+ * @see nfc_manager_initialize()
  */
 int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int *ndef_bytes_size);
 
 
 /**
  * @brief Retrieves all tag information
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
  *
  * @param[in] tag The handle to NFC tag
@@ -1669,14 +2041,21 @@ int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int *ndef_bytes_size);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
  *
+ * @see nfc_manager_initialize()
  */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @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.
@@ -1690,21 +2069,29 @@ int nfc_tag_foreach_information(nfc_tag_h tag, nfc_tag_information_cb callback,
 *
 * @return 0 on success, otherwise a negative error value.
 * @retval #NFC_ERROR_NONE Successful
+* @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+* @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
 * @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_OPERATION_FAILED Operation failed
+*
+* @post It invokes nfc_tag_transceive_completed_cb() when it has completed to transceive data.\n
+* The Callback can receive error code when process is done.
 *
-* @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()
+* @see nfc_manager_initialize()
 */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @ingroup CAPI_NETWORK_NFC_TAG_MODULE
  *
  * @param [in] tag The handle to NFC tag
@@ -1713,50 +2100,64 @@ int nfc_tag_transceive(nfc_tag_h tag, unsigned char *buffer, int buffer_size, nf
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
  *
- * @post It invokes nfc_tag_read_completed_cb() when it has completed to read NDEF formatted data.
+ * @post It invokes nfc_tag_read_completed_cb() when it has completed to read NDEF formatted data.\n
+ * The Callback can receive error code when process is done.
  *
  * @see nfc_tag_transceive()
  * @see nfc_tag_is_support_ndef()
  * @see nfc_tag_write_ndef()
+ * @see nfc_manager_initialize()
  */
 int nfc_tag_read_ndef(nfc_tag_h tag, nfc_tag_read_completed_cb callback, void *user_data);
 
 /**
  * @brief Writes NDEF formatted data.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @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
+ * @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_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post It invokes nfc_tag_write_completed_cb() when it has completed to write NDEF data.\n
+ * The Callback can receive error code when process is done.
  *
- * @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()
+ * @see nfc_manager_initialize()
  */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @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
  *
@@ -1768,23 +2169,30 @@ int nfc_tag_write_ndef(nfc_tag_h tag, nfc_ndef_message_h msg, nfc_tag_write_comp
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
  *
- * @post It invokes nfc_tag_format_completed_cb() when it has completed to format the NFC tag.
+ * @post It invokes nfc_tag_format_completed_cb() when it has completed to format the NFC tag.\n
+ * The Callback can receive error code when process is done.
  *
  * @see nfc_tag_is_support_ndef()
+ * @see nfc_manager_initialize()
  */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @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
@@ -1806,14 +2214,18 @@ int nfc_tag_format_ndef(nfc_tag_h tag, unsigned char *key, int key_size, nfc_tag
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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_OPERATION_FAILED Operation failed
+ *
+ * @post It invokes nfc_mifare_authenticate_with_keyA_completed_cb() when it has completed to authenticate the given sector with key A.\n
+ * The Callback can receive error code when process is done.
  *
- * @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()
@@ -1821,13 +2233,16 @@ int nfc_tag_format_ndef(nfc_tag_h tag, unsigned char *key, int key_size, nfc_tag
  * @see nfc_mifare_write_page()
  * @see nfc_mifare_increment()
  * @see nfc_mifare_decrement()
+ * @see nfc_manager_initialize()
 */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @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
@@ -1849,14 +2264,18 @@ int nfc_mifare_authenticate_with_keyA(nfc_tag_h tag, int sector_index, unsigned
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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_OPERATION_FAILED Operation failed
+ *
+ * @post It invokes nfc_mifare_authenticate_with_keyB_completed_cb() when it has completed to authenticate the given sector with key B.\n
+ * The Callback can receive error code when process is done.
  *
- * @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()
@@ -1864,6 +2283,7 @@ int nfc_mifare_authenticate_with_keyA(nfc_tag_h tag, int sector_index, unsigned
  * @see nfc_mifare_write_page()
  * @see nfc_mifare_increment()
  * @see nfc_mifare_decrement()
+ * @see nfc_manager_initialize()
 */
 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);
 
@@ -1871,6 +2291,9 @@ int nfc_mifare_authenticate_with_keyB(nfc_tag_h tag, int sector_index, unsigned
 /**
  * @ingroup CAPI_NETWORK_NFC_TAG_MIFARE_MODULE
  * @brief Reads a 16-byte block.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @remarks This function is only available for MIFARE classic.
  *
  * @param [in] tag The handle to NFC tag
@@ -1880,22 +2303,30 @@ int nfc_mifare_authenticate_with_keyB(nfc_tag_h tag, int sector_index, unsigned
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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_OPERATION_FAILED Operation failed
+ *
+ * @post It invokes nfc_mifare_read_block_completed_cb() when it has completed to read a block.\n
+ * The Callback can receive error code when process is done.
  *
- * @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()
+ * @see nfc_manager_initialize()
 */
 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).
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @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.
  *
@@ -1907,22 +2338,30 @@ int nfc_mifare_read_block(nfc_tag_h tag, int block_index, nfc_mifare_read_block_
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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_OPERATION_FAILED Operation failed
+ *
+ * @post It invokes nfc_mifare_read_page_completed_cb() when it has completed to read a page.\n
+ * The Callback can receive error code when process is done.
  *
- * @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()
+ * @see nfc_manager_initialize()
 */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @remarks This function is only available for MIFARE classic.
  *
  * @param [in] tag The handle to NFC tag
@@ -1934,24 +2373,30 @@ int nfc_mifare_read_page(nfc_tag_h tag, int page_index, nfc_mifare_read_page_com
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
  *
- * @post It invokes nfc_mifare_write_block_completed_cb() when it has completed to write a block.
+ * @post It invokes nfc_mifare_write_block_completed_cb() when it has completed to write a block.\n The Callback can receive error code when process is done.
  *
  * @see nfc_mifare_write_page()
  * @see nfc_mifare_read_block()
+ * @see nfc_manager_initialize()
 */
 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
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @remarks This function is only available for MIFARE Ultra light
  *
  * @param [in] tag The handle to NFC tag
@@ -1963,23 +2408,30 @@ int nfc_mifare_write_block(nfc_tag_h tag, int block_index, unsigned char *buffer
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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_OPERATION_FAILED Operation failed
  *
- * @post It invokes nfc_mifare_write_page_completed_cb() when it has completed to write a page.
+ * @post It invokes nfc_mifare_write_page_completed_cb() when it has completed to write a page.\n
+ * The Callback can receive error code when process is done.
  *
  * @see nfc_mifare_write_block()
  * @see nfc_mifare_read_page()
+ * @see nfc_manager_initialize()
 */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @remarks This function is only available for MIFARE classic
  *
  * @param [in] tag The handle to NFC tag
@@ -1990,22 +2442,31 @@ int nfc_mifare_write_page(nfc_tag_h tag, int page_index, unsigned char *buffer,
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @post It invokes nfc_mifare_increment_completed_cb() when it has completed to increment.\n
+ * The Callback can receive error code when process is done.
  *
  * @see nfc_mifare_decrement()
  * @see nfc_mifare_write_block()
+ * @see nfc_manager_initialize()
 */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @remarks  This function is only available for MIFARE classic
  *
  * @param [in] tag The handle to NFC tag
@@ -2016,21 +2477,30 @@ int nfc_mifare_increment(nfc_tag_h tag, int block_index, int value, nfc_mifare_i
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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_OPERATION_FAILED Operation failed
+ *
+ * @post It invokes nfc_mifare_decrement_completed_cb() when it has completed to decrement.\n
+ * The Callback can receive error code when process is done.
  *
  * @see nfc_mifare_increment()
  * @see nfc_mifare_write_block()
+ * @see nfc_manager_initialize()
 */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @remarks This function is only available for MIFARE classic
  *
  * @param [in] tag The handle to NFC tag
@@ -2040,20 +2510,29 @@ int nfc_mifare_decrement(nfc_tag_h tag, int block_index, int value, nfc_mifare_d
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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_OPERATION_FAILED Operation failed
+ *
+ * @post It invokes nfc_mifare_transfer_completed_cb() when it has completed to transfer.\n
+ * The Callback can receive error code when process is done.
  *
  * @see nfc_mifare_restore()
+ * @see nfc_manager_initialize()
 */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @remarks This function is only available for MIFARE classic
  *
  * @param [in] tag The handle to NFC tag
@@ -2063,20 +2542,26 @@ int nfc_mifare_transfer(nfc_tag_h tag, int block_index, nfc_mifare_transfer_comp
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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_OPERATION_FAILED Operation failed
+ *
+ * @post It invokes nfc_mifare_restore_completed_cb() when it has completed to restore.\n
+ * The Callback can receive error code when process is done.
  *
  * @see nfc_mifare_transfer()
+ * @see nfc_manager_initialize()
 */
 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.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  *
  * @param [in] target The handle to peer target
@@ -2085,114 +2570,73 @@ int nfc_mifare_restore(nfc_tag_h tag, int block_index, nfc_mifare_restore_comple
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  *
+ * @see nfc_p2p_set_data_received_cb()
  * @see nfc_p2p_unset_data_received_cb()
- * @see nfc_p2p_data_recived_cb()
  * @see nfc_p2p_target_discovered_cb()
+ * @see nfc_manager_initialize()
  */
-int nfc_p2p_set_data_received_cb(nfc_p2p_target_h target, nfc_p2p_data_recived_cb callback, void *user_data);
+int nfc_p2p_set_data_received_cb(nfc_p2p_target_h target, nfc_p2p_data_received_cb callback, void *user_data);
 
 /**
  * @brief Unregisters the callback function.
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  * @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_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  *
  * @see nfc_p2p_set_data_received_cb()
- * @see nfc_p2p_data_recived_cb()
+ * @see nfc_p2p_unset_data_received_cb()
  * @see nfc_p2p_target_discovered_cb()
+ * @see nfc_manager_initialize()
  */
 int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target);
 
 /**
  * @brief Sends data to NFC peer-to-peer target
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  *
- * @param [in] tag The handle to NFC tag
+ * @param [in] target The handle to peer target
  * @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_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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
+ * @post It invokes nfc_p2p_send_completed_cb() when it has completed to p2p send.\n
+ * The Callback can receive error code when process is done.
  *
  * @see nfc_p2p_send_completed_cb()
  * @see nfc_p2p_target_discovered_cb()
+ * @see nfc_manager_initialize()
 */
-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);
-
+int nfc_p2p_send(nfc_p2p_target_h target, nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data);
 
 /**
  * @brief Start peer-to-peer server using SNEP protocol
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  *
  * @param [in] target The handle to peer target
@@ -2203,18 +2647,27 @@ bool nfc_p2p_is_supported_ac_type( nfc_ac_type_e carrior);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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
  *
+ * @post It invokes nfc_snep_event_cb() when snep event is occured.\n
+ * The Callback can receive error code when process is done.
+ *
  * @see nfc_snep_event_cb()
+ * @see nfc_manager_initialize()
 */
 int nfc_snep_start_server(nfc_p2p_target_h target, const char *san, int sap, nfc_snep_event_cb callback, void *user_data);
 
 /**
  * @brief Start peer-to-peer client using SNEP protocol
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  *
  * @param [in] target The handle to peer target
@@ -2225,20 +2678,29 @@ int nfc_snep_start_server(nfc_p2p_target_h target, const char *san, int sap, nfc
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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
  *
+ * @post It invokes nfc_snep_event_cb() when snep event is occured.\n
+ * The Callback can receive error code when process is done.
+ *
  * @see nfc_snep_event_cb()
  * @see nfc_snep_send_client_request()
- * @see nfc_snep_stop_service
+ * @see nfc_snep_stop_service()
+ * @see nfc_manager_initialize()
 */
 int nfc_snep_start_client(nfc_p2p_target_h target, const char *san, int sap, nfc_snep_event_cb callback, void *user_data);
 
 /**
  * @brief Send request message to peer-to-peer client using SNEP protocol
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  *
  * @param [in] handle The handle to connected snep instance
@@ -2249,18 +2711,27 @@ int nfc_snep_start_client(nfc_p2p_target_h target, const char *san, int sap, nfc
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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
  *
+ * @post It invokes nfc_snep_event_cb() when snep event is occured.\n
+ * The Callback can receive error code when process is done.
+ *
  * @see nfc_snep_event_cb()
+ * @see nfc_manager_initialize()
 */
 int nfc_snep_send_client_request(nfc_p2p_snep_h handle, nfc_snep_type_e type, nfc_ndef_message_h msg, nfc_snep_event_cb callback, void *user_data);
 
 /**
  * @brief Stop snep server or client
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  *
  * @param [in] target The handle to peer target
@@ -2268,16 +2739,22 @@ int nfc_snep_send_client_request(nfc_p2p_snep_h handle, nfc_snep_type_e type, nf
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
  *
  * @see nfc_snep_event_cb()
+ * @see nfc_manager_initialize()
 */
 int nfc_snep_stop_service(nfc_p2p_target_h target, nfc_p2p_snep_h service);
 
 /**
  * @brief Register peer-to-peer server using SNEP protocol
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  *
  * @param [in] san The name of service (service access name)
@@ -2287,18 +2764,27 @@ int nfc_snep_stop_service(nfc_p2p_target_h target, nfc_p2p_snep_h service);
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @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
  *
+ * @post It invokes nfc_snep_event_cb() when snep event is occured.\n
+ * The Callback can receive error code when process is done.
+ *
  * @see nfc_snep_event_cb()
+ * @see nfc_manager_initialize()
 */
 int nfc_snep_register_server(const char *san, int sap, nfc_snep_event_cb callback, void *user_data);
 
 /**
  * @brief Unregister snep server or client
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc
  * @ingroup CAPI_NETWORK_NFC_P2P_MODULE
  *
  * @param [in] san The name of service (service access name)
@@ -2306,127 +2792,276 @@ int nfc_snep_register_server(const char *san, int sap, nfc_snep_event_cb callbac
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
  * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
  * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
  *
  * @see nfc_snep_event_cb()
+ * @see nfc_manager_initialize()
 */
 int nfc_snep_unregister_server(const char *san, int sap);
 
 /**
- * @brief Open connection to secure element.
- * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
- *
- * @param [in] se_type   The type you want to open
- * @param [out] handle    The handle of connected secure element
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #NFC_ERROR_NONE Successful
- * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
- * @retval #NFC_ERROR_INVALID_NDEF_MESSAGE Invalid NDEF message
- *
- * @see nfc_se_close_secure_element()
- */
-int nfc_se_open_secure_element(nfc_se_type_e se_type, nfc_se_h *handle);
-
-/**
  * @brief Enable card emulation mode.
- * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
+ * @remarks Security level can be determined by the manufacturer usage.\n
+ * If a security issue is occurred, contact with the manufacturer of the product.\n
+ * If you want to know about security level in detail, See the GSMA specification.\n
+ * (http://www.gsma.com/digitalcommerce/wp-content/uploads/2013/12/GSMA-NFC05-NFC-Handset-APIs-Requirement-Specification-version-4-1.pdf)
  *
  * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not intialized NFC
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #NFC_ERROR_PERMISSION_DENIED Security Restricted by SMACK
+ * @retval #NFC_ERROR_SECURITY_RESTRICTED Security Restricted
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
  *
  * @see nfc_se_disable_card_emulation()
+ * @see nfc_manager_initialize()
  */
 int nfc_se_enable_card_emulation();
 
 /**
  * @brief Disable card emulation mode.
- * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
+ * @remarks Security level can be determined by the manufacturer usage.\n
+ * If a security issue is occurred, contact with the manufacturer of the product.\n
+ * If you want to know about security level in detail, See the GSMA specification.\n
+ * (http://www.gsma.com/digitalcommerce/wp-content/uploads/2013/12/GSMA-NFC05-NFC-Handset-APIs-Requirement-Specification-version-4-1.pdf)
  *
  * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not intialized NFC
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #NFC_ERROR_PERMISSION_DENIED Security Restricted by SMACK
+ * @retval #NFC_ERROR_SECURITY_RESTRICTED Security Restricted
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
  *
  * @see nfc_se_enable_card_emulation()
+ * @see nfc_manager_initialize()
  */
 int nfc_se_disable_card_emulation();
 
 /**
  * @brief Get the current card emulation mode.
- * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
  *
  * @param [out]  type   The current card emulation mode type
  *
  * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not intialized NFC
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
  * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ * @retval #NFC_ERROR_PERMISSION_DENIED Security Restricted by SMACK
+ * @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
  *
+ * @see nfc_se_enable_card_emulation()
+ * @see nfc_se_disable_card_emulation()
+ * @see nfc_manager_initialize()
  */
 int nfc_se_get_card_emulation_mode(nfc_se_card_emulation_mode_type_e *type);
 
 /**
- * @brief Open connection to secure element.
- * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
- *
- * @remarks It gets the allocated bytes array including data. @a resp must be released with free() by you.
+ * @brief Send APDU(Application Protocol Data Unit) response to CLF(Contactless Front-end).
+ * @since_tizen 2.3.1
+ * @privlevel   public
+ * @privilege   %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
  *
  * @param [in]  handle   The handle of connected secure element
- * @param [in]  cmd      The bytes array of apdu command data
- * @param [in]  cmd_len  The size of apdu command bytes array
- * @param [out] resp     The bytes array of response data
- * @param [out] resp_len The size of response bytes array
+ * @param [in] resp     The bytes array of response data
+ * @param [in] resp_len The size of response bytes array
  *
- * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_ILLEGAL_STATE Illegal state
  * @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
+ * @retval #NFC_ERROR_PERMISSION_DENIED        Permission denied
  *
- * @see nfc_se_open_secure_element()
- * @see nfc_se_close_secure_element()
+ * @see nfc_manager_set_hce_event_cb()
+ * @see nfc_manager_unset_hce_event_cb()
+ * @see nfc_manager_initialize()
  */
-int nfc_se_send_apdu(nfc_se_h handle, unsigned char *cmd, unsigned int cmd_len, unsigned char **resp, unsigned int *resp_len);
+int nfc_hce_send_apdu_response(nfc_se_h handle, unsigned char *resp, unsigned int resp_len);
 
 /**
- * @brief Get ATR(Answer to Reset) of connected secure element.
- * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ * @brief Set the default route for each device status.
+ * @since_tizen 2.3.1
+ * @privlevel   public
+ * @privilege   %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
+ *
+ * @param [in] powered_on_status The type of default Secure Element when device is powered on
+ * @param [in] powered_off_status The type of default Secure Element when device is powered off
+ * @param [in] low_battery_status The type of default Secure Element when battery is low
+ *
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_ILLEGAL_STATE Illegal state
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_PERMISSION_DENIED        Permission denied
  *
- * @remarks It gets the allocated bytes array including data. @a atr must be released with free() by you.
+ * @see nfc_manager_initialize()
+ */
+int nfc_se_set_default_route(nfc_se_type_e powered_on_status, nfc_se_type_e powered_off_status, nfc_se_type_e low_battery_status);
+
+/**
+ * @brief Gets the state whether an application to call this api is currently the activated handler for specific AID.
+ * @since_tizen 2.3.1
+ * @privlevel   public
+ * @privilege   %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
  *
- * @param [in]  handle  The handle of connected secure element
- * @param [out] atr     The bytes array of atr data
- * @param [out] atr_len The size of atr bytes array
+ * @param [in] se_type The type of Secure Element
+ * @param [in] aid Application Id, specified in ISO/IEC 7816-4
+ * @param [out] is_activated_handler @c true when application is currently the activated handler, otherwise @c false
  *
- * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_ILLEGAL_STATE Illegal state
  * @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
+ * @retval #NFC_ERROR_PERMISSION_DENIED        Permission denied
  *
- * @see nfc_se_open_secure_element()
- * @see nfc_se_close_secure_element()
+ * @see nfc_manager_initialize()
  */
-int nfc_se_get_atr(nfc_se_h handle, unsigned char **atr, unsigned int *atr_len);
+int nfc_se_is_activated_handler_for_aid(nfc_se_type_e se_type, const char *aid, bool *is_activated_handler);
 
 /**
- * @brief Close connection to secure element.
- * @ingroup CAPI_NETWORK_NFC_NDEF_MESSAGE_MODULE
+ * @brief Gets the state whether an application to call this api is currently the activated handler for category.
+ * @since_tizen 2.3.1
+ * @privlevel   public
+ * @privilege   %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
  *
- * @param [in] handle   The handle of connected secure element
+ * @param [in] se_type The type of Secure Element
+ * @param [in] category The category
+ * @param [out] is_activated_handler @c true when application is currently the activated handler, otherwise @c false
  *
- * @return 0 on success, otherwise a negative error value.
  * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_ILLEGAL_STATE Illegal state
  * @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
+ * @retval #NFC_ERROR_PERMISSION_DENIED        Permission denied
  *
- * @see nfc_se_open_secure_element()
+ * @see nfc_manager_initialize()
  */
-int nfc_se_close_secure_element(nfc_se_h handle);
+int nfc_se_is_activated_handler_for_category(nfc_se_type_e se_type, nfc_card_emulation_category_type_e category, bool *is_activated_handler);
+
+/**
+ * @brief Registers a AID for a specific category.
+ * @since_tizen 2.3.1
+ * @privlevel   public
+ * @privilege   %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
+ *
+ * @param [in] se_type The type of Secure Element
+ * @param [in] category The category
+ * @param [in] aid Application Id, specified in ISO/IEC 7816-4
+ *
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_ILLEGAL_STATE Illegal state
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_AID_ALREADY_REGISTERED AID is already registered
+ * @retval #NFC_ERROR_PERMISSION_DENIED        Permission denied
+ *
+ * @see nfc_se_unregister_aid()
+ * @see nfc_manager_initialize()
+ */
+int nfc_se_register_aid(nfc_se_type_e se_type, nfc_card_emulation_category_type_e category, const char *aid);
+
+/**
+ * @brief Unregisters a previously registered AID for the specified category.
+ * @details You can unregister aid only you registered. If you try to release the aid what you are not registered, then the api return error.
+ * @since_tizen 2.3.1
+ * @privlevel   public
+ * @privilege   %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
+ *
+ * @param [in] se_type The type of Secure Element
+ * @param [in] category The category
+ * @param [in] aid Application Id, specified in ISO/IEC 7816-4
+ *
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_ILLEGAL_STATE Illegal state
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_PERMISSION_DENIED        Permission denied
+ *
+ * @see nfc_se_register_aid()
+ * @see nfc_manager_initialize()
+ */
+int nfc_se_unregister_aid(nfc_se_type_e se_type, nfc_card_emulation_category_type_e category, const char *aid);
+
+/**
+ * @brief Retrieves all registered AID.
+ * @details You can retrives aid only you registered. If you try to retrives the aid what you are not registered, then the api return error.
+ * @since_tizen 2.3.1
+ * @privlevel   public
+ * @privilege   %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
+ *
+ * @param [in] se_type The type of Secure Element
+ * @param [in] category The category
+ * @param [in] callback        The callback function to invoke
+ * @param [in] user_data The user data to be passed to the callback function
+ *
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_ILLEGAL_STATE Illegal state
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see nfc_manager_initialize()
+ *
+ */
+int nfc_se_foreach_registered_aids(nfc_se_type_e se_type, nfc_card_emulation_category_type_e category, nfc_se_registered_aid_cb callback, void *user_data);
 
 #ifdef __cplusplus
 }
 #endif
 
-
 #endif /* __NFC_H__ */
-
diff --git a/include/nfc_common.h b/include/nfc_common.h
new file mode 100644 (file)
index 0000000..23b1a99
--- /dev/null
@@ -0,0 +1,164 @@
+/*
+* 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_LOG_H__
+#define __NFC_LOG_H__
+
+#include <unistd.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <dlog.h>
+#include <vconf.h>
+#include <system_info.h>
+
+#include "net_nfc.h"
+#include "nfc.h"
+#include "nfc_internal.h"
+
+#define COLOR_RED              "\033[0;31m"
+#define COLOR_GREEN            "\033[0;32m"
+#define COLOR_BROWN            "\033[0;33m"
+#define COLOR_BLUE             "\033[0;34m"
+#define COLOR_PURPLE           "\033[0;35m"
+#define COLOR_CYAN             "\033[0;36m"
+#define COLOR_LIGHTBLUE                "\033[0;37m"
+#define COLOR_END              "\033[0;m"
+
+#define NFC_FEATURE "http://tizen.org/feature/network.nfc"
+#define NFC_TAG_FEATURE "http://tizen.org/feature/network.nfc"
+#define NFC_P2P_FEATURE "http://tizen.org/feature/network.nfc"
+#define NFC_CE_FEATURE "http://tizen.org/feature/network.nfc.card_emulation"
+#define NFC_CE_HCE_FEATURE "http://tizen.org/feature/network.nfc.card_emulation.hce"
+
+#define CHECK_INIT() \
+               do{\
+                       if(nfc_common_is_initialized() == false) \
+                       { \
+                               LOG_ERR("[ERROR][%s] NFC not initialized", __func__); \
+                               return NFC_ERROR_NOT_INITIALIZED; \
+                       } \
+               }while(0)
+
+#define CHECK_SUPPORTED(str) \
+               do{\
+                       if(nfc_common_is_supported(str) == false) \
+                       { \
+                               LOG_ERR("[ERROR][%s] NFC not supported", __func__); \
+                               return NFC_ERROR_NOT_SUPPORTED; \
+                       } \
+               }while(0)
+
+#define CHECK_ACTIVATED() \
+               do{\
+                       if (!nfc_manager_is_activated()) \
+                       { \
+                               LOG_ERR("[ERROR][%s] NFC not activated", __func__); \
+                               return NFC_ERROR_NOT_ACTIVATED; \
+                       } \
+               } while(0)
+
+#define CHECK_INVALID(expr) \
+               do{\
+                       if (expr) \
+                       { \
+                               LOG_ERR("[ERROR][%s] INVALID PARAMETER (%s)", __func__, #expr); \
+                               return NFC_ERROR_INVALID_PARAMETER; \
+                       } \
+               } while(0)
+
+#define CHECK_APP_PERMISSION() \
+               do{\
+                       if (nfc_common_check_app_permission() == false) \
+                       { \
+                               LOG_ERR("[ERROR][%s] Permission check fail", __func__); \
+                               return NFC_ERROR_SECURITY_RESTRICTED; \
+                       } \
+               } while(0)
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "NFC_CAPI"
+
+#define LOG_DEBUG(fmt, ...) \
+       do { \
+               LOGD(COLOR_BROWN" " fmt COLOR_END, ##__VA_ARGS__); \
+       } while (0)
+#define LOG_ERR(fmt, ...) \
+       do { \
+               LOGE(COLOR_RED" " fmt COLOR_END, ##__VA_ARGS__); \
+       } while (0)
+#define LOG_BEGIN() \
+       do { \
+               LOGD(COLOR_BLUE"BEGIN >>>>"COLOR_END); \
+       } while (0)
+#define LOG_END() \
+       do { \
+               LOGD(COLOR_BLUE"END <<<<"COLOR_END); \
+       } while (0)
+
+typedef struct
+{
+       bool                            initialized;
+       bool                            on_activation_doing;
+
+       net_nfc_target_info_h           current_tag;
+
+       //net_nfc_target_handle_s       current_target;
+       net_nfc_target_handle_h         current_target;
+
+       nfc_tag_discovered_cb           on_tag_discovered_cb;
+       void                            *on_tag_discovered_user_data;
+
+       nfc_ndef_discovered_cb          on_ndef_discovered_cb;
+       void                            *on_ndef_discovered_user_data;
+
+       nfc_p2p_target_discovered_cb    on_p2p_target_discovered_cb;
+       void                            *on_p2p_target_discovered_user_data;
+
+       nfc_p2p_data_received_cb                on_p2p_recv_cb;
+       void                            *on_p2p_recv_user_data;
+
+       nfc_se_event_cb                 on_se_event_cb;
+       void                            *on_se_event_user_data;
+
+       nfc_se_transaction_event_cb     on_se_transaction_event_cb;
+       void                            *on_se_transaction_event_user_data;
+
+       nfc_connection_handover_event_cb on_handover_event_cb;
+       void                            *on_handover_event_user_data;
+
+       nfc_hce_event_cb on_hce_event_cb;
+       void                            *on_hce_event_user_data;
+
+       nfc_se_registered_aid_cb on_se_registered_aid_cb;
+       void                            *on_se_registered_aid_cb_user_data;
+}
+_nfc_context_s;
+
+_nfc_context_s gdbus_nfc_context;
+
+pid_t nfc_common_get_focus_app_pid();
+char * nfc_common_get_bt_address_string(data_h data);
+bool nfc_common_check_app_permission();
+int nfc_common_convert_error_code(const char *func, int native_error_code);
+bool nfc_common_is_initialized();
+bool nfc_common_is_supported(char *str);
+int nfc_common_get_rawdata_size(nfc_ndef_message_h ndef_message, unsigned int *byte_size);
+
+#endif // __NFC_LOG_H__
old mode 100644 (file)
new mode 100755 (executable)
index 9ab6e87..22f7ce0
 /*
-* 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.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 
 #ifndef __NFC_INTERNAL_H__
 #define __NFC_INTERNAL_H__
 
-#include <net_nfc.h>
-
 #include "nfc.h"
 
-typedef struct
-{
-       bool initialized;
-       bool on_activation_doing;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Enumerations for Handover event
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ */
+typedef enum {
+    NFC_HANDOVER_EVENT_START = 0x00, /**< handover started */
+    NFC_HANDOVER_EVENT_FINISH = 0x01, /**< handover finished */
+} nfc_handover_event_e;
+
+/**
+ * @brief Enumerations for NFC AC(Alternative Carrier)
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_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 Enumerations for NFC AC(Alternative Carrier) state
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ */
+typedef enum {
+       NFC_AC_STATE_INACTIVATE = 0x00, /**< inactivate */
+       NFC_AC_STATE_ACTIVATE, /**<  activated */
+       NFC_AC_STATE_ACTIVATING,/**< now activating */
+       NFC_AC_STATE_UNKNOWN, /**< unknown */
+} nfc_ac_state_e ;
+
+typedef enum{
+       NFC_SE_POWER_MODE_SLEEP = 0x00, /**< sleep mode */
+       NFC_SE_POWER_MODE_ON = 0x01, /**< Power On */
+       NFC_SE_POWER_MODE_OFF = 0x02, /**< Power Off */
+} nfc_se_power_type_e;
+
+/**
+ * @brief The handle to the Connection Handover message
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ */
+typedef struct _net_nfc_ch_message_s *nfc_handover_message_h;
+
+/**
+ * @brief The handle to the Connection Handover carrier
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ */
+typedef struct _net_nfc_ch_carrier_s *nfc_handover_carrier_h;
+
+/**
+ * @brief The handle to the Connection Handover carrier configuration
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ */
+typedef struct _net_nfc_carrier_config_s *nfc_handover_config_h;
+
+/**
+ * @brief Called after nfc_p2p_connection_handover() has completed.
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_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 carrier, void *ac_data, int ac_data_size, void *user_data);
+
+
+/**
+ * @brief Called when connection handover is started or finished.
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @remark To use the @a address outside this function, copy the @a address.
+ * @remark @a address is NULL when is called by start event
+ *
+ * @param [in] result  The result of function call
+ * @param [in] event   The event type of current invocation
+ * @param [in] carrier The type of Alternative Carrier
+ * @param [in] address The unique id of connected remote device
+ * @param [in] msg     The original ndef message of current handover operation
+ * @param [in] user_data The user data passed from nfc_connection_handover_set_event_cb()
+ *
+ * @see nfc_connection_handover_set_event_cb()
+ * @see nfc_connection_handover_unset_event_cb()
+ */
+typedef void (*nfc_connection_handover_event_cb)(nfc_error_e result, nfc_handover_event_e event, nfc_ac_type_e carrier, char *address, nfc_ndef_message_h msg, void *user_data);
+
+
+/**
+ * @brief NFC Connection handover between NFC peer-to-peer target
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_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
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_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 carrier);
+
+/**
+ * @brief Registers a callback function for receiving event of connection handover.
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @param [in] callback The callback function to invoke when handover event occurs
+ * @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_connection_handover_unset_event_cb()
+ * @see nfc_connection_handover_event_cb()
+ */
+int nfc_connection_handover_set_event_cb(nfc_connection_handover_event_cb callback, void *user_data);
+
+
+/**
+ * @brief Unregisters the callback function
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ *
+ * @see nfc_connection_handover_set_event_cb()
+ * @see nfc_connection_handover_event_cb()
+ */
+int nfc_connection_handover_unset_event_cb(void);
+
+/**
+ * @brief create handover message instance from ndef message
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @remarks There is no relation or memory share between @a msg and @a result.
+ * @remarks After using handover message, @a result must be destroyed by nfc_handover_message_destroy()
+ *
+ * @param [out] result The instance of created handover message
+ * @param [in]  msg    The instance of source 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_handover_message_get_random_number()
+ * @see nfc_handover_message_get_carrier_count()
+ * @see nfc_handover_message_get_carrier()
+ * @see nfc_handover_message_get_carrier_by_type()
+ * @see nfc_handover_message_destroy()
+ */
+int nfc_handover_message_import_from_ndef_message(nfc_handover_message_h *result, nfc_ndef_message_h msg);
+
+/**
+ * @brief extract random number of handover message
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @param [in]  message The instance of handover message
+ * @param [out] random_number The random number of current message
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_message_import_from_ndef_message()
+ * @see nfc_handover_message_destroy()
+ */
+int nfc_handover_message_get_random_number(nfc_handover_message_h message, unsigned short *random_number);
+
+/**
+ * @brief get number of carriers in handover message
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @param [in]  message The instance of handover message
+ * @param [out] count The number of carriers in handover message
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_message_import_from_ndef_message()
+ * @see nfc_handover_message_destroy()
+ */
+int nfc_handover_message_get_carrier_count(nfc_handover_message_h message, unsigned int *count);
+
+/**
+ * @brief get instance of specific carrier in handover message by index
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @remarks Do not destroy carrier instance returned from this function. (It managed by handover message)
+
+ * @param [in]  message The instance of handover message
+ * @param [in]  index The index of specific carrier
+ * @param [out] carrier The instance of indexed carrier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_message_import_from_ndef_message()
+ * @see nfc_handover_message_destroy()
+ */
+int nfc_handover_message_get_carrier(nfc_handover_message_h message, int index, nfc_handover_carrier_h *carrier);
+
+/**
+ * @brief get instance of specific carrier in handover message by carrier type
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @remarks Do not destroy carrier instance returned from this function. (It managed by handover message)
+ *
+ * @param [in]  message The instance of handover message
+ * @param [in]  type The type of specific carrier
+ * @param [out] carrier The instance of indexed carrier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_message_import_from_ndef_message()
+ * @see nfc_handover_message_destroy()
+ */
+int nfc_handover_message_get_carrier_by_type(nfc_handover_message_h message, nfc_ac_type_e type, nfc_handover_carrier_h *carrier);
+
+/**
+ * @brief destroy handover message instance
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @param [in]  message The instance of handover message
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_message_import_from_ndef_message()
+ */
+int nfc_handover_message_destroy(nfc_handover_message_h message);
+
+/**
+ * @brief get CPS(Carrier Power Status) value of handover carrier
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @param [in]  carrier The instance of handover carrier
+ * @param [out] cps The CPS of handover carrier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_message_get_carrier()
+ * @see nfc_handover_message_get_carrier_by_type()
+ */
+int nfc_handover_carrier_get_cps(nfc_handover_carrier_h carrier, nfc_ac_state_e *cps);
+
+/**
+ * @brief get type of handover carrier
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @param [in]  carrier The instance of handover carrier
+ * @param [out] type The type of handover carrier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_message_get_carrier()
+ * @see nfc_handover_message_get_carrier_by_type()
+ */
+
+int nfc_handover_carrier_get_type(nfc_handover_carrier_h carrier, nfc_ac_type_e *type);
+/**
+ * @brief get carrier record of handover carrier
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @remarks Do not destroy ndef record instance returned from this function. (It managed by handover carrier)
+ *
+ * @param [in]  carrier The instance of handover carrier
+ * @param [out] record The ndef record of current handover carrier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_message_get_carrier()
+ * @see nfc_handover_message_get_carrier_by_type()
+ */
+int nfc_handover_carrier_get_carrier_record(nfc_handover_carrier_h carrier, nfc_ndef_record_h *record);
+
+/**
+ * @brief get number of auxiliary records in handover carrier
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @param [in]  carrier The instance of handover carrier
+ * @param [out] count The number of auxiliary records in handover carrier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_message_get_carrier()
+ * @see nfc_handover_message_get_carrier_by_type()
+ */
+int nfc_handover_carrier_get_auxiliary_record_count(nfc_handover_carrier_h carrier, unsigned int *count);
+
+/**
+ * @brief get specific auxiliary record in handover carrier by index
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @remarks Do not destroy ndef record instance returned from this function. (It managed by handover carrier)
+ *
+ * @param [in]  carrier The instance of handover carrier
+ * @param [in]  index The index of specific record
+ * @param [out] record The ndef record of current handover carrier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_message_get_carrier()
+ * @see nfc_handover_message_get_carrier_by_type()
+ */
+int nfc_handover_carrier_get_auxiliary_record(nfc_handover_carrier_h carrier, int index, nfc_ndef_record_h *record);
+
+/**
+ * @brief get instance of handover configuration from handover carrier
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @remarks There is no relation or memory share between @a carrier and @a config.
+ * @remarks After using handover config, @a config must be destroyed by nfc_handover_config_destroy()
+ *
+ * @param [in]  carrier The instance of handover carrier
+ * @param [out] config The instance of handover config
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_message_get_carrier()
+ * @see nfc_handover_message_get_carrier_by_type()
+ * @see nfc_handover_config_destroy()
+ */
+int nfc_handover_carrier_get_handover_config(nfc_handover_carrier_h carrier, nfc_handover_config_h *config);
+
+/**
+ * @brief destroy handover carrier instance
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @param [in]  carrier The instance of handover carrier
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_carrier_duplicate()
+ */
+int nfc_handover_carrier_destroy(nfc_handover_carrier_h carrier);
+
+/**
+ * @brief get attribute property from handover configuration
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @remarks Do not destroy @a data returned from this function. (It managed by handover config)
+ *
+ * @param [in]  config The instance of handover config
+ * @param [in]  attribute The id of specific attribute
+ * @param [out] size The length of returned buffer
+ * @param [out] data The data buffer of specific attribute
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_message_get_carrier()
+ * @see nfc_handover_message_get_carrier_by_type()
+ */
+int nfc_handover_config_get_property(nfc_handover_config_h config, unsigned short attribute, unsigned short *size, unsigned char **data);
+
+/**
+ * @brief destroy handover config instance
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_HANDOVER_MODULE
+ *
+ * @param [in]  config The instance of handover config
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_handover_carrier_get_handover_config()
+ */
+int nfc_handover_config_destroy(nfc_handover_config_h config);
+
+int nfc_manager_set_system_handler_enable_force(bool enable);
+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);
 
-       net_nfc_target_info_s *current_tag;
-       net_nfc_target_handle_s *current_target;
+int nfc_se_open_secure_element_internal(nfc_se_type_e se_type, nfc_se_h *handle);
+int nfc_se_send_apdu_internal(nfc_se_h handle, unsigned char *cmd, unsigned int cmd_len, unsigned char **resp, unsigned int *resp_len);
+int nfc_se_close_secure_element_internal(nfc_se_h handle);
+int nfc_se_get_atr_internal(nfc_se_h handle, unsigned char **atr, unsigned int *atr_len);
 
-       nfc_tag_discovered_cb on_tag_discovered_cb;
-       void *on_tag_discovered_user_data;
+/**
+ * @brief Add a route for the specific AID.
+ * @since_tizen 2.3.0.1
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
+ *
+ * @param [in] aid The AID
+ * @param [in] se_type The type of Secure Element
+ * @param [in] pkg_name The package name
+ * @param [in] unlock_required @c true when enabling routing only in device unlock state, otherwise @c false
+ * @param [in] power The device power state
+ * @param [in] category The category which the AID associated with
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_PERMISSION_DENIED        Permission denied
+ *
+ * @see nfc_se_remove_route_for_aid()
+ */
+int nfc_se_add_route_for_aid_internal(const char *aid, nfc_se_type_e se_type, const char* pkg_name, bool unlock_required, nfc_se_power_type_e power, nfc_card_emulation_category_type_e category);
 
-       nfc_ndef_discovered_cb on_ndef_discovered_cb;
-       void *on_ndef_discovered_user_data;
+/**
+ * @brief Remove a route for the specific AID.
+ * @since_tizen 2.3.0.1
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
+ *
+ * @param [in] pkg_name The package name
+ * @param [in] aid The AID
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_INVALID_PARAMETER        Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #NFC_ERROR_PERMISSION_DENIED        Permission denied
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation failed
+ *
+ * @see nfc_se_add_route_for_aid()
+ */
+int nfc_se_remove_route_for_aid_internal(const char* pkg_name, const char *aid);
 
-       nfc_p2p_target_discovered_cb on_p2p_target_discovered_cb;
-       void *on_p2p_target_discovered_user_data;
+/**
+ * @brief Initializes NFC Manager.
+ * @since_tizen 2.3
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ * @remarks This function must be called before proceeding any other nfc functions\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_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_OPERATION_FAILED Operation fail
+ *
+ * @see nfc_manager_deinitialize()
+ */
+int nfc_manager_initialize_sync(void);
 
-       nfc_p2p_data_recived_cb on_p2p_recv_cb;
-       void *on_p2p_recv_user_data;
+/**
+ * @brief Get number of all registered AID.
+ * @since_tizen 2.4
+ * @privlevel public
+ * @privilege   %http://tizen.org/privilege/nfc.cardemulation
+ * @ingroup CAPI_NETWORK_NFC_SE_MODULE
+ *
+ * @remarks You can get number of aids only you registered.
+ *
+ * @param [in] se_type The type of Secure Element
+ * @param [in] category The category
+ * @param [out] count Number of registered aids
+ *
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_NOT_SUPPORTED Not supported NFC
+ * @retval #NFC_ERROR_NOT_INITIALIZED Not initialized NFC
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_ILLEGAL_STATE Illegal state
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
+ *
+ * @see nfc_se_register_aid()
+ * @see nfc_se_unregister_aid()
+ * @see nfc_se_foreach_registered_aids()
+ *
+ */
+int nfc_se_get_registered_aids_count(nfc_se_type_e se_type, nfc_card_emulation_category_type_e category, int *count);
 
-       nfc_se_transaction_event_cb on_se_transaction_event_cb;
-       void *on_se_transaction_event_user_data;
 
-       nfc_se_event_cb                         on_se_event_cb;
-       void                            *on_se_event_user_data;
+#ifdef __cplusplus
 }
-_nfc_context_s;
+#endif
 
-#endif // _NFC_INTERNAL_H__
+#endif /* __NFC_INTERNAL_H__ */
diff --git a/include/nfc_private.h b/include/nfc_private.h
deleted file mode 100755 (executable)
index cf082ce..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#ifndef __NFC_PRIVATE_H__
-#define __NFC_PRIVATE_H__
-#include <net_nfc.h>
-#include <net_nfc_typedef_private.h>
-
-#include "nfc.h"
-
-
-typedef enum {
-       _NFC_CALLBACK_TYPE_RESULT=0,
-       _NFC_CALLBACK_TYPE_DATA=1,
-} _nfc_callback_type;
-
-
-typedef struct {
-       bool initialized;
-
-       nfc_tag_discovered_cb                   on_tag_discovered_cb;
-       void *                                          on_tag_discovered_user_data;
-       nfc_ndef_discovered_cb          on_ndef_discovered_cb;
-       void *                                          on_ndef_discovered_user_data;
-       net_nfc_target_info_s                   *current_tag;
-
-       //net_nfc_target_handle_s               current_target;
-       net_nfc_target_handle_h         current_target;
-
-       nfc_p2p_target_discovered_cb    on_p2p_discovered_cb;
-       void *                                          on_p2p_discovered_user_data;
-
-       nfc_se_event_cb                         on_se_event_cb;
-       void *                                          on_se_event_user_data;
-
-       nfc_p2p_send_completed_cb       on_p2p_send_completed_cb;
-       void *                                          on_p2p_send_completed_user_data;
-
-       nfc_p2p_data_recived_cb         on_p2p_recv_cb;
-       void *                                          on_p2p_recv_user_data;
-
-       nfc_p2p_connection_handover_completed_cb                on_p2p_connection_handover_completed_cb;
-       void *                                                                          on_p2p_connection_handover_completed_user_data;
-
-       nfc_initialize_completed_cb             on_initialize_completed_cb;
-
-       //nfc_se_transaction_event_cb           on_se_transaction_event_cb;
-       //void *                                                on_se_transaction_event_user_data;
-
-       nfc_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 b/packaging/capi-network-nfc
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/packaging/capi-network-nfc.manifest b/packaging/capi-network-nfc.manifest
deleted file mode 100644 (file)
index 017d22d..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<manifest>
- <request>
-    <domain name="_"/>
- </request>
-</manifest>
index 56fd156..de0215e 100644 (file)
@@ -1,38 +1,27 @@
-%bcond_with x
-%bcond_with neard_nfc
-
 Name:       capi-network-nfc
-Summary:    NFC Core API
-Version:    0.1.5
+Summary:    A NFC library in Native API
+Version:    0.2.0
 Release:    0
 Group:      Network & Connectivity/NFC
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
-Source1001:    %{name}.manifest
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(gobject-2.0)
-%if %{with neard_nfc}
-BuildRequires:  nfc-client-lib-neard-devel
-BuildRequires:  nfc-common-neard-devel
-%else
 BuildRequires:  nfc-client-lib-devel
-BuildRequires:  nfc-common-devel
-%endif
 BuildRequires:  pkgconfig(capi-base-common)
 BuildRequires:  pkgconfig(vconf)
-%if %{with x}
-BuildRequires:  pkgconfig(ecore-x)
-%endif
+BuildRequires:  pkgconfig(capi-system-info)
+
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
 %description
-A library for Tizen NFC Core API.
+A library for Tizen NFC Native API.
 
 %package devel
-Summary:  NFC Core API (devel)
+Summary:  A NFC library in Native API (Development)
 Group:    Network & Connectivity/Development
 Requires: %{name} = %{version}-%{release}
 
@@ -42,21 +31,23 @@ This package contains the development files for %{name}.
 
 %prep
 %setup -q
-cp %{SOURCE1001} .
 
 
 %build
+export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
+export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
+export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
+
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
-%if %{with x}
-         -DX11_SUPPORT=On
-%else
-         -DX11_SUPPORT=Off
-%endif
+cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DCMAKE_LIB_DIR=%{_libdir}
 
 make %{?jobs:-j%jobs}
 
 %install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/usr/share/license
+cp -af %{_builddir}/%{name}-%{version}/packaging/capi-network-nfc %{buildroot}/usr/share/license/
+
 %make_install
 
 %post -p /sbin/ldconfig
@@ -65,12 +56,11 @@ make %{?jobs:-j%jobs}
 
 
 %files
-%manifest %{name}.manifest
-%{_libdir}/libcapi-network-nfc.so.*
-%license LICENSE.APLv2
+%manifest capi-network-nfc.manifest
+%{_libdir}/libcapi-network-nfc.so*
+/usr/share/license/capi-network-nfc
 
 %files devel
-%manifest %{name}.manifest
 %{_includedir}/network/*.h
 %{_libdir}/pkgconfig/*.pc
 %{_libdir}/libcapi-network-nfc.so
diff --git a/src/nfc.c b/src/nfc.c
deleted file mode 100755 (executable)
index 4d2d3e0..0000000
--- a/src/nfc.c
+++ /dev/null
@@ -1,3133 +0,0 @@
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <unistd.h>
-#include <glib.h>
-#include <gio/gio.h>
-
-#include <vconf.h>
-#ifdef HAVE_X11
-#include <Ecore_X.h>
-#endif
-#include <net_nfc_typedef_internal.h>
-
-#include "nfc_internal.h"
-
-#define LOG_TAG "CAPI_NETWORK_NFC"
-#include <dlog.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' };
-
-
-static _nfc_context_s gdbus_nfc_context;
-
-/********************************Utility functions***********************/
-
-static pid_t _get_focus_app_pid()
-{
-#ifdef HAVE_X11
-       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;
-
-#endif
-       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());
-
-       LOGD("[check app permission] focus_app_pid [%d], current_app_pid [%d]",
-                       focus_app_pid, current_app_pid);
-
-#ifdef HAVE_X11
-       if (-1 == current_app_pid)
-               return false;
-       else
-               return (focus_app_pid == current_app_pid) ? true : false;
-#endif
-
-       return true;
-}
-
-static int _return_invalid_param(const char *func)
-{
-       LOGE("INVALID_PARAMETER : %s", func);
-
-       return NFC_ERROR_INVALID_PARAMETER;
-}
-
-static int _convert_error_code(const char *func, int native_error_code)
-{
-       int error_code = NFC_ERROR_NONE;
-       char *errorstr = NULL;
-
-       switch (native_error_code)
-       {
-       case NET_NFC_OK:
-               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_NOT_CONNECTED:
-               error_code = NFC_ERROR_NO_DEVICE;
-               errorstr = "NO_DEVICE";
-               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_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 bool _is_initialized()
-{
-       return gdbus_nfc_context.initialized;
-}
-
-/**********************Activate/DeActivate*****************/
-
-bool nfc_manager_is_supported(void)
-{
-       int nfc_supported = 0;
-
-       net_nfc_client_is_nfc_supported(&nfc_supported);
-
-       return (!!nfc_supported);
-}
-
-static void _activation_changed(net_nfc_error_e result, void *user_data)
-{
-       nfc_activation_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result), user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_manager_set_activation(bool activation,
-               nfc_activation_completed_cb callback,
-               void *user_data)
-{
-       int ret;
-       int nfc_supported = 0;
-#if 0
-       unsigned int state;
-#endif
-       ret = net_nfc_client_is_nfc_supported(&nfc_supported);
-       if (ret != NET_NFC_OK || nfc_supported == false)
-       {
-               LOGE("NFC not supported");
-
-               return NFC_ERROR_NOT_SUPPORTED;
-       }
-#if 0
-       ret = net_nfc_client_manager_get_server_state_sync(&state);
-       if (ret == NFC_ERROR_NONE && state != 0)
-       {
-               LOGE("nfc_manager_check_activation BUSY!!!!!");
-
-               return NFC_ERROR_DEVICE_BUSY;
-       }
-#endif
-       if (nfc_manager_is_activated() == activation)
-       {
-               if (activation)
-               {
-                       ret = NFC_ERROR_ALREADY_ACTIVATED;
-               }
-               else
-               {
-                       ret = NFC_ERROR_ALREADY_DEACTIVATED;
-               }
-       }
-       else
-       {
-               GVariant *parameter;
-
-               parameter = g_variant_new("(uu)", callback, user_data);
-               if (parameter != NULL)
-               {
-                       ret = net_nfc_client_manager_set_active(activation,
-                                       _activation_changed,
-                                       parameter);
-                       if (ret != NET_NFC_OK)
-                       {
-                               LOGE("net_nfc_client_manager_set_active fail");
-
-                               g_variant_unref(parameter);
-                       }
-               }
-               else
-               {
-                       ret = NET_NFC_ALLOC_FAIL;
-               }
-
-               ret = _convert_error_code(__func__, ret);
-       }
-
-       return ret;
-}
-
-bool nfc_manager_is_activated(void)
-{
-       int activated = 0;
-
-       net_nfc_client_get_nfc_state(&activated);
-
-       return (!!activated);
-}
-
-int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback,
-               void *user_data)
-{
-       if (callback == NULL)
-               return _return_invalid_param(__func__);
-
-       net_nfc_client_manager_set_activated(callback, user_data);
-
-       return NFC_ERROR_NONE;
-}
-
-void nfc_manager_unset_activation_changed_cb(void)
-{
-       net_nfc_client_manager_unset_activated();
-}
-
-#if 0
-void _net_nfc_manager_get_current_target_handle_(
-               net_nfc_error_e result,
-               net_nfc_target_handle_s *handle,
-               void *user_data)
-{
-       gdbus_nfc_context.current_target =(net_nfc_target_handle_s*) handle;
-
-       nfc_initialize_completed_cb cb =
-               gdbus_nfc_context.on_initialize_completed_cb;
-       gdbus_nfc_context.on_initialize_completed_cb = NULL;
-       if( cb )
-       {
-               cb( result, user_data );
-       }
-
-}
-
-void _net_nfc_manager_get_current_tag_info_(
-               net_nfc_error_e result,
-               net_nfc_target_info_s *info,
-               void *user_data)
-{
-       if (info != NULL)
-       {
-               if (gdbus_nfc_context.current_tag != NULL)
-               {
-                       net_nfc_release_tag_info(gdbus_nfc_context.current_tag);
-                       gdbus_nfc_context.current_tag = NULL;
-               }
-
-               net_nfc_duplicate_target_info(info, &gdbus_nfc_context.current_tag);
-       }
-
-       nfc_initialize_completed_cb cb =
-               gdbus_nfc_context.on_initialize_completed_cb;
-       gdbus_nfc_context.on_initialize_completed_cb = NULL;
-       if (cb)
-       {
-               cb(result, user_data);
-       }
-}
-
-
-void _net_nfc_manager_tag_connected_cb(
-               net_nfc_error_e result,
-               net_nfc_target_type_e dev_type,
-               void *user_data)
-{
-       net_nfc_target_type_e  devType = dev_type;
-       int capi_result;
-
-       if( (devType == NET_NFC_NFCIP1_TARGET )||
-                       (devType == NET_NFC_NFCIP1_INITIATOR ))
-       {
-               net_nfc_client_tag_get_current_target_handle(
-                               _net_nfc_manager_get_current_target_handle_,
-                               user_data);
-       }
-       else if( (devType > NET_NFC_UNKNOWN_TARGET )&&
-                       (devType < NET_NFC_NFCIP1_TARGET ))
-       {
-               net_nfc_client_tag_get_current_tag_info(
-                               _net_nfc_manager_get_current_tag_info_,
-                               user_data);
-       }
-       else
-       {
-               if (result == NET_NFC_NOT_CONNECTED)
-               {
-                       capi_result = NFC_ERROR_NONE;
-               }
-
-               if( gdbus_nfc_context.on_initialize_completed_cb )
-               {
-                       nfc_initialize_completed_cb cb =
-                               gdbus_nfc_context.on_initialize_completed_cb;
-                       gdbus_nfc_context.on_initialize_completed_cb = NULL;
-                       cb( capi_result,user_data );
-               }
-       }
-}
-#endif
-
-static void _nfc_manager_tag_discovered_cb(net_nfc_target_info_s *info,
-               void *user_data)
-{
-       gdbus_nfc_context.current_tag = info;
-
-       if (gdbus_nfc_context.on_tag_discovered_cb != NULL) {
-               gdbus_nfc_context.on_tag_discovered_cb(
-                               NFC_DISCOVERED_TYPE_ATTACHED,
-                               gdbus_nfc_context.current_tag,
-                               gdbus_nfc_context.on_tag_discovered_user_data);
-       }
-
-       /* ndef discovered cb */
-       if (gdbus_nfc_context.on_ndef_discovered_cb &&
-                       info->raw_data.buffer != NULL)
-       {
-               ndef_message_s *ndef_message;
-
-               net_nfc_create_ndef_message_from_rawdata(&ndef_message, &(info->raw_data));
-
-               gdbus_nfc_context.on_ndef_discovered_cb(ndef_message,
-                               gdbus_nfc_context.on_ndef_discovered_user_data);
-
-               net_nfc_free_ndef_message(ndef_message);
-       }
-}
-
-static void _nfc_manager_tag_detached_cb(void *user_data)
-{
-       if (gdbus_nfc_context.on_tag_discovered_cb != NULL) {
-               gdbus_nfc_context.on_tag_discovered_cb(
-                               NFC_DISCOVERED_TYPE_DETACHED,
-                               gdbus_nfc_context.current_tag,
-                               gdbus_nfc_context.on_tag_discovered_user_data);
-       }
-
-       gdbus_nfc_context.current_tag = NULL;
-}
-static void _p2p_target_discovered_cb(
-               net_nfc_target_handle_s *handle_info,
-               void *user_data)
-{
-       gdbus_nfc_context.current_target = handle_info;
-
-       if (gdbus_nfc_context.on_p2p_target_discovered_cb != NULL) {
-               gdbus_nfc_context.on_p2p_target_discovered_cb(
-                               NFC_DISCOVERED_TYPE_ATTACHED,
-                               (nfc_p2p_target_h)gdbus_nfc_context.current_target,
-                               gdbus_nfc_context.on_p2p_target_discovered_user_data);
-       }
-}
-
-static void _p2p_device_detached(void *user_data)
-{
-       nfc_p2p_target_h handle = (nfc_p2p_target_h)gdbus_nfc_context.current_target;
-
-       if (gdbus_nfc_context.on_p2p_target_discovered_cb != NULL) {
-               gdbus_nfc_context.on_p2p_target_discovered_cb(
-                               NFC_DISCOVERED_TYPE_DETACHED,
-                               handle,
-                               gdbus_nfc_context.on_p2p_target_discovered_user_data);
-       }
-
-       /* unset data_received callback */
-       nfc_p2p_unset_data_received_cb(handle);
-
-       gdbus_nfc_context.current_target = NULL;
-}
-
-static void _se_event_cb(net_nfc_message_e message, void *user_data)
-{
-       if (gdbus_nfc_context.on_se_event_cb != NULL) {
-               if(message == NET_NFC_MESSAGE_SE_CARD_EMULATION_CHANGED)
-                       gdbus_nfc_context.on_se_event_cb(
-                               NFC_SE_EVENT_CARD_EMULATION_CHANGED,
-                               gdbus_nfc_context.on_se_event_user_data);
-
-               else if(message == NET_NFC_MESSAGE_SE_TYPE_CHANGED)
-                       gdbus_nfc_context.on_se_event_cb(
-                               NFC_SE_EVENT_SE_TYPE_CHANGED,
-                               gdbus_nfc_context.on_se_event_user_data);
-       }
-}
-
-/* deprecated */
-static gboolean _initialize_cb(gpointer user_data)
-{
-       nfc_initialize_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL)
-               return false;
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(NFC_ERROR_NONE, user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-
-       return false;
-}
-
-int nfc_manager_initialize(nfc_initialize_completed_cb callback, void *user_data)
-{
-       int ret;
-       int nfc_supported = 0;
-
-       net_nfc_client_is_nfc_supported(&nfc_supported);
-       if (!nfc_supported)
-       {
-               LOGE("NFC_ERROR_NOT_SUPPORTED");
-
-               return NFC_ERROR_NOT_SUPPORTED;
-       }
-
-       if (!_is_initialized())
-       {
-               ret = net_nfc_client_initialize();
-               if (ret != NET_NFC_OK)
-                       return _convert_error_code(__func__, ret);
-
-               memset(&gdbus_nfc_context, 0, sizeof(gdbus_nfc_context));
-
-               gdbus_nfc_context.initialized = true;
-
-               net_nfc_client_tag_set_tag_detached(_nfc_manager_tag_detached_cb, NULL);
-               net_nfc_client_tag_set_tag_discovered(_nfc_manager_tag_discovered_cb, NULL);
-
-               net_nfc_client_p2p_set_device_discovered(_p2p_target_discovered_cb, NULL);
-
-               net_nfc_client_p2p_set_device_detached(_p2p_device_detached, NULL);
-               net_nfc_client_se_set_event_cb(_se_event_cb, NULL);
-
-               /* invoke callback if it needs */
-               if (callback != NULL) {
-                       g_main_context_invoke(NULL,
-                                       _initialize_cb,
-                                       g_variant_new("(uu)", callback, user_data));
-               }
-#if 0
-               gdbus_nfc_context.on_initialize_completed_cb = callback;
-
-               ret = net_nfc_client_tag_is_tag_connected(
-                               _net_nfc_manager_tag_connected_cb,
-                               user_data);
-
-               if( ret != NET_NFC_OK )
-                       return _convert_error_code(__func__, ret);
-#endif
-       }
-
-       return NFC_ERROR_NONE;
-}
-
-int nfc_manager_initialize_sync()
-{
-       int ret;
-       int nfc_supported = 0;
-
-       net_nfc_client_is_nfc_supported(&nfc_supported);
-       if (!nfc_supported)
-       {
-               LOGE("NFC_ERROR_NOT_SUPPORTED");
-
-               return NFC_ERROR_NOT_SUPPORTED;
-       }
-
-       if (!_is_initialized())
-       {
-#if 0
-               net_nfc_target_type_e devType;
-#endif
-               memset(&gdbus_nfc_context, 0, sizeof(gdbus_nfc_context));
-
-               ret = net_nfc_client_initialize();
-               if (ret != NET_NFC_OK)
-                       return _convert_error_code(__func__, ret);
-
-               gdbus_nfc_context.initialized = true;
-
-               net_nfc_client_tag_set_tag_detached(_nfc_manager_tag_detached_cb, NULL);
-               net_nfc_client_tag_set_tag_discovered(_nfc_manager_tag_discovered_cb, NULL);
-
-               net_nfc_client_p2p_set_device_discovered(_p2p_target_discovered_cb, NULL);
-
-               net_nfc_client_p2p_set_device_detached(_p2p_device_detached, NULL);
-               net_nfc_client_se_set_event_cb(_se_event_cb, NULL);
-#if 0
-               ret = net_nfc_client_tag_is_tag_connected_sync(&devType);
-               if (ret == NET_NFC_OK)
-               {
-                       if ((devType == NET_NFC_NFCIP1_TARGET) ||
-                                       (devType == NET_NFC_NFCIP1_INITIATOR))
-                       {
-                               net_nfc_client_tag_get_current_target_handle_sync(
-                                               &gdbus_nfc_context.current_target);
-                       }
-                       else if ((devType > NET_NFC_UNKNOWN_TARGET) &&
-                                       (devType < NET_NFC_NFCIP1_TARGET))
-                       {
-                               if (gdbus_nfc_context.current_tag != NULL)
-                               {
-                                       net_nfc_release_tag_info(gdbus_nfc_context.current_tag);
-                                       gdbus_nfc_context.current_tag = NULL;
-                               }
-
-                               net_nfc_client_tag_get_current_tag_info_sync(
-                                               &gdbus_nfc_context.current_tag);
-                       }
-               }
-               else
-               {
-                       if (ret == NET_NFC_NOT_CONNECTED)
-                       {
-                               ret = NFC_ERROR_NONE;
-                       }
-               }
-
-               if (ret != NET_NFC_OK)
-                       return _convert_error_code(__func__, ret);
-#endif
-       }
-
-       return NFC_ERROR_NONE;
-}
-
-int nfc_manager_deinitialize (void)
-{
-       int ret = NET_NFC_OK;
-
-       if (_is_initialized())
-       {
-               net_nfc_client_p2p_unset_device_discovered();
-               net_nfc_client_p2p_unset_device_detached();
-
-               net_nfc_client_tag_unset_tag_discovered();
-               net_nfc_client_tag_unset_tag_detached();
-
-               ret = net_nfc_client_deinitialize();
-
-               gdbus_nfc_context.initialized = false;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-/*********************** NDEF Functions*********************/
-
-int nfc_manager_set_ndef_discovered_cb(nfc_ndef_discovered_cb callback,
-               void *user_data)
-{
-       if (callback == NULL)
-               return _return_invalid_param(__func__);
-
-       gdbus_nfc_context.on_ndef_discovered_cb = callback;
-       gdbus_nfc_context.on_ndef_discovered_user_data = user_data;
-
-       return NFC_ERROR_NONE;
-}
-
-void nfc_manager_unset_ndef_discovered_cb(void)
-{
-       gdbus_nfc_context.on_ndef_discovered_cb = NULL;
-       gdbus_nfc_context.on_ndef_discovered_user_data = NULL;
-}
-
-void nfc_manager_set_tag_filter(int filter)
-{
-       net_nfc_client_tag_set_filter(filter);
-}
-
-int nfc_manager_get_tag_filter(void)
-{
-       return net_nfc_client_tag_get_filter();
-}
-
-static void _net_nfc_manager_tag_format_ndef_cb(net_nfc_error_e result,
-               void *user_data)
-{
-       nfc_tag_format_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result),
-                               user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_tag_format_ndef(nfc_tag_h tag, unsigned char *key, int key_size,
-               nfc_tag_format_completed_cb callback, void *user_data)
-{
-       int ret;
-       data_s key_data = { key, key_size };
-       GVariant *parameter;
-
-       if (tag == NULL)
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       if (_check_app_permission() == false)
-       {
-               LOGE("permission check fail");
-
-               return NFC_ERROR_SECURITY_RESTRICTED;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_ndef_format(
-                               tag->handle,
-                               &key_data,
-                               _net_nfc_manager_tag_format_ndef_cb,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-static void _net_nfc_manager_tag_read_ndef_cb(net_nfc_error_e result,
-               ndef_message_s *message, void *user_data)
-{
-       nfc_tag_read_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result), message, user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_tag_read_ndef(nfc_tag_h tag, nfc_tag_read_completed_cb callback,
-               void *user_data)
-{
-       int ret;
-       GVariant *parameter;
-
-       if (tag == NULL)
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_ndef_read(
-                               tag->handle,
-                               _net_nfc_manager_tag_read_ndef_cb,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_message_get_rawdata_size(nfc_ndef_message_h ndef_message,
-               unsigned int *byte_size)
-{
-       int ret;
-
-       if (ndef_message == NULL || byte_size == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_get_ndef_message_byte_length(ndef_message,
-                       (unsigned int *)byte_size);
-
-       return _convert_error_code(__func__, ret);
-}
-
-static void _net_nfc_manager_tag_write_ndef_cb(net_nfc_error_e result,
-               void *user_data)
-{
-       nfc_tag_write_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result), user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_tag_write_ndef(nfc_tag_h tag, nfc_ndef_message_h msg,
-               nfc_tag_write_completed_cb callback, void *user_data)
-{
-       int ret;
-       unsigned int byte_size = 0;
-       GVariant *parameter;
-
-       if (tag == 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->ndefCardState == NET_NFC_NDEF_CARD_READ_ONLY) {
-               return NFC_ERROR_READ_ONLY_NDEF;
-       }
-
-       nfc_ndef_message_get_rawdata_size(msg, &byte_size);
-       if (tag->maxDataSize < byte_size) {
-               return NFC_ERROR_NO_SPACE_ON_NDEF;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_ndef_write(
-                               tag->handle,
-                               msg,
-                               _net_nfc_manager_tag_write_ndef_cb,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, 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)
-{
-       int ret;
-       data_s type_data = { (unsigned char *)type, type_size };
-       data_s id_data = { (unsigned char *)id, id_size };
-       data_s payload_data = { (unsigned char *)payload, payload_size };
-
-       if (record == NULL || type == NULL || type_size <= 0)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_create_record(record, tnf, &type_data, &id_data, &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(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(record, uri, NET_NFC_SCHEMA_FULL_URI);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_record_create_mime(nfc_ndef_record_h *record, const char *mime_type,
-               const unsigned char *data, int data_size)
-{
-       int ret;
-
-       if (record == NULL || mime_type == NULL ||
-                       data == NULL || data_size <= 0)
-               return _return_invalid_param(__func__);
-
-       ret = nfc_ndef_record_create(record,
-                       NFC_RECORD_TNF_MIME_MEDIA,
-                       (unsigned char *)mime_type,
-                       strlen(mime_type),
-                       NULL,
-                       0,
-                       data,
-                       data_size);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_record_get_mime_type(nfc_ndef_record_h record, char **mime_type)
-{
-       int ret;
-       nfc_record_tnf_e tnf;
-       unsigned char *typename;
-       int length;
-
-       if (record == NULL || mime_type == NULL)
-               return _return_invalid_param(__func__);
-
-       if (nfc_ndef_record_get_tnf(record, &tnf) != NET_NFC_OK ||
-                       tnf != NFC_RECORD_TNF_MIME_MEDIA)
-       {
-               return NFC_ERROR_INVALID_RECORD_TYPE;
-       }
-
-       ret = nfc_ndef_record_get_type(record, &typename, &length);
-       if (ret == NET_NFC_OK) {
-               *mime_type = calloc(1, length + 1);
-               if (*mime_type != NULL) {
-                       memcpy(*mime_type, typename, length);
-               } else {
-                       ret = NET_NFC_ALLOC_FAIL;
-               }
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-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;
-       data_s id_data = { id, id_size };
-
-       if (record == NULL || id == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_set_record_id(record, &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;
-       data_s *payload_data;
-
-       if (record == NULL || payload == NULL || size == NULL)
-               return _return_invalid_param(__func__);
-
-       *payload = NULL;
-       *size = 0;
-
-       ret = net_nfc_get_record_payload(record, &payload_data);
-       if (ret == NET_NFC_OK) {
-               *payload = payload_data->buffer;
-               *size = payload_data->length;
-       } else {
-               *payload = NULL;
-               *size = 0;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_record_get_type(nfc_ndef_record_h record, unsigned char **type,
-               int *size)
-{
-       int ret;
-       data_s *type_data;
-
-       if (record == NULL || type == NULL || size == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_get_record_type(record, &type_data);
-       if (ret == NET_NFC_OK) {
-               *type = type_data->buffer;
-               *size = type_data->length;
-       } else {
-               *type = NULL;
-               *size = 0;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_record_get_id(nfc_ndef_record_h record, unsigned char **id, int *size)
-{
-       int ret;
-       data_s *id_data;
-
-       if (record == NULL || id == NULL || size == NULL)
-               return _return_invalid_param(__func__);
-
-       *id = NULL;
-       *size = 0;
-
-       ret = net_nfc_get_record_id(record, &id_data);
-       if (ret == NET_NFC_OK) {
-               *id = id_data->buffer;
-               *size = id_data->length;
-       } else {
-               *id = NULL;
-               *size = 0;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e *tnf)
-{
-       int ret;
-
-       if (record == NULL || tnf == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_get_record_tnf(record, (net_nfc_record_tnf_e *)tnf);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_record_get_text(nfc_ndef_record_h record, char **buffer)
-{
-       int ret;
-
-       if (record == NULL || buffer == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_create_text_string_from_text_record(record, buffer);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_record_get_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;
-
-       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;
-
-       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;
-
-       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;
-       data_s rawdata_data = { (unsigned char *)rawdata, rawdata_size };
-
-       if (ndef_message == NULL || rawdata == NULL || rawdata_size <= 0)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_create_ndef_message_from_rawdata(ndef_message, &rawdata_data);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message)
-{
-       int ret;
-
-       if (ndef_message == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_free_ndef_message(ndef_message);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message,
-               int *count)
-{
-       int ret;
-
-       if (ndef_message == NULL || count == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_get_ndef_message_record_count(ndef_message, count);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_message_get_rawdata(nfc_ndef_message_h ndef_message,
-       unsigned char **rawdata,
-       unsigned int *rawdata_size)
-{
-       int ret;
-       data_s *rawdata_data;
-
-       if (ndef_message == NULL || rawdata == NULL || rawdata_size == NULL)
-               return _return_invalid_param(__func__);
-
-       *rawdata = NULL;
-       *rawdata_size = 0;
-
-       ret = net_nfc_create_rawdata_from_ndef_message(ndef_message, &rawdata_data);
-       if (ret == NET_NFC_OK) {
-               *rawdata = calloc(1, rawdata_data->length);
-               memcpy(*rawdata, rawdata_data->buffer, rawdata_data->length);
-               *rawdata_size = rawdata_data->length;
-
-               net_nfc_free_data(rawdata_data);
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_message_append_record(nfc_ndef_message_h ndef_message,
-               nfc_ndef_record_h record)
-{
-       int ret;
-
-       if (ndef_message == NULL || record == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_append_record_to_ndef_message(ndef_message, record);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_message_insert_record(nfc_ndef_message_h ndef_message,
-               int index, nfc_ndef_record_h record)
-{
-       int ret;
-
-       if (ndef_message == NULL || record == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_append_record_by_index(ndef_message, index, record);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message,
-               int index)
-{
-       int ret;
-
-       if (ndef_message == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_remove_record_by_index(ndef_message, index);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_ndef_message_get_record(nfc_ndef_message_h ndef_message,
-               int index, nfc_ndef_record_h *record)
-{
-       int ret;
-
-       if (ndef_message == NULL || record == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_get_record_by_index(ndef_message, index, record);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_tag_get_type(nfc_tag_h tag, nfc_tag_type_e *type)
-{
-       int ret;
-
-       if (tag == NULL || type == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_get_tag_type(tag, (net_nfc_target_type_e *)type);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_tag_is_support_ndef(nfc_tag_h tag, bool *is_support)
-{
-       int ret;
-
-       if (tag == NULL || is_support == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_get_tag_ndef_support(tag, is_support);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag, unsigned int *max_size)
-{
-       int ret;
-
-       if (tag == NULL || max_size == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_get_tag_max_data_size(tag, max_size);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int *actual_data_size)
-{
-       int ret;
-
-       if (tag == NULL || actual_data_size == NULL)
-               return _return_invalid_param(__func__);
-
-       ret = net_nfc_get_tag_actual_data_size(tag, actual_data_size);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_tag_foreach_information(nfc_tag_h tag, nfc_tag_information_cb callback,
-               void *user_data)
-{
-       net_nfc_tag_info_s *taglist = NULL;
-       int i;
-       bool cont;
-
-       if (tag == NULL || callback == NULL)
-               return _return_invalid_param(__func__);
-
-       taglist = tag->tag_info_list;
-
-       if (taglist == NULL) {
-               return NFC_ERROR_NOT_SUPPORTED;
-       }
-
-       for (i = 0; i < tag->number_of_keys; i++) {
-               cont = callback(taglist[i].key,
-                               net_nfc_get_data_buffer(taglist[i].value),
-                               net_nfc_get_data_length(taglist[i].value),
-                               user_data);
-
-               if (!cont)
-                       break;
-       }
-
-       return NFC_ERROR_NONE;
-}
-
-/********************************Tag Functions***********************************/
-
-int nfc_manager_get_connected_tag(nfc_tag_h *tag)
-{
-       int ret;
-       net_nfc_target_info_s *result = NULL;
-
-       if (tag == NULL)
-               return _return_invalid_param(__func__);
-
-       *tag = NULL;
-
-       if (gdbus_nfc_context.current_tag == NULL) {
-               ret = net_nfc_client_tag_get_current_tag_info_sync(&result);
-               if (ret == NET_NFC_OK) {
-                       *tag = result;
-               }
-       } else {
-               /* FIXME ??? */
-               *tag = gdbus_nfc_context.current_tag;
-
-               ret = NET_NFC_OK;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_manager_get_connected_target(nfc_p2p_target_h *target)
-{
-       int ret;
-       net_nfc_target_handle_s *result = NULL;
-
-       if (target == NULL)
-               return _return_invalid_param(__func__);
-
-       *target = NULL;
-
-       if (gdbus_nfc_context.current_target == NULL) {
-               ret = net_nfc_client_tag_get_current_target_handle_sync(&result);
-               if (ret == NET_NFC_OK) {
-                       gdbus_nfc_context.current_target = result;
-
-                       *target = gdbus_nfc_context.current_target;
-               }
-       } else {
-               /* FIXME ??? */
-               *target = gdbus_nfc_context.current_target;
-
-               ret = NET_NFC_OK;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_manager_set_tag_discovered_cb(nfc_tag_discovered_cb callback,
-               void *user_data)
-{
-       if (callback == NULL)
-               return _return_invalid_param(__func__);
-
-       gdbus_nfc_context.on_tag_discovered_cb = callback;
-       gdbus_nfc_context.on_tag_discovered_user_data = user_data;
-
-       return NFC_ERROR_NONE;
-}
-
-void nfc_manager_unset_tag_discovered_cb(void)
-{
-       gdbus_nfc_context.on_tag_discovered_cb = NULL;
-       gdbus_nfc_context.on_tag_discovered_user_data = NULL;
-}
-#if 0
-void _nfc_manager_tag_detached_cb(void *user_data)
-{
-       if (gdbus_nfc_context.on_tag_discovered_cb)
-       {
-               gdbus_nfc_context.on_tag_discovered_cb(
-                               NFC_DISCOVERED_TYPE_DETACHED,
-                               (nfc_tag_h)gdbus_nfc_context.current_tag,
-                               gdbus_nfc_context.on_tag_discovered_user_data);
-       }
-
-       if (gdbus_nfc_context.current_tag != NULL )
-       {
-               net_nfc_release_tag_info(gdbus_nfc_context.current_tag);
-               gdbus_nfc_context.current_tag = NULL;
-       }
-}
-
-int nfc_manager_set_tag_detached_cb(nfc_tag_discovered_cb callback,
-               void *user_data)
-{
-       if (callback == NULL)
-               return _return_invalid_param(__func__);
-
-       gdbus_nfc_context.on_tag_discovered_cb = callback;
-       gdbus_nfc_context.on_tag_discovered_user_data = user_data;
-
-       net_nfc_client_tag_set_tag_detached(
-                       _nfc_manager_tag_detached_cb,
-                       user_data);
-
-       return NFC_ERROR_NONE;
-}
-
-void nfc_manager_unset_tag_detached_cb(void)
-{
-       net_nfc_client_tag_unset_tag_detached();
-}
-#endif
-/******************************Popup Notification*******************************/
-
-int nfc_manager_set_system_handler_enable(bool enable)
-{
-       int ret;
-       int state;
-
-       if (enable == true) {
-               state = NET_NFC_LAUNCH_APP_SELECT;
-       } else {
-               state = NET_NFC_NO_LAUNCH_APP_SELECT;
-       }
-
-       ret = net_nfc_client_sys_handler_set_launch_popup_state(state);
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_manager_set_system_handler_enable_force(bool enable)
-{
-       int ret;
-       int state;
-
-       if (enable == true) {
-               state = NET_NFC_LAUNCH_APP_SELECT;
-       } else {
-               state = NET_NFC_NO_LAUNCH_APP_SELECT;
-       }
-
-       ret = net_nfc_client_sys_handler_set_launch_popup_state_force(state);
-
-       return _convert_error_code(__func__, ret);
-}
-
-bool nfc_manager_is_system_handler_enabled(void)
-{
-       int state = 0;
-
-       net_nfc_client_sys_handler_get_launch_popup_state(&state);
-
-       if (NET_NFC_LAUNCH_APP_SELECT == state)
-               return true;
-       else
-               return false;
-}
-
-/******************************Handover*******************************/
-
-static void _net_nfc_manager_p2p_handover_cb(net_nfc_error_e result,
-               net_nfc_conn_handover_carrier_type_e carrier, data_s *ac_data, void *user_data)
-{
-       nfc_p2p_connection_handover_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               nfc_ac_type_e carrior_type = NFC_AC_TYPE_UNKNOWN;
-               char buffer[50] = { 0, };
-
-               if (carrier == NET_NFC_CONN_HANDOVER_CARRIER_BT) {
-                       carrior_type = NFC_AC_TYPE_BT;
-                       if (ac_data != NULL && ac_data->buffer != NULL)
-                       {
-                               snprintf(buffer, sizeof(buffer),
-                                               "%02x:%02x:%02x:%02x:%02x:%02x",
-                                               ac_data->buffer[0], ac_data->buffer[1],
-                                               ac_data->buffer[2], ac_data->buffer[3],
-                                               ac_data->buffer[4], ac_data->buffer[5]);
-                       }
-               }
-
-               callback(_convert_error_code(__func__, result),
-                               carrior_type, (void *)buffer,
-                               strlen(buffer), user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_p2p_connection_handover(nfc_p2p_target_h target, nfc_ac_type_e type,
-               nfc_p2p_connection_handover_completed_cb callback, void *user_data)
-{
-       int ret;
-       net_nfc_conn_handover_carrier_type_e net_ac_type =
-               NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
-       GVariant *parameter;
-
-       if (target == NULL)
-               return _return_invalid_param(__func__);
-
-       if (type > NFC_AC_TYPE_UNKNOWN)
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated()) {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       switch (type)
-       {
-       case NFC_AC_TYPE_BT :
-               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_BT;
-               break;
-
-       case NFC_AC_TYPE_WIFI :
-               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS;
-               break;
-
-       case NFC_AC_TYPE_WIFI_DIRECT :
-               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_IBSS;
-               break;
-
-       case NFC_AC_TYPE_UNKNOWN :
-               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
-               break;
-
-       default:
-               break;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_p2p_connection_handover(
-                               (net_nfc_target_handle_s*)target,
-                               net_ac_type,
-                               _net_nfc_manager_p2p_handover_cb,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-bool nfc_p2p_is_supported_ac_type(nfc_ac_type_e carrier)
-{
-       bool result = false;
-
-       if (carrier == NFC_AC_TYPE_BT)
-               result = true;
-
-       return result;
-}
-
-/**********************P2P functions************************************/
-
-static void _p2p_send_cb(net_nfc_error_e result, void *user_data)
-{
-       nfc_p2p_send_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result), user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_p2p_send(nfc_p2p_target_h target, nfc_ndef_message_h message,
-               nfc_p2p_send_completed_cb callback, void *user_data)
-{
-       int ret;
-       data_s *rawdata;
-       GVariant *parameter;
-
-       if (target == NULL || message == NULL)
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated())
-               return NFC_ERROR_NOT_ACTIVATED;
-
-       if (_check_app_permission() == false)
-       {
-               LOGE("permission check fail");
-
-               return NFC_ERROR_SECURITY_RESTRICTED;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               net_nfc_create_rawdata_from_ndef_message(message, &rawdata);
-               ret = net_nfc_client_p2p_send((net_nfc_target_handle_s*)target,
-                               rawdata,
-                               _p2p_send_cb,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-
-               net_nfc_free_data(rawdata);
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_p2p_send_no_permission(nfc_p2p_target_h target,
-               nfc_ndef_message_h message, nfc_p2p_send_completed_cb callback, void *user_data)
-{
-       int ret;
-       data_s *rawdata;
-       GVariant *parameter;
-
-       if (target == NULL || message == NULL)
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated())
-               return NFC_ERROR_NOT_ACTIVATED;
-
-       /* skip check app permission */
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               net_nfc_create_rawdata_from_ndef_message(message, &rawdata);
-               ret = net_nfc_client_p2p_send((net_nfc_target_handle_s*)target,
-                               rawdata,
-                               _p2p_send_cb,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-
-               net_nfc_free_data(rawdata);
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-static void _net_nfc_manager_p2p_set_data_received_cb(data_s *data,
-               void *user_data)
-{
-       if (gdbus_nfc_context.on_p2p_recv_cb != NULL)
-       {
-               ndef_message_s *ndef_message;
-
-               net_nfc_create_ndef_message_from_rawdata(&ndef_message, data);
-
-               gdbus_nfc_context.on_p2p_recv_cb(
-                               (nfc_p2p_target_h)(gdbus_nfc_context.current_target),
-                               ndef_message,
-                               gdbus_nfc_context.on_p2p_recv_user_data);
-
-               net_nfc_free_ndef_message(ndef_message);
-       }
-}
-
-int nfc_p2p_set_data_received_cb(nfc_p2p_target_h target,
-               nfc_p2p_data_recived_cb callback, void *user_data)
-{
-       if (target == NULL || callback == NULL)
-               return _return_invalid_param(__func__);
-
-       if (gdbus_nfc_context.current_target != target)
-               return _return_invalid_param(__func__);
-
-       gdbus_nfc_context.on_p2p_recv_cb = callback;
-       gdbus_nfc_context.on_p2p_recv_user_data = user_data;
-
-       net_nfc_client_p2p_set_data_received(
-                       _net_nfc_manager_p2p_set_data_received_cb,
-                       NULL);
-
-       return NFC_ERROR_NONE;
-}
-
-int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target)
-{
-       if (target == NULL)
-               return _return_invalid_param(__func__);
-
-       if (gdbus_nfc_context.current_target != target)
-               return _return_invalid_param(__func__);
-
-       net_nfc_client_p2p_unset_data_received();
-
-       gdbus_nfc_context.on_p2p_recv_cb = NULL;
-       gdbus_nfc_context.on_p2p_recv_user_data = NULL;
-
-       return NFC_ERROR_NONE;
-}
-
-int nfc_manager_set_p2p_target_discovered_cb(
-               nfc_p2p_target_discovered_cb callback, void *user_data)
-{
-       if (callback == NULL)
-               return _return_invalid_param(__func__);
-
-       gdbus_nfc_context.on_p2p_target_discovered_cb = callback;
-       gdbus_nfc_context.on_p2p_target_discovered_user_data = user_data;
-
-       return NFC_ERROR_NONE;
-}
-
-void nfc_manager_unset_p2p_target_discovered_cb(void)
-{
-       gdbus_nfc_context.on_p2p_target_discovered_cb = NULL;
-       gdbus_nfc_context.on_p2p_target_discovered_user_data = NULL;
-}
-
-/******************************SNEP***********************************/
-
-static void _net_nfc_manager_snep_start_server(
-               net_nfc_snep_handle_h arg_handle,
-               net_nfc_snep_type_t event,
-               net_nfc_error_e result,
-               nfc_ndef_message_h msg,
-               void *user_data)
-{
-       nfc_snep_event_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               nfc_snep_event_e snep_event;
-
-               switch ((int)event) {
-               case NET_NFC_SNEP_GET :
-                       snep_event = NFC_SNEP_EVENT_GET;
-                       break;
-
-               case NET_NFC_SNEP_PUT :
-                       snep_event = NFC_SNEP_EVENT_PUT;
-                       break;
-
-               case NET_NFC_LLCP_REGISTERED :
-                       snep_event = NFC_SNEP_EVENT_REGISTER;
-                       break;
-
-               case NET_NFC_LLCP_UNREGISTERED :
-                       snep_event = NFC_SNEP_EVENT_UNREGISTER;
-                       break;
-
-               case NET_NFC_LLCP_START :
-                       snep_event = NFC_SNEP_EVENT_START;
-                       break;
-
-               case NET_NFC_LLCP_STOP :
-               default :
-                       snep_event = NFC_SNEP_EVENT_STOP;
-                       break;
-               }
-
-               callback(arg_handle, snep_event,
-                               _convert_error_code(__func__, result)
-                               , msg, user_param);
-
-               if (snep_event == NFC_SNEP_EVENT_STOP) {
-                       g_variant_unref(user_data);
-               }
-       }
-}
-
-int nfc_snep_start_server(nfc_p2p_target_h target, const char *san, int sap,
-               nfc_snep_event_cb callback, void *user_data)
-{
-       net_nfc_error_e result;
-       GVariant *parameter;
-
-       if (target == NULL) {
-               return NFC_ERROR_INVALID_PARAMETER;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               result = net_nfc_client_snep_start_server(
-                               (net_nfc_target_handle_s*)target,
-                               san,
-                               (sap_t)sap,
-                               _net_nfc_manager_snep_start_server,
-                               parameter);
-               if (result != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               result = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, result);
-}
-
-static void _net_nfc_manager_snep_start_client(
-               net_nfc_snep_handle_h arg_handle,
-               net_nfc_snep_type_t event,
-               net_nfc_error_e result,
-               nfc_ndef_message_h msg,
-               void *user_data)
-{
-       nfc_snep_event_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               nfc_snep_event_e snep_event;
-
-               switch ((int)event) {
-               case NET_NFC_SNEP_GET :
-                       snep_event = NFC_SNEP_EVENT_GET;
-                       break;
-
-               case NET_NFC_SNEP_PUT :
-                       snep_event = NFC_SNEP_EVENT_PUT;
-                       break;
-
-               case NET_NFC_LLCP_REGISTERED :
-                       snep_event = NFC_SNEP_EVENT_REGISTER;
-                       break;
-
-               case NET_NFC_LLCP_UNREGISTERED :
-                       snep_event = NFC_SNEP_EVENT_UNREGISTER;
-                       break;
-
-               case NET_NFC_LLCP_START :
-                       snep_event = NFC_SNEP_EVENT_START;
-                       break;
-
-               case NET_NFC_LLCP_STOP :
-               default :
-                       snep_event = NFC_SNEP_EVENT_STOP;
-                       break;
-               }
-
-               callback(arg_handle, snep_event, _convert_error_code(__func__, result),
-                               msg, user_param);
-
-               if (snep_event == NFC_SNEP_EVENT_STOP) {
-                       g_variant_unref(user_data);
-               }
-       }
-}
-
-int nfc_snep_start_client(nfc_p2p_target_h target, const char *san, int sap,
-               nfc_snep_event_cb callback, void *user_data)
-{
-       net_nfc_error_e result;
-       GVariant *parameter;
-
-       if (target == NULL) {
-               return NFC_ERROR_INVALID_PARAMETER;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               result = net_nfc_client_snep_start_client(
-                               (net_nfc_target_handle_s*)target,
-                               san,
-                               (sap_t)sap,
-                               _net_nfc_manager_snep_start_client,
-                               parameter);
-               if (result != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               result = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, result);
-}
-
-static void _net_nfc_manager_snep_send_request(
-               net_nfc_snep_handle_h target,
-               net_nfc_snep_type_t event,
-               net_nfc_error_e result,
-               ndef_message_s *msg,
-               void *user_data)
-{
-       nfc_snep_event_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback((nfc_p2p_snep_h)target,
-                               event,
-                               _convert_error_code(__func__, result),
-                               (nfc_ndef_message_h)msg,
-                               user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_snep_send_client_request(nfc_p2p_snep_h handle, nfc_snep_type_e type,
-               nfc_ndef_message_h msg, nfc_snep_event_cb callback, void *user_data)
-{
-       net_nfc_error_e result;
-       GVariant *parameter;
-
-       if (handle == NULL || msg == NULL) {
-               return NFC_ERROR_INVALID_PARAMETER;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               result = net_nfc_client_snep_send_client_request(
-                               (net_nfc_target_handle_s*)handle,
-                               type,
-                               msg,
-                               _net_nfc_manager_snep_send_request,
-                               parameter);
-               if (result != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               result = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, result);
-}
-
-static void _snep_event_cb(net_nfc_snep_handle_h target, net_nfc_snep_type_t event,
-               net_nfc_error_e result, ndef_message_s *msg, void *user_data)
-{
-       nfc_snep_event_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               switch ((int)event) {
-               case NET_NFC_SNEP_GET :
-                       event = NFC_SNEP_EVENT_GET;
-                       break;
-
-               case NET_NFC_SNEP_PUT :
-                       event = NFC_SNEP_EVENT_PUT;
-                       break;
-
-               case NET_NFC_LLCP_REGISTERED :
-                       event = NFC_SNEP_EVENT_REGISTER;
-                       break;
-
-               case NET_NFC_LLCP_UNREGISTERED :
-                       event = NFC_SNEP_EVENT_UNREGISTER;
-                       break;
-
-               case NET_NFC_LLCP_START :
-                       event = NFC_SNEP_EVENT_START;
-                       break;
-
-               case NET_NFC_LLCP_STOP :
-                       event = NFC_SNEP_EVENT_STOP;
-                       break;
-               }
-
-               callback(target, event, _convert_error_code(__func__, result), msg, user_param);
-       }
-
-       if ((int)event == NFC_SNEP_EVENT_UNREGISTER) {
-               g_variant_unref((GVariant *)user_data);
-       }
-}
-
-int nfc_snep_register_server(const char *san, int sap,
-               nfc_snep_event_cb callback, void *user_data)
-{
-       net_nfc_error_e result;
-       GVariant *parameter;
-
-       if (san == NULL) {
-               return _return_invalid_param(__func__);
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               result = net_nfc_client_snep_register_server(san, (sap_t)sap,
-                               _snep_event_cb, parameter);
-               if (result != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               result = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, result);
-}
-
-int nfc_snep_unregister_server(const char *san, int sap)
-{
-       net_nfc_error_e result;
-
-       result = net_nfc_client_snep_unregister_server(san, (sap_t)sap);
-
-       return _convert_error_code(__func__, result);
-}
-
-int nfc_snep_stop_service(nfc_p2p_target_h target, nfc_p2p_snep_h clients)
-{
-       int ret;
-
-       ret = net_nfc_client_snep_stop_service_sync(target, clients);
-
-       return _convert_error_code(__func__, ret);
-}
-
-/******************************Secure Element***********************************/
-
-static void _net_nfc_manager_set_card_emulation_se_type_cb(
-               net_nfc_error_e result, void *user_data)
-{
-       nfc_set_card_emulation_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result),
-                               user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_manager_set_card_emulation_se_type(nfc_se_type_e type,
-               nfc_set_card_emulation_completed_cb callback, void *user_data)
-{
-       int ret;
-       net_nfc_se_type_e se_type;
-       GVariant *parameter;
-
-       if ((type < NFC_SE_TYPE_DISABLE) || (type > NFC_SE_TYPE_UICC))
-       {
-               return _return_invalid_param(__func__);
-       }
-
-       if (!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       switch (type)
-       {
-       case NFC_SE_TYPE_DISABLE :
-               se_type = NET_NFC_SE_TYPE_NONE;
-               break;
-       case NFC_SE_TYPE_ESE :
-               se_type = NET_NFC_SE_TYPE_ESE;
-               break;
-       case NFC_SE_TYPE_UICC :
-               se_type = NET_NFC_SE_TYPE_UICC;
-               break;
-       default:
-               break;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_se_set_secure_element_type(
-                               se_type,
-                               _net_nfc_manager_set_card_emulation_se_type_cb,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-int nfc_manager_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_client_se_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;
-       int se_type;
-
-       ret = vconf_get_int(VCONFKEY_NFC_SE_TYPE, &se_type);
-       if (ret == 0)
-       {
-               if ((se_type >= NFC_SE_TYPE_DISABLE)
-                               && (se_type <= NFC_SE_TYPE_UICC))
-               {
-                       *type = se_type;
-
-                       ret = NFC_ERROR_NONE;
-               }
-               else
-               {
-                       ret = NFC_ERROR_OPERATION_FAILED;
-               }
-       }
-       else
-       {
-               ret = NFC_ERROR_OPERATION_FAILED;
-       }
-
-       return ret;
-}
-
-int nfc_se_open_secure_element(nfc_se_type_e se_type, nfc_se_h *handle)
-{
-       net_nfc_error_e result;
-       net_nfc_se_type_e type;
-       net_nfc_target_handle_s *temp = NULL;
-
-       switch (se_type)
-       {
-       case NFC_SE_TYPE_ESE :
-               type = NET_NFC_SE_TYPE_ESE;
-               break;
-
-       case NFC_SE_TYPE_UICC :
-               type = NET_NFC_SE_TYPE_UICC;
-               break;
-
-       default:
-               return NFC_ERROR_INVALID_PARAMETER;
-               break;
-       }
-
-       result = net_nfc_client_se_open_internal_secure_element_sync(type, &temp);
-       if (result == NET_NFC_OK) {
-               *handle = (nfc_se_h)temp;
-       }
-
-       return _convert_error_code(__func__, result);
-}
-
-int nfc_se_send_apdu(nfc_se_h handle, unsigned char *cmd, unsigned int cmd_len,
-               unsigned char **resp, unsigned int *resp_len)
-{
-       net_nfc_error_e result;
-       data_s command, *response = NULL;
-
-       if (handle == NULL || cmd == NULL || cmd_len == 0 ||
-                       resp == NULL || resp_len == NULL ) {
-               return _return_invalid_param(__func__);
-       }
-
-       *resp = NULL;
-       *resp_len = 0;
-
-       command.buffer = cmd;
-       command.length = cmd_len;
-
-       result = net_nfc_client_se_send_apdu_sync(
-                       (net_nfc_target_handle_s*)handle,
-                       &command,
-                       &response);
-
-       if (result == NET_NFC_OK && response != NULL
-                       && response->buffer != NULL) {
-               if (response->length >= 2) {
-                       *resp = calloc(1, response->length);
-                       if (*resp != NULL) {
-                               memcpy(*resp, response->buffer, response->length);
-                               *resp_len = response->length;
-                       } else {
-                               result = NET_NFC_ALLOC_FAIL;
-                       }
-               } else {
-                       result = NET_NFC_OPERATION_FAIL;
-               }
-       }
-
-       if (response != NULL) {
-               net_nfc_free_data(response);
-       }
-
-       return _convert_error_code(__func__, result);
-}
-
-int nfc_se_get_atr(nfc_se_h handle, unsigned char **atr, unsigned int *atr_len)
-{
-       net_nfc_error_e result;
-       data_s *response = NULL;
-
-       if (handle == NULL || atr == NULL || atr_len == NULL) {
-               return _return_invalid_param(__func__);
-       }
-
-       *atr = NULL;
-       *atr_len = 0;
-
-       result = net_nfc_client_se_get_atr_sync(
-                       (net_nfc_target_handle_s*)handle,
-                       &response);
-
-       if (result == NET_NFC_OK && response != NULL
-                       && response->buffer != NULL && response->length > 0) {
-               *atr = calloc(1, response->length);
-               if (*atr != NULL) {
-                       memcpy(*atr, response->buffer, response->length);
-                       *atr_len = response->length;
-               } else {
-                       result = NET_NFC_ALLOC_FAIL;
-               }
-       }
-
-       if (response != NULL) {
-               net_nfc_free_data(response);
-       }
-
-       return _convert_error_code(__func__, result);
-}
-
-int nfc_se_close_secure_element(nfc_se_h handle)
-{
-       net_nfc_error_e result;
-
-       result = net_nfc_client_se_close_internal_secure_element_sync(
-                       (net_nfc_target_handle_s*)handle);
-
-       return _convert_error_code(__func__, result);
-}
-
-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)
-{
-       net_nfc_error_e result;
-       net_nfc_se_type_e se_type;
-
-       result = net_nfc_get_card_emulation_mode(&se_type);
-
-       if(result == NET_NFC_OK)
-       {
-               if(se_type == NET_NFC_SE_TYPE_NONE)
-               {
-                       *type = NFC_SE_CARD_EMULATION_MODE_OFF;
-               }
-               else if(se_type == NET_NFC_SE_TYPE_ESE || se_type == NET_NFC_SE_TYPE_UICC)
-               {
-                       *type = NFC_SE_CARD_EMULATION_MODE_ON;
-               }
-       }
-       else
-       {
-               result = NET_NFC_OPERATION_FAIL;
-       }
-
-       return _convert_error_code(__func__, result);;
-}
-
-int nfc_manager_set_se_event_cb(nfc_se_event_cb callback, void *user_data)
-{
-       if (callback == NULL)
-               return _return_invalid_param(__func__);
-
-       net_nfc_client_se_set_event_cb(
-                       (net_nfc_client_se_event)callback,
-                       user_data);
-
-       return NFC_ERROR_NONE;
-}
-
-void nfc_manager_unset_se_event_cb(void)
-{
-       net_nfc_client_se_unset_event_cb();
-
-       gdbus_nfc_context.on_se_transaction_event_cb = NULL;
-       gdbus_nfc_context.on_se_transaction_event_user_data = NULL;
-}
-
-static void _se_transaction_event_cb(
-                                               net_nfc_se_type_e se_type,
-                                               data_s* aid,
-                                               data_s* param,
-                                               void *user_data)
-{
-       if (gdbus_nfc_context.on_se_transaction_event_cb != NULL) {
-               gdbus_nfc_context.on_se_transaction_event_cb(
-                       se_type,
-                       net_nfc_get_data_buffer(aid),
-                       net_nfc_get_data_length(aid),
-                       net_nfc_get_data_buffer(param),
-                       net_nfc_get_data_length(param),
-                       gdbus_nfc_context.on_se_transaction_event_user_data);
-       }
-}
-
-int nfc_manager_set_se_transaction_event_cb(
-       nfc_se_type_e se_type,
-       nfc_se_transaction_event_cb callback,
-       void *user_data)
-{
-       net_nfc_se_type_e type = NET_NFC_SE_TYPE_NONE;
-
-       if (callback == NULL)
-               return _return_invalid_param(__func__);
-
-       gdbus_nfc_context.on_se_transaction_event_cb = callback;
-       gdbus_nfc_context.on_se_transaction_event_user_data = user_data;
-
-       switch(se_type)
-       {
-               case NFC_SE_TYPE_ESE:
-                       type = NET_NFC_SE_TYPE_ESE;
-                       break;
-
-               case NFC_SE_TYPE_UICC:
-                       type = NET_NFC_SE_TYPE_UICC;
-                       break;
-               default:
-                       return _return_invalid_param(__func__);
-                       break;
-
-       }
-
-       net_nfc_client_se_set_transaction_event_cb(type, _se_transaction_event_cb, user_data);
-
-       return NFC_ERROR_NONE;
-}
-
-void nfc_manager_unset_se_transaction_event_cb(nfc_se_type_e se_type)
-{
-       net_nfc_se_type_e type = NET_NFC_SE_TYPE_NONE;
-
-       switch(se_type)
-       {
-               case NFC_SE_TYPE_ESE:
-                       type = NET_NFC_SE_TYPE_ESE;
-                       break;
-
-               case NFC_SE_TYPE_UICC:
-                       type = NET_NFC_SE_TYPE_UICC;
-                       break;
-               default:
-                       type = NET_NFC_SE_TYPE_NONE;
-                       break;
-       }
-       net_nfc_client_se_unset_transaction_event_cb(type);
-}
-
-/************************************Raw Data- Transceive*********************/
-
-static void _net_nfc_manager_tag_transceive_data(net_nfc_error_e result,
-               data_s *arg_data, void *user_data)
-{
-       nfc_tag_transceive_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               unsigned char *buffer = NULL;
-               int buffer_size = 0;
-
-               if (result == NET_NFC_OK && arg_data != NULL) {
-                       buffer = arg_data->buffer;
-                       buffer_size = arg_data->length;
-               }
-
-               callback(_convert_error_code(__func__, result),
-                               buffer,
-                               buffer_size,
-                               user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_tag_transceive(nfc_tag_h tag, unsigned char *buffer, int buffer_size,
-               nfc_tag_transceive_completed_cb callback, void *user_data)
-{
-       int ret;
-       data_s rawdata = { buffer, buffer_size };
-       GVariant *parameter;
-
-       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;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_transceive_data(
-                               tag->handle,
-                               &rawdata,
-                               _net_nfc_manager_tag_transceive_data,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-/*********************************Mifare*********************************/
-/* FIXME */
-static void _net_nfc_manager_mifare_authenticate_with_keyA(
-               net_nfc_error_e result, void *user_data)
-{
-       nfc_mifare_authenticate_with_keyA_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)",(guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result), user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_mifare_authenticate_with_keyA(nfc_tag_h tag,
-               int sector_index,
-               unsigned char *auth_key,
-               nfc_mifare_authenticate_with_keyA_completed_cb callback,
-               void *user_data)
-{
-       int ret;
-       data_s auth_key_data = { auth_key, 6 };
-       GVariant *parameter;
-
-       if (tag == NULL || auth_key == NULL)
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_mifare_authenticate_with_keyA(
-                               tag->handle,
-                               sector_index,
-                               &auth_key_data,
-                               _net_nfc_manager_mifare_authenticate_with_keyA,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-static void _net_nfc_manager_mifare_authenticate_with_keyB(
-               net_nfc_error_e result, void *user_data)
-{
-       nfc_mifare_authenticate_with_keyB_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result), user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_mifare_authenticate_with_keyB(nfc_tag_h tag,
-               int sector_index,
-               unsigned char *auth_key,
-               nfc_mifare_authenticate_with_keyB_completed_cb callback,
-               void *user_data)
-{
-       int ret;
-       data_s auth_key_data = { auth_key, 6 };
-       GVariant *parameter;
-
-       if (tag == NULL || auth_key == NULL)
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_mifare_authenticate_with_keyB(
-                               tag->handle,
-                               sector_index,
-                               &auth_key_data,
-                               _net_nfc_manager_mifare_authenticate_with_keyB,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-/* FIXME */
-static void _net_nfc_manager_mifare_read_block(net_nfc_error_e result,
-               data_s *data, void *user_data)
-{
-       nfc_mifare_read_block_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               uint8_t *buffer = NULL;
-               int length = 0;
-
-               if (result == NET_NFC_OK && data != NULL) {
-                       buffer = data->buffer;
-                       length = data->length;
-               }
-
-               callback(_convert_error_code(__func__, result),
-                               buffer,
-                               length,
-                               user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_mifare_read_block(nfc_tag_h tag, int block_index,
-               nfc_mifare_read_block_completed_cb callback, void *user_data)
-{
-       int ret;
-       GVariant *parameter;
-
-       if (tag == NULL)
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_mifare_read(
-                               tag->handle,
-                               block_index,
-                               _net_nfc_manager_mifare_read_block,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-#if 0
-/* FIXME : ... */
-static void _mifare_read_page(net_nfc_error_e result,
-               data_s *data,
-               void *user_data)
-{
-       nfc_mifare_read_page_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               uint8_t *buffer = NULL;
-               int length = 0;
-
-               if (result == NET_NFC_OK && data != NULL) {
-                       buffer = data->buffer;
-                       length = data->length;
-               }
-
-               callback(_convert_error_code(__func__, result),
-                               buffer,
-                               length,
-                               user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-#endif
-int nfc_mifare_read_page(nfc_tag_h tag, int page_index,
-               nfc_mifare_read_page_completed_cb callback, void *user_data)
-{
-       int ret;
-       GVariant *parameter;
-
-       if (!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               /* FIXME : not implemented */
-               //              ret = net_nfc_client_mifare_read_block(tag,
-               //                      page_index,
-               //                      _mifare_read_page,
-               //                      parameter);
-               //              if (ret != NET_NFC_OK) {
-               g_variant_unref(parameter);
-               //              }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-static void _net_nfc_manager_mifare_write_block(net_nfc_error_e result,
-               void *user_data)
-{
-       nfc_mifare_write_block_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result), user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_mifare_write_block(nfc_tag_h tag, int block_index, unsigned char *buffer,
-               int buffer_size, nfc_mifare_write_block_completed_cb callback, void *user_data)
-{
-       int ret;
-       data_s block_data = { buffer, buffer_size };
-       GVariant *parameter;
-
-       if (tag == NULL || buffer == NULL || buffer_size <= 0)
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_mifare_write_block(
-                               tag->handle,
-                               block_index,
-                               &block_data,
-                               _net_nfc_manager_mifare_write_block,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-static void _mifare_write_page(net_nfc_error_e result, void *user_data)
-{
-       nfc_mifare_write_page_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data,"(uu)", (guint *)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result), user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_mifare_write_page(nfc_tag_h tag, int page_index, unsigned char *buffer,
-               int buffer_size, nfc_mifare_write_page_completed_cb callback, void *user_data)
-{
-       int ret;
-       data_s block_data = { buffer, buffer_size };
-       GVariant *parameter;
-
-       if (tag == NULL || buffer == NULL || buffer_size <= 0)
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_mifare_write_page(
-                               tag->handle,
-                               page_index,
-                               &block_data,
-                               _mifare_write_page,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-static void _net_nfc_manager_mifare_increment(net_nfc_error_e result,
-               void *user_data)
-{
-       nfc_mifare_increment_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result), user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_mifare_increment(nfc_tag_h tag, int block_index, int value,
-               nfc_mifare_increment_completed_cb callback, void *user_data)
-{
-       int ret;
-       GVariant *parameter;
-
-       if (tag == NULL )
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_mifare_increment(
-                               tag->handle,
-                               block_index,
-                               value,
-                               _net_nfc_manager_mifare_increment,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-static void _net_nfc_manager_mifare_decrement(net_nfc_error_e result,
-               void *user_data)
-{
-       nfc_mifare_decrement_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result), user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_mifare_decrement(nfc_tag_h tag, int block_index, int value,
-               nfc_mifare_decrement_completed_cb callback, void *user_data)
-{
-       int ret;
-       GVariant *parameter;
-
-       if (tag == NULL)
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_mifare_decrement(
-                               tag->handle,
-                               block_index,
-                               value,
-                               _net_nfc_manager_mifare_decrement,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-static void _net_nfc_manager_mifare_transfer(net_nfc_error_e result,
-               void *user_data)
-{
-       nfc_mifare_transfer_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data, "(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result), user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_mifare_transfer(nfc_tag_h tag, int block_index,
-               nfc_mifare_transfer_completed_cb callback, void *user_data)
-{
-       int ret;
-       GVariant *parameter;
-
-       if (tag == NULL)
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_mifare_transfer(
-                               tag->handle,
-                               block_index,
-                               _net_nfc_manager_mifare_transfer,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
-
-static void _net_nfc_manager_mifare_restore(net_nfc_error_e result,
-               void *user_data)
-{
-       nfc_mifare_restore_completed_cb callback;
-       void *user_param;
-
-       if (user_data == NULL) {
-               return;
-       }
-
-       g_variant_get((GVariant*)user_data,"(uu)", (guint*)&callback, (guint*)&user_param);
-
-       if (callback != NULL) {
-               callback(_convert_error_code(__func__, result), user_param);
-       }
-
-       g_variant_unref((GVariant *)user_data);
-}
-
-int nfc_mifare_restore(nfc_tag_h tag, int block_index,
-               nfc_mifare_restore_completed_cb callback, void *user_data)
-{
-       int ret;
-       GVariant *parameter;
-
-       if (tag == NULL)
-               return _return_invalid_param(__func__);
-
-       if (!nfc_manager_is_activated())
-       {
-               return NFC_ERROR_NOT_ACTIVATED;
-       }
-
-       parameter = g_variant_new("(uu)",
-                       GPOINTER_TO_UINT(callback), GPOINTER_TO_UINT(user_data));
-       if (parameter != NULL) {
-               ret = net_nfc_client_mifare_restore(
-                               tag->handle,
-                               block_index,
-                               _net_nfc_manager_mifare_restore,
-                               parameter);
-               if (ret != NET_NFC_OK) {
-                       g_variant_unref(parameter);
-               }
-       } else {
-               ret = NET_NFC_ALLOC_FAIL;
-       }
-
-       return _convert_error_code(__func__, ret);
-}
diff --git a/src/nfc_card_emulation.c b/src/nfc_card_emulation.c
new file mode 100644 (file)
index 0000000..fdb7891
--- /dev/null
@@ -0,0 +1,418 @@
+/*
+* 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 "nfc_common.h"
+
+int nfc_se_open_secure_element_internal(
+       nfc_se_type_e se_type,
+       nfc_se_h *handle)
+{
+       net_nfc_error_e result;
+       net_nfc_se_type_e type;
+       net_nfc_target_handle_h temp = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(handle == NULL);
+
+       switch (se_type)
+       {
+       case NFC_SE_TYPE_ESE :
+               type = NET_NFC_SE_TYPE_ESE;
+               break;
+
+       case NFC_SE_TYPE_UICC :
+               type = NET_NFC_SE_TYPE_UICC;
+               break;
+
+       default:
+               return NFC_ERROR_INVALID_PARAMETER;
+               break;
+       }
+
+       result = net_nfc_client_se_open_internal_secure_element_sync(
+               type,
+               &temp);
+       if (result == NET_NFC_OK) {
+               *handle = (nfc_se_h)temp;
+       }
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+
+int nfc_se_send_apdu_internal(nfc_se_h handle,
+       unsigned char *cmd,
+       unsigned int cmd_len,
+       unsigned char **resp,
+       unsigned int *resp_len)
+{
+       net_nfc_error_e result;
+       data_h command = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(handle == NULL);
+       CHECK_INVALID(cmd == NULL);
+       CHECK_INVALID(cmd_len == 0);
+       CHECK_INVALID(resp == NULL);
+       CHECK_INVALID(resp_len == NULL);
+
+       if (cmd_len == 3 && cmd[0] == 'A' && cmd[1] == 'T' && cmd[2] == 'R') {
+               LOG_DEBUG("cheat... invoke get atr");
+               return nfc_se_get_atr_internal(handle, resp, resp_len);
+       }
+
+       *resp = NULL;
+       *resp_len = 0;
+
+       result = net_nfc_create_data(&command, cmd, cmd_len);
+       if (result == NET_NFC_OK) {
+               data_h response = NULL;
+
+               result = net_nfc_client_se_send_apdu_sync(
+                       (net_nfc_target_handle_h)handle,
+                       command,
+                       &response);
+               if (result == NET_NFC_OK && response != NULL) {
+                       uint8_t *buffer;
+                       uint32_t length;
+
+                       buffer = net_nfc_get_data_buffer(response);
+                       length = net_nfc_get_data_length(response);
+
+                       if (buffer != NULL && length > 0) {
+                               *resp = calloc(1, length);
+                               if (*resp != NULL) {
+                                       memcpy(*resp, buffer, length);
+                                       *resp_len = length;
+                               } else {
+                                       result = NET_NFC_ALLOC_FAIL;
+                               }
+                       } else {
+                               result = NET_NFC_NO_DATA_FOUND;
+                       }
+
+                       net_nfc_free_data(response);
+               }
+
+               net_nfc_free_data(command);
+       } else {
+               LOG_ERR("net_nfc_create_data failed, [%d]", result);
+       }
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+
+int nfc_se_get_atr_internal(nfc_se_h handle, unsigned char **atr, unsigned int *atr_len)
+{
+       net_nfc_error_e result;
+       data_h response = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(handle == NULL);
+       CHECK_INVALID(atr == NULL);
+       CHECK_INVALID(atr_len == NULL);
+
+       *atr = NULL;
+       *atr_len = 0;
+
+       result = net_nfc_client_se_get_atr_sync(
+               (net_nfc_target_handle_h)handle,
+               &response);
+       if (result == NET_NFC_OK && response != NULL) {
+               uint8_t *buffer;
+               uint32_t length;
+
+               buffer = net_nfc_get_data_buffer(response);
+               length = net_nfc_get_data_length(response);
+
+               if (buffer != NULL && length > 0) {
+                       *atr = calloc(1, length);
+                       if (*atr != NULL) {
+                               memcpy(*atr, buffer, length);
+                               *atr_len = length;
+                       } else {
+                               result = NET_NFC_ALLOC_FAIL;
+                       }
+               } else {
+                       result = NET_NFC_NO_DATA_FOUND;
+               }
+
+               net_nfc_free_data(response);
+       }
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_se_close_secure_element_internal(nfc_se_h handle)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_FEATURE);
+       CHECK_INIT();
+
+       result = net_nfc_client_se_close_internal_secure_element_sync(
+               (net_nfc_target_handle_h)handle);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_se_enable_card_emulation()
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_FEATURE);
+       CHECK_INIT();
+
+       result = net_nfc_set_card_emulation_mode_sync(NET_NFC_CARD_EMELATION_ENABLE);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_se_disable_card_emulation()
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_FEATURE);
+       CHECK_INIT();
+
+       result = net_nfc_set_card_emulation_mode_sync(NET_NFC_CARD_EMULATION_DISABLE);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_se_get_card_emulation_mode(nfc_se_card_emulation_mode_type_e *mode)
+{
+       net_nfc_error_e result;
+       net_nfc_card_emulation_mode_t se_mode;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(mode == NULL);
+
+       result = net_nfc_get_card_emulation_mode_sync(&se_mode);
+
+       switch(se_mode)
+       {
+       case NET_NFC_CARD_EMELATION_ENABLE :
+               *mode = NFC_SE_CARD_EMULATION_MODE_ON;
+               break;
+
+       case NET_NFC_CARD_EMULATION_DISABLE :
+               *mode = NFC_SE_CARD_EMULATION_MODE_OFF;
+               break;
+       }
+
+       return nfc_common_convert_error_code(__func__, result);;
+}
+
+int nfc_hce_send_apdu_response(nfc_se_h handle, unsigned char *resp, unsigned int resp_len)
+{
+       net_nfc_error_e result;
+       data_h data;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_HCE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(resp == NULL);
+       CHECK_INVALID(resp_len == 0);
+
+       result = net_nfc_create_data(&data, resp, resp_len);
+       if (result == NET_NFC_OK) {
+               result = net_nfc_client_hce_response_apdu_sync(handle, data);
+               net_nfc_free_data(data);
+       }
+       else {
+               LOG_ERR("net_nfc_create_data failed, [%d]", result);
+       }
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_se_set_default_route(nfc_se_type_e powered_on_status, nfc_se_type_e powered_off_status, nfc_se_type_e low_battery_status)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_HCE_FEATURE);
+       CHECK_INIT();
+
+       result = net_nfc_client_se_set_default_route_sync(powered_on_status, powered_off_status, low_battery_status);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_se_is_activated_handler_for_aid(nfc_se_type_e se_type, const char *aid, bool *is_activated_handler)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_HCE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(aid == NULL);
+       CHECK_INVALID(is_activated_handler == NULL);
+
+       result = net_nfc_client_se_is_activated_aid_handler_sync((net_nfc_se_type_e)se_type, aid, is_activated_handler);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_se_is_activated_handler_for_category(nfc_se_type_e se_type, nfc_card_emulation_category_type_e category, bool *is_activated_handler)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_HCE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(is_activated_handler == NULL);
+
+       result = net_nfc_client_se_is_activated_category_handler_sync((net_nfc_se_type_e)se_type, category, is_activated_handler);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_se_register_aid(nfc_se_type_e se_type, nfc_card_emulation_category_type_e category, const char *aid)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_HCE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(aid == NULL);
+
+       result = net_nfc_client_se_register_aids_sync((net_nfc_se_type_e)se_type, category, aid);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_se_unregister_aid(nfc_se_type_e se_type, nfc_card_emulation_category_type_e category, const char *aid)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_HCE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(aid == NULL);
+
+       result = net_nfc_client_se_unregister_aid_sync((net_nfc_se_type_e)se_type, category, aid);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_se_get_registered_aids_count(nfc_se_type_e se_type, nfc_card_emulation_category_type_e category, int *count)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_HCE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(count == NULL);
+
+       result = net_nfc_client_se_get_registered_aids_count_sync(
+                       (net_nfc_se_type_e)NFC_SE_TYPE_HCE,
+                       (net_nfc_card_emulation_category_t)category,
+                       (size_t *)count);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+static void _se_registered_aid_event_cb(net_nfc_se_type_e se_type,
+               const char *aid, bool readonly, void *user_data)
+{
+       LOG_BEGIN();
+
+       if (gdbus_nfc_context.on_se_registered_aid_cb != NULL) {
+               gdbus_nfc_context.on_se_registered_aid_cb(
+                       (nfc_se_type_e)se_type,
+                       aid,
+                       readonly,
+                       gdbus_nfc_context.on_se_registered_aid_cb_user_data);
+       }
+}
+
+int nfc_se_foreach_registered_aids(nfc_se_type_e se_type, nfc_card_emulation_category_type_e category, nfc_se_registered_aid_cb callback, void *user_data)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_HCE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(callback == NULL);
+
+       gdbus_nfc_context.on_se_registered_aid_cb = callback;
+       gdbus_nfc_context.on_se_registered_aid_cb_user_data = user_data;
+
+       result = net_nfc_client_se_foreach_registered_aids_sync((net_nfc_se_type_e)se_type,
+               (net_nfc_card_emulation_category_t)category,
+               (net_nfc_client_se_registered_aid_cb)_se_registered_aid_event_cb,
+               user_data);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_se_add_route_for_aid_internal(const char *aid, nfc_se_type_e se_type, const char* pkg_name, bool unlock_required,
+               nfc_se_power_type_e power, nfc_card_emulation_category_type_e category)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_HCE_FEATURE);
+       CHECK_INIT();
+
+       result = net_nfc_client_se_add_route_aid_sync(pkg_name, se_type, category, aid, unlock_required, power);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_se_remove_route_for_aid_internal(const char* pkg_name, const char *aid)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_HCE_FEATURE);
+       CHECK_INIT();
+
+       result = net_nfc_client_se_remove_route_aid_sync(pkg_name, aid);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
diff --git a/src/nfc_common.c b/src/nfc_common.c
new file mode 100644 (file)
index 0000000..0dfe109
--- /dev/null
@@ -0,0 +1,217 @@
+/*
+* 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 "nfc_common.h"
+
+pid_t nfc_common_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;
+}
+
+char * nfc_common_get_bt_address_string(data_h data)
+{
+       uint8_t *buffer;
+       uint32_t length;
+
+       if (data == NULL) {
+               return NULL;
+       }
+
+       buffer = net_nfc_get_data_buffer(data);
+       length = net_nfc_get_data_length(data);
+
+       if (buffer == NULL || length < 6) {
+               return NULL;
+       }
+
+       return g_strdup_printf("%02X:%02X:%02X:%02X:%02X:%02X",
+               buffer[0],
+               buffer[1],
+               buffer[2],
+               buffer[3],
+               buffer[4],
+               buffer[5]);
+}
+
+bool nfc_common_check_app_permission()
+{
+       pid_t focus_app_pid, current_app_pid;
+
+       focus_app_pid = nfc_common_get_focus_app_pid();
+       current_app_pid = getpgid(getpid());
+
+       LOGD("[check app permission] focus_app_pid [%d], current_app_pid [%d]", focus_app_pid,
+               current_app_pid);
+
+       return (focus_app_pid == current_app_pid) ? true : false;
+}
+
+int nfc_common_convert_error_code(const char *func, int native_error_code)
+{
+       int error_code = NFC_ERROR_NONE;
+       char *errorstr = NULL;
+
+       switch (native_error_code)
+       {
+               case NET_NFC_OK:
+                       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_NOT_CONNECTED:
+                       error_code = NFC_ERROR_NO_DEVICE;
+                       errorstr = "NO_DEVICE";
+                       break;
+
+               case NET_NFC_UNKNOWN_ERROR:
+               case NET_NFC_THREAD_CREATE_FAIL:
+               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_INSUFFICIENT_STORAGE:
+               case NET_NFC_NOT_INITIALIZED:
+               case NET_NFC_NOT_REGISTERED:
+                       error_code = NFC_ERROR_OPERATION_FAILED;
+                       errorstr = "OPERATION_FAILED";
+                       break;
+
+               case NET_NFC_SECURITY_FAIL:
+                       error_code = NFC_ERROR_SECURITY_RESTRICTED;
+                       errorstr = "SECURITY_RESTRICTED";
+                       break;
+
+               case NET_NFC_INVALID_STATE:
+                       error_code = NFC_ERROR_ILLEGAL_STATE;
+                       errorstr = "ILLEGAL_STATE";
+                       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;
+               case NET_NFC_PERMISSION_DENIED:
+                       error_code = NFC_ERROR_PERMISSION_DENIED;
+                       errorstr = "PERMISSION_DENIED";
+                       break;
+               case NET_NFC_NOT_ACTIVATED:
+                       error_code = NFC_ERROR_NOT_ACTIVATED;
+                       errorstr = "NOT_ACTIVATED";
+                       break;
+               default :
+                       error_code = NFC_ERROR_OPERATION_FAILED;
+                       errorstr = "OPERATION_FAILED";
+       }
+
+       if ( error_code != NFC_ERROR_NONE )
+               LOGE("NFC func : %s, %s(0x%08x)", func, errorstr, error_code);
+
+       return error_code;
+}
+
+bool nfc_common_is_initialized()
+{
+       return gdbus_nfc_context.initialized;
+}
+
+bool nfc_common_is_supported(char *str)
+{
+       int ret;
+       bool is_supported;
+
+       ret = system_info_get_platform_bool(str, &is_supported);
+
+       if(ret != 0)
+               return false;
+
+       return is_supported;
+}
+
+int nfc_common_get_rawdata_size(nfc_ndef_message_h ndef_message,
+       unsigned int *byte_size)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(ndef_message == NULL);
+       CHECK_INVALID(byte_size == NULL);
+
+       ret = net_nfc_get_ndef_message_byte_length(ndef_message,
+               (unsigned int *)byte_size);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
diff --git a/src/nfc_manager.c b/src/nfc_manager.c
new file mode 100644 (file)
index 0000000..760a31c
--- /dev/null
@@ -0,0 +1,925 @@
+/*
+* 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 "nfc_common.h"
+
+bool nfc_manager_is_supported(void)
+{
+       bool nfc_supported = false;
+
+       LOG_BEGIN();
+
+       nfc_supported = nfc_common_is_supported(NFC_FEATURE);
+
+       if(nfc_supported == true)
+               set_last_result(NFC_ERROR_NONE);
+       else
+               set_last_result(NFC_ERROR_NOT_SUPPORTED);
+
+       return nfc_supported;
+}
+
+static void _activation_changed_cb(net_nfc_error_e result, void *user_data)
+{
+       nfc_activation_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if(user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(nfc_common_convert_error_code(__func__, result), user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_manager_set_activation(bool activation,
+       nfc_activation_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+
+       if(nfc_manager_is_activated() == activation)
+       {
+               if (activation)
+               {
+                       ret = NFC_ERROR_ALREADY_ACTIVATED;
+               }
+               else
+               {
+                       ret = NFC_ERROR_ALREADY_DEACTIVATED;
+               }
+       }
+       else
+       {
+               GVariant *parameter;
+
+               parameter = g_variant_new("(uu)",
+                       callback,
+                       user_data);
+               if (parameter != NULL)
+               {
+                       ret = net_nfc_client_manager_set_active(activation,
+                               _activation_changed_cb,
+                               parameter);
+                       if (ret != NET_NFC_OK)
+                       {
+                               LOG_ERR("net_nfc_client_manager_set_active fail");
+
+                               g_variant_unref(parameter);
+                       }
+               }
+               else
+               {
+                       ret = NET_NFC_ALLOC_FAIL;
+               }
+
+               ret = nfc_common_convert_error_code(__func__, ret);
+       }
+
+       return ret;
+}
+
+bool nfc_manager_is_activated(void)
+{
+       int ret;
+       int activated = 0;
+
+       LOG_BEGIN();
+
+       if(nfc_common_is_supported(NFC_FEATURE) == false)
+       {
+               set_last_result(NFC_ERROR_NOT_SUPPORTED);
+               return false;
+       }
+
+       ret = net_nfc_client_get_nfc_state(&activated);
+
+       set_last_result(nfc_common_convert_error_code(__func__,ret));
+
+       return (!!activated);
+}
+
+int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback,
+       void *user_data)
+{
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(callback == NULL);
+
+       net_nfc_client_manager_set_activated(callback, user_data);
+
+       return NFC_ERROR_NONE;
+}
+
+void nfc_manager_unset_activation_changed_cb(void)
+{
+       LOG_BEGIN();
+
+       if(nfc_common_is_supported(NFC_FEATURE) == false)
+       {
+               LOG_ERR("NFC not supported");
+               set_last_result(NFC_ERROR_NOT_SUPPORTED);
+               return;
+       }
+
+       if(nfc_common_is_initialized() == false)
+       {
+               LOG_ERR("NFC not initialized");
+               set_last_result(NFC_ERROR_NOT_INITIALIZED);
+               return;
+       }
+
+       net_nfc_client_manager_unset_activated();
+
+       set_last_result(NFC_ERROR_NONE);
+}
+
+int nfc_manager_initialize(void)
+{
+       int ret = NET_NFC_OK;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+
+       if(!nfc_common_is_initialized())
+       {
+               ret = net_nfc_client_initialize();
+               if (ret != NET_NFC_OK)
+                       return nfc_common_convert_error_code(__func__, ret);
+
+               memset(&gdbus_nfc_context, 0, sizeof(gdbus_nfc_context));
+
+               gdbus_nfc_context.initialized = true;
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_manager_deinitialize (void)
+{
+       int ret = NET_NFC_OK;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+
+       if(nfc_common_is_initialized())
+       {
+               net_nfc_client_se_unset_event_cb();
+
+               net_nfc_client_p2p_unset_device_discovered();
+               net_nfc_client_p2p_unset_device_detached();
+
+               net_nfc_client_tag_unset_tag_discovered();
+               net_nfc_client_tag_unset_tag_detached();
+
+               ret = net_nfc_client_deinitialize();
+
+               gdbus_nfc_context.initialized = false;
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _tag_discovered_cb(net_nfc_target_info_h info, void *user_data)
+{
+       LOG_BEGIN();
+
+       gdbus_nfc_context.current_tag = info;
+
+       if(gdbus_nfc_context.on_tag_discovered_cb != NULL) {
+               gdbus_nfc_context.on_tag_discovered_cb(
+                       NFC_DISCOVERED_TYPE_ATTACHED,
+                       (nfc_tag_h)gdbus_nfc_context.current_tag,
+                       gdbus_nfc_context.on_tag_discovered_user_data);
+       }
+
+       /* ndef discovered cb */
+       if(gdbus_nfc_context.on_ndef_discovered_cb)
+       {
+               ndef_message_h ndef_message = NULL;
+
+               if (net_nfc_get_tag_ndef_message((net_nfc_target_info_h)info,
+                       &ndef_message) == NET_NFC_OK) {
+                       gdbus_nfc_context.on_ndef_discovered_cb(ndef_message,
+                               gdbus_nfc_context.on_ndef_discovered_user_data);
+
+                       net_nfc_free_ndef_message(ndef_message);
+               }
+       }
+}
+
+static void _tag_detached_cb(void *user_data)
+{
+       LOG_BEGIN();
+
+       if(gdbus_nfc_context.on_tag_discovered_cb != NULL) {
+               gdbus_nfc_context.on_tag_discovered_cb(
+                       NFC_DISCOVERED_TYPE_DETACHED,
+                       (nfc_tag_h)gdbus_nfc_context.current_tag,
+                       gdbus_nfc_context.on_tag_discovered_user_data);
+       }
+
+       gdbus_nfc_context.current_tag = NULL;
+}
+
+int nfc_manager_set_ndef_discovered_cb(
+       nfc_ndef_discovered_cb callback,
+       void *user_data)
+{
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(callback == NULL);
+
+       net_nfc_client_tag_set_tag_discovered(_tag_discovered_cb, NULL);
+       net_nfc_client_tag_set_tag_detached(_tag_detached_cb, NULL);
+
+       gdbus_nfc_context.on_ndef_discovered_cb = callback;
+       gdbus_nfc_context.on_ndef_discovered_user_data = user_data;
+
+       return NFC_ERROR_NONE;
+}
+
+void nfc_manager_unset_ndef_discovered_cb( void )
+{
+       LOG_BEGIN();
+
+       if(nfc_common_is_supported(NFC_FEATURE) == false)
+       {
+               LOG_ERR("NFC not supported");
+               set_last_result(NFC_ERROR_NOT_SUPPORTED);
+               return;
+       }
+
+       if(nfc_common_is_initialized() == false)
+       {
+               LOG_ERR("NFC not initialized");
+               set_last_result(NFC_ERROR_NOT_INITIALIZED);
+               return;
+       }
+
+       gdbus_nfc_context.on_ndef_discovered_cb = NULL;
+       gdbus_nfc_context.on_ndef_discovered_user_data = NULL;
+
+       set_last_result(NFC_ERROR_NONE);
+}
+
+void nfc_manager_set_tag_filter(int filter)
+{
+       LOG_BEGIN();
+
+       if(nfc_common_is_supported(NFC_TAG_FEATURE) == false)
+       {
+               LOG_ERR("NFC not supported");
+               set_last_result(NFC_ERROR_NOT_SUPPORTED);
+               return;
+       }
+
+       if(nfc_common_is_initialized() == false)
+       {
+               LOG_ERR("NFC not initialized");
+               set_last_result(NFC_ERROR_NOT_INITIALIZED);
+               return;
+       }
+
+       if(filter < NET_NFC_ALL_DISABLE)
+       {
+               LOG_ERR("Invalid parameter");
+               set_last_result(NFC_ERROR_INVALID_PARAMETER);
+               return;
+       }
+
+       net_nfc_client_tag_set_filter(filter);
+
+       set_last_result(NFC_ERROR_NONE);
+}
+
+int nfc_manager_get_tag_filter(void)
+{
+       LOG_BEGIN();
+
+       if(nfc_common_is_supported(NFC_TAG_FEATURE) == false)
+       {
+               LOG_ERR("NFC not supported");
+               set_last_result(NFC_ERROR_NOT_SUPPORTED);
+               return 0;
+       }
+
+       if(nfc_common_is_initialized() == false)
+       {
+               LOG_ERR("NFC not initialized");
+               set_last_result(NFC_ERROR_NOT_INITIALIZED);
+               return 0;
+       }
+
+       set_last_result(NFC_ERROR_NONE);
+
+       return net_nfc_client_tag_get_filter();
+}
+
+int nfc_manager_get_connected_tag(nfc_tag_h *tag)
+{
+       int ret;
+       net_nfc_target_info_h result = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+
+       *tag = NULL;
+
+       net_nfc_client_tag_set_tag_discovered(_tag_discovered_cb, NULL);
+       net_nfc_client_tag_set_tag_detached(_tag_detached_cb, NULL);
+
+
+       if(gdbus_nfc_context.current_tag == NULL) {
+               ret = net_nfc_client_tag_get_current_tag_info_sync(&result);
+               if (ret == NET_NFC_OK) {
+                       *tag = (nfc_tag_h)result;
+               }
+       } else {
+               /* FIXME ??? */
+               *tag = gdbus_nfc_context.current_tag;
+
+               ret = NET_NFC_OK;
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_manager_get_connected_target(nfc_p2p_target_h *target)
+{
+       int ret;
+       net_nfc_target_handle_h result = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(target == NULL);
+
+       *target = NULL;
+
+       net_nfc_client_tag_set_tag_discovered(_tag_discovered_cb, NULL);
+       net_nfc_client_tag_set_tag_detached(_tag_detached_cb, NULL);
+
+       if(gdbus_nfc_context.current_target == NULL) {
+               ret = net_nfc_client_tag_get_current_target_handle_sync(&result);
+               if (ret == NET_NFC_OK) {
+                       gdbus_nfc_context.current_target = result;
+
+                       *target = gdbus_nfc_context.current_target;
+               }
+       } else {
+               /* FIXME ??? */
+               *target = gdbus_nfc_context.current_target;
+
+               ret = NET_NFC_OK;
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_manager_set_tag_discovered_cb(nfc_tag_discovered_cb callback,
+       void *user_data)
+{
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(callback == NULL);
+
+       net_nfc_client_tag_set_tag_discovered(_tag_discovered_cb, NULL);
+       net_nfc_client_tag_set_tag_detached(_tag_detached_cb, NULL);
+
+       gdbus_nfc_context.on_tag_discovered_cb = callback;
+       gdbus_nfc_context.on_tag_discovered_user_data = user_data;
+
+       return NFC_ERROR_NONE;
+}
+
+void nfc_manager_unset_tag_discovered_cb(void)
+{
+       LOG_BEGIN();
+
+       if(nfc_common_is_supported(NFC_TAG_FEATURE) == false)
+       {
+               LOG_ERR("NFC not supported");
+               set_last_result(NFC_ERROR_NOT_SUPPORTED);
+               return;
+       }
+
+       if(nfc_common_is_initialized() == false)
+       {
+               LOG_ERR("NFC not initialized");
+               set_last_result(NFC_ERROR_NOT_INITIALIZED);
+               return;
+       }
+
+       gdbus_nfc_context.on_tag_discovered_cb = NULL;
+       gdbus_nfc_context.on_tag_discovered_user_data = NULL;
+
+       set_last_result(NFC_ERROR_NONE);
+}
+
+static void _p2p_discovered_cb(
+       net_nfc_target_handle_h handle_info,
+       void *user_data)
+{
+       LOG_BEGIN();
+
+       gdbus_nfc_context.current_target = handle_info;
+
+       if(gdbus_nfc_context.on_p2p_target_discovered_cb != NULL) {
+               gdbus_nfc_context.on_p2p_target_discovered_cb(
+                       NFC_DISCOVERED_TYPE_ATTACHED,
+                       (nfc_p2p_target_h)gdbus_nfc_context.current_target,
+                       gdbus_nfc_context.on_p2p_target_discovered_user_data);
+       }
+}
+
+static void _p2p_detached_cb(void *user_data)
+{
+       nfc_p2p_target_h handle =
+               (nfc_p2p_target_h)gdbus_nfc_context.current_target;
+
+       LOG_BEGIN();
+
+       if(gdbus_nfc_context.on_p2p_target_discovered_cb != NULL) {
+               gdbus_nfc_context.on_p2p_target_discovered_cb(
+                       NFC_DISCOVERED_TYPE_DETACHED,
+                       handle,
+                       gdbus_nfc_context.on_p2p_target_discovered_user_data);
+       }
+
+       /* unset data_received callback */
+       nfc_p2p_unset_data_received_cb(handle);
+
+       gdbus_nfc_context.current_target = NULL;
+}
+
+int nfc_manager_set_p2p_target_discovered_cb(
+       nfc_p2p_target_discovered_cb callback,
+       void *user_data)
+{
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(callback == NULL);
+
+       net_nfc_client_p2p_set_device_discovered(_p2p_discovered_cb, NULL);
+       net_nfc_client_p2p_set_device_detached(_p2p_detached_cb, NULL);
+
+       gdbus_nfc_context.on_p2p_target_discovered_cb = callback;
+       gdbus_nfc_context.on_p2p_target_discovered_user_data = user_data;
+
+       return NFC_ERROR_NONE;
+}
+
+void nfc_manager_unset_p2p_target_discovered_cb(void)
+{
+       LOG_BEGIN();
+
+       if(nfc_common_is_supported(NFC_P2P_FEATURE) == false)
+       {
+               LOG_ERR("NFC not supported");
+               set_last_result(NFC_ERROR_NOT_SUPPORTED);
+               return;
+       }
+
+       if(nfc_common_is_initialized() == false)
+       {
+               LOG_ERR("NFC not initialized");
+               set_last_result(NFC_ERROR_NOT_INITIALIZED);
+               return;
+       }
+
+       gdbus_nfc_context.on_p2p_target_discovered_cb = NULL;
+       gdbus_nfc_context.on_p2p_target_discovered_user_data = NULL;
+
+       set_last_result(NFC_ERROR_NONE);
+}
+
+int nfc_manager_set_system_handler_enable(bool enable)
+{
+       int ret;
+       int state;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+
+       if (enable == true) {
+               state = 0;
+       } else {
+               state = 1;
+       }
+
+       ret = net_nfc_client_sys_handler_set_launch_popup_state(state);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_manager_set_system_handler_enable_force(bool enable)
+{
+       int ret;
+       int state;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+
+       if (enable == true) {
+               state = 0;
+       } else {
+               state = 1;
+       }
+
+       ret = net_nfc_client_sys_handler_set_launch_popup_state_force(state);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+bool nfc_manager_is_system_handler_enabled(void)
+{
+       int ret;
+       int state = 0;
+
+       LOG_BEGIN();
+
+       if(nfc_common_is_supported(NFC_FEATURE) == false)
+       {
+               LOG_ERR("NFC not supported");
+               set_last_result(NFC_ERROR_NOT_SUPPORTED);
+               return false;
+       }
+
+       if(nfc_common_is_initialized() == false)
+       {
+               LOG_ERR("NFC not initialized");
+               set_last_result(NFC_ERROR_NOT_INITIALIZED);
+               return false;
+       }
+
+       ret = net_nfc_client_sys_handler_get_launch_popup_state(&state);
+
+       set_last_result(nfc_common_convert_error_code(__func__,ret));
+
+       return (state == 0);
+}
+
+int nfc_manager_get_cached_message(nfc_ndef_message_h *ndef_message)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(ndef_message == NULL);
+
+       ret = net_nfc_retrieve_current_ndef_message(ndef_message);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _se_event_cb(net_nfc_message_e message, void *user_data)
+{
+       LOG_BEGIN();
+
+       if (gdbus_nfc_context.on_se_event_cb != NULL) {
+               if(message == NET_NFC_MESSAGE_SE_CARD_EMULATION_CHANGED)
+                       gdbus_nfc_context.on_se_event_cb(
+                               NFC_SE_EVENT_CARD_EMULATION_CHANGED,
+                               gdbus_nfc_context.on_se_event_user_data);
+
+               else if(message == NET_NFC_MESSAGE_SE_TYPE_CHANGED)
+                       gdbus_nfc_context.on_se_event_cb(
+                               NFC_SE_EVENT_SE_TYPE_CHANGED,
+                               gdbus_nfc_context.on_se_event_user_data);
+               else if(message == NET_NFC_MESSAGE_SE_FIELD_ON)
+                       gdbus_nfc_context.on_se_event_cb(
+                               NFC_SE_EVENT_FIELD_ON,
+                               gdbus_nfc_context.on_se_event_user_data);
+       }
+}
+
+int nfc_manager_set_se_event_cb(nfc_se_event_cb callback, void *user_data)
+{
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(callback == NULL);
+
+       net_nfc_client_se_set_event_cb(_se_event_cb, NULL);
+
+       gdbus_nfc_context.on_se_event_cb = callback;
+       gdbus_nfc_context.on_se_event_user_data = user_data;
+
+       return NFC_ERROR_NONE;
+}
+
+void nfc_manager_unset_se_event_cb(void)
+{
+       LOG_BEGIN();
+
+       if(nfc_common_is_supported(NFC_CE_FEATURE) == false)
+       {
+               LOG_ERR("NFC not supported");
+               set_last_result(NFC_ERROR_NOT_SUPPORTED);
+               return;
+       }
+
+       if(nfc_common_is_initialized() == false)
+       {
+               LOG_ERR("NFC not initialized");
+               set_last_result(NFC_ERROR_NOT_INITIALIZED);
+               return;
+       }
+
+       gdbus_nfc_context.on_se_event_cb = NULL;
+       gdbus_nfc_context.on_se_event_user_data = NULL;
+
+       set_last_result(NFC_ERROR_NONE);
+}
+
+static void _se_transaction_event_cb(net_nfc_se_type_e se_type, data_h aid,
+       data_h param, void *user_data)
+{
+       LOG_BEGIN();
+
+       if (gdbus_nfc_context.on_se_transaction_event_cb != NULL) {
+               gdbus_nfc_context.on_se_transaction_event_cb(
+                       se_type,
+                       net_nfc_get_data_buffer(aid),
+                       net_nfc_get_data_length(aid),
+                       net_nfc_get_data_buffer(param),
+                       net_nfc_get_data_length(param),
+                       gdbus_nfc_context.on_se_transaction_event_user_data);
+       }
+}
+
+int nfc_manager_set_se_transaction_event_cb(
+       nfc_se_type_e se_type,
+       nfc_se_transaction_event_cb callback,
+       void *user_data)
+{
+       net_nfc_se_type_e type = NET_NFC_SE_TYPE_NONE;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(callback == NULL);
+
+       gdbus_nfc_context.on_se_transaction_event_cb = callback;
+       gdbus_nfc_context.on_se_transaction_event_user_data = user_data;
+
+       switch(se_type)
+       {
+               case NFC_SE_TYPE_ESE:
+                       type = NET_NFC_SE_TYPE_ESE;
+                       break;
+
+               case NFC_SE_TYPE_UICC:
+                       type = NET_NFC_SE_TYPE_UICC;
+                       break;
+               case NET_NFC_SE_TYPE_HCE:
+                       type = NET_NFC_SE_TYPE_HCE;
+                       break;
+               default:
+                       return NFC_ERROR_INVALID_PARAMETER;
+                       break;
+
+       }
+
+       net_nfc_client_se_set_transaction_event_cb(type, _se_transaction_event_cb, user_data);
+
+       return NFC_ERROR_NONE;
+}
+
+void nfc_manager_unset_se_transaction_event_cb(nfc_se_type_e se_type)
+{
+       net_nfc_se_type_e type = NET_NFC_SE_TYPE_NONE;
+
+       LOG_BEGIN();
+
+       if(nfc_common_is_supported(NFC_CE_FEATURE) == false)
+       {
+               LOG_ERR("NFC not supported");
+               set_last_result(NFC_ERROR_NOT_SUPPORTED);
+               return;
+       }
+
+       if(nfc_common_is_initialized() == false)
+       {
+               LOG_ERR("NFC not initialized");
+               set_last_result(NFC_ERROR_NOT_INITIALIZED);
+               return;
+       }
+
+       switch(se_type)
+       {
+               case NFC_SE_TYPE_ESE:
+                       type = NET_NFC_SE_TYPE_ESE;
+                       break;
+
+               case NFC_SE_TYPE_UICC:
+                       type = NET_NFC_SE_TYPE_UICC;
+                       break;
+               default:
+                       type = NET_NFC_SE_TYPE_NONE;
+                       break;
+       }
+
+       net_nfc_client_se_unset_transaction_event_cb(type);
+
+       set_last_result(NFC_ERROR_NONE);
+}
+
+int nfc_manager_enable_transaction_fg_dispatch()
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_FEATURE);
+       CHECK_INIT();
+
+       result = net_nfc_client_se_set_transaction_fg_dispatch(true);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_manager_disable_transaction_fg_dispatch()
+{
+       net_nfc_error_e result;
+
+       CHECK_SUPPORTED(NFC_CE_FEATURE);
+       CHECK_INIT();
+
+       result = net_nfc_client_se_set_transaction_fg_dispatch(false);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+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;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(type < NFC_SE_TYPE_DISABLE);
+       CHECK_INVALID(type > NFC_SE_TYPE_HCE);
+
+       switch (type)
+       {
+       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;
+       case NFC_SE_TYPE_HCE :
+               se_type = NET_NFC_SE_TYPE_HCE;
+               break;
+       default :
+               se_type = NET_NFC_SE_TYPE_NONE;
+               break;
+       }
+
+       ret = net_nfc_client_se_set_secure_element_type_sync(se_type);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_manager_get_se_type(nfc_se_type_e *type)
+{
+       int ret;
+       net_nfc_se_type_e se_type = NET_NFC_SE_TYPE_NONE;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(type == NULL);
+
+       ret = net_nfc_client_se_get_secure_element_type_sync(&se_type);
+
+       switch (se_type)
+       {
+               case NET_NFC_SE_TYPE_ESE :
+                       *type = NFC_SE_TYPE_ESE;
+                       break;
+               case NET_NFC_SE_TYPE_UICC :
+                       *type = NFC_SE_TYPE_UICC;
+                       break;
+               case NET_NFC_SE_TYPE_HCE :
+                       *type = NFC_SE_TYPE_HCE;
+                       break;
+               default:
+                       *type = NFC_SE_TYPE_DISABLE;
+                       break;
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _hce_event_cb(net_nfc_target_handle_h handle,
+               net_nfc_hce_event_t event, data_h apdu, void *user_data)
+{
+       LOG_BEGIN();
+
+       if (gdbus_nfc_context.on_hce_event_cb != NULL) {
+               gdbus_nfc_context.on_hce_event_cb(
+                       (nfc_se_h)handle,
+                       (nfc_hce_event_type_e)event,
+                       net_nfc_get_data_buffer(apdu),
+                       net_nfc_get_data_length(apdu),
+                       gdbus_nfc_context.on_hce_event_user_data);
+       }
+}
+
+int nfc_manager_set_hce_event_cb(nfc_hce_event_cb callback, void *user_data)
+{
+       net_nfc_error_e result;
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_CE_HCE_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(callback == NULL);
+
+       gdbus_nfc_context.on_hce_event_cb = callback;
+       gdbus_nfc_context.on_hce_event_user_data = user_data;
+
+       result = net_nfc_client_hce_set_event_received_cb(_hce_event_cb, user_data);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+void nfc_manager_unset_hce_event_cb(void)
+{
+       LOG_BEGIN();
+
+       if(nfc_common_is_supported(NFC_CE_HCE_FEATURE) == false)
+       {
+               LOG_ERR("NFC not supported");
+               set_last_result(NFC_ERROR_NOT_SUPPORTED);
+               return;
+       }
+
+       if(nfc_common_is_initialized() == false)
+       {
+               LOG_ERR("NFC not initialized");
+               set_last_result(NFC_ERROR_NOT_INITIALIZED);
+               return;
+       }
+
+       net_nfc_client_hce_unset_event_received_cb();
+
+       set_last_result(NFC_ERROR_NONE);
+}
+
diff --git a/src/nfc_ndef.c b/src/nfc_ndef.c
new file mode 100644 (file)
index 0000000..446f386
--- /dev/null
@@ -0,0 +1,596 @@
+/*
+* 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 "nfc_common.h"
+
+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,
+       unsigned int payload_size)
+{
+       int ret;
+       data_h type_data = NULL;
+       data_h id_data = NULL;
+       data_h payload_data = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+
+       net_nfc_create_data(&type_data, type, type_size);
+
+       if (id != NULL && id_size > 0) {
+               net_nfc_create_data(&id_data, id, id_size);
+       }
+
+       if (payload != NULL && payload_size > 0) {
+               net_nfc_create_data(&payload_data, payload, payload_size);
+       }
+
+       ret = net_nfc_create_record(
+               (ndef_record_h *)record,
+               tnf,
+               type_data,
+               id_data,
+               payload_data);
+
+       if (payload_data != NULL) {
+               net_nfc_free_data(payload_data);
+       }
+
+       if (id_data != NULL) {
+               net_nfc_free_data(id_data);
+       }
+
+       net_nfc_free_data(type_data);
+
+       return nfc_common_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;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+       CHECK_INVALID(text == NULL);
+       CHECK_INVALID(lang_code == NULL);
+
+       ret = net_nfc_create_text_type_record(
+               (ndef_record_h *)record,
+               text,
+               lang_code,
+               encode);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_create_uri(nfc_ndef_record_h *record,
+       const char *uri)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+       CHECK_INVALID(uri == NULL);
+
+       ret = net_nfc_create_uri_type_record(
+               (ndef_record_h *)record,
+               uri,
+               NET_NFC_SCHEMA_FULL_URI);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_create_mime(nfc_ndef_record_h *record,
+       const char *mime_type,
+       const unsigned char *data,
+       unsigned int data_size)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+       CHECK_INVALID(mime_type == NULL);
+       CHECK_INVALID(data == NULL);
+       CHECK_INVALID(data_size <= 0);
+
+       ret = nfc_ndef_record_create(record,
+               NFC_RECORD_TNF_MIME_MEDIA,
+               (unsigned char *)mime_type,
+               strlen(mime_type),
+               NULL,
+               0,
+               data,
+               data_size);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_mime_type(nfc_ndef_record_h record,
+       char **mime_type)
+{
+       int ret;
+       nfc_record_tnf_e tnf;
+       unsigned char *typename;
+       int length;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+       CHECK_INVALID(mime_type == NULL);
+
+       if (nfc_ndef_record_get_tnf(record, &tnf) != NET_NFC_OK ||
+               tnf != NFC_RECORD_TNF_MIME_MEDIA)
+                       {
+               return NFC_ERROR_INVALID_RECORD_TYPE;
+       }
+
+       ret = nfc_ndef_record_get_type(record, &typename, &length);
+       if (ret == NET_NFC_OK) {
+               *mime_type = calloc(1, length + 1);
+               if (*mime_type != NULL) {
+                       memcpy(*mime_type, typename, length);
+               } else {
+                       ret = NET_NFC_ALLOC_FAIL;
+               }
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_destroy(nfc_ndef_record_h record)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+
+       ret = net_nfc_free_record(record);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_set_id(nfc_ndef_record_h record,
+       unsigned char *id,
+       int id_size)
+{
+       int ret;
+       data_h id_data = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+       CHECK_INVALID(id == NULL);
+
+       ret = net_nfc_create_data(&id_data, id, id_size);
+       if (ret == NET_NFC_OK) {
+               ret = net_nfc_set_record_id(record, id_data);
+
+               net_nfc_free_data(id_data);
+       } else {
+               LOG_ERR("net_nfc_create_data failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_payload(nfc_ndef_record_h record,
+       unsigned char **payload,
+       unsigned int *size)
+{
+       int ret;
+       data_h payload_data;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+       CHECK_INVALID(payload == NULL);
+       CHECK_INVALID(size == NULL);
+
+       *payload = NULL;
+       *size = 0;
+
+       ret = net_nfc_get_record_payload(record, &payload_data);
+       if (ret == NET_NFC_OK) {
+               *payload = net_nfc_get_data_buffer(payload_data);
+               *size = net_nfc_get_data_length(payload_data);
+       } else {
+               *payload = NULL;
+               *size = 0;
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_type(nfc_ndef_record_h record,
+       unsigned char **type,
+       int *size)
+{
+       int ret;
+       data_h type_data;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+       CHECK_INVALID(type == NULL);
+       CHECK_INVALID(size == NULL);
+
+       *type = NULL;
+       *size = 0;
+
+       ret = net_nfc_get_record_type(record, &type_data);
+       if (ret == NET_NFC_OK) {
+               *type = net_nfc_get_data_buffer(type_data);
+               *size = net_nfc_get_data_length(type_data);
+       } else {
+               *type = NULL;
+               *size = 0;
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_id(nfc_ndef_record_h record,
+       unsigned char **id,
+       int *size)
+{
+       int ret;
+       data_h id_data;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+       CHECK_INVALID(id == NULL);
+       CHECK_INVALID(size == NULL);
+
+       *id = NULL;
+       *size = 0;
+
+       ret = net_nfc_get_record_id(record, &id_data);
+       if (ret == NET_NFC_OK) {
+               *id = net_nfc_get_data_buffer(id_data);
+               *size = net_nfc_get_data_length(id_data);
+       } else {
+               *id = NULL;
+               *size = 0;
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_tnf(nfc_ndef_record_h record, nfc_record_tnf_e *tnf)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+       CHECK_INVALID(tnf == NULL);
+
+       ret = net_nfc_get_record_tnf(record, (net_nfc_record_tnf_e *)tnf);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_text(nfc_ndef_record_h record, char **buffer)
+{
+       int ret;
+       unsigned char* record_type = NULL;
+       int type_size = 0;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+       CHECK_INVALID(buffer == NULL);
+
+       ret = nfc_ndef_record_get_type(record, &record_type, &type_size);
+
+       if (ret == NFC_ERROR_NONE && record_type != NULL && type_size != 0 &&
+                               !strcmp((char*)record_type, "T"))
+       {
+               LOG_ERR("record type is T");
+               ret = net_nfc_create_text_string_from_text_record(record, buffer);
+       }
+       else
+       {
+               LOG_ERR("record type is not T");
+               return NFC_ERROR_INVALID_RECORD_TYPE;
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_langcode(nfc_ndef_record_h record, char **lang_code)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+       CHECK_INVALID(lang_code == NULL);
+
+       ret = net_nfc_get_languange_code_string_from_text_record(record, lang_code);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_encode_type(
+       nfc_ndef_record_h record,
+       nfc_encode_type_e *encode)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+       CHECK_INVALID(encode == NULL);
+
+       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 nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_record_get_uri(nfc_ndef_record_h record, char **uri)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(record == NULL);
+       CHECK_INVALID(uri == NULL);
+
+       ret = net_nfc_create_uri_string_from_uri_record(record, uri);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_create(nfc_ndef_message_h *ndef_message)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(ndef_message == NULL);
+
+       ret = net_nfc_create_ndef_message(ndef_message);
+
+       return nfc_common_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;
+       data_h rawdata_data = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(ndef_message == NULL);
+       CHECK_INVALID(rawdata == NULL);
+       CHECK_INVALID(rawdata_size <= 0);
+
+       ret = net_nfc_create_data(&rawdata_data, rawdata, rawdata_size);
+       if (ret == NET_NFC_OK) {
+               ret = net_nfc_create_ndef_message_from_rawdata(
+                       (ndef_message_h *)ndef_message,
+                       rawdata_data);
+
+               net_nfc_free_data(rawdata_data);
+       } else {
+               LOG_ERR("net_nfc_create_data failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_destroy(nfc_ndef_message_h ndef_message)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(ndef_message == NULL);
+
+       ret = net_nfc_free_ndef_message(ndef_message);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_get_record_count(nfc_ndef_message_h ndef_message,
+       int *count)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(ndef_message == NULL);
+       CHECK_INVALID(count == NULL);
+
+       ret = net_nfc_get_ndef_message_record_count(ndef_message, count);
+
+       return nfc_common_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;
+       data_h rawdata_data;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(ndef_message == NULL);
+       CHECK_INVALID(rawdata == NULL);
+       CHECK_INVALID(rawdata_size == NULL);
+
+       *rawdata = NULL;
+       *rawdata_size = 0;
+
+       ret = net_nfc_create_rawdata_from_ndef_message(ndef_message,
+               &rawdata_data);
+       if (ret == NET_NFC_OK) {
+               uint8_t *buffer;
+               uint32_t length;
+
+               buffer = net_nfc_get_data_buffer(rawdata_data);
+               length = net_nfc_get_data_length(rawdata_data);
+
+               *rawdata = calloc(1, length);
+               if (*rawdata != NULL) {
+                       memcpy(*rawdata, buffer, length);
+                       *rawdata_size = length;
+               } else {
+                       ret = NET_NFC_ALLOC_FAIL;
+               }
+
+               net_nfc_free_data(rawdata_data);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_append_record(nfc_ndef_message_h ndef_message,
+       nfc_ndef_record_h record)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(ndef_message == NULL);
+       CHECK_INVALID(record == NULL);
+
+       ret = net_nfc_append_record_to_ndef_message(ndef_message, record);
+
+       return nfc_common_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;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(ndef_message == NULL);
+       CHECK_INVALID(record == NULL);
+
+       ret = net_nfc_append_record_by_index(ndef_message, index, record);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_ndef_message_remove_record(nfc_ndef_message_h ndef_message,
+       int index)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(ndef_message == NULL);
+
+       ret = net_nfc_remove_record_by_index(ndef_message, index);
+
+       return nfc_common_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;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(ndef_message == NULL);
+       CHECK_INVALID(record == NULL);
+
+       ret = net_nfc_get_record_by_index(ndef_message,
+               index,
+               (ndef_record_h*)record);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
diff --git a/src/nfc_p2p.c b/src/nfc_p2p.c
new file mode 100644 (file)
index 0000000..656b957
--- /dev/null
@@ -0,0 +1,543 @@
+/*
+* 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 "nfc_common.h"
+
+static void _p2p_send_cb(net_nfc_error_e result, void *user_data)
+{
+       nfc_p2p_send_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(nfc_common_convert_error_code(__func__, result), user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_p2p_send(nfc_p2p_target_h target,
+       nfc_ndef_message_h message,
+       nfc_p2p_send_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       data_h rawdata;
+       GVariant *parameter;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(message == NULL);
+       CHECK_INVALID(target == NULL);
+       CHECK_ACTIVATED();
+       CHECK_APP_PERMISSION();
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               net_nfc_create_rawdata_from_ndef_message(message, &rawdata);
+               ret = net_nfc_client_p2p_send((net_nfc_target_handle_h)target,
+                       rawdata,
+                       _p2p_send_cb,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+
+               net_nfc_free_data(rawdata);
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_p2p_send_no_permission(
+       nfc_p2p_target_h target,
+       nfc_ndef_message_h message,
+       nfc_p2p_send_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       data_h rawdata;
+       GVariant *parameter;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(target == NULL);
+       CHECK_INVALID(message == NULL);
+       CHECK_ACTIVATED();
+
+       /* skip check app permission */
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               net_nfc_create_rawdata_from_ndef_message(message, &rawdata);
+               ret = net_nfc_client_p2p_send((net_nfc_target_handle_h)target,
+                       rawdata,
+                       _p2p_send_cb,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+
+               net_nfc_free_data(rawdata);
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _p2p_set_data_received_cb(data_h data, void *user_data)
+{
+       LOG_BEGIN();
+
+       if (gdbus_nfc_context.on_p2p_recv_cb != NULL)
+       {
+               ndef_message_h ndef_message;
+
+               net_nfc_create_ndef_message_from_rawdata(&ndef_message, data);
+
+               gdbus_nfc_context.on_p2p_recv_cb(
+                       (nfc_p2p_target_h)(gdbus_nfc_context.current_target),
+                       ndef_message,
+                       gdbus_nfc_context.on_p2p_recv_user_data);
+
+               net_nfc_free_ndef_message(ndef_message);
+       }
+}
+
+int nfc_p2p_set_data_received_cb(nfc_p2p_target_h target,
+       nfc_p2p_data_received_cb callback,
+       void *user_data)
+{
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(target == NULL);
+       CHECK_INVALID(callback == NULL);
+       CHECK_INVALID(gdbus_nfc_context.current_target != target);
+
+       gdbus_nfc_context.on_p2p_recv_cb = callback;
+       gdbus_nfc_context.on_p2p_recv_user_data = user_data;
+
+       net_nfc_client_p2p_set_data_received(_p2p_set_data_received_cb, NULL);
+
+       return NFC_ERROR_NONE;
+}
+
+int nfc_p2p_unset_data_received_cb(nfc_p2p_target_h target)
+{
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(target == NULL);
+       CHECK_INVALID(gdbus_nfc_context.current_target != target);
+
+       net_nfc_client_p2p_unset_data_received();
+
+       gdbus_nfc_context.on_p2p_recv_cb = NULL;
+       gdbus_nfc_context.on_p2p_recv_user_data = NULL;
+
+       return NFC_ERROR_NONE;
+}
+
+static void _snep_start_server_cb(
+       net_nfc_snep_handle_h arg_handle,
+       net_nfc_snep_type_t event,
+       net_nfc_error_e result,
+       nfc_ndef_message_h msg,
+       void *user_data)
+{
+       nfc_snep_event_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               nfc_snep_event_e snep_event;
+
+               switch ((int)event) {
+               case NET_NFC_SNEP_GET :
+                       snep_event = NFC_SNEP_EVENT_GET;
+                       break;
+
+               case NET_NFC_SNEP_PUT :
+                       snep_event = NFC_SNEP_EVENT_PUT;
+                       break;
+
+               case NET_NFC_LLCP_REGISTERED :
+                       snep_event = NFC_SNEP_EVENT_REGISTER;
+                       break;
+
+               case NET_NFC_LLCP_UNREGISTERED :
+                       snep_event = NFC_SNEP_EVENT_UNREGISTER;
+                       break;
+
+               case NET_NFC_LLCP_START :
+                       snep_event = NFC_SNEP_EVENT_START;
+                       break;
+
+               case NET_NFC_LLCP_STOP :
+               default :
+                       snep_event = NFC_SNEP_EVENT_STOP;
+                       break;
+               }
+
+               callback(arg_handle, snep_event,
+                       nfc_common_convert_error_code(__func__, result),
+                       msg, user_param);
+
+               if (snep_event == NFC_SNEP_EVENT_STOP) {
+                       g_variant_unref(user_data);
+               }
+       }
+}
+
+int nfc_snep_start_server(nfc_p2p_target_h target,
+       const char *san,
+       int sap,
+       nfc_snep_event_cb callback,
+       void *user_data)
+{
+       net_nfc_error_e result;
+       GVariant *parameter;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(target == NULL);
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               result = net_nfc_client_snep_start_server(
+                       (net_nfc_target_handle_h)target,
+                       san,
+                       (sap_t)sap,
+                       _snep_start_server_cb,
+                       parameter);
+               if (result != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               result = NET_NFC_ALLOC_FAIL;
+       }
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+static void _snep_start_client_cb(net_nfc_snep_handle_h arg_handle,
+       net_nfc_snep_type_t event,
+       net_nfc_error_e result,
+       nfc_ndef_message_h msg,
+       void *user_data)
+{
+       nfc_snep_event_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               nfc_snep_event_e snep_event;
+
+               switch ((int)event) {
+               case NET_NFC_SNEP_GET :
+                       snep_event = NFC_SNEP_EVENT_GET;
+                       break;
+
+               case NET_NFC_SNEP_PUT :
+                       snep_event = NFC_SNEP_EVENT_PUT;
+                       break;
+
+               case NET_NFC_LLCP_REGISTERED :
+                       snep_event = NFC_SNEP_EVENT_REGISTER;
+                       break;
+
+               case NET_NFC_LLCP_UNREGISTERED :
+                       snep_event = NFC_SNEP_EVENT_UNREGISTER;
+                       break;
+
+               case NET_NFC_LLCP_START :
+                       snep_event = NFC_SNEP_EVENT_START;
+                       break;
+
+               case NET_NFC_LLCP_STOP :
+               default :
+                       snep_event = NFC_SNEP_EVENT_STOP;
+                       break;
+               }
+
+               callback(arg_handle, snep_event,
+                       nfc_common_convert_error_code(__func__, result),
+                       msg, user_param);
+
+               if (snep_event == NFC_SNEP_EVENT_STOP) {
+                       g_variant_unref(user_data);
+               }
+       }
+}
+
+int nfc_snep_start_client(nfc_p2p_target_h target,
+       const char *san,
+       int sap,
+       nfc_snep_event_cb callback,
+       void *user_data)
+{
+       net_nfc_error_e result;
+       GVariant *parameter;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(target == NULL);
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               result = net_nfc_client_snep_start_client(
+                       (net_nfc_target_handle_h)target,
+                       san,
+                       (sap_t)sap,
+                       _snep_start_client_cb,
+                       parameter);
+               if (result != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               result = NET_NFC_ALLOC_FAIL;
+       }
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+static void _snep_send_request_cb(net_nfc_snep_handle_h target,
+       net_nfc_snep_type_t event, net_nfc_error_e result, ndef_message_h msg, void *user_data)
+{
+       nfc_snep_event_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback((nfc_p2p_snep_h)target,
+                       event,
+                       nfc_common_convert_error_code(__func__, result),
+                       (nfc_ndef_message_h)msg,
+                       user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_snep_send_client_request(nfc_p2p_snep_h handle,
+       nfc_snep_type_e type,
+       nfc_ndef_message_h msg,
+       nfc_snep_event_cb callback,
+       void *user_data)
+{
+       net_nfc_error_e result;
+       GVariant *parameter;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(handle == NULL);
+       CHECK_INVALID(msg == NULL);
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               result = net_nfc_client_snep_send_client_request(
+                       (net_nfc_target_handle_h)handle,
+                       type,
+                       msg,
+                       _snep_send_request_cb,
+                       parameter);
+               if (result != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               result = NET_NFC_ALLOC_FAIL;
+       }
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+static void _snep_event_cb(net_nfc_snep_handle_h target, net_nfc_snep_type_t event,
+       net_nfc_error_e result, ndef_message_h msg, void *user_data)
+{
+       nfc_snep_event_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               switch ((int)event) {
+               case NET_NFC_SNEP_GET :
+                       event = NFC_SNEP_EVENT_GET;
+                       break;
+
+               case NET_NFC_SNEP_PUT :
+                       event = NFC_SNEP_EVENT_PUT;
+                       break;
+
+               case NET_NFC_LLCP_REGISTERED :
+                       event = NFC_SNEP_EVENT_REGISTER;
+                       break;
+
+               case NET_NFC_LLCP_UNREGISTERED :
+                       event = NFC_SNEP_EVENT_UNREGISTER;
+                       break;
+
+               case NET_NFC_LLCP_START :
+                       event = NFC_SNEP_EVENT_START;
+                       break;
+
+               case NET_NFC_LLCP_STOP :
+                       event = NFC_SNEP_EVENT_STOP;
+                       break;
+               }
+
+               callback(target, event,
+                       nfc_common_convert_error_code(__func__, result),
+                       (ndef_message_h)msg, user_param);
+       }
+}
+
+int nfc_snep_register_server(const char *san, int sap,
+       nfc_snep_event_cb callback, void *user_data)
+{
+       net_nfc_error_e result;
+       GVariant *parameter;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(san == NULL);
+       CHECK_INVALID(sap == 0);
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               result = net_nfc_client_snep_register_server(san, (sap_t)sap,
+                       _snep_event_cb, parameter);
+               if (result != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               result = NET_NFC_ALLOC_FAIL;
+       }
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_snep_unregister_server(const char *san, int sap)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+
+       result = net_nfc_client_snep_unregister_server(san, (sap_t)sap);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_snep_stop_service(nfc_p2p_target_h target, nfc_p2p_snep_h clients)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+
+       result = net_nfc_client_snep_stop_service_sync(target, clients);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
diff --git a/src/nfc_p2p_handover.c b/src/nfc_p2p_handover.c
new file mode 100644 (file)
index 0000000..68e2b5a
--- /dev/null
@@ -0,0 +1,563 @@
+/*
+* 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 "nfc_common.h"
+
+static void _p2p_handover_cb(net_nfc_error_e result,
+       net_nfc_conn_handover_carrier_type_e carrier, data_h ac_data, void *user_data)
+{
+       nfc_p2p_connection_handover_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               nfc_ac_type_e carrior_type;
+               char *buffer;
+               int len = 0;
+
+               switch (carrier) {
+               case NET_NFC_CONN_HANDOVER_CARRIER_BT :
+                       carrior_type = NFC_AC_TYPE_BT;
+                       buffer = nfc_common_get_bt_address_string(ac_data);
+                       if(buffer != NULL)
+                               len = strlen(buffer);
+                       break;
+
+               case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS :
+                       carrior_type = NFC_AC_TYPE_WIFI;
+                       buffer = nfc_common_get_bt_address_string(ac_data);
+                       if(buffer != NULL)
+                               len = strlen(buffer);
+                       break;
+
+               case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P :
+                       carrior_type = NFC_AC_TYPE_WIFI_DIRECT;
+                       buffer = nfc_common_get_bt_address_string(ac_data);
+                       if(buffer != NULL)
+                               len = strlen(buffer);
+                       break;
+
+               default :
+                       carrior_type = NFC_AC_TYPE_UNKNOWN;
+                       buffer = NULL;
+                       len = 0;
+                       break;
+               }
+
+               callback(nfc_common_convert_error_code(__func__, result),
+                       carrior_type, (void *)buffer,
+                       len, user_param);
+
+               if (buffer != NULL) {
+                       g_free(buffer);
+               }
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_p2p_connection_handover(nfc_p2p_target_h target,
+       nfc_ac_type_e type,
+       nfc_p2p_connection_handover_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       net_nfc_conn_handover_carrier_type_e net_ac_type =
+               NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+       GVariant *parameter;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(target == NULL);
+       CHECK_INVALID(type > NFC_AC_TYPE_UNKNOWN);
+       CHECK_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_WPS;
+               break;
+
+       case NFC_AC_TYPE_WIFI_DIRECT :
+               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P;
+               break;
+
+       case NFC_AC_TYPE_UNKNOWN :
+               net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+               break;
+
+       default:
+               break;
+       }
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               ret = net_nfc_client_p2p_connection_handover(
+                       (net_nfc_target_handle_h)target,
+                       net_ac_type,
+                       _p2p_handover_cb,
+                       parameter);
+               if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+               }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _connection_handover_event_cb(
+       net_nfc_handover_event_e event,
+       net_nfc_error_e result,
+       net_nfc_conn_handover_carrier_type_e carrier,
+       data_h ac_data,
+       data_h ndef_message,
+       void *user_data)
+{
+       LOG_BEGIN();
+
+       if (gdbus_nfc_context.on_handover_event_cb != NULL) {
+               nfc_ndef_message_h message;
+               nfc_ac_type_e type;
+               char *address;
+
+               net_nfc_create_ndef_message_from_rawdata(&message, ndef_message);
+
+               if (event == NET_NFC_HANDOVER_START) {
+                       type = NFC_AC_TYPE_UNKNOWN;
+                       address = NULL;
+               } else {
+                       switch (carrier) {
+                       case NET_NFC_CONN_HANDOVER_CARRIER_BT :
+                               type = NFC_AC_TYPE_BT;
+                               address = nfc_common_get_bt_address_string(ac_data);
+                               break;
+
+                       case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS :
+                               type = NFC_AC_TYPE_WIFI;
+                               address = nfc_common_get_bt_address_string(ac_data);
+                               break;
+
+                       case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P :
+                               type = NFC_AC_TYPE_WIFI_DIRECT;
+                               address = nfc_common_get_bt_address_string(ac_data);
+                               break;
+
+                       default :
+                               type = NFC_AC_TYPE_UNKNOWN;
+                               address = NULL;
+                               break;
+                       }
+               }
+
+               gdbus_nfc_context.on_handover_event_cb(
+                       nfc_common_convert_error_code(__func__, result),
+                       event,
+                       type,
+                       address,
+                       message,
+                       gdbus_nfc_context.on_handover_event_user_data);
+
+               if (address != NULL) {
+                       g_free(address);
+               }
+               net_nfc_free_ndef_message(message);
+       }
+
+       LOG_END();
+}
+
+int nfc_connection_handover_set_event_cb(nfc_connection_handover_event_cb callback, void *user_data)
+{
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(callback == NULL);
+
+       gdbus_nfc_context.on_handover_event_cb = callback;
+       gdbus_nfc_context.on_handover_event_user_data = user_data;
+
+       net_nfc_client_handover_set_handover_event_cb(_connection_handover_event_cb, NULL);
+
+       return NFC_ERROR_NONE;
+}
+
+int nfc_connection_handover_unset_event_cb(void)
+{
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+
+       net_nfc_client_handover_unset_handover_event_cb();
+
+       gdbus_nfc_context.on_handover_event_cb = NULL;
+       gdbus_nfc_context.on_handover_event_user_data = NULL;
+
+       return NFC_ERROR_NONE;
+}
+
+bool nfc_p2p_is_supported_ac_type(nfc_ac_type_e carrier)
+{
+       bool result = false;
+
+       LOG_BEGIN();
+
+       if (carrier == NFC_AC_TYPE_BT)
+               result = true;
+
+       return result;
+}
+
+int nfc_handover_message_import_from_ndef_message(nfc_handover_message_h *result, nfc_ndef_message_h msg)
+{
+       net_nfc_error_e ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(msg == NULL);
+       CHECK_INVALID(result == NULL);
+
+       ret = net_nfc_import_handover_from_ndef_message(
+               (ndef_message_h)msg, (net_nfc_ch_message_h *)result);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_handover_message_get_random_number(nfc_handover_message_h message, unsigned short *random_number)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(message == NULL);
+       CHECK_INVALID(random_number == NULL);
+
+       result = net_nfc_get_handover_random_number(
+               (net_nfc_ch_message_h)message,
+               random_number);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_handover_message_get_carrier_count(nfc_handover_message_h message, unsigned int *count)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(message == NULL);
+       CHECK_INVALID(count == NULL);
+
+       result = net_nfc_get_handover_carrier_count(
+               (net_nfc_ch_message_h)message,
+               count);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_handover_message_get_carrier(nfc_handover_message_h message, int index, nfc_handover_carrier_h *carrier)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(message == NULL);
+       CHECK_INVALID(carrier == NULL);
+
+       result = net_nfc_get_handover_carrier(
+               (net_nfc_ch_message_h)message,
+               index,
+               (net_nfc_ch_carrier_h *)carrier);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_handover_message_get_carrier_by_type(nfc_handover_message_h message, nfc_ac_type_e type, nfc_handover_carrier_h *carrier)
+{
+       net_nfc_error_e result;
+       net_nfc_conn_handover_carrier_type_e temp;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(message == NULL);
+       CHECK_INVALID(carrier == NULL);
+
+       switch (type) {
+       case NFC_AC_TYPE_BT :
+               temp = NET_NFC_CONN_HANDOVER_CARRIER_BT;
+               break;
+
+       case NFC_AC_TYPE_WIFI :
+               temp = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS;
+               break;
+
+       case NFC_AC_TYPE_WIFI_DIRECT :
+               temp = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P;
+               break;
+
+       default:
+               temp = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+               break;
+       }
+       result = net_nfc_get_handover_carrier_by_type(
+               (net_nfc_ch_message_h)message,
+               temp,
+               (net_nfc_ch_carrier_h *)carrier);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_handover_message_destroy(nfc_handover_message_h message)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(message == NULL);
+
+       result = net_nfc_free_handover_message((net_nfc_ch_message_h)message);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+
+int nfc_handover_carrier_get_cps(nfc_handover_carrier_h carrier, nfc_ac_state_e *cps)
+{
+       net_nfc_error_e result;
+       net_nfc_conn_handover_carrier_state_e temp;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(carrier == NULL);
+       CHECK_INVALID(cps == NULL);
+
+       result = net_nfc_get_handover_carrier_cps(
+               (net_nfc_ch_carrier_h)carrier, &temp);
+       if (result == NET_NFC_OK) {
+               switch (temp) {
+               case NET_NFC_CONN_HANDOVER_CARRIER_INACTIVATE :
+                       *cps = NFC_AC_STATE_INACTIVATE;
+                       break;
+
+               case NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE :
+                       *cps = NFC_AC_STATE_ACTIVATE;
+                       break;
+
+               case NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATING :
+                       *cps = NFC_AC_STATE_ACTIVATING;
+                       break;
+
+               default :
+                       *cps = NFC_AC_STATE_UNKNOWN;
+                       break;
+               }
+       }
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_handover_carrier_get_type(nfc_handover_carrier_h carrier, nfc_ac_type_e *type)
+{
+       net_nfc_error_e result;
+       net_nfc_conn_handover_carrier_type_e temp;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(carrier == NULL);
+       CHECK_INVALID(type == NULL);
+
+       result = net_nfc_get_handover_carrier_type(
+               (net_nfc_ch_carrier_h)carrier, &temp);
+       if (result == NET_NFC_OK) {
+               switch (temp) {
+               case NET_NFC_CONN_HANDOVER_CARRIER_BT :
+                       *type = NFC_AC_TYPE_BT;
+                       break;
+
+               case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_WPS :
+                       *type = NFC_AC_TYPE_WIFI;
+                       break;
+
+               case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_P2P :
+                       *type = NFC_AC_TYPE_WIFI_DIRECT;
+                       break;
+
+               default :
+                       *type = NFC_AC_TYPE_UNKNOWN;
+                       break;
+               }
+       }
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_handover_carrier_get_carrier_record(nfc_handover_carrier_h carrier, nfc_ndef_record_h *record)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(carrier == NULL);
+       CHECK_INVALID(record == NULL);
+
+       result = net_nfc_get_handover_carrier_record(
+               (net_nfc_ch_carrier_h)carrier, (ndef_record_h *)record);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_handover_carrier_get_auxiliary_record_count(nfc_handover_carrier_h carrier, unsigned int *count)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(carrier == NULL);
+       CHECK_INVALID(count == NULL);
+
+       result = net_nfc_get_handover_auxiliary_record_count(
+               (net_nfc_ch_carrier_h)carrier, count);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_handover_carrier_get_auxiliary_record(nfc_handover_carrier_h carrier, int index, nfc_ndef_record_h *record)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(carrier == NULL);
+       CHECK_INVALID(record == NULL);
+
+       result = net_nfc_get_handover_auxiliary_record(
+               (net_nfc_ch_carrier_h)carrier,
+               index, (ndef_record_h *)record);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_handover_carrier_get_handover_config(nfc_handover_carrier_h carrier, nfc_handover_config_h *config)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(carrier == NULL);
+       CHECK_INVALID(config == NULL);
+
+       result = net_nfc_create_carrier_config_from_carrier(
+               (net_nfc_carrier_config_h *)config,
+               (net_nfc_ch_carrier_h)carrier);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_handover_carrier_destroy(nfc_handover_carrier_h carrier)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(carrier == NULL);
+
+       result = net_nfc_free_handover_carrier((net_nfc_ch_carrier_h)carrier);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+
+int nfc_handover_config_get_property(nfc_handover_config_h config, unsigned short attribute, unsigned short *size, unsigned char **data)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(config == NULL);
+       CHECK_INVALID(size == NULL);
+       CHECK_INVALID(data == NULL);
+
+       result = net_nfc_get_carrier_config_property(
+               (net_nfc_carrier_config_h)config,
+               attribute, size, data);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
+int nfc_handover_config_destroy(nfc_handover_config_h config)
+{
+       net_nfc_error_e result;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_P2P_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(config == NULL);
+
+       result = net_nfc_free_carrier_config((net_nfc_carrier_config_h)config);
+
+       return nfc_common_convert_error_code(__func__, result);
+}
+
diff --git a/src/nfc_tag.c b/src/nfc_tag.c
new file mode 100644 (file)
index 0000000..ae3d7b0
--- /dev/null
@@ -0,0 +1,1147 @@
+/*
+* 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 "nfc_common.h"
+
+static void _tag_format_ndef_cb(net_nfc_error_e result,
+       void *user_data)
+{
+       nfc_tag_format_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(nfc_common_convert_error_code(__func__, result),
+                       user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_tag_format_ndef(nfc_tag_h tag,
+       unsigned char *key,
+       int key_size,
+       nfc_tag_format_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       data_h key_data = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_ACTIVATED();
+       CHECK_APP_PERMISSION();
+
+       ret = net_nfc_create_data(&key_data, key, key_size);
+       if (ret == NET_NFC_OK) {
+               net_nfc_target_handle_h handle = NULL;
+
+               ret = net_nfc_get_tag_handle((net_nfc_target_info_h)tag,
+                       &handle);
+               if (ret == NET_NFC_OK) {
+                       GVariant *parameter;
+
+                       parameter = g_variant_new("(uu)",
+                               GPOINTER_TO_UINT(callback),
+                               GPOINTER_TO_UINT(user_data));
+                       if (parameter != NULL) {
+                               ret = net_nfc_client_ndef_format(
+                                       handle,
+                                       key_data,
+                                       _tag_format_ndef_cb,
+                                       parameter);
+                               if (ret != NET_NFC_OK) {
+                                       g_variant_unref(parameter);
+                               }
+                       } else {
+                               ret = NET_NFC_ALLOC_FAIL;
+                       }
+               } else {
+                       LOG_ERR("net_nfc_get_tag_handle failed, [%d]", ret);
+               }
+
+               net_nfc_free_data(key_data);
+       } else {
+               LOG_ERR("net_nfc_create_data failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _tag_read_ndef_cb(net_nfc_error_e result, ndef_message_h message,
+       void *user_data)
+{
+       nfc_tag_read_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(nfc_common_convert_error_code(__func__, result),
+                       (nfc_ndef_message_h)message,
+                       user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_tag_read_ndef(nfc_tag_h tag,
+       nfc_tag_read_completed_cb callback,
+       void * user_data)
+{
+       int ret;
+       net_nfc_target_handle_h handle = NULL;
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_ACTIVATED();
+
+       ret = net_nfc_get_tag_handle((net_nfc_target_info_h)tag, &handle);
+       if (ret == NET_NFC_OK) {
+               GVariant *parameter;
+
+               parameter = g_variant_new("(uu)",
+                       GPOINTER_TO_UINT(callback),
+                       GPOINTER_TO_UINT(user_data));
+               if (parameter != NULL) {
+                       ret = net_nfc_client_ndef_read(
+                               handle,
+                               _tag_read_ndef_cb,
+                               parameter);
+                       if (ret != NET_NFC_OK) {
+                               g_variant_unref(parameter);
+                       }
+               } else {
+                       ret = NET_NFC_ALLOC_FAIL;
+               }
+       } else {
+               LOG_ERR("net_nfc_get_tag_handle failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _tag_write_ndef_cb(net_nfc_error_e result,
+       void *user_data)
+{
+       nfc_tag_write_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(nfc_common_convert_error_code(__func__, result), user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_tag_write_ndef(nfc_tag_h tag,
+       nfc_ndef_message_h msg,
+       nfc_tag_write_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       net_nfc_target_handle_h handle = NULL;
+       unsigned int byte_size = 0;
+       uint32_t max_len = 0;
+       net_nfc_ndef_card_state_e state = NET_NFC_NDEF_CARD_INVALID;
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_ACTIVATED();
+       CHECK_APP_PERMISSION();
+
+       ret = net_nfc_get_tag_ndef_state((net_nfc_target_info_h)tag, &state);
+       if (ret != NET_NFC_OK) {
+               LOG_ERR("net_nfc_get_tag_ndef_state failed, [%d]", ret);
+               return nfc_common_convert_error_code(__func__, ret);;
+       }
+
+       if (state == NET_NFC_NDEF_CARD_READ_ONLY) {
+               return NFC_ERROR_READ_ONLY_NDEF;
+       }
+
+       ret = net_nfc_get_tag_max_data_size((net_nfc_target_info_h)tag, &max_len);
+       if (ret != NET_NFC_OK) {
+               LOG_ERR("net_nfc_get_tag_max_data_size failed, [%d]", ret);
+               return nfc_common_convert_error_code(__func__, ret);;
+       }
+
+       ret = nfc_common_get_rawdata_size(msg, &byte_size);
+       if (ret != NFC_ERROR_NONE) {
+               LOG_ERR("nfc_ndef_message_get_rawdata_size failed, [%d]", ret);
+               return nfc_common_convert_error_code(__func__, ret);;
+       }
+
+       if (max_len < byte_size) {
+               return NFC_ERROR_NO_SPACE_ON_NDEF;
+       }
+
+       ret = net_nfc_get_tag_handle((net_nfc_target_info_h)tag, &handle);
+       if (ret == NET_NFC_OK) {
+               GVariant *parameter;
+
+               parameter = g_variant_new("(uu)",
+                       GPOINTER_TO_UINT(callback),
+                       GPOINTER_TO_UINT(user_data));
+               if (parameter != NULL) {
+                       ret = net_nfc_client_ndef_write(
+                               handle,
+                               msg,
+                               _tag_write_ndef_cb,
+                               parameter);
+                       if (ret != NET_NFC_OK) {
+                               g_variant_unref(parameter);
+                       }
+               } else {
+                       ret = NET_NFC_ALLOC_FAIL;
+               }
+       } else {
+               LOG_ERR("net_nfc_get_tag_handle failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _tag_transceive_data_cb(net_nfc_error_e result, data_h arg_data,
+       void *user_data)
+{
+       nfc_tag_transceive_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               uint8_t *buffer = NULL;
+               uint32_t length = 0;
+
+               if (result == NET_NFC_OK && arg_data != NULL) {
+                       buffer = net_nfc_get_data_buffer(arg_data);
+                       length = net_nfc_get_data_length(arg_data);
+               }
+
+               callback(nfc_common_convert_error_code(__func__, result),
+                       buffer,
+                       length,
+                       user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_tag_transceive(nfc_tag_h tag,
+       unsigned char *buffer,
+       int buffer_size,
+       nfc_tag_transceive_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       data_h rawdata = NULL;
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_INVALID(buffer == NULL);
+       CHECK_INVALID(buffer_size <= 0);
+       CHECK_ACTIVATED();
+       CHECK_APP_PERMISSION();
+
+       ret = net_nfc_create_data(&rawdata, buffer, buffer_size);
+       if (ret == NET_NFC_OK) {
+               net_nfc_target_handle_h handle = NULL;
+
+               ret = net_nfc_get_tag_handle((net_nfc_target_info_h)tag, &handle);
+               if (ret == NET_NFC_OK) {
+                       GVariant *parameter;
+
+                       parameter = g_variant_new("(uu)",
+                               GPOINTER_TO_UINT(callback),
+                               GPOINTER_TO_UINT(user_data));
+                       if (parameter != NULL) {
+                               ret = net_nfc_client_transceive_data(
+                                       handle,
+                                       rawdata,
+                                       _tag_transceive_data_cb,
+                                       parameter);
+                               if (ret != NET_NFC_OK) {
+                                       g_variant_unref(parameter);
+                               }
+                       } else {
+                               ret = NET_NFC_ALLOC_FAIL;
+                       }
+               } else {
+                       LOG_ERR("net_nfc_get_tag_handle failed, [%d]", ret);
+               }
+
+               net_nfc_free_data(rawdata);
+       } else {
+               LOG_ERR("net_nfc_create_data failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_tag_get_type(nfc_tag_h tag, nfc_tag_type_e *type)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_INVALID(type == NULL);
+
+       ret = net_nfc_get_tag_type(tag, (net_nfc_target_type_e *)type);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_tag_is_support_ndef(nfc_tag_h tag, bool *is_support)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_INVALID(is_support == NULL);
+
+       ret = net_nfc_get_tag_ndef_support(tag, is_support);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_tag_get_maximum_ndef_size(nfc_tag_h tag, unsigned int *max_size)
+{
+       int ret;
+
+       LOG_BEGIN();
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_INVALID(max_size == NULL);
+
+       ret = net_nfc_get_tag_max_data_size(tag, max_size);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_tag_get_ndef_size(nfc_tag_h tag, unsigned int *actual_data_size)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_INVALID(actual_data_size == NULL);
+
+       ret = net_nfc_get_tag_actual_data_size(tag, actual_data_size);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_tag_foreach_information(nfc_tag_h tag,
+       nfc_tag_information_cb callback,
+       void *user_data)
+{
+       int ret;
+       int i, count = 0;
+       char **keys = NULL;
+       data_h value = NULL;
+
+       bool cont;
+
+       LOG_BEGIN();
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_INVALID(callback == NULL);
+
+       ret = net_nfc_get_tag_info_keys((net_nfc_target_info_h)tag,
+               &keys, &count);
+
+       if(ret != NET_NFC_OK)
+               return nfc_common_convert_error_code(__func__, ret);
+
+       for (i = 0; i < count; i++) {
+               net_nfc_get_tag_info_value((net_nfc_target_info_h)tag, keys[i],
+                       &value);
+
+               cont = callback(keys[i],
+                       net_nfc_get_data_buffer(value),
+                       net_nfc_get_data_length(value),
+                       user_data);
+
+               if (!cont)
+                       break;
+       }
+
+       return NFC_ERROR_NONE;
+}
+
+/* FIXME */
+static void _mifare_authenticate_with_keyA_cb(net_nfc_error_e result,
+       void *user_data)
+{
+       nfc_mifare_authenticate_with_keyA_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(nfc_common_convert_error_code(__func__, result), user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_mifare_authenticate_with_keyA(nfc_tag_h tag,
+       int sector_index,
+       unsigned char *auth_key,
+       nfc_mifare_authenticate_with_keyA_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       data_h auth_key_data = NULL;
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_INVALID(auth_key == NULL);
+       CHECK_ACTIVATED();
+
+       ret = net_nfc_create_data(&auth_key_data, auth_key, 6);
+       if (ret == NET_NFC_OK) {
+               net_nfc_target_handle_h handle = NULL;
+
+               ret = net_nfc_get_tag_handle((net_nfc_target_info_h)tag, &handle);
+               if (ret == NET_NFC_OK) {
+                       GVariant *parameter;
+
+                       parameter = g_variant_new("(uu)",
+                               GPOINTER_TO_UINT(callback),
+                               GPOINTER_TO_UINT(user_data));
+                       if (parameter != NULL) {
+                               ret = net_nfc_client_mifare_authenticate_with_keyA(
+                                       handle,
+                                       sector_index,
+                                       auth_key_data,
+                                       _mifare_authenticate_with_keyA_cb,
+                                       parameter);
+                               if (ret != NET_NFC_OK) {
+                                       g_variant_unref(parameter);
+                               }
+                       } else {
+                               ret = NET_NFC_ALLOC_FAIL;
+                       }
+               } else {
+                       LOG_ERR("net_nfc_get_tag_handle failed, [%d]", ret);
+               }
+
+               net_nfc_free_data(auth_key_data);
+       } else {
+               LOG_ERR("net_nfc_create_data failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+
+static void _mifare_authenticate_with_keyB_cb(net_nfc_error_e result,
+       void *user_data)
+{
+       nfc_mifare_authenticate_with_keyB_completed_cb callback;
+       void *user_param;
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(nfc_common_convert_error_code(__func__, result), user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_mifare_authenticate_with_keyB(nfc_tag_h tag,
+       int sector_index,
+       unsigned char *auth_key,
+       nfc_mifare_authenticate_with_keyB_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       data_h auth_key_data = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_INVALID(auth_key == NULL);
+       CHECK_ACTIVATED();
+
+       ret = net_nfc_create_data(&auth_key_data, auth_key, 6);
+       if (ret == NET_NFC_OK) {
+               net_nfc_target_handle_h handle = NULL;
+
+               ret = net_nfc_get_tag_handle((net_nfc_target_info_h)tag, &handle);
+               if (ret == NET_NFC_OK) {
+                       GVariant *parameter;
+
+                       parameter = g_variant_new("(uu)",
+                               GPOINTER_TO_UINT(callback),
+                               GPOINTER_TO_UINT(user_data));
+                       if (parameter != NULL) {
+                               ret = net_nfc_client_mifare_authenticate_with_keyB(
+                                       handle,
+                                       sector_index,
+                                       auth_key_data,
+                                       _mifare_authenticate_with_keyB_cb,
+                                       parameter);
+                               if (ret != NET_NFC_OK) {
+                                       g_variant_unref(parameter);
+                               }
+                       } else {
+                               ret = NET_NFC_ALLOC_FAIL;
+                       }
+               } else {
+                       LOG_ERR("net_nfc_get_tag_handle failed, [%d]", ret);
+               }
+
+               net_nfc_free_data(auth_key_data);
+       } else {
+               LOG_ERR("net_nfc_create_data failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+/* FIXME */
+static void _mifare_read_block_cb(net_nfc_error_e result, data_h data,
+       void *user_data)
+{
+       nfc_mifare_read_block_completed_cb callback;
+       void *user_param;
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               uint8_t *buffer = NULL;
+               int length = 0;
+
+               if (result == NET_NFC_OK && data != NULL) {
+                       buffer = net_nfc_get_data_buffer(data);
+                       length = net_nfc_get_data_length(data);
+               }
+
+               callback(nfc_common_convert_error_code(__func__, result),
+                       buffer,
+                       length,
+                       user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_mifare_read_block(nfc_tag_h tag,
+       int block_index,
+       nfc_mifare_read_block_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       net_nfc_target_handle_h handle = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+
+       ret = net_nfc_get_tag_handle((net_nfc_target_info_h)tag, &handle);
+       if (ret == NET_NFC_OK) {
+               GVariant *parameter;
+
+               parameter = g_variant_new("(uu)",
+                       GPOINTER_TO_UINT(callback),
+                       GPOINTER_TO_UINT(user_data));
+               if (parameter != NULL) {
+                       ret = net_nfc_client_mifare_read(
+                               handle,
+                               block_index,
+                               _mifare_read_block_cb,
+                               parameter);
+                       if (ret != NET_NFC_OK) {
+                               g_variant_unref(parameter);
+                       }
+               } else {
+                       ret = NET_NFC_ALLOC_FAIL;
+               }
+       } else {
+               LOG_ERR("net_nfc_get_tag_handle failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_mifare_read_page(nfc_tag_h tag,
+       int page_index,
+       nfc_mifare_read_page_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       GVariant *parameter;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+
+       parameter = g_variant_new("(uu)",
+               GPOINTER_TO_UINT(callback),
+               GPOINTER_TO_UINT(user_data));
+       if (parameter != NULL) {
+               /* FIXME : not implemented */
+//             ret = net_nfc_client_mifare_read_block(tag,
+//                     page_index,
+//                     _mifare_read_page_cb,
+//                     parameter);
+//             if (ret != NET_NFC_OK) {
+                       g_variant_unref(parameter);
+                       ret = NET_NFC_OK;
+//             }
+       } else {
+               ret = NET_NFC_ALLOC_FAIL;
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _mifare_write_block_cb(net_nfc_error_e result, void *user_data)
+{
+       nfc_mifare_write_block_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(nfc_common_convert_error_code(__func__, result), user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_mifare_write_block(nfc_tag_h tag,
+       int block_index,
+       unsigned char *buffer,
+       int buffer_size,
+       nfc_mifare_write_block_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       data_h block_data = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_INVALID(buffer == NULL);
+       CHECK_INVALID(buffer_size <= 0);
+       CHECK_ACTIVATED();
+
+       ret = net_nfc_create_data(&block_data, buffer, buffer_size);
+       if (ret == NET_NFC_OK) {
+               net_nfc_target_handle_h handle = NULL;
+
+               ret = net_nfc_get_tag_handle((net_nfc_target_info_h)tag,
+                       &handle);
+               if (ret == NET_NFC_OK) {
+                       GVariant *parameter;
+
+                       parameter = g_variant_new("(uu)",
+                               GPOINTER_TO_UINT(callback),
+                               GPOINTER_TO_UINT(user_data));
+                       if (parameter != NULL) {
+                               ret = net_nfc_client_mifare_write_block(
+                                       handle,
+                                       block_index,
+                                       block_data,
+                                       _mifare_write_block_cb,
+                                       parameter);
+                               if (ret != NET_NFC_OK) {
+                                       g_variant_unref(parameter);
+                               }
+                       } else {
+                               ret = NET_NFC_ALLOC_FAIL;
+                       }
+               } else {
+                       LOG_ERR("net_nfc_get_tag_handle failed, [%d]", ret);
+               }
+
+               net_nfc_free_data(block_data);
+       } else {
+               LOG_ERR("net_nfc_create_data failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _mifare_write_page_cb(net_nfc_error_e result, void *user_data)
+{
+       nfc_mifare_write_page_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(nfc_common_convert_error_code(__func__, result), user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_mifare_write_page(nfc_tag_h tag,
+       int page_index,
+       unsigned char *buffer,
+       int buffer_size,
+       nfc_mifare_write_page_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       data_h block_data = NULL;
+
+       LOG_BEGIN();
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_INVALID(buffer == NULL);
+       CHECK_INVALID(buffer_size <= 0);
+       CHECK_ACTIVATED();
+
+       ret = net_nfc_create_data(&block_data, buffer, buffer_size);
+       if (ret == NET_NFC_OK) {
+               net_nfc_target_handle_h handle = NULL;
+
+               ret = net_nfc_get_tag_handle((net_nfc_target_info_h)tag,
+                       &handle);
+               if (ret == NET_NFC_OK) {
+                       GVariant *parameter;
+
+                       parameter = g_variant_new("(uu)",
+                               GPOINTER_TO_UINT(callback),
+                               GPOINTER_TO_UINT(user_data));
+                       if (parameter != NULL) {
+                               ret = net_nfc_client_mifare_write_page(
+                                       handle,
+                                       page_index,
+                                       block_data,
+                                       _mifare_write_page_cb,
+                                       parameter);
+                               if (ret != NET_NFC_OK) {
+                                       g_variant_unref(parameter);
+                               }
+                       } else {
+                               ret = NET_NFC_ALLOC_FAIL;
+                       }
+               } else {
+                       LOG_ERR("net_nfc_get_tag_handle failed, [%d]", ret);
+               }
+
+               net_nfc_free_data(block_data);
+       } else {
+               LOG_ERR("net_nfc_create_data failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _mifare_increment_cb(net_nfc_error_e result, void *user_data)
+{
+       nfc_mifare_increment_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(nfc_common_convert_error_code(__func__, result), user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_mifare_increment(nfc_tag_h tag,
+       int block_index,
+       int value,
+       nfc_mifare_increment_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       net_nfc_target_handle_h handle = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_ACTIVATED();
+
+       ret = net_nfc_get_tag_handle((net_nfc_target_info_h)tag, &handle);
+       if (ret == NET_NFC_OK) {
+               GVariant *parameter;
+
+               parameter = g_variant_new("(uu)",
+                       GPOINTER_TO_UINT(callback),
+                       GPOINTER_TO_UINT(user_data));
+               if (parameter != NULL) {
+                       ret = net_nfc_client_mifare_increment(
+                               handle,
+                               block_index,
+                               value,
+                               _mifare_increment_cb,
+                               parameter);
+                       if (ret != NET_NFC_OK) {
+                               g_variant_unref(parameter);
+                       }
+               } else {
+                       ret = NET_NFC_ALLOC_FAIL;
+               }
+       } else {
+               LOG_ERR("net_nfc_get_tag_handle failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _mifare_decrement_cb(net_nfc_error_e result, void *user_data)
+{
+       nfc_mifare_decrement_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(nfc_common_convert_error_code(__func__, result), user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_mifare_decrement(nfc_tag_h tag,
+       int block_index,
+       int value,
+       nfc_mifare_decrement_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       net_nfc_target_handle_h handle = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_ACTIVATED();
+
+       ret = net_nfc_get_tag_handle((net_nfc_target_info_h)tag, &handle);
+       if (ret == NET_NFC_OK) {
+               GVariant *parameter;
+
+               parameter = g_variant_new("(uu)",
+                       GPOINTER_TO_UINT(callback),
+                       GPOINTER_TO_UINT(user_data));
+               if (parameter != NULL) {
+                       ret = net_nfc_client_mifare_decrement(
+                               handle,
+                               block_index,
+                               value,
+                               _mifare_decrement_cb,
+                               parameter);
+                       if (ret != NET_NFC_OK) {
+                               g_variant_unref(parameter);
+                       }
+               } else {
+                       ret = NET_NFC_ALLOC_FAIL;
+               }
+       } else {
+               LOG_ERR("net_nfc_get_tag_handle failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _mifare_transfer_cb(net_nfc_error_e result, void *user_data)
+{
+       nfc_mifare_transfer_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(nfc_common_convert_error_code(__func__, result), user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_mifare_transfer(nfc_tag_h tag,
+       int block_index,
+       nfc_mifare_transfer_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       net_nfc_target_handle_h handle = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_ACTIVATED();
+
+       ret = net_nfc_get_tag_handle((net_nfc_target_info_h)tag, &handle);
+       if (ret == NET_NFC_OK) {
+               GVariant *parameter;
+
+               parameter = g_variant_new("(uu)",
+                       GPOINTER_TO_UINT(callback),
+                       GPOINTER_TO_UINT(user_data));
+               if (parameter != NULL) {
+                       ret = net_nfc_client_mifare_transfer(
+                               handle,
+                               block_index,
+                               _mifare_transfer_cb,
+                               parameter);
+                       if (ret != NET_NFC_OK) {
+                               g_variant_unref(parameter);
+                       }
+               } else {
+                       ret = NET_NFC_ALLOC_FAIL;
+               }
+       } else {
+               LOG_ERR("net_nfc_get_tag_handle failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+static void _mifare_restore_cb(net_nfc_error_e result, void *user_data)
+{
+       nfc_mifare_restore_completed_cb callback;
+       void *user_param;
+
+       LOG_BEGIN();
+
+       if (user_data == NULL) {
+               LOG_ERR("user_data is NULL");
+               return;
+       }
+
+       g_variant_get((GVariant *)user_data,
+               "(uu)",
+               (guint *)&callback,
+               (guint *)&user_param);
+
+       if (callback != NULL) {
+               callback(nfc_common_convert_error_code(__func__, result), user_param);
+       }
+
+       g_variant_unref((GVariant *)user_data);
+}
+
+int nfc_mifare_restore(nfc_tag_h tag,
+       int block_index,
+       nfc_mifare_restore_completed_cb callback,
+       void *user_data)
+{
+       int ret;
+       net_nfc_target_handle_h handle = NULL;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(tag == NULL);
+       CHECK_ACTIVATED();
+
+       ret = net_nfc_get_tag_handle((net_nfc_target_info_h)tag, &handle);
+       if (ret == NET_NFC_OK) {
+               GVariant *parameter;
+
+               parameter = g_variant_new("(uu)",
+                       GPOINTER_TO_UINT(callback),
+                       GPOINTER_TO_UINT(user_data));
+               if (parameter != NULL) {
+                       ret = net_nfc_client_mifare_restore(
+                               handle,
+                               block_index,
+                               _mifare_restore_cb,
+                               parameter);
+                       if (ret != NET_NFC_OK) {
+                               g_variant_unref(parameter);
+                       }
+               } else {
+                       ret = NET_NFC_ALLOC_FAIL;
+               }
+       } else {
+               LOG_ERR("net_nfc_get_tag_handle failed, [%d]", ret);
+       }
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
+
+int nfc_barcode_get_barcode(unsigned char **barcode, int *barcode_len)
+{
+       int ret;
+
+       LOG_BEGIN();
+
+       CHECK_SUPPORTED(NFC_TAG_FEATURE);
+       CHECK_INIT();
+       CHECK_INVALID(barcode == NULL);
+       CHECK_INVALID(barcode_len == NULL);
+
+       *barcode_len = 0;
+
+       ret = net_nfc_client_barcode_get_barcode_sync(barcode, barcode_len);
+
+       return nfc_common_convert_error_code(__func__, ret);
+}
index 20a03af..474d37d 100644 (file)
@@ -1,7 +1,7 @@
 SET(fw_test "${fw_name}-test")
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(${fw_test} REQUIRED nfc-common-lib nfc dlog elementary evas ecore)
+pkg_check_modules(${fw_test} REQUIRED dlog glib-2.0)
 FOREACH(flag ${${fw_test}_CFLAGS})
     SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
     MESSAGE(${flag})
@@ -9,9 +9,6 @@ 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)
diff --git a/test/network_nfc_test.c b/test/network_nfc_test.c
deleted file mode 100644 (file)
index f5da0ac..0000000
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-#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 _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"
-
-
-
-       "------------------\n"
-       ">";
-
- void  set_activation_completed_cb(nfc_error_e error, void *user_data)
-{
-       printf("set_activation_completed_cb  ret(%d) \n", error);
-
-}
-
-int main(int argc, char ** argv)
-{
-       elm_init(argc, argv);
-       is_terminate = 0;
-       char select[255];
-       int ret;
-
-
-       printf( menu );
-       gets(select);
-
-       switch(select[0]){
-
-               case '0':
-                       ret =  nfc_manager_set_activation(0, set_activation_completed_cb, NULL);
-                       printf("nfc_manager_set_activation set off  ret(0x%08x) \n", ret);
-
-                       if (ret == NFC_ERROR_NOT_SUPPORTED)
-                       {
-                               printf("NFC_ERROR_NOT_SUPPORTED \n");
-                       }
-                       else if (ret == NFC_ERROR_ALREADY_ACTIVATED)
-                       {
-                               printf("NFC_ERROR_ALREADY_ACTIVATED \n");
-
-                       }
-                       else if (ret == NFC_ERROR_ALREADY_DEACTIVATED)
-                       {
-                               printf("NFC_ERROR_ALREADY_DEACTIVATED \n");
-
-                       }
-                       else if (ret == NFC_ERROR_OPERATION_FAILED)
-                       {
-                               printf("NFC_ERROR_OPERATION_FAILED \n");
-
-                       }
-                       elm_shutdown();
-                       return 0;
-
-               case '1':
-                       ret =  nfc_manager_set_activation(1, set_activation_completed_cb, NULL);
-                       printf("nfc_manager_set_activation set off  ret(0x%08x) \n", ret);
-
-                       if (ret == NFC_ERROR_NOT_SUPPORTED)
-                       {
-                               printf("NFC_ERROR_NOT_SUPPORTED \n");
-                       }
-                       else if (ret == NFC_ERROR_ALREADY_ACTIVATED)
-                       {
-                               printf("NFC_ERROR_ALREADY_ACTIVATED \n");
-
-                       }
-                       else if (ret == NFC_ERROR_ALREADY_DEACTIVATED)
-                       {
-                               printf("NFC_ERROR_ALREADY_DEACTIVATED \n");
-
-                       }
-                       else if (ret == NFC_ERROR_OPERATION_FAILED)
-                       {
-                               printf("NFC_ERROR_OPERATION_FAILED \n");
-
-                       }
-                       elm_shutdown();
-                       return 0;
-
-               case '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;
-
-
-
-               default:
-                       printf("wrong selection!\n");
-                       is_terminate = 1;
-       }
-
-
-
-       ecore_timer_add(1, check_terminate, NULL);
-
-       elm_run();
-       elm_shutdown();
-
-
-       return 0;
-}
diff --git a/test/nfc_unit_test.c b/test/nfc_unit_test.c
new file mode 100644 (file)
index 0000000..8f66922
--- /dev/null
@@ -0,0 +1,183 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <glib.h>
+
+#include <nfc.h>
+
+#define BUFFER_LEN 10
+#define PRT(format, args...) printf("%s:%d() "format, __FUNCTION__, __LINE__, ##args)
+#define TC_PRT(format, args...) PRT(format"\n", ##args)
+
+
+GMainLoop *main_loop = NULL;
+
+typedef struct {
+       const char *tc_name;
+       int tc_code;
+} tc_table_t;
+
+tc_table_t tc_table[] = {
+       /* manage api*/
+       {"nfc_manager_initialize" ,1}, //OK
+       {"nfc_snep_register_server", 2},
+
+    /* -----------*/
+    {"Finish"               , 0x00ff},
+    {NULL                   , 0x0000},
+};
+
+void tc_usage_print(void)
+{
+       int i = 0;
+
+       while (tc_table[i].tc_name)
+       {
+               if (tc_table[i].tc_code != 0x00ff)
+               {
+                       TC_PRT("Key %d : usage %s", tc_table[i].tc_code, tc_table[i].tc_name);
+               }
+               else
+               {
+         TC_PRT("Key %d : usage %s\n\n", 0x00ff, tc_table[i].tc_name);
+               }
+
+               i++;
+       }
+}
+
+
+void _nfc_snep_event_cb(nfc_p2p_snep_h handle, nfc_snep_event_e event, nfc_error_e result, nfc_ndef_message_h msg, void *user_data)
+{
+       TC_PRT("Inside _nfc_snep_event_cb");
+       switch(event)
+       {
+               case NFC_SNEP_EVENT_STOP:
+                       TC_PRT("NFC_SNEP_EVENT_STOP");
+                       break;
+               case NFC_SNEP_EVENT_START:
+                       TC_PRT("NFC_SNEP_EVENT_START");
+                       break;
+               case NFC_SNEP_EVENT_GET:
+                       TC_PRT("NFC_SNEP_EVENT_GET");
+                       break;
+               case NFC_SNEP_EVENT_PUT:
+                       TC_PRT("NFC_SNEP_EVENT_PUT");
+                       break;
+               case NFC_SNEP_EVENT_REGISTER:
+                       TC_PRT("NFC_SNEP_EVENT_REGISTER");
+                       break;
+               case NFC_SNEP_EVENT_UNREGISTER:
+                       TC_PRT("NFC_SNEP_EVENT_UNREGISTER");
+                       break;
+       }
+}
+
+void _nfc_p2p_target_discovered_cb(nfc_discovered_type_e type, nfc_p2p_target_h target, void *user_data)
+{
+       int result;
+
+       TC_PRT("Inside server");
+       result = nfc_snep_register_server("default", 4, _nfc_snep_event_cb, NULL);
+       TC_PRT("nfc_snep_register_server %d", result);
+
+       result = nfc_snep_start_server(target, "default", 4, _nfc_snep_event_cb, NULL);
+       TC_PRT("nfc_snep_start_server %d", result);
+}
+
+int test_input_callback(void *data)
+{
+       long test_id = (long)data;
+
+       switch (test_id) {
+       case 0x00ff:
+               TC_PRT("Finished");
+               g_main_loop_quit(main_loop);
+               break;
+       case 1: //nfc_manager_initialize
+               {
+                       int ret;
+                       ret = nfc_manager_initialize();
+
+                       if(ret == NFC_ERROR_NONE)
+                               TC_PRT("nfc initialize success");
+                       else
+                               TC_PRT("nfc initialize failed");
+               }
+               break;
+       case 2: //TBT - snep behavior
+               {
+                       int ret;
+                       ret = nfc_manager_initialize();
+
+                       if(ret == NFC_ERROR_NONE)
+                       {
+                               TC_PRT("register cb");
+                               nfc_manager_set_p2p_target_discovered_cb(_nfc_p2p_target_discovered_cb, NULL);
+                       }
+               }
+       case 3: //nfc_snep_register_server
+               {
+                       int ret;
+                       ret = nfc_snep_register_server("default", 4, NULL, NULL);
+
+                       if(ret == NFC_ERROR_NONE)
+                               TC_PRT("success");
+                       else
+                               TC_PRT("failed");
+               }
+       default:
+               break;
+       }
+
+    return 0;
+}
+
+static gboolean key_event_cb(GIOChannel *chan,
+                GIOCondition cond,
+                gpointer data)
+{
+       char buf[BUFFER_LEN] = { 0 };
+
+       gsize len = 0;
+       long test_id;
+
+       memset(buf, 0, sizeof(buf));
+
+       if (g_io_channel_read_chars(chan, buf, sizeof(buf), &len, NULL) == G_IO_STATUS_ERROR)
+               return FALSE;
+
+       tc_usage_print();
+       test_id = atoi(buf);
+
+       if (test_id)
+               g_idle_add(test_input_callback, (void *)test_id);
+
+       return TRUE;
+}
+
+
+int main(int argc, char ** argv)
+{
+       GIOChannel *key_io;
+
+//#if !GLIB_CHECK_VERSION(2,35,0)
+//   g_type_init();
+//#endif
+
+       key_io = g_io_channel_unix_new(fileno(stdin));
+
+       g_io_channel_set_encoding(key_io, NULL, NULL);
+       g_io_channel_set_flags(key_io, G_IO_FLAG_NONBLOCK, NULL);
+
+       g_io_add_watch(key_io, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+               key_event_cb, NULL);
+
+       g_io_channel_unref(key_io);
+
+       main_loop = g_main_loop_new(NULL, FALSE);
+
+       g_main_loop_run(main_loop);
+
+       return 0;
+}