Update the latest source
authorSungjae Lim <neueziel.lim>
Wed, 22 Aug 2012 05:33:10 +0000 (14:33 +0900)
committerSungjae Lim <neueziel.lim>
Wed, 22 Aug 2012 05:33:10 +0000 (14:33 +0900)
129 files changed:
CMakeLists.txt
TC/_export_target_env.sh [changed mode: 0644->0755]
TC/build.sh [changed mode: 0644->0755]
TC/clean.sh [changed mode: 0644->0755]
TC/execute.sh [changed mode: 0644->0755]
TC/testcase/utc_net_nfc_client_data.c [changed mode: 0644->0755]
TC/testcase/utc_net_nfc_client_exchanger.c [changed mode: 0644->0755]
TC/testcase/utc_net_nfc_client_internal_se.c [changed mode: 0644->0755]
TC/testcase/utc_net_nfc_client_ndef_message.c [changed mode: 0644->0755]
TC/testcase/utc_net_nfc_client_ndef_record.c [changed mode: 0644->0755]
TC/testcase/utc_net_nfc_client_nfc.c [changed mode: 0644->0755]
TC/testcase/utc_net_nfc_client_tag.c [changed mode: 0644->0755]
TC/testcase/utc_net_nfc_client_tag_felica.c [changed mode: 0644->0755]
TC/testcase/utc_net_nfc_client_tag_jewel.c [changed mode: 0644->0755]
TC/testcase/utc_net_nfc_client_tag_mifare.c [changed mode: 0644->0755]
TC/testcase/utc_net_nfc_client_target_info.c [changed mode: 0644->0755]
TC/tet_scen [changed mode: 0644->0755]
debian/changelog [changed mode: 0644->0755]
debian/control [changed mode: 0644->0755]
debian/libnfc-common-lib-0.postinst.in [new file with mode: 0755]
debian/libnfc-manager-0.init.in
debian/libnfc-manager-0.install.in
debian/libnfc-manager-0.postinst.in
debian/rules
doxygen/doxygen.conf [changed mode: 0644->0755]
packaging/libnfc-manager-0.init.in [changed mode: 0644->0755]
packaging/nfc-manager.spec
src/agent/CMakeLists.txt [deleted file]
src/agent/include/net_nfc_dbus_agent_obj_private.h [deleted file]
src/agent/net_nfc_agent.c [deleted file]
src/agent/net_nfc_dbus_agent_obj.c [deleted file]
src/agent/resource/com.samsung.slp.nfc.agent.service [deleted file]
src/agent/resource/dbus_agent.xml [deleted file]
src/clientlib/CMakeLists.txt
src/clientlib/include/net_nfc.h
src/clientlib/include/net_nfc_apdu.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_client_dispatcher_private.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_client_ipc_private.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_client_nfc_private.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_client_util_private.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_data.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_exchanger.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_exchanger_private.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_internal_se.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_llcp.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_ndef_message.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_ndef_message_handover.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_ndef_record.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_sign_record.h [new file with mode: 0755]
src/clientlib/include/net_nfc_tag.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_tag_felica.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_tag_jewel.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_tag_mifare.h [changed mode: 0644->0755]
src/clientlib/include/net_nfc_target_info.h [changed mode: 0644->0755]
src/clientlib/net_nfc_client_data.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_dispatcher.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_exchanger.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_internal_se.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_ipc.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_llcp.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_ndef_message_handover.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_ndef_record.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_nfc.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_sign_record.c [new file with mode: 0755]
src/clientlib/net_nfc_client_tag.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_tag_felica.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_tag_jewel.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_tag_mifare.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_target_info.c [changed mode: 0644->0755]
src/clientlib/net_nfc_client_test.c
src/clientlib/net_nfc_client_util.c [changed mode: 0644->0755]
src/commonlib/CMakeLists.txt
src/commonlib/include/net_nfc_debug_private.h [changed mode: 0644->0755]
src/commonlib/include/net_nfc_oem_controller.h
src/commonlib/include/net_nfc_typedef.h [changed mode: 0644->0755]
src/commonlib/include/net_nfc_typedef_private.h [changed mode: 0644->0755]
src/commonlib/include/net_nfc_util_defines.h [changed mode: 0644->0755]
src/commonlib/include/net_nfc_util_handover.h [changed mode: 0644->0755]
src/commonlib/include/net_nfc_util_ndef_message.h [changed mode: 0644->0755]
src/commonlib/include/net_nfc_util_ndef_parser.h [changed mode: 0644->0755]
src/commonlib/include/net_nfc_util_ndef_record.h [changed mode: 0644->0755]
src/commonlib/include/net_nfc_util_openssl_private.h [new file with mode: 0644]
src/commonlib/include/net_nfc_util_private.h
src/commonlib/include/net_nfc_util_sign_record.h [new file with mode: 0755]
src/commonlib/net_nfc_util_handover.c
src/commonlib/net_nfc_util_ndef_message.c [changed mode: 0644->0755]
src/commonlib/net_nfc_util_ndef_parser.c [changed mode: 0644->0755]
src/commonlib/net_nfc_util_ndef_record.c [changed mode: 0644->0755]
src/commonlib/net_nfc_util_openssl.c [new file with mode: 0644]
src/commonlib/net_nfc_util_sign_record.c [new file with mode: 0644]
src/manager/CMakeLists.txt [changed mode: 0644->0755]
src/manager/include/net_nfc_app_util_private.h
src/manager/include/net_nfc_controller_private.h
src/manager/include/net_nfc_dbus_service_obj_private.h [deleted file]
src/manager/include/net_nfc_manager_util_private.h [changed mode: 0644->0755]
src/manager/include/net_nfc_server_dispatcher_private.h [changed mode: 0644->0755]
src/manager/include/net_nfc_server_ipc_private.h [changed mode: 0644->0755]
src/manager/include/net_nfc_service_llcp_handover_private.h [changed mode: 0644->0755]
src/manager/include/net_nfc_service_llcp_private.h [changed mode: 0644->0755]
src/manager/include/net_nfc_service_private.h
src/manager/include/net_nfc_service_se_private.h [changed mode: 0644->0755]
src/manager/include/net_nfc_service_tag_private.h [changed mode: 0644->0755]
src/manager/include/net_nfc_service_vconf_private.h [changed mode: 0644->0755]
src/manager/include/net_nfc_util_access_control_private.h [moved from src/agent/include/net_nfc_agent_private.h with 57% similarity]
src/manager/net_nfc_app_util.c
src/manager/net_nfc_controller.c [changed mode: 0644->0755]
src/manager/net_nfc_dbus_service_obj.c [deleted file]
src/manager/net_nfc_manager.c [changed mode: 0644->0755]
src/manager/net_nfc_manager_util.c [changed mode: 0644->0755]
src/manager/net_nfc_server_dispatcher.c [changed mode: 0644->0755]
src/manager/net_nfc_server_ipc.c [changed mode: 0644->0755]
src/manager/net_nfc_service.c [changed mode: 0644->0755]
src/manager/net_nfc_service_llcp.c [changed mode: 0644->0755]
src/manager/net_nfc_service_llcp_handover.c
src/manager/net_nfc_service_se.c [changed mode: 0644->0755]
src/manager/net_nfc_service_tag.c [changed mode: 0644->0755]
src/manager/net_nfc_service_vconf.c [changed mode: 0644->0755]
src/manager/net_nfc_util_access_control.c [new file with mode: 0644]
src/manager/resource/dbus_service.xml [deleted file]
src/manager/resource/nfc-manager-config.txt.in [deleted file]
test_clinet_app/bt_paring/bt_paring.c [changed mode: 0644->0755]
test_clinet_app/ndef-tool/CMakeLists.txt [new file with mode: 0644]
test_clinet_app/ndef-tool/ndef-tool-display.c [new file with mode: 0755]
test_clinet_app/ndef-tool/ndef-tool-sign.c [new file with mode: 0755]
test_clinet_app/ndef-tool/ndef-tool-tag.c [new file with mode: 0755]
test_clinet_app/ndef-tool/ndef-tool.c [new file with mode: 0755]
test_clinet_app/ndef-tool/ndef-tool.h [new file with mode: 0755]
test_clinet_app/nfc_client/main.c [changed mode: 0644->0755]
test_clinet_app/nfc_client/nfc_api_test.h [changed mode: 0644->0755]

index 3c8cf7b..70ea038 100755 (executable)
@@ -4,6 +4,6 @@ MESSAGE("build nfc-common-lib and nfc-manager")
 
 ADD_SUBDIRECTORY(src/commonlib)
 ADD_SUBDIRECTORY(src/manager)
-ADD_SUBDIRECTORY(src/agent)
 ADD_SUBDIRECTORY(src/clientlib)
+ADD_SUBDIRECTORY(test_clinet_app/ndef-tool)
 
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 70e4a29..b2f0b43
@@ -1,19 +1,3 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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 <stdint.h>
 
old mode 100644 (file)
new mode 100755 (executable)
index fb9d3b4..c769918
@@ -1,19 +1,3 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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 <net_nfc_data.h>
 #include <stdint.h>
old mode 100644 (file)
new mode 100755 (executable)
index ae897b8..766fd36
@@ -1,19 +1,3 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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 "net_nfc_tag.h"
old mode 100644 (file)
new mode 100755 (executable)
index 581353f..833f5f3
@@ -1,19 +1,3 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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 <stdint.h>
 
old mode 100644 (file)
new mode 100755 (executable)
index 78a7d05..85cf793
@@ -1,19 +1,3 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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 <stdint.h>
 
old mode 100644 (file)
new mode 100755 (executable)
index fa72b08..3d7315d
@@ -1,19 +1,3 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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 "net_nfc.h"
old mode 100644 (file)
new mode 100755 (executable)
index bf326a3..b89fb92
@@ -1,19 +1,3 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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 <stdint.h>
 
old mode 100644 (file)
new mode 100755 (executable)
index 71062a0..acbdef1
@@ -1,19 +1,3 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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 "net_nfc_ndef_record.h"
old mode 100644 (file)
new mode 100755 (executable)
index 88b5a26..5578065
@@ -1,19 +1,3 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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 "net_nfc_tag.h"
old mode 100644 (file)
new mode 100755 (executable)
index fcb2718..65d1f97
@@ -1,19 +1,3 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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 "net_nfc_tag.h"
old mode 100644 (file)
new mode 100755 (executable)
index 1307f6d..6b95abe
@@ -1,19 +1,3 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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 "net_nfc_typedef.h"
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 515721c..72e2214
@@ -1,7 +1,614 @@
+nfc-manager (0.0.1-77) unstable; urgency=low
+
+  * JSR257 NDEF absoluteURI issue resolved
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-77
+
+ -- Sechang Sohn <sc.sohn@samsung.com> Thu, 31 May 2012 10:18:24 +0900
+
+nfc-manager (0.0.1-76) unstable; urgency=low
+
+  * Add the function checking nfc feature
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-76
+
+ -- Wonkyu Kwon <wonkyu.kwon@samsung.com>  Wed, 30 May 2012 16:24:50 +0900
+
+nfc-manager (0.0.1-75) unstable; urgency=low
+
+  * Modify the plugin check routine
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-75
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Thu, 24 May 2012 17:00:11 +0900
+
+nfc-manager (0.0.1-74) unstable; urgency=low
+
+  * Add signature RTD library and ndef-tool
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-74
+
+ -- Wonkyu Kwon <wonkyu.kwon@samsung.com>  Mon, 21 May 2012 15:32:08 +0900
+
+nfc-manager (0.0.1-73) unstable; urgency=low
+
+  * Modify the Private vconf.
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-73
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Mon, 16 May 2012 11:00:11 +0900
+
+nfc-manager (0.0.1-72) unstable; urgency=low
+
+  * Modify the absolute uri.
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-72
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Mon, 14 May 2012 17:00:11 +0900
+
+nfc-manager (0.0.1-71) unstable; urgency=low
+
+  * Add the routine to initialize the vconf for nfc
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-71
+
+ -- Junyong Sim <junyong.sim@samsung.com>  Mon, 07 May 2012 16:37:50 +0900
+
+nfc-manager (0.0.1-70) unstable; urgency=low
+
+  * Remove unused file
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-70
+
+ -- Wonkyu Kwon <wonkyu.kwon@samsung.com>  Fri, 04 May 2012 14:21:29 +0900
+
+nfc-manager (0.0.1-69) unstable; urgency=low
+
+  * Add the pm's lock&unlock api.
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-69
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Thu, 03 May 2012 17:00:11 +0900
+
+nfc-manager (0.0.1-68) unstable; urgency=low
+
+  * Remove the nfc-agent's daemon
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-68
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Thu, 26 Apr 2012 17:17:17 +0900
+
+nfc-manager (0.0.1-67) unstable; urgency=low
+
+  * initialize vconf value : db/nfc/feature
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-67
+
+ -- Junyong Sim <junyong.sim@samsung.com>  Tue, 24 Apr 2012 21:17:17 +0900
+
+nfc-manager (0.0.1-66) unstable; urgency=low
+
+  * apply the access control in SE transaction.
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-66
+
+ -- Wonkyu Kwon <wonkyu.kwon@samsung.com>  Fri, 20 Apr 2012 11:00:00 +0900
+
+nfc-manager (0.0.1-65) unstable; urgency=low
+
+  * Check the state using nfc set state func
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-65
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Thu, 19 Apr 2012 13:54:15 +0900
+
 nfc-manager (0.0.1-64) unstable; urgency=low
 
-  * change spec file
-  * Git: pkgs/n/nfc-manager
+  * Modify the spec & net_nfc_set_state's return value
+  * Git: slp/pkgs/n/nfc-manager
   * Tag: nfc-manager_0.0.1-64
 
- -- Junyong Sim <junyong.sim@samsung.com>  Mon, 23 Apr 2012 01:53:06 +0900
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Thu, 05 Apr 2012 19:32:15 +0900
+
+nfc-manager (0.0.1-63) unstable; urgency=low
+
+  * package upload
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-63
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Wed, 04 Apr 2012 16:58:15 +0900
+
+nfc-manager (0.0.1-62) unstable; urgency=low
+
+  * Check the plugin's so file for Pulic Version
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-62
+
+ -- Sungjae Lim <neuezieil.lim@samsung.com>  Wed, 04 Apr 2012 10:58:15 +0900
+
+nfc-manager (0.0.1-61) unstable; urgency=low
+
+  * Add the routine to check tag stage
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-61
+
+ -- Junyong Sim <junyong.sim@samsung.com>  Thu, 29 Mar 2012 14:38:15 +0900
+
+nfc-manager (0.0.1-60) unstable; urgency=low
+
+  * Modify SE event
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-60
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Fri, 16 Mar 2012 16:11:31 +0900
+
+nfc-manager (0.0.1-59) unstable; urgency=low
+
+  * change appsvc operation
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-59
+
+ -- Wonkyu Kwon <wonkyu.kwon@samsung.com>  Thu, 15 Mar 2012 15:30:00 +0900
+
+nfc-manager (0.0.1-58) unstable; urgency=low
+
+  * bug fix about trans param
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-58
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Thu, 15 Mar 2012 11:06:38 +0900
+
+nfc-manager (0.0.1-57) unstable; urgency=low
+
+  * remove capi dependency
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-57
+
+ -- Junyong Sim <junyong.sim@samsung.com>  Wed, 14 Mar 2012 19:54:13 +0900
+
+nfc-manager (0.0.1-56) unstable; urgency=low
+
+  * Broadcasting enable
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-56
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Mon, 12 Mar 2012 16:52:39 +0900
+
+nfc-manager (0.0.1-55) unstable; urgency=low
+
+  * Tag connection check api change
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-55
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Wed, 07 Mar 2012 17:21:51 +0900
+
+nfc-manager (0.0.1-54) unstable; urgency=low
+
+  * add new client api
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-54
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Tue, 06 Mar 2012 20:30:19 +0900
+
+nfc-manager (0.0.1-53) unstable; urgency=low
+
+  * fix the crash issue of nfc manager in emulator
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-53
+
+ -- Junyong Sim <junyong.sim@samsung.com>  Mon, 05 Mar 2012 10:02:00 +0900
+
+nfc-manager (0.0.1-52) unstable; urgency=low
+
+  * Upload package
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-52
+
+ -- Wonkyu Kwon <wonkyu.kwon@samsung.com>  Mon, 27 Feb 2012 17:00:00 +0900
+
+nfc-manager (0.0.1-51) unstable; urgency=low
+
+  * Implement the check routin to distinguish the driver
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-51
+
+ -- Sechang Sohn <sc.sohn@samsung.com>  Tue, 21 Feb 2012 13:06:37 +0900
+
+nfc-manager (0.0.1-50) unstable; urgency=low
+
+  * Implement the check routin to distinguish the driver
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-50
+
+ -- Sungjae Lim <neuezieil.lim@samsung.com>  Mon, 20 Feb 2012 10:36:28 +0900
+
+nfc-manager (0.0.1-49) unstable; urgency=low
+
+  * Update changelog
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-49
+
+ -- Junyong Sim <junyong.sim@samsung.com>  Mon, 06 Feb 2012 10:36:28 +0900
+
+nfc-manager (0.0.1-48) unstable; urgency=low
+
+  * Implement the polling loop after wake-up.
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-48
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Fri, 03 Feb 2012 14:47:35 +0900
+
+nfc-manager (0.0.1-47) unstable; urgency=low
+
+  * Modify the LTO value from 10 to 100.
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-47
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Wed, 01 Feb 2012 09:23:35 +0900
+
+nfc-manager (0.0.1-46) unstable; urgency=low
+
+  * Fix build error when is using cxx compiler
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-46
+
+ -- Wonkyu Kwon <wonkyu.kwon@samsung.com>  Thu, 26 Jan 2012 15:00:35 +0900
+
+nfc-manager (0.0.1-45) unstable; urgency=low
+
+  * Change IPC request algorithm from client to server
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-45
+
+ -- Wonkyu Kwon <wonkyu.kwon@samsung.com>  Thu, 29 Dec 2011 13:00:35 +0900
+
+nfc-manager (0.0.1-44) unstable; urgency=low
+
+  * modify changelog
+  * Git: slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-44
+
+ -- Junyong Sim <junyong.sim@samsung.com>  Thu, 15 Dec 2011 18:58:35 +0900
+
+nfc-manager (0.0.1-43) unstable; urgency=low
+
+  * Change ambiguous value name and option name
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-43
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Wed, 07 Dec 2011 12:45:19 +0900
+
+nfc-manager (0.0.1-42) unstable; urgency=low
+
+  * Clean unused code
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-42
+
+ -- Wonkyu kwon <wonkyu.kwon@samsung.com>  Tue, 06 Dec 2011 17:40:00 +0900
+nfc-manager (0.0.1-41) unstable; urgency=low
+
+  *Modify the code
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-41
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Tue, 06 Dec 2011 12:40:45 +0900
+
+nfc-manager (0.0.1-40) unstable; urgency=low
+
+  *Change AUTHORS.
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-40
+
+ -- Junyong Sim <junyong.sim@samsung.com>  Sat, 03 Dec 2011 13:05:45 +0900
+
+nfc-manager (0.0.1-39) unstable; urgency=low
+
+  *Package Upload.
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-39
+
+ -- sungjae.lim <neueziel.lim@samsung.com>  Fri, 02 Dec 2011 19:57:07 +0900
+
+nfc-manager (0.0.1-38) unstable; urgency=low
+
+  *Change the boilerplate.
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-38
+
+ -- sungjae.lim <neueziel.lim@samsung.com>  Fri, 02 Dec 2011 19:00:07 +0900
+
+nfc-manager (0.0.1-37) unstable; urgency=low
+
+  *Change the function name for 3rd part.
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-37
+
+ -- sungjae.lim <neueziel.lim@samsung.com>  Fri, 02 Dec 2011 11:20:07 +0900
+
+nfc-manager (0.0.1-36) unstable; urgency=low
+
+  *Bug fix.
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-36
+
+ -- constant.lee <constant.lee@samsung.com>  Thu, 01 Dec 2011 21:08:07 +0900
+
+nfc-manager (0.0.1-35) unstable; urgency=low
+
+  *Change the boilerplate.
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-35
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Thu, 01 Dec 2011 15:55:42 +0900
+
+nfc-manager (0.0.1-34) unstable; urgency=low
+
+  * Package upload
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-34
+
+ -- Wonkyu Kwon <wonkyu.kwon@samsung.com>  Wed, 30 Nov 2011 18:00:00 +0900
+
+nfc-manager (0.0.1-33) unstable; urgency=low
+
+  *some error value change
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-33
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Tue, 29 Nov 2011 14:45:40 +0900
+
+nfc-manager (0.0.1-32) unstable; urgency=low
+
+  *NET_NFC_MESSSAGE_P2P_RECEIVE problem fix 
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-32
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Tue, 29 Nov 2011 13:07:01 +0900
+
+nfc-manager (0.0.1-31) unstable; urgency=low
+
+  *p2p popup problem fix.
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-31 
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Fri, 25 Nov 2011 15:04:48 +0900
+
+nfc-manager (0.0.1-30) unstable; urgency=low
+
+  *bug fix
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag : nfc-manager_0.0.1-30 
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Fri, 18 Nov 2011 12:45:58 +0900
+
+nfc-manager (0.0.1-29) unstable; urgency=low
+
+  *LLCP problem was fixed. and some message name change.
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-29
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Wed, 16 Nov 2011 22:55:18 +0900
+
+nfc-manager (0.0.1-28) unstable; urgency=low
+
+  *NXP parser was seperated to net_nfc_util_ndef_parser.c
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-28 
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Wed, 02 Nov 2011 18:30:57 +0900
+
+nfc-manager (0.0.1-27) unstable; urgency=low
+
+  *Modify app launch condition
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-27
+
+ -- Wonkyu Kwon <wonkyu.kwon@samsung.com>  Wed, 02 Nov 2011 13:50:00 +0900
+
+nfc-manager (0.0.1-26) unstable; urgency=low
+
+  *ndef memory problem fix
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-26
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Mon, 31 Oct 2011 17:54:56 +0900
+
+nfc-manager (0.0.1-25) unstable; urgency=low
+
+  *LLCP flow change. 
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-25
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Fri, 28 Oct 2011 14:57:26 +0900
+
+nfc-manager (0.0.1-24) unstable; urgency=low
+
+  *Change the boilerplate.
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-24
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Thu, 27 Oct 2011 14:55:42 +0900
+
+nfc-manager (0.0.1-23) unstable; urgency=low
+
+  *Add the NPP for android NFC.
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-23
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Wed, 26 Oct 2011 17:19:02 +0900
+
+nfc-manager (0.0.1-22) unstable; urgency=low
+
+  *Modify the code for Prevent.
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-22
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Mon, 24 Oct 2011 19:38:59 +0900
+
+nfc-manager (0.0.1-21ubuntu2) unstable; urgency=low
+
+  *add server state.
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-21
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Wed, 12 Oct 2011 20:10:02 +0900
+
+nfc-manager (0.0.1-20ubuntu1) unstable; urgency=low
+
+  *bug fix. when read ndef fail, data was free two times.
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-20 
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Mon, 10 Oct 2011 18:51:42 +0900
+
+nfc-manager (0.0.1-19) unstable; urgency=low
+
+  *Add message broadcasting. and implement net_nfc_get_server_state
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-19
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Thu, 06 Oct 2011 16:01:59 +0900
+
+nfc-manager (0.0.1-18) unstable; urgency=low
+
+  *Add the prefix net to the NFC Manager FW
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-18
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Thu, 22 Sep 2011 16:51:30 +0900
+
+nfc-manager (0.0.1-17) unstable; urgency=low
+
+  *Add the prefix net to the common and client lib
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-17
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Tue, 20 Sep 2011 10:48:30 +0900
+
+nfc-manager (0.0.1-16) unstable; urgency=low
+
+  *Modify the manager for setting and exchanger
+  *Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  *Tag: nfc-manager_0.0.1-16
+
+ -- Sungjae Lim <neueziel.lim@samsung.com>  Wed, 7 Sep 2011 19:19:20 +0900
+
+nfc-manager (0.0.1-15) unstable; urgency=low
+
+  * add NDEF parser
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-15
+
+ -- Sangsoo Lee <constant.lee@samsung.com>  Wed, 24 Aug 2011 15:27:30 +0900
+
+nfc-manager (0.0.1-14) unstable; urgency=low
+
+  * change the traceive function parameter
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-14
+
+ -- root <bumj.kim@samsung.com>  Mon, 27 Jun 2011 20:15:09 +0900
+
+nfc-manager (0.0.1-13) unstable; urgency=low
+
+  * updates package for CAPI
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-13
+
+ -- root <bumj.kim@samsung.com>  Fri, 24 Jun 2011 18:52:20 +0900
+
+nfc-manager (0.0.1-12) unstable; urgency=low
+
+  * adding missing header file
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-12
+
+ -- root <bumj.kim@samsung.com>  Wed, 15 Jun 2011 10:04:58 +0900
+
+nfc-manager (0.0.1-11) unstable; urgency=low
+
+  * Change llcp connection policy and sepcific API for tags
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-11
+
+ -- root <bumj.kim@samsung.com>  Wed, 15 Jun 2011 09:47:21 +0900
+
+nfc-manager (0.0.1-10) unstable; urgency=low
+
+  * fix the compile error and add comments of exception
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-10
+
+ -- root <bumj.kim@samsung.com>  Wed, 18 May 2011 14:31:45 +0900
+
+nfc-manager (0.0.1-9) unstable; urgency=low
+
+  * update NFC manager API and split the solution package and manger package
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-9 
+
+ -- root <bumj.kim@samsung.com>  Wed, 18 May 2011 14:27:37 +0900
+
+nfc-manager (0.0.1-8) unstable; urgency=low
+
+  * remove the dependency of bt-engine 
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-8 
+
+ -- Bumjoon Kim <bumj.kim@samsung.com>  Fri, 11 Mar 2011 09:52:48 +0900
+
+nfc-manager (0.0.1-7) unstable; urgency=low
+
+  * fix the prevent issues extra
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-7 
+
+ -- Bumjoon Kim <bumj.kim@samsung.com>  Thu, 17 Feb 2011 17:12:47 +0900
+
+nfc-manager (0.0.1-6) unstable; urgency=low
+
+  * fix the prevent issues 
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-6 
+
+ -- Bumjoon Kim <bumj.kim@samsung.com>  Tue, 15 Feb 2011 21:12:22 +0900
+
+nfc-manager (0.0.1-5) unstable; urgency=low
+
+  * enhance the stablity of nfc-manager
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-5 
+
+ -- Bumjoon Kim <bumj.kim@samsung.com>  Tue, 01 Feb 2011 18:21:56 +0900
+
+nfc-manager (0.0.1-4) unstable; urgency=low
+
+  * Vice President demo version
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-4 
+
+ -- Bumjoon Kim <bumj.kim@samsung.com>  Thu, 27 Jan 2011 13:49:18 +0900
+
+nfc-manager (0.0.1-3) unstable; urgency=low
+
+  * adding settup switch to enable disable nfc-manager
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-3 
+
+ -- Bumjoon Kim <bumj.kim@samsung.com>  Mon, 24 Jan 2011 16:21:44 +0900
+
+nfc-manager (0.0.1-2) unstable; urgency=low
+
+  * nfc-manager and stand alone mode is enabled 
+  * Git: 165.213.180.234:slp/pkgs/n/nfc-manager
+  * Tag: nfc-manager_0.0.1-2
+
+ -- Bumjoon Kim <bumj.kim@samsung.com>  Tue, 04 Jan 2011 20:21:19 +0900
+
+nfc-manager (0.0.1-1) unstable; urgency=low
+
+  * first source package for building
+
+ -- hyogil.kim <hyogil.kim@samsung.com>  Wed, 3 Nov 2010 13:43:34 +0900
+
old mode 100644 (file)
new mode 100755 (executable)
index ee6d135..5706b1d
@@ -2,7 +2,7 @@ Source: nfc-manager
 Section: libs
 Priority: extra
 Maintainer: Sangsoo Lee <constant.lee@samsung.com>, Sungjae Lim <sungjae.lim@samsung.com>, Sechang Sohn <sc.sohn@samsung.com>
-Build-Depends: debhelper (>= 5), libaul-1-dev, libglib2.0-dev, libvconf-dev, libsecurity-server-client-dev, libbluetooth-frwk-dev,libdbus-glib-1-dev, dlog-dev, libecore-dev, libslp-tapi-dev, libappsvc-dev, libcurl-dev, libheynoti-dev, libsvi-dev
+Build-Depends: debhelper (>= 5), libaul-1-dev, libglib2.0-dev, libvconf-dev, libsecurity-server-client-dev, libbluetooth-frwk-dev,libdbus-glib-1-dev, dlog-dev, libecore-dev, libslp-tapi-dev, libappsvc-dev, libcurl-dev, libheynoti-dev, libsvi-dev, libssl-dev, smartcard-service-dev, smartcard-service-common-dev, libslp-pm-dev
 Standards-Version: 0.0.1
 
 Package: libnfc-common-lib-0
diff --git a/debian/libnfc-common-lib-0.postinst.in b/debian/libnfc-common-lib-0.postinst.in
new file mode 100755 (executable)
index 0000000..2993487
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+#Add boot sequence script
+if [ ${USER} == "root" ]
+then
+vconftool set -t bool memory/private/nfc-manager/popup_disabled 0 -u 5000
+else
+vconftool set -t bool memory/private/nfc-manager/popup_disabled 0
+fi
index 9520480..c5557cc 100755 (executable)
@@ -14,7 +14,7 @@
 # Author: Wonkyu Kwon <wonkyu.kwon@samsung.com>
 
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
-DAEMON=/usr/bin/nfc-agent # Introduce the server's location here
+DAEMON=/usr/bin/nfc-manager-daemon
 DAEMON_ARGS=""             # Arguments to run the daemon with
 
 # Exit if the package is not installed
index cfbbd96..71fe461 100755 (executable)
@@ -1,7 +1,5 @@
-@DATADIR@/data/nfc-manager-daemon/config/nfc-manager-config.txt
 @PREFIX@/lib/libnfc.so.*
 @PREFIX@/bin/*
-@PREFIX@/share/dbus-1/services/*
 /etc/init.d/*
 /etc/rc.d/*
 
index 89c187d..30520f4 100644 (file)
@@ -3,6 +3,10 @@
 if [ ${USER} == "root" ]
 then
 vconftool set -t bool db/nfc/feature 0 -u 5000
+vconftool set -t bool db/nfc/enable 0 -u 5000
+vconftool set -t bool db/nfc/sbeam 0 -u 5000
 else
 vconftool set -t bool db/nfc/feature 0
+vconftool set -t bool db/nfc/enable 0
+vconftool set -t bool db/nfc/sbeam 0
 fi
index 9565f36..22a2767 100755 (executable)
@@ -13,7 +13,6 @@ CFLAGS ?= -Wall -g
 CXXFLAGS ?=  -Wall -g
 LDFLAGS ?= 
 PREFIX ?= /usr
-DATADIR ?= /opt
 
 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
        CFLAGS += -O0
@@ -49,7 +48,6 @@ build-stamp: configure-stamp
        for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
                cat $$f > $${f%.in}; \
                sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
-               sed -i -e "s#@DATADIR@#$(DATADIR)#g" $${f%.in}; \
        done
 
 
@@ -83,8 +81,6 @@ install: build
        dh_clean -k 
        dh_installdirs
 
-       mkdir -p $(CURDIR)/debian/tmp/opt/data/nfc-manager-daemon/config
-       cp -af $(CURDIR)/src/manager/resource/nfc-manager-config.txt.in $(CURDIR)/debian/tmp/opt/data/nfc-manager-daemon/config/nfc-manager-config.txt
        mkdir -p $(CURDIR)/debian/tmp/etc/init.d
        cp -af $(CURDIR)/debian/libnfc-manager-0.init.in $(CURDIR)/debian/tmp/etc/init.d/libnfc-manager-0
        
@@ -105,9 +101,9 @@ binary-indep: build install
 binary-arch: build install
        dh_testdir
        dh_testroot
-       dh_installchangelogs 
+#      dh_installchangelogs 
 #      dh_installdocs
-       dh_installexamples
+#      dh_installexamples
        dh_install --sourcedir=debian/tmp
 #      dh_installmenu
 #      dh_installdebconf       
@@ -119,7 +115,7 @@ binary-arch: build install
 #      dh_installinit
 #      dh_installcron
 #      dh_installinfo
-       dh_installman
+#      dh_installman
        dh_link
        dh_strip --dbg-package=libnfc-manager-dbg --dbg-package=libnfc-common-lib-dbg
        dh_compress
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index a471b96..b2aba5d
@@ -1,12 +1,12 @@
 #!/bin/sh
 ### BEGIN INIT INFO
-# Provides:          nfc-agent
+# Provides:          nfc-manager-daemon
 # Required-Start:
 # Required-Stop:
 # Default-Start:     3 5
 # Default-Stop:      0
-# Short-Description: NFC agent
-# Description:       NFC agent
+# Short-Description: NFC manager
+# Description:       NFC manager
 #
 #
 ### END INIT INFO
@@ -14,7 +14,7 @@
 # Author: Wonkyu Kwon <wonkyu.kwon@samsung.com>
 
 # PATH should only include /usr/* if it runs after the mountnfs.sh script
-DAEMON=/usr/bin/nfc-agent # Introduce the server's location here
+DAEMON=/usr/bin/nfc-manager-daemon
 DAEMON_ARGS=""             # Arguments to run the daemon with
 
 # Exit if the package is not installed
index efc844d..28b9638 100644 (file)
@@ -1,10 +1,9 @@
-#sbs-git:slp/pkgs/n/nfc-manager nfc-manager 0.0.1 7e42d204f11700974e83188adca03dcd1b0f0e9c
 Name:       nfc-manager
 Summary:    NFC framework manager
-Version: 0.0.1
-Release:    1
+Version:    0.0.3
+Release:    9
 Group:      libs
-License:    Flora Software License
+License:    Samsung Proprietary License
 Source0:    %{name}-%{version}.tar.gz
 Source1:    libnfc-manager-0.init.in
 BuildRequires: pkgconfig(aul)
@@ -21,6 +20,10 @@ BuildRequires: pkgconfig(mm-sound)
 BuildRequires: pkgconfig(appsvc)
 BuildRequires: pkgconfig(heynoti)
 BuildRequires: pkgconfig(svi)
+BuildRequires: pkgconfig(smartcard-service)
+BuildRequires: pkgconfig(smartcard-service-common)
+BuildRequires: pkgconfig(libssl)
+BuildRequires: pkgconfig(pmapi)
 BuildRequires: cmake
 BuildRequires: gettext-tools
 Requires(post):   /sbin/ldconfig
@@ -74,15 +77,14 @@ chmod 755 %{buildroot}/etc/init.d/libnfc-manager-0
 
 %post
 /sbin/ldconfig
-#vconftool set -t string memory/nfc/client/deb.com.samsung.gallery "" -g 6517 -i
-#vconftool set -t string memory/nfc/client/deb.com.samsung.browser "" -g 6517 -i
-#vconftool set -t string memory/nfc/client/deb.com.samsung.contacts "" -g 6517 -i
-#vconftool set -t string memory/nfc/client/deb.com.samsung.video-player "" -g 6517 -i
-#vconftool set -t string memory/nfc/client/eeprom "" -g 6517 -i
 vconftool set -t bool db/nfc/feature 0 -u 5000
+vconftool set -t bool db/nfc/enable 0 -u 5000
+vconftool set -t bool db/nfc/sbeam 0 -u 5000
 
-ln -s /etc/rc.d/init.d/libnfc-manager-0 /etc/rc.d/rc3.d/S81libnfc-manager-0
-ln -s /etc/rc.d/init.d/libnfc-manager-0 /etc/rc.d/rc5.d/S81libnfc-manager-0
+vconftool set -t bool memory/private/nfc-manager/popup_disabled 0 -u 5000
+
+ln -s /etc/init.d/libnfc-manager-0 /etc/rc.d/rc3.d/S81libnfc-manager-0
+ln -s /etc/init.d/libnfc-manager-0 /etc/rc.d/rc5.d/S81libnfc-manager-0
 
 %postun
 /sbin/ldconfig
@@ -97,12 +99,10 @@ rm -f /etc/rc.d/rc5.d/S81libnfc-manager-0
 
 %files
 %defattr(-,root,root,-)
-#@DATADIR@/data/nfc-manager-daemon/config/nfc-manager-config.txt
 %{_libdir}/libnfc.so.1
 %{_libdir}/libnfc.so.1.0.0
-%{_prefix}/bin/nfc-agent
 %{_prefix}/bin/nfc-manager-daemon
-%{_prefix}/share/dbus-1/services/com.samsung.slp.nfc.agent.service
+%{_prefix}/bin/ndef-tool
 /etc/init.d/libnfc-manager-0
 
 %files devel
diff --git a/src/agent/CMakeLists.txt b/src/agent/CMakeLists.txt
deleted file mode 100644 (file)
index 7707819..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(nfc C)
-
-SET(AGENT_DAEMON "nfc-agent")
-
-SET(AGENT_SRCS
-       ${CMAKE_CURRENT_SOURCE_DIR}/net_nfc_agent.c
-       ${CMAKE_CURRENT_SOURCE_DIR}/net_nfc_dbus_agent_obj.c
-)
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../commonlib/include)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../manager/include)
-
-IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
-       SET(CMAKE_BUILD_TYPE "Release")
-ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
-
-INCLUDE(FindPkgConfig)
-
-MESSAGE("CHECK MODULE in MANAGER ${agent_pkges_LDFLAGS}")
-
-pkg_check_modules(agent_pkges REQUIRED glib-2.0 gobject-2.0 vconf dlog dbus-glib-1)
-
-FOREACH(flag ${agent_pkges_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-
-# this for NFC flag
-
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration  -fno-strict-aliasing")
-
-SET(ARM_CFALGS "${ARM_CFLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -mno-thumb-interwork -msoft-float -Uarm -fno-common -fpic")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror-implicit-function-declaration")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-
-FIND_PROGRAM(UNAME NAMES uname)
-EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
-IF("${ARCH}" MATCHES "^arm.*")
-       ADD_DEFINITIONS("-DTARGET")
-       MESSAGE("add -DTARGET")
-       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARM_CFLAGS}")
-ENDIF()
-
-ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DSLP_DEBUG")
-ADD_DEFINITIONS("-fpie")
-
-#ADD_DEFINITIONS("-DSECURITY_SERVER")
-
-SET (DBUS_AUTO_ACTIVE 
-       ${CMAKE_CURRENT_SOURCE_DIR}/resource/com.samsung.slp.nfc.agent.service
-)
-
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
-
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-
-ADD_EXECUTABLE(${AGENT_DAEMON} ${AGENT_SRCS})
-
-TARGET_LINK_LIBRARIES(${AGENT_DAEMON} "-pie")
-TARGET_LINK_LIBRARIES(${AGENT_DAEMON} ${agent_pkges_LDFLAGS})
-
-ADD_CUSTOM_TARGET(dbus_agent_glue_private.h
-               COMMAND dbus-binding-tool --prefix=dbus_agent ${CMAKE_CURRENT_SOURCE_DIR}/resource/dbus_agent.xml 
-               --mode=glib-server --output=${CMAKE_CURRENT_SOURCE_DIR}/include/dbus_agent_glue_private.h
-               DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/resource/dbus_agent.xml
-)
-ADD_DEPENDENCIES(${AGENT_DAEMON} dbus_agent_glue_private.h)
-
-ADD_CUSTOM_TARGET(dbus_agent_binding_private.h
-               COMMAND dbus-binding-tool --prefix=dbus_agent ${CMAKE_CURRENT_SOURCE_DIR}/resource/dbus_agent.xml 
-               --mode=glib-client --output=${CMAKE_CURRENT_SOURCE_DIR}/include/dbus_agent_binding_private.h
-               DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/resource/dbus_agent.xml
-)
-ADD_DEPENDENCIES(${AGENT_DAEMON} dbus_agent_binding_private.h)
-
-INSTALL(TARGETS ${AGENT_DAEMON} DESTINATION bin)
-INSTALL(FILES ${DBUS_AUTO_ACTIVE} DESTINATION share/dbus-1/services/)
-
diff --git a/src/agent/include/net_nfc_dbus_agent_obj_private.h b/src/agent/include/net_nfc_dbus_agent_obj_private.h
deleted file mode 100644 (file)
index b067c39..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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-object.h>
-#include <dbus/dbus-glib-bindings.h>
-
-
-typedef struct _Dbus_Agent Dbus_Agent;
-typedef struct _Dbus_AgentClass Dbus_AgentClass;
-
-#define DBUS_AGENT_NAME "com.samsung.slp.nfc.agent"
-#define DBUS_AGENT_PATH "/com/samsung/slp/nfc/agent"
-
-
-GType dbus_agent_get_type (void);
-
-struct _Dbus_Agent
-{
-  GObject parent;
-  int status;
-  DBusGConnection *connection;
-};
-
-struct _Dbus_AgentClass
-{
-  GObjectClass parent;
-};
-
-#define DBUS_AGENT_TYPE                                (dbus_agent_get_type ())
-#define DBUS_AGENT(object)                     (G_TYPE_CHECK_INSTANCE_CAST ((object), DBUS_AGENT_TYPE, Dbus_Agent))
-#define DBUS_AGENT_CLASS(klass)                (G_TYPE_CHECK_CLASS_CAST ((klass), DBUS_AGENT_TYPE, Dbus_AgentClass))
-#define IS_DBUS_AGENT(object)                  (G_TYPE_CHECK_INSTANCE_TYPE ((object), DBUS_AGENT_TYPE))
-#define IS_DBUS_AGENT_CLASS(klass)     (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUS_AGENT_TYPE))
-#define DBUS_AGENT_GET_CLASS(obj)              (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUS_AGENT_TYPE, Dbus_AgentClass))
-
-typedef enum
-{
-  DBUS_AGENT_ERROR_INVALID_PRAM
-} Dbus_Agent_Error;
-
-GQuark dbus_agent_error_quark (void);
-#define DBUS_AGENT_ERROR dbus_agent_error_quark ()
-
-/**
- *     launch the nfc-manager
- */
-gboolean dbus_agent_launch (Dbus_Agent *dbus_agent, guint *result_val, GError **error);
-
-gboolean dbus_agent_terminate (Dbus_Agent *dbus_agent, guint *result_val, GError **error);
-
-
diff --git a/src/agent/net_nfc_agent.c b/src/agent/net_nfc_agent.c
deleted file mode 100644 (file)
index 1ef939d..0000000
+++ /dev/null
@@ -1,308 +0,0 @@
-/*\r
-  * Copyright 2012  Samsung Electronics Co., Ltd\r
-  *\r
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license\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
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <unistd.h>\r
-#include <pthread.h>\r
-#include <stdio.h>\r
-#include <sys/types.h>\r
-#include <sys/wait.h>\r
-\r
-#include <glib-object.h>\r
-#include <glib.h>\r
-#include <sys/utsname.h>\r
-#include "vconf.h"\r
-#include "vconf-keys.h"\r
-\r
-#include "net_nfc_debug_private.h"\r
-#include "net_nfc_util_defines.h"\r
-#include "net_nfc_dbus_agent_obj_private.h"\r
-#include "net_nfc_agent_private.h"\r
-\r
-const char *net_nfc_daemon = "/usr/bin/nfc-manager-daemon";\r
-\r
-#define VCONF_FALSE 0\r
-#define VCONF_TRUE 1\r
-\r
-#ifndef NET_NFC_SETUP_ENABLE\r
-#define NET_NFC_SETUP_DEFAULT VCONF_FALSE\r
-#endif\r
-\r
-static pthread_mutex_t g_queue_lock = PTHREAD_MUTEX_INITIALIZER;\r
-static pid_t manager_pid = 0;\r
-static int child_status = 0;\r
-\r
-\r
-#define device_file_path_plugin "/usr/lib/libnfc-plugin.so"\r
-#define device_file_path_plugin_65 "/usr/lib/libnfc-plugin-65nxp.so"\r
-\r
-int __net_nfc_intialize_dbus_connection();\r
-int __net_nfc_register_child_sig_handler();\r
-void __net_nfc_sig_child_cb(int signo);\r
-void *__net_nfc_fork_thread(void *data);\r
-\r
-int main(int argc, char **argv)\r
-{\r
-       int progress = 0;\r
-       GMainLoop *event_loop;\r
-       FILE *fp = NULL;\r
-\r
-       if (!g_thread_supported())\r
-       {\r
-               g_thread_init(NULL);\r
-       }\r
-       dbus_g_thread_init();\r
-       g_type_init();\r
-\r
-       /* reset progress key */\r
-       if (vconf_get_int(NET_NFC_VCONF_KEY_PROGRESS, &progress) == 0)\r
-       {\r
-               DEBUG_MSG("==========================================");\r
-               DEBUG_MSG("Old NET_NFC_VCONF_KEY_PROGRESS value is %d", progress);\r
-               DEBUG_MSG("==========================================");\r
-       }\r
-\r
-       if (vconf_set_int(NET_NFC_VCONF_KEY_PROGRESS, 0) != 0)\r
-       {\r
-               DEBUG_ERR_MSG("vconf_set_int failed");\r
-       }\r
-\r
-       /* run manager first */\r
-       __net_nfc_fork_thread(NULL);\r
-\r
-       if (__net_nfc_intialize_dbus_connection() != VCONF_TRUE)\r
-       {\r
-               DEBUG_ERR_MSG("DBUS: intialize dbus is failed");\r
-       }\r
-       if (__net_nfc_register_child_sig_handler() != VCONF_TRUE)\r
-       {\r
-               DEBUG_ERR_MSG("SIGCHLD: registering sig child is failed");\r
-       }\r
-\r
-       /* to check H/W which dose not support NFC */\r
-\r
-       fp = fopen(device_file_path_plugin, "r");\r
-       if(fp == NULL)\r
-       {\r
-               fp = fopen(device_file_path_plugin_65, "r");\r
-               if(fp == NULL)\r
-               {\r
-                       vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_OFF);\r
-                       vconf_set_bool(VCONFKEY_NFC_STATE, FALSE);\r
-                       DEBUG_ERR_MSG("There is NO plugin");\r
-               }\r
-               else\r
-               {\r
-                       vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_ON);\r
-                       DEBUG_ERR_MSG("There is device_file_path_plugin_65");\r
-                       fclose(fp);\r
-               }\r
-       }\r
-       else\r
-       {\r
-               vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_ON);\r
-               DEBUG_ERR_MSG("There is  device_file_path_plugin ");\r
-\r
-               fclose(fp);\r
-       }\r
-\r
-\r
-       event_loop = g_main_loop_new(NULL, FALSE);\r
-       g_main_loop_run(event_loop);\r
-\r
-       return 0;\r
-}\r
-\r
-int __net_nfc_register_child_sig_handler()\r
-{\r
-       struct sigaction act;\r
-\r
-       act.sa_handler = __net_nfc_sig_child_cb;\r
-       sigemptyset(&act.sa_mask);\r
-       act.sa_flags = SA_NOCLDSTOP;\r
-\r
-       if (sigaction(SIGCHLD, &act, NULL) < 0)\r
-       {\r
-               return VCONF_FALSE;\r
-       }\r
-       return VCONF_TRUE;\r
-}\r
-\r
-void *__net_nfc_fork_thread(void *data)\r
-{\r
-       int state, progress;\r
-       int result;\r
-\r
-       if (data != NULL)\r
-       {\r
-               DEBUG_MSG("child process is terminated with: %d ", *((int *)data));\r
-       }\r
-\r
-       result = vconf_get_bool(VCONFKEY_NFC_STATE, &state);\r
-       if (result != 0)\r
-       {\r
-               DEBUG_MSG("VCONFKEY_NFC_STATE is not exist: %d ", result);\r
-               return NULL;\r
-       }\r
-\r
-       result = vconf_get_int(NET_NFC_VCONF_KEY_PROGRESS, &progress);\r
-       if (result != 0)\r
-       {\r
-               DEBUG_MSG("NET_NFC_VCONF_KEY_PROGRESS is not exist: %d ", result);\r
-\r
-               progress = 0;\r
-               result = vconf_set_int(NET_NFC_VCONF_KEY_PROGRESS, progress);\r
-               if (result != 0)\r
-               {\r
-                       DEBUG_ERR_MSG("vconf_set_int failed");\r
-                       return NULL;\r
-               }\r
-       }\r
-\r
-       if (progress != 0)\r
-       {\r
-               DEBUG_ERR_MSG("Error occur in progress [%d]", progress);\r
-\r
-               /* off */\r
-               result = vconf_set_bool(VCONFKEY_NFC_STATE, 0);\r
-               if (result != 0)\r
-               {\r
-                       DEBUG_MSG("vconf_set_int failed", result);\r
-               }\r
-               return NULL;\r
-       }\r
-\r
-       if (state == TRUE)\r
-       {\r
-               DEBUG_MSG("Vconf value is true");\r
-               if (_net_nfc_launch_net_nfc_manager() == VCONF_FALSE)\r
-               {\r
-                       DEBUG_ERR_MSG("sigchild is called");\r
-               }\r
-       }\r
-\r
-       return NULL;\r
-}\r
-\r
-void __net_nfc_sig_child_cb(int signo)\r
-{\r
-\r
-       pthread_attr_t attr;\r
-       pthread_attr_init(&attr);\r
-       pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\r
-       pthread_t sig_thread;\r
-       pid_t child_pid;\r
-       int status;\r
-\r
-       child_pid = waitpid(-1, &status, 0);\r
-\r
-       child_status = status;\r
-\r
-       // do not use lock here!\r
-       manager_pid = 0;\r
-\r
-       pthread_create(&sig_thread, &attr, __net_nfc_fork_thread, &child_status);\r
-}\r
-\r
-int _net_nfc_is_terminated()\r
-{\r
-       return (manager_pid == 0);\r
-}\r
-\r
-int _net_nfc_launch_net_nfc_manager()\r
-{\r
-       pthread_mutex_lock(&g_queue_lock);\r
-       if (manager_pid == 0)\r
-       {\r
-               manager_pid = fork();\r
-               if (manager_pid == 0)\r
-               {\r
-                       if (-1 == execl(net_nfc_daemon, net_nfc_daemon, NULL))\r
-                       {\r
-                               exit(0);\r
-                       }\r
-               }\r
-       }\r
-       else\r
-       {\r
-               DEBUG_MSG("NFC-manager is already running");\r
-               pthread_mutex_unlock(&g_queue_lock);\r
-               return VCONF_FALSE;\r
-       }\r
-       DEBUG_MSG("NFC-manager's PID %d", manager_pid);\r
-       pthread_mutex_unlock(&g_queue_lock);\r
-       return VCONF_TRUE;\r
-}\r
-\r
-int _net_nfc_terminate_net_nfc_manager()\r
-{\r
-       int status;\r
-\r
-       pthread_mutex_lock(&g_queue_lock);\r
-       if (manager_pid)\r
-       {\r
-               DEBUG_MSG("NFC-manager's PID %d", manager_pid);\r
-               kill(manager_pid, SIGKILL);\r
-               wait(&status);\r
-               manager_pid = 0;\r
-               pthread_mutex_unlock(&g_queue_lock);\r
-               return VCONF_TRUE;\r
-       }\r
-       pthread_mutex_unlock(&g_queue_lock);\r
-       return VCONF_FALSE;\r
-}\r
-\r
-int __net_nfc_intialize_dbus_connection()\r
-{\r
-       GError *error = NULL;\r
-       DBusGProxy *proxy;\r
-       GObject *object = NULL;\r
-       guint32 name;\r
-       DBusGConnection *connection;\r
-\r
-       connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);\r
-       if (connection == NULL)\r
-       {\r
-               DEBUG_ERR_MSG("DBUS: getting dbus connection is failed [%s]", error->message);\r
-               g_error_free(error);\r
-\r
-               return VCONF_FALSE;\r
-       }\r
-\r
-       object = g_object_new(DBUS_AGENT_TYPE, NULL);\r
-\r
-       dbus_g_connection_register_g_object(connection, DBUS_AGENT_PATH, object);\r
-\r
-       proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);\r
-\r
-       // Make sure getting name is correct version or not\r
-       if (!org_freedesktop_DBus_request_name(proxy, DBUS_AGENT_NAME, 0, &name, &error))\r
-       {\r
-               DEBUG_ERR_MSG("DBUS: getting dbus proxy is failed [%s]", error->message);\r
-               g_error_free(error);\r
-\r
-               return VCONF_FALSE;\r
-       }\r
-\r
-       if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != name)\r
-       {\r
-               DEBUG_MSG("Requested name is: %d", name);\r
-       }\r
-\r
-       return VCONF_TRUE;\r
-}\r
-\r
diff --git a/src/agent/net_nfc_dbus_agent_obj.c b/src/agent/net_nfc_dbus_agent_obj.c
deleted file mode 100644 (file)
index 185ddc6..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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 <stdlib.h>
-#include <glib-object.h>
-#include <dbus/dbus-glib-bindings.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <pthread.h>
-
-#include "net_nfc_typedef_private.h"
-#include "net_nfc_debug_private.h"
-#include "net_nfc_agent_private.h"
-#include "net_nfc_dbus_agent_obj_private.h"
-#include "dbus_agent_glue_private.h"
-#include "dbus_service_binding_private.h"
-
-G_DEFINE_TYPE(Dbus_Agent, dbus_agent, G_TYPE_OBJECT)
-
-// Just Check the assert  and set the error message
-#define __G_ASSERT(test, return_val, error, domain, error_code)\
-G_STMT_START\
-{\
-       if G_LIKELY (!(test)) { \
-               g_set_error (error, domain, error_code, #test); \
-               return (return_val); \
-       }\
-}\
-G_STMT_END
-
-GQuark dbus_agent_error_quark(void)
-{
-       return g_quark_from_static_string("dbus_agent_error");
-}
-
-static void dbus_agent_init(Dbus_Agent *dbus_agent)
-{
-       GError *error = NULL;
-
-       dbus_agent->connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
-       if (dbus_agent->connection == NULL)
-       {
-               DEBUG_MSG("failed to get dbus connection");
-       }
-}
-
-static void dbus_agent_class_init(Dbus_AgentClass *dbus_agent_class)
-{
-       dbus_g_object_type_install_info(DBUS_AGENT_TYPE, &dbus_glib_dbus_agent_object_info);
-}
-
-gboolean dbus_agent_launch(Dbus_Agent *dbus_agent, guint *result_val, GError **error)
-{
-       DBusGProxy *proxy;
-       guint status;
-       GError *inter_error = NULL;
-       int count = 0;
-
-       DEBUG_MSG("---- dbus_agent_launch is called -----");
-
-       proxy = dbus_g_proxy_new_for_name_owner(dbus_agent->connection, "com.samsung.slp.nfc.manager",
-               "/com/samsung/slp/nfc/manager", "com.samsung.slp.nfc.manager", &inter_error);
-       if (proxy != NULL)
-       {
-               DEBUG_MSG("Posting terminate again");
-               com_samsung_slp_nfc_manager_terminate(proxy, &status, &inter_error);
-       }
-       else
-       {
-               _net_nfc_terminate_net_nfc_manager();
-       }
-
-       DEBUG_MSG("Posting terminate success");
-
-       count = 0;
-       while (_net_nfc_is_terminated() == FALSE)
-       {
-               usleep(30000);
-               if (++count % 30)
-               {
-                       _net_nfc_terminate_net_nfc_manager();
-               }
-       }
-
-       if (_net_nfc_launch_net_nfc_manager() == FALSE)
-       {
-               return FALSE;
-       }
-
-       DEBUG_MSG("---- dbus_agent_launch is completed -----");
-
-       return TRUE;
-}
-
-gboolean dbus_agent_terminate(Dbus_Agent *dbus_agent, guint *result_val, GError **error)
-{
-       DBusGProxy *proxy;
-       guint status;
-       GError *inter_error = NULL;
-
-       DEBUG_MSG("---- dbus_agent_terminate is called -----");
-
-       proxy = dbus_g_proxy_new_for_name_owner(dbus_agent->connection, "com.samsung.slp.nfc.manager",
-               "/com/samsung/slp/nfc/manager", "com.samsung.slp.nfc.manager", &inter_error);
-
-       if (proxy == NULL)
-       {
-               _net_nfc_terminate_net_nfc_manager();
-       }
-       else
-       {
-               if (!com_samsung_slp_nfc_manager_se_only(proxy, &status, &inter_error))
-               {
-                       DEBUG_MSG("Termination is failed: %d", status);
-
-                       return FALSE;
-               }
-       }
-
-       DEBUG_MSG("---- dbus_agent_terminate is completed -----");
-
-       return TRUE;
-}
-
diff --git a/src/agent/resource/com.samsung.slp.nfc.agent.service b/src/agent/resource/com.samsung.slp.nfc.agent.service
deleted file mode 100644 (file)
index 63fe4ec..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-[D-BUS Service]
-Name=com.samsung.slp.nfc.agent
-Exec=/usr/bin/nfc-agent
diff --git a/src/agent/resource/dbus_agent.xml b/src/agent/resource/dbus_agent.xml
deleted file mode 100644 (file)
index 6da63c0..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<node name="/com/samsung/slp/nfc/agent">
-
-  <interface name="com.samsung.slp.nfc.agent">
-
-    <method name="Launch">
-      <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="dbus_agent_launch"/>
-      <arg type="u" name="result_val" direction="out"/>
-    </method>
-
-    <method name="Terminate">
-      <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="dbus_agent_terminate"/>
-      <arg type="u" name="result_val" direction="out"/>
-    </method>
-
-  </interface>
-</node>
index e948d7b..27f91e7 100644 (file)
@@ -79,6 +79,7 @@ SET(CLIENT_HEADER
        include/net_nfc_ndef_record.h
        include/net_nfc_ndef_message.h
        include/net_nfc_ndef_message_handover.h
+       include/net_nfc_sign_record.h
        include/net_nfc_data.h
        include/net_nfc_apdu.h
        include/net_nfc_exchanger.h
index c8ee8cf..70d3094 100644 (file)
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 /**
   NFC Manager
   NFC Manager controls the nfc device with high level APIs such as SmartPoster ans Connection handover.
@@ -372,6 +373,10 @@ net_nfc_error_e net_nfc_state_activate(int client_type);
 net_nfc_error_e net_nfc_state_deactivate(void);
 
 net_nfc_error_e net_nfc_sim_test(void);
+net_nfc_error_e net_nfc_prbs_test(int tech , int rate);
+
+net_nfc_error_e net_nfc_get_firmware_version(void);
+
 void net_nfc_test_read_test_cb(net_nfc_message_e message, net_nfc_error_e result, void* data, void* user_param, void * trans_data);
 void net_nfc_test_sim_test_cb(net_nfc_message_e message, net_nfc_error_e result, void* data, void* user_param, void * trans_data);
 
old mode 100644 (file)
new mode 100755 (executable)
index 7671c9e..63b0f1f
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_APDU__\r
 #define __NET_NFC_APDU__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 685316d..1259ec4
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 #ifndef NET_NFC_CLIENT_DISPATCHER_H
 #define NET_NFC_CLIENT_DISPATCHER_H
 
old mode 100644 (file)
new mode 100755 (executable)
index 330ecb9..0a2e2df
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 #ifndef NET_NFC_CLIENT_IPC_H
 #define NET_NFC_CLIENT_IPC_H
 
old mode 100644 (file)
new mode 100755 (executable)
index 9fff083..92c9fc8
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_CLIENT_NET_NFC_PRIVATE_H__\r
 #define __NET_NFC_CLIENT_NET_NFC_PRIVATE_H__\r
 \r
@@ -25,6 +26,13 @@ extern "C" {
 \r
 client_context_t* net_nfc_get_client_context();\r
 bool net_nfc_tag_is_connected();\r
+net_nfc_error_e net_nfc_send_init(void* context);\r
+net_nfc_error_e net_nfc_send_deinit(void* context);\r
+\r
+\r
+typedef bool (*net_nfc_client_cb)(net_nfc_message_e message ,  net_nfc_error_e result, void* user_param );\r
+\r
+\r
 \r
 /**\r
 @} */\r
old mode 100644 (file)
new mode 100755 (executable)
index 0928c11..59eb940
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_CLIENT_UTIL_PRIVATE__\r
 #define __NET_NFC_CLENT_UTIL_PRIVATE__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 0e834c7..959287b
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include <net_nfc_typedef.h>\r
 \r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 4ea65b8..f3ee8be
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __SLP_NET_NFC_EXCHANGER_H__\r
 #define __SLP_NET_NFC_EXCHANGER_H__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index e39c606..533060a
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __SLP_NET_NFC_EXCHANGER_H__\r
 #define __SLP_NET_NFC_EXCHANGER_H__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 2d6730d..3caf6d1
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_INTERNAL_SE_H__\r
 #define __NET_NFC_INTERNAL_SE_H__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index d6e456f..6c3cc13
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_LLCP_H__\r
 #define __NET_NFC_LLCP_H__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 6d73c40..f95443d
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_NDEF_MESSAGE_H__\r
 #define __NET_NFC_NDEF_MESSAGE_H__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 04f4381..0bb8862
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_NDEF_RECORD_H__\r
 #define __NET_NFC_NDEF_RECORD_H__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index c1a9ab1..e062a43
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_NDEF_RECORD_H__\r
 #define __NET_NFC_NDEF_RECORD_H__\r
 \r
diff --git a/src/clientlib/include/net_nfc_sign_record.h b/src/clientlib/include/net_nfc_sign_record.h
new file mode 100755 (executable)
index 0000000..5704f27
--- /dev/null
@@ -0,0 +1,152 @@
+/*\r
+  * Copyright 2012  Samsung Electronics Co., Ltd\r
+  *\r
+  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license\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
+#ifndef __NET_NFC_SIGN_RECORD_H\r
+#define __NET_NFC_SIGN_RECORD_H\r
+\r
+#include "net_nfc_typedef.h"\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/**\r
+\r
+@addtogroup NET_NFC_MANAGER_RECORD\r
+@{\r
+       This document is for the APIs reference document\r
+\r
+        NFC Manager defines are defined in <nfc-typedef.h>\r
+\r
+*/\r
+\r
+/**\r
+       this function make the signature of some continuous records\r
+       please refer the NFC forum specification "Signature Record type Definition"\r
+\r
+       @param[in/out]  msg                                     NDEF message handler. After executing this function, a signature record will be added.\r
+       @param[in]              begin_index                     the index of beginning record that will be signed.\r
+       @param[in]              end_index                       the last index of record that will be signed.\r
+       @param[in]              cert_file                       PKCS #12 type certificate file (.p12). And the file should be encoded in DER type. (NOT PEM type)\r
+       @param[in]              passowrd                        the password of cert_file\r
+\r
+       @return         return the result of the calling the function\r
+\r
+       @exception NET_NFC_NULL_PARAMETER               parameter(s) has(have) illegal NULL pointer(s)\r
+       @exception NET_NFC_ALLOC_FAIL                   memory allocation is failed\r
+\r
+       @code\r
+               ndef_message_h msg = NULL;\r
+\r
+               // create a ndef message and add some records\r
+               // ...\r
+\r
+               net_nfc_sign_records(msg, 0, 1, "/tmp/cert.p12", "abcdef");\r
+       @endcode\r
+*/\r
+net_nfc_error_e net_nfc_sign_records(ndef_message_h msg, int begin_index, int end_index, char *cert_file, char *password);\r
+\r
+/**\r
+       this function make the signature of whole records in NDEF message\r
+\r
+       @param[in/out]  msg                                     NDEF message handler. After executing this function, a signature record will be added.\r
+       @param[in]              cert_file                       PKCS #12 type certificate file (.p12). And the file should be encoded in DER type. (NOT PEM type)\r
+       @param[in]              passowrd                        the password of cert_file\r
+\r
+       @return         return the result of the calling the function\r
+\r
+       @exception NET_NFC_NULL_PARAMETER               parameter(s) has(have) illegal NULL pointer(s)\r
+       @exception NET_NFC_ALLOC_FAIL                   memory allocation is failed\r
+\r
+       @code\r
+               ndef_message_h msg = NULL;\r
+\r
+               // create a ndef message and add some records\r
+               // ...\r
+\r
+               net_nfc_sign_ndef_message(msg, "/tmp/cert.p12", "abcdef");\r
+       @endcode\r
+*/\r
+net_nfc_error_e net_nfc_sign_ndef_message(ndef_message_h msg, char *cert_file, char *password);\r
+\r
+/**\r
+       This function does verify signature of records\r
+       record MUST be continuous.\r
+\r
+       @param[in]      begin_record                            the handle of beginning record that will be verified\r
+       @param[in]      sign_record                                     the handle of signature record\r
+\r
+       @return         return the result of the calling the function\r
+\r
+       @exception NET_NFC_NULL_PARAMETER               parameter(s) has(have) illegal NULL pointer(s)\r
+       @exception NET_NFC_ALLOC_FAIL                   memory allocation is failed\r
+\r
+       @code\r
+               net_nfc_error_e error = NET_NFC_OK;\r
+               ndef_message_h msg = NULL;\r
+               ndef_record_h begin_record = NULL;\r
+               ndef_record_h sign_record = NULL;\r
+\r
+               // import NDEF message including the signature record.\r
+               // ...\r
+\r
+               net_nfc_get_record_by_index(msg, 0, &begin_record);\r
+               net_nfc_get_record_by_index(msg, 2, &sign_record);\r
+\r
+               error = net_nfc_verify_signature_records(begin_record, sign_record);\r
+\r
+               return (error == NET_NFC_OK);\r
+       @endcode\r
+*/\r
+net_nfc_error_e net_nfc_verify_signature_records(ndef_record_h begin_record, ndef_record_h sign_record);\r
+\r
+/**\r
+       This function does verify signature in NDEF message\r
+       If message has 2 or more signature record, it should do verify every signatures and return result.\r
+       (Despite of failing only one signature record, this function will return error.)\r
+\r
+       @param[in]      msg                             NDEF message that will be verified.\r
+\r
+       @return         return the result of the calling the function\r
+\r
+       @exception NET_NFC_NULL_PARAMETER               parameter(s) has(have) illegal NULL pointer(s)\r
+       @exception NET_NFC_ALLOC_FAIL                   memory allocation is failed\r
+\r
+       @code\r
+               net_nfc_error_e error = NET_NFC_OK;\r
+               ndef_message_h msg = NULL;\r
+\r
+               // import NDEF message including the signature record.\r
+               // ...\r
+\r
+               error = net_nfc_verify_signature_ndef_message(msg);\r
+\r
+               return (error == NET_NFC_OK);\r
+       @endcode\r
+*/\r
+net_nfc_error_e net_nfc_verify_signature_ndef_message(ndef_message_h msg);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /* __NET_NFC_SIGN_RECORD_H */\r
+\r
+\r
old mode 100644 (file)
new mode 100755 (executable)
index 7a3262d..86fed3c
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_TAG_H__\r
 #define __NET_NFC_TAG_H__\r
 \r
        }\r
 \r
        int main()\r
-       {
+       {\r
 \r
                net_nfc_error_e result;\r
                result = net_nfc_initialize();\r
-               check_result(result);
+               check_result(result);\r
 \r
                result = net_nfc_set_response_callback (net_nfc_cb, &user_context2);\r
                check_result(result);\r
 \r
                sleep (100);\r
-
-               return 0;
+\r
+               return 0;\r
        }\r
        @endcode\r
 \r
@@ -242,18 +243,18 @@ net_nfc_error_e net_nfc_format_ndef(net_nfc_target_handle_h handle, data_h key,
        }\r
 \r
        int main()\r
-       {
+       {\r
 \r
                net_nfc_error_e result;\r
                result = net_nfc_initialize();\r
-               check_result(result);
+               check_result(result);\r
 \r
                result = net_nfc_set_response_callback (net_nfc_cb, &user_context2);\r
                check_result(result);\r
 \r
                sleep (100);\r
-
-               return 0;
+\r
+               return 0;\r
        }\r
        @endcode\r
 \r
@@ -328,18 +329,18 @@ net_nfc_error_e net_nfc_read_tag (net_nfc_target_handle_h handle, void* trans_pa
        }\r
 \r
        int main()\r
-       {
+       {\r
 \r
                net_nfc_error_e result;\r
                result = net_nfc_initialize();\r
-               check_result(result);
+               check_result(result);\r
 \r
                result = net_nfc_set_response_callback (net_nfc_cb, &user_context2);\r
                check_result(result);\r
 \r
                sleep (100);\r
-
-               return 0;
+\r
+               return 0;\r
        }\r
        @endcode\r
 \r
@@ -400,18 +401,18 @@ net_nfc_error_e net_nfc_write_ndef (net_nfc_target_handle_h handle, ndef_message
        }\r
 \r
        int main()\r
-       {
+       {\r
 \r
                net_nfc_error_e result;\r
                result = net_nfc_initialize();\r
-               check_result(result);
+               check_result(result);\r
 \r
                result = net_nfc_set_response_callback (net_nfc_cb, &user_context2);\r
                check_result(result);\r
 \r
                sleep (100);\r
-
-               return 0;
+\r
+               return 0;\r
        }\r
        @endcode\r
 \r
@@ -439,11 +440,11 @@ net_nfc_error_e net_nfc_make_read_only_ndef_tag(net_nfc_target_handle_h handle,
        @code\r
 \r
        int main()\r
-       {
+       {\r
 \r
                net_nfc_error_e result;\r
                result = net_nfc_initialize();\r
-               check_result(result);
+               check_result(result);\r
 \r
                net_nfc_event_filter_e filter = NET_NFC_ALL_ENABLE;\r
                net_nfc_error_e net_nfc_set_tag_filter(filter);\r
@@ -452,8 +453,8 @@ net_nfc_error_e net_nfc_make_read_only_ndef_tag(net_nfc_target_handle_h handle,
                check_result(result);\r
 \r
                sleep (100);\r
-
-               return 0;
+\r
+               return 0;\r
        }\r
 \r
        @endcode\r
old mode 100644 (file)
new mode 100755 (executable)
index cedfb34..42167a8
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_TAG_FELICA_H__\r
 #define __NET_NFC_TAG_FELICA_H__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 36c611a..fec9fc5
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_TAG_JEWEL_H__\r
 #define __NET_NFC_TAG_JEWEL_H__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index df0cbf1..d06fcc3
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_TAG_MIFARE_H__\r
 #define __NET_NFC_TAG_MIFARE_H__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 18fb5c5..c6018ee
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_TARGET_INFO_H__\r
 #define __NET_NFC_TARGET_INFO_H__\r
 \r
@@ -47,7 +48,7 @@ extern "C" {
 \r
        @param[in]      target_info     target info handler\r
        @param[out]     type                    tag type these type is one of the enum "net_nfc_target_type_e" defined\r
-
+\r
        @return         return the result of calling this functions\r
 \r
        @exception      NET_NFC_NULL_PARAMETER          parameter(s) has(have) illigal NULL pointer(s)\r
old mode 100644 (file)
new mode 100755 (executable)
index 58df115..c32ac70
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include "net_nfc_data.h"\r
 #include "net_nfc_typedef_private.h"\r
 #include "net_nfc_util_private.h"\r
old mode 100644 (file)
new mode 100755 (executable)
index 85557fb..c8083eb
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 #include <stdio.h>
 #include <glib.h>
 
@@ -138,7 +139,7 @@ void net_nfc_client_call_dispatcher_in_g_main_loop(net_nfc_response_cb client_cb
 
 void net_nfc_client_call_dispatcher_in_current_context(net_nfc_response_cb client_cb, net_nfc_response_msg_t* msg)
 {
-       DEBUG_CLIENT_MSG("put message to g main loop");
+       DEBUG_CLIENT_MSG("invoke callback in current thread");
 
        client_dispatcher_param_t* param = calloc(1, sizeof(client_dispatcher_param_t));
 
@@ -299,6 +300,31 @@ static bool net_nfc_client_dispatch_response(client_dispatcher_param_t* param)
                }
                break;
 
+               case NET_NFC_MESSAGE_PRBS_TEST:
+               {
+                       if(client_cb != NULL)
+                               client_cb(msg->response_type, ((net_nfc_response_get_server_state_t *)msg->detail_message)->result, NULL, client_context->register_user_param, (void*)((net_nfc_response_get_server_state_t *)msg->detail_message)->state);
+               }
+               break;
+
+       case NET_NFC_MESSAGE_GET_FIRMWARE_VERSION :
+               {
+                       data_s *version = &(((net_nfc_response_get_firmware_version_t *)msg->detail_message)->data);
+
+                       if (version->length > 0)
+                       {
+                               if (client_cb != NULL)
+                                       client_cb(msg->response_type, ((net_nfc_response_send_apdu_t *)msg->detail_message)->result, version, client_context->register_user_param, ((net_nfc_response_send_apdu_t *)(msg->detail_message))->trans_param);
+                       }
+                       else
+                       {
+                               if (client_cb != NULL)
+                                       client_cb(msg->response_type, ((net_nfc_response_send_apdu_t *)msg->detail_message)->result, NULL, client_context->register_user_param, ((net_nfc_response_send_apdu_t *)(msg->detail_message))->trans_param);
+                       }
+
+               }
+               break;
+
                case NET_NFC_MESSAGE_WRITE_NDEF:
                {
                        if(client_cb != NULL)
@@ -415,7 +441,7 @@ static bool net_nfc_client_dispatch_response(client_dispatcher_param_t* param)
                {
                        net_nfc_response_get_current_tag_info_t* detected = (net_nfc_response_get_current_tag_info_t *)msg->detail_message;
 
-                       if(detected->result == NET_NFC_OK)
+                       if(detected->result != NET_NFC_NOT_CONNECTED)
                        {
                                net_nfc_event_filter_e current_filter = net_nfc_get_tag_filter();
                                net_nfc_event_filter_e converted = NET_NFC_ALL_ENABLE;
@@ -860,6 +886,32 @@ static bool net_nfc_client_dispatch_response(client_dispatcher_param_t* param)
                }
                break;
 
+               case NET_NFC_MESSAGE_SERVICE_INIT:
+               {
+                       net_nfc_response_test_t* detail_msg = (net_nfc_response_test_t*)msg->detail_message;
+
+                       DEBUG_CLIENT_MSG("net_nfc_client_dispatch_response NET_NFC_MESSAGE_SERVICE_INIT [%x]" , detail_msg->trans_param);
+
+                       if(client_cb != NULL)
+                       {
+                               client_cb(NET_NFC_MESSAGE_INIT, detail_msg->result , NULL, detail_msg->trans_param, NULL);
+                       }
+               }
+               break;
+
+               case NET_NFC_MESSAGE_SERVICE_DEINIT:
+               {
+                       net_nfc_response_test_t* detail_msg = (net_nfc_response_test_t*)msg->detail_message;
+
+                       DEBUG_CLIENT_MSG("net_nfc_client_dispatch_response NET_NFC_MESSAGE_SERVICE_DEINIT [%x]" , detail_msg->trans_param);
+
+                       if(client_cb != NULL)
+                       {
+                               client_cb(NET_NFC_MESSAGE_DEINIT, detail_msg->result , NULL, detail_msg->trans_param, NULL);
+                       }
+               }
+               break;
+
                default:
                        break;
        }
old mode 100644 (file)
new mode 100755 (executable)
index 1b599eb..20dd435
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include "net_nfc_exchanger.h"\r
 #include "net_nfc_exchanger_private.h"\r
 #include "net_nfc.h"\r
old mode 100644 (file)
new mode 100755 (executable)
index 601e2dd..ccfc389
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include "net_nfc_tag.h"\r
 #include "net_nfc_typedef_private.h"\r
 #include "net_nfc_client_ipc_private.h"\r
old mode 100644 (file)
new mode 100755 (executable)
index 97b8d60..1a54be1
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
@@ -1027,6 +1028,51 @@ net_nfc_response_msg_t* net_nfc_client_read_response_msg(net_nfc_error_e* result
                }
                break;
 
+               case NET_NFC_MESSAGE_PRBS_TEST:
+               {
+                       net_nfc_response_test_t * resp_detail = NULL;
+                       int res = 0;
+
+                       DEBUG_CLIENT_MSG("message from server NET_NFC_MESSAGE_PRBS_TEST");
+
+
+                       res = __net_nfc_client_read_util ((void **)&resp_detail, sizeof (net_nfc_response_test_t));
+                       if (res != 1){
+                               _net_nfc_client_util_free_mem(resp_msg);
+                               return NULL;
+                       }
+                       resp_msg->detail_message = resp_detail;
+               }
+               break;
+
+       case NET_NFC_MESSAGE_GET_FIRMWARE_VERSION :
+               {
+                       net_nfc_response_get_firmware_version_t * resp_detail = NULL;
+                       int res = 0;
+
+                       DEBUG_CLIENT_MSG("message from server NET_NFC_MESSAGE_GET_FIRMWARE_VERSION");
+
+                       if (__net_nfc_client_read_util((void **)&resp_detail, sizeof(net_nfc_response_get_firmware_version_t)) > 0)
+                       {
+                               if (__net_nfc_client_read_util((void **)&(resp_detail->data.buffer), resp_detail->data.length) > 0)
+                               {
+                                       resp_msg->detail_message = resp_detail;
+                               }
+                               else
+                               {
+                                       _net_nfc_client_util_free_mem(resp_msg);
+                                       _net_nfc_client_util_free_mem(resp_detail);
+                                       return NULL;
+                               }
+                       }
+                       else
+                       {
+                               _net_nfc_client_util_free_mem(resp_msg);
+                               return NULL;
+                       }
+               }
+               break;
+
                case NET_NFC_MESSAGE_NOTIFY:
                {
                        net_nfc_response_notify_t * resp_detail = NULL;
@@ -1362,6 +1408,41 @@ net_nfc_response_msg_t* net_nfc_client_read_response_msg(net_nfc_error_e* result
                }
                break;
 
+
+               case NET_NFC_MESSAGE_SERVICE_INIT:
+               {
+                       net_nfc_response_test_t * resp_detail = NULL;
+                       int res = 0;
+
+                       DEBUG_CLIENT_MSG("Client Receive the NET_NFC_MESSAGE_SERVICE_INIT");
+
+                       res = __net_nfc_client_read_util ((void **)&resp_detail, sizeof (net_nfc_response_test_t));
+                       if (res != 1){
+                               _net_nfc_client_util_free_mem(resp_msg);
+                               return NULL;
+                       }
+                       resp_msg->detail_message = resp_detail;
+
+               }
+               break;
+
+               case NET_NFC_MESSAGE_SERVICE_DEINIT:
+               {
+                       net_nfc_response_test_t * resp_detail = NULL;
+                       int res = 0;
+
+                       DEBUG_CLIENT_MSG("Client Receive the NET_NFC_MESSAGE_SERVICE_DEINIT");
+
+                       res = __net_nfc_client_read_util ((void **)&resp_detail, sizeof (net_nfc_response_test_t));
+                       if (res != 1){
+                               _net_nfc_client_util_free_mem(resp_msg);
+                               return NULL;
+                       }
+                       resp_msg->detail_message = resp_detail;
+
+               }
+               break;
+
                default:
                {
                        DEBUG_CLIENT_MSG("Currently NOT supported RESP TYPE = [%d]", resp_msg->response_type);
old mode 100644 (file)
new mode 100755 (executable)
index c4efa8b..7eb610c
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include <glib.h>\r
 #include <pthread.h>\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 7d0b518..907642b
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include "net_nfc_ndef_message_handover.h"\r
 \r
 #include "net_nfc_typedef_private.h"\r
old mode 100644 (file)
new mode 100755 (executable)
index 40a4aad..6e28c3d
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include "net_nfc_ndef_record.h"\r
 #include "net_nfc_ndef_message.h"\r
 #include "net_nfc_data.h"\r
old mode 100644 (file)
new mode 100755 (executable)
index e929cfa..55a9467
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 #include "net_nfc.h"
 #include "net_nfc_typedef.h"
 #include "net_nfc_util_private.h"
 #include "net_nfc_exchanger_private.h"
 #include "net_nfc_client_util_private.h"
 #include "net_nfc_client_nfc_private.h"
-#include "../agent/include/dbus_agent_binding_private.h"
 
 #include <pthread.h>
 #include <glib.h>
 #include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-bindings.h>
 
 #include "vconf.h"
 
@@ -46,6 +45,28 @@ static client_context_t g_client_context = {NULL, NET_NFC_OK, PTHREAD_MUTEX_INIT
 
 static net_nfc_set_activation_completed_cb g_net_nfc_set_activation_completed_cb = NULL;
 
+void net_nfc_set_state_response_cb(net_nfc_message_e message, net_nfc_error_e result, void* data, void* user_param, void * trans_data );
+
+
+static pthread_t g_set_thread = (pthread_t)0;
+static pthread_t g_set_send_thread = (pthread_t)0;
+
+static int gv_state = 0;
+static bool gv_set_state_lock = false;
+
+static pthread_mutex_t g_client_lock = PTHREAD_MUTEX_INITIALIZER;
+
+typedef struct _client_context_s
+{
+       pthread_cond_t *client_cond;
+       void *user_context;
+       int result;
+} client_context_s;
+
+
+
+
+
 static void _net_nfc_reset_client_context()
 {
        g_client_context.register_user_param = NULL;
@@ -176,125 +197,63 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_unset_response_callback (void)
 
 NET_NFC_EXPORT_API net_nfc_error_e net_nfc_set_launch_popup_state(int enable)
 {
-       net_nfc_error_e result = NET_NFC_OK;
-
-       pthread_mutex_lock(&g_client_context.g_client_lock);
+       net_nfc_error_e ret;
+       net_nfc_request_set_launch_state_t request = {0,};
 
-       if (vconf_set_bool(NET_NFC_DISABLE_LAUNCH_POPUP_KEY, enable ? 0 : 1) != 0)
-       {
-               result = NET_NFC_UNKNOWN_ERROR;
-       }
+       request.length = sizeof(net_nfc_request_set_launch_state_t);
+       request.request_type = NET_NFC_MESSAGE_SERVICE_SET_LAUNCH_STATE;
+       request.set_launch_popup = enable;
 
-       pthread_mutex_unlock(&g_client_context.g_client_lock);
+       ret = _net_nfc_client_send_reqeust((net_nfc_request_msg_t *)&request, NULL);
 
-       return result;
+       return ret;
 }
 
 NET_NFC_EXPORT_API bool net_nfc_get_launch_popup_state(void)
 {
-       int disable = 0;
+       bool enable = 0;
 
        /* check state of launch popup */
-       if (vconf_get_bool(NET_NFC_DISABLE_LAUNCH_POPUP_KEY, &disable) == 0 && disable == TRUE)
+       if (vconf_get_bool(NET_NFC_DISABLE_LAUNCH_POPUP_KEY, &enable) == 0 && enable == TRUE)
        {
-               DEBUG_MSG("skip launch popup");
-               return false;
+               return true;
        }
 
-       return true;
+       DEBUG_MSG("skip launch popup");
+
+       return false;
 }
 
 NET_NFC_EXPORT_API net_nfc_error_e net_nfc_set_state(int state, net_nfc_set_activation_completed_cb callback)
 {
        net_nfc_error_e ret = NET_NFC_UNKNOWN_ERROR;;
-       uint32_t status;
-       GError *error = NULL;
-       DBusGConnection *connection = NULL;
-       DBusGProxy *proxy = NULL;
 
-       g_net_nfc_set_activation_completed_cb = callback;
+       DEBUG_MSG("net_nfc_set_state[Enter]");
 
        if(!g_thread_supported())
        {
                g_thread_init(NULL);
        }
 
-       dbus_g_thread_init();
        g_type_init();
 
-       connection = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
-       if (connection != NULL)
+       gv_state = state;
+
+       if (gv_state == FALSE)/*Deinit*/
        {
-               proxy = dbus_g_proxy_new_for_name(connection, "com.samsung.slp.nfc.agent", "/com/samsung/slp/nfc/agent", "com.samsung.slp.nfc.agent");
-               if (proxy != NULL)
-               {
-                       if (state == FALSE)
-                       {
-                               if (!com_samsung_slp_nfc_agent_terminate(proxy, &status, &error))
-                               {
-                                       DEBUG_ERR_MSG("Termination is failed: %d", status);
-                                       DEBUG_ERR_MSG("error : %s", error->message);
-                                       g_error_free(error);
-                               }
-                               else
-                               {
-                                       DEBUG_CLIENT_MSG("terminate is completed");
-
-                                       if (vconf_set_bool(VCONFKEY_NFC_STATE, FALSE) != 0)
-                                       {
-                                               DEBUG_ERR_MSG("vconf_set_bool failed");
-                                       }
-
-                                       ret = NET_NFC_OK;
-                               }
-                       }
-                       else
-                       {
-                               if (!com_samsung_slp_nfc_agent_launch(proxy, &status, &error))
-                               {
-                                       DEBUG_ERR_MSG("[%s(): %d] faile to launch nfc-manager\n", __FUNCTION__, __LINE__);
-                                       DEBUG_ERR_MSG("[%s(): %d] error : %s\n", __FUNCTION__, __LINE__, error->message);
-                                       g_error_free(error);
-                               }
-                               else
-                               {
-                                       DEBUG_CLIENT_MSG("[%s(): %d] launch is completed\n", __FUNCTION__, __LINE__);
-
-                                       if (vconf_set_bool(VCONFKEY_NFC_STATE, TRUE) != 0)
-                                       {
-                                               DEBUG_ERR_MSG("vconf_set_bool failed");
-                                       }
-
-                                       if (vconf_set_int(NET_NFC_VCONF_KEY_PROGRESS, 0) != 0)
-                                       {
-                                               DEBUG_ERR_MSG("vconf_set_bool failed");
-                                       }
-
-                                       ret = NET_NFC_OK;
-                               }
-                       }
+               ret = net_nfc_send_deinit(NULL);
 
-                       g_object_unref(proxy);
-               }
-               else
-               {
-                       DEBUG_ERR_MSG("dbus_g_proxy_new_for_name returns NULL");
-               }
+               DEBUG_CLIENT_MSG("Send the deinit msg!!");
        }
-       else
+       else/*INIT*/
        {
-               DEBUG_ERR_MSG("dbus_g_bus_get returns NULL [%s]", error->message);
-               g_error_free(error);
+               ret = net_nfc_send_init(NULL);
+
+               DEBUG_CLIENT_MSG("Send the init msg!!");
        }
-       /* todo it will be move to the point of  init response */
-       if (g_net_nfc_set_activation_completed_cb)
-       {
-               DEBUG_ERR_MSG("g_net_nfc_set_activation_completed_cb ret[%d]",ret);
 
-               g_net_nfc_set_activation_completed_cb(ret,NULL);
+       DEBUG_CLIENT_MSG("Send the init/deinit msg!![%d]" , ret);
 
-               g_net_nfc_set_activation_completed_cb = NULL;
-       }
        return ret;
 }
 
@@ -390,6 +349,34 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_sim_test(void)
        return ret;
 }
 
+NET_NFC_EXPORT_API net_nfc_error_e net_nfc_prbs_test(int tech , int rate)
+{
+       net_nfc_error_e ret;
+       net_nfc_request_test_t request = {0,};
+
+       request.length = sizeof(net_nfc_request_test_t);
+       request.request_type = NET_NFC_MESSAGE_PRBS_TEST;/*TEST MODE*/
+       request.rate = rate;
+       request.tech = tech;
+
+       ret = _net_nfc_client_send_reqeust((net_nfc_request_msg_t *)&request, NULL);
+
+       return ret;
+}
+
+NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_firmware_version(void)
+{
+       net_nfc_error_e ret;
+       net_nfc_request_msg_t request = { 0,};
+
+       request.length = sizeof(net_nfc_request_msg_t);
+       request.request_type = NET_NFC_MESSAGE_GET_FIRMWARE_VERSION;
+
+       ret = _net_nfc_client_send_reqeust((net_nfc_request_msg_t *)&request, NULL);
+
+       return ret;
+}
+
 client_context_t* net_nfc_get_client_context()
 {
        return &g_client_context;
@@ -413,3 +400,33 @@ bool net_nfc_tag_is_connected()
        }
 }
 
+net_nfc_error_e net_nfc_send_init(void* context)
+{
+       net_nfc_error_e ret;
+       net_nfc_request_msg_t req_msg = {0,};
+
+
+       req_msg.length = sizeof(net_nfc_request_msg_t);
+       req_msg.request_type = NET_NFC_MESSAGE_SERVICE_INIT;
+       req_msg.user_param = context;
+
+       ret = _net_nfc_client_send_reqeust((net_nfc_request_msg_t *)&req_msg, NULL);
+
+       return ret;
+}
+
+net_nfc_error_e net_nfc_send_deinit(void* context)
+{
+       net_nfc_error_e ret;
+       net_nfc_request_msg_t req_msg = {0,};
+
+       req_msg.length = sizeof(net_nfc_request_msg_t);
+       req_msg.request_type = NET_NFC_MESSAGE_SERVICE_DEINIT;
+       req_msg.user_param = context;
+
+       ret = _net_nfc_client_send_reqeust((net_nfc_request_msg_t *)&req_msg, NULL);
+
+       return ret;
+}
+
+
diff --git a/src/clientlib/net_nfc_client_sign_record.c b/src/clientlib/net_nfc_client_sign_record.c
new file mode 100755 (executable)
index 0000000..44151ed
--- /dev/null
@@ -0,0 +1,42 @@
+/*\r
+  * Copyright 2012  Samsung Electronics Co., Ltd\r
+  *\r
+  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license\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
+#include "net_nfc_util_sign_record.h"\r
+\r
+#ifndef NET_NFC_EXPORT_API\r
+#define NET_NFC_EXPORT_API __attribute__((visibility("default")))\r
+#endif\r
+\r
+NET_NFC_EXPORT_API net_nfc_error_e net_nfc_sign_records(ndef_message_h msg, int begin_index, int end_index, char *cert_file, char *password)\r
+{\r
+       return net_nfc_util_sign_records((ndef_message_s *)msg, begin_index, end_index, cert_file, password);\r
+}\r
+\r
+NET_NFC_EXPORT_API net_nfc_error_e net_nfc_sign_ndef_message(ndef_message_h msg, char *cert_file, char *password)\r
+{\r
+       return net_nfc_util_sign_ndef_message((ndef_message_s *)msg, cert_file, password);\r
+}\r
+\r
+NET_NFC_EXPORT_API net_nfc_error_e net_nfc_verify_signature_ndef_message(ndef_message_h msg)\r
+{\r
+       return net_nfc_util_verify_signature_ndef_message((ndef_message_s *)msg);\r
+}\r
+\r
+NET_NFC_EXPORT_API net_nfc_error_e net_nfc_verify_signature_records(ndef_record_h begin_record, ndef_record_h sign_record)\r
+{\r
+       return net_nfc_util_verify_signature_records((ndef_record_s *)begin_record, (ndef_record_s *)sign_record);\r
+}\r
old mode 100644 (file)
new mode 100755 (executable)
index 06882c2..6162de6
@@ -104,6 +104,7 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_transceive(net_nfc_target_handle_h ha
        net_nfc_target_info_s *target_info = NULL;\r
        uint32_t length = 0;\r
        data_s *data = (data_s *)rawdata;\r
+       uint8_t *send_buffer;\r
 \r
        DEBUG_CLIENT_MSG("send reqeust :: transceive = [%d]", handle);\r
 \r
@@ -125,12 +126,80 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_transceive(net_nfc_target_handle_h ha
        /* fill trans information struct */\r
        target_info = client_context_tmp->target_info;\r
 \r
-       length = sizeof(net_nfc_request_transceive_t) + data->length;\r
-\r
-       _net_nfc_client_util_alloc_mem(request, length);\r
-       if (request == NULL)\r
+       switch(target_info->devType)\r
        {\r
-               return NET_NFC_ALLOC_FAIL;\r
+               case NET_NFC_MIFARE_MINI_PICC :\r
+               case NET_NFC_MIFARE_1K_PICC :\r
+               case NET_NFC_MIFARE_4K_PICC :\r
+               case NET_NFC_MIFARE_ULTRA_PICC :\r
+               {\r
+                       _net_nfc_client_util_alloc_mem(send_buffer, data->length + 2);\r
+                       if (send_buffer == NULL)\r
+                       {\r
+                               return NET_NFC_ALLOC_FAIL;\r
+                       }\r
+\r
+                       length = sizeof(net_nfc_request_transceive_t) + data->length + 2;\r
+\r
+                       _net_nfc_client_util_alloc_mem(request, length);\r
+                       if (request == NULL)\r
+                       {\r
+                               return NET_NFC_ALLOC_FAIL;\r
+                       }\r
+\r
+                       memcpy(send_buffer, data->buffer, data->length);\r
+                       net_nfc_util_compute_CRC(CRC_A, send_buffer, data->length + 2);\r
+\r
+                       memcpy(&request->info.trans_data.buffer, send_buffer, data->length + 2);\r
+\r
+                       request->info.trans_data.length = data->length + 2;\r
+               }\r
+               break;\r
+\r
+               case NET_NFC_JEWEL_PICC :\r
+               {\r
+                       _net_nfc_client_util_alloc_mem(send_buffer, 9);\r
+\r
+                       length = sizeof(net_nfc_request_transceive_t) + 9;\r
+\r
+                       _net_nfc_client_util_alloc_mem(request, length);\r
+                       if (request == NULL)\r
+                       {\r
+                               return NET_NFC_ALLOC_FAIL;\r
+                       }\r
+\r
+                       if(data->length > 9)\r
+                       {\r
+                               return NET_NFC_INVALID_PARAM;\r
+                       }\r
+\r
+                       memcpy(send_buffer, data->buffer, data->length);\r
+                       net_nfc_util_compute_CRC(CRC_B, send_buffer, 9);\r
+\r
+                       memcpy(&request->info.trans_data.buffer, send_buffer, 9);\r
+\r
+                       request->info.trans_data.length = 9;\r
+\r
+                       _net_nfc_client_util_free_mem(send_buffer);\r
+\r
+               }\r
+               break;\r
+\r
+               default :\r
+               {\r
+                       length = sizeof(net_nfc_request_transceive_t) + data->length;\r
+\r
+                       _net_nfc_client_util_alloc_mem(request, length);\r
+                       if (request == NULL)\r
+                       {\r
+                               return NET_NFC_ALLOC_FAIL;\r
+                       }\r
+\r
+                       memcpy(&request->info.trans_data.buffer, data->buffer, data->length);\r
+\r
+                       request->info.trans_data.length = data->length;\r
+               }\r
+               break;\r
        }\r
 \r
        /* fill request message */\r
@@ -140,9 +209,6 @@ NET_NFC_EXPORT_API net_nfc_error_e net_nfc_transceive(net_nfc_target_handle_h ha
        request->trans_param = trans_param;\r
        request->info.dev_type = (uint32_t)target_info->devType;\r
 \r
-       request->info.trans_data.length = data->length;\r
-       memcpy(&request->info.trans_data.buffer, data->buffer, request->info.trans_data.length);\r
-\r
        ret = _net_nfc_client_send_reqeust((net_nfc_request_msg_t *)request, NULL);\r
 \r
        _net_nfc_client_util_free_mem(request);\r
old mode 100644 (file)
new mode 100755 (executable)
index 1bda0b4..0b44933
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include "net_nfc_tag.h"\r
 #include "net_nfc_typedef_private.h"\r
 #include "net_nfc_client_ipc_private.h"\r
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index b2bc2eb..64aef75
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include "net_nfc_tag.h"\r
 #include "net_nfc_data.h"\r
 #include "net_nfc_typedef_private.h"\r
old mode 100644 (file)
new mode 100755 (executable)
index 4be7fa0..14b629a
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include "net_nfc_typedef_private.h"\r
 #include "net_nfc_target_info.h"\r
 #include "net_nfc_data.h"\r
index 7dc99d4..36a382f 100644 (file)
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 #include "net_nfc.h"
 #include "net_nfc_typedef.h"
 #include "net_nfc_util_private.h"
old mode 100644 (file)
new mode 100755 (executable)
index c47324c..80be1bc
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include <stdlib.h>\r
 #include <string.h>\r
 \r
index 10624fb..68435e2 100644 (file)
@@ -14,7 +14,7 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(commonlib_pkges REQUIRED glib-2.0 dlog bluetooth-api svi)
+pkg_check_modules(commonlib_pkges REQUIRED glib-2.0 dlog bluetooth-api svi libssl)
 
 FOREACH(flag ${commonlib_pkges_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
@@ -61,6 +61,7 @@ SET(COMMON_LIB_HEADER
        include/net_nfc_util_ndef_message.h
        include/net_nfc_util_handover.h
        include/net_nfc_util_ndef_record.h
+       include/net_nfc_util_sign_record.h
 )
 
 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${NFC_COMMON_LIB}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${NFC_COMMON_LIB}.pc)
old mode 100644 (file)
new mode 100755 (executable)
index 79df6ff..9325a06
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 #ifndef __NET_NFC_DEBUG_PRIVATE_H__
 #define __NET_NFC_DEBUG_PRIVATE_H__
 
index fdd02e7..8d75bcd 100644 (file)
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef NET_NFC_OEM_CONTROLLER_H\r
 #define NET_NFC_OEM_CONTROLLER_H\r
 \r
@@ -23,6 +24,7 @@ typedef bool (*net_nfc_oem_controller_init)(net_nfc_error_e *result);
 typedef bool (*net_nfc_oem_controller_deinit)(void);\r
 typedef bool (*net_nfc_oem_controller_register_listener)(target_detection_listener_cb target_detection_listener, se_transaction_listener_cb se_transaction_listener, llcp_event_listener_cb llcp_event_listener, net_nfc_error_e *result);\r
 typedef bool (*net_nfc_oem_controller_unregister_listener)(void);\r
+typedef bool (*net_nfc_oem_controller_get_firmware_version)(data_s **data, net_nfc_error_e *result);\r
 typedef bool (*net_nfc_oem_controller_check_firmware_version)(net_nfc_error_e *result);\r
 typedef bool (*net_nfc_oem_controller_update_firmware)(net_nfc_error_e *result);\r
 typedef bool (*net_nfc_oem_controller_get_stack_information)(net_nfc_stack_information_s *stack_info, net_nfc_error_e *result);\r
@@ -63,15 +65,20 @@ typedef bool (*net_nfc_oem_controller_llcp_get_remote_config)(net_nfc_target_han
 typedef bool (*net_nfc_oem_controller_llcp_get_remote_socket_info)(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, net_nfc_llcp_socket_option_s *option, net_nfc_error_e *result);\r
 \r
 typedef bool (*net_nfc_oem_controller_sim_test)(net_nfc_error_e *result);\r
+typedef bool (*net_nfc_oem_controller_prbs_test)(net_nfc_error_e *result , int tech , int rate);\r
+\r
 typedef bool (*net_nfc_oem_controller_test_mode_on)(net_nfc_error_e *result);\r
 typedef bool (*net_nfc_oem_controller_test_mode_off)(net_nfc_error_e *result);\r
 \r
+typedef bool (*net_nfc_oem_controller_support_nfc)(net_nfc_error_e *result);\r
+\r
 typedef struct _net_nfc_oem_interface_s\r
 {\r
        net_nfc_oem_controller_init init;\r
        net_nfc_oem_controller_deinit deinit;\r
        net_nfc_oem_controller_register_listener register_listener;\r
        net_nfc_oem_controller_unregister_listener unregister_listener;\r
+       net_nfc_oem_controller_get_firmware_version get_firmware_version;\r
        net_nfc_oem_controller_check_firmware_version check_firmware_version;\r
        net_nfc_oem_controller_update_firmware update_firmeware;\r
        net_nfc_oem_controller_get_stack_information get_stack_information;\r
@@ -110,8 +117,12 @@ typedef struct _net_nfc_oem_interface_s
        net_nfc_oem_controller_llcp_get_remote_socket_info get_remote_socket_info;\r
 \r
        net_nfc_oem_controller_sim_test sim_test;\r
+       net_nfc_oem_controller_prbs_test prbs_test;\r
        net_nfc_oem_controller_test_mode_on test_mode_on;\r
        net_nfc_oem_controller_test_mode_off test_mode_off;\r
+\r
+       net_nfc_oem_controller_support_nfc support_nfc;\r
+\r
 } net_nfc_oem_interface_s;\r
 \r
 #endif\r
old mode 100644 (file)
new mode 100755 (executable)
index cb9cf1c..767630b
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 /**
  NFC Manager
  NFC Manager controls the nfc device with high level APIs such as SmartPoster and Connection handover.
@@ -73,6 +74,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <stddef.h>
 #include <stdint.h>
 #include <stdbool.h>
 
@@ -207,6 +209,13 @@ typedef enum
 
        NET_NFC_MESSAGE_SIM_TEST,
 
+       NET_NFC_MESSAGE_INIT,/*31*/
+       NET_NFC_MESSAGE_DEINIT,
+
+       NET_NFC_MESSAGE_PRBS_TEST,
+
+       NET_NFC_MESSAGE_GET_FIRMWARE_VERSION,
+
 } net_nfc_message_e;
 
 typedef enum
@@ -487,6 +496,23 @@ typedef enum
        NET_NFC_SE_TYPE_SDCARD = 0x03, /* SDCard type is not currently supported */
 } net_nfc_se_type_e;
 
+typedef enum
+{
+       NET_NFC_SIGN_TYPE_NO_SIGN = 0,
+       NET_NFC_SIGN_TYPE_PKCS_1,
+       NET_NFC_SIGN_TYPE_PKCS_1_V_1_5,
+       NET_NFC_SIGN_TYPE_DSA,
+       NET_NFC_SIGN_TYPE_ECDSA,
+       NET_NFC_MAX_SIGN_TYPE,
+} net_nfc_sign_type_t;
+
+typedef enum
+{
+       NET_NFC_CERT_FORMAT_X_509 = 0,
+       NET_NFC_CERT_FORMAT_X9_86,
+       NET_NFC_MAX_CERT_FORMAT,
+} net_nfc_cert_format_t;
+
 #ifdef __cplusplus
 }
 #endif
old mode 100644 (file)
new mode 100755 (executable)
index 734648e..7003c20
@@ -1,19 +1,21 @@
 /*
- * Copyright (C) 2010 NXP Semiconductors
- * Copyright (C) 2012 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) 2010 NXP Semiconductors
+  * Copyright (C) 2012 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 __NET_NFC_INTERNAL_TYPEDEF_H__
@@ -376,17 +378,16 @@ typedef enum _client_state_e
        NET_NFC_CLIENT_ACTIVE_STATE,
 } client_state_e;
 
-typedef enum _server_state_e
-{
-       NET_NFC_SERVER_IDLE,
-       NET_NFC_SERVER_DISCOVERY,
-       NET_NFC_TAG_CONNECTED,
-       NET_NFC_SE_CONNECTED,
-       NET_NFC_LLCP_CONNECTED,
-       NET_NFC_SNEP_CLIENT_CONNECTED,
-       NET_NFC_NPP_CLIENT_CONNECTED,
-       NET_NFC_SNEP_SERVER_CONNECTED,
-} server_state_e;
+/* server state */
+#define NET_NFC_SERVER_IDLE                            0
+#define NET_NFC_SERVER_DISCOVERY                       (1 << 1)
+#define NET_NFC_TAG_CONNECTED                          (1 << 2)
+#define NET_NFC_SE_CONNECTED                           (1 << 3)
+#define NET_NFC_SNEP_CLIENT_CONNECTED  (1 << 4)
+#define NET_NFC_NPP_CLIENT_CONNECTED           (1 << 5)
+#define NET_NFC_SNEP_SERVER_CONNECTED  (1 << 6)
+#define NET_NFC_NPP_SERVER_CONNECTED           (1 << 7)
+
 
 #define        NET_NFC_CLIENT_TYPE_INVALID  0x00
 #define        NET_NFC_CLIENT_TYPE_MASTER 0x01
@@ -414,6 +415,16 @@ typedef struct _net_nfc_request_change_client_state_t
        int client_type;
 } net_nfc_request_change_client_state_t;
 
+typedef struct _net_nfc_request_set_launch_state_t
+{
+       /* DON'T MODIFY THIS CODE - BEGIN */
+       uint32_t length;
+       uint32_t request_type;
+       uint32_t user_param;
+       /* DON'T MODIFY THIS CODE - END */
+       bool set_launch_popup;
+}net_nfc_request_set_launch_state_t;
+
 typedef struct _net_nfc_request_transceive_t
 {
        /* DON'T MODIFY THIS CODE - BEGIN */
@@ -463,6 +474,8 @@ typedef struct _net_nfc_request_test_t
        /* DON'T MODIFY THIS CODE - END */
        net_nfc_target_handle_s *handle;
        void *trans_param;
+       uint32_t tech;
+       uint32_t rate;
 } net_nfc_request_test_t;
 
 typedef struct _net_nfc_request_make_read_only_ndef_t
@@ -1155,7 +1168,7 @@ typedef struct _net_nfc_response_send_apdu_t
 typedef struct _net_nfc_response_get_server_state_t
 {
        net_nfc_error_e result;
-       server_state_e state;
+       uint32_t state;
 } net_nfc_response_get_server_state_t;
 
 typedef struct _net_nfc_response_connection_handover
@@ -1167,6 +1180,13 @@ typedef struct _net_nfc_response_connection_handover
 }
 net_nfc_response_connection_handover_t;
 
+typedef struct _net_nfc_response_get_firmware_version
+{
+       net_nfc_error_e result;
+       data_s data;
+}
+net_nfc_response_get_firmware_version_t;
+
 typedef struct _client_context
 {
        void *register_user_param; /* parameter that registed in the cb register time */
@@ -1269,6 +1289,7 @@ typedef enum _net_nfc_message_service_e
        NET_NFC_MESSAGE_SERVICE_CHANGE_CLIENT_STATE,
        NET_NFC_MESSAGE_SERVICE_WATCH_DOG,
        NET_NFC_MESSAGE_SERVICE_CLEANER,
+       NET_NFC_MESSAGE_SERVICE_SET_LAUNCH_STATE,
 } net_nfc_message_service_e;
 
 typedef enum _net_nfc_se_command_e
@@ -1305,6 +1326,31 @@ typedef struct _net_nfc_carrier_config_s
        struct _GList *data;
 } net_nfc_carrier_config_s;
 
+typedef struct _net_nfc_sub_field_s
+{
+       uint16_t length;
+       uint8_t value[0];
+}
+__attribute__((packed)) net_nfc_sub_field_s;
+
+typedef struct _net_nfc_signature_record_s
+{
+       uint8_t version;
+       uint8_t sign_type : 7;
+       uint8_t uri_present : 1;
+       net_nfc_sub_field_s signature;
+}
+__attribute__((packed)) net_nfc_signature_record_s;
+
+typedef struct _net_nfc_certificate_chain_s
+{
+       uint8_t num_of_certs : 4;
+       uint8_t cert_format : 3;
+       uint8_t uri_present : 1;
+       uint8_t cert_store[0];
+}
+__attribute__((packed)) net_nfc_certificate_chain_s;
+
 #define SMART_POSTER_RECORD_TYPE "Sp"
 #define URI_RECORD_TYPE "U"
 #define TEXT_RECORD_TYPE "T"
old mode 100644 (file)
new mode 100755 (executable)
index a834f1c..c129f38
@@ -30,9 +30,7 @@
 #define BLUETOOTH_ADDRESS_LENGTH 6\r
 #define HIDDEN_BT_ADDR_FILE "/opt/etc/.bd_addr"\r
 \r
-#define NET_NFC_VCONF_KEY_PROGRESS "db/nfc/progress"\r
-\r
 /* define vconf key */\r
-#define NET_NFC_DISABLE_LAUNCH_POPUP_KEY "memory/nfc/popup_disabled"\r
+#define NET_NFC_DISABLE_LAUNCH_POPUP_KEY "memory/private/nfc-manager/popup_disabled"//"memory/nfc/popup_disabled"\r
 \r
 #endif\r
old mode 100644 (file)
new mode 100755 (executable)
index 15d6036..3a1d44b
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_UTIL_HANDOVER__\r
 #define __NET_NFC_UTIL_HANDOVER__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 7cd3844..49fd744
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_UTIL_NDEF_MESSAGE__\r
 #define __NET_NFC_UTIL_NDEF_MESSAGE__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 394c7f8..7c77e1a
@@ -1,19 +1,20 @@
 /*
- * Copyright (C) 2010 NXP Semiconductors
- * Copyright (C) 2012 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) 2010 NXP Semiconductors
+  * Copyright (C) 2012 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 __NET_NFC_UTIL_NDEF_PARSER__
old mode 100644 (file)
new mode 100755 (executable)
index 8bbc1c6..c4128ba
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_UTIL_NDEF_RECORD__\r
 #define __NET_NFC_UTIL_NDEF_RECORD__\r
 \r
diff --git a/src/commonlib/include/net_nfc_util_openssl_private.h b/src/commonlib/include/net_nfc_util_openssl_private.h
new file mode 100644 (file)
index 0000000..7e2d4a1
--- /dev/null
@@ -0,0 +1,61 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+  *
+  * 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 NET_NFC_UTIL_OPENSSL_PRIVATE_H_
+#define NET_NFC_UTIL_OPENSSL_PRIVATE_H_
+
+#include <openssl/x509.h>
+
+enum
+{
+       OPENSSL_FORMAT_UNDEF,
+       OPENSSL_FORMAT_ASN1,
+       OPENSSL_FORMAT_TEXT,
+       OPENSSL_FORMAT_PEM,
+       OPENSSL_FORMAT_NETSCAPE,
+       OPENSSL_FORMAT_PKCS12,
+       OPENSSL_FORMAT_SMIME,
+       OPENSSL_FORMAT_ENGINE,
+       OPENSSL_FORMAT_IISSGC,
+       OPENSSL_FORMAT_PEMRSA,
+       OPENSSL_FORMAT_ASN1RSA,
+       OPENSSL_FORMAT_MSBLOB,
+       OPENSSL_FORMAT_PVK,
+};
+
+typedef struct _net_nfc_openssl_verify_context_s
+{
+       X509 *signer_cert;
+       X509_STORE *store;
+       X509_STORE_CTX *store_ctx;
+}
+net_nfc_openssl_verify_context_s;
+
+typedef net_nfc_openssl_verify_context_s *net_nfc_openssl_verify_context_h;
+
+net_nfc_openssl_verify_context_h net_nfc_util_openssl_init_verify_certificate(void);
+bool net_nfc_util_openssl_add_certificate_of_signer(net_nfc_openssl_verify_context_h context, uint8_t *buffer, uint32_t length);
+bool net_nfc_util_openssl_add_certificate_of_ca(net_nfc_openssl_verify_context_h context, uint8_t *buffer, uint32_t length);
+int net_nfc_util_openssl_verify_certificate(net_nfc_openssl_verify_context_h context);
+void net_nfc_util_openssl_release_verify_certificate(net_nfc_openssl_verify_context_h context);
+
+int net_nfc_util_openssl_sign_buffer(uint32_t type, uint8_t *buffer, uint32_t length, char *key_file, char *password, uint8_t *sign, uint32_t *sign_len);
+int net_nfc_util_openssl_verify_signature(uint32_t type, uint8_t *buffer, uint32_t length, uint8_t *cert, uint32_t cert_len, uint8_t *sign, uint32_t sign_len);
+int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_t **buffer, uint32_t *length, uint32_t *cert_count);
+
+
+#endif /* NET_NFC_UTIL_OPENSSL_PRIVATE_H_ */
index 0383099..1cfd52d 100644 (file)
   * limitations under the License.
   */
 
+
 #ifndef __NET_NFC_UTIL_H__
 #define __NET_NFC_UTIL_H__
 
 #include <stdio.h>
 #include <libgen.h>
+#include <netinet/in.h>
 
 #include "net_nfc_typedef_private.h"
 
+#define NET_NFC_REVERSE_ORDER_6_BYTES(__array) \
+       do \
+       { \
+               uint16_t __x = htons(*(uint16_t *)(__array + 4)); \
+               *(uint32_t *)(__array + 2) = htonl(*(uint32_t *)(__array)); \
+               *(uint16_t *)(__array) = __x; \
+       } while (0);
+
+#define NET_NFC_REVERSE_ORDER_16_BYTES(array) \
+       do \
+       { \
+               uint32_t __x1 = htonl(*(uint32_t *)(array + 12)); \
+               uint32_t __x2 = htonl(*(uint32_t *)(array + 8)); \
+               *(uint32_t *)(array + 8) = htonl(*(uint32_t *)(array + 4)); \
+               *(uint32_t *)(array + 12) = htonl(*(uint32_t *)(array)); \
+               *(uint32_t *)(array) = __x1; \
+               *(uint32_t *)(array + 4) = __x2; \
+       } while (0);
+
+
 typedef enum
 {
        CRC_A = 0x00,
diff --git a/src/commonlib/include/net_nfc_util_sign_record.h b/src/commonlib/include/net_nfc_util_sign_record.h
new file mode 100755 (executable)
index 0000000..f43e41f
--- /dev/null
@@ -0,0 +1,36 @@
+/*\r
+  * Copyright 2012  Samsung Electronics Co., Ltd\r
+  *\r
+  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license\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
+#ifndef __NET_NFC_UTIL_SIGN_RECORD_H\r
+#define __NET_NFC_UTIL_SIGN_RECORD_H\r
+\r
+#include "net_nfc_typedef_private.h"\r
+\r
+/*\r
+ * sign ndef record and ndef message\r
+ */\r
+net_nfc_error_e net_nfc_util_sign_records(ndef_message_s *msg, int begin_index, int end_index, char *cert_file, char *password);\r
+net_nfc_error_e net_nfc_util_sign_ndef_message(ndef_message_s *msg, char *cert_file, char *password);\r
+\r
+/*\r
+ * check validity of ndef record and ndef message\r
+ */\r
+net_nfc_error_e net_nfc_util_verify_signature_ndef_message(ndef_message_s *msg);\r
+net_nfc_error_e net_nfc_util_verify_signature_records(ndef_record_s *begin_record, ndef_record_s *sign_record);\r
+\r
+\r
+#endif /* __NET_NFC_UTIL_SIGN_RECORD_H */\r
+\r
index fc41507..a810450 100644 (file)
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include <glib.h>\r
 \r
 #include "net_nfc_typedef_private.h"\r
old mode 100644 (file)
new mode 100755 (executable)
index 5ba5bdf..1a01c79
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include "net_nfc_debug_private.h"\r
 #include "net_nfc_util_defines.h"\r
 #include "net_nfc_util_private.h"\r
old mode 100644 (file)
new mode 100755 (executable)
index bc3be5a..23a1632
@@ -1,19 +1,20 @@
 /*
- * Copyright (C) 2010 NXP Semiconductors
- * Copyright (C) 2012 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) 2010 NXP Semiconductors
+  * Copyright (C) 2012 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 "net_nfc_debug_private.h"
@@ -46,6 +47,9 @@ void __phFriNfc_NdefRecord_RecordFlag(uint8_t *rawData, ndef_record_s* record)
        {
                record->IL = 1;
        }
+       DEBUG_MSG("__phFriNfc_NdefRecord_RecordFlag MB[%d]ME[%d]CF[%d]SR[%d]IL[%d]", record->MB,record->ME,record->CF,record->SR,record->IL  );
+
+
 }
 
 /* Calculate the Type Name Format for the record */
@@ -69,6 +73,8 @@ uint8_t __phFriNfc_NdefRecord_TypeNameFormat(uint8_t *rawData, ndef_record_s* re
                tnf = 0xFF;
                break;
        }
+       DEBUG_MSG("__phFriNfc_NdefRecord_TypeNameFormat tnf[%d]", tnf  );
+
        return tnf;
 
 }
@@ -148,6 +154,44 @@ net_nfc_error_e __phFriNfc_NdefRecord_RecordIDCheck(uint8_t *rawData,
                        *IDLength = 0;
                }
        }
+       else if(record->TNF == NET_NFC_NDEF_TNF_ABSURI) /* temp_patch_for_absoluteURI */
+       {
+               *TypeLength = *(rawData + SLP_FRINET_NFC_NDEFRECORD_BUF_INC1);
+               *TypeLengthByte = 1;
+               DEBUG_MSG("__phFriNfc_NdefRecord_RecordIDCheck TypeLength = [%d]", *TypeLength);
+
+
+               /* Check for Short Record */
+               if (record->SR)
+               {
+                       /* For Short Record, Payload Length Byte is 1 */
+                       *PayloadLengthByte = 1;
+                       /*  1 for Header byte */
+                       *PayloadLength = *(rawData + *TypeLengthByte + SLP_FRINET_NFC_NDEFRECORD_BUF_INC1);
+               }
+               else
+               {
+                       /* For Normal Record, Payload Length Byte is 4 */
+                       *PayloadLengthByte = SLPFRINFCNDEFRECORD_NORMAL_RECORD_BYTE;
+                       *PayloadLength = ((((uint32_t)(*(rawData + SLP_FRINET_NFC_NDEFRECORD_BUF_INC2))) << SLPNFCSTSHL24) +
+                               (((uint32_t)(*(rawData + SLP_FRINET_NFC_NDEFRECORD_BUF_INC3))) << SLPNFCSTSHL16) +
+                               (((uint32_t)(*(rawData + SLP_FRINET_NFC_NDEFRECORD_BUF_INC4))) << SLPNFCSTSHL8) +
+                               *(rawData + SLP_FRINET_NFC_NDEFRECORD_BUF_INC5));
+               }
+
+               if (record->IL)
+               {
+                       *IDLengthByte = 1;
+                       /*  1 for Header byte */
+                       *IDLength = (uint8_t)*(rawData + *PayloadLengthByte + *TypeLengthByte + SLP_FRINET_NFC_NDEFRECORD_BUF_INC1);
+               }
+               else
+               {
+                       *IDLengthByte = 0;
+                       *IDLength = 0;
+               }
+
+       }
        else
        {
                if (record->TNF == NET_NFC_NDEF_TNF_UNKNOWN
@@ -162,11 +206,6 @@ net_nfc_error_e __phFriNfc_NdefRecord_RecordIDCheck(uint8_t *rawData,
                        *TypeLength = 0;
                        *TypeLengthByte = 1;
                }
-               else if(record->TNF == NET_NFC_NDEF_TNF_ABSURI) /* temp_patch_for_absoluteURI */
-               {
-                       *TypeLength = 0;
-                       *TypeLengthByte = 0;
-               }
                else
                {
                        /*  1 for Header byte */
@@ -288,9 +327,14 @@ net_nfc_error_e __phFriNfc_NdefRecord_Parse(ndef_record_s*Record, uint8_t *RawRe
                        }
 
                        RawRecord = RawRecord + Record->id_s.length;
-                       _net_nfc_util_alloc_mem(Record->payload_s.buffer, Record->payload_s.length);
-                       if (Record->payload_s.buffer != NULL)
-                               memcpy(Record->payload_s.buffer, RawRecord, Record->payload_s.length);
+
+                       if (Record->payload_s.length != 0)
+                       {
+                               _net_nfc_util_alloc_mem(Record->payload_s.buffer, Record->payload_s.length);
+                               if (Record->payload_s.buffer != NULL)
+                                       memcpy(Record->payload_s.buffer, RawRecord, Record->payload_s.length);
+                       }
+                       DEBUG_MSG("__phFriNfc_NdefRecord_Parse Record->type_s.buffer= [%s]", Record->type_s.buffer);
 
                        *readData = RawRecord + Record->payload_s.length - original;
                }
@@ -403,7 +447,9 @@ net_nfc_error_e __phFriNfc_NdefRecord_Generate(ndef_record_s *Record,
        }
        else if (FlagCheck == NET_NFC_NDEF_TNF_ABSURI )  /* temp_patch_for_absoluteURI */
        {
-               // nothing for type
+               *Buffer = Record->type_s.length;
+               Buffer++;
+               TypeCheck = 1;
        }
        else
        {
old mode 100644 (file)
new mode 100755 (executable)
index c97d304..dd2d3e8
@@ -46,7 +46,7 @@ net_nfc_error_e net_nfc_util_create_record(net_nfc_record_tnf_e recordType, data
                return NET_NFC_NULL_PARAMETER;\r
        }\r
 \r
-       if (recordType < NET_NFC_RECORD_EMPTY || recordType > NET_NFC_RECORD_EXTERNAL_RTD)\r
+       if (recordType < NET_NFC_RECORD_EMPTY || recordType > NET_NFC_RECORD_UNCHAGNED)\r
        {\r
                return NET_NFC_OUT_OF_BOUND;\r
        }\r
@@ -280,7 +280,6 @@ uint32_t net_nfc_util_get_record_length(ndef_record_s *Record)
        RecordLength++;\r
        if (Record->TNF != NET_NFC_NDEF_TNF_EMPTY &&\r
                Record->TNF != NET_NFC_NDEF_TNF_UNKNOWN &&\r
-               Record->TNF != NET_NFC_NDEF_TNF_ABSURI &&  /* temp_patch_for_absoluteURI */\r
                Record->TNF != NET_NFC_NDEF_TNF_UNCHANGED)\r
        {\r
                RecordLength += Record->type_s.length;\r
diff --git a/src/commonlib/net_nfc_util_openssl.c b/src/commonlib/net_nfc_util_openssl.c
new file mode 100644 (file)
index 0000000..06d4278
--- /dev/null
@@ -0,0 +1,742 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+  *
+  * 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 <openssl/evp.h>
+#include <openssl/engine.h>
+#include <openssl/pkcs12.h>
+#include <openssl/pem.h>
+
+#include "net_nfc_typedef_private.h"
+#include "net_nfc_debug_private.h"
+#include "net_nfc_util_private.h"
+#include "net_nfc_util_openssl_private.h"
+
+//static X509 *_load_certificate_from_file(const char *file)
+//{
+//     X509 *x509 = NULL;
+//     BIO *cert = NULL;
+//
+//     cert = BIO_new(BIO_s_file());
+//     if (cert != NULL)
+//     {
+//             if (BIO_read_filename(cert, file) > 0)
+//             {
+//                     x509 = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
+//             }
+//
+//             BIO_free(cert);
+//     }
+//
+//     return x509;
+//}
+
+static X509 *_load_certificate_from_mem(int format, uint8_t *buffer, uint32_t length, char *password)
+{
+       X509 *x509 = NULL;
+       BIO *mem = NULL;
+
+       mem = BIO_new_mem_buf(buffer, length);
+       if (mem != NULL)
+       {
+               switch (format)
+               {
+               case 0 :
+                       x509 = d2i_X509_bio(mem, NULL);
+                       break;
+
+               case 1 :
+                       x509 = PEM_read_bio_X509(mem, NULL, NULL, NULL);
+                       break;
+
+               case 2 :
+                       {
+                               PKCS12 *p12 = d2i_PKCS12_bio(mem, NULL);
+                               PKCS12_parse(p12, password, NULL, &x509, NULL);
+                               PKCS12_free(p12);
+                       }
+                       break;
+               }
+
+               BIO_free(mem);
+       }
+       else
+       {
+               DEBUG_ERR_MSG("X509_LOOKUP_load_file failed");
+       }
+
+       return x509;
+}
+
+//int net_nfc_util_openssl_verify_certificate(const char* certfile, const char* CAfile)
+//{
+//     int ret = 0;
+//     X509_STORE *cert_ctx = NULL;
+//     X509_LOOKUP *lookup = NULL;
+//
+//     cert_ctx = X509_STORE_new();
+//     if (cert_ctx != NULL)
+//     {
+//             OpenSSL_add_all_algorithms();
+//
+//             lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
+//             if (lookup != NULL)
+//             {
+//                     if (X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM) == true)
+//                     {
+//                             lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
+//                             if (lookup != NULL)
+//                             {
+//                                     X509_LOOKUP_add_dir(lookup, NULL, X509_FILETYPE_DEFAULT);
+//
+//                                     ret = _verify_certificate_file(cert_ctx, certfile);
+//                             }
+//                             else
+//                             {
+//                                     DEBUG_ERR_MSG("X509_STORE_add_lookup failed");
+//                             }
+//                     }
+//                     else
+//                     {
+//                             DEBUG_ERR_MSG("X509_LOOKUP_load_file failed");
+//                     }
+//             }
+//             else
+//             {
+//                     DEBUG_ERR_MSG("X509_STORE_add_lookup failed");
+//             }
+//
+//             X509_STORE_free(cert_ctx);
+//     }
+//     else
+//     {
+//             DEBUG_ERR_MSG("X509_STORE_new failed");
+//     }
+//
+//     return ret;
+//}
+
+net_nfc_openssl_verify_context_s *net_nfc_util_openssl_init_verify_certificate(void)
+{
+       net_nfc_openssl_verify_context_s *result = NULL;
+
+       _net_nfc_util_alloc_mem(result, sizeof(net_nfc_openssl_verify_context_s));
+       if (result != NULL)
+       {
+               result->store = X509_STORE_new();
+               if (result->store != NULL)
+               {
+                       OpenSSL_add_all_algorithms();
+               }
+               else
+               {
+                       DEBUG_ERR_MSG("X509_STORE_new failed");
+               }
+       }
+       else
+       {
+               DEBUG_ERR_MSG("alloc failed [%d]", sizeof(net_nfc_openssl_verify_context_s));
+       }
+
+       return result;
+}
+
+void net_nfc_util_openssl_release_verify_certificate(net_nfc_openssl_verify_context_s *context)
+{
+       if (context != NULL)
+       {
+               if (context->signer_cert != NULL)
+                       X509_free(context->signer_cert);
+
+               if (context->store != NULL)
+                       X509_STORE_free(context->store);
+
+               _net_nfc_util_free_mem(context);
+       }
+}
+
+bool net_nfc_util_openssl_add_certificate_of_signer(net_nfc_openssl_verify_context_s *context, uint8_t *buffer, uint32_t length)
+{
+       bool result = false;
+
+       if (context->signer_cert != NULL)
+       {
+               X509_free(context->signer_cert);
+               context->signer_cert = NULL;
+       }
+
+       context->signer_cert = _load_certificate_from_mem(1, buffer, length, NULL);
+       if (context->signer_cert != NULL)
+               result = true;
+
+       return result;
+}
+
+bool net_nfc_util_openssl_add_certificate_of_ca(net_nfc_openssl_verify_context_s *context, uint8_t *buffer, uint32_t length)
+{
+       bool result = false;
+       X509 *x509 = NULL;
+
+       x509 = _load_certificate_from_mem(1, buffer, length, NULL);
+       if (x509 != NULL)
+       {
+               X509_STORE_add_cert(context->store, x509);
+
+               result = true;
+       }
+
+       return result;
+}
+
+int net_nfc_util_openssl_verify_certificate(net_nfc_openssl_verify_context_s *context)
+{
+       int result = 0;
+       X509_STORE_CTX *store_ctx = NULL;
+
+       store_ctx = X509_STORE_CTX_new();
+       if (store_ctx != NULL)
+       {
+               X509_STORE_set_flags(context->store, 0);
+               if (X509_STORE_CTX_init(store_ctx, context->store, context->signer_cert, 0) == true)
+               {
+                       result = X509_verify_cert(store_ctx);
+               }
+               else
+               {
+                       DEBUG_ERR_MSG("X509_STORE_CTX_init failed");
+               }
+
+               X509_STORE_CTX_free(store_ctx);
+       }
+       else
+       {
+               DEBUG_ERR_MSG("X509_STORE_CTX_new failed");
+       }
+
+       return result;
+}
+
+int _password_callback(char *buf, int bufsiz, int verify, void *data)
+{
+       int res = 0;
+       const char *password = (char *)data;
+
+       if (password)
+       {
+               res = strlen(password);
+               if (res > bufsiz)
+                       res = bufsiz;
+               memcpy(buf, password, res);
+               return res;
+       }
+
+       return res;
+}
+
+static int _load_pkcs12(BIO *in, const char *password, EVP_PKEY **pkey, X509 **cert, STACK_OF(X509) **ca)
+{
+       int ret = 0;
+       PKCS12 *p12 = NULL;
+
+       if ((p12 = d2i_PKCS12_bio(in, NULL)) != NULL)
+       {
+               if (PKCS12_verify_mac(p12, password, strlen(password)) == true)
+               {
+                       ret = PKCS12_parse(p12, password, pkey, cert, ca);
+               }
+               else
+               {
+                       DEBUG_ERR_MSG("Mac verify error (wrong password?) in PKCS12 file");
+               }
+
+               PKCS12_free(p12);
+       }
+       else
+       {
+               DEBUG_ERR_MSG("Error loading PKCS12 file");
+       }
+
+       return ret;
+}
+
+EVP_PKEY *_load_key(const char *file, int format, const char *pass, ENGINE *e)
+{
+       BIO *key = NULL;
+       EVP_PKEY *pkey = NULL;
+
+       if (file == NULL)
+       {
+               DEBUG_ERR_MSG("no keyfile specified\n");
+               return pkey;
+       }
+
+       if (format == OPENSSL_FORMAT_ENGINE)
+       {
+               if (e != NULL)
+               {
+                       pkey = ENGINE_load_private_key(e, file, NULL/*ui_method*/, (void *)pass);
+                       if (!pkey)
+                       {
+                               DEBUG_ERR_MSG("cannot load key from engine");
+                       }
+               }
+               else
+               {
+                       DEBUG_ERR_MSG("no engine specified");
+               }
+       }
+       else
+       {
+               if ((key = BIO_new(BIO_s_file())) != NULL)
+               {
+                       if (BIO_read_filename(key,file) > 0)
+                       {
+                               switch (format)
+                               {
+                               case OPENSSL_FORMAT_ASN1 :
+                                       pkey = d2i_PrivateKey_bio(key, NULL);
+                                       break;
+
+                               case OPENSSL_FORMAT_PEM :
+                                       pkey = PEM_read_bio_PrivateKey(key, NULL, (pem_password_cb *)_password_callback, (void *)pass);
+                                       break;
+
+                               case OPENSSL_FORMAT_PKCS12 :
+                                       if (_load_pkcs12(key, pass, &pkey, NULL, NULL) == false)
+                                       {
+                                               DEBUG_ERR_MSG("_load_pkcs12 failed");
+                                       }
+                                       break;
+
+                               case OPENSSL_FORMAT_MSBLOB :
+                                       pkey = b2i_PrivateKey_bio(key);
+                                       break;
+
+                               case OPENSSL_FORMAT_PVK :
+                                       pkey = b2i_PVK_bio(key, (pem_password_cb *)_password_callback, (void *)pass);
+                                       break;
+
+                               default :
+                                       DEBUG_ERR_MSG("bad input format specified for key file");
+                                       break;
+                               }
+                       }
+                       else
+                       {
+                               DEBUG_ERR_MSG("Error opening %s", file);
+                       }
+
+                       BIO_free(key);
+               }
+               else
+               {
+                       DEBUG_ERR_MSG("BIO_new failed");
+               }
+       }
+
+       return pkey;
+}
+
+EVP_PKEY *_load_pubkey(const char *file, int format, const char *pass, ENGINE *e, const char *key_descrip)
+{
+       BIO *key = NULL;
+       EVP_PKEY *pkey = NULL;
+
+       if (file == NULL)
+       {
+               DEBUG_ERR_MSG("no keyfile specified");
+               return pkey;
+       }
+
+       if (format == OPENSSL_FORMAT_ENGINE)
+       {
+               if (e != NULL)
+               {
+                       pkey = ENGINE_load_public_key(e, file, NULL/*ui_method*/, (void *)pass);
+               }
+               else
+               {
+                       DEBUG_ERR_MSG("no engine specified");
+               }
+       }
+       else
+       {
+               if ((key = BIO_new(BIO_s_file())) != NULL)
+               {
+                       if (BIO_read_filename(key,file) <= 0)
+                       {
+                               switch (format)
+                               {
+                               case OPENSSL_FORMAT_ASN1 :
+                                       pkey = d2i_PUBKEY_bio(key, NULL);
+                                       break;
+
+                               case OPENSSL_FORMAT_ASN1RSA :
+                                       {
+                                               RSA *rsa;
+                                               rsa = d2i_RSAPublicKey_bio(key, NULL);
+                                               if (rsa)
+                                               {
+                                                       pkey = EVP_PKEY_new();
+                                                       if (pkey)
+                                                               EVP_PKEY_set1_RSA(pkey, rsa);
+                                                       RSA_free(rsa);
+                                               }
+                                               else
+                                                       pkey = NULL;
+                                       }
+                                       break;
+
+                               case OPENSSL_FORMAT_PEMRSA :
+                                       {
+                                               RSA *rsa;
+                                               rsa = PEM_read_bio_RSAPublicKey(key, NULL, (pem_password_cb *)_password_callback, (void *)pass);
+                                               if (rsa)
+                                               {
+                                                       pkey = EVP_PKEY_new();
+                                                       if (pkey)
+                                                               EVP_PKEY_set1_RSA(pkey, rsa);
+                                                       RSA_free(rsa);
+                                               }
+                                               else
+                                                       pkey = NULL;
+                                       }
+                                       break;
+
+                               case OPENSSL_FORMAT_PEM :
+                                       pkey = PEM_read_bio_PUBKEY(key, NULL, (pem_password_cb *)_password_callback, (void *)pass);
+                                       break;
+
+                               case OPENSSL_FORMAT_MSBLOB :
+                                       pkey = b2i_PublicKey_bio(key);
+                                       break;
+
+                               default :
+                                       DEBUG_ERR_MSG("bad input format specified for key file");
+                                       break;
+                               }
+                       }
+                       else
+                       {
+                               DEBUG_ERR_MSG("Error opening %s %s", key_descrip, file);
+                       }
+
+                       BIO_free(key);
+               }
+               else
+               {
+                       DEBUG_ERR_MSG("BIO_new failed");
+               }
+       }
+
+       return pkey;
+}
+
+int net_nfc_util_openssl_sign_buffer(uint32_t type, uint8_t *buffer, uint32_t length, char *key_file, char *password, uint8_t *sign, uint32_t *sign_len)
+{
+       int result = 0;
+       const EVP_MD *md = NULL;
+       ENGINE *engine;
+       EVP_PKEY *pkey;
+
+       OpenSSL_add_all_algorithms();
+
+       /* md context */
+       EVP_MD_CTX ctx = { 0, };
+       EVP_PKEY_CTX *pctx = NULL;
+
+       switch (type)
+       {
+       case 0 :
+               result = 0;
+               return result;
+
+               /* RSASSA-PSS, RSASSA-PKCS1-v1_5 */
+       case 1 :
+               case 2 :
+               /* md */
+               md = EVP_get_digestbyname("sha1");
+
+               /* engine */
+               engine = ENGINE_get_default_RSA();
+               break;
+
+               /* DSA */
+       case 3 :
+               /* md */
+               //md = EVP_get_digestbyname("sha1");
+               /* engine */
+               engine = ENGINE_get_default_DSA();
+               break;
+
+               /* ECDSA */
+       case 4 :
+               /* md */
+               md = EVP_get_digestbyname("sha1");
+
+               /* engine */
+               engine = ENGINE_get_default_ECDSA();
+               break;
+
+       default :
+               result = -1;
+               return result;
+       }
+
+       /* pkey */
+       pkey = _load_key(key_file, OPENSSL_FORMAT_PKCS12, password, NULL);
+
+       EVP_DigestSignInit(&ctx, &pctx, md, engine, pkey);
+       EVP_DigestSignUpdate(&ctx, buffer, length);
+       EVP_DigestSignFinal(&ctx, sign, sign_len);
+
+       return result;
+}
+
+int net_nfc_util_openssl_verify_signature(uint32_t type, uint8_t *buffer, uint32_t length, uint8_t *cert, uint32_t cert_len, uint8_t *sign, uint32_t sign_len)
+{
+       int result = 0;
+       const EVP_MD *md = NULL;
+       ENGINE *engine;
+       EVP_PKEY *pkey;
+
+       OpenSSL_add_all_algorithms();
+
+       /* md context */
+       EVP_MD_CTX ctx = { 0, };
+       EVP_PKEY_CTX *pctx = NULL;
+
+       switch (type)
+       {
+       case 0 :
+               result = 0;
+               return result;
+
+               /* RSASSA-PSS, RSASSA-PKCS1-v1_5 */
+       case 1 :
+       case 2 :
+               /* md */
+               md = EVP_get_digestbyname("sha1");
+
+               /* engine */
+               engine = ENGINE_get_default_RSA();
+               break;
+
+               /* DSA */
+       case 3 :
+               /* md */
+               //md = EVP_get_digestbyname("sha1");
+               /* engine */
+               engine = ENGINE_get_default_DSA();
+               break;
+
+               /* ECDSA */
+       case 4 :
+               /* md */
+               md = EVP_get_digestbyname("sha1");
+
+               /* engine */
+               engine = ENGINE_get_default_ECDSA();
+               break;
+
+       default :
+               result = -1;
+               return result;
+       }
+
+       /* pkey */
+       X509 *x509 = _load_certificate_from_mem(0, cert, cert_len, NULL);
+       pkey = X509_PUBKEY_get(X509_get_X509_PUBKEY(x509));
+       X509_free(x509);
+
+       EVP_DigestVerifyInit(&ctx, &pctx, md, engine, pkey);
+       EVP_DigestVerifyUpdate(&ctx, buffer, length);
+       result = EVP_DigestVerifyFinal(&ctx, sign, sign_len);
+
+       DEBUG_MSG("EVP_DigestVerifyFinal returns %d", result);
+
+       return result;
+}
+
+#if 0
+int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_t **buffer, uint32_t *length, uint32_t *cert_count)
+{
+       int result = 0;
+       BIO *bio = NULL;
+
+       bio = BIO_new(BIO_s_file());
+       if (bio != NULL)
+       {
+               if (BIO_read_filename(bio, file_name) > 0)
+               {
+                       STACK_OF(X509_INFO) *xis = NULL;
+
+                       if ((xis = PEM_X509_INFO_read_bio(bio, NULL, (pem_password_cb *)_password_callback, password)) != NULL)
+                       {
+                               X509_INFO *xi;
+                               int i;
+                               uint32_t temp_len = 0;
+                               uint8_t *temp_buf = NULL;
+                               uint32_t offset = 0;
+                               uint32_t count = 0;
+
+                               for (i = 0; i < sk_X509_INFO_num(xis); i++)
+                               {
+                                       xi = sk_X509_INFO_value(xis, i);
+                                       if (xi->x509)
+                                       {
+                                               int32_t ret = 0;
+
+                                               if ((ret = i2d_X509(xi->x509, NULL)) > 0)
+                                               {
+                                                       temp_len += (ret + 2);
+                                               }
+                                       }
+                               }
+
+                               DEBUG_MSG("count = %d, length = %d", sk_X509_INFO_num(xis), temp_len);
+                               *length = temp_len;
+                               _net_nfc_util_alloc_mem(*buffer, temp_len);
+
+                               for (i = 0; i < sk_X509_INFO_num(xis); i++)
+                               {
+                                       xi = sk_X509_INFO_value(xis, i);
+                                       if (xi->x509)
+                                       {
+                                               temp_buf = NULL;
+
+                                               if ((temp_len = i2d_X509(xi->x509, &temp_buf)) > 0)
+                                               {
+                                                       *(uint16_t *)(*buffer + offset) = temp_len;
+                                                       offset += sizeof(uint16_t);
+
+                                                       memcpy(*buffer + offset, temp_buf, temp_len);
+                                                       offset += temp_len;
+
+                                                       count++;
+                                               }
+                                       }
+                               }
+
+                               *cert_count = count;
+
+                               sk_X509_INFO_pop_free(xis, X509_INFO_free);
+                       }
+                       else
+                       {
+                               DEBUG_ERR_MSG("PEM_X509_INFO_read_bio failed");
+                       }
+               }
+
+               BIO_free(bio);
+       }
+
+       return result;
+}
+#endif
+
+/* TODO : DER?? PEM?? */
+int net_nfc_util_get_cert_list_from_file(char *file_name, char *password, uint8_t **buffer, uint32_t *length, uint32_t *cert_count)
+{
+       int result = 0;
+       BIO *bio = NULL;
+
+       bio = BIO_new(BIO_s_file());
+       if (bio != NULL)
+       {
+               if (BIO_read_filename(bio, file_name) > 0)
+               {
+                       EVP_PKEY *pkey = NULL;
+                       X509 *x509 = NULL;
+                       STACK_OF(X509) *ca = NULL;
+
+                       if (_load_pkcs12(bio, password, &pkey, &x509, &ca) != 0)
+                       {
+                               X509 *temp_x509;
+                               int i;
+                               uint32_t temp_len = 0;
+                               uint8_t *temp_buf = NULL;
+                               uint32_t offset = 0;
+                               uint32_t count = 0;
+                               int32_t ret = 0;
+
+                               if ((ret = i2d_X509(x509, NULL)) > 0)
+                               {
+                                       temp_len += (ret + 2);
+                               }
+
+                               for (i = 0; i < sk_X509_num(ca); i++)
+                               {
+                                       temp_x509 = sk_X509_value(ca, i);
+                                       if (temp_x509)
+                                       {
+                                               if ((ret = i2d_X509(temp_x509, NULL)) > 0)
+                                               {
+                                                       temp_len += (ret + 2);
+                                               }
+                                       }
+                               }
+
+                               DEBUG_MSG("count = %d, length = %d", sk_X509_num(ca) + 1, temp_len);
+                               *length = temp_len;
+                               _net_nfc_util_alloc_mem(*buffer, temp_len);
+
+                               if ((temp_len = i2d_X509(x509, &temp_buf)) > 0)
+                               {
+                                       *(uint16_t *)(*buffer + offset) = temp_len;
+                                       offset += sizeof(uint16_t);
+
+                                       memcpy(*buffer + offset, temp_buf, temp_len);
+                                       offset += temp_len;
+
+                                       count++;
+                               }
+
+                               for (i = 0; i < sk_X509_num(ca); i++)
+                               {
+                                       temp_x509 = sk_X509_value(ca, i);
+                                       if (temp_x509)
+                                       {
+                                               temp_buf = NULL;
+
+                                               if ((temp_len = i2d_X509(temp_x509, &temp_buf)) > 0)
+                                               {
+                                                       *(uint16_t *)(*buffer + offset) = temp_len;
+                                                       offset += sizeof(uint16_t);
+
+                                                       memcpy(*buffer + offset, temp_buf, temp_len);
+                                                       offset += temp_len;
+
+                                                       count++;
+                                               }
+                                       }
+                               }
+
+                               *cert_count = count;
+
+                               sk_X509_pop_free(ca, X509_free);
+                       }
+                       else
+                       {
+                               DEBUG_ERR_MSG("PEM_X509_INFO_read_bio failed");
+                       }
+               }
+
+               BIO_free(bio);
+       }
+
+       return result;
+}
diff --git a/src/commonlib/net_nfc_util_sign_record.c b/src/commonlib/net_nfc_util_sign_record.c
new file mode 100644 (file)
index 0000000..0b69794
--- /dev/null
@@ -0,0 +1,378 @@
+/*\r
+  * Copyright 2012  Samsung Electronics Co., Ltd\r
+  *\r
+  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license\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
+#include <sys/param.h>\r
+\r
+#include "net_nfc_debug_private.h"\r
+#include "net_nfc_util_defines.h"\r
+#include "net_nfc_util_private.h"\r
+#include "net_nfc_util_ndef_parser.h"\r
+#include "net_nfc_util_ndef_message.h"\r
+#include "net_nfc_util_ndef_record.h"\r
+#include "net_nfc_util_openssl_private.h"\r
+#include "net_nfc_util_sign_record.h"\r
+\r
+#define IS_SIGN_RECORD(__x) \\r
+       (((__x)->TNF == NET_NFC_RECORD_WELL_KNOWN_TYPE) && \\r
+       ((__x)->type_s.length == 3) && \\r
+       (memcmp((__x)->type_s.buffer, "Sig", 3) == 0))\r
+\r
+#define IS_EMPTY_RECORD(__x) \\r
+       ((__x->TNF == NET_NFC_RECORD_EMPTY))\r
+\r
+#define __FILL_SUB_FIELD(__dst, __buf, __len) \\r
+       (__dst)->length = (__len); \\r
+       memcpy((__dst)->value, (__buf), (__dst)->length);\r
+\r
+#define __NEXT_SUB_FIELD(__dst) ((__dst)->value + (__dst)->length)\r
+\r
+bool _get_records_data_buffer(ndef_record_s *begin_record, ndef_record_s *end_record, uint8_t **buffer, uint32_t *length)\r
+{\r
+       bool result = false;\r
+       uint32_t len = 0;\r
+       ndef_record_s *current_record = NULL;\r
+\r
+       if (begin_record == NULL || begin_record == end_record)\r
+               return result;\r
+\r
+       /* count total buffer length */\r
+       current_record = begin_record;\r
+       len = 0;\r
+\r
+       while (current_record != NULL && current_record != end_record)\r
+       {\r
+               /* type length */\r
+               if (current_record->type_s.buffer != NULL && current_record->type_s.length > 0)\r
+                       len += current_record->type_s.length;\r
+\r
+               /* ID length */\r
+               if (current_record->id_s.buffer != NULL && current_record->id_s.length > 0)\r
+                       len += current_record->id_s.length;\r
+\r
+               /* payload length */\r
+               if (current_record->payload_s.buffer != NULL && current_record->payload_s.length > 0)\r
+                       len += current_record->payload_s.length;\r
+\r
+               current_record = current_record->next;\r
+       }\r
+\r
+       if (len > 0)\r
+       {\r
+               uint8_t *buf = NULL;\r
+\r
+               _net_nfc_util_alloc_mem(buf, len);\r
+               if (buf != NULL)\r
+               {\r
+                       uint32_t offset = 0;\r
+\r
+                       current_record = begin_record;\r
+\r
+                       while (offset < len && current_record != NULL && current_record != end_record)\r
+                       {\r
+                               /* type length */\r
+                               if (current_record->type_s.buffer != NULL && current_record->type_s.length > 0)\r
+                               {\r
+                                       memcpy(buf + offset, current_record->type_s.buffer, MIN(current_record->type_s.length, len - offset));\r
+                                       offset += MIN(current_record->type_s.length, len - offset);\r
+                               }\r
+\r
+                               /* ID length */\r
+                               if (current_record->id_s.buffer != NULL && current_record->id_s.length > 0)\r
+                               {\r
+                                       memcpy(buf + offset, current_record->id_s.buffer, MIN(current_record->id_s.length, len - offset));\r
+                                       offset += MIN(current_record->id_s.length, len - offset);\r
+                               }\r
+\r
+                               /* payload length */\r
+                               if (current_record->payload_s.buffer != NULL && current_record->payload_s.length > 0)\r
+                               {\r
+                                       memcpy(buf + offset, current_record->payload_s.buffer, MIN(current_record->payload_s.length, len - offset));\r
+                                       offset += MIN(current_record->payload_s.length, len - offset);\r
+                               }\r
+\r
+                               current_record = current_record->next;\r
+                       }\r
+\r
+                       *buffer = buf;\r
+                       *length = offset;\r
+\r
+                       result = true;\r
+               }\r
+       }\r
+\r
+       return result;\r
+}\r
+\r
+net_nfc_error_e net_nfc_util_verify_signature_records(ndef_record_s *begin_record, ndef_record_s *sign_record)\r
+{\r
+       net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;\r
+       uint8_t *buffer = NULL;\r
+       uint32_t length = 0;\r
+\r
+       if (begin_record == NULL || sign_record == NULL || begin_record == sign_record)\r
+               return NET_NFC_INVALID_PARAM;\r
+\r
+       /* get signed data */\r
+       if (_get_records_data_buffer(begin_record, sign_record, &buffer, &length) == true)\r
+       {\r
+               uint8_t *signature = NULL;\r
+               uint32_t sign_len = 0;\r
+               net_nfc_signature_record_s *sign_info = NULL;\r
+               net_nfc_certificate_chain_s *chain_info = NULL;\r
+\r
+               /* parse signature info */\r
+               sign_info = (net_nfc_signature_record_s *)sign_record->payload_s.buffer;\r
+\r
+               DEBUG_MSG("record version : %d", sign_info->version);\r
+               DEBUG_MSG("signature URI present? : %s", sign_info->uri_present ? "true" : "false");\r
+               DEBUG_MSG("signature type : %d", sign_info->sign_type);\r
+               DEBUG_MSG("signature length : %d", sign_info->signature.length);\r
+\r
+               if (sign_info->uri_present == true)\r
+               {\r
+                       /* TODO */\r
+                       /* receive the signature data directed by uri */\r
+                       DEBUG_ERR_MSG("NOT IMPLEMENTED (sign_info->uri_present == true)");\r
+                       _net_nfc_util_free_mem(buffer);\r
+                       return result;\r
+               }\r
+               else\r
+               {\r
+                       signature = sign_info->signature.value;\r
+                       sign_len = sign_info->signature.length;\r
+               }\r
+\r
+               /* parse certificate chain info */\r
+               chain_info = (net_nfc_certificate_chain_s *)__NEXT_SUB_FIELD(&(sign_info->signature));\r
+\r
+               DEBUG_MSG("certificate URI present? : %s", chain_info->uri_present ? "true" : "false");\r
+               DEBUG_MSG("certificate format : %d", chain_info->cert_format);\r
+               DEBUG_MSG("number of certificates : %d", chain_info->num_of_certs);\r
+\r
+               if (chain_info->num_of_certs > 0)\r
+               {\r
+                       net_nfc_sub_field_s *data_info = NULL;\r
+\r
+                       data_info = (net_nfc_sub_field_s *)chain_info->cert_store;\r
+                       DEBUG_MSG("certficate length : %d", data_info->length);\r
+\r
+       //              DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);\r
+\r
+                       /* the first certificate is signer's one\r
+                        * verify signature of content */\r
+                       if (net_nfc_util_openssl_verify_signature(sign_info->sign_type, buffer, length, data_info->value, data_info->length, sign_info->signature.value, sign_info->signature.length) == true)\r
+                       {\r
+                               if (chain_info->num_of_certs > 1)\r
+                               {\r
+                                       int32_t i = 0;\r
+                                       net_nfc_openssl_verify_context_h context = NULL;\r
+\r
+                                       /* initialize context of verifying certificate */\r
+                                       context = net_nfc_util_openssl_init_verify_certificate();\r
+\r
+                                       /* add signer's certificate */\r
+                                       net_nfc_util_openssl_add_certificate_of_signer(context, data_info->value, data_info->length);\r
+\r
+                                       /* verify certificate using certificate chain */\r
+                                       for (i = 1, data_info = (net_nfc_sub_field_s *)__NEXT_SUB_FIELD(data_info);\r
+                                               i < chain_info->num_of_certs;\r
+                                               i++, data_info = (net_nfc_sub_field_s *)__NEXT_SUB_FIELD(data_info))\r
+                                       {\r
+                                               DEBUG_MSG("certficate length : %d", data_info->length);\r
+//                                             DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);\r
+\r
+                                               net_nfc_util_openssl_add_certificate_of_ca(context, data_info->value, data_info->length);\r
+                                       }\r
+\r
+                                       /* if the CA_Uri is present, continue adding certificate from uri */\r
+                                       if (chain_info->uri_present == true)\r
+                                       {\r
+                                               /* TODO */\r
+                                               DEBUG_ERR_MSG("NOT IMPLEMENTED (found_root == false && chain_info->uri_present == true)");\r
+                                               net_nfc_util_openssl_release_verify_certificate(context);\r
+                                               _net_nfc_util_free_mem(buffer);\r
+                                               return result;\r
+\r
+                                               DEBUG_MSG("certficate length : %d", data_info->length);\r
+//                                             DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);\r
+                                       }\r
+\r
+                                       /* verify buffer with cert chain and signature bytes */\r
+                                       if (net_nfc_util_openssl_verify_certificate(context) == true)\r
+                                               result = NET_NFC_OK;\r
+\r
+                                       net_nfc_util_openssl_release_verify_certificate(context);\r
+                               }\r
+                               else\r
+                               {\r
+                                       /* TODO : test certificate??? */\r
+                                       result = NET_NFC_OK;\r
+                               }\r
+\r
+                               DEBUG_MSG("verifying signature %d", result);\r
+                       }\r
+                       else\r
+                       {\r
+                               DEBUG_ERR_MSG("verifying signature failed");\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       DEBUG_ERR_MSG("certificate not found");\r
+               }\r
+\r
+               _net_nfc_util_free_mem(buffer);\r
+       }\r
+       else\r
+       {\r
+               DEBUG_ERR_MSG("_get_records_data_buffer failed");\r
+       }\r
+\r
+       return result;\r
+}\r
+\r
+net_nfc_error_e net_nfc_util_verify_signature_ndef_message(ndef_message_s *msg)\r
+{\r
+       net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;\r
+       ndef_record_s *begin_record = NULL;\r
+       ndef_record_s *current_record = NULL;\r
+\r
+       begin_record = msg->records;\r
+       current_record = msg->records;\r
+\r
+       while (current_record != NULL)\r
+       {\r
+               if (begin_record == NULL)\r
+               {\r
+                       begin_record = current_record;\r
+               }\r
+\r
+               if (IS_EMPTY_RECORD(current_record))\r
+               {\r
+                       begin_record = NULL;\r
+               }\r
+               else if (IS_SIGN_RECORD(current_record))\r
+               {\r
+                       result = net_nfc_util_verify_signature_records(begin_record, current_record);\r
+\r
+                       begin_record = NULL;\r
+               }\r
+\r
+               current_record = current_record->next;\r
+       }\r
+\r
+       return result;\r
+}\r
+\r
+/*\r
+ * sign method\r
+ */\r
+net_nfc_error_e net_nfc_util_sign_records(ndef_message_s *msg, int begin_index, int end_index, char *cert_file, char *password)\r
+{\r
+       net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;\r
+       ndef_record_s *begin_record = NULL, *end_record = NULL, *record = NULL;\r
+       data_s payload = { NULL, 0 };\r
+       uint8_t *data_buffer = NULL;\r
+       uint32_t data_len = 0;\r
+       uint8_t signature[1024] = { 0, };\r
+       uint32_t sign_len = sizeof(signature);\r
+       uint8_t *cert_buffer = NULL;\r
+       uint32_t cert_len = 0;\r
+       uint32_t cert_count = 0;\r
+\r
+       net_nfc_util_get_record_by_index(msg, begin_index, &begin_record);\r
+       net_nfc_util_get_record_by_index(msg, end_index, &end_record);\r
+\r
+       DEBUG_MSG("total record count : %d, begin_index : %d, end_index : %d", msg->recordCount, begin_index, end_index);\r
+\r
+       /* get target data */\r
+       _get_records_data_buffer(begin_record, end_record->next, &data_buffer, &data_len);\r
+\r
+       DEBUG_MSG_PRINT_BUFFER(data_buffer, data_len);\r
+\r
+       net_nfc_util_openssl_sign_buffer(NET_NFC_SIGN_TYPE_PKCS_1, data_buffer, data_len, cert_file, password, signature, &sign_len);\r
+\r
+       /* get cert chain */\r
+       net_nfc_util_get_cert_list_from_file(cert_file, password, &cert_buffer, &cert_len, &cert_count);\r
+\r
+       /* create payload */\r
+       payload.length = sizeof(net_nfc_signature_record_s) + sign_len + sizeof(net_nfc_certificate_chain_s) + cert_len;\r
+\r
+       _net_nfc_util_alloc_mem(payload.buffer, payload.length);\r
+\r
+       net_nfc_signature_record_s *sign_record = (net_nfc_signature_record_s *)payload.buffer;\r
+       sign_record->version = 1;\r
+       sign_record->uri_present = 0;\r
+       sign_record->sign_type = NET_NFC_SIGN_TYPE_PKCS_1;\r
+\r
+       if (sign_record->uri_present)\r
+       {\r
+               /* TODO */\r
+       }\r
+       else\r
+       {\r
+               __FILL_SUB_FIELD(&(sign_record->signature), signature, sign_len);\r
+       }\r
+\r
+       net_nfc_certificate_chain_s *chain = (net_nfc_certificate_chain_s *)__NEXT_SUB_FIELD(&(sign_record->signature));\r
+       if (cert_count < 16)\r
+       {\r
+               chain->uri_present = 0;\r
+       }\r
+       else\r
+       {\r
+               chain->uri_present = 1;\r
+       }\r
+\r
+       chain->cert_format = NET_NFC_CERT_FORMAT_X_509;\r
+       chain->num_of_certs = cert_count;\r
+       memcpy(chain->cert_store, cert_buffer, cert_len);\r
+\r
+       if (chain->uri_present)\r
+       {\r
+               /* TODO */\r
+               DEBUG_ERR_MSG("num_of_certs is greater than 15 [%d]", cert_count)\r
+       }\r
+\r
+       /* create record */\r
+       data_s type = { (uint8_t *)"Sig", 3 };\r
+\r
+       net_nfc_util_create_record(NET_NFC_RECORD_WELL_KNOWN_TYPE, &type, NULL, &payload, &record);\r
+\r
+       /* get last record index */\r
+       net_nfc_util_append_record_by_index(msg, end_index + 1, record);\r
+\r
+       _net_nfc_util_free_mem(payload.buffer);\r
+       _net_nfc_util_free_mem(cert_buffer);\r
+       _net_nfc_util_free_mem(data_buffer);\r
+\r
+       return result;\r
+}\r
+\r
+net_nfc_error_e net_nfc_util_sign_ndef_message(ndef_message_s *msg, char *cert_file, char *password)\r
+{\r
+       net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;\r
+\r
+       if (msg->recordCount > 0)\r
+       {\r
+               net_nfc_util_sign_records(msg, 0, msg->recordCount - 1, cert_file, password);\r
+\r
+               result = NET_NFC_OK;\r
+       }\r
+\r
+       return result;\r
+}\r
old mode 100644 (file)
new mode 100755 (executable)
index 5ba198c..5210c21
@@ -14,7 +14,7 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(manager_pkges REQUIRED aul glib-2.0 gobject-2.0 security-server dbus-glib-1 vconf dlog tapi appsvc libcurl bluetooth-api heynoti)
+pkg_check_modules(manager_pkges REQUIRED aul glib-2.0 gobject-2.0 security-server dbus-glib-1 vconf dlog tapi appsvc libcurl bluetooth-api heynoti smartcard-service smartcard-service-common libssl pmapi)
 
 FOREACH(flag ${manager_pkges_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
@@ -69,19 +69,7 @@ ADD_EXECUTABLE(${NFC_MANAGER_DAEMON} ${MANAGER_SRCS})
 TARGET_LINK_LIBRARIES(${NFC_MANAGER_DAEMON} ${manager_pkges_LDFLAGS} "-lpthread -lrt -pie -ldl" "-L${CMAKE_CURRENT_SOURCE_DIR}/../../cmake_tmp/src/commonlib/" "-lnfc-common-lib")
 #TARGET_LINK_LIBRARIES(${NFC_MANAGER_DAEMON} ${manager_pkges_LDFLAGS} "-L${CMAKE_CURRENT_SOURCE_DIR}/../../cmake_tmp/src/stack/" "-lnfc-stack")
 
-ADD_CUSTOM_TARGET(dbus_service_glue_private.h
-                COMMAND dbus-binding-tool --prefix=dbus_service ${CMAKE_CURRENT_SOURCE_DIR}/resource/dbus_service.xml
-               --mode=glib-server --output=${CMAKE_CURRENT_SOURCE_DIR}/include/dbus_service_glue_private.h
-                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/resource/dbus_service.xml
-)
-ADD_DEPENDENCIES(${NFC_MANAGER_DAEMON} dbus_service_glue_private.h)
-
-ADD_CUSTOM_TARGET(dbus_service_binding_private.h
-               COMMAND dbus-binding-tool --prefix=dbus_service ${CMAKE_CURRENT_SOURCE_DIR}/resource/dbus_service.xml
-               --mode=glib-client --output=${CMAKE_CURRENT_SOURCE_DIR}/include/dbus_service_binding_private.h
-                DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/resource/dbus_service.xml
-)
-ADD_DEPENDENCIES(${NFC_MANAGER_DAEMON} dbus_service_binding_private.h)
+
 
 INSTALL(TARGETS ${NFC_MANAGER_DAEMON} DESTINATION bin)
 
index 98e247d..0b9361a 100644 (file)
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef NET_NFC_APP_UTIL_H\r
 #define NET_NFC_APP_UTIL_H\r
 \r
@@ -31,5 +32,8 @@ void net_nfc_app_util_aul_launch_app(char* package_name, bundle* kb);
 void net_nfc_app_util_clean_storage(char* src_path);\r
 bool net_nfc_app_util_is_dir(const char* path_name);\r
 int net_nfc_app_util_appsvc_launch(const char *operation, const char *uri, const char *mime, const char *data);\r
+int net_nfc_app_util_launch_se_transaction_app(uint8_t *aid, uint32_t aid_len, uint8_t *param, uint32_t param_len);\r
+int net_nfc_app_util_encode_base64(uint8_t *buffer, uint32_t buf_len, char *result, uint32_t max_result);\r
+int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t *result, uint32_t *res_len);\r
 \r
 #endif\r
index 9f5af99..8f468b8 100644 (file)
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef NET_NFC_CONTROLLER_H\r
 #define NET_NFC_CONTROLLER_H\r
 \r
@@ -26,6 +27,7 @@ bool net_nfc_controller_init (net_nfc_error_e* result);
 bool net_nfc_controller_deinit (void);\r
 bool net_nfc_controller_register_listener(target_detection_listener_cb target_detection_listener, se_transaction_listener_cb se_transaction_listener, llcp_event_listener_cb llcp_event_listener, net_nfc_error_e* result);\r
 bool net_nfc_controller_unregister_listener(void);\r
+bool net_nfc_controller_get_firmware_version(data_s **data, net_nfc_error_e *result);\r
 bool net_nfc_controller_check_firmware_version(net_nfc_error_e* result);\r
 bool net_nfc_controller_update_firmware(net_nfc_error_e* result);\r
 bool net_nfc_controller_get_stack_information(net_nfc_stack_information_s* stack_info, net_nfc_error_e* result);\r
@@ -70,8 +72,13 @@ bool net_nfc_controller_llcp_get_remote_socket_info (net_nfc_target_handle_s* ha
 // LLCP API DEFINE\r
 \r
 bool net_nfc_controller_sim_test(net_nfc_error_e* result);\r
+bool net_nfc_controller_prbs_test(net_nfc_error_e* result , uint32_t tech , uint32_t rate);\r
+\r
 bool net_nfc_controller_test_mode_on(net_nfc_error_e* result);\r
 bool net_nfc_controller_test_mode_off(net_nfc_error_e* result);\r
 bool net_nfc_test_sim(void);\r
+\r
+bool net_nfc_controller_support_nfc(net_nfc_error_e* result);\r
+\r
 #endif\r
 \r
diff --git a/src/manager/include/net_nfc_dbus_service_obj_private.h b/src/manager/include/net_nfc_dbus_service_obj_private.h
deleted file mode 100644 (file)
index 6a18fa3..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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-object.h>
-
-typedef struct _Dbus_Service Dbus_Service;
-typedef struct _Dbus_ServiceClass Dbus_ServiceClass;
-
-#define DBUS_SERVICE_NAME "com.samsung.slp.nfc.manager"
-#define DBUS_SERVICE_PATH "/com/samsung/slp/nfc/manager"
-
-
-GType dbus_service_get_type (void);
-
-struct _Dbus_Service
-{
-  GObject parent;
-  int status;
-};
-
-struct _Dbus_ServiceClass
-{
-  GObjectClass parent;
-};
-
-#define DBUS_SERVICE_TYPE                              (dbus_service_get_type ())
-#define DBUS_SERVICE(object)                   (G_TYPE_CHECK_INSTANCE_CAST ((object), DBUS_SERVICE_TYPE, Dbus_Service))
-#define DBUS_SERVICE_CLASS(klass)              (G_TYPE_CHECK_CLASS_CAST ((klass), DBUS_SERVICE_TYPE, Dbus_Service_Class))
-#define IS_DBUS_SERVICE(object)                        (G_TYPE_CHECK_INSTANCE_TYPE ((object), DBUS_SERVICE_TYPE))
-#define IS_DBUS_SERVICE_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUS_SERVICE_TYPE))
-#define DBUS_SERVICE_GET_CLASS(obj)            (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUS_SERVICE_TYPE, Dbus_Service_Class))
-
-typedef enum
-{
-  DBUS_SERVICE_ERROR_INVALID_PRAM
-} Dbus_Service_Error;
-
-GQuark dbus_service_error_quark (void);
-#define DBUS_SERVICE_ERROR dbus_service_error_quark ()
-
-/**
- *     launch the nfc-manager
- */
-gboolean dbus_service_launch (Dbus_Service *dbus_service, guint *result_val, GError **error);
-
-gboolean dbus_service_se_only (Dbus_Service *dbus_service, guint *result_val, GError **error);
-
-gboolean dbus_service_terminate (Dbus_Service *dbus_service, guint *result_val, GError **error);
-
-
old mode 100644 (file)
new mode 100755 (executable)
index 819d217..d45c80e
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_MANAGER_UTIL_PRIVATE__\r
 #define __NET_NFC_MANAGER_UTIL_PRIVATE__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 76df0e0..6a801e7
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_SERVER_DISPATCHER__\r
 #define __NET_NFC_SERVER_DISPATCHER__\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 99539b1..69987a7
@@ -34,7 +34,7 @@ typedef struct net_nfc_server_info_t
        int server_sock_fd ;
        int client_sock_fd ; /* current client sock fd*/
 
-       server_state_e state;
+       uint32_t state;
 #ifdef BROADCAST_MESSAGE
        net_nfc_server_received_message_s* received_message;
 #endif
@@ -55,16 +55,18 @@ bool net_nfc_server_set_current_client_target_handle(int socket_fd, net_nfc_targ
 
 bool net_nfc_server_get_client_type(int socket, int* client_type);
 bool net_nfc_server_set_client_type(int socket, int type);
-bool net_nfc_server_set_server_state(server_state_e state);
-server_state_e net_nfc_server_get_server_state();
+bool net_nfc_server_set_server_state(uint32_t state);
+
+bool net_nfc_server_unset_server_state(uint32_t state);
+uint32_t net_nfc_server_get_server_state();
 
 bool _net_nfc_send_response_msg (int msg_type, ...);
 bool _net_nfc_check_client_handle ();
-server_state_e net_nfc_get_server_state();
 void net_nfc_server_set_tag_info(void * info);
 net_nfc_current_target_info_s* net_nfc_server_get_tag_info();
 void net_nfc_server_free_current_tag_info();
-
+void net_nfc_server_set_launch_state(int socket, bool enable);
+bool net_nfc_server_is_set_launch_state();
 
 #endif
 
old mode 100644 (file)
new mode 100755 (executable)
index 19b2f1c..6196e0c
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 #ifndef NET_NFC_SERVICE_LLCP_HANDOVER_PRVIATE_H_
 #define NET_NFC_SERVICE_LLCP_HANDOVER_PRVIATE_H_
 
old mode 100644 (file)
new mode 100755 (executable)
index d179326..ffd3c57
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef NET_NFC_SERVICE_LLCP_PRIVATE_H\r
 #define NET_NFC_SERVICE_LLCP_PRIVATE_H\r
 \r
index f05d28c..b2234a1 100644 (file)
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef NET_NFC_SERVICE_PRIVATE_H\r
 #define NET_NFC_SERVICE_PRIVATE_H\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index fbdfeaa..3c0b360
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef NET_NFC_SERVICE_SE_PRIVATE_H\r
 #define NET_NFC_SERVICE_SE_PRIVATE_H\r
 \r
 #include "net_nfc_typedef_private.h"\r
 \r
-typedef struct _se_setting_t{\r
-       net_nfc_target_handle_s* current_ese_handle;\r
-       void* open_request_trans_param;\r
-}se_setting_t;\r
+typedef struct _se_setting_t\r
+{\r
+       net_nfc_target_handle_s *current_ese_handle;\r
+       void *open_request_trans_param;\r
+}\r
+se_setting_t;\r
 \r
-void net_nfc_service_se_detected(net_nfc_request_msg_treq_msg);\r
+void net_nfc_service_se_detected(net_nfc_request_msg_t *req_msg);\r
 \r
 /* TAPI SIM API */\r
 \r
 bool net_nfc_service_tapi_init(void);\r
 void net_nfc_service_tapi_deinit(void);\r
-bool net_nfc_service_transfer_apdu(data_s* apdu, void* trans_param);\r
-bool net_nfc_service_request_atr(voidtrans_param);\r
+bool net_nfc_service_transfer_apdu(data_s *apdu, void *trans_param);\r
+bool net_nfc_service_request_atr(void *trans_param);\r
 \r
 #endif\r
old mode 100644 (file)
new mode 100755 (executable)
index 03c2679..257f17c
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef NET_NFC_SERVICE_TAG_PRIVATE_H\r
 #define NET_NFC_SERVICE_TAG_PRIVATE_H\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 4ab35d5..11bfbda
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef NET_NFC_SERVICE_VCONF_H\r
 #define NET_NFC_SERVICE_VCONF_H\r
 \r
   * limitations under the License.\r
   */\r
 \r
-#ifndef __NET_NFC_AGENT__\r
-#define __NET_NFC_AGENT__\r
 \r
+#ifndef NET_NFC_UTIL_ACCESS_CONTROL_PRIVATE_H\r
+#define NET_NFC_UTIL_ACCESS_CONTROL_PRIVATE_H\r
 \r
-int _net_nfc_launch_net_nfc_manager ();\r
-int _net_nfc_terminate_net_nfc_manager ();\r
-int _net_nfc_is_terminated ();\r
+#include "net_nfc_typedef_private.h"\r
 \r
+bool net_nfc_util_access_control_is_initialized(void);\r
+void net_nfc_util_access_control_initialize(void);\r
+void net_nfc_util_access_control_update_list(void);\r
+bool net_nfc_util_access_control_is_authorized_package(const char* pkg_name, uint8_t *aid, uint32_t length);\r
+void net_nfc_util_access_control_release(void);\r
 \r
 #endif\r
index bb1dd47..811b378 100644 (file)
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include <dirent.h>\r
 #include <pwd.h>\r
 #include <grp.h>\r
@@ -25,6 +26,9 @@
 #include <stdlib.h>\r
 #include <curl/curl.h>\r
 #include <glib.h>\r
+#include <openssl/evp.h>\r
+#include <openssl/bio.h>\r
+#include <openssl/buffer.h>\r
 \r
 #include "net_nfc_typedef.h"\r
 #include "net_nfc_typedef_private.h"\r
@@ -34,6 +38,7 @@
 #include "net_nfc_util_ndef_message.h"\r
 #include "net_nfc_manager_util_private.h"\r
 #include "net_nfc_app_util_private.h"\r
+#include "net_nfc_util_access_control_private.h"\r
 //#include "syspopup_caller.h"\r
 \r
 #include "appsvc.h"\r
@@ -73,6 +78,17 @@ static char *uri_scheme[] =
        "",\r
 };\r
 \r
+static const char *sbeam_mime_type[] =\r
+{\r
+       "text/DirectShareGallery",\r
+       "text/DirectShareMusic",\r
+       "text/DirectShareVideos",\r
+       "text/DirectShareFile",\r
+       "text/DirectSharePolarisViewer",\r
+       "text/DirectSharePolarisEditor",\r
+       "text/DirectShareDefault"\r
+};\r
+\r
 net_nfc_error_e net_nfc_app_util_process_ndef(data_s *data)\r
 {\r
        net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;\r
@@ -97,7 +113,7 @@ net_nfc_error_e net_nfc_app_util_process_ndef(data_s *data)
        }\r
 \r
        /* check state of launch popup */\r
-       if (vconf_get_bool(NET_NFC_DISABLE_LAUNCH_POPUP_KEY, &disable) == 0 && disable == TRUE)\r
+       if (vconf_get_bool(NET_NFC_DISABLE_LAUNCH_POPUP_KEY, &disable) == 0 && disable == FALSE)\r
        {\r
                DEBUG_MSG("skip launch popup");\r
                result = NET_NFC_OK;\r
@@ -258,11 +274,11 @@ net_nfc_error_e net_nfc_app_util_store_ndef_message(data_s *data)
 \r
                if ((length = fwrite(data->buffer, 1, data->length, fp)) > 0)\r
                {\r
-                       DEBUG_MSG("[%d] bytes is written \n", length);\r
+                       DEBUG_MSG("[%d] bytes is written", length);\r
                }\r
                else\r
                {\r
-                       DEBUG_MSG("write is failed = [%d] \n", data->length);\r
+                       DEBUG_MSG("write is failed = [%d]", data->length);\r
                }\r
 \r
                _net_nfc_app_util_change_file_owner_permission(fp);\r
@@ -336,6 +352,31 @@ void net_nfc_app_util_clean_storage(char* src_path)
        rmdir(src_path);\r
 }\r
 \r
+static bool __check_is_sbeam_record(ndef_record_s *record)\r
+{\r
+       bool result = FALSE;\r
+       data_s type_s = record->type_s;\r
+       int index = 0;\r
+\r
+       if (type_s.buffer == NULL || type_s.length == 0)\r
+       {\r
+               return result;\r
+       }\r
+\r
+       DEBUG_MSG("type_s.buffer [%s]", type_s.buffer);\r
+\r
+       while (strlen(sbeam_mime_type[index]) > 0)\r
+       {\r
+               if (strncasecmp(type_s.buffer, sbeam_mime_type[index], strlen(sbeam_mime_type[index])) == 0)\r
+               {\r
+                       return TRUE;\r
+               }\r
+               index++;\r
+       }\r
+\r
+       return result;\r
+}\r
+\r
 static bool _net_nfc_app_util_get_operation_from_record(ndef_record_s *record, char *operation, size_t length)\r
 {\r
        bool result = FALSE;\r
@@ -352,7 +393,12 @@ static bool _net_nfc_app_util_get_operation_from_record(ndef_record_s *record, c
                op_text = "http://tizen.org/appsvc/operation/nfc_well_known_type";\r
                break;\r
        case NET_NFC_RECORD_MIME_TYPE :\r
-               op_text = "http://tizen.org/appsvc/operation/nfc_mime_type";\r
+       {\r
+               if (__check_is_sbeam_record(record))\r
+                       op_text = "http://tizen.org/appsvc/operation/nfc_sbeam_receive";\r
+               else\r
+                       op_text = "http://tizen.org/appsvc/operation/nfc_mime_type";\r
+       }\r
                break;\r
        case NET_NFC_RECORD_URI : /* Absolute URI */\r
                op_text = "http://tizen.org/appsvc/operation/nfc_uri_type";\r
@@ -476,19 +522,22 @@ static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s *record, char *
                        int index = 0;\r
                        char scheme[100] = {0, };\r
 \r
-                       if (record->payload_s.buffer == NULL || record->payload_s.length == 0)\r
+                       DEBUG_MSG("record->type_s.length [%d]" , record->type_s.length);\r
+                       DEBUG_MSG("record->type_s.buffer [%s]" , record->type_s.buffer);\r
+\r
+                       if (record->type_s.buffer == NULL || record->type_s.length == 0)\r
                        {\r
                                DEBUG_ERR_MSG("Broken NDEF Message [NET_NFC_RECORD_URI]");\r
                                break;\r
                        }\r
 \r
-                       _net_nfc_manager_util_alloc_mem(buffer, record->payload_s.length + 1);\r
+                       _net_nfc_manager_util_alloc_mem(buffer, record->type_s.length + 1);\r
                        if (buffer == NULL)\r
                        {\r
                                DEBUG_ERR_MSG("_net_nfc_manager_util_alloc_mem return NULL");\r
                                break;\r
                        }\r
-                       memcpy(buffer, record->payload_s.buffer, record->payload_s.length);\r
+                       memcpy(buffer, record->type_s.buffer, record->type_s.length);\r
 \r
                        while (strlen(uri_scheme[index]) > 0)\r
                        {\r
@@ -498,6 +547,7 @@ static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s *record, char *
 \r
                                        memcpy(scheme, uri_scheme[index], scheme_len);\r
                                        scheme[scheme_len] = '\0';\r
+                                       DEBUG_MSG("uri scheme = [%s]" ,buffer );\r
                                        break;\r
                                }\r
                                index++;\r
@@ -511,32 +561,11 @@ static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s *record, char *
                                scheme[scheme_len] = '\0';\r
                        }\r
 \r
-                       DEBUG_MSG("mime not end [%s]", mime);\r
-                       _net_nfc_manager_util_free_mem(buffer);\r
-\r
-                       /* percent encode uri */\r
-                       curl_handle = curl_easy_init();\r
-                       if (curl_handle == NULL)\r
-                       {\r
-                               DEBUG_ERR_MSG("curl_easy_init return NULL");\r
-                               break;\r
-                       }\r
-\r
-                       buffer = curl_easy_escape(curl_handle, (char *)record->payload_s.buffer, record->payload_s.length);\r
-                       if (buffer == NULL)\r
-                       {\r
-                               DEBUG_ERR_MSG("curl_easy_escape return NULL");\r
-                               curl_easy_cleanup(curl_handle);\r
-                               break;\r
-                       }\r
-                       DEBUG_MSG("curl_easy_escape result [%s]", buffer);\r
-\r
                        snprintf(mime, length, "%s/%s", scheme, buffer);\r
                        DEBUG_MSG("mime [%s]", mime);\r
 \r
-                       /* release curl */\r
-                       curl_free(buffer);\r
-                       curl_easy_cleanup(curl_handle);\r
+                       DEBUG_MSG("mime not end [%s]", mime);\r
+                       _net_nfc_manager_util_free_mem(buffer);\r
 \r
                        result = TRUE;\r
                }\r
@@ -595,7 +624,7 @@ static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s *record, char *
                                break;\r
                        }\r
 \r
-                       buffer = curl_easy_escape(curl_handle, (char *)record->payload_s.buffer, record->payload_s.length);\r
+                       buffer = curl_easy_escape(curl_handle, (char *)record->type_s.buffer, record->type_s.length);\r
                        if (buffer == NULL)\r
                        {\r
                                DEBUG_ERR_MSG("curl_easy_escape return NULL");\r
@@ -747,3 +776,146 @@ int net_nfc_app_util_appsvc_launch(const char *operation, const char *uri, const
 \r
        return result;\r
 }\r
+\r
+static int _pkglist_iter_fn(const char* pkg_name, void *data)\r
+{\r
+       int result = 0;\r
+       const char *aid_string = NULL;\r
+       uint8_t aid[1024] = { 0, };\r
+       uint32_t length = sizeof(aid);\r
+\r
+       aid_string = appsvc_get_uri((bundle *)data);\r
+       DEBUG_MSG("package name : %s, aid_string : %s", pkg_name, aid_string);\r
+\r
+       /* convert aid string to aid */\r
+       net_nfc_app_util_decode_base64(aid_string, strlen(aid_string), aid, &length);\r
+\r
+       if (net_nfc_util_access_control_is_authorized_package(pkg_name, aid, length) == true)\r
+       {\r
+               DEBUG_MSG("allowed package : %s", pkg_name);\r
+\r
+               /* launch */\r
+               aul_launch_app(pkg_name, (bundle *)data);\r
+\r
+               result = 1; /* break iterator */\r
+       }\r
+       else\r
+       {\r
+               DEBUG_MSG("not allowed package : %s", pkg_name);\r
+       }\r
+\r
+       return result;\r
+}\r
+\r
+gboolean _invoke_get_list(gpointer data)\r
+{\r
+       bundle *bd = (bundle *)data;\r
+\r
+       appsvc_get_list(bd, _pkglist_iter_fn, (bundle *)bd);\r
+\r
+       bundle_free(bd);\r
+\r
+       return 0;\r
+}\r
+\r
+int net_nfc_app_util_launch_se_transaction_app(uint8_t *aid, uint32_t aid_len, uint8_t *param, uint32_t param_len)\r
+{\r
+       char aid_string[1024] = { 0, };\r
+       char param_string[1024] = { 0, };\r
+       bundle *bd = NULL;\r
+\r
+       /* initialize and make list */\r
+       if (net_nfc_util_access_control_is_initialized() == false)\r
+       {\r
+               net_nfc_util_access_control_initialize();\r
+       }\r
+\r
+       net_nfc_util_access_control_update_list();\r
+\r
+       /* convert aid to aid string */\r
+       net_nfc_app_util_encode_base64(aid, aid_len, aid_string, sizeof(aid_string));\r
+       DEBUG_MSG("aid_string : %s", aid_string);\r
+\r
+       net_nfc_app_util_encode_base64(param, param_len, param_string, sizeof(param_string));\r
+       DEBUG_MSG("param_string : %s", param_string);\r
+\r
+       /* launch */\r
+       bd = bundle_create();\r
+\r
+       appsvc_set_operation(bd, "http://tizen.org/appsvc/operation/nfc_se_transaction");\r
+       appsvc_set_uri(bd, aid_string);\r
+       appsvc_add_data(bd, "data", param_string);\r
+\r
+       g_idle_add((GSourceFunc)_invoke_get_list, (gpointer)bd);\r
+\r
+       return 0;\r
+}\r
+\r
+int net_nfc_app_util_encode_base64(uint8_t *buffer, uint32_t buf_len, char *result, uint32_t max_result)\r
+{\r
+       int ret = -1;\r
+       BUF_MEM *bptr;\r
+       BIO *b64, *bmem;\r
+\r
+       if (buffer == NULL || buf_len == 0 || result == NULL || max_result == 0)\r
+               return ret;\r
+\r
+       /* base 64 */\r
+       b64 = BIO_new(BIO_f_base64());\r
+       BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);\r
+       bmem = BIO_new(BIO_s_mem());\r
+       b64 = BIO_push(b64, bmem);\r
+\r
+       BIO_write(b64, buffer, buf_len);\r
+       BIO_flush(b64);\r
+       BIO_get_mem_ptr(b64, &bptr);\r
+\r
+       memset(result, 0, max_result);\r
+       memcpy(result, bptr->data, MIN(bptr->length, max_result - 1));\r
+\r
+       BIO_free_all(b64);\r
+\r
+       ret = 0;\r
+\r
+       return ret;\r
+}\r
+\r
+int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t *result, uint32_t *res_len)\r
+{\r
+       int ret = -1;\r
+       char *temp = NULL;\r
+\r
+       if (buffer == NULL || buf_len == 0 || result == NULL || res_len == NULL || *res_len == 0)\r
+               return ret;\r
+\r
+       _net_nfc_manager_util_alloc_mem(temp, buf_len);\r
+       if (temp != NULL)\r
+       {\r
+               BIO *b64, *bmem;\r
+               uint32_t temp_len;\r
+\r
+               b64 = BIO_new(BIO_f_base64());\r
+               BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);\r
+               bmem = BIO_new_mem_buf((void *)buffer, buf_len);\r
+               bmem = BIO_push(b64, bmem);\r
+\r
+               temp_len = BIO_read(bmem, temp, buf_len);\r
+\r
+               BIO_free_all(bmem);\r
+\r
+               memset(result, 0, *res_len);\r
+               memcpy(result, temp, MIN(temp_len, *res_len));\r
+\r
+               *res_len = MIN(temp_len, *res_len);\r
+\r
+               _net_nfc_manager_util_free_mem(temp);\r
+\r
+               ret = 0;\r
+       }\r
+       else\r
+       {\r
+               DEBUG_ERR_MSG("alloc failed");\r
+       }\r
+\r
+       return ret;\r
+}\r
old mode 100644 (file)
new mode 100755 (executable)
index b7ebd64..a40592e
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include <stdio.h>\r
 #include <dlfcn.h>\r
 #include <unistd.h>\r
@@ -25,6 +26,8 @@
 #include "net_nfc_server_ipc_private.h"\r
 #include "net_nfc_server_dispatcher_private.h"\r
 \r
+#include <pmapi.h>/*for pm lock*/\r
+\r
 #define NET_NFC_OEM_LIBRARY_PATH "/usr/lib/libnfc-plugin.so"\r
 \r
 static net_nfc_oem_interface_s g_interface;\r
@@ -65,12 +68,12 @@ void* net_nfc_controller_onload()
                        DEBUG_SERVER_MSG("temp[%d]'s value = %s\n" ,i ,  token_cpuinfo[i]);\r
                }\r
 \r
-               revision = atoi(token_cpuinfo[3]);\r
+               revision = strtol(token_cpuinfo[3] , 0 , 16);\r
                DEBUG_SERVER_MSG("revision = %d\n" , revision );\r
 \r
-               if(!(strncmp(token_cpuinfo[1] , "SLP_PQ" , 6)) && (revision >= 7))\r
+               if((!(strncmp(token_cpuinfo[1] , "SLP_PQ" , 6)) && (revision >= 7))|| !(strncmp(token_cpuinfo[1] , "REDWOOD" , 7)))\r
                {\r
-                       DEBUG_SERVER_MSG("It's SLP_PQ && Revision 7!!\n");\r
+                       DEBUG_SERVER_MSG("It's SLP_PQ && Revision 7!! || REDWOOD revC.\n");\r
                        library_path = "/usr/lib/libnfc-plugin-65nxp.so";\r
 \r
                }\r
@@ -186,6 +189,20 @@ bool net_nfc_controller_unregister_listener()
        }\r
 }\r
 \r
+bool net_nfc_controller_get_firmware_version(data_s **data, net_nfc_error_e *result)\r
+{\r
+       if (g_interface.get_firmware_version != NULL)\r
+       {\r
+               return g_interface.get_firmware_version(data, result);\r
+       }\r
+       else\r
+       {\r
+               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;\r
+               DEBUG_SERVER_MSG("interface is null");\r
+               return false;\r
+       }\r
+}\r
+\r
 bool net_nfc_controller_check_firmware_version(net_nfc_error_e* result)\r
 {\r
        if(g_interface.check_firmware_version != NULL)\r
@@ -286,6 +303,12 @@ bool net_nfc_controller_check_target_presence(net_nfc_target_handle_s* handle, n
 \r
 bool net_nfc_controller_connect(net_nfc_target_handle_s* handle, net_nfc_error_e* result)\r
 {\r
+       int ret_val = 0;\r
+\r
+       ret_val = pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW, 0);\r
+\r
+       DEBUG_SERVER_MSG("net_nfc_controller_connect pm_lock_state [%d]!!" , ret_val);\r
+\r
        if(g_interface.connect != NULL)\r
        {\r
                return g_interface.connect(handle, result);\r
@@ -300,6 +323,12 @@ bool net_nfc_controller_connect(net_nfc_target_handle_s* handle, net_nfc_error_e
 \r
 bool net_nfc_controller_disconnect(net_nfc_target_handle_s* handle, net_nfc_error_e* result)\r
 {\r
+       int ret_val = 0;\r
+\r
+       ret_val = pm_unlock_state(LCD_NORMAL, PM_RESET_TIMER);\r
+\r
+       DEBUG_ERR_MSG("net_nfc_controller_disconnect pm_lock_state [%d]!!" , ret_val);\r
+\r
        if(g_interface.disconnect != NULL)\r
        {\r
                net_nfc_server_free_current_tag_info();\r
@@ -531,6 +560,12 @@ bool net_nfc_controller_llcp_reject(net_nfc_target_handle_s* handle, net_nfc_llc
 \r
 bool net_nfc_controller_llcp_connect_by_url(net_nfc_target_handle_s * handle, net_nfc_llcp_socket_t socket, uint8_t* service_access_name, net_nfc_error_e* result, void * user_param)\r
 {\r
+       int ret_val = 0;\r
+\r
+       ret_val = pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW, 0);\r
+\r
+       DEBUG_SERVER_MSG("net_nfc_controller_llcp_connect_by_url pm_lock_state [%d]!!" , ret_val);\r
+\r
        if(g_interface.connect_llcp_by_url != NULL)\r
        {\r
                return g_interface.connect_llcp_by_url(handle, socket, service_access_name, result, user_param);\r
@@ -544,6 +579,12 @@ bool net_nfc_controller_llcp_connect_by_url(net_nfc_target_handle_s * handle, ne
 }\r
 bool net_nfc_controller_llcp_connect(net_nfc_target_handle_s* handle, net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e* result, void * user_param)\r
 {\r
+       int ret_val = 0;\r
+\r
+       ret_val = pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW, 0);\r
+\r
+       DEBUG_SERVER_MSG("net_nfc_controller_llcp_connect pm_lock_state [%d]!!" , ret_val);\r
+\r
        if(g_interface.connect_llcp != NULL)\r
        {\r
                return g_interface.connect_llcp(handle, socket, service_access_point, result, user_param);\r
@@ -557,6 +598,12 @@ bool net_nfc_controller_llcp_connect(net_nfc_target_handle_s* handle, net_nfc_ll
 }\r
 bool net_nfc_controller_llcp_disconnect(net_nfc_target_handle_s* handle, net_nfc_llcp_socket_t socket, net_nfc_error_e* result, void * user_param)\r
 {\r
+       int ret_val = 0;\r
+\r
+       ret_val = pm_unlock_state(LCD_NORMAL, PM_RESET_TIMER);\r
+\r
+       DEBUG_SERVER_MSG("net_nfc_controller_llcp_disconnect pm_lock_state [%d]!!" , ret_val);\r
+\r
        if(g_interface.disconnect_llcp != NULL)\r
        {\r
                return g_interface.disconnect_llcp(handle, socket, result ,user_param);\r
@@ -676,6 +723,21 @@ bool net_nfc_controller_sim_test(net_nfc_error_e* result)
        }\r
 }\r
 \r
+bool net_nfc_controller_prbs_test(net_nfc_error_e* result ,uint32_t tech , uint32_t rate )\r
+{\r
+       if(g_interface.prbs_test!= NULL)\r
+       {\r
+               return g_interface.prbs_test(result , tech , rate);\r
+       }\r
+       else\r
+       {\r
+               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;\r
+               DEBUG_SERVER_MSG("interface is null");\r
+               return false;\r
+       }\r
+}\r
+\r
+\r
 bool net_nfc_controller_test_mode_on(net_nfc_error_e* result)\r
 {\r
        if(g_interface.test_mode_on!= NULL)\r
@@ -704,3 +766,16 @@ bool net_nfc_controller_test_mode_off(net_nfc_error_e* result)
        }\r
 }\r
 \r
+bool net_nfc_controller_support_nfc(net_nfc_error_e* result)\r
+{\r
+       if(g_interface.support_nfc != NULL)\r
+       {\r
+               return g_interface.support_nfc(result);\r
+       }\r
+       else\r
+       {\r
+               *result = NET_NFC_DEVICE_DOES_NOT_SUPPORT_NFC;\r
+               DEBUG_SERVER_MSG("interface is null");\r
+               return false;\r
+       }\r
+}\r
diff --git a/src/manager/net_nfc_dbus_service_obj.c b/src/manager/net_nfc_dbus_service_obj.c
deleted file mode 100644 (file)
index 450a271..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-  * Copyright 2012  Samsung Electronics Co., Ltd
-  *
-  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
-  *
-  * 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 <stdlib.h>
-#include <glib-object.h>
-#include <dbus/dbus-glib-bindings.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <pthread.h>
-
-#include "net_nfc_typedef_private.h"
-#include "net_nfc_debug_private.h"
-#include "net_nfc_controller_private.h"
-#include "net_nfc_server_dispatcher_private.h"
-#include "net_nfc_manager_util_private.h"
-#include "net_nfc_dbus_service_obj_private.h"
-#include "dbus_service_glue_private.h"
-
-G_DEFINE_TYPE(Dbus_Service, dbus_service, G_TYPE_OBJECT)
-
-/* Just Check the assert  and set the error message */
-#define __G_ASSERT(test, return_val, error, domain, error_code)\
-G_STMT_START\
-{\
-       if G_LIKELY (!(test)) { \
-               g_set_error (error, domain, error_code, #test); \
-               return (return_val); \
-       }\
-}\
-G_STMT_END
-
-GQuark dbus_service_error_quark(void)
-{
-       return g_quark_from_static_string("dbus_service_error");
-}
-
-static void dbus_service_init(Dbus_Service *dbus_service)
-{
-}
-
-static void dbus_service_class_init(Dbus_ServiceClass *dbus_service_class)
-{
-       dbus_g_object_type_install_info(DBUS_SERVICE_TYPE, &dbus_glib_dbus_service_object_info);
-}
-
-gboolean dbus_service_launch(Dbus_Service *dbus_service, guint *result_val, GError **error)
-{
-       return TRUE;
-}
-
-gboolean dbus_service_se_only(Dbus_Service *dbus_service, guint *result_val, GError **error)
-{
-       net_nfc_request_terminate_t *term = NULL;
-
-       DEBUG_SERVER_MSG("dbus_service_se_only is called ..\n");
-
-       *result_val = NET_NFC_OK;
-
-       _net_nfc_manager_util_alloc_mem(term, sizeof(net_nfc_request_terminate_t));
-       if (term != NULL)
-       {
-               term->length = sizeof(net_nfc_request_terminate_t);
-               term->request_type = NET_NFC_MESSAGE_SERVICE_TERMINATION;
-               term->handle = NULL;
-               term->object = dbus_service;
-
-               net_nfc_dispatcher_queue_push((net_nfc_request_msg_t *)term);
-       }
-
-       return TRUE;
-}
-
-gboolean dbus_service_terminate(Dbus_Service *dbus_service, guint *result_val, GError **error)
-{
-       net_nfc_controller_deinit();
-
-       DEBUG_SERVER_MSG("service terminated");
-
-       exit(0);
-
-       return TRUE;
-}
old mode 100644 (file)
new mode 100755 (executable)
index 5d12c6d..6655b50
   */
 
 #include <glib.h>
+#include <pthread.h>
 #include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-bindings.h>
+//#include <dbus/dbus-glib-bindings.h>
+#include <sys/utsname.h>
 
 
+#include "heynoti.h"
+#include "vconf.h"
+
 #include "net_nfc_server_ipc_private.h"
 #include "net_nfc_debug_private.h"
 #include "net_nfc_service_private.h"
 #include "net_nfc_typedef_private.h"
 #include "net_nfc_service_vconf_private.h"
 #include "net_nfc_app_util_private.h"
-#include "net_nfc_dbus_service_obj_private.h"
 #include "net_nfc_controller_private.h"
 #include "net_nfc_util_private.h"
-
 #include "net_nfc_util_defines.h"
-#include "heynoti.h"
-#include "vconf.h"
+#include "net_nfc_server_dispatcher_private.h"
 
-GMainLooploop = NULL;
+GMainLoop *loop = NULL;
 
-bool __net_nfc_intialize_dbus_connection ();
 void __net_nfc_discovery_polling_cb(int signo);
+bool Check_Redwood();
+
 
 int main()
 {
+       int result = 0;
+       void *handle = NULL;
+       /*+REDWOOD+*/
+       bool ret = false;
+       /*-REDWOOD-*/
 
        DEBUG_SERVER_MSG("start nfc manager");
 
@@ -50,40 +58,59 @@ int main()
                g_thread_init(NULL);
        }
 
-       dbus_g_thread_init();
-
        g_type_init();
 
-       void* handle = NULL;
-
        handle = net_nfc_controller_onload();
-
        if(handle == NULL)
        {
                DEBUG_SERVER_MSG("load plugin library is failed");
                return 0;
        }
 
-       if(net_nfc_server_ipc_initialize() != true)
+       if (net_nfc_controller_support_nfc(&result) == true)
        {
-               DEBUG_ERR_MSG("nfc server ipc initialization is failed \n");
-               return 0;
-       }
+               DEBUG_SERVER_MSG("NFC Support");
 
+               /*+REDWOOD+*/
+               ret = Check_Redwood();
+               if(ret == true)
+               {
+                       DEBUG_ERR_MSG("NFC doesn't support");
 
-       DEBUG_SERVER_MSG("nfc server ipc init is ok \n");
-
+                       vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_OFF);
+                       vconf_set_bool(VCONFKEY_NFC_STATE, FALSE);
 
-       if (__net_nfc_intialize_dbus_connection ())
-       {
-               DEBUG_SERVER_MSG("Registering DBUS is OK! \n");
+                       net_nfc_controller_unload(handle);
+               }
+               else
+               {
+               vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_ON);
+       }
+               /*-REDWOOD-*/
        }
        else
        {
-               DEBUG_SERVER_MSG("Registering DBUS is FAILED !!!\n");
+               DEBUG_ERR_MSG("NFC doesn't support");
+
+               vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_OFF);
+               vconf_set_bool(VCONFKEY_NFC_STATE, FALSE);
+
+               net_nfc_controller_unload(handle);
+
+               //return(0);
        }
 
-       int result = 0;
+       if(net_nfc_server_ipc_initialize() != true)
+       {
+               DEBUG_ERR_MSG("nfc server ipc initialization is failed \n");
+
+               net_nfc_controller_unload(handle);
+
+               return 0;
+       }
+
+       DEBUG_SERVER_MSG("nfc server ipc init is ok \n");
+
        int fd = 0;
 
        fd = heynoti_init();
@@ -104,6 +131,8 @@ int main()
        if (result == -1)
                return 0;
 
+       net_nfc_service_vconf_register_notify_listener();
+
        loop = g_main_new(TRUE);
        g_main_loop_run(loop);
 
@@ -116,63 +145,66 @@ int main()
 
 void __net_nfc_discovery_polling_cb(int signo)
 {
-       int status;
+       int state;
        net_nfc_error_e result;
 
-       DEBUG_MSG("__net_nfc_discovery_polling_cb[Enter]");
-
-       if(net_nfc_controller_confiure_discovery(NET_NFC_DISCOVERY_MODE_CONFIG, NET_NFC_ALL_ENABLE, &result) == true)
+       result = vconf_get_bool(VCONFKEY_NFC_STATE, &state);
+       if (result != 0)
        {
-               DEBUG_SERVER_MSG("someone wake-up the nfc-manager daemon. and it succeeds to restart the polling. ");
+               DEBUG_MSG("VCONFKEY_NFC_STATE is not exist: %d ", result);
        }
-       else
+
+       DEBUG_MSG("__net_nfc_discovery_polling_cb[Enter]");
+
+       if(state == TRUE)
        {
-               if (vconf_set_int(NET_NFC_VCONF_KEY_PROGRESS, result) != 0)
+               net_nfc_request_msg_t *req_msg = NULL;
+
+               _net_nfc_util_alloc_mem(req_msg, sizeof(net_nfc_request_msg_t));
+
+               if (req_msg == NULL)
                {
-                       DEBUG_ERR_MSG("vconf_set_int(NET_NFC_VCONF_KEY_PROGRESS, ERROR) != 0");
+                       DEBUG_MSG("_net_nfc_util_alloc_mem[NULL]");
+                       return false;
                }
-               exit(result);
+
+               req_msg->length = sizeof(net_nfc_request_msg_t);
+               req_msg->request_type = NET_NFC_MESSAGE_SERVICE_RESTART_POLLING_LOOP;
+
+               net_nfc_dispatcher_queue_push(req_msg);
+       }
+       else
+       {
+               DEBUG_SERVER_MSG("Don't need to wake up. NFC is OFF!!");
        }
 
        DEBUG_MSG("__net_nfc_discovery_polling_cb[Out]");
 }
 
-bool __net_nfc_intialize_dbus_connection ()
+bool Check_Redwood()
 {
+       struct utsname hwinfo;
 
-       GError *error = NULL;
-       DBusGProxy *proxy;
-       GObject *object = NULL;
-       guint32 name;
-       DBusGConnection *connection;
-
-       connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
-       if (connection == NULL) {
-               DEBUG_ERR_MSG ("DBUS: getting dbus connection is failed \n");
-               DEBUG_SERVER_MSG("DBUS: %s", error->message);
-               g_error_free (error);
-               return false;
-       }
-
-       object = g_object_new (DBUS_SERVICE_TYPE, NULL);
+       int ret = uname(&hwinfo);
+       DEBUG_MSG("uname returned %d",ret);
+       DEBUG_MSG("sysname::%s",hwinfo.sysname);
+       DEBUG_MSG("release::%s",hwinfo.release);
+       DEBUG_MSG("version::%s",hwinfo.version);
+       DEBUG_MSG("machine::%s",hwinfo.machine);
+       DEBUG_MSG("nodename::%s",hwinfo.nodename);
 
-       dbus_g_connection_register_g_object (connection, DBUS_SERVICE_PATH, object);
-
-       proxy = dbus_g_proxy_new_for_name (connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
+       if(strstr(hwinfo.nodename,"REDWOOD"))
+       {
+               DEBUG_MSG("REDWOOD harware");
+               return true;
 
-       /* Make sure getting name is correct version or not */
-       if (!org_freedesktop_DBus_request_name (proxy, DBUS_SERVICE_NAME, 0, &name, &error))
+       }
+       else
        {
-               DEBUG_ERR_MSG ("DBUS: getting dbus proxy is failed \n");
-               DEBUG_SERVER_MSG("DBUS: %s", error->message);
-               g_error_free (error);
+               DEBUG_MSG("except REDWOOD");
                return false;
        }
 
-       if (DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER != name)
-       {
-               DEBUG_SERVER_MSG ("Requested name is: %d", name);
-       }
-       return true;
 }
 
+
old mode 100644 (file)
new mode 100755 (executable)
index 10e80aa..3eb79d1
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include <stdlib.h>\r
 #include <string.h>\r
 \r
old mode 100644 (file)
new mode 100755 (executable)
index 9b520f2..63144c4
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include <stdlib.h>\r
 #include <string.h>\r
 #include <pthread.h>\r
@@ -33,9 +34,9 @@
 #include "net_nfc_service_llcp_private.h"\r
 #include "net_nfc_service_llcp_handover_private.h"\r
 #include "net_nfc_service_tag_private.h"\r
-#include "net_nfc_dbus_service_obj_private.h"\r
 #include "net_nfc_manager_util_private.h"\r
 #include "net_nfc_service_se_private.h"\r
+#include "net_nfc_util_access_control_private.h"\r
 \r
 static GQueue *g_dispatcher_queue;\r
 static pthread_cond_t g_dispatcher_queue_cond = PTHREAD_COND_INITIALIZER;\r
@@ -72,6 +73,7 @@ bool net_nfc_dispatcher_start_thread()
 {\r
        net_nfc_request_msg_t *req_msg = NULL;\r
        pthread_attr_t attr;\r
+       int result , state;\r
 \r
        DEBUG_SERVER_MSG("init queue");\r
 \r
@@ -84,10 +86,27 @@ bool net_nfc_dispatcher_start_thread()
        if (req_msg == NULL)\r
                return false;\r
 \r
-       req_msg->length = sizeof(net_nfc_request_msg_t);\r
-       req_msg->request_type = NET_NFC_MESSAGE_SERVICE_INIT;\r
+       result = vconf_get_bool(VCONFKEY_NFC_STATE, &state);\r
+       if (result != 0)\r
+       {\r
+               DEBUG_MSG("VCONFKEY_NFC_STATE is not exist: %d ", result);\r
+               return false;\r
+       }\r
+\r
+       DEBUG_MSG("net_nfc_dispatcher_start_thread vconf state value [%d]" , state);\r
+\r
+       if(state == TRUE)\r
+       {\r
 \r
-       net_nfc_dispatcher_queue_push(req_msg);\r
+               req_msg->length = sizeof(net_nfc_request_msg_t);\r
+               req_msg->request_type = NET_NFC_MESSAGE_SERVICE_INIT;\r
+\r
+               net_nfc_dispatcher_queue_push(req_msg);\r
+       }\r
+       else\r
+       {\r
+       /*Don't need to initialize the stack!!*/\r
+       }\r
 \r
        if(pthread_create(&g_dispatcher_thread, &attr, _net_nfc_dispatcher_thread_func, NULL) != 0)\r
        {\r
@@ -261,7 +280,7 @@ static void *_net_nfc_dispatcher_thread_func(void *data)
                                        }\r
 \r
 #ifdef BROADCAST_MESSAGE\r
-                                       net_nfc_server_set_server_state(NET_NFC_SERVER_IDLE);\r
+                                       net_nfc_server_unset_server_state(NET_NFC_SE_CONNECTED);\r
 #endif\r
                                        g_se_setting.current_ese_handle = NULL;\r
                                }\r
@@ -528,7 +547,7 @@ static void *_net_nfc_dispatcher_thread_func(void *data)
 \r
                                _net_nfc_send_response_msg(req_msg->request_type, (void *)&resp, sizeof(net_nfc_response_is_tag_connected_t), NULL);\r
                        }\r
-                       break;
+                       break;\r
 \r
                case NET_NFC_MESSAGE_GET_CURRENT_TAG_INFO:\r
                        {\r
@@ -546,8 +565,6 @@ static void *_net_nfc_dispatcher_thread_func(void *data)
                                        bool success = true;\r
                                        data_s* recv_data = NULL;\r
 \r
-                                       memset(&resp, 0x00, sizeof(net_nfc_response_get_current_tag_info_t));\r
-\r
                                        if(target_info->devType != NET_NFC_NFCIP1_TARGET  && target_info->devType != NET_NFC_NFCIP1_INITIATOR)\r
                                        {\r
 #ifdef BROADCAST_MESSAGE\r
@@ -654,7 +671,7 @@ static void *_net_nfc_dispatcher_thread_func(void *data)
                        {\r
                                net_nfc_response_get_server_state_t resp = { 0, };\r
 \r
-                               resp.state = net_nfc_get_server_state();\r
+                               resp.state = net_nfc_server_get_server_state();\r
                                resp.result = NET_NFC_OK;\r
 \r
                                _net_nfc_send_response_msg(req_msg->request_type, (void *)&resp, sizeof(net_nfc_response_get_server_state_t), NULL);\r
@@ -754,9 +771,111 @@ static void *_net_nfc_dispatcher_thread_func(void *data)
                        }\r
                        break;\r
 \r
+               case NET_NFC_MESSAGE_GET_FIRMWARE_VERSION :\r
+                       {\r
+                               net_nfc_response_get_firmware_version_t resp = { 0, };\r
+                               net_nfc_error_e result = NET_NFC_OK;\r
+                               data_s *data = NULL;\r
+\r
+                               resp.result = NET_NFC_OK;\r
+\r
+                               if (net_nfc_controller_get_firmware_version(&data, &resp.result) == true)\r
+                               {\r
+                                       DEBUG_SERVER_MSG("net_nfc_controller_update_firmware Result [SUCCESS]");\r
+\r
+                                       resp.data.length = data->length;\r
+                               }\r
+                               else\r
+                               {\r
+                                       DEBUG_ERR_MSG("net_nfc_controller_update_firmware Result [ERROR3]");\r
+                               }\r
+\r
+                               _net_nfc_send_response_msg(req_msg->request_type, (void *)&resp, sizeof(net_nfc_response_get_firmware_version_t), (void *)data->buffer, resp.data.length, NULL);\r
+\r
+                               net_nfc_util_free_data(data);\r
+                       }\r
+                       break;\r
+\r
+                       case NET_NFC_MESSAGE_PRBS_TEST:\r
+                               {\r
+                                       net_nfc_response_test_t resp = { 0, };\r
+                                       net_nfc_request_test_t *prbs_test = (net_nfc_request_test_t *)req_msg;\r
+                                       net_nfc_error_e result = NET_NFC_OK;\r
+                                       uint32_t local_tech = 0;\r
+                                       uint32_t local_rate = 0;\r
+\r
+                                       resp.result = NET_NFC_OK;\r
+                                       resp.trans_param = prbs_test->trans_param;\r
+\r
+                                       local_tech = prbs_test->tech;\r
+                                       local_rate = prbs_test->rate;\r
+\r
+                                       DEBUG_SERVER_MSG("NET_NFC_MESSAGE_PRBS_TEST local_tech [%d]\n" , local_tech );\r
+                                       DEBUG_SERVER_MSG("NET_NFC_MESSAGE_PRBS_TEST local_rate [%d]\n" , local_rate);\r
+\r
+                                       if (net_nfc_controller_prbs_test(&result , local_tech , local_rate) == true)\r
+                                       {\r
+                                               DEBUG_SERVER_MSG("net_nfc_controller_prbs_test Result [SUCCESS]");\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               resp.result = NET_NFC_UNKNOWN_ERROR;\r
+                                               DEBUG_SERVER_MSG("net_nfc_controller_prbs_test Result [ERROR3]");\r
+                                       }\r
+\r
+                               DEBUG_SERVER_MSG("SEND RESPONSE!!");\r
+                               _net_nfc_send_response_msg(req_msg->request_type, (void *)&resp, sizeof(net_nfc_response_test_t), NULL);\r
+                       }\r
+                       break;\r
+\r
                case NET_NFC_MESSAGE_SERVICE_DEINIT:\r
                        {\r
-                               net_nfc_controller_deinit();\r
+                               net_nfc_error_e result;\r
+\r
+                               /* release access control instance */\r
+                               net_nfc_util_access_control_release();\r
+\r
+                               net_nfc_server_free_current_tag_info();\r
+\r
+                               result = net_nfc_controller_deinit();\r
+\r
+                               if(result == TRUE)\r
+                               {\r
+                                               DEBUG_SERVER_MSG("net_nfc_controller_deinit success [%d]", result);\r
+\r
+                                               net_nfc_response_test_t resp = { 0 ,};\r
+\r
+                                               resp.result = NET_NFC_OK;\r
+                                               resp.trans_param = req_msg->user_param;\r
+\r
+\r
+                                               /*vconf off*/\r
+                                               if (vconf_set_bool(VCONFKEY_NFC_STATE, FALSE) != 0)\r
+                                               {\r
+                                                       DEBUG_ERR_MSG("vconf_set_bool failed");\r
+                                               }\r
+\r
+                                               if (_net_nfc_check_client_handle())\r
+                                               {\r
+                                                   _net_nfc_send_response_msg(req_msg->request_type, (void *)&resp, sizeof(net_nfc_response_test_t), NULL);\r
+                                               }\r
+\r
+\r
+                               }\r
+                               else\r
+                               {\r
+                                       DEBUG_SERVER_MSG("net_nfc_controller_deinit success [%d]", result);\r
+\r
+                                       net_nfc_response_test_t resp = { 0 ,};\r
+\r
+                                       resp.result = NET_NFC_UNKNOWN_ERROR;\r
+                                       resp.trans_param = req_msg->user_param;\r
+\r
+                                       if (_net_nfc_check_client_handle())\r
+                                       {\r
+                                           _net_nfc_send_response_msg(req_msg->request_type, (void *)&resp, sizeof(net_nfc_response_test_t), NULL);\r
+                                       }\r
+                               }\r
                        }\r
                        break;\r
 \r
@@ -768,30 +887,11 @@ static void *_net_nfc_dispatcher_thread_func(void *data)
                                {\r
                                        if(net_nfc_controller_register_listener(net_nfc_service_target_detected_cb, net_nfc_service_se_transaction_cb, net_nfc_service_llcp_event_cb, &result) == true)\r
                                        {\r
-                                               if(net_nfc_controller_confiure_discovery(NET_NFC_DISCOVERY_MODE_CONFIG, NET_NFC_ALL_ENABLE, &result) == true)\r
-                                               {\r
-                                                       DEBUG_SERVER_MSG("now, nfc is ready");\r
-                                               }\r
-                                               else\r
-                                               {\r
-                                                       DEBUG_ERR_MSG("net_nfc_controller_confiure_discovery failed [%d]", result);\r
-\r
-                                                       if (vconf_set_int(NET_NFC_VCONF_KEY_PROGRESS, result) != 0)\r
-                                                       {\r
-                                                               DEBUG_ERR_MSG("vconf_set_int(NET_NFC_VCONF_KEY_PROGRESS, ERROR) != 0");\r
-                                                       }\r
-                                                       exit(result);\r
-                                               }\r
+                                               DEBUG_SERVER_MSG("net_nfc_controller_register_listener Success!!");\r
                                        }\r
                                        else\r
                                        {\r
                                                DEBUG_ERR_MSG("net_nfc_controller_register_listener failed [%d]", result);\r
-\r
-                                               if (vconf_set_int(NET_NFC_VCONF_KEY_PROGRESS, result) != 0)\r
-                                               {\r
-                                                       DEBUG_ERR_MSG("vconf_set_int(NET_NFC_VCONF_KEY_PROGRESS, ERROR) != 0");\r
-                                               }\r
-                                               exit(result);\r
                                        }\r
 \r
                                        net_nfc_llcp_config_info_s config = {128, 1, 100, 0};\r
@@ -827,30 +927,59 @@ static void *_net_nfc_dispatcher_thread_func(void *data)
                                                DEBUG_SERVER_MSG("failed to set UICC as enable = [%d]", result);\r
                                        }\r
 \r
+                                       if(net_nfc_controller_confiure_discovery(NET_NFC_DISCOVERY_MODE_CONFIG, NET_NFC_ALL_ENABLE, &result) == true)\r
+                                       {\r
+                                               DEBUG_SERVER_MSG("now, nfc is ready");\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               DEBUG_ERR_MSG("net_nfc_controller_confiure_discovery failed [%d]", result);\r
+                                       }\r
+\r
                                        g_se_cur_type = SECURE_ELEMENT_TYPE_UICC;\r
                                        g_se_cur_mode = SECURE_ELEMENT_VIRTUAL_MODE;\r
                                        g_se_prev_type = SECURE_ELEMENT_TYPE_UICC;\r
                                        g_se_prev_mode = SECURE_ELEMENT_VIRTUAL_MODE;\r
 \r
-                                       if (vconf_set_int(NET_NFC_VCONF_KEY_PROGRESS, 0) != 0)\r
-                                       {\r
-                                               DEBUG_ERR_MSG("vconf_set_int(NET_NFC_VCONF_KEY_PROGRESS, SUCCESS) != 0");\r
-                                       }\r
-                                       else\r
+                                       /* initialize access control instance */\r
+                                       net_nfc_util_access_control_initialize();\r
+\r
+                                       /*Send the Init Success Response Msg*/\r
                                        {\r
-                                               DEBUG_SERVER_MSG("update vconf key NET_NFC_VCONF_KEY_PROGRESS [SUCCESS]");\r
+                                               DEBUG_SERVER_MSG("net_nfc_controller_init success [%d]", result);\r
+\r
+                                               net_nfc_response_test_t resp = { 0 ,};\r
+\r
+                                               resp.result = NET_NFC_OK;\r
+                                               resp.trans_param = req_msg->user_param;\r
+\r
+                                               /*vconf on*/\r
+                                               if (vconf_set_bool(VCONFKEY_NFC_STATE, TRUE) != 0)\r
+                                               {\r
+                                                       DEBUG_ERR_MSG("vconf_set_bool failed");\r
+                                               }\r
+\r
+                                               if (_net_nfc_check_client_handle())\r
+                                               {\r
+                                                       _net_nfc_send_response_msg(req_msg->request_type, (void *)&resp, sizeof(net_nfc_response_test_t), NULL);\r
+                                               }\r
+\r
+\r
                                        }\r
                                }\r
                                else\r
                                {\r
                                        DEBUG_ERR_MSG("net_nfc_controller_init failed [%d]", result);\r
 \r
-                                       if (vconf_set_int(NET_NFC_VCONF_KEY_PROGRESS, result) != 0)\r
+                                       net_nfc_response_test_t resp = { 0 ,};\r
+\r
+                                       resp.result = NET_NFC_UNKNOWN_ERROR;\r
+                                       resp.trans_param = req_msg->user_param;\r
+\r
+                                       if (_net_nfc_check_client_handle())\r
                                        {\r
-                                               DEBUG_ERR_MSG("vconf_set_int(NET_NFC_VCONF_KEY_PROGRESS, ERROR) != 0");\r
+                                               _net_nfc_send_response_msg(req_msg->request_type, (void *)&resp, sizeof(net_nfc_response_test_t), NULL);\r
                                        }\r
-                                       /*We have to considerate when initialization is failed.*/\r
-                                       exit(result);\r
                                }\r
                        }\r
                        break;\r
@@ -865,7 +994,8 @@ static void *_net_nfc_dispatcher_thread_func(void *data)
                        {\r
                                net_nfc_error_e result = NET_NFC_OK;\r
 \r
-                               if (net_nfc_controller_confiure_discovery(NET_NFC_DISCOVERY_MODE_RESUME, NET_NFC_ALL_ENABLE, &result) == true)\r
+                               //(net_nfc_controller_confiure_discovery(NET_NFC_DISCOVERY_MODE_RESUME, NET_NFC_ALL_ENABLE, &result) == true)\r
+                               if(net_nfc_controller_confiure_discovery(NET_NFC_DISCOVERY_MODE_CONFIG, NET_NFC_ALL_ENABLE, &result) == true)\r
                                {\r
                                        DEBUG_SERVER_MSG("now, nfc polling loop is running again");\r
                                }\r
@@ -1242,6 +1372,7 @@ static void *_net_nfc_dispatcher_thread_func(void *data)
                                resp.result = NET_NFC_IPC_FAIL;\r
                                if (detail != NULL)\r
                                {\r
+                                       DEBUG_SERVER_MSG("socket close :: NET_NFC_MESSAGE_SERVICE_LLCP_CLOSE");\r
                                        net_nfc_controller_llcp_socket_close(detail->oal_socket, &(resp.result));\r
 \r
                                        resp.client_socket = detail->client_socket;\r
old mode 100644 (file)
new mode 100755 (executable)
index 5c1f224..c4aaeca
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/socket.h>
@@ -37,6 +38,8 @@
 #include "net_nfc_controller_private.h"
 #include "net_nfc_manager_util_private.h"
 
+#include "vconf.h"
+
 #ifdef SECURITY_SERVER
 #include <security-server.h>
 #endif
@@ -51,6 +54,7 @@ typedef struct _net_nfc_client_info_t{
        client_state_e state;
        int client_type;
        //client_type_e client_type;
+       bool is_set_launch_popup;
        net_nfc_target_handle_s* target_handle;
 }net_nfc_client_info_t;
 
@@ -64,7 +68,7 @@ typedef struct _net_nfc_client_info_t{
 /* static variable */
 
 static net_nfc_server_info_t g_server_info = {0,};
-static net_nfc_client_info_t g_client_info[NET_NFC_CLIENT_MAX] = {{0, NULL, 0, NET_NFC_CLIENT_INACTIVE_STATE, 0, NULL},};
+static net_nfc_client_info_t g_client_info[NET_NFC_CLIENT_MAX] = {{0, NULL, 0, NET_NFC_CLIENT_INACTIVE_STATE, 0, FALSE, NULL},};
 
 #ifdef SECURITY_SERVER
 static char* cookies = NULL;
@@ -243,6 +247,9 @@ bool net_nfc_server_ipc_initialize()
 
        DEBUG_SERVER_MSG("server ipc is initialized");
 
+       if(vconf_set_bool(NET_NFC_DISABLE_LAUNCH_POPUP_KEY, TRUE) != 0)
+               DEBUG_ERR_MSG("SERVER : launch state set vconf fail");
+
        return true;
 ERROR:
        if(g_server_info.server_channel != NULL)
@@ -543,7 +550,8 @@ bool net_nfc_server_read_client_request(int client_sock_fd, net_nfc_error_e *res
        DEBUG_SERVER_MSG("message from client. request type = [%d]", req_msg->request_type);
 
 #ifdef BROADCAST_MESSAGE
-       if(req_msg->request_type != NET_NFC_MESSAGE_SERVICE_CHANGE_CLIENT_STATE)
+       if(req_msg->request_type != NET_NFC_MESSAGE_SERVICE_CHANGE_CLIENT_STATE &&
+               req_msg->request_type != NET_NFC_MESSAGE_SERVICE_SET_LAUNCH_STATE)
        {
                net_nfc_server_received_message_s* p = (net_nfc_server_received_message_s*)malloc(sizeof(net_nfc_server_received_message_s));
 
@@ -557,7 +565,7 @@ bool net_nfc_server_read_client_request(int client_sock_fd, net_nfc_error_e *res
        /* process exceptional case of request type */
        switch (req_msg->request_type)
        {
-       case NET_NFC_MESSAGE_SERVICE_CHANGE_CLIENT_STATE :
+               case NET_NFC_MESSAGE_SERVICE_CHANGE_CLIENT_STATE :
                {
                        net_nfc_request_change_client_state_t *detail = (net_nfc_request_change_client_state_t *)req_msg;
 
@@ -615,8 +623,16 @@ bool net_nfc_server_read_client_request(int client_sock_fd, net_nfc_error_e *res
                }
                break;
 
-       default :
+               case NET_NFC_MESSAGE_SERVICE_SET_LAUNCH_STATE :
+               {
+                       net_nfc_request_set_launch_state_t *detail = (net_nfc_request_set_launch_state_t *)req_msg;
+
+                       net_nfc_server_set_launch_state(client_sock_fd, detail->set_launch_popup);
+               }
                break;
+
+               default :
+                       break;
        }
 
 #ifdef SECURITY_SERVER
@@ -699,6 +715,9 @@ static bool net_nfc_server_cleanup_client_context(GIOChannel* channel)
 
                        g_server_info.connected_client_count--;
 
+                       if(vconf_set_bool(NET_NFC_DISABLE_LAUNCH_POPUP_KEY, net_nfc_server_is_set_launch_state()) != 0)
+                               DEBUG_ERR_MSG("SERVER :set launch vconf fail");
+
                        break;
                }
        }
@@ -733,6 +752,29 @@ bool net_nfc_server_send_message_to_client(void* message, int length)
                        leng = send(p1->client_fd, (void *)message, length, 0);
                        pthread_mutex_unlock(&g_server_socket_lock);
 
+
+
+                       if ((mes_type ==   NET_NFC_MESSAGE_SERVICE_INIT)||(mes_type ==   NET_NFC_MESSAGE_SERVICE_DEINIT))
+                       {
+
+                               for(i=0; i<NET_NFC_CLIENT_MAX; i++)
+                               {
+                                       if((g_client_info[i].socket)&&(g_client_info[i].socket !=p1->client_fd))
+                                       {
+                                               pthread_mutex_lock(&g_server_socket_lock);
+                                               leng = send(g_client_info[i].socket, (void *)message, length, 0);
+                                               pthread_mutex_unlock(&g_server_socket_lock);
+                                       }
+
+                                       if(leng <= 0)
+                                       {
+                                               DEBUG_ERR_MSG("failed to send message, socket = [%d], msg_length = [%d]", g_server_info.client_sock_fd, length);
+                                       }
+                               }
+
+                       }
+
+
                        if(p2 != NULL)
                        {
                                p2->next = p1->next;
@@ -971,6 +1013,7 @@ static bool net_nfc_server_add_client_context(int socket, GIOChannel* channel, u
                        g_client_info[i].channel = channel;
                        g_client_info[i].src_id = src_id;
                        g_client_info[i].state = state;
+                       g_client_info[i].is_set_launch_popup = TRUE;
 
                        ret = true;
 
@@ -1038,18 +1081,32 @@ bool net_nfc_server_set_client_type(int socket, int type)
        return ret;
 }
 
-bool net_nfc_server_set_server_state(server_state_e state)
+bool net_nfc_server_set_server_state(uint32_t state)
+{
+       pthread_mutex_lock(&g_server_socket_lock);
+
+       if (state == NET_NFC_SERVER_IDLE)
+               g_server_info.state &= NET_NFC_SERVER_IDLE;
+       else
+               g_server_info.state |= state;
+
+       pthread_mutex_unlock(&g_server_socket_lock);
+
+       return true;
+}
+
+bool net_nfc_server_unset_server_state(uint32_t state)
 {
        pthread_mutex_lock(&g_server_socket_lock);
 
-       g_server_info.state state;
+       g_server_info.state &= ~state;
 
        pthread_mutex_unlock(&g_server_socket_lock);
 
        return true;
 }
 
-server_state_e net_nfc_server_get_server_state()
+uint32_t net_nfc_server_get_server_state()
 {
        return g_server_info.state;
 }
@@ -1154,11 +1211,6 @@ bool _net_nfc_check_client_handle ()
 }
 
 
-server_state_e net_nfc_get_server_state()
-{
-       return g_server_info.state;
-}
-
 void net_nfc_server_set_tag_info(void * info)
 {
        net_nfc_request_target_detected_t* detail = (net_nfc_request_target_detected_t *)info;
@@ -1199,4 +1251,49 @@ void net_nfc_server_free_current_tag_info()
        pthread_mutex_unlock(&g_server_socket_lock);
 }
 
+void net_nfc_server_set_launch_state(int socket, bool enable)
+{
+       int i = 0;
+
+       if(vconf_set_bool(NET_NFC_DISABLE_LAUNCH_POPUP_KEY, enable) != 0)
+               DEBUG_ERR_MSG("SERVER : launch state set vconf fail");
+
+       pthread_mutex_lock(&g_server_socket_lock);
+
+       if(enable == TRUE)
+       {
+               for(; i < NET_NFC_CLIENT_MAX; i++)
+               {
+                       g_client_info[i].is_set_launch_popup = enable;
+               }
+       }
+       else
+       {
+               for(; i < NET_NFC_CLIENT_MAX; i++)
+               {
+                       if(g_client_info[i].socket == socket)
+                       {
+                               g_client_info[i].is_set_launch_popup = enable;
+
+                               break;
+                       }
+               }
+       }
+
+       pthread_mutex_unlock(&g_server_socket_lock);
+
+}
+
+bool net_nfc_server_is_set_launch_state()
+{
+       int i = 0;
+
+       for(; i < NET_NFC_CLIENT_MAX; i++)
+       {
+               if(g_client_info[i].socket > 0 && g_client_info[i].is_set_launch_popup == FALSE)
+                       return FALSE;
+       }
+
+       return TRUE;
+}
 
old mode 100644 (file)
new mode 100755 (executable)
index 2e429e4..15bc698
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include "net_nfc_controller_private.h"\r
 #include "net_nfc_util_private.h"\r
 #include "net_nfc_typedef.h"\r
@@ -21,7 +22,6 @@
 #include "net_nfc_service_private.h"\r
 #include "net_nfc_service_se_private.h"\r
 #include "net_nfc_app_util_private.h"\r
-#include "net_nfc_dbus_service_obj_private.h"\r
 #include "net_nfc_server_ipc_private.h"\r
 #include "net_nfc_server_dispatcher_private.h"\r
 #include "net_nfc_manager_util_private.h"\r
@@ -31,6 +31,7 @@
 \r
 #include "net_nfc_util_ndef_message.h"\r
 #include "net_nfc_util_ndef_record.h"\r
+#include "net_nfc_util_access_control_private.h"\r
 \r
 #include <pthread.h>\r
 #include <malloc.h>\r
@@ -69,22 +70,27 @@ void net_nfc_service_target_detected_cb(void *info, void *user_context)
        if (info == NULL)\r
                return;\r
 \r
-       net_nfc_server_set_tag_info(info);\r
-\r
        if (req_msg->request_type == NET_NFC_MESSAGE_SERVICE_RESTART_POLLING_LOOP)\r
        {\r
                net_nfc_dispatcher_queue_push(req_msg);\r
        }\r
 #ifdef BROADCAST_MESSAGE\r
-       net_nfc_request_target_detected_t *detail = (net_nfc_request_target_detected_t *)req_msg;\r
-       req_msg->request_type = NET_NFC_MESSAGE_SERVICE_SLAVE_TARGET_DETECTED;\r
-       net_nfc_dispatcher_queue_push(req_msg);\r
+       else\r
+       {\r
+               net_nfc_server_set_tag_info(info);\r
+\r
+               net_nfc_request_target_detected_t *detail = (net_nfc_request_target_detected_t *)req_msg;\r
+               req_msg->request_type = NET_NFC_MESSAGE_SERVICE_SLAVE_TARGET_DETECTED;\r
+               net_nfc_dispatcher_queue_push(req_msg);\r
+       }\r
 #else\r
        else if (net_nfc_server_get_current_client_context(&client_context) == true &&\r
                net_nfc_server_check_client_is_running(&client_context) == true)\r
        {\r
                net_nfc_request_target_detected_t *detail = (net_nfc_request_target_detected_t *)req_msg;\r
 \r
+               net_nfc_server_set_tag_info(info);\r
+\r
                if (!_net_nfc_service_check_internal_ese_detected())\r
                {\r
                        req_msg->request_type = NET_NFC_MESSAGE_SERVICE_SLAVE_TARGET_DETECTED;\r
@@ -110,45 +116,49 @@ void net_nfc_service_target_detected_cb(void *info, void *user_context)
 #endif\r
 }\r
 \r
-void net_nfc_service_se_transaction_cb(void* info, void* user_context)\r
+void net_nfc_service_se_transaction_cb(void *info, void *user_context)\r
 {\r
        int client_context = 0;\r
        bool success;\r
 \r
-       net_nfc_request_se_event_tse_event = (net_nfc_request_se_event_t *)info;\r
+       net_nfc_request_se_event_t *se_event = (net_nfc_request_se_event_t *)info;\r
 \r
        DEBUG_SERVER_MSG("se event [%d]", se_event->request_type);\r
 \r
-       if(net_nfc_server_get_current_client_context(&client_context) == true)\r
+       if (1)\r
+       {\r
+               net_nfc_app_util_launch_se_transaction_app(se_event->aid.buffer, se_event->aid.length, se_event->param.buffer, se_event->param.length);\r
+       }\r
+\r
+       if (net_nfc_server_get_current_client_context(&client_context) == true)\r
        {\r
-               if(net_nfc_server_check_client_is_running(&client_context) == true)\r
+               if (net_nfc_server_check_client_is_running(&client_context) == true)\r
                {\r
-                       net_nfc_response_se_event_t resp_msg  = {0,};\r
+                       net_nfc_response_se_event_t resp_msg = { 0, };\r
 \r
                        resp_msg.aid.length = se_event->aid.length;\r
                        resp_msg.param.length = se_event->param.length;\r
 \r
-                       if(resp_msg.aid.length > 0)\r
+                       if (resp_msg.aid.length > 0)\r
                        {\r
-\r
-                               if(resp_msg.param.length > 0)\r
+                               if (resp_msg.param.length > 0)\r
                                {\r
-                                       success = _net_nfc_send_response_msg (se_event->request_type, (void *)&resp_msg,  sizeof (net_nfc_response_se_event_t),\r
-                                                       (void *)(se_event->aid.buffer), resp_msg.aid.length,\r
-                                                       (void *)(se_event->param.buffer), resp_msg.param.length, NULL);\r
+                                       success = _net_nfc_send_response_msg(se_event->request_type, (void *)&resp_msg, sizeof(net_nfc_response_se_event_t),\r
+                                               (void *)(se_event->aid.buffer), resp_msg.aid.length,\r
+                                               (void *)(se_event->param.buffer), resp_msg.param.length, NULL);\r
                                }\r
                                else\r
                                {\r
-                                       success = _net_nfc_send_response_msg (se_event->request_type, (void *)&resp_msg,  sizeof (net_nfc_response_se_event_t),\r
-                                                               (void *)(se_event->aid.buffer), resp_msg.aid.length, NULL);\r
+                                       success = _net_nfc_send_response_msg(se_event->request_type, (void *)&resp_msg, sizeof(net_nfc_response_se_event_t),\r
+                                               (void *)(se_event->aid.buffer), resp_msg.aid.length, NULL);\r
                                }\r
                        }\r
                        else\r
                        {\r
-                               success = _net_nfc_send_response_msg (se_event->request_type, (void *)&resp_msg,  sizeof (net_nfc_response_se_event_t), NULL);\r
+                               success = _net_nfc_send_response_msg(se_event->request_type, (void *)&resp_msg, sizeof(net_nfc_response_se_event_t), NULL);\r
                        }\r
 \r
-                       if(success == true)\r
+                       if (success == true)\r
                        {\r
                                DEBUG_SERVER_MSG("sending response is ok");\r
                        }\r
old mode 100644 (file)
new mode 100755 (executable)
index b91679b..313752b
@@ -20,7 +20,6 @@
 #include "net_nfc_debug_private.h"\r
 #include "net_nfc_service_private.h"\r
 #include "net_nfc_app_util_private.h"\r
-#include "net_nfc_dbus_service_obj_private.h"\r
 #include "net_nfc_server_ipc_private.h"\r
 #include "net_nfc_server_dispatcher_private.h"\r
 #include "net_nfc_manager_util_private.h"\r
@@ -109,10 +108,6 @@ bool net_nfc_service_llcp_process(net_nfc_target_handle_s* handle, int devType,
                }\r
        }\r
 \r
-#ifdef BROADCAST_MESSAGE\r
-       net_nfc_server_set_server_state(        NET_NFC_LLCP_CONNECTED);\r
-#endif\r
-\r
        DEBUG_SERVER_MSG("check LLCP");\r
 \r
        if(net_nfc_controller_llcp_check_llcp(handle, result) == true)\r
@@ -308,6 +303,7 @@ static bool _net_nfc_service_llcp_state_process(net_nfc_request_msg_t *msg)
        {\r
        case NET_NFC_STATE_EXCHANGER_SERVER :\r
                DEBUG_SERVER_MSG("exchanger server service");\r
+               net_nfc_server_set_server_state(NET_NFC_SNEP_SERVER_CONNECTED);\r
                result = _net_nfc_service_llcp_snep_server(state, &error);\r
                break;\r
 \r
@@ -319,6 +315,7 @@ static bool _net_nfc_service_llcp_state_process(net_nfc_request_msg_t *msg)
 \r
        case NET_NFC_STATE_EXCHANGER_SERVER_NPP :\r
                DEBUG_SERVER_MSG("exchanger sesrver npp");\r
+               net_nfc_server_set_server_state(NET_NFC_SNEP_SERVER_CONNECTED);\r
                result = _net_nfc_service_llcp_npp_server(state, &error);\r
                break;\r
 \r
@@ -351,8 +348,6 @@ bool net_nfc_service_llcp_process_accept(net_nfc_request_msg_t *msg)
                return false;\r
        }\r
 \r
-       net_nfc_server_set_server_state(NET_NFC_SNEP_SERVER_CONNECTED);\r
-\r
        if (msg->request_type == NET_NFC_MESSAGE_SERVICE_LLCP_ACCEPT)\r
        {\r
                state = (net_nfc_llcp_state_t *)accept->user_param;\r
@@ -1150,6 +1145,10 @@ static bool _net_nfc_service_llcp_snep_server(net_nfc_llcp_state_t * state, net_
 \r
        if (need_clean_up == true)\r
        {\r
+               DEBUG_SERVER_MSG("socket close :: snep server");\r
+\r
+               net_nfc_server_unset_server_state(NET_NFC_SNEP_SERVER_CONNECTED);\r
+\r
                net_nfc_controller_llcp_socket_close (state->socket, result);\r
                net_nfc_service_llcp_remove_state (state);\r
                _net_nfc_manager_util_free_mem (state);\r
@@ -1573,6 +1572,10 @@ static bool _net_nfc_service_llcp_npp_server(net_nfc_llcp_state_t * state, net_n
 \r
        if (need_clean_up == true)\r
        {\r
+               DEBUG_SERVER_MSG("socket close :: NPP server");\r
+\r
+               net_nfc_server_unset_server_state(NET_NFC_NPP_SERVER_CONNECTED);\r
+\r
                net_nfc_controller_llcp_socket_close (state->socket, result);\r
                net_nfc_service_llcp_remove_state (state);\r
                _net_nfc_manager_util_free_mem (state);\r
@@ -1599,7 +1602,7 @@ static bool _net_nfc_service_llcp_client(net_nfc_llcp_state_t * state, net_nfc_e
 \r
        *result = NET_NFC_OK;\r
 \r
-       if(((net_nfc_server_get_server_state() == NET_NFC_SNEP_CLIENT_CONNECTED) ||  (net_nfc_server_get_server_state() == NET_NFC_NPP_CLIENT_CONNECTED))\r
+       if(((net_nfc_server_get_server_state() & NET_NFC_SNEP_CLIENT_CONNECTED) ||  (net_nfc_server_get_server_state() & NET_NFC_NPP_CLIENT_CONNECTED))\r
                && state->step == NET_NFC_LLCP_STEP_01)\r
        {\r
                state->socket = current_llcp_client_state.socket;\r
@@ -1848,6 +1851,7 @@ static bool _net_nfc_service_llcp_client(net_nfc_llcp_state_t * state, net_nfc_e
                                req_msg.result = NET_NFC_OK;\r
 \r
                                _net_nfc_send_response_msg (NET_NFC_MESSAGE_P2P_SEND, &req_msg, sizeof (net_nfc_response_p2p_send_t), NULL);\r
+\r
                                break;\r
                        }\r
 \r
@@ -1871,6 +1875,8 @@ static bool _net_nfc_service_llcp_client(net_nfc_llcp_state_t * state, net_nfc_e
                                                req_msg.result = NET_NFC_OK;\r
 \r
                                                _net_nfc_send_response_msg (NET_NFC_MESSAGE_P2P_SEND, &req_msg, sizeof (net_nfc_response_p2p_send_t), NULL);\r
+\r
+\r
                                        }\r
                                        else if(code == SNEP_RESP_CONT)\r
                                        {\r
@@ -2051,6 +2057,8 @@ static bool _net_nfc_service_llcp_client(net_nfc_llcp_state_t * state, net_nfc_e
                                req_msg.result = NET_NFC_OK;\r
 \r
                                _net_nfc_send_response_msg (NET_NFC_MESSAGE_P2P_SEND, &req_msg, sizeof (net_nfc_response_p2p_send_t), NULL);\r
+\r
+\r
                        }\r
 \r
                        DEBUG_SERVER_MSG("sending last fragment msg is ok");\r
@@ -2078,14 +2086,22 @@ static bool _net_nfc_service_llcp_client(net_nfc_llcp_state_t * state, net_nfc_e
 \r
                net_nfc_util_play_target_detect_sound();\r
                _net_nfc_send_response_msg (NET_NFC_MESSAGE_P2P_SEND, &req_msg, sizeof (net_nfc_response_p2p_send_t), NULL);\r
-               state->step = 0;\r
+\r
+               net_nfc_server_unset_server_state(NET_NFC_SNEP_CLIENT_CONNECTED|NET_NFC_NPP_CLIENT_CONNECTED);\r
+\r
+               need_clean_up = true;\r
        }\r
 \r
        if (need_clean_up == true )\r
        {\r
+               DEBUG_SERVER_MSG("socket close :: LLCP client");\r
+\r
                net_nfc_controller_llcp_socket_close (state->socket, result);\r
                net_nfc_service_llcp_remove_state (state);\r
                _net_nfc_manager_util_free_mem (state);\r
+\r
+               net_nfc_server_unset_server_state(NET_NFC_SNEP_CLIENT_CONNECTED|NET_NFC_NPP_CLIENT_CONNECTED);\r
+\r
        }\r
 \r
        if (*result != NET_NFC_OK && *result != NET_NFC_BUSY)\r
index 9abfc1d..1f80188 100644 (file)
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 #include "net_nfc_debug_private.h"
 #include "net_nfc_util_private.h"
 #include "net_nfc_util_ndef_message.h"
@@ -52,6 +53,7 @@ net_nfc_error_e net_nfc_service_llcp_handover_process_carrier_config(net_nfc_car
 int net_nfc_service_llcp_handover_process_bt_config(net_nfc_handover_process_config_context_t *context);
 
 int net_nfc_service_llcp_handover_return_to_step(net_nfc_handover_context_t *context);
+net_nfc_error_e net_nfc_service_llcp_handover_bt_change_data_order(net_nfc_carrier_config_s *config);
 
 net_nfc_error_e net_nfc_service_llcp_handover_send_request_msg(net_nfc_request_connection_handover_t *msg)
 {
@@ -1428,7 +1430,7 @@ int net_nfc_service_llcp_handover_append_bt_carrier_config(net_nfc_handover_crea
                                        /* get oob data */
                                        bluetooth_oob_read_local_data(&oob);
 
-                                       if (oob.hash_len > 0)
+                                       if (oob.hash_len == 16)
                                        {
                                                DEBUG_SERVER_MSG("oob.hash_len [%d]", oob.hash_len);
 
@@ -1438,7 +1440,7 @@ int net_nfc_service_llcp_handover_append_bt_carrier_config(net_nfc_handover_crea
                                                }
                                        }
 
-                                       if (oob.randomizer_len > 0)
+                                       if (oob.randomizer_len == 16)
                                        {
                                                DEBUG_SERVER_MSG("oob.randomizer_len [%d]", oob.randomizer_len);
 
@@ -1448,6 +1450,8 @@ int net_nfc_service_llcp_handover_append_bt_carrier_config(net_nfc_handover_crea
                                                }
                                        }
 
+                                       net_nfc_service_llcp_handover_bt_change_data_order(config);
+
                                        if ((result = net_nfc_util_create_ndef_record_with_carrier_config(&record, config)) == NET_NFC_OK)
                                        {
                                                if ((result = net_nfc_util_append_carrier_config_record(context->ndef_message, record, 0)) == NET_NFC_OK)
@@ -1709,6 +1713,7 @@ net_nfc_error_e net_nfc_service_llcp_handover_process_carrier_config(net_nfc_car
                {
                case NET_NFC_CONN_HANDOVER_CARRIER_BT :
                        DEBUG_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_BT]");
+                       net_nfc_service_llcp_handover_bt_change_data_order(context->config);
                        g_idle_add((GSourceFunc)net_nfc_service_llcp_handover_process_bt_config, (gpointer)context);
                        break;
 
@@ -1786,7 +1791,7 @@ int net_nfc_service_llcp_handover_process_bt_config(net_nfc_handover_process_con
                        DEBUG_MSG("STEP [2]");
 
                        net_nfc_util_get_carrier_config_property(context->config, NET_NFC_BT_ATTRIBUTE_ADDRESS, (uint16_t *)&temp.length, &temp.buffer);
-                       if (temp.length > 0)
+                       if (temp.length == 6)
                        {
                                memcpy(address.addr, temp.buffer, MIN(sizeof(address.addr), temp.length));
 
@@ -1837,7 +1842,7 @@ int net_nfc_service_llcp_handover_process_bt_config(net_nfc_handover_process_con
                        }
                        else
                        {
-                               DEBUG_ERR_MSG("bluetooth address is invalid");
+                               DEBUG_ERR_MSG("bluetooth address is invalid. [%d] bytes", temp.length);
 
                                context->step = NET_NFC_LLCP_STEP_RETURN;
                                context->result = NET_NFC_OPERATION_FAIL;
@@ -1855,12 +1860,22 @@ int net_nfc_service_llcp_handover_process_bt_config(net_nfc_handover_process_con
                        context->step++;
 
                        net_nfc_util_get_carrier_config_property(context->config, NET_NFC_BT_ATTRIBUTE_ADDRESS, (uint16_t *)&data.length, &data.buffer);
+                       if (data.length == 6)
+                       {
+                               /* send handover success message to client */
+                               _net_nfc_service_llcp_handover_send_response(NET_NFC_OK, NET_NFC_CONN_HANDOVER_CARRIER_BT, &data);
 
-                       /* send handover success message to client */
-                       _net_nfc_service_llcp_handover_send_response(NET_NFC_OK, NET_NFC_CONN_HANDOVER_CARRIER_BT, &data);
+                               context->step = NET_NFC_LLCP_STEP_RETURN;
+                               context->result = NET_NFC_OK;
+                       }
+                       else
+                       {
+                               DEBUG_ERR_MSG("bluetooth address is invalid. [%d] bytes", data.length);
+
+                               context->step = NET_NFC_LLCP_STEP_RETURN;
+                               context->result = NET_NFC_OPERATION_FAIL;
+                       }
 
-                       context->step = NET_NFC_LLCP_STEP_RETURN;
-                       context->result = NET_NFC_OK;
                        g_idle_add((GSourceFunc)net_nfc_service_llcp_handover_process_bt_config, (gpointer)context);
                }
                break;
@@ -1902,17 +1917,83 @@ net_nfc_error_e net_nfc_service_llcp_handover_get_oob_data(net_nfc_carrier_confi
        {
                if ((result = net_nfc_util_get_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_OOB_HASH_R, (uint16_t *)&randomizer.length, &randomizer.buffer)) == NET_NFC_OK)
                {
-                       if (hash.length > 0)
+                       if (hash.length == 16)
                        {
+                               DEBUG_MSG("hash.length == 16");
+
                                oob->hash_len = MIN(sizeof(oob->hash), hash.length);
                                memcpy(oob->hash, hash.buffer, oob->hash_len);
                        }
+                       else
+                       {
+                               DEBUG_ERR_MSG("hash.length error : [%d] bytes", hash.length);
+                       }
 
-                       if (hash.length > 0)
+                       if (randomizer.length == 16)
                        {
+                               DEBUG_MSG("randomizer.length == 16");
+
                                oob->randomizer_len = MIN(sizeof(oob->randomizer), randomizer.length);
                                memcpy(oob->randomizer, randomizer.buffer, oob->randomizer_len);
                        }
+                       else
+                       {
+                               DEBUG_ERR_MSG("randomizer.length error : [%d] bytes", randomizer.length);
+                       }
+               }
+       }
+
+       LOGD("[%s:%d] END", __func__, __LINE__);
+
+       return result;
+}
+
+net_nfc_error_e net_nfc_service_llcp_handover_bt_change_data_order(net_nfc_carrier_config_s *config)
+{
+       uint8_t *buffer = NULL;
+       uint32_t len = 0;
+       net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
+
+       LOGD("[%s:%d] START", __func__, __LINE__);
+
+       if (config == NULL)
+       {
+               return NET_NFC_NULL_PARAMETER;
+       }
+
+       if ((result = net_nfc_util_get_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_ADDRESS, &len, (uint16_t *)&buffer)) == NET_NFC_OK)
+       {
+               if (len == 6)
+               {
+                       NET_NFC_REVERSE_ORDER_6_BYTES(buffer);
+               }
+               else
+               {
+                       DEBUG_ERR_MSG("NET_NFC_BT_ATTRIBUTE_ADDRESS len error : [%d] bytes", len);
+               }
+       }
+
+       if ((result = net_nfc_util_get_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_OOB_HASH_C, &len, (uint16_t *)&buffer)) == NET_NFC_OK)
+       {
+               if (len == 16)
+               {
+                       NET_NFC_REVERSE_ORDER_16_BYTES(buffer);
+               }
+               else
+               {
+                       DEBUG_ERR_MSG("NET_NFC_BT_ATTRIBUTE_OOB_HASH_C len error : [%d] bytes", len);
+               }
+       }
+
+       if ((result = net_nfc_util_get_carrier_config_property(config, NET_NFC_BT_ATTRIBUTE_OOB_HASH_R, &len, (uint16_t *)&buffer)) == NET_NFC_OK)
+       {
+               if (len == 16)
+               {
+                       NET_NFC_REVERSE_ORDER_16_BYTES(buffer);
+               }
+               else
+               {
+                       DEBUG_ERR_MSG("NET_NFC_BT_ATTRIBUTE_OOB_HASH_R error : [%d] bytes", len);
                }
        }
 
old mode 100644 (file)
new mode 100755 (executable)
index e918e1f..414f3d5
   * limitations under the License.\r
   */\r
 \r
+\r
 #include "net_nfc_controller_private.h"\r
 #include "net_nfc_util_private.h"\r
 #include "net_nfc_typedef.h"\r
 #include "net_nfc_debug_private.h"\r
 #include "net_nfc_service_private.h"\r
 #include "net_nfc_app_util_private.h"\r
-#include "net_nfc_dbus_service_obj_private.h"\r
 #include "net_nfc_server_ipc_private.h"\r
 #include "net_nfc_server_dispatcher_private.h"\r
 #include "net_nfc_manager_util_private.h"\r
 #include <glib.h>\r
 #include <malloc.h>\r
 \r
-#include <TapiCommon.h>\r
-#include <TelSim.h>\r
+#include <tapi_common.h>\r
 #include <ITapiSim.h>\r
 \r
 /* define */\r
 /* For ESE*/\r
 se_setting_t g_se_setting;\r
 \r
-\r
 /* For UICC */\r
-\r
-static unsigned int tapi_event_list[] =\r
-{\r
-        TAPI_EVENT_SIM_APDU_CNF,\r
-        TAPI_EVENT_SIM_ATR_CNF\r
-};\r
-\r
-typedef struct _uicc_context_t{\r
-       int req_id;\r
-       void* trans_param;\r
-}uicc_context_t;\r
-\r
-static unsigned int *p_event_subscription_ids = NULL;\r
+struct tapi_handle *uicc_handle = NULL;\r
 \r
 static bool net_nfc_service_check_sim_state(void);\r
-static int  sim_callback  (TelTapiEvent_t *sim_event);\r
 \r
-#define TAPI_EVENT_COUNT (sizeof(tapi_event_list) / sizeof(unsigned int))\r
-\r
-static GList * list = NULL;\r
-\r
-\r
-static int _compare_func (gconstpointer key1, gconstpointer key2)\r
-{\r
-       uicc_context_t * arg1 = (uicc_context_t*) key1;\r
-       uicc_context_t * arg2 = (uicc_context_t *) key2;\r
-\r
-       if (arg1->req_id < arg2->req_id){\r
-               return -1;\r
-       }\r
-       else if (arg1->req_id > arg2->req_id){\r
-               return 1;\r
-       }\r
-       else {\r
-               return 0;\r
-       }\r
-}\r
-\r
-static void _append_data(uicc_context_t* data)\r
-{\r
-       if (data != NULL)\r
-       {\r
-               list = g_list_append (list, data);\r
-       }\r
-}\r
-\r
-static uicc_context_t* _get_data(int req_id)\r
-{\r
-       if(list != NULL)\r
-       {\r
-\r
-               GList* found = NULL;\r
-\r
-               uicc_context_t value = {0, NULL};\r
-               value.req_id = req_id;\r
-\r
-               found = g_list_find_custom (list, &value, _compare_func );\r
-\r
-               if(found != NULL){\r
-                       return (uicc_context_t*)found->data;\r
-               }\r
-       }\r
-\r
-       return NULL;\r
-}\r
-\r
-static void _remove_data(uicc_context_t* data)\r
-{\r
-       if(list != NULL)\r
-       {\r
-\r
-               list = g_list_remove (list, data);\r
-       }\r
-}\r
+static void _uicc_transmit_apdu_cb(TapiHandle *handle, int result, void *data, void *user_data);\r
+static void _uicc_get_atr_cb(TapiHandle *handle, int result, void *data, void *user_data);\r
+static void _uicc_status_noti_cb(TapiHandle *handle, const char *noti_id, void *data, void *user_data);\r
 \r
 void net_nfc_service_se_detected(net_nfc_request_msg_t *msg)\r
 {\r
@@ -153,123 +84,81 @@ void net_nfc_service_se_detected(net_nfc_request_msg_t *msg)
        g_se_setting.open_request_trans_param = NULL;\r
 }\r
 \r
-\r
 bool net_nfc_service_tapi_init(void)\r
 {\r
+       char **cpList = NULL;\r
+\r
        DEBUG_SERVER_MSG("tapi init");\r
 \r
-       unsigned int event_counts = TAPI_EVENT_COUNT;\r
+       cpList = tel_get_cp_name_list();\r
 \r
-       if ( tel_init() == TAPI_API_SUCCESS)\r
+       uicc_handle = tel_init(cpList[0]);\r
+       if (uicc_handle == NULL)\r
        {\r
-               if((p_event_subscription_ids = (unsigned int *)calloc(1, sizeof(tapi_event_list))) == NULL)\r
-               {\r
-                       return false;\r
-               }\r
-\r
-\r
-               int i = 0;\r
-\r
-               for(; i < event_counts; i++)\r
-               {\r
-                       tel_register_event(tapi_event_list[i], &(p_event_subscription_ids[i]), (TelAppCallback)sim_callback, NULL);\r
-               }\r
+               int error;\r
 \r
+               error = tel_register_noti_event(uicc_handle, TAPI_NOTI_SIM_STATUS, _uicc_status_noti_cb, NULL);\r
        }\r
        else\r
        {\r
-               DEBUG_SERVER_MSG(" tel_init() failed");\r
+               DEBUG_SERVER_MSG("tel_init() failed");\r
                return false;\r
        }\r
 \r
-       tel_register_app_name("com.samsung.nfc");\r
-\r
-       DEBUG_SERVER_MSG(" tel_init() is success");\r
+       DEBUG_SERVER_MSG("tel_init() is success");\r
 \r
        return net_nfc_service_check_sim_state();\r
-\r
 }\r
 \r
 void net_nfc_service_tapi_deinit(void)\r
 {\r
        DEBUG_SERVER_MSG("deinit tapi");\r
 \r
-       unsigned int event_counts = TAPI_EVENT_COUNT;\r
-       int i = 0;\r
-\r
-       if(p_event_subscription_ids != NULL)\r
-       {\r
-               for(; i < event_counts; i++){\r
-                       tel_deregister_event(p_event_subscription_ids[i]);\r
-               }\r
-       }\r
-\r
-       tel_deinit();\r
+       tel_deregister_noti_event(uicc_handle, TAPI_NOTI_SIM_STATUS);\r
 \r
-       if(p_event_subscription_ids != NULL)\r
-       {\r
-               free(p_event_subscription_ids);\r
-               p_event_subscription_ids = NULL;\r
-       }\r
+       tel_deinit(uicc_handle);\r
 }\r
 \r
-bool net_nfc_service_transfer_apdu(data_s* apdu, void* trans_param)\r
+bool net_nfc_service_transfer_apdu(data_s *apdu, void *trans_param)\r
 {\r
-       if(apdu == NULL)\r
-               return false;\r
+       TelSimApdu_t apdu_data = { 0 };\r
+       int result;\r
+\r
+       DEBUG_SERVER_MSG("tranfer apdu");\r
 \r
-       TelSimApdu_t  apdu_data = {0};\r
+       if (apdu == NULL)\r
+               return false;\r
 \r
        apdu_data.apdu = apdu->buffer;\r
        apdu_data.apdu_len = apdu->length;\r
 \r
-       DEBUG_SERVER_MSG("tranfer apdu \n");\r
-\r
-       int req_id = 0;\r
-       TapiResult_t error = tel_req_sim_apdu(&apdu_data, (int *)&req_id);\r
-\r
-       if(error != TAPI_API_SUCCESS)\r
+       result = tel_req_sim_apdu(uicc_handle, &apdu_data, _uicc_transmit_apdu_cb, trans_param);\r
+       if (result == 0)\r
        {\r
-               DEBUG_SERVER_MSG("request sim apdu is failed with error = [%d] \n", error);\r
-               return false;\r
+               DEBUG_SERVER_MSG("sim apdu request is success");\r
        }\r
        else\r
        {\r
-               uicc_context_t* context = calloc(1, sizeof(uicc_context_t));\r
-\r
-               if(context != NULL)\r
-               {\r
-                       context->req_id = req_id;\r
-                       _append_data(context);\r
-               }\r
-\r
-               DEBUG_SERVER_MSG("sim apdu request is success \n");\r
+               DEBUG_SERVER_MSG("request sim apdu is failed with error = [%d]", result);\r
+               return false;\r
        }\r
 \r
        return true;\r
 }\r
 \r
-bool net_nfc_service_request_atr(voidtrans_param)\r
+bool net_nfc_service_request_atr(void *trans_param)\r
 {\r
-       int req_id = 0;\r
-       TapiResult_t error = tel_req_sim_atr((int *)&req_id);\r
+       int result;\r
 \r
-       if(error != TAPI_API_SUCCESS)\r
+       result = tel_req_sim_atr(uicc_handle, _uicc_get_atr_cb, trans_param);\r
+       if(result == 0)\r
        {\r
-               DEBUG_SERVER_MSG("failed to request ATR  = [%d]\n", error);\r
-               return false;\r
+               DEBUG_SERVER_MSG("request is success");\r
        }\r
        else\r
        {\r
-               uicc_context_t* context = calloc(1, sizeof(uicc_context_t));\r
-\r
-               if(context != NULL)\r
-               {\r
-                       context->req_id = req_id;\r
-                       _append_data(context);\r
-               }\r
-\r
-               DEBUG_SERVER_MSG("request is success \n");\r
+               DEBUG_SERVER_MSG("failed to request ATR  = [%d]", result);\r
+               return false;\r
        }\r
 \r
        return true;\r
@@ -277,107 +166,90 @@ bool net_nfc_service_request_atr(void* trans_param)
 \r
 static bool net_nfc_service_check_sim_state(void)\r
 {\r
-       DEBUG_SERVER_MSG("check sim state");\r
-\r
-       TelSimCardStatus_t state = TAPI_API_SUCCESS;\r
+       TelSimCardStatus_t state = (TelSimCardStatus_t)0;\r
        int b_card_changed = 0;\r
+       int error;\r
+\r
+       DEBUG_SERVER_MSG("check sim state");\r
 \r
-       TapiResult_t error  = tel_get_sim_init_info(&state, &b_card_changed);\r
+       error = tel_get_sim_init_info(uicc_handle, &state, &b_card_changed);\r
 \r
-       DEBUG_SERVER_MSG("current sim init state = [%d] \n", state);\r
+       DEBUG_SERVER_MSG("current sim init state = [%d]", state);\r
 \r
-       if(error != TAPI_API_SUCCESS)\r
+       if (error != 0)\r
        {\r
-               DEBUG_SERVER_MSG("error = [%d] \n", error);\r
+               DEBUG_SERVER_MSG("error = [%d]", error);\r
                return false;\r
        }\r
-       else if(state ==TAPI_SIM_STATUS_SIM_INIT_COMPLETED || state == TAPI_SIM_STATUS_SIM_INITIALIZING)\r
+       else if (state == TAPI_SIM_STATUS_SIM_INIT_COMPLETED || state == TAPI_SIM_STATUS_SIM_INITIALIZING)\r
        {\r
-               DEBUG_SERVER_MSG("sim is initialized \n");\r
+               DEBUG_SERVER_MSG("sim is initialized");\r
        }\r
        else\r
        {\r
-               DEBUG_SERVER_MSG("sim is not initialized \n");\r
+               DEBUG_SERVER_MSG("sim is not initialized");\r
                return false;\r
        }\r
 \r
        return true;\r
 }\r
 \r
-static int  sim_callback  (TelTapiEvent_t *sim_event)\r
+void _uicc_transmit_apdu_cb(TapiHandle *handle, int result, void *data, void *user_data)\r
 {\r
-       DEBUG_SERVER_MSG("[SIM]Reques Id[%d]", sim_event->RequestId);\r
-       DEBUG_SERVER_MSG("[SIM]event state [%d]", sim_event->Status);\r
+       TelSimApduResp_t *apdu = (TelSimApduResp_t *)data;\r
+       net_nfc_response_send_apdu_t resp = { 0 };\r
 \r
-       switch(sim_event->EventType)\r
+       DEBUG_SERVER_MSG("_uicc_transmit_apdu_cb");\r
+\r
+       if (result == 0)\r
        {\r
-               case TAPI_EVENT_SIM_APDU_CNF:\r
-               {\r
-                       DEBUG_SERVER_MSG("TAPI_EVENT_SIM_APDU_CNF");\r
-\r
-                       net_nfc_response_send_apdu_t resp = {0};\r
-\r
-                       uicc_context_t* temp = _get_data(sim_event->RequestId);\r
-\r
-                       if(temp != NULL)\r
-                       {\r
-                               resp.trans_param = temp->trans_param;\r
-                               _remove_data(temp);\r
-                               free(temp);\r
-                       }\r
-                       else\r
-                       {\r
-                               resp.trans_param = NULL;\r
-                       }\r
-\r
-                       if(sim_event->Status == TAPI_API_SUCCESS)\r
-                       {\r
-                               resp.result = NET_NFC_OK;\r
-                       }\r
-                       else\r
-                       {\r
-                               resp.result = NET_NFC_OPERATION_FAIL;\r
-                       }\r
-\r
-                       if(sim_event->pData != NULL)\r
-                       {\r
-\r
-                               TelSimApduResp_t* apdu = (TelSimApduResp_t*)sim_event->pData;\r
-\r
-                               if(apdu->apdu_resp_len > 0)\r
-                               {\r
-                                       resp.data.length = apdu->apdu_resp_len;\r
-                                       DEBUG_MSG("send response send apdu msg");\r
-                                       _net_nfc_send_response_msg (NET_NFC_MESSAGE_SEND_APDU_SE, (void*)&resp, sizeof(net_nfc_response_send_apdu_t), apdu->apdu_resp, apdu->apdu_resp_len, NULL);\r
-                               }\r
-                               else\r
-                               {\r
-                                       DEBUG_MSG("send response send apdu msg");\r
-                                       _net_nfc_send_response_msg (NET_NFC_MESSAGE_SEND_APDU_SE, (void*)&resp, sizeof(net_nfc_response_send_apdu_t), NULL);\r
-                               }\r
-                       }\r
-                       else\r
-                       {\r
-                               DEBUG_MSG("send response send apdu msg");\r
-                               _net_nfc_send_response_msg (NET_NFC_MESSAGE_SEND_APDU_SE, (void*)&resp, sizeof(net_nfc_response_send_apdu_t), NULL);\r
-                       }\r
-               }\r
+               resp.result = NET_NFC_OK;\r
+       }\r
+       else\r
+       {\r
+               resp.result = NET_NFC_OPERATION_FAIL;\r
+       }\r
+\r
+       if (apdu != NULL && apdu->apdu_resp_len > 0)\r
+       {\r
+               resp.data.length = apdu->apdu_resp_len;\r
+\r
+               DEBUG_MSG("send response send apdu msg");\r
+               _net_nfc_send_response_msg(NET_NFC_MESSAGE_SEND_APDU_SE, (void *)&resp, sizeof(net_nfc_response_send_apdu_t), apdu->apdu_resp, apdu->apdu_resp_len, NULL);\r
+       }\r
+       else\r
+       {\r
+               DEBUG_MSG("send response send apdu msg");\r
+               _net_nfc_send_response_msg(NET_NFC_MESSAGE_SEND_APDU_SE, (void *)&resp, sizeof(net_nfc_response_send_apdu_t), NULL);\r
+       }\r
+}\r
+\r
+void _uicc_get_atr_cb(TapiHandle *handle, int result, void *data, void *user_data)\r
+{\r
+       /* TODO : response message */\r
+\r
+       DEBUG_SERVER_MSG("_uicc_get_atr_cb");\r
+}\r
+\r
+void _uicc_status_noti_cb(TapiHandle *handle, const char *noti_id, void *data, void *user_data)\r
+{\r
+       TelSimCardStatus_t *status = (TelSimCardStatus_t *)data;\r
+\r
+       /* TODO :  */\r
+       DEBUG_SERVER_MSG("_uicc_status_noti_cb");\r
+\r
+       switch (*status)\r
+       {\r
+       case TAPI_SIM_STATUS_SIM_INIT_COMPLETED :\r
+               DEBUG_SERVER_MSG("TAPI_SIM_STATUS_SIM_INIT_COMPLETED");\r
                break;\r
 \r
-               case TAPI_EVENT_SIM_ATR_CNF:\r
-               {\r
-                       DEBUG_SERVER_MSG("TAPI_EVENT_SIM_ATR_CNF");\r
-               }\r
+       case TAPI_SIM_STATUS_CARD_REMOVED :\r
+               DEBUG_SERVER_MSG("TAPI_SIM_STATUS_CARD_REMOVED");\r
                break;\r
 \r
-               default:\r
-               {\r
-                       DEBUG_SERVER_MSG("[SIM]Undhandled event type [%d]", sim_event->EventType);\r
-                       DEBUG_SERVER_MSG("[SIM]Undhandled event state [%d]", sim_event->Status);\r
-               }\r
+       default :\r
+               DEBUG_SERVER_MSG("unknown status [%d]", *status);\r
                break;\r
        }\r
-\r
-       return 0;\r
 }\r
-\r
old mode 100644 (file)
new mode 100755 (executable)
index c13e852..4960571
   * limitations under the License.\r
   */\r
 \r
+\r
 #include "net_nfc_controller_private.h"\r
 #include "net_nfc_util_private.h"\r
 #include "net_nfc_typedef.h"\r
 #include "net_nfc_debug_private.h"\r
 #include "net_nfc_service_private.h"\r
 #include "net_nfc_app_util_private.h"\r
-#include "net_nfc_dbus_service_obj_private.h"\r
 #include "net_nfc_server_ipc_private.h"\r
 #include "net_nfc_server_dispatcher_private.h"\r
 #include "net_nfc_manager_util_private.h"\r
@@ -73,11 +73,15 @@ void net_nfc_service_watch_dog(net_nfc_request_msg_t* req_msg)
        {\r
                //DEBUG_SERVER_MSG("try to disconnect target = [%d]", detail_msg->handle);\r
 \r
-               if (net_nfc_controller_disconnect(detail_msg->handle, &result) == false)\r
+               if((NET_NFC_NOT_INITIALIZED != result) && (NET_NFC_INVALID_HANDLE != result))\r
                {\r
-                       net_nfc_controller_exception_handler();\r
-               }\r
+                       if (net_nfc_controller_disconnect(detail_msg->handle, &result) == false)\r
+                       {\r
 \r
+                               DEBUG_SERVER_MSG("try to disconnect result = [%d]", result);\r
+                               net_nfc_controller_exception_handler();\r
+                       }\r
+               }\r
 #ifdef BROADCAST_MESSAGE\r
                net_nfc_server_set_server_state( NET_NFC_SERVER_IDLE);\r
 #endif\r
old mode 100644 (file)
new mode 100755 (executable)
index badd71e..bbf3503
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #include <vconf.h>\r
 #include <glib.h>\r
 #include <string.h>\r
 #include "aul.h"\r
 \r
 \r
-#define GALLERY_PKG_NAME_KEY NET_NFC_KEY_PREFIX"deb.com.samsung.gallery"\r
-#define CONTACT_PKG_NAME_KEY NET_NFC_KEY_PREFIX"deb.com.samsung.contacts"\r
-#define BROWSER_PKG_NAME_KEY NET_NFC_KEY_PREFIX"deb.com.samsung.browser"\r
-#define VIDEO_PKG_NAME_KEY NET_NFC_KEY_PREFIX"deb.com.samsung.video-player"\r
-\r
-#define NET_NFC_MODE_SE_KEY NET_NFC_KEY_PREFIX"se"\r
-#define NET_NFC_EEPROM_WRITEN NET_NFC_KEY_PREFIX"eeprom"\r
-\r
-\r
-#define NET_NFC_MODE_SE_ON 1\r
-#define NET_NFC_MODE_SE_OFF 0\r
-\r
-#define TIMEOUT 60 /* secs */\r
-\r
-#define NET_NFC_KEY_PREFIX "memory/nfc/client/"\r
-\r
-static guint g_source_id_gallery = 0;\r
-static guint g_source_id_contact = 0;\r
-static guint g_source_id_browser = 0;\r
-static guint g_source_id_video = 0;\r
-\r
-static bool is_EEPROM_writen = false;\r
-\r
-// static function\r
-\r
-static gboolean timedout_func(gpointer data);\r
-static void net_nfc_service_vconf_changed_cb(keynode_t* key, void* data);\r
 \r
 /////////////////////////////////////////////////////////////////////////\r
 \r
-\r
-\r
-static gboolean timedout_func(gpointer data)\r
+static void net_nfc_service_airplane_mode_cb(keynode_t* key, void* data)\r
 {\r
-       DEBUG_SERVER_MSG("timed out. clean up the value of key = [%s] \n", (char *)data);\r
-\r
-       vconf_set_str((char *)data, "");\r
+       int flight_mode = 0;\r
+       int nfc_state = 0;\r
+       static gboolean powered_off_by_flightmode = FALSE;\r
 \r
-       if(strcmp((char *)data, GALLERY_PKG_NAME_KEY) == 0){g_source_id_gallery = 0;}\r
-       else if(strcmp((char *)data, CONTACT_PKG_NAME_KEY) == 0){g_source_id_contact = 0;}\r
-       else if(strcmp((char *)data, BROWSER_PKG_NAME_KEY) == 0){g_source_id_browser = 0;}\r
-       else if(strcmp((char *)data, VIDEO_PKG_NAME_KEY) == 0){g_source_id_video = 0;}\r
+       vconf_get_bool(VCONFKEY_SETAPPL_FLIGHT_MODE_BOOL, &flight_mode);\r
+       vconf_get_bool(VCONFKEY_NFC_STATE, &nfc_state);\r
 \r
-       return FALSE;\r
-}\r
-\r
-static void net_nfc_service_se_setting_cb(keynode_t* key, void* data)\r
-{\r
-       DEBUG_SERVER_MSG("se vconf value is changed");\r
+       DEBUG_SERVER_MSG("flight mode %s \n", flight_mode > 0 ? "ON" : "OFF");\r
+       DEBUG_SERVER_MSG("NFC state %d, NFC was off by flight mode %s \n",\r
+                       nfc_state, powered_off_by_flightmode == TRUE ? "Yes" : "No");\r
 \r
-       if(vconf_keynode_get_type(key) == VCONF_TYPE_INT)\r
+       if (flight_mode > 0)\r
        {\r
-               net_nfc_request_set_se_t *msg = NULL;\r
-               int value = vconf_keynode_get_int(key);\r
-\r
-               if(value < NET_NFC_SE_CMD_UICC_ON  || value > NET_NFC_SE_CMD_ALL_ON)\r
-               {\r
-                       DEBUG_ERR_MSG("invalid value for setting SE mode");\r
+               /* flight mode enabled */\r
+               if (nfc_state == VCONFKEY_NFC_STATE_OFF)\r
                        return;\r
-               }\r
 \r
-               _net_nfc_util_alloc_mem(msg, sizeof(net_nfc_request_set_se_t));\r
-               if(msg == NULL)\r
-               {\r
-                       DEBUG_ERR_MSG("failed to malloc");\r
-                       return;\r
-               }\r
+               DEBUG_SERVER_MSG("Turning NFC off \n");\r
 \r
-               msg->length =  sizeof(net_nfc_request_set_se_t);\r
-               msg->request_type = NET_NFC_MESSAGE_SERVICE_SE;\r
-               msg->se_type = value;\r
+               /* nfc off */\r
+               net_nfc_request_msg_t *req_msg = NULL;\r
 \r
-               net_nfc_dispatcher_queue_push((net_nfc_request_msg_t *)msg);\r
-       }\r
-       else\r
-       {\r
-               DEBUG_ERR_MSG("unknown type for setting SE mode. only int type will be accepted");\r
-       }\r
-}\r
-\r
-static void net_nfc_service_vconf_changed_cb(keynode_t* key, void* data)\r
-{\r
-       DEBUG_SERVER_MSG("vconf value is changed");\r
-\r
-       if(vconf_keynode_get_type(key) == VCONF_TYPE_STRING)\r
-       {\r
-               char* str = vconf_keynode_get_str(key);\r
-               char* vconf_key = vconf_keynode_get_name(key);\r
+               _net_nfc_util_alloc_mem(req_msg, sizeof(net_nfc_request_msg_t));\r
+               if (req_msg == NULL)\r
+                       return false;\r
 \r
-               if(str != NULL && (strlen(str) > 0))\r
-               {\r
-                       if( strcmp(vconf_key, GALLERY_PKG_NAME_KEY) == 0)\r
-                       {\r
-                               /* make g timer for key A */\r
-                               if(g_source_id_gallery != 0)\r
-                               {\r
-                                       g_source_remove(g_source_id_gallery);\r
-                                       g_source_id_gallery = 0;\r
-                               }\r
+               req_msg->length = sizeof(net_nfc_request_msg_t);\r
+               req_msg->request_type = NET_NFC_MESSAGE_SERVICE_DEINIT;\r
 \r
-                               g_source_id_gallery = g_timeout_add_seconds(TIMEOUT, timedout_func, GALLERY_PKG_NAME_KEY);\r
-                       }\r
-                       else if( strcmp(vconf_key, CONTACT_PKG_NAME_KEY) == 0)\r
-                       {\r
-                               /* make g timer for key B */\r
-                               if(g_source_id_contact != 0)\r
-                               {\r
-                                       g_source_remove(g_source_id_contact);\r
-                                       g_source_id_contact = 0;\r
-                               }\r
-                               g_source_id_contact = g_timeout_add_seconds(TIMEOUT, timedout_func, CONTACT_PKG_NAME_KEY);\r
+               net_nfc_dispatcher_queue_push(req_msg);\r
 \r
-                       }\r
-                       else if( strcmp(vconf_key, BROWSER_PKG_NAME_KEY) == 0)\r
-                       {\r
-                               /* make g timer for key A */\r
-                               if(g_source_id_browser != 0)\r
-                               {\r
-                                       g_source_remove(g_source_id_browser);\r
-                                       g_source_id_browser = 0;\r
-                               }\r
-                               g_source_id_browser = g_timeout_add_seconds(TIMEOUT, timedout_func, BROWSER_PKG_NAME_KEY);\r
+               /* set internal flag */\r
+               powered_off_by_flightmode = TRUE;\r
+       }\r
+       else if (flight_mode == 0)\r
+       {\r
+               /* flight mode disabled */\r
+               if (nfc_state > VCONFKEY_NFC_STATE_OFF)\r
+                       return;\r
 \r
-                       }\r
-                       else if( strcmp(vconf_key, VIDEO_PKG_NAME_KEY) == 0)\r
-                       {\r
-                               /* make g timer for key A */\r
-                               if(g_source_id_video != 0)\r
-                               {\r
-                                       g_source_remove(g_source_id_video);\r
-                                       g_source_id_video = 0;\r
-                               }\r
+               if (powered_off_by_flightmode != TRUE)\r
+                       return;\r
 \r
-                               g_source_id_video = g_timeout_add_seconds(TIMEOUT, timedout_func, VIDEO_PKG_NAME_KEY);\r
-                       }\r
-                       else\r
-                       {\r
-                               DEBUG_SERVER_MSG("unknown key value is changed \n");\r
-                       }\r
+               DEBUG_SERVER_MSG("Turning NFC on \n");\r
 \r
-               }\r
-               else\r
-               {\r
+               /* nfc on */\r
+               net_nfc_request_msg_t *req_msg = NULL;\r
 \r
-                       if( strcmp(vconf_key, GALLERY_PKG_NAME_KEY) == 0)\r
-                       {\r
-                               /* make g timer for key A */\r
-                               if(g_source_id_gallery != 0)\r
-                               {\r
-                                       g_source_remove(g_source_id_gallery);\r
-                                       g_source_id_gallery = 0;\r
-                               }\r
-                       }\r
-                       else if( strcmp(vconf_key, CONTACT_PKG_NAME_KEY) == 0)\r
-                       {\r
-                               /* make g timer for key B */\r
-                               if(g_source_id_contact != 0)\r
-                               {\r
-                                       g_source_remove(g_source_id_contact);\r
-                                       g_source_id_contact = 0;\r
-                               }\r
+               _net_nfc_util_alloc_mem(req_msg, sizeof(net_nfc_request_msg_t));\r
+               if (req_msg == NULL)\r
+                       return false;\r
 \r
-                       }\r
-                       else if( strcmp(vconf_key, BROWSER_PKG_NAME_KEY) == 0)\r
-                       {\r
-                               /* make g timer for key A */\r
-                               if(g_source_id_browser != 0)\r
-                               {\r
-                                       g_source_remove(g_source_id_browser);\r
-                                       g_source_id_browser = 0;\r
-                               }\r
+               req_msg->length = sizeof(net_nfc_request_msg_t);\r
+               req_msg->request_type = NET_NFC_MESSAGE_SERVICE_INIT;\r
 \r
-                       }\r
-                       else if( strcmp(vconf_key, VIDEO_PKG_NAME_KEY) == 0)\r
-                       {\r
-                               /* make g timer for key A */\r
-                               if(g_source_id_video != 0)\r
-                               {\r
-                                       g_source_remove(g_source_id_video);\r
-                                       g_source_id_video = 0;\r
-                               }\r
-                       }\r
-                       else\r
-                       {\r
-                               DEBUG_ERR_MSG("unknown key \n");\r
-                       }\r
+               net_nfc_dispatcher_queue_push(req_msg);\r
 \r
-                       DEBUG_SERVER_MSG("value is cleard. so turn off the timer \n");\r
-               }\r
+               /* unset internal flag */\r
+               powered_off_by_flightmode = FALSE;\r
        }\r
        else\r
        {\r
-               DEBUG_ERR_MSG("unknown value type \n");\r
+               DEBUG_SERVER_MSG("Invalid Vconf value \n");\r
        }\r
 }\r
 \r
 \r
-bool _net_nfc_check_pprom_is_completed ()\r
-{\r
-\r
-       int vconf_val= false;\r
-\r
-       if (is_EEPROM_writen) return true;\r
-       if (vconf_get_bool (NET_NFC_EEPROM_WRITEN, &vconf_val) != 0)\r
-       {\r
-               vconf_val = false;\r
-       }\r
-       if (vconf_val == true) return true;\r
-       return false;\r
-}\r
-\r
-void _net_nfc_set_pprom_is_completed ()\r
-{\r
-       vconf_set_bool (NET_NFC_EEPROM_WRITEN, true);\r
-       is_EEPROM_writen = true;\r
-}\r
-\r
 \r
 void net_nfc_service_vconf_register_notify_listener()\r
 {\r
-       vconf_notify_key_changed(GALLERY_PKG_NAME_KEY, net_nfc_service_vconf_changed_cb, NULL);\r
-       vconf_notify_key_changed(CONTACT_PKG_NAME_KEY, net_nfc_service_vconf_changed_cb, NULL);\r
-       vconf_notify_key_changed(BROWSER_PKG_NAME_KEY, net_nfc_service_vconf_changed_cb, NULL);\r
-       vconf_notify_key_changed(VIDEO_PKG_NAME_KEY, net_nfc_service_vconf_changed_cb, NULL);\r
-       vconf_notify_key_changed(NET_NFC_MODE_SE_KEY, net_nfc_service_se_setting_cb, NULL);\r
+       vconf_notify_key_changed(VCONFKEY_SETAPPL_FLIGHT_MODE_BOOL, net_nfc_service_airplane_mode_cb, NULL);\r
 }\r
 \r
 void net_nfc_service_vconf_unregister_notify_listener()\r
 {\r
-       vconf_ignore_key_changed(GALLERY_PKG_NAME_KEY, net_nfc_service_vconf_changed_cb);\r
-       vconf_ignore_key_changed(CONTACT_PKG_NAME_KEY, net_nfc_service_vconf_changed_cb);\r
-       vconf_ignore_key_changed(BROWSER_PKG_NAME_KEY, net_nfc_service_vconf_changed_cb);\r
-       vconf_ignore_key_changed(VIDEO_PKG_NAME_KEY, net_nfc_service_vconf_changed_cb);\r
-       vconf_ignore_key_changed(NET_NFC_MODE_SE_KEY, net_nfc_service_se_setting_cb);\r
+       vconf_ignore_key_changed(VCONFKEY_SETAPPL_FLIGHT_MODE_BOOL, net_nfc_service_airplane_mode_cb);\r
 }\r
diff --git a/src/manager/net_nfc_util_access_control.c b/src/manager/net_nfc_util_access_control.c
new file mode 100644 (file)
index 0000000..c449189
--- /dev/null
@@ -0,0 +1,188 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+  *
+  * 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 <stdio.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+
+#include "SEService.h"
+#include "Reader.h"
+#include "Session.h"
+#include "ClientChannel.h"
+#include "GPSEACL.h"
+#include "SignatureHelper.h"
+
+#include "net_nfc_debug_private.h"
+
+static bool initialized = false;
+static se_service_h se_service = NULL;
+static reader_h readers[10] = { NULL, };
+static session_h sessions[10] = { NULL, };
+static channel_h channels[10] = { NULL, };
+static gp_se_acl_h acls[10] = { NULL, };
+
+static void _session_open_channel_cb(channel_h channel, int error, void *userData)
+{
+       if (error == 0 && channel != NULL)
+       {
+               int i = (int)userData;
+
+               DEBUG_MSG("channel [%p], error [%d], userdata [%d]", channel, error, (int)userData);
+
+               channels[i] = channel;
+               acls[i] = gp_se_acl_create_instance(channel);
+
+               initialized = true;
+       }
+       else
+       {
+               DEBUG_ERR_MSG("invalid handle");
+       }
+}
+
+static void _reader_open_session_cb(session_h session, int error, void *userData)
+{
+       unsigned char aid[] = { 0xA0, 0x00, 0x00, 0x00, 0x63, 0x50, 0x4B, 0x43, 0x53, 0x2D, 0x31, 0x35 };
+
+       if (error == 0 && session != NULL)
+       {
+               int i = (int)userData;
+
+               sessions[i] = session;
+
+               session_open_basic_channel(session, aid, sizeof(aid), _session_open_channel_cb, userData);
+       }
+       else
+       {
+               DEBUG_ERR_MSG("invalid handle");
+       }
+}
+
+static void _se_service_connected_cb(se_service_h handle, void *data)
+{
+       if (handle != NULL)
+       {
+               int i;
+
+               se_service = handle;
+
+               se_service_get_readers(se_service, readers, (sizeof(readers) / sizeof(reader_h)));
+
+               for(i = 0; readers[i] != NULL && i < (sizeof(readers) / sizeof(reader_h)); i++)
+               {
+                       reader_open_session(readers[i], _reader_open_session_cb, (void *)i);
+               }
+       }
+       else
+       {
+               DEBUG_ERR_MSG("invalid handle");
+       }
+}
+
+bool net_nfc_util_access_control_is_initialized(void)
+{
+       return initialized;
+}
+
+void net_nfc_util_access_control_initialize(void)
+{
+       se_service_h handle = NULL;
+
+       if (net_nfc_util_access_control_is_initialized() == false)
+       {
+               if ((handle = se_service_create_instance((void *)1, _se_service_connected_cb)) == NULL)
+               {
+               }
+       }
+}
+
+void net_nfc_util_access_control_update_list(void)
+{
+       int i;
+
+       if (net_nfc_util_access_control_is_initialized() == true)
+       {
+               for (i = 0; i < (sizeof(acls) / sizeof(gp_se_acl_h)); i++)
+               {
+                       if (acls[i] != NULL)
+                       {
+                               gp_se_acl_update_acl(acls[i]);
+                       }
+               }
+       }
+}
+
+bool net_nfc_util_access_control_is_authorized_package(const char* pkg_name, uint8_t *aid, uint32_t length)
+{
+       bool result = false;
+
+       DEBUG_MSG("aid : { %02X %02X %02X %02X ... }", aid[0], aid[1], aid[2], aid[3]);
+
+       if (net_nfc_util_access_control_is_initialized() == true)
+       {
+               int i;
+               uint8_t hash[20] = { 0, };
+               uint32_t hash_length = sizeof(hash);
+
+               if (signature_helper_get_certificate_hash(pkg_name, hash, &hash_length) == 0)
+               {
+                       DEBUG_MSG("%s hash : { %02X %02X %02X %02X ... }", pkg_name, hash[0], hash[1], hash[2], hash[3]);
+                       for (i = 0; result == false && i < (sizeof(acls) / sizeof(gp_se_acl_h)); i++)
+                       {
+                               if (acls[i] != NULL)
+                               {
+                                       DEBUG_MSG("acl[%d] exists : %s", i, reader_get_name(readers[i]));
+                                       result = gp_se_acl_is_authorized_access(acls[i], aid, length, hash, hash_length);
+                                       DEBUG_MSG("result = %s", (result) ? "true" : "false");
+                               }
+                       }
+               }
+               else
+               {
+                       /* hash not found */
+                       DEBUG_ERR_MSG("hash doesn't exist : %s", pkg_name);
+               }
+       }
+
+       return result;
+}
+
+void net_nfc_util_access_control_release(void)
+{
+       int i;
+
+       for (i = 0; i < (sizeof(acls) / sizeof(gp_se_acl_h)); i++)
+       {
+               if (acls[i] != NULL)
+               {
+                       gp_se_acl_destroy_instance(acls[i]);
+                       acls[i] = NULL;
+               }
+       }
+
+       if (se_service != NULL)
+       {
+               se_service_destroy_instance(se_service);
+               se_service = NULL;
+               memset(readers, 0, sizeof(readers));
+               memset(sessions, 0, sizeof(sessions));
+               memset(channels, 0, sizeof(channels));
+       }
+
+       initialized = false;
+}
diff --git a/src/manager/resource/dbus_service.xml b/src/manager/resource/dbus_service.xml
deleted file mode 100644 (file)
index e220029..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<node name="/com/samsung/slp/nfc/manager">
-
-  <interface name="com.samsung.slp.nfc.manager">
-
-    <method name="Launch">
-      <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="dbus_service_launch"/>
-      <arg type="u" name="result_val" direction="out"/>
-    </method>
-
-    <method name="Se_only">
-      <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="dbus_service_se_only"/>
-      <arg type="u" name="result_val" direction="out"/>
-    </method>
-
-    <method name="Terminate">
-      <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="dbus_service_terminate"/>
-      <arg type="u" name="result_val" direction="out"/>
-    </method>
-
-  </interface>
-</node>
diff --git a/src/manager/resource/nfc-manager-config.txt.in b/src/manager/resource/nfc-manager-config.txt.in
deleted file mode 100644 (file)
index 93f928d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-# NFC MANAGER SERVER LLCP CONFIG AND OPTION
-
-[service]
-data_exchange_service=true
-data_exchange_client=true
-connection_handover_service=true
-
-[option]
-ADD=on
old mode 100644 (file)
new mode 100755 (executable)
index 703f9fd..bbc125f
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 #include <stdio.h>
 #include <stdlib.h>
 
diff --git a/test_clinet_app/ndef-tool/CMakeLists.txt b/test_clinet_app/ndef-tool/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a63967b
--- /dev/null
@@ -0,0 +1,51 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(ndef-tool C)
+
+SET(NDEF_TOOL "ndef-tool")
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../src/commonlib/include)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../src/clientlib/include)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/ TOOL_SRC)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+       SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(tool_pkgs REQUIRED glib-2.0 gobject-2.0)
+
+FOREACH(flag ${tool_pkgs_CFLAGS})
+       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+# this for NFC flag
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pipe -fomit-frame-pointer -Wall -Wno-trigraphs -Werror-implicit-function-declaration  -fno-strict-aliasing -Wl,-zdefs -fvisibility=hidden")
+
+SET(ARM_CFLAGS "${ARM_CLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -mno-thumb-interwork -msoft-float -Uarm -fno-common -fpic")
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+FIND_PROGRAM(UNAME NAMES uname)
+EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
+IF("${ARCH}" MATCHES "^arm.*")
+       ADD_DEFINITIONS("-DTARGET")
+       MESSAGE("add -DTARGET")
+       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARM_CFLAGS}")
+ENDIF()
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+ADD_EXECUTABLE(${NDEF_TOOL} ${TOOL_SRC})
+
+TARGET_LINK_LIBRARIES(${NDEF_TOOL} ${tool_pkgs_LDFLAGS} "-lpthread -lrt -pie -ldl" "-L${CMAKE_CURRENT_SOURCE_DIR}/../../cmake_tmp/src/clientlib -L${CMAKE_CURRENT_SOURCE_DIR}/../../cmake_tmp/src/commonlib" "-lnfc" "-lnfc-common-lib")
+
+
+INSTALL(TARGETS ${NDEF_TOOL} DESTINATION bin)
+
+
diff --git a/test_clinet_app/ndef-tool/ndef-tool-display.c b/test_clinet_app/ndef-tool/ndef-tool-display.c
new file mode 100755 (executable)
index 0000000..688a1d7
--- /dev/null
@@ -0,0 +1,464 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+  *
+  * 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 <stddef.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "net_nfc.h"
+#include "net_nfc_sign_record.h"
+#include "ndef-tool.h"
+
+typedef struct _net_nfc_sub_field_s
+{
+       uint16_t length;
+       uint8_t value[0];
+}
+__attribute__((packed)) net_nfc_sub_field_s;
+
+typedef struct _net_nfc_signature_record_s
+{
+       uint8_t version;
+       uint8_t sign_type : 7;
+       uint8_t uri_present : 1;
+       net_nfc_sub_field_s signature;
+}
+__attribute__((packed)) net_nfc_signature_record_s;
+
+typedef struct _net_nfc_certificate_chain_s
+{
+       uint8_t num_of_certs : 4;
+       uint8_t cert_format : 3;
+       uint8_t uri_present : 1;
+       uint8_t cert_store[0];
+}
+__attribute__((packed)) net_nfc_certificate_chain_s;
+
+static void _display_buffer(char *title, uint8_t *buffer, uint32_t length)
+{
+       int32_t i;
+
+       fprintf(stdout, " %s[%d] = {", title, length);
+
+       for (i = 0; i < length; i++)
+       {
+               if ((i % 16) == 0)
+                       fprintf(stdout, "\n");
+
+               if ((i % 8) == 0)
+                       fprintf(stdout, "  ");
+
+               fprintf(stdout, "%02X ", buffer[i]);
+       }
+
+       fprintf(stdout, "\n };\n");
+}
+
+static void _display_id(ndef_record_h record)
+{
+       data_h data = NULL;
+
+       net_nfc_get_record_id(record, &data);
+       if (net_nfc_get_data_length(data) > 0)
+       {
+               char temp_buffer[1024] = { 0, };
+
+               memcpy(temp_buffer, (void *)net_nfc_get_data_buffer(data), net_nfc_get_data_length(data));
+               fprintf(stdout, " ID string : %s\n", temp_buffer);
+       }
+}
+
+static void _display_signature(ndef_record_h record)
+{
+       data_h data = NULL;
+
+       _display_id(record);
+
+       net_nfc_get_record_payload(record, &data);
+       if (net_nfc_get_data_length(data) > 0)
+       {
+               int32_t i;
+               char temp_buffer[1024];
+               net_nfc_signature_record_s *sign = (net_nfc_signature_record_s *)net_nfc_get_data_buffer(data);
+
+               fprintf(stdout, " Version : %d\n", sign->version);
+               fprintf(stdout, " Signature URI present : %s\n", sign->uri_present ? "present" : "not present");
+
+               switch (sign->sign_type)
+               {
+               case NET_NFC_SIGN_TYPE_NO_SIGN :
+                       fprintf(stdout, " Signing method : Not signed (%d)\n", sign->sign_type);
+                       break;
+
+               case NET_NFC_SIGN_TYPE_PKCS_1 :
+                       fprintf(stdout, " Signing method : RSASSA-PSS with SHA1 (%d)\n", sign->sign_type);
+                       break;
+
+               case NET_NFC_SIGN_TYPE_PKCS_1_V_1_5 :
+                       fprintf(stdout, " Signing method : PKCS #1 v1.5 with SHA1 (%d)\n", sign->sign_type);
+                       break;
+
+               case NET_NFC_SIGN_TYPE_DSA :
+                       fprintf(stdout, " Signing method : DSA (%d)\n", sign->sign_type);
+                       break;
+
+               case NET_NFC_SIGN_TYPE_ECDSA :
+                       fprintf(stdout, " Signing method : ECDSA (%d)\n", sign->sign_type);
+                       break;
+
+               default :
+                       fprintf(stdout, " Signing method : Unknown (%d)\n", sign->sign_type);
+                       break;
+               }
+
+               if (sign->uri_present)
+               {
+                       memset(temp_buffer, 0, sizeof(temp_buffer));
+                       memcpy(temp_buffer, sign->signature.value, sign->signature.length);
+                       fprintf(stdout, " URI : %s\n", temp_buffer);
+               }
+               else
+               {
+                       _display_buffer("Signature", sign->signature.value, sign->signature.length);
+               }
+
+               net_nfc_certificate_chain_s *chain = (net_nfc_certificate_chain_s *)(sign->signature.value + sign->signature.length);
+               fprintf(stdout, " Cert. URI : %s\n", chain->uri_present ? "present" : "not present");
+
+               switch (chain->cert_format)
+               {
+               case NET_NFC_CERT_FORMAT_X_509 :
+                       fprintf(stdout, " Cert. format : X.509 (%d)\n", chain->cert_format);
+                       break;
+
+               case NET_NFC_CERT_FORMAT_X9_86 :
+                       fprintf(stdout, " Cert. format : X9.86 (%d)\n", chain->cert_format);
+                       break;
+
+               default :
+                       fprintf(stdout, " Cert. format : Unknown (%d)\n", chain->cert_format);
+                       break;
+               }
+
+               fprintf(stdout, " Cert. count : %d\n", chain->num_of_certs);
+
+               net_nfc_sub_field_s *field = NULL;
+
+               for (i = 0, field = (net_nfc_sub_field_s *)chain->cert_store; i < chain->num_of_certs; i++, field = (net_nfc_sub_field_s *)(field->value + field->length))
+               {
+                       memset(temp_buffer, 0, sizeof(temp_buffer));
+                       snprintf(temp_buffer, sizeof(temp_buffer), "Certificate %d", i);
+                       _display_buffer(temp_buffer, field->value, field->length);
+               }
+
+               if (chain->uri_present)
+               {
+                       memset(temp_buffer, 0, sizeof(temp_buffer));
+                       memcpy(temp_buffer, field->value, field->length);
+                       fprintf(stdout, " URI : %s\n", temp_buffer);
+               }
+       }
+}
+
+static void _display_smart_poster(ndef_record_h record)
+{
+       data_h data = NULL;
+
+       _display_id(record);
+
+       net_nfc_get_record_payload(record, &data);
+       if (net_nfc_get_data_length(data) > 0)
+       {
+               char temp_buffer[1024] = { 0, };
+
+               memcpy(temp_buffer, (void *)net_nfc_get_data_buffer(data), net_nfc_get_data_length(data));
+               fprintf(stdout, " Type string : %s (Signature)\n", temp_buffer);
+       }
+}
+
+static void _display_text(ndef_record_h record)
+{
+       data_h data = NULL;
+       net_nfc_encode_type_e encoding = 0;
+
+       _display_id(record);
+
+       net_nfc_get_encoding_type_from_text_record(record, &encoding);
+       switch (encoding)
+       {
+       case NET_NFC_ENCODE_UTF_8 :
+               fprintf(stdout, " Encoding : UTF-8\n");
+               break;
+
+       case NET_NFC_ENCODE_UTF_16 :
+               fprintf(stdout, " Encoding : UTF-16\n");
+               break;
+       }
+
+       net_nfc_get_record_payload(record, &data);
+       if (net_nfc_get_data_length(data) > 0)
+       {
+               uint8_t *buffer = net_nfc_get_data_buffer(data);
+               uint32_t length = net_nfc_get_data_length(data);
+               char temp_buffer[1024] = { 0, };
+               int code_length = buffer[0] & 0x3F;
+
+               memcpy(temp_buffer, buffer + 1, code_length);
+               fprintf(stdout, " Language code[%d] : %s\n", code_length, temp_buffer);
+
+               memset(temp_buffer, 0, sizeof(temp_buffer));
+
+               memcpy(temp_buffer, buffer + code_length + 1, length - code_length - 1);
+               fprintf(stdout, " Text[%d] : %s\n", length - code_length - 1, temp_buffer);
+       }
+}
+
+static void _display_uri(ndef_record_h record)
+{
+       data_h data = NULL;
+
+       _display_id(record);
+
+       net_nfc_get_record_payload(record, &data);
+       if (net_nfc_get_data_length(data) > 0)
+       {
+               uint8_t *buffer = net_nfc_get_data_buffer(data);
+               uint32_t length = net_nfc_get_data_length(data);
+               char temp_buffer[1024] = { 0, };
+               char *uri = NULL;
+
+               fprintf(stdout, " URI scheme : 0x%02X\n", buffer[0]);
+
+               memcpy(temp_buffer, buffer + 1, length - 1);
+               fprintf(stdout, " Raw URI payload[%d] : %s\n", length - 1, temp_buffer);
+
+               net_nfc_create_uri_string_from_uri_record(record, &uri);
+
+               fprintf(stdout, " Resolved URI[%d] : %s\n", strlen(uri), uri);
+       }
+}
+
+static void _display_well_known(ndef_record_h record)
+{
+       data_h data = NULL;
+
+       net_nfc_get_record_type(record, &data);
+       if (net_nfc_get_data_length(data) > 0)
+       {
+               uint8_t *buffer = net_nfc_get_data_buffer(data);
+               uint32_t length = net_nfc_get_data_length(data);
+               char temp_buffer[1024] = { 0, };
+
+               memcpy(temp_buffer, buffer, length);
+
+               if (strncmp(temp_buffer, "Sig", 3) == 0)
+               {
+                       fprintf(stdout, " Type string[%d] : %s (Signature)\n", length, temp_buffer);
+                       _display_signature(record);
+               }
+               else if (strncmp(temp_buffer, "Sp", 2) == 0)
+               {
+                       fprintf(stdout, " Type string[%d] : %s (Smart poster)\n", length, temp_buffer);
+                       _display_smart_poster(record);
+               }
+               else if (strncmp(temp_buffer, "Gc", 2) == 0)
+               {
+                       fprintf(stdout, " Type string[%d] : %s (General control)\n", length, temp_buffer);
+               }
+               else if (strncmp(temp_buffer, "U", 1) == 0)
+               {
+                       fprintf(stdout, " Type string[%d] : %s (URI)\n", length, temp_buffer);
+                       _display_uri(record);
+               }
+               else if (strncmp(temp_buffer, "T", 1) == 0)
+               {
+                       fprintf(stdout, " Type string[%d] : %s (Text)\n", length, temp_buffer);
+                       _display_text(record);
+               }
+               else
+               {
+                       fprintf(stdout, " Type string[%d] : %s (Unknown)\n", length, temp_buffer);
+               }
+       }
+}
+
+static void _display_general_record(ndef_record_h record)
+{
+       data_h data = NULL;
+
+       net_nfc_get_record_type(record, &data);
+       if (net_nfc_get_data_length(data) > 0)
+       {
+               uint8_t *buffer = net_nfc_get_data_buffer(data);
+               uint32_t length = net_nfc_get_data_length(data);
+               char temp_buffer[1024] = { 0, };
+
+               memcpy(temp_buffer, buffer, length);
+
+               fprintf(stdout, " Type string[%d] : %s\n", length, temp_buffer);
+       }
+
+       _display_id(record);
+
+       net_nfc_get_record_payload(record, &data);
+       if (net_nfc_get_data_length(data) > 0)
+       {
+               uint32_t length = net_nfc_get_data_length(data);
+               uint8_t temp_buffer[512] = { 0, };
+
+               if (length > sizeof(temp_buffer))
+               {
+                       memcpy(temp_buffer, net_nfc_get_data_buffer(data), sizeof(temp_buffer));
+
+                       fprintf(stdout, " Real payload length : %d\n", length);
+                       _display_buffer("Abb. payload", temp_buffer, sizeof(temp_buffer));
+               }
+               else
+               {
+                       _display_buffer("Payload", net_nfc_get_data_buffer(data), length);
+               }
+       }
+}
+
+static void _display_absolute_uri(ndef_record_h record)
+{
+       data_h data = NULL;
+
+       _display_id(record);
+
+       net_nfc_get_record_type(record, &data);
+       if (net_nfc_get_data_length(data) > 0)
+       {
+               uint8_t *buffer = net_nfc_get_data_buffer(data);
+               uint32_t length = net_nfc_get_data_length(data);
+               char temp_buffer[2048] = { 0, };
+
+               memcpy(temp_buffer, buffer, length);
+
+               fprintf(stdout, " URI[%d] : %s\n", length, temp_buffer);
+       }
+#if 0
+       nfc_ndef_record_get_payload(record, &buffer, &length);
+       if (length > 0)
+       {
+               char temp_buffer[512] = { 0, };
+
+               if (length > sizeof(temp_buffer))
+               {
+                       memcpy(temp_buffer, buffer, sizeof(temp_buffer));
+
+                       fprintf(stdout, " Real payload length : %d\n", length);
+                       _display_buffer("Abb. payload", temp_buffer, sizeof(temp_buffer));
+               }
+               else
+               {
+                       _display_buffer("Payload", temp_buffer, length);
+               }
+       }
+#endif
+}
+
+static void _display_tnf(ndef_record_h record)
+{
+       net_nfc_record_tnf_e tnf = NET_NFC_RECORD_UNKNOWN;
+
+       net_nfc_get_record_tnf(record, &tnf);
+
+       switch (tnf)
+       {
+       case NET_NFC_RECORD_EMPTY :
+               fprintf(stdout, " TNF : Empty (%d)\n", tnf);
+               break;
+
+       case NET_NFC_RECORD_WELL_KNOWN_TYPE :
+               fprintf(stdout, " TNF : Well-known (%d)\n", tnf);
+               _display_well_known(record);
+               break;
+
+       case NET_NFC_RECORD_MIME_TYPE :
+               fprintf(stdout, " TNF : MIME (%d)\n", tnf);
+               _display_general_record(record);
+               break;
+
+       case NET_NFC_RECORD_URI :
+               fprintf(stdout, " TNF : Absolute URI (%d)\n", tnf);
+               _display_absolute_uri(record);
+               break;
+
+       case NET_NFC_RECORD_EXTERNAL_RTD :
+               fprintf(stdout, " TNF : External (%d)\n", tnf);
+               _display_general_record(record);
+               break;
+
+       case NET_NFC_RECORD_UNKNOWN :
+               fprintf(stdout, " TNF : Unknown (%d)\n", tnf);
+               _display_general_record(record);
+               break;
+
+       case NET_NFC_RECORD_UNCHAGNED :
+               fprintf(stdout, " TNF : Unchanged (%d)\n", tnf);
+               _display_general_record(record);
+               break;
+
+       default :
+               fprintf(stdout, " Invalid TNF\n");
+               break;
+       }
+}
+
+static void _display_record(ndef_record_h record)
+{
+       uint8_t header;
+
+       net_nfc_get_record_flags(record, &header);
+
+       fprintf(stdout, " MB[%d], ME[%d], CF[%d], SR[%d], IL[%d]\n", net_nfc_get_record_mb(header), net_nfc_get_record_me(header),
+               net_nfc_get_record_cf(header), net_nfc_get_record_sr(header), net_nfc_get_record_il(header));
+
+       _display_tnf(record);
+}
+
+void ndef_tool_display_ndef_message_from_file(const char *file_name)
+{
+       ndef_message_h msg = NULL;
+
+       if (ndef_tool_read_ndef_message_from_file(file_name, &msg) == 0)
+       {
+               int32_t count = 0;
+               int32_t i = 0;
+               ndef_record_h record = NULL;
+
+               net_nfc_get_ndef_message_record_count(msg, &count);
+
+               fprintf(stdout, "\n=========== ndef message begin ===========\n");
+
+               for (i = 0; i < count; i++)
+               {
+                       net_nfc_get_record_by_index(msg, i, &record);
+
+                       fprintf(stdout, "------------- ndef record %02d -------------\n", i);
+                       _display_record(record);
+                       fprintf(stdout, "------------------------------------------\n");
+               }
+               fprintf(stdout, "============ ndef message end ============\n\n");
+
+               net_nfc_free_ndef_message(msg);
+       }
+}
diff --git a/test_clinet_app/ndef-tool/ndef-tool-sign.c b/test_clinet_app/ndef-tool/ndef-tool-sign.c
new file mode 100755 (executable)
index 0000000..e844883
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+  *
+  * 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 <stddef.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "net_nfc.h"
+#include "net_nfc_sign_record.h"
+#include "ndef-tool.h"
+
+bool ndef_tool_sign_message_from_file(const char *file_name, int begin_index, int end_index, char *cert_file, char *password)
+{
+       bool result = false;
+       ndef_message_h msg = NULL;
+       int32_t count = 0;
+
+       if (ndef_tool_read_ndef_message_from_file(file_name, &msg) == 0)
+       {
+               net_nfc_get_ndef_message_record_count(msg, &count);
+
+               if (count > end_index)
+               {
+                       fprintf(stdout, "count : %d\n", count);
+
+                       net_nfc_sign_records(msg, begin_index, end_index, cert_file, password);
+
+                       ndef_tool_write_ndef_message_to_file(file_name, msg);
+
+                       result = true;
+               }
+
+               net_nfc_free_ndef_message(msg);
+       }
+
+       return result;
+}
+
+bool ndef_tool_verify_message_from_file(const char *file_name)
+{
+       bool result = false;
+       ndef_message_h msg = NULL;
+
+       if (ndef_tool_read_ndef_message_from_file(file_name, &msg) == 0)
+       {
+               result = (net_nfc_verify_signature_ndef_message(msg) == 0);
+
+               net_nfc_free_ndef_message(msg);
+       }
+
+       return result;
+}
diff --git a/test_clinet_app/ndef-tool/ndef-tool-tag.c b/test_clinet_app/ndef-tool/ndef-tool-tag.c
new file mode 100755 (executable)
index 0000000..7e9f7c8
--- /dev/null
@@ -0,0 +1,292 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+  *
+  * 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 <stddef.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <glib.h>
+
+#include "net_nfc.h"
+#include "net_nfc_exchanger.h"
+#include "ndef-tool.h"
+
+typedef struct _response_context_t
+{
+       int type;
+       void *user_param;
+} response_context_t;
+
+GMainLoop *main_loop = NULL;
+response_context_t response_context = { 0, };
+
+static void _tag_read_completed_cb(ndef_message_h msg, void *user_data)
+{
+       response_context_t *context = (response_context_t *)user_data;
+
+       fprintf(stdout, "tag read complete!!!\n\n");
+       if (msg != NULL)
+       {
+               ndef_tool_write_ndef_message_to_file((char *)context->user_param, msg);
+
+               ndef_tool_display_ndef_message_from_file((char *)context->user_param);
+       }
+
+       g_main_loop_quit(main_loop);
+}
+
+static void _tag_read_cb(net_nfc_target_handle_h handle, void *user_data)
+{
+       fprintf(stdout, "target tag discovered!!!\n\n");
+       fprintf(stdout, "reading...\n");
+
+       net_nfc_read_tag(handle, user_data);
+}
+
+static void _tag_write_completed_cb(net_nfc_error_e result, void *user_data)
+{
+       if (result == NET_NFC_OK)
+               fprintf(stdout, "write success!!!\n\n");
+       else
+               fprintf(stdout, "write failed.\n\n");
+
+       g_main_loop_quit(main_loop);
+}
+
+static void _tag_write_cb(net_nfc_target_handle_h handle, void *user_data)
+{
+       response_context_t *context = (response_context_t *)user_data;
+
+       fprintf(stdout, "target tag discovered!!!\n\n");
+       fprintf(stdout, "writing...\n");
+
+       net_nfc_write_ndef(handle, (ndef_message_h)context->user_param, user_data);
+}
+
+static void _p2p_receive_completed_cb(data_h data, void *user_data)
+{
+       response_context_t *context = (response_context_t *)user_data;
+
+       fprintf(stdout, "p2p receive complete!!!\n\n");
+       if (data != NULL)
+       {
+               ndef_message_h msg;
+
+               net_nfc_create_ndef_message_from_rawdata(&msg, data);
+
+               ndef_tool_write_ndef_message_to_file((char *)context->user_param, msg);
+
+               net_nfc_free_ndef_message(msg);
+
+               ndef_tool_display_ndef_message_from_file((char *)context->user_param);
+       }
+
+       g_main_loop_quit(main_loop);
+}
+
+static void _p2p_send_completed_cb(net_nfc_error_e result, void *user_data)
+{
+       if (result == NET_NFC_OK)
+               fprintf(stdout, "send success!!!\n\n");
+       else
+               fprintf(stdout, "send failed.\n\n");
+
+       g_main_loop_quit(main_loop);
+}
+
+static void _p2p_send_cb(net_nfc_target_handle_h handle, void *user_data)
+{
+       response_context_t *context = (response_context_t *)user_data;
+
+       fprintf(stdout, "target device discovered!!!\n\n");
+       fprintf(stdout, "sending...\n");
+
+       net_nfc_exchanger_data_h data_handle;
+       data_h rawdata;
+
+       net_nfc_create_rawdata_from_ndef_message((ndef_message_h)context->user_param, &rawdata);
+       net_nfc_create_exchanger_data(&data_handle,  rawdata);
+       net_nfc_free_data(rawdata);
+
+       net_nfc_send_exchanger_data(data_handle, handle);
+       net_nfc_free_exchanger_data(data_handle);
+}
+
+void _nfc_response_cb(net_nfc_message_e message, net_nfc_error_e result, void *data, void *user_param, void *trans_data)
+{
+       response_context_t *context = (response_context_t *)user_param;
+
+       switch (message)
+       {
+       case NET_NFC_MESSAGE_TAG_DISCOVERED :
+               {
+                       net_nfc_target_handle_h handle = NULL;
+
+                       net_nfc_get_tag_handle((net_nfc_target_info_h)data, &handle);
+
+                       if (context->type == 0) /* read */
+                       {
+                               _tag_read_cb(handle, user_param);
+                       }
+                       else
+                       {
+                               _tag_write_cb(handle, user_param);
+                       }
+               }
+               break;
+
+       case NET_NFC_MESSAGE_READ_NDEF :
+               _tag_read_completed_cb((ndef_message_h)data, user_param);
+               break;
+
+       case NET_NFC_MESSAGE_WRITE_NDEF :
+               _tag_write_completed_cb(result, user_param);
+               break;
+
+       case NET_NFC_MESSAGE_P2P_DISCOVERED :
+               if (context->type == 1) /* receive */
+               {
+                       _p2p_send_cb((net_nfc_target_handle_h)data, user_param);
+               }
+               break;
+
+       case NET_NFC_MESSAGE_P2P_SEND :
+               _p2p_send_completed_cb(result, user_param);
+               break;
+
+       case NET_NFC_MESSAGE_P2P_RECEIVE :
+               _p2p_receive_completed_cb(data, user_param);
+               break;
+
+       default :
+               break;
+       }
+}
+
+static void _initialize_tag_context(response_context_t *context)
+{
+       if(!g_thread_supported())
+       {
+               g_thread_init(NULL);
+       }
+
+//     g_type_init();
+
+       net_nfc_initialize();
+
+       net_nfc_set_response_callback(_nfc_response_cb, (void *)context);
+}
+
+static void _run_tag_action()
+{
+       main_loop = g_main_new(TRUE);
+       g_main_loop_run(main_loop);
+}
+
+static void _release_tag_context(void)
+{
+       net_nfc_unset_response_callback();
+
+       net_nfc_deinitialize();
+}
+
+int ndef_tool_read_ndef_from_tag(const char *file)
+{
+       int result = 0;
+
+       response_context.type = 0;
+       response_context.user_param = (void *)file;
+
+       _initialize_tag_context(&response_context);
+
+       fprintf(stdout, "Contact a tag to device.....\n");
+
+       _run_tag_action();
+
+       _release_tag_context();
+
+       return result;
+}
+
+int ndef_tool_receive_ndef_via_p2p(const char *file)
+{
+       int result = 0;
+
+       response_context.type = 0;
+       response_context.user_param = (void *)file;
+
+       _initialize_tag_context(&response_context);
+
+       fprintf(stdout, "Contact a tag to device.....\n");
+
+       _run_tag_action();
+
+       _release_tag_context();
+
+       return result;
+}
+
+int ndef_tool_write_ndef_to_tag(const char *file)
+{
+       int result = 0;
+       ndef_message_h msg = NULL;
+
+       if (ndef_tool_read_ndef_message_from_file(file, &msg) == 0)
+       {
+               response_context.type = 1;
+               response_context.user_param = (void *)msg;
+
+               _initialize_tag_context(&response_context);
+
+               fprintf(stdout, "Contact a tag to device.....\n");
+
+               _run_tag_action();
+
+               net_nfc_free_ndef_message(msg);
+
+               _release_tag_context();
+       }
+
+       return result;
+}
+
+int ndef_tool_send_ndef_via_p2p(const char *file)
+{
+       int result = 0;
+       ndef_message_h msg = NULL;
+
+       if (ndef_tool_read_ndef_message_from_file(file, &msg) == 0)
+       {
+               response_context.type = 1;
+               response_context.user_param = (void *)msg;
+
+               _initialize_tag_context(&response_context);
+
+               fprintf(stdout, "Contact a tag to device.....\n");
+
+               _run_tag_action();
+
+               net_nfc_free_ndef_message(msg);
+
+               _release_tag_context();
+       }
+
+       return result;
+}
+
diff --git a/test_clinet_app/ndef-tool/ndef-tool.c b/test_clinet_app/ndef-tool/ndef-tool.c
new file mode 100755 (executable)
index 0000000..b965a46
--- /dev/null
@@ -0,0 +1,540 @@
+/*
+  * Copyright 2012  Samsung Electronics Co., Ltd
+  *
+  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
+  *
+  * 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 <stddef.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "net_nfc.h"
+#include "ndef-tool.h"
+
+void _on_completed_cb(net_nfc_error_e error, void *user_data)
+{
+       if (error == NET_NFC_OK)
+               fprintf(stdout, "power on success\n\n");
+       else
+               fprintf(stdout, "failed to power on (%d)\n\n", error);
+}
+
+void _off_completed_cb(net_nfc_error_e error, void *user_data)
+{
+       if (error == NET_NFC_OK)
+               fprintf(stdout, "power off success\n\n");
+       else
+               fprintf(stdout, "failed to power off (%d)\n\n", error);
+}
+
+int ndef_tool_read_ndef_message_from_file(const char *file_name, ndef_message_h *msg)
+{
+       int result = -1;
+       FILE *file = NULL;
+
+       file = fopen(file_name, "rb");
+       if (file != NULL)
+       {
+               long int file_size = 0;
+               fseek(file, 0, SEEK_END);
+               file_size = ftell(file);
+               fseek(file, 0, SEEK_SET);
+
+               if (file_size > 0)
+               {
+                       data_h data;
+
+                       net_nfc_create_data(&data, NULL, file_size);
+                       if (data != NULL)
+                       {
+                               fread((void *)net_nfc_get_data_buffer(data), 1, file_size, file);
+
+                               net_nfc_create_ndef_message_from_rawdata(msg, data);
+
+                               net_nfc_free_data(data);
+
+                               result = 0;
+                       }
+               }
+
+               fclose(file);
+       }
+
+       return result;
+}
+
+int ndef_tool_write_ndef_message_to_file(const char *file_name, ndef_message_h msg)
+{
+       int result = -1;
+       FILE *file = NULL;
+       data_h data = NULL;
+
+       net_nfc_create_rawdata_from_ndef_message(msg, &data);
+       if (data != NULL)
+       {
+               file = fopen(file_name, "wb");
+               if (file != NULL)
+               {
+                       fwrite((void *)net_nfc_get_data_buffer(data), 1, net_nfc_get_data_length(data), file);
+                       fflush(file);
+                       fclose(file);
+
+                       result = 0;
+               }
+
+               net_nfc_free_data(data);
+       }
+
+       return result;
+}
+
+static void print_usage(char *file_name)
+{
+       fprintf(stdout, "Usage : %s OPERATION [OPTION]... FILE\n", file_name);
+       fprintf(stdout, "\n");
+       fprintf(stdout, "  Operation\n");
+       fprintf(stdout, "    -a, --append-record          Append a record to file\n");
+       fprintf(stdout, "    Options\n");
+       fprintf(stdout, "      -t, --tnf tnf              Input TNF value\n");
+       fprintf(stdout, "                                 (WKT : Well-known, EXT : External, \n");
+       fprintf(stdout, "                                  MIME : MIME-type, URI : Absolute-URI)\n");
+       fprintf(stdout, "      -T, --type-data data       Input Type-field data\n");
+       fprintf(stdout, "      -I, --id-data data         Input ID-field data\n");
+       fprintf(stdout, "      -P, --payload-data data    Input Payload-field data\n");
+       fprintf(stdout, "      -E, --encoding data        Input encoding method of Well-known Text type record\n");
+       fprintf(stdout, "\n");
+       fprintf(stdout, "    -r, --remove-record          Remove a specific record from file\n");
+       fprintf(stdout, "    Options\n");
+       fprintf(stdout, "      -i, --index value          Input a record index\n");
+       fprintf(stdout, "\n");
+       fprintf(stdout, "    -d, --display                Display all records in file\n");
+       fprintf(stdout, "    -s, --sign-records           Sign some continuous records in file\n");
+       fprintf(stdout, "    Options\n");
+       fprintf(stdout, "      -b, --begin-index value    Input a beginning record index\n");
+       fprintf(stdout, "      -e, --end-index value      Input a last record index\n");
+       fprintf(stdout, "      -c, --cert-file file       Input a PKCS #12 certificate file (DER file, not PEM file)\n");
+       fprintf(stdout, "      -p, --password pass        Input a password ofPKCS #12 certificate file\n");
+       fprintf(stdout, "\n");
+       fprintf(stdout, "    -v, --verify-signed-records  Verify signature in file\n");
+       fprintf(stdout, "        --read-tag               Read a ndef from tag and store to file\n");
+       fprintf(stdout, "        --write-tag              Write a ndef file to tag\n");
+       fprintf(stdout, "        --receive-ndef           Receive a ndef from target device and store to file\n");
+       fprintf(stdout, "        --send-ndef              Send a ndef file to target device\n");
+       fprintf(stdout, "\n");
+       fprintf(stdout, "    -h, --help                   Show this help messages\n");
+       fprintf(stdout, "\n");
+}
+
+static net_nfc_record_tnf_e _parse_tnf_string(const char *tnf)
+{
+       net_nfc_record_tnf_e result = -1;
+
+       if (tnf == NULL)
+               return result;
+
+       if (strncasecmp(tnf, "EMT", 3) == 0)
+       {
+               result = NET_NFC_RECORD_EMPTY;
+       }
+       else if (strncasecmp(tnf, "WKT", 3) == 0)
+       {
+               result = NET_NFC_RECORD_WELL_KNOWN_TYPE;
+       }
+       else if (strncasecmp(tnf, "MIME", 4) == 0)
+       {
+               result = NET_NFC_RECORD_MIME_TYPE;
+       }
+       else if (strncasecmp(tnf, "URI", 3) == 0)
+       {
+               result = NET_NFC_RECORD_URI;
+       }
+       else if (strncasecmp(tnf, "EXT", 3) == 0)
+       {
+               result = NET_NFC_RECORD_EXTERNAL_RTD;
+       }
+       else if (strncasecmp(tnf, "UNK", 3) == 0)
+       {
+               result = NET_NFC_RECORD_UNKNOWN;
+       }
+       else if (strncasecmp(tnf, "UNC", 3) == 0)
+       {
+               result = NET_NFC_RECORD_UNCHAGNED;
+       }
+
+       return result;
+}
+
+static int _append_record_to_file(const char *file_name, ndef_record_h record)
+{
+       int result = -1;
+       ndef_message_h msg = NULL;
+
+       if (ndef_tool_read_ndef_message_from_file(file_name, &msg) != 0)
+       {
+               net_nfc_create_ndef_message(&msg);
+       }
+
+       net_nfc_append_record_to_ndef_message(msg, record);
+
+       ndef_tool_write_ndef_message_to_file(file_name, msg);
+
+       net_nfc_free_ndef_message(msg);
+
+       result = 0;
+
+       return result;
+}
+
+ndef_record_h _create_record(net_nfc_record_tnf_e tnf, data_h type, data_h id , data_h payload, char *encoding)
+{
+       ndef_record_h result = NULL;
+
+       switch (tnf)
+       {
+       case NET_NFC_RECORD_WELL_KNOWN_TYPE :
+               if (net_nfc_get_data_length(type) == 1 && memcmp((void *)net_nfc_get_data_buffer(type), "T", 1) == 0)
+               {
+                       if (encoding == NULL)
+                       {
+                               fprintf(stdout, "encoding type is not present.\n");
+                               return result;
+                       }
+
+                       char *temp_str = calloc(1, net_nfc_get_data_length(payload) + 1);
+                       memcpy(temp_str, (void *)net_nfc_get_data_buffer(payload), net_nfc_get_data_length(payload));
+
+                       net_nfc_create_text_type_record(&result, temp_str, encoding, NET_NFC_ENCODE_UTF_8);
+                       if (id != NULL)
+                       {
+                               net_nfc_set_record_id(result, id);
+                       }
+               }
+               else if (net_nfc_get_data_length(type) == 1 && memcmp((void *)net_nfc_get_data_buffer(type), "U", 1) == 0)
+               {
+                       char *temp_str = calloc(1, net_nfc_get_data_length(payload) + 1);
+                       memcpy(temp_str, (void *)net_nfc_get_data_buffer(payload), net_nfc_get_data_length(payload));
+
+                       net_nfc_create_uri_type_record(&result, temp_str, 0);
+                       if (id != NULL)
+                       {
+                               net_nfc_set_record_id(result, id);
+                       }
+               }
+               else
+               {
+                       net_nfc_create_record(&result, tnf, type, id, payload);
+               }
+               break;
+
+       default :
+               net_nfc_create_record(&result, tnf, type, id, payload);
+               break;
+       }
+
+       return result;
+}
+
+bool _remove_record_from_file(const char *file_name, int index)
+{
+       bool result = false;
+       ndef_message_h msg = NULL;
+
+       if (ndef_tool_read_ndef_message_from_file(file_name, &msg) == 0)
+       {
+               net_nfc_remove_record_by_index(msg, index);
+
+               ndef_tool_write_ndef_message_to_file(file_name, msg);
+
+               net_nfc_free_ndef_message(msg);
+
+               result = true;
+       }
+
+       return result;
+}
+
+#define __IS_SHORT_OPTION(__dst) ((strlen(__dst) == 2) && ((__dst)[0] == '-'))
+#define __IS_LONG_OPTION(__dst) ((strlen(__dst) > 2) && ((__dst)[0] == '-') && ((__dst)[1] == '-'))
+#define __IS_OPTION(__dst) (__IS_SHORT_OPTION(__dst) || __IS_LONG_OPTION(__dst))
+
+#define __COMPARE_OPTION(__dst, __s, __l) \
+       ((__IS_SHORT_OPTION(__dst) && ((__dst)[1] == (__s))) || \
+       (__IS_LONG_OPTION(__dst) && (strcmp((__dst) + 2, (__l)) == 0)))
+
+#define __DO_NEXT_ARG \
+               if (++i >= argc || __IS_OPTION(argv[i]) == true) \
+               { \
+                       operation = OPERATION_ERROR; \
+                       break; \
+               }
+
+int main(int argc, char *argv[])
+{
+       int remove_index = -1;
+       int begin_index = -1;
+       int end_index = -1;
+       int operation = OPERATION_ERROR;
+       net_nfc_record_tnf_e tnf = -1;
+       data_h type = NULL;
+       data_h id = NULL;
+       data_h payload = NULL;
+       char *file_name = NULL;
+       char *cert_file = NULL;
+       char *password = NULL;
+       char *encoding = NULL;
+       ndef_record_h record = NULL;
+
+       int i = 1;
+       int len = 0;
+
+       for (i = 1; i < argc; i++)
+       {
+               if (__COMPARE_OPTION(argv[i], 'a', "append-record"))
+               {
+                       operation = OPERATION_APPEND;
+               }
+               else if (__COMPARE_OPTION(argv[i], 's', "sign-records"))
+               {
+                       operation = OPERATION_SIGN;
+               }
+               else if (__COMPARE_OPTION(argv[i], 'd', "display-record"))
+               {
+                       operation = OPERATION_DISPLAY;
+               }
+               else if (__COMPARE_OPTION(argv[i], 'v', "verify-signed-records"))
+               {
+                       operation = OPERATION_VERIFY;
+               }
+               else if (__COMPARE_OPTION(argv[i], 'r', "remove-record"))
+               {
+                       operation = OPERATION_REMOVE;
+               }
+               else if (__COMPARE_OPTION(argv[i], 0, "read-tag"))
+               {
+                       operation = OPERATION_READ_TAG;
+               }
+               else if (__COMPARE_OPTION(argv[i], 0, "write-tag"))
+               {
+                       operation = OPERATION_WRITE_TAG;
+               }
+               else if (__COMPARE_OPTION(argv[i], 0, "receive-ndef"))
+               {
+                       operation = OPERATION_RECEIVE_NDEF;
+               }
+               else if (__COMPARE_OPTION(argv[i], 0, "send-ndef"))
+               {
+                       operation = OPERATION_SEND_NDEF;
+               }
+               else if (__COMPARE_OPTION(argv[i], 0, "off")) /* hidden operation */
+               {
+                       operation = OPERATION_OFF;
+               }
+               else if (__COMPARE_OPTION(argv[i], 0, "on")) /* hidden operation */
+               {
+                       operation = OPERATION_ON;
+               }
+               else if (__COMPARE_OPTION(argv[i], 'i', "record-index"))
+               {
+                       __DO_NEXT_ARG;
+                       remove_index = atoi(argv[i]);
+               }
+               else if (__COMPARE_OPTION(argv[i], 'c', "cert-file"))
+               {
+                       __DO_NEXT_ARG;
+                       cert_file = strdup(argv[i]);
+               }
+               else if (__COMPARE_OPTION(argv[i], 'p', "password"))
+               {
+                       __DO_NEXT_ARG;
+                       password = strdup(argv[i]);
+               }
+               else if (__COMPARE_OPTION(argv[i], 'b', "begin-index"))
+               {
+                       __DO_NEXT_ARG;
+                       begin_index = atoi(argv[i]);
+               }
+               else if (__COMPARE_OPTION(argv[i], 'e', "end-index"))
+               {
+                       __DO_NEXT_ARG;
+                       end_index = atoi(argv[i]);
+               }
+               else if (__COMPARE_OPTION(argv[i], 't', "tnf"))
+               {
+                       __DO_NEXT_ARG;
+                       tnf = _parse_tnf_string(argv[i]);
+               }
+               else if (__COMPARE_OPTION(argv[i], 'T', "type-data"))
+               {
+                       __DO_NEXT_ARG;
+                       len = strlen(argv[i]);
+                       if (len > 0)
+                       {
+                               net_nfc_create_data(&type, (const uint8_t *)argv[i], len);
+                       }
+               }
+               else if (__COMPARE_OPTION(argv[i], 'I', "id-data"))
+               {
+                       __DO_NEXT_ARG;
+                       len = strlen(argv[i]);
+                       if (len > 0)
+                       {
+                               net_nfc_create_data(&id, (const uint8_t *)argv[i], len);
+                       }
+               }
+               else if (__COMPARE_OPTION(argv[i], 'P', "payload-data"))
+               {
+                       __DO_NEXT_ARG;
+                       len = strlen(argv[i]);
+                       if (len > 0)
+                       {
+                               net_nfc_create_data(&payload, (const uint8_t *)argv[i], len);
+                       }
+               }
+               else if (__COMPARE_OPTION(argv[i], 'E', "encoding"))
+               {
+                       __DO_NEXT_ARG;
+                       encoding = strdup(argv[i]);
+               }
+               else if (__COMPARE_OPTION(argv[i], 'h', "help"))
+               {
+                       operation = OPERATION_ERROR;
+                       break;
+               }
+               else
+               {
+                       if (file_name == NULL)
+                       {
+                               file_name = strdup(argv[i]);
+                       }
+                       else
+                       {
+                               operation = OPERATION_ERROR;
+                               break;
+                       }
+               }
+       }
+
+       if (operation != OPERATION_ON && operation != OPERATION_OFF && file_name == NULL)
+               operation = OPERATION_ERROR;
+
+       switch (operation)
+       {
+       case OPERATION_DISPLAY :
+               ndef_tool_display_ndef_message_from_file(file_name);
+               break;
+
+       case OPERATION_APPEND :
+               if (tnf >= 0 && type != NULL)
+               {
+                       record = _create_record(tnf, type, id, payload, encoding);
+
+                       if (record != NULL)
+                       {
+                               _append_record_to_file(file_name, record);
+                       }
+                       else
+                       {
+                               print_usage(argv[0]);
+                       }
+               }
+               else
+               {
+                       print_usage(argv[0]);
+               }
+               break;
+
+       case OPERATION_REMOVE :
+               _remove_record_from_file(file_name, remove_index);
+               break;
+
+       case OPERATION_SIGN :
+               if (begin_index < 0 || end_index < 0 || begin_index > end_index || cert_file == NULL || password == NULL)
+               {
+                       print_usage(argv[0]);
+               }
+               else
+               {
+                       fprintf(stdout, "file : %s\ncert file : %s\npassword : %s\nbegin index : %d\nend index : %d\n", file_name, cert_file, password, begin_index, end_index);
+                       ndef_tool_sign_message_from_file(file_name, begin_index, end_index, cert_file, password);
+               }
+               break;
+
+       case OPERATION_VERIFY :
+               fprintf(stdout, "verify %s\n", ndef_tool_verify_message_from_file(file_name) ? "success" : "failed");
+               break;
+
+       case OPERATION_READ_TAG :
+               ndef_tool_read_ndef_from_tag(file_name);
+               break;
+
+       case OPERATION_WRITE_TAG :
+               ndef_tool_write_ndef_to_tag(file_name);
+               break;
+
+       case OPERATION_RECEIVE_NDEF :
+               ndef_tool_receive_ndef_via_p2p(file_name);
+               break;
+
+       case OPERATION_SEND_NDEF :
+               ndef_tool_send_ndef_via_p2p(file_name);
+               break;
+
+       case OPERATION_ON :
+               {
+                       int state = 0;
+
+                       net_nfc_get_state(&state);
+
+                       if (state == 0)
+                       {
+                               fprintf(stdout, "Power on....\n\n");
+                               net_nfc_set_state(1, _on_completed_cb);
+                       }
+                       else
+                       {
+                               fprintf(stdout, "Already power is on.\n\n");
+                       }
+               }
+               break;
+
+       case OPERATION_OFF :
+               {
+                       int state = 0;
+
+                       net_nfc_get_state(&state);
+
+                       if (state == 1)
+                       {
+                               fprintf(stdout, "Power off....\n\n");
+                               net_nfc_set_state(0, _off_completed_cb);
+                       }
+                       else
+                       {
+                               fprintf(stdout, "Already power is off.\n\n");
+                       }
+               }
+               break;
+
+       case OPERATION_ERROR :
+       default :
+               print_usage(argv[0]);
+               break;
+       }
+
+       return 0;
+}
+
diff --git a/test_clinet_app/ndef-tool/ndef-tool.h b/test_clinet_app/ndef-tool/ndef-tool.h
new file mode 100755 (executable)
index 0000000..5a66fa3
--- /dev/null
@@ -0,0 +1,56 @@
+/*\r
+  * Copyright 2012  Samsung Electronics Co., Ltd\r
+  *\r
+  * Licensed under the Flora License, Version 1.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.tizenopensource.org/license\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
+#ifndef __NDEF_TOOL_H\r
+#define __NDEF_TOOL_H\r
+\r
+#include "net_nfc_typedef.h"\r
+\r
+enum\r
+{\r
+       OPERATION_ERROR,\r
+       OPERATION_DISPLAY,\r
+       OPERATION_APPEND,\r
+       OPERATION_REMOVE,\r
+       OPERATION_SIGN,\r
+       OPERATION_VERIFY,\r
+       OPERATION_READ_TAG,\r
+       OPERATION_WRITE_TAG,\r
+       OPERATION_RECEIVE_NDEF,\r
+       OPERATION_SEND_NDEF,\r
+       OPERATION_ON, /* hidden operation */\r
+       OPERATION_OFF, /* hidden operation */\r
+};\r
+\r
+int ndef_tool_read_ndef_message_from_file(const char *file_name, ndef_message_h *msg);\r
+int ndef_tool_write_ndef_message_to_file(const char *file_name, ndef_message_h msg);\r
+\r
+void ndef_tool_display_ndef_message_from_file(const char *file_name);\r
+\r
+bool ndef_tool_sign_message_from_file(const char *file_name, int begin_index, int end_index, char *cert_file, char *password);\r
+bool ndef_tool_verify_message_from_file(const char *file_name);\r
+\r
+int ndef_tool_read_ndef_from_tag(const char *file);\r
+int ndef_tool_write_ndef_to_tag(const char *file);\r
+int ndef_tool_receive_ndef_via_p2p(const char *file);\r
+int ndef_tool_send_ndef_via_p2p(const char *file);\r
+\r
+\r
+\r
+\r
+#endif /* __NDEF_TOOL_H */\r
+\r
old mode 100644 (file)
new mode 100755 (executable)
index eb0bd01..9e8782a
@@ -14,6 +14,7 @@
   * limitations under the License.
   */
 
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <net_nfc_typedef.h>
old mode 100644 (file)
new mode 100755 (executable)
index a6196c1..ede6da3
@@ -14,6 +14,7 @@
   * limitations under the License.\r
   */\r
 \r
+\r
 #ifndef __NET_NFC_TEST_H__\r
 #define __NET_NFC_TEST_H__\r
 \r