-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.\r
+Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.\r
\r
Apache License\r
Version 2.0, January 2004\r
--- /dev/null
+#!/bin/sh
+
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
--- /dev/null
+#!/bin/sh
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
--- /dev/null
+#!/bin/sh
+
+. ./_export_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
--- /dev/null
+#!/bin/sh
+
+. ./_export_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+RESULT_DIR=results
+
+tcc -c -p ./ # executing tcc, with clean option (-c)
+rm -r $RESULT_DIR
+rm -r tet_tmp_dir
+rm testcase/tet_captured
--- /dev/null
+CAPI_PROJECT_ROOT=/home/abyss/capi
+TET_INSTALL_HOST_PATH=/home/abyss/TETware
+TET_INSTALL_TARGET_PATH=/mnt/nfs/TETware
--- /dev/null
+#!/bin/sh
+
+. ./_export_target_env.sh # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
--- /dev/null
+CC ?= gcc
+
+C_FILES = $(shell ls *.c)
+
+PKGS = capi-network-nfc
+
+LDFLAGS = `pkg-config --libs $(PKGS)`
+LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
+LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
+
+CFLAGS = -I. `pkg-config --cflags $(PKGS)`
+CFLAGS += -I$(TET_ROOT)/inc/tet3
+CFLAGS += -Wall
+
+TCS := $(shell ls -1 *.c | cut -d. -f1)
+
+all: $(TCS)
+
+%: %.c
+ $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+
+clean:
+ rm -f $(TCS)
--- /dev/null
+/testcase/utc_network_nfc_ndef_record
+/testcase/utc_network_nfc_ndef_message
+/testcase/utc_network_nfc
+
--- /dev/null
+/*
+* Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <tet_api.h>
+#include <nfc.h>
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MY_ASSERT( fun , test , msg ) \
+{\
+ if( !test ) \
+ dts_fail(fun , msg ); \
+}
+
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void nfc_manager_set_activation_changed_cb_p(void);
+static void nfc_manager_set_activation_changed_cb_n(void);
+static void nfc_manager_set_activation_p(void);
+static void nfc_manager_set_activation_n(void);
+static void nfc_manager_initialize_p(void);
+static void nfc_manager_initialize_n(void);
+static void nfc_manager_deinitialize_p(void);
+static void nfc_manager_deinitialize_n(void);
+static void nfc_manager_set_tag_discovered_cb_p(void);
+static void nfc_manager_set_tag_discovered_cb_n(void);
+static void nfc_manager_set_ndef_discovered_cb_p(void);
+static void nfc_manager_set_ndef_discovered_cb_n(void);
+static void nfc_manager_set_p2p_target_discovered_cb_p(void);
+static void nfc_manager_set_p2p_target_discovered_cb_n(void);
+static void nfc_manager_set_se_event_cb_p(void);
+static void nfc_manager_set_se_event_cb_n(void);
+static void nfc_manager_set_se_transaction_event_cb_p(void);
+static void nfc_manager_set_se_transaction_event_cb_n(void);
+static void nfc_manager_set_system_handler_enable_p(void);
+static void nfc_manager_set_system_handler_enable_n(void);
+
+
+void _activation_changed_cb(bool activated , void *user_data);
+void _activation_completed_cb(int error, void *user_data);
+void utc_test_cb(void * user_data);
+
+
+
+
+
+struct tet_testlist tet_testlist[] = {
+ { nfc_manager_set_activation_changed_cb_p , POSITIVE_TC_IDX },
+ { nfc_manager_set_activation_changed_cb_n , NEGATIVE_TC_IDX },
+ { nfc_manager_set_activation_p , POSITIVE_TC_IDX },
+ { nfc_manager_set_activation_n , NEGATIVE_TC_IDX },
+ { nfc_manager_initialize_p , POSITIVE_TC_IDX },
+ { nfc_manager_initialize_n , NEGATIVE_TC_IDX },
+ { nfc_manager_deinitialize_p , POSITIVE_TC_IDX },
+ { nfc_manager_deinitialize_n , NEGATIVE_TC_IDX },
+ { nfc_manager_set_tag_discovered_cb_p , POSITIVE_TC_IDX },
+ { nfc_manager_set_tag_discovered_cb_n , NEGATIVE_TC_IDX },
+ { nfc_manager_set_ndef_discovered_cb_p , POSITIVE_TC_IDX },
+ { nfc_manager_set_ndef_discovered_cb_n , NEGATIVE_TC_IDX },
+ { nfc_manager_set_p2p_target_discovered_cb_p , POSITIVE_TC_IDX },
+ { nfc_manager_set_p2p_target_discovered_cb_n , NEGATIVE_TC_IDX },
+ { nfc_manager_set_se_event_cb_p , POSITIVE_TC_IDX },
+ { nfc_manager_set_se_event_cb_n , NEGATIVE_TC_IDX },
+ { nfc_manager_set_se_transaction_event_cb_p , POSITIVE_TC_IDX },
+ { nfc_manager_set_se_transaction_event_cb_n , NEGATIVE_TC_IDX },
+ { nfc_manager_set_system_handler_enable_p , POSITIVE_TC_IDX },
+ { nfc_manager_set_system_handler_enable_n , NEGATIVE_TC_IDX },
+
+ { NULL, 0 },
+};
+
+//this method is called only once in start
+static void startup(void)
+{
+ /* start of TC */
+}
+
+static void cleanup(void)
+{
+ /* end of TC */
+}
+
+void _activation_changed_cb(bool activated , void *user_data)
+{
+ if( activated == true)
+ {
+ }
+ else if( activated == false)
+ {
+ }
+}
+
+void _activation_completed_cb(int error, void *user_data)
+{
+ error = 0;
+ return error;
+}
+
+void utc_test_cb(void *user_data)
+{
+ return true;
+}
+
+
+static void nfc_manager_set_activation_changed_cb_p(void)
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_activation_changed_cb(_activation_changed_cb , NULL);
+
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_activation_changed_cb_p is faild");
+}
+
+static void nfc_manager_set_activation_changed_cb_n(void)
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_activation_changed_cb(NULL , NULL);
+
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_activation_changed_cb_n not allow null");
+}
+
+static void nfc_manager_set_activation_p()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_activation(1, _activation_completed_cb, NULL);
+
+ dts_pass(__func__, "PASS");
+}
+
+static void nfc_manager_set_activation_n()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_activation(1, NULL, NULL);
+
+ dts_pass(__func__, "PASS");
+}
+
+static void nfc_manager_initialize_p()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_initialize(NULL, NULL);
+
+ nfc_manager_deinitialize();
+
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_initialize_p is faild");
+}
+
+static void nfc_manager_initialize_n()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_initialize(NULL, NULL);
+
+ dts_pass(__func__, "PASS");
+}
+
+static void nfc_manager_deinitialize_p()
+{
+ int ret = NFC_ERROR_NONE;
+
+ nfc_manager_initialize(NULL, NULL);
+
+ ret = nfc_manager_deinitialize();
+
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_initialize_p is faild");
+}
+
+static void nfc_manager_deinitialize_n()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_deinitialize();
+
+ dts_pass(__func__, "PASS");
+}
+
+static void nfc_manager_set_tag_discovered_cb_p()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_tag_discovered_cb(utc_test_cb, NULL);
+
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_tag_discovered_cb_p is faild");
+}
+
+static void nfc_manager_set_tag_discovered_cb_n()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_tag_discovered_cb(NULL, NULL);
+
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_tag_discovered_cb_n not allow null");
+}
+
+static void nfc_manager_set_ndef_discovered_cb_p()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_ndef_discovered_cb(utc_test_cb , NULL);
+
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_ndef_discovered_cb_p is faild");
+}
+
+static void nfc_manager_set_ndef_discovered_cb_n()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_ndef_discovered_cb(NULL, NULL);
+
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_ndef_discovered_cb_n not allow null");
+}
+
+static void nfc_manager_set_p2p_target_discovered_cb_p()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_p2p_target_discovered_cb(utc_test_cb , NULL);
+
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_p2p_target_discovered_cb_p is faild");
+}
+
+static void nfc_manager_set_p2p_target_discovered_cb_n()
+{
+ int ret;
+
+ ret = nfc_manager_set_p2p_target_discovered_cb(NULL, NULL);
+
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_p2p_target_discovered_cb_n not allow null");
+}
+
+static void nfc_manager_set_se_event_cb_p()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_se_event_cb(utc_test_cb , NULL);
+
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_event_cb_p is faild");
+}
+
+static void nfc_manager_set_se_event_cb_n ()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_se_event_cb(NULL, NULL);
+
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_event_cb_n not allow null");
+}
+
+static void nfc_manager_set_se_transaction_event_cb_p()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_se_transaction_event_cb(utc_test_cb , NULL);
+
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_transaction_event_cb_p is faild");
+}
+
+static void nfc_manager_set_se_transaction_event_cb_n ()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_se_transaction_event_cb(NULL, NULL);
+
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_manager_set_se_transaction_event_cb_n not allow null");
+}
+
+static void nfc_manager_set_system_handler_enable_p()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_system_handler_enable(true);
+
+ dts_pass(__func__, "PASS");
+
+}
+
+static void nfc_manager_set_system_handler_enable_n ()
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_manager_set_system_handler_enable(NULL);
+
+ dts_pass(__func__, "PASS");
+}
--- /dev/null
+/*
+* Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <tet_api.h>
+#include <nfc.h>
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+
+#define MY_ASSERT( fun , test , msg ) \
+{\
+ if( !test ) \
+ dts_fail(fun , msg ); \
+}
+
+
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_nfc_ndef_message_create_p(void);
+static void utc_nfc_ndef_message_create_n(void);
+static void utc_nfc_ndef_message_create_from_rawdata_p(void);
+static void utc_nfc_ndef_message_create_from_rawdata_n(void);
+static void utc_nfc_ndef_message_destroy_p(void);
+static void utc_nfc_ndef_message_destroy_n(void);
+static void utc_nfc_ndef_message_get_record_count_p(void);
+static void utc_nfc_ndef_message_get_record_count_n(void);
+static void utc_nfc_ndef_message_get_rawdata_p(void);
+static void utc_nfc_ndef_message_get_rawdata_n(void);
+static void utc_nfc_ndef_message_append_record_p(void);
+static void utc_nfc_ndef_message_append_record_n(void);
+static void utc_nfc_ndef_message_insert_record_p(void);
+static void utc_nfc_ndef_message_insert_record_n(void);
+static void utc_nfc_ndef_message_remove_record_p(void);
+static void utc_nfc_ndef_message_remove_record_n(void);
+static void utc_nfc_ndef_message_get_record_p(void);
+static void utc_nfc_ndef_message_get_record_n(void);
+
+
+struct tet_testlist tet_testlist[] = {
+ { utc_nfc_ndef_message_create_p , POSITIVE_TC_IDX },
+ { utc_nfc_ndef_message_create_n , NEGATIVE_TC_IDX },
+ { utc_nfc_ndef_message_create_from_rawdata_p , POSITIVE_TC_IDX },
+ { utc_nfc_ndef_message_create_from_rawdata_n , NEGATIVE_TC_IDX },
+ { utc_nfc_ndef_message_destroy_p , POSITIVE_TC_IDX },
+ { utc_nfc_ndef_message_destroy_n , NEGATIVE_TC_IDX },
+ { utc_nfc_ndef_message_get_record_count_p , POSITIVE_TC_IDX },
+ { utc_nfc_ndef_message_get_record_count_n , NEGATIVE_TC_IDX },
+ { utc_nfc_ndef_message_get_rawdata_p , POSITIVE_TC_IDX },
+ { utc_nfc_ndef_message_get_rawdata_n , NEGATIVE_TC_IDX },
+ { utc_nfc_ndef_message_append_record_p , POSITIVE_TC_IDX },
+ { utc_nfc_ndef_message_append_record_n , NEGATIVE_TC_IDX },
+ { utc_nfc_ndef_message_insert_record_p , POSITIVE_TC_IDX },
+ { utc_nfc_ndef_message_insert_record_n , NEGATIVE_TC_IDX },
+ { utc_nfc_ndef_message_remove_record_p , POSITIVE_TC_IDX },
+ { utc_nfc_ndef_message_remove_record_n , NEGATIVE_TC_IDX },
+ { utc_nfc_ndef_message_get_record_p , POSITIVE_TC_IDX },
+ { utc_nfc_ndef_message_get_record_n , NEGATIVE_TC_IDX },
+
+ { NULL, 0 },
+};
+
+//this method is called only once in start
+static void startup(void)
+{
+ /* start of TC */
+}
+
+static void cleanup(void)
+{
+ /* end of TC */
+}
+
+
+static void utc_nfc_ndef_message_create_p(void)
+{
+ int ret ;
+ nfc_ndef_message_h message;
+ ret = nfc_ndef_message_create(&message);
+ MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+ nfc_ndef_message_destroy(message);
+ dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_create_n(void)
+{
+ int ret ;
+ ret = nfc_ndef_message_create(NULL);
+ MY_ASSERT(__func__, ret != NFC_ERROR_NONE , "FAIL");
+ dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_create_from_rawdata_p(void)
+{
+ int ret ;
+ unsigned char *buffer;
+ int size;
+ nfc_ndef_message_h message;
+ nfc_ndef_message_h message2;
+ nfc_ndef_record_h record1;
+ ret = nfc_ndef_message_create(&message);
+ nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+ nfc_ndef_message_append_record(message, record1);
+ nfc_ndef_message_get_rawdata(message, &buffer, &size);
+ ret = nfc_ndef_message_create_from_rawdata(&message2, buffer,size);
+
+ MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+ nfc_ndef_message_destroy(message2);
+ nfc_ndef_message_destroy(message);
+ free(buffer);
+ dts_pass(__func__, "PASS");
+
+}
+static void utc_nfc_ndef_message_create_from_rawdata_n(void)
+{
+ int ret ;
+ ret = nfc_ndef_message_create_from_rawdata(NULL, NULL, 0);
+ MY_ASSERT(__func__, ret != NFC_ERROR_NONE , "FAIL");
+ dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_destroy_p(void)
+{
+ int ret ;
+ nfc_ndef_message_h message;
+ ret = nfc_ndef_message_create(&message);
+ ret = nfc_ndef_message_destroy(message);
+ MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+ dts_pass(__func__, "PASS");
+
+}
+static void utc_nfc_ndef_message_destroy_n(void)
+{
+ int ret ;
+ ret = nfc_ndef_message_destroy(NULL);
+ MY_ASSERT(__func__, ret != NFC_ERROR_NONE , "FAIL");
+ dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_get_record_count_p(void)
+{
+ int ret ;
+ int count;
+ nfc_ndef_message_h message;
+ nfc_ndef_record_h record1;
+ ret = nfc_ndef_message_create(&message);
+ nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+ nfc_ndef_message_append_record(message, record1);
+ ret = nfc_ndef_message_get_record_count(message, &count);
+
+ MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+ nfc_ndef_message_destroy(message);
+ dts_pass(__func__, "PASS");
+
+}
+static void utc_nfc_ndef_message_get_record_count_n(void)
+{
+ int ret ;
+ ret = nfc_ndef_message_get_record_count(NULL, NULL);
+ MY_ASSERT(__func__, ret != NFC_ERROR_NONE , "FAIL");
+ dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_get_rawdata_p(void)
+{
+ int ret ;
+ unsigned char *buffer;
+ int size;
+ nfc_ndef_message_h message;
+ nfc_ndef_record_h record1;
+ ret = nfc_ndef_message_create(&message);
+ nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+ nfc_ndef_message_append_record(message, record1);
+ ret= nfc_ndef_message_get_rawdata(message, &buffer, &size);
+
+ MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+ nfc_ndef_message_destroy(message);
+ free(buffer);
+ dts_pass(__func__, "PASS");
+
+}
+static void utc_nfc_ndef_message_get_rawdata_n(void)
+{
+ int ret ;
+ ret = nfc_ndef_message_get_rawdata(NULL, NULL, NULL);
+ MY_ASSERT(__func__, ret != NFC_ERROR_NONE , "FAIL");
+ dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_append_record_p(void)
+{
+ int ret ;
+ nfc_ndef_message_h message;
+ nfc_ndef_record_h record1;
+ ret = nfc_ndef_message_create(&message);
+ nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+ ret = nfc_ndef_message_append_record(message, record1);
+ MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+ nfc_ndef_message_destroy(message);
+ dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_append_record_n(void)
+{
+ int ret ;
+ ret = nfc_ndef_message_append_record(NULL, NULL);
+ MY_ASSERT(__func__, ret != NFC_ERROR_NONE , "FAIL");
+ dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_insert_record_p(void)
+{
+ int ret ;
+ nfc_ndef_message_h message;
+ nfc_ndef_record_h record1;
+ ret = nfc_ndef_message_create(&message);
+ nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+ ret = nfc_ndef_message_insert_record(message,0, record1);
+ MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+ nfc_ndef_message_destroy(message);
+ dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_insert_record_n(void)
+{
+ int ret ;
+ ret = nfc_ndef_message_insert_record(NULL, 0 , NULL);
+ MY_ASSERT(__func__, ret != NFC_ERROR_NONE , "FAIL");
+ dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_remove_record_p(void)
+{
+ int ret ;
+ nfc_ndef_message_h message;
+ nfc_ndef_record_h record1;
+ ret = nfc_ndef_message_create(&message);
+ nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+ ret = nfc_ndef_message_insert_record(message,0, record1);
+ ret = nfc_ndef_message_remove_record(message, 0);
+ MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+ nfc_ndef_message_destroy(message);
+ dts_pass(__func__, "PASS");
+
+}
+static void utc_nfc_ndef_message_remove_record_n(void)
+{
+ int ret ;
+ ret = nfc_ndef_message_remove_record(NULL, 0);
+ MY_ASSERT(__func__, ret != NFC_ERROR_NONE , "FAIL");
+ dts_pass(__func__, "PASS");
+}
+static void utc_nfc_ndef_message_get_record_p(void)
+{
+ int ret ;
+ nfc_ndef_message_h message;
+ nfc_ndef_record_h record1, record2;
+ ret = nfc_ndef_message_create(&message);
+ nfc_ndef_record_create_text(&record1, "test", "en-US", NFC_ENCODE_UTF_8);
+ ret = nfc_ndef_message_insert_record(message,0, record1);
+ ret = nfc_ndef_message_get_record(message, 0, &record2);
+ MY_ASSERT(__func__ , ret == NFC_ERROR_NONE , "FAIL");
+ nfc_ndef_message_destroy(message);
+ dts_pass(__func__, "PASS");
+
+}
+static void utc_nfc_ndef_message_get_record_n(void)
+{
+ int ret ;
+ ret = nfc_ndef_message_get_record(NULL, 0 , NULL);
+ MY_ASSERT(__func__, ret != NFC_ERROR_NONE , "FAIL");
+ dts_pass(__func__, "PASS");
+}
+
--- /dev/null
+/*
+* Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+#include <tet_api.h>
+#include <nfc.h>
+
+enum {
+ POSITIVE_TC_IDX = 0x01,
+ NEGATIVE_TC_IDX,
+};
+static void startup(void);
+static void cleanup(void);
+
+void (*tet_startup)(void) = startup;
+void (*tet_cleanup)(void) = cleanup;
+
+static void utc_nfc_ndef_record_create_p(void);
+static void utc_nfc_ndef_record_create_n(void);
+static void utc_nfc_ndef_record_create_text_p(void);
+static void utc_nfc_ndef_record_create_text_n(void);
+static void utc_nfc_ndef_record_create_uri_p(void);
+static void utc_nfc_ndef_record_create_uri_n(void);
+static void utc_nfc_ndef_record_create_mime_p(void);
+static void utc_nfc_ndef_record_create_mime_n_1(void);
+static void utc_nfc_ndef_record_create_mime_n_2(void);
+static void utc_nfc_ndef_record_create_mime_n_3(void);
+static void utc_nfc_ndef_record_destroy_p(void);
+static void utc_nfc_ndef_record_destroy_n(void);
+static void utc_nfc_ndef_record_set_id_p(void);
+static void utc_nfc_ndef_record_set_id_n(void);
+static void utc_nfc_ndef_record_get_id_p(void);
+static void utc_nfc_ndef_record_get_id_n(void);
+static void utc_nfc_ndef_record_get_payload_p(void);
+static void utc_nfc_ndef_record_get_payload_n(void);
+static void utc_nfc_ndef_record_get_type_p(void);
+static void utc_nfc_ndef_record_get_type_n(void);
+static void utc_nfc_ndef_record_get_tnf_p(void);
+static void utc_nfc_ndef_record_get_tnf_n(void);
+static void utc_nfc_ndef_record_get_text_p(void);
+static void utc_nfc_ndef_record_get_text_n(void);
+static void utc_nfc_ndef_record_get_langcode_p(void);
+static void utc_nfc_ndef_record_get_langcode_n(void);
+static void utc_nfc_ndef_record_get_encode_type_p(void);
+static void utc_nfc_ndef_record_get_encode_type_n(void);
+static void utc_nfc_ndef_record_get_uri_p(void);
+static void utc_nfc_ndef_record_get_uri_n(void);
+static void utc_nfc_ndef_record_get_mime_type_p(void);
+static void utc_nfc_ndef_record_get_mime_type_n(void);
+
+struct tet_testlist tet_testlist[] = {
+ { utc_nfc_ndef_record_create_p , POSITIVE_TC_IDX },
+ { utc_nfc_ndef_record_create_n , NEGATIVE_TC_IDX },
+ { utc_nfc_ndef_record_create_text_p, POSITIVE_TC_IDX },
+ { utc_nfc_ndef_record_create_text_n , NEGATIVE_TC_IDX},
+ { utc_nfc_ndef_record_create_uri_p, 1},
+ { utc_nfc_ndef_record_create_uri_n, 2 },
+ { utc_nfc_ndef_record_create_mime_p, 1},
+ { utc_nfc_ndef_record_create_mime_n_1, 2 },
+ { utc_nfc_ndef_record_create_mime_n_2, 2 },
+ { utc_nfc_ndef_record_create_mime_n_3, 2 },
+ { utc_nfc_ndef_record_destroy_p, 1},
+ { utc_nfc_ndef_record_destroy_n, 2},
+ { utc_nfc_ndef_record_set_id_p, 1 },
+ { utc_nfc_ndef_record_set_id_n, 2 },
+ { utc_nfc_ndef_record_get_id_p, 1 },
+ { utc_nfc_ndef_record_get_id_n, 2 },
+ { utc_nfc_ndef_record_get_payload_p, 1},
+ { utc_nfc_ndef_record_get_payload_n, 2},
+ { utc_nfc_ndef_record_get_type_p, 1},
+ { utc_nfc_ndef_record_get_type_n, 2},
+ { utc_nfc_ndef_record_get_tnf_p, 1},
+ { utc_nfc_ndef_record_get_tnf_n, 2},
+ { utc_nfc_ndef_record_get_text_p, 1},
+ { utc_nfc_ndef_record_get_text_n, 2},
+ { utc_nfc_ndef_record_get_langcode_p, 1},
+ { utc_nfc_ndef_record_get_langcode_n, 2},
+ { utc_nfc_ndef_record_get_encode_type_p, 1},
+ { utc_nfc_ndef_record_get_encode_type_n, 2},
+ { utc_nfc_ndef_record_get_uri_p, 1},
+ { utc_nfc_ndef_record_get_uri_n, 2},
+ { utc_nfc_ndef_record_get_mime_type_p, 1},
+ { utc_nfc_ndef_record_get_mime_type_n, 2},
+ { NULL, 0 },
+};
+
+//this method is called only once in start
+static void startup(void)
+{
+ /* start of TC */
+}
+
+static void cleanup(void)
+{
+ /* end of TC */
+}
+static void utc_nfc_ndef_record_create_p(void)
+{
+ int ret=0;
+ nfc_ndef_record_h record;
+ unsigned char testbuffer[] = "TEST";
+
+ ret = nfc_ndef_record_create(&record, NFC_RECORD_TNF_WELL_KNOWN, testbuffer,1, testbuffer, 4, testbuffer, 4);
+ if( ret == 0 )
+ nfc_ndef_record_destroy(record);
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create is faild");
+}
+
+static void utc_nfc_ndef_record_create_n(void)
+{
+ int ret=0;
+ unsigned char testbuffer[] = "TEST";
+
+ ret = nfc_ndef_record_create(NULL, NFC_RECORD_TNF_WELL_KNOWN, testbuffer,1, testbuffer, 4, testbuffer, 4);
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+}
+static void utc_nfc_ndef_record_create_text_p(void)
+{
+ int ret = 0;
+ nfc_ndef_record_h record;
+ ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+ if( ret == 0 )
+ nfc_ndef_record_destroy(record);
+
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create_text is faild");
+}
+static void utc_nfc_ndef_record_create_text_n(void)
+{
+ int ret = 0;
+ ret = nfc_ndef_record_create_text(NULL, "test", "en-US", NFC_ENCODE_UTF_8 );
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_create_uri_p(void)
+{
+ int ret = 0;
+ nfc_ndef_record_h record;
+ ret = nfc_ndef_record_create_uri(&record , "http://test.com");
+ if( ret == 0)
+ nfc_ndef_record_destroy(record);
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create_uri is faild");
+}
+static void utc_nfc_ndef_record_create_uri_n(void)
+{
+ int ret = 0;
+ ret = nfc_ndef_record_create_uri(NULL , "http://test.com");
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+
+static void utc_nfc_ndef_record_create_mime_p(void)
+{
+ int ret = NFC_ERROR_NONE;
+ nfc_ndef_record_h record;
+
+ ret = nfc_ndef_record_create_mime(&record, "text/plain", (unsigned char*)"the text record", sizeof("the text record"));
+ if( ret == NFC_ERROR_NONE)
+ nfc_ndef_record_destroy(record);
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_create_mime is faild");
+}
+
+static void utc_nfc_ndef_record_create_mime_n_1(void)
+{
+ int ret = NFC_ERROR_NONE;
+
+ ret = nfc_ndef_record_create_mime(NULL, "text/plain", (unsigned char*)"the text record", sizeof("the text record"));
+ dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "nfc_ndef_record_h null not allowed");
+}
+
+static void utc_nfc_ndef_record_create_mime_n_2(void)
+{
+ int ret = NFC_ERROR_NONE;
+ nfc_ndef_record_h record;
+
+ ret = nfc_ndef_record_create_mime(&record, NULL, (unsigned char*)"the text record", sizeof("the text record"));
+ if( ret == NFC_ERROR_NONE)
+ nfc_ndef_record_destroy(record);
+
+ dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "mime_type null not allowed");
+}
+
+static void utc_nfc_ndef_record_create_mime_n_3(void)
+{
+ int ret = NFC_ERROR_NONE;
+ nfc_ndef_record_h record;
+
+ ret = nfc_ndef_record_create_mime(&record, "text/plain", NULL, sizeof("the text record"));
+ if( ret == NFC_ERROR_NONE)
+ nfc_ndef_record_destroy(record);
+
+ dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "data null not allowed");
+}
+
+static void utc_nfc_ndef_record_destroy_p(void)
+{
+ int ret = 0;
+ nfc_ndef_record_h record;
+ ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+ if( ret != 0){
+ dts_fail(__func__, "can't create record\n");
+ }
+ ret = nfc_ndef_record_destroy(record);
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_destroy is faild");
+}
+static void utc_nfc_ndef_record_destroy_n(void)
+{
+ int ret = 0;
+ ret = nfc_ndef_record_destroy(NULL);
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+}
+static void utc_nfc_ndef_record_set_id_p(void)
+{
+ int ret = 0;
+ nfc_ndef_record_h record;
+ ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+ ret = nfc_ndef_record_set_id(record, (unsigned char *)"test", 4);
+ nfc_ndef_record_destroy(record);
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_set_id is faild");
+}
+static void utc_nfc_ndef_record_set_id_n(void)
+{
+ int ret;
+ ret = nfc_ndef_record_set_id(NULL, (unsigned char *)"test", 4);
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+}
+static void utc_nfc_ndef_record_get_id_p(void)
+{
+ int ret = 0;
+ int size;
+ nfc_ndef_record_h record;
+ unsigned char *id;
+ ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+ ret = nfc_ndef_record_set_id(record, (unsigned char *)"test", 4);
+ ret = nfc_ndef_record_get_id(record, &id, &size);
+ nfc_ndef_record_destroy(record);
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_id is faild");
+
+}
+static void utc_nfc_ndef_record_get_id_n(void)
+{
+ int ret;
+ ret = nfc_ndef_record_get_id(NULL,NULL, NULL);
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+}
+static void utc_nfc_ndef_record_get_payload_p(void)
+{
+ int ret = 0;
+ int size;
+ nfc_ndef_record_h record;
+ unsigned char *payload;
+ ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+ ret = nfc_ndef_record_get_payload(record, &payload, &size);
+ nfc_ndef_record_destroy(record);
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_payload is faild");
+}
+static void utc_nfc_ndef_record_get_payload_n(void)
+{
+ int ret;
+ ret = nfc_ndef_record_set_id(NULL, (unsigned char *)"test", 4);
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_get_type_p(void)
+{
+ int ret = 0;
+ int size;
+ nfc_ndef_record_h record;
+ unsigned char *data;
+ ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+ ret = nfc_ndef_record_get_type(record, &data, &size);
+ nfc_ndef_record_destroy(record);
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_type is faild");
+}
+static void utc_nfc_ndef_record_get_type_n(void)
+{
+ int ret;
+ ret = nfc_ndef_record_get_type(NULL, NULL, NULL);
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_get_tnf_p(void)
+{
+ int ret = 0;
+
+ nfc_ndef_record_h record;
+ nfc_record_tnf_e tnf;
+ ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+ ret = nfc_ndef_record_get_tnf(record, &tnf);
+ nfc_ndef_record_destroy(record);
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is faild");
+}
+static void utc_nfc_ndef_record_get_tnf_n(void)
+{
+ int ret;
+ ret = nfc_ndef_record_get_tnf(NULL, NULL);
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_get_text_p(void)
+{
+ int ret = 0;
+ char *text;
+ nfc_ndef_record_h record;
+ ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+ ret = nfc_ndef_record_get_text(record, &text);
+ free(text);
+ nfc_ndef_record_destroy(record);
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is faild");
+
+}
+static void utc_nfc_ndef_record_get_text_n(void)
+{
+ int ret;
+ ret = nfc_ndef_record_get_text(NULL, NULL);
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_get_langcode_p(void)
+{
+ int ret = 0;
+ char *text;
+ nfc_ndef_record_h record;
+ ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+ ret = nfc_ndef_record_get_langcode(record, &text);
+ free(text);
+ nfc_ndef_record_destroy(record);
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_tnf is faild");
+
+}
+static void utc_nfc_ndef_record_get_langcode_n(void)
+{
+ int ret;
+ ret = nfc_ndef_record_get_langcode(NULL, NULL);
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_get_encode_type_p(void)
+{
+ int ret = 0;
+ nfc_encode_type_e type;
+ nfc_ndef_record_h record;
+ ret = nfc_ndef_record_create_text(&record, "test", "en-US", NFC_ENCODE_UTF_8 );
+ ret = nfc_ndef_record_get_encode_type(record, &type);
+ nfc_ndef_record_destroy(record);
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_encode_type is faild");
+
+}
+static void utc_nfc_ndef_record_get_encode_type_n(void)
+{
+ int ret;
+ ret = nfc_ndef_record_get_encode_type(NULL, NULL);
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+static void utc_nfc_ndef_record_get_uri_p(void)
+{
+ int ret = 0;
+ char *uri;
+ nfc_ndef_record_h record;
+ ret = nfc_ndef_record_create_uri(&record, "http://test.com");
+ ret = nfc_ndef_record_get_uri(record, &uri);
+ if(ret == 0 ){
+ free(uri);
+ nfc_ndef_record_destroy(record);
+ }
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_uri is faild");
+}
+static void utc_nfc_ndef_record_get_uri_n(void)
+{
+ int ret;
+ ret = nfc_ndef_record_get_uri(NULL, NULL);
+ dts_check_ne(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_h not allow null");
+
+}
+
+static void utc_nfc_ndef_record_get_mime_type_p(void)
+{
+ int ret = NFC_ERROR_NONE;
+ char *mime_type;
+
+ nfc_ndef_record_h record;
+ ret = nfc_ndef_record_create_mime(&record, "text/plain", (unsigned char*)"the text record", sizeof("the text record"));
+ ret = nfc_ndef_record_get_mime_type(record, &mime_type);
+ if(ret == NFC_ERROR_NONE ){
+ free(mime_type);
+ nfc_ndef_record_destroy(record);
+ }
+ dts_check_eq(__func__, ret, NFC_ERROR_NONE, "nfc_ndef_record_get_mime_type is faild");
+}
+static void utc_nfc_ndef_record_get_mime_type_n(void)
+{
+ int ret;
+
+ ret = nfc_ndef_record_get_mime_type(NULL, NULL);
+ dts_check_eq(__func__, ret, NFC_ERROR_INVALID_PARAMETER, "nfc_ndef_record_h not allow null");
+}
--- /dev/null
+all
+ ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+ :include:/testcase/tslist
--- /dev/null
+TET_OUTPUT_CAPTURE=True # capture option for build operation checking
+TET_BUILD_TOOL=make # build with using make command
+TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
+TET_API_COMPLIANT=True # use TET API in Test Case ?
+TET_PASS_TC_NAME=True # report passed TC name in Journal file?
--- /dev/null
+TET_OUTPUT_CAPTURE=True # capture option
+TET_CLEAN_TOOL= make clean # clean tool
+TET_CLEAN_FILE= Makefile # file for clean
+TET_API_COMPLIANT=True # TET API useage
+TET_PASS_TC_NAME=True # showing name , passed TC
--- /dev/null
+TET_OUTPUT_CAPTURE=True # capturing execution or not
+TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional
+TET_EXEC_FILE= # ex) exectool : execution file/ Optional
+TET_API_COMPLIANT=True # Test case or Tool usesTET API?
+TET_PASS_TC_NAME=True # showing Passed TC name ?
+capi-network-nfc (0.0.1-20) unstable; urgency=low
+
+ * Modify the nfc set state function
+ * Git: slp/api/nfc
+ * Tag: capi-network-nfc_0.0.1-20
+
+ -- Sungjae Lim <neueziel.lim@samsung.com> Wed, 11 July 2012 12:20:08 +0900
+
+capi-network-nfc (0.0.1-19) unstable; urgency=low
+
+ * ADD NFC Err case for empty tag and not ndef format
+ * Git: slp/api/nfc
+ * Tag: capi-network-nfc_0.0.1-19
+
+ -- Sechang Sohn <sc.sohn@samsung.com> Fri, 18 May 2012 14:20:08 +0900
+
+capi-network-nfc (0.0.1-18) unstable; urgency=low
+
+ * Patch for NFC Err case pssing issue
+ * Git: slp/api/nfc
+ * Tag: capi-network-nfc_0.0.1-18
+
+ -- Sechang Sohn <sc.sohn@samsung.com> Fri, 11 May 2012 14:45:44 +0900
+
+capi-network-nfc (0.0.1-17) unstable; urgency=low
+
+ * prevent NFC set state CB reset
+ * Git: slp/api/nfc
+ * Tag: capi-network-nfc_0.0.1-17
+
+ -- Sechang Sohn <sc.sohn@samsung.com> Wed, 18 Apr 2012 17:21:56 +0900
+
+capi-network-nfc (0.0.1-16) unstable; urgency=low
+
+ * make transfer NFC set state user data
+ * Git: slp/api/nfc
+ * Tag: capi-network-nfc_0.0.1-16
+
+ -- Sechang Sohn <sc.sohn@samsung.com> Tue, 10 Apr 2012 15:05:24 +0900
+
+capi-network-nfc (0.0.1-15) unstable; urgency=low
+
+ * Adjust the calling sequence of callback
+ * Git: slp/api/nfc
+ * Tag: capi-network-nfc_0.0.1-15
+
+ -- Wonkyu Kwon <wonkyu.kwon@samsung.com> Mon, 09 Apr 2012 15:50:00 +0900
+
+capi-network-nfc (0.0.1-14) unstable; urgency=low
+
+ * add NFC nfc_manager_is_supported added
+ * Git: slp/api/nfc
+ * Tag: capi-network-nfc_0.0.1-14
+
+ -- Sechang Sohn <sc.sohn@samsung.com> Mon, 09 Apr 2012 12:18:51 +0900
+
+capi-network-nfc (0.0.1-13) unstable; urgency=low
+
+ * add NFC init/deinit CB
+ * Git: slp/api/nfc
+ * Tag: capi-network-nfc_0.0.1-13
+
+ -- Sechang Sohn <sc.sohn@samsung.com> Thu, 05 Apr 2012 14:15:52 +0900
+
capi-network-nfc (0.0.1-12) unstable; urgency=low
* add NFC tag write exception
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#ifndef __NFC_H__
NFC_ERROR_DEVICE_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Previous opertion is not finished still busy */
NFC_ERROR_NO_DEVICE = NFC_ERROR_CLASS | 0x04, /**< no device */
NFC_ERROR_NOT_ACTIVATED = NFC_ERROR_CLASS | 0x05, /**< NFC is not activated */
- NFC_ERROR_NOT_SUPPORTED = NFC_ERROR_CLASS | 0x06, /**< Not supported NFC */
+ NFC_ERROR_NOT_SUPPORTED = NFC_ERROR_CLASS | 0x06, /**< Not supported */
NFC_ERROR_ALREADY_ACTIVATED = NFC_ERROR_CLASS | 0x07, /**< Already activated */
NFC_ERROR_ALREADY_DEACTIVATED = NFC_ERROR_CLASS | 0x08, /**< Already deactivated */
NFC_ERROR_READ_ONLY_NDEF = NFC_ERROR_CLASS | 0x09, /**< Read only tag */
- NFC_ERROR_NO_SPACE_ON_NDEF = NFC_ERROR_CLASS | 0x0a /**< No enough space on tag */
+ NFC_ERROR_NO_SPACE_ON_NDEF = NFC_ERROR_CLASS | 0x0a, /**< No enough space on tag */
+ NFC_ERROR_NO_NDEF_MESSAGE = NFC_ERROR_CLASS | 0x0b, /**< No NDEF Message on Tag */
+ NFC_ERROR_NOT_NDEF_FORMAT = NFC_ERROR_CLASS | 0x0c /**< Not NDEF format Tag */
} nfc_error_e;
/**
*
* @see nfc_manager_set_activation()
*/
-typedef void (* nfc_set_activation_completed_cb)(nfc_error_e error, void *user_data);
+typedef void (* nfc_activation_completed_cb)(nfc_error_e error, void *user_data);
+
+/**
+ * @brief Called when nfc activation state is changed.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] activated The activation state
+ * @param [in] user_data The user data passed from the callback registeration function
+ *
+ * @see nfc_manager_set_activation_changed_cb()
+ */
+typedef void (*nfc_activation_changed_cb)(bool activated , void *user_data);
/**
* @brief Called after nfc_manager_initialize() has completed.
*/
typedef void (*nfc_p2p_connection_handover_completed_cb)(nfc_error_e result, nfc_ac_type_e carrior, void * ac_data, int ac_data_size , void *user_data);
-
/**
- * @brief Sets NFC Activation
+ * @brief Gets the value that indicates whether NFC is supported.
* @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
*
* @remarks This function can executed Regardless of nfc_manager_initialize state.
*
+ * @return true on NFC supported, otherwise false
+ * @see nfc_manager_set_activation()
+ */
+bool nfc_manager_is_supported(void);
+
+/**
+ * @brief Sets NFC Activation
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
* @param [in] activation The NFC state for setting
* @param [in] callback The callback function to invoke after this function has completed\n It can be null if notification is not required
* @param [in] user_data The user data to be passed to the callback function
* @retval #NFC_ERROR_ALREADY_ACTIVATED Already activated
* @retval #NFC_ERROR_ALREADY_DEACTIVATED Already deactivated
* @see nfc_manager_is_activated()
- * @see nfc_set_activation_completed_cb()
+ * @see nfc_activation_completed_cb()
*/
-int nfc_manager_set_activation(bool activation, nfc_set_activation_completed_cb callback, void *user_data);
+int nfc_manager_set_activation(bool activation, nfc_activation_completed_cb callback, void *user_data);
+
+/**
+ * @brief Set NFC Activation state changed callback
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @param [in] callback The callback function to invoke when activation state is changed.
+ * @param [in] user_data The user data to be passed to the callback function
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #NFC_ERROR_NONE Successful
+ * @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
+ *
+ * @see nfc_activation_changed_cb()
+ * @see nfc_manager_unset_activation_changed_cb()
+ */
+int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback , void *user_data);
+
+/**
+ * @brief Unregisters the callback function.
+ * @ingroup CAPI_NETWORK_NFC_MANAGER_MODULE
+ *
+ * @see nfc_manager_set_activation_changed_cb()
+ * @see nfc_activation_changed_cb()
+ */
+void nfc_manager_unset_activation_changed_cb(void);
+
/**
* @brief Gets NFC Activation state
* @return 0 on success, otherwise a negative error value.
* @retval #NFC_ERROR_NONE Successful
* @retval #NFC_ERROR_OPERATION_FAILED Operation fail
- * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
* @see nfc_manager_deinitialize()
*/
int nfc_manager_initialize(nfc_initialize_completed_cb callback, void *user_data);
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+* @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
*
* @post It invokes nfc_tag_transceive_completed_cb() when it has completed to t
* @see nfc_tag_read_ndef()
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format tag
*
* @post It invokes nfc_tag_read_completed_cb() when it has completed to read NDEF formatted data.
*
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format tag
*
* @post It invokes nfc_tag_write_completed_cb() when it has completed to write NDEF data.
* @see nfc_tag_is_support_ndef()
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
+ * @retval #NFC_ERROR_NOT_NDEF_FORMAT Not ndef format tag
*
* @post It invokes nfc_tag_format_completed_cb() when it has completed to format the NFC tag.
*
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
*
* @post It invokes nfc_mifare_authenticate_with_keyA_completed_cb() when it has completed to authenticate the given sector with key A.
* @see nfc_mifare_authenticate_with_keyB()
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
*
* @post It invokes nfc_mifare_authenticate_with_keyB_completed_cb() when it has completed to authenticate the given sector with key B.
* @see nfc_mifare_authenticate_with_keyA()
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
*
* @post It invokes nfc_mifare_read_block_completed_cb() when it has completed to read a block.
* @see nfc_mifare_read_page()
* @retval #NFC_ERROR_NONE Successful
* @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
* @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
-
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
*
* @post It invokes nfc_mifare_read_page_completed_cb() when it has completed to read a page.
* @see nfc_mifare_read_block()
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
*
* @post It invokes nfc_mifare_write_block_completed_cb() when it hase completed to write a block.
*
* @retval #NFC_ERROR_NONE Successful
* @retval #NFC_ERROR_OUT_OF_MEMORY Out of memory
* @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
-
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
*
* @post It invokes nfc_mifare_write_page_completed_cb() when it has completed to write a page.
*
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
*
* @see nfc_mifare_decrement()
* @see nfc_mifare_write_block()
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
*
* @see nfc_mifare_increment()
* @see nfc_mifare_write_block()
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
*
* @see nfc_mifare_restore()
*/
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_TIMED_OUT Timeout is reached while communicating with tag
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
*
* @see nfc_mifare_transfer()
*/
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
*
* @see nfc_p2p_send_completed_cb()
* @see @see nfc_p2p_target_discovered_cb()
* @retval #NFC_ERROR_OPERATION_FAILED Operation failed
* @retval #NFC_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #NFC_ERROR_DEVICE_BUSY Device is too busy to handle your request
+ * @retval #NFC_ERROR_NOT_ACTIVATED NFC is not activated
*
* @see nfc_p2p_connection_handover_completed_cb()
* @see @see nfc_p2p_connection_handover_completed_cb()
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
typedef struct {
nfc_tag_discovered_cb on_tag_discovered_cb;
- void * on_tag_discovered_user_data;
+ void * on_tag_discovered_user_data;
nfc_ndef_discovered_cb on_ndef_discovered_cb;
- void * on_ndef_discovered_user_data;
+ void * on_ndef_discovered_user_data;
net_nfc_target_info_s current_tag;
//net_nfc_target_handle_s current_target;
net_nfc_target_handle_h current_target;
nfc_p2p_target_discovered_cb on_p2p_discovered_cb;
- void * on_p2p_discovered_user_data;
+ void * on_p2p_discovered_user_data;
- nfc_se_event_cb on_se_event_cb;
- void * on_se_event_user_data;
+ nfc_se_event_cb on_se_event_cb;
+ void * on_se_event_user_data;
- nfc_p2p_send_completed_cb on_p2p_send_completed_cb;
- void * on_p2p_send_completed_user_data;
+ nfc_p2p_send_completed_cb on_p2p_send_completed_cb;
+ void * on_p2p_send_completed_user_data;
nfc_p2p_data_recived_cb on_p2p_recv_cb;
- void * on_p2p_recv_user_data;
+ void * on_p2p_recv_user_data;
- nfc_p2p_connection_handover_completed_cb on_p2p_connection_handover_completed_cb;
+ nfc_p2p_connection_handover_completed_cb on_p2p_connection_handover_completed_cb;
void * on_p2p_connection_handover_completed_user_data;
nfc_initialize_completed_cb on_initialize_completed_cb;
nfc_se_transaction_event_cb on_se_transaction_event_cb;
- void * on_se_transaction_event_user_data;
+ void * on_se_transaction_event_user_data;
+
+ nfc_activation_changed_cb on_activation_changed_cb;
+ void * on_activation_changed_user_data;
+
+ nfc_activation_completed_cb on_activation_completed_cb;
+ void * on_activation_completed_user_data;
+ bool on_activation_doing;
+
} _nfc_context_s;
typedef struct {
Name: capi-network-nfc
Summary: A NFC library in SLP C API
Version: 0.0.1
-Release: 1
+Release: 26
Group: TO_BE/FILLED_IN
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
case NET_NFC_TAG_WRITE_FAILED:
case NET_NFC_OPERATION_FAIL:
case NET_NFC_SECURITY_FAIL:
- case NET_NFC_NO_NDEF_SUPPORT:
case NET_NFC_INSUFFICIENT_STORAGE:
case NET_NFC_NOT_CONNECTED:
case NET_NFC_NOT_INITIALIZED:
case NET_NFC_NDEF_TYPE_LENGTH_IS_NOT_OK:
case NET_NFC_NDEF_ID_LENGTH_IS_NOT_OK:
case NET_NFC_NDEF_BUF_END_WITHOUT_ME:
- case NET_NFC_NO_NDEF_MESSAGE:
error_code = NFC_ERROR_INVALID_NDEF_MESSAGE;
errorstr = "INVALID_NDEF_MESSAGE";
break;
+ case NET_NFC_NO_NDEF_MESSAGE:
+ error_code = NFC_ERROR_NO_NDEF_MESSAGE;
+ errorstr = "NO_NDEF_MESSAGE";
+ break;
case NET_NFC_BUSY :
error_code = NFC_ERROR_DEVICE_BUSY;
errorstr = "DEVICE_BUSY";
break;
+ case NET_NFC_NO_NDEF_SUPPORT:
+ error_code = NFC_ERROR_NOT_NDEF_FORMAT;
+ errorstr = "NOT_SUPPORTED";
+ break;
default :
error_code = NFC_ERROR_OPERATION_FAILED;
errorstr = "OPERATION_FAILED";
}
- LOGE( "[%s] %s(0x%08x)",func, errorstr, error_code);
+ LOGE( "NFC [%s] %s(0x%08x)",func, errorstr, error_code);
return error_code;
}
_nfc_context_s g_nfc_context;
-static nfc_set_activation_completed_cb g_nfc_set_activation_completed_cb = NULL;
+
+
+static void nfc_manager_set_activation_completed_cb(nfc_activation_completed_cb callback , void *user_data)
+{
+ g_nfc_context.on_activation_completed_cb = callback;
+ g_nfc_context.on_activation_completed_user_data = user_data;
+ g_nfc_context.on_activation_doing = true;
+}
+
+static void nfc_manager_unset_activation_completed_cb(void)
+{
+ g_nfc_context.on_activation_completed_cb = NULL;
+ g_nfc_context.on_activation_completed_user_data = NULL;
+ g_nfc_context.on_activation_doing = false;
+}
+
+static bool nfc_manager_check_activation(void)
+{
+ return g_nfc_context.on_activation_doing;
+}
void _nfc_response_handler(net_nfc_message_e message, net_nfc_error_e result, void* data, void* user_param, void * trans_data)
{
- LOGI("[%s] message %d - start", __func__, message);
+ LOGI("NFC [%s] message %d - start result[%d] ", __func__, message, result);
int capi_result = _convert_error_code("EVENT", result);
void * user_data = g_nfc_context.on_p2p_send_completed_user_data;
g_nfc_context.on_p2p_send_completed_cb = NULL;
g_nfc_context.on_p2p_send_completed_user_data = NULL;
- cb(result , user_data );
+ cb(capi_result , user_data );
}
break;
}
void * user_data = g_nfc_context.on_p2p_connection_handover_completed_user_data;
g_nfc_context.on_p2p_connection_handover_completed_cb = NULL;
g_nfc_context.on_p2p_connection_handover_completed_user_data = NULL;
- cb(result , carrior_type, (void *)ac_data, ac_data_size, user_data );
+ cb(capi_result , carrior_type, (void *)ac_data, ac_data_size, user_data );
net_nfc_exchanger_free_alternative_carrier_data((net_nfc_connection_handover_info_h)data);
free(ac_data);
}
else
{
+ if (result == NET_NFC_NOT_CONNECTED)
+ {
+ capi_result = NFC_ERROR_NONE;
+ }
+
if( g_nfc_context.on_initialize_completed_cb ){
nfc_initialize_completed_cb cb = g_nfc_context.on_initialize_completed_cb;
g_nfc_context.on_initialize_completed_cb = NULL;
- cb( result,trans_data );
+ cb( capi_result,trans_data );
}
}
break;
net_nfc_target_info_s *target_info = (net_nfc_target_info_s*)data;
memset(&g_nfc_context.current_tag , 0 , sizeof( g_nfc_context.current_tag ));
+ g_nfc_context.current_tag = * target_info;
+ net_nfc_tag_info_s *list = g_nfc_context.current_tag.tag_info_list;
+ net_nfc_tag_info_s *newlist ;
+ newlist = (net_nfc_tag_info_s *)calloc(g_nfc_context.current_tag.number_of_keys, sizeof(net_nfc_tag_info_s));
- if(result == NET_NFC_OK)
- {
- g_nfc_context.current_tag = * target_info;
- net_nfc_tag_info_s *list = g_nfc_context.current_tag.tag_info_list;
- net_nfc_tag_info_s *newlist ;
- newlist = (net_nfc_tag_info_s *)calloc(g_nfc_context.current_tag.number_of_keys, sizeof(net_nfc_tag_info_s));
-
- //copy info list
- for(i = 0; i < g_nfc_context.current_tag.number_of_keys ; i++){
- if( list[i].key ){
- newlist[i].key = strdup(list[i].key);
- }
- if ( list[i].value ){
- net_nfc_create_data(&newlist[i].value , ((data_s*)list[i].value)->buffer, ((data_s*)list[i].value)->length);
- }
+ //copy info list
+ for(i = 0; i < g_nfc_context.current_tag.number_of_keys ; i++){
+ if( list[i].key ){
+ newlist[i].key = strdup(list[i].key);
+ }
+ if ( list[i].value ){
+ net_nfc_create_data(&newlist[i].value , ((data_s*)list[i].value)->buffer, ((data_s*)list[i].value)->length);
}
- g_nfc_context.current_tag.tag_info_list = newlist;
-
}
+ g_nfc_context.current_tag.tag_info_list = newlist;
nfc_initialize_completed_cb cb = g_nfc_context.on_initialize_completed_cb;
g_nfc_context.on_initialize_completed_cb = NULL;
if( cb ){
- cb( result, trans_data );
+ cb( capi_result, trans_data );
}
break;
}
case NET_NFC_MESSAGE_GET_CURRENT_TARGET_HANDLE :
{
- memset(&g_nfc_context.current_target , 0 , sizeof( g_nfc_context.current_target ));
- g_nfc_context.on_p2p_recv_cb = NULL;
- g_nfc_context.on_p2p_recv_user_data = NULL;
- g_nfc_context.on_p2p_send_completed_cb = NULL;
- g_nfc_context.on_p2p_send_completed_user_data = NULL;
-
- if(result == NET_NFC_OK)
- {
- g_nfc_context.current_target = (net_nfc_target_handle_h)data;
- }
+ g_nfc_context.current_target = (net_nfc_target_handle_h)data;
nfc_initialize_completed_cb cb = g_nfc_context.on_initialize_completed_cb;
g_nfc_context.on_initialize_completed_cb = NULL;
if( cb ){
- cb( result, trans_data );
+ cb( capi_result, trans_data );
+ }
+
+ break;
+ }
+
+
+ case NET_NFC_MESSAGE_INIT :
+ {
+ bool activated = true;
+
+ LOGE( "_nfc_response_handler NET_NFC_MESSAGE_INIT\n");
+
+ if (result == NET_NFC_OK){
+ if( g_nfc_context.on_activation_changed_cb != NULL ){
+ g_nfc_context.on_activation_changed_cb(activated , g_nfc_context.on_activation_changed_user_data);
+ LOGE( "_nfc_response_handler changed call back NET_NFC_MESSAGE_INIT NET_NFC_OK\n");
+ }
+
+ if( g_nfc_context.on_activation_completed_cb != NULL ){
+ g_nfc_context.on_activation_completed_cb(result , g_nfc_context.on_activation_completed_user_data);
+ LOGE( "_nfc_response_handler completed call back NET_NFC_MESSAGE_INIT NET_NFC_OK\n");
+
+ nfc_manager_unset_activation_completed_cb();
+ }
+ else
+ {
+ g_nfc_context.on_activation_doing = false;
+ LOGE( "g_nfc_context.on_activation_doing\n");
+ }
+
+
+ }
+
+ break;
+ }
+
+ case NET_NFC_MESSAGE_DEINIT :
+ {
+ bool activated = false;
+
+ if (result == NET_NFC_OK){
+ if( g_nfc_context.on_activation_changed_cb != NULL ){
+ g_nfc_context.on_activation_changed_cb(activated , g_nfc_context.on_activation_changed_user_data);
+ LOGE( "_nfc_response_handler NET_NFC_MESSAGE_DEINIT NET_NFC_OK\n");
+ }
+
+ if( g_nfc_context.on_activation_completed_cb != NULL ){
+ g_nfc_context.on_activation_completed_cb(result , g_nfc_context.on_activation_completed_user_data);
+ LOGE( "_nfc_response_handler completed call back NET_NFC_MESSAGE_INIT NET_NFC_OK\n");
+
+ nfc_manager_unset_activation_completed_cb();
+ }
+ else
+ {
+ g_nfc_context.on_activation_doing = false;
+ LOGE( "g_nfc_context.on_activation_doing\n");
+ }
}
break;
case NET_NFC_MESSAGE_SE_TYPE_TRANSACTION:
event = NFC_SE_EVENT_TRANSACTION;
break;
- default:
- break;
+ default:
+ break;
}
if( g_nfc_context.on_se_event_cb ){
}
-static void __nfc_set_activation_completed(net_nfc_error_e error, void *user_data)
+
+bool nfc_manager_is_supported(void)
{
- int capi_result = _convert_error_code("nfc_set_activation_completed", error);
- nfc_set_activation_completed_cb cb = g_nfc_set_activation_completed_cb;
- g_nfc_set_activation_completed_cb = NULL;
- if(cb)
- {
- cb(capi_result, user_data);
- }
- return ;
+ int nfc_supported = 0;
+
+ net_nfc_is_supported(&nfc_supported);
+
+ return nfc_supported;
}
-int nfc_manager_set_activation(bool activation, nfc_set_activation_completed_cb callback, void *user_data)
+
+int nfc_manager_set_activation(bool activation, nfc_activation_completed_cb callback, void *user_data)
{
int ret = 0;
int nfc_supported = 0;
+ bool nfc_check_activation = 0;
+
+ nfc_check_activation = nfc_manager_check_activation();
+
+ if(nfc_check_activation == true)
+ {
+ LOGE( "nfc_manager_check_activation BUSY!!!!!\n");
+ return NFC_ERROR_DEVICE_BUSY;
+ }
net_nfc_is_supported(&nfc_supported);
if(!nfc_supported)
{
- ret = NFC_ERROR_NOT_SUPPORTED;
+ ret = NFC_ERROR_NOT_SUPPORTED;
}
else
{
{
if(activation)
{
- ret = NFC_ERROR_ALREADY_ACTIVATED;
+ ret = NFC_ERROR_ALREADY_ACTIVATED;
}
else
{
- ret = NFC_ERROR_ALREADY_DEACTIVATED;
+ ret = NFC_ERROR_ALREADY_DEACTIVATED;
}
}
else
{
- g_nfc_set_activation_completed_cb = callback;
- ret = net_nfc_set_state(activation, __nfc_set_activation_completed);
- if (ret)
+
+ nfc_manager_set_activation_completed_cb(callback , user_data);
+
+ ret = net_nfc_set_state(activation, NULL);
+
+ if (ret == NET_NFC_OK)
{
- ret = NFC_ERROR_OPERATION_FAILED;
+ ret = NFC_ERROR_NONE;
+ LOGE( "nfc_manager_set_activation net_nfc_set_state success\n");
}
else
{
- ret = NFC_ERROR_NONE;
+ nfc_manager_unset_activation_completed_cb();
+ ret = NFC_ERROR_OPERATION_FAILED;
+ LOGE( "nfc_manager_set_activation net_nfc_set_state fail\n");
}
}
}
}
+int nfc_manager_set_activation_changed_cb(nfc_activation_changed_cb callback , void *user_data)
+{
+ if( callback == NULL)
+ return _return_invalid_param(__func__);
+ g_nfc_context.on_activation_changed_cb = callback;
+ g_nfc_context.on_activation_changed_user_data = user_data;
+ return 0;
+}
+
+void nfc_manager_unset_activation_changed_cb(void)
+{
+ g_nfc_context.on_activation_changed_cb = NULL;
+ g_nfc_context.on_activation_changed_user_data = NULL;
+}
+
+
+
bool nfc_manager_is_activated(void)
{
{
int ret;
- if(!nfc_manager_is_activated())
- {
- return NFC_ERROR_NOT_ACTIVATED;
- }
+
ret = net_nfc_initialize();
if( ret != NET_NFC_OK )
return _convert_error_code(__func__, ret);
int nfc_manager_deinitialize (void)
{
int ret;
+
+ net_nfc_state_deactivate();
+
ret = net_nfc_deinitialize();
if( ret == 0)
net_nfc_unset_response_callback();
- net_nfc_state_deactivate();
-
return _convert_error_code(__func__, ret);
}
return _convert_error_code(__func__, ret);
}
-int nfc_tag_foreach_information(nfc_tag_h tag , nfc_tag_information_cb callback , void * user_data ){
- char **keys;
- int number_of_keys;
+int nfc_tag_foreach_information(nfc_tag_h tag , nfc_tag_information_cb callback , void * user_data )
+{
int i;
- int ret ;
+
+ net_nfc_tag_info_s *taglist = g_nfc_context.current_tag.tag_info_list;
if( tag == NULL || callback == NULL )
return _return_invalid_param(__func__);
- ret = net_nfc_get_tag_info_keys(tag, &keys , &number_of_keys);
- if( ret != 0 )
- return _convert_error_code(__func__, ret);
-
- for( i = 0 ; i < number_of_keys ; i++){
- data_s *tmpdata;
- ret = net_nfc_get_tag_info_value( tag, keys[i], (data_h*)&tmpdata);
- if( ret == 0 ){
- bool cont;
- cont = callback(keys[i], tmpdata->buffer, tmpdata->length, user_data);
- if( !cont )
- break;
- }
+ for(i=0; i<g_nfc_context.current_tag.number_of_keys; i++){
+ bool cont;
+ cont = callback(taglist[i].key, net_nfc_get_data_buffer(taglist[i].value), net_nfc_get_data_length(taglist[i].value), user_data);
+ if( !cont )
+ break;
}
- //free(keys);
-
return 0;
-
}
if( tag == NULL )
return _return_invalid_param(__func__);
+
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
int ret=0;
data_s rawdata = { buffer, buffer_size };
net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
if( tag == NULL )
return _return_invalid_param(__func__);
+
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
int ret=0;
_async_callback_data * trans_data = NULL;
net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
if( tag == NULL )
return _return_invalid_param(__func__);
+
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
int ret=0;
_async_callback_data * trans_data = NULL;
net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
if( tag == NULL )
return _return_invalid_param(__func__);
+
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
data_s key_data = { key, key_size };
int ret=0;
net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
if( tag == NULL )
return _return_invalid_param(__func__);
+
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
data_s auth_key_data = { auth_key , 6};
int ret = 0;
net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
if( tag == NULL )
return _return_invalid_param(__func__);
+
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
data_s auth_key_data = { auth_key , 6};
int ret = 0;
_async_callback_data * trans_data = NULL;
if( tag == NULL )
return _return_invalid_param(__func__);
+
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
int ret = 0;
_async_callback_data * trans_data = NULL;
net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
int nfc_mifare_read_page(nfc_tag_h tag, int page_index, nfc_mifare_read_block_completed_cb callback, void *user_data)
{
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
return nfc_mifare_read_block(tag, page_index, callback, user_data);
}
if( tag == NULL )
return _return_invalid_param(__func__);
+
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
int ret = 0;
data_s block_data = { buffer , buffer_size};
_async_callback_data * trans_data = NULL;
if( tag == NULL )
return _return_invalid_param(__func__);
+
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
int ret = 0;
data_s block_data = { buffer , buffer_size};
_async_callback_data * trans_data = NULL;
if( tag == NULL )
return _return_invalid_param(__func__);
+
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
int ret = 0;
_async_callback_data * trans_data = NULL;
net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
if( tag == NULL )
return _return_invalid_param(__func__);
+
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
int ret = 0;
_async_callback_data * trans_data = NULL;
net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
if( tag == NULL )
return _return_invalid_param(__func__);
+
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
int ret = 0;
_async_callback_data * trans_data = NULL;
net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
if( tag == NULL )
return _return_invalid_param(__func__);
+
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
+
int ret = 0;
_async_callback_data * trans_data = NULL;
net_nfc_target_info_s *tag_info = (net_nfc_target_info_s*)tag;
- if( tag_info == NULL )
- return _return_invalid_param(__func__);
if( callback != NULL ){
trans_data = (_async_callback_data*)malloc( sizeof(_async_callback_data));
if( target == NULL || message == NULL )
return _return_invalid_param(__func__);
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
net_nfc_exchanger_data_h data_handle;
data_h rawdata;
net_nfc_create_rawdata_from_ndef_message(message, &rawdata);
if( type > NFC_AC_TYPE_UNKNOWN )
return _return_invalid_param(__func__);
+ if(!nfc_manager_is_activated())
+ {
+ return NFC_ERROR_NOT_ACTIVATED;
+ }
+
switch( type ){
case NFC_AC_TYPE_BT:
net_ac_type = NET_NFC_CONN_HANDOVER_CARRIER_BT;
/*
-* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+* Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
}
+
void recv_ndef_from_peer(nfc_error_e error, void *user_data){
int ret ;
success = 0;
}
+void _activation_changed_cb(bool activated , void *user_data){
+ if( activated == true){
+ printf("NET_NFC_MESSAGE_INIT received\n");
+ }else if( activated == false){
+ printf("NET_NFC_MESSAGE_DEINIT received\n");
+ }
+}
+
+
+void on_activation_changed_cb_test(nfc_error_e error, void *user_data){
+ int ret ;
+ success = 0;
+ timeout_counter = 30;
+ ret = nfc_manager_set_activation_changed_cb(_activation_changed_cb , NULL);
+ printf("Now, wait NET_NFC_MESSAGE_INIT or NET_NFC_MESSAGE_DEINIT\n");
+ ecore_timer_add(1, timeout_handler, NULL);
+
+}
+
+
Eina_Bool check_terminate(void *data){
if( is_terminate ){
"------------------\n"
" 0. NFC OFF\n"
" 1. NFC ON\n"
+ " 2. ON/OFF on_activation_changed_cb check\n"
"------------------\n"
" a. ndef record test\n"
" h. OFF nfc_manager_enable_system_handler\n"
+
"------------------\n"
">";
elm_shutdown();
return 0;
+ case '2':
+ ret = nfc_manager_initialize(on_activation_changed_cb_test,NULL);
+ print_result("on_activation_changed_cb", ret);
+ break;
+
case 'a':
ret = nfc_manager_initialize(ndef_record_create_test,NULL);
print_result("nfc_manager_initialize", ret);
return 0;
+
default:
printf("wrong selection!\n");
is_terminate = 1;