revise file name.
revise indent.
revise makefiles.
cleanup code.
Change-Id: Ic7c714c0916c6d35ff07839aedef81a281bcb8af
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(nfc-manager C)
-MESSAGE("build nfc-common-lib and nfc-manager")
+INCLUDE(FindPkgConfig)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall -Werror-implicit-function-declaration")
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC -fvisibility=hidden")
+#SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fno-strict-aliasing")
+
+#SET(ARM_CFLAGS "-mabi=aapcs-linux -fno-common")
+
+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()
+
+SET(CMAKE_SHARED_LINKER_FLAGS " -Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
+SET(CMAKE_EXE_LINKER_FLAGS " -Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(LIBDIR "${PREFIX}/lib")
-SET(MODULEDIR "${LIBDIR}/nfc")
-ADD_DEFINITIONS("-D_GNU_SOURCE")
+ADD_DEFINITIONS("-DNFC_MANAGER_MODULEDIR=\"${LIB_INSTALL_DIR}/nfc\"")
+
#ADD_DEFINITIONS("-DSECURITY_SERVER")
+ADD_DEFINITIONS("-DUSE_FULL_URI")
+#ADD_DEFINITIONS("-DESE_ALWAYS_ON")
-ADD_SUBDIRECTORY(src/commonlib)
-ADD_SUBDIRECTORY(src/clientlib)
-ADD_SUBDIRECTORY(src/manager)
-#ADD_SUBDIRECTORY(test_clinet_app/ndef-tool)
-#ADD_SUBDIRECTORY(test_clinet_app/nfc_client)
+ADD_SUBDIRECTORY(common)
+ADD_SUBDIRECTORY(client)
+ADD_SUBDIRECTORY(daemon)
ADD_SUBDIRECTORY(tests)
+#ADD_SUBDIRECTORY(tools/ndef-tool)
+#ADD_SUBDIRECTORY(tools/nfc-client)
+++ /dev/null
-#!/bin/sh
-
-. ./config
-export TET_INSTALL_PATH=$TET_INSTALL_HOST_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)
-
-ifeq ($(ARCH),target)
- PKG_CONFIG_PATH=/usr/lib/pkgconfig
- export PKG_CONFIG_PATH
- CC=arm-linux-gcc -Wall
- CXX=arm-linux-g++ -Wall
-else
- PKG_CONFIG_PATH=/usr/lib/pkgconfig
- export PKG_CONFIG_PATH
- CC=gcc -Wall
- CXX=gcc -Wall
-endif
-
-
-LDFLAGS = `pkg-config --libs nfc nfc-common-lib glib-2.0`
-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 nfc nfc-common-lib glib-2.0`
-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_net_nfc_client_data
-/testcase/utc_net_nfc_client_exchanger
-/testcase/utc_net_nfc_client_internal_se
-/testcase/utc_net_nfc_client_ndef_message
-/testcase/utc_net_nfc_client_ndef_record
-/testcase/utc_net_nfc_client_nfc
-/testcase/utc_net_nfc_client_tag
-/testcase/utc_net_nfc_client_tag_felica
-/testcase/utc_net_nfc_client_tag_jewel
-/testcase/utc_net_nfc_client_tag_mifare
-/testcase/utc_net_nfc_client_target_info
-
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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>
-
-#include <net_nfc_data.h>
-#include <net_nfc_typedef.h>
-#include <net_nfc_typedef_internal.h>
-#include <net_nfc_util_internal.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_net_nfc_create_data_only_p(void);
-static void utc_net_nfc_create_data_only_n(void);
-static void utc_net_nfc_create_data_p(void);
-static void utc_net_nfc_create_data_n(void);
-static void utc_net_nfc_get_data_p(void);
-static void utc_net_nfc_get_data_n(void);
-static void utc_net_nfc_set_data_p(void);
-static void utc_net_nfc_set_data_n(void);
-static void utc_net_nfc_get_data_length_p(void);
-static void utc_net_nfc_get_data_length_n(void);
-static void utc_net_nfc_get_data_buffer_p(void);
-static void utc_net_nfc_get_data_buffer_n(void);
-static void utc_net_nfc_free_data_p(void);
-static void utc_net_nfc_free_data_n(void);
-
-
-
-
-struct tet_testlist tet_testlist[] = {
- { utc_net_nfc_create_data_only_p , POSITIVE_TC_IDX },
- { utc_net_nfc_create_data_only_n , NEGATIVE_TC_IDX },
- { utc_net_nfc_create_data_p, POSITIVE_TC_IDX },
- { utc_net_nfc_create_data_n , NEGATIVE_TC_IDX},
- { utc_net_nfc_get_data_p, 1},
- { utc_net_nfc_get_data_n, 2 },
- { utc_net_nfc_set_data_p, 1},
- { utc_net_nfc_set_data_n, 2},
- { utc_net_nfc_get_data_length_p, 1},
- { utc_net_nfc_get_data_length_n, 2},
- { utc_net_nfc_get_data_buffer_p, 1},
- { utc_net_nfc_get_data_buffer_n, 2},
- { utc_net_nfc_free_data_p, 1},
- { utc_net_nfc_free_data_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_net_nfc_create_data_only_p(void)
-{
- int ret=0;
- data_h* config = NULL;
-
- config = calloc(1 , sizeof(data_h));
-
- ret = net_nfc_create_data_only(config);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_create_data_only is failed");
-}
-
-static void utc_net_nfc_create_data_only_n(void)
-{
- int ret=0;
-
- ret = net_nfc_create_data_only(NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_create_data not allow null");
-}
-
-static void utc_net_nfc_create_data_p(void)
-{
- int ret=0;
- data_h* config = NULL;
- uint8_t* sec_param = NULL;
-
- config = calloc(1, sizeof(data_h));
- sec_param = calloc(1, sizeof(uint8_t));
- memcpy(sec_param , "U" , sizeof(uint8_t));
-
- ret = net_nfc_create_data(config , sec_param/*"U"*/ , 1);
-
- free(config);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_create_data is failed");
-}
-
-static void utc_net_nfc_create_data_n(void)
-{
- int ret=0;
-
- ret = net_nfc_create_data(NULL , NULL , 0);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_create_data_only not allow null");
-}
-
-static void utc_net_nfc_get_data_p(void)
-{
- int ret=0;
- data_h data = NULL;
- uint8_t* byte = NULL;
- uint32_t length;
-
- byte = calloc(10, sizeof(uint8_t));
-
- data = calloc(1, sizeof(data_s));
-
- ret = net_nfc_get_data(data , &byte , &length);
-
- free(data);
- free(byte);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_get_data is failed");
-}
-
-static void utc_net_nfc_get_data_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_data(NULL , NULL , NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_get_data not allow null");
-}
-
-static void utc_net_nfc_set_data_p(void)
-{
- int ret=0;
- data_h data = NULL;
- uint8_t main_record_name[] = "samsung.com:allshare";
-
- data = calloc(1, sizeof(data_h));
-
- ret = net_nfc_set_data (data, main_record_name, 20);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_set_data is failed");
-}
-
-static void utc_net_nfc_set_data_n(void)
-{
- int ret=0;
-
- ret = net_nfc_set_data(NULL , NULL , 0);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_set_data not allow null");
-}
-
-static void utc_net_nfc_get_data_length_p(void)
-{
- int ret=0;
- int length = 0;
- data_s* data = NULL;
- //uint8_t temp_data[] = "www.samsung.com";
- uint32_t temp_size = 16;
-
- data = calloc(1, sizeof(data_s));
-
- //data->buffer = temp_data;
- data->length = temp_size;
-
- length = net_nfc_get_data_length ((data_h)data);
-
- if(length > 0)
- {
- ret = NET_NFC_OK;
- }
- else
- {
- ret = NET_NFC_UNKNOWN_ERROR;
- }
-
- free(data);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_get_data_length is failed");
-}
-
-static void utc_net_nfc_get_data_length_n(void)
-{
- int ret=0;
- int length = 0;
-
- length = net_nfc_get_data_length(NULL);
-
- if(length > 0)
- {
- ret = NET_NFC_OK;
- }
- else
- {
- ret = NET_NFC_UNKNOWN_ERROR;
- }
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_get_data_length not allow null");
-}
-
-static void utc_net_nfc_get_data_buffer_p(void)
-{
- int ret=0;
- uint8_t* buffer = NULL;
- data_s* data = NULL;
- uint8_t temp_data[] = "www.samsung.com";
- int temp_size = 16;
-
- data = calloc(1, sizeof(data_s));
-
- data->buffer = temp_data;
- data->length = temp_size;
-
- buffer = net_nfc_get_data_buffer ((data_h)data);
-
- if(buffer != NULL)
- {
- ret = NET_NFC_OK;
- }
- else
- {
- ret = NET_NFC_UNKNOWN_ERROR;
- }
-
- free(data);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_get_data_buffer is failed");
-}
-
-static void utc_net_nfc_get_data_buffer_n(void)
-{
- int ret=0;
- uint8_t* buffer = NULL;
-
- buffer = net_nfc_get_data_buffer(NULL);
-
- if(buffer != NULL)
- {
- ret = NET_NFC_OK;
- }
- else
- {
- ret = NET_NFC_UNKNOWN_ERROR;
- }
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_get_data_buffer not allow null");
-}
-
-static void utc_net_nfc_free_data_p(void)
-{
- int ret=0;
- data_h data = NULL;
- //uint8_t temp_data[] = "www.samsung.com";
- //uint32_t temp_size = 16;
-
- data = calloc(1, sizeof(data_h));
-
- ret = net_nfc_free_data (data);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_free_data is failed");
-}
-
-static void utc_net_nfc_free_data_n(void)
-{
- int ret=0;
-
- ret = net_nfc_free_data(NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_free_data not allow null");
-}
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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>
-
-#include <net_nfc_exchanger.h>
-#include <net_nfc_typedef.h>
-#include <net_nfc_typedef_internal.h>
-#include <net_nfc_util_internal.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_net_nfc_create_exchanger_data_p(void);
-static void utc_net_nfc_create_exchanger_data_n(void);
-static void utc_net_nfc_free_exchanger_data_p(void);
-static void utc_net_nfc_free_exchanger_data_n(void);
-static void utc_net_nfc_set_exchanger_cb_p(void);
-static void utc_net_nfc_set_exchanger_cb_n(void);
-static void utc_net_nfc_unset_exchanger_cb_p(void);
-static void utc_net_nfc_unset_exchanger_cb_n(void);
-
-
-
-
-
-struct tet_testlist tet_testlist[] = {
- { utc_net_nfc_create_exchanger_data_p , POSITIVE_TC_IDX},
- { utc_net_nfc_create_exchanger_data_n , NEGATIVE_TC_IDX},
- { utc_net_nfc_free_exchanger_data_p, 1},
- { utc_net_nfc_free_exchanger_data_n, 2 },
- { utc_net_nfc_set_exchanger_cb_p, 1},
- { utc_net_nfc_set_exchanger_cb_n, 2},
- { utc_net_nfc_unset_exchanger_cb_p, 1},
- { utc_net_nfc_unset_exchanger_cb_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_net_nfc_create_exchanger_data_p(void)
-{
- int ret=0;
- net_nfc_exchanger_data_h* ex_data = NULL;
- char temp[] = "http://www.samsung.com";
- data_s payload;
-
- payload.length= 23;
-
- payload.buffer = calloc(1 , 23*sizeof(char));
-
- memcpy(payload.buffer , temp , sizeof(temp));
-
- ex_data = calloc(1 , sizeof(ex_data));
-
- ret = net_nfc_create_exchanger_data(ex_data , (data_h)&payload);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_create_exchanger_url_type_data is failed");
-}
-
-static void utc_net_nfc_create_exchanger_data_n(void)
-{
- int ret=0;
-
- ret = net_nfc_create_exchanger_data(NULL , NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_create_exchanger_url_type_data not allow null");
-}
-
-static void utc_net_nfc_free_exchanger_data_p(void)
-{
- int ret=0;
- net_nfc_exchanger_data_h ex_data = NULL;
- char temp[] = "http://www.samsung.com";
- data_s payload;
-
- payload.length= 23;
-
- payload.buffer = calloc(1 , 23*sizeof(char));
-
- memcpy(payload.buffer , temp , sizeof(temp));
-
- net_nfc_create_exchanger_data(&ex_data , (data_h)&payload );
-
- ret = net_nfc_free_exchanger_data(ex_data);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "utc_net_nfc_free_exchanger_data_p is failed");
-}
-
-static void utc_net_nfc_free_exchanger_data_n(void)
-{
- int ret=0;
-
- ret = net_nfc_free_exchanger_data(NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "utc_net_nfc_free_exchanger_data_p not allow null");
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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"
-#include "net_nfc_typedef_internal.h"
-#include "net_nfc_internal_se.h"
-#include "net_nfc_util_internal.h"
-#include "net_nfc_data.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_net_nfc_set_secure_element_type_p(void);
-static void utc_net_nfc_set_secure_element_type_n(void);
-static void utc_net_nfc_get_secure_element_type_p(void);
-static void utc_net_nfc_get_secure_element_type_n(void);
-static void utc_net_nfc_open_internal_secure_element_p(void);
-static void utc_net_nfc_open_internal_secure_element_n(void);
-static void utc_net_nfc_close_internal_secure_element_p(void);
-static void utc_net_nfc_close_internal_secure_element_n(void);
-static void utc_net_nfc_send_apdu_p(void);
-static void utc_net_nfc_send_apdu_n(void);
-
-
-
-struct tet_testlist tet_testlist[] = {
- { utc_net_nfc_set_secure_element_type_p , POSITIVE_TC_IDX },
- { utc_net_nfc_set_secure_element_type_n , NEGATIVE_TC_IDX },
- { utc_net_nfc_get_secure_element_type_p, POSITIVE_TC_IDX },
- { utc_net_nfc_get_secure_element_type_n , NEGATIVE_TC_IDX},
- { utc_net_nfc_open_internal_secure_element_p, 1},
- { utc_net_nfc_open_internal_secure_element_n, 2 },
- { utc_net_nfc_close_internal_secure_element_p, 1},
- { utc_net_nfc_close_internal_secure_element_n, 2},
- { utc_net_nfc_send_apdu_p, 1},
- { utc_net_nfc_send_apdu_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_net_nfc_set_secure_element_type_p(void)
-{
- int ret=0;
-
- ret = net_nfc_set_secure_element_type(NET_NFC_SE_TYPE_UICC, NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_set_secure_element_type_n(void)
-{
- int ret=0;
-
- ret = net_nfc_set_secure_element_type( -1 , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_secure_element_type_p(void)
-{
- int ret=0;
-
- ret = net_nfc_get_secure_element_type(NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_secure_element_type_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_secure_element_type(NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_open_internal_secure_element_p(void)
-{
- net_nfc_open_internal_secure_element(NET_NFC_SE_TYPE_ESE, NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_open_internal_secure_element_n(void)
-{
- int ret=0;
-
- ret = net_nfc_open_internal_secure_element(NET_NFC_SE_TYPE_ESE, NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_close_internal_secure_element_p(void)
-{
- int ret=0;
- void * trans_data = NULL;
-
- ret = net_nfc_close_internal_secure_element ((net_nfc_target_handle_h)trans_data, NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_close_internal_secure_element_n(void)
-{
- int ret=0;
-
- ret = net_nfc_close_internal_secure_element(NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_send_apdu_p(void)
-{
- int ret ;
- net_nfc_target_handle_h data = NULL;
- data_h apdu = NULL;
- uint8_t apdu_cmd[4] = {0x00, 0xA4, 0x00, 0x0C} ; // CLA 0-> use default channel and no secure message. 0xA4 -> select instruction
-
- //data->connection_id = 1;
- //data->connection_type = NET_NFC_SE_CONNECTION;
-
- net_nfc_create_data(&apdu, apdu_cmd, 4);
-
- ret = net_nfc_send_apdu((net_nfc_target_handle_h)(data), apdu, data);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_send_apdu_n(void)
-{
- int ret ;
-
- ret = net_nfc_send_apdu(NULL , NULL , NULL );
-
- dts_pass(__func__, "PASS");
-}
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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>
-
-#include "net_nfc_ndef_message.h"
-#include "net_nfc_util_internal.h"
-#include "net_nfc.h" // to use net_nfc_data
-
-
-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_net_nfc_create_ndef_message_p(void);
-static void utc_net_nfc_create_ndef_message_n(void);
-static void utc_net_nfc_create_rawdata_from_ndef_message_p(void);
-static void utc_net_nfc_create_rawdata_from_ndef_message_n(void);
-static void utc_net_nfc_create_ndef_message_from_rawdata_p(void);
-static void utc_net_nfc_create_ndef_message_from_rawdata_n(void);
-static void utc_net_nfc_get_ndef_message_byte_length_p(void);
-static void utc_net_nfc_get_ndef_message_byte_length_n(void);
-static void utc_net_nfc_append_record_to_ndef_message_p(void);
-static void utc_net_nfc_append_record_to_ndef_message_n(void);
-static void utc_net_nfc_free_ndef_message_p(void);
-static void utc_net_nfc_free_ndef_message_n(void);
-static void utc_net_nfc_get_ndef_message_record_count_p(void);
-static void utc_net_nfc_get_ndef_message_record_count_n(void);
-
-
-
-
-struct tet_testlist tet_testlist[] = {
- { utc_net_nfc_create_ndef_message_p , POSITIVE_TC_IDX },
- { utc_net_nfc_create_ndef_message_n , NEGATIVE_TC_IDX },
- { utc_net_nfc_create_rawdata_from_ndef_message_p, POSITIVE_TC_IDX },
- { utc_net_nfc_create_rawdata_from_ndef_message_n , NEGATIVE_TC_IDX},
- { utc_net_nfc_create_ndef_message_from_rawdata_p, 1},
- { utc_net_nfc_create_ndef_message_from_rawdata_n, 2 },
- { utc_net_nfc_get_ndef_message_byte_length_p, 1},
- { utc_net_nfc_get_ndef_message_byte_length_n, 2},
- { utc_net_nfc_append_record_to_ndef_message_p, 1},
- { utc_net_nfc_append_record_to_ndef_message_n, 2},
- { utc_net_nfc_free_ndef_message_p, 1},
- { utc_net_nfc_free_ndef_message_n, 2},
- { utc_net_nfc_get_ndef_message_record_count_p, 1},
- { utc_net_nfc_get_ndef_message_record_count_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_net_nfc_create_ndef_message_p(void)
-{
- int ret ;
- ndef_message_h message;
-
- ret = net_nfc_create_ndef_message(&message);
- net_nfc_free_ndef_message(message);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_create_ndef_message is failed");
-}
-
-static void utc_net_nfc_create_ndef_message_n(void)
-{
- int ret=0;
-
- ret = net_nfc_create_ndef_message( NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_create_ndef_message not allow null");
-}
-
-static void utc_net_nfc_create_rawdata_from_ndef_message_p(void)
-{
- int ret ;
- char url[] = "samsung.com";
- ndef_record_h record = NULL;
- ndef_message_h msg = NULL;
- data_h rawdata = NULL;
-
- net_nfc_create_uri_type_record(&record, url, NET_NFC_SCHEMA_HTTPS_WWW);
-
- net_nfc_create_ndef_message(&msg);
-
- net_nfc_append_record_to_ndef_message(msg, record);
-
- ret = net_nfc_create_rawdata_from_ndef_message (msg, &rawdata);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_create_rawdata_from_ndef_message is failed");
-}
-
-static void utc_net_nfc_create_rawdata_from_ndef_message_n(void)
-{
- int ret ;
-
- ret = net_nfc_create_rawdata_from_ndef_message (NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_create_rawdata_from_ndef_message not allow null");
-}
-
-static void utc_net_nfc_create_ndef_message_from_rawdata_p(void)
-{
- int ret ;
- uint8_t url[] = "samsung.com";
- ndef_message_s* msg = NULL;
- data_s* rawdata = NULL;
-
- rawdata = calloc(1, sizeof(data_s));
- msg = calloc(1, sizeof(ndef_message_s));
-
- rawdata->buffer = url;
- rawdata->length = 11;
-
- ret = net_nfc_create_ndef_message_from_rawdata ((ndef_message_h*)msg, (data_h)rawdata);
-
- net_nfc_free_ndef_message((ndef_message_h)msg);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_create_ndef_message_from_rawdata is failed");
-}
-
-static void utc_net_nfc_create_ndef_message_from_rawdata_n(void)
-{
- int ret ;
-
- ret = net_nfc_create_ndef_message_from_rawdata (NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK,"net_nfc_create_ndef_message_from_rawdata not allow null");
-}
-
-static void utc_net_nfc_get_ndef_message_byte_length_p(void)
-{
- int ret ;
- char url[] = "samsung.com";
- ndef_record_h record = NULL;
- ndef_message_h msg = NULL;
- uint32_t length = 0;
-
- net_nfc_create_uri_type_record(&record, url, NET_NFC_SCHEMA_HTTPS_WWW);
-
- net_nfc_create_ndef_message(&msg);
-
- net_nfc_append_record_to_ndef_message(msg, record);
-
- ret = net_nfc_get_ndef_message_byte_length(msg , &length);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_get_ndef_message_byte_length is failed");
-}
-
-static void utc_net_nfc_get_ndef_message_byte_length_n(void)
-{
- int ret ;
-
- ret = net_nfc_get_ndef_message_byte_length (NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK,"net_nfc_get_ndef_message_byte_length not allow null");
-}
-
-static void utc_net_nfc_append_record_to_ndef_message_p(void)
-{
- int ret ;
- char url[] = "samsung.com";
- ndef_record_h record = NULL;
- ndef_message_h msg = NULL;
-
- net_nfc_create_uri_type_record(&record, url, NET_NFC_SCHEMA_HTTPS_WWW);
-
- net_nfc_create_ndef_message(&msg);
-
- ret = net_nfc_append_record_to_ndef_message(msg, record);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_append_record_to_ndef_message is failed");
-}
-
-static void utc_net_nfc_append_record_to_ndef_message_n(void)
-{
- int ret ;
-
- ret = net_nfc_append_record_to_ndef_message (NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK,"net_nfc_append_record_to_ndef_message not allow null");
-}
-
-static void utc_net_nfc_free_ndef_message_p(void)
-{
- int ret ;
- ndef_message_h message;
-
- net_nfc_create_ndef_message(&message);
- ret = net_nfc_free_ndef_message(message);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "utc_net_nfc_free_ndef_message_n is failed");
-}
-
-static void utc_net_nfc_free_ndef_message_n(void)
-{
- int ret=0;
-
- ret = net_nfc_free_ndef_message( NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "utc_net_nfc_free_ndef_message_n not allow null");
-}
-
-static void utc_net_nfc_get_ndef_message_record_count_p(void)
-{
- int ret ;
- char url[] = "samsung.com";
- ndef_record_h record = NULL;
- ndef_message_h msg = NULL;
- int count = 0;
-
- net_nfc_create_uri_type_record(&record, url, NET_NFC_SCHEMA_HTTPS_WWW);
-
- net_nfc_create_ndef_message(&msg);
-
- net_nfc_append_record_to_ndef_message(msg, record);
-
- ret = net_nfc_get_ndef_message_record_count( msg , &count );
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_get_ndef_message_record_count is failed");
-}
-
-static void utc_net_nfc_get_ndef_message_record_count_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_ndef_message_record_count( NULL , NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_get_ndef_message_record_count not allow null");
-}
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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>
-
-#include "net_nfc_ndef_record.h"
-#include "net_nfc_ndef_message.h"
-#include "net_nfc_util_internal.h"
-#include "net_nfc_data.h"
-//#include "net_nfc_debug_internal.h"
-#include "net_nfc_util_internal.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_net_nfc_create_record_p(void);
-static void utc_net_nfc_create_record_n(void);
-static void utc_net_nfc_create_text_type_record_p(void);
-static void utc_net_nfc_create_text_type_record_n(void);
-static void utc_net_nfc_create_uri_type_record_p(void);
-static void utc_net_nfc_create_uri_type_record_n(void);
-static void utc_net_nfc_free_record_p(void);
-static void utc_net_nfc_free_record_n(void);
-static void utc_net_nfc_get_record_payload_p(void);
-static void utc_net_nfc_get_record_payload_n(void);
-static void utc_net_nfc_get_record_type_p(void);
-static void utc_net_nfc_get_record_type_n(void);
-static void utc_net_nfc_set_record_id_p(void);
-static void utc_net_nfc_set_record_id_n(void);
-static void utc_net_nfc_get_record_id_p(void);
-static void utc_net_nfc_get_record_id_n(void);
-static void utc_net_nfc_get_record_tnf_p(void);
-static void utc_net_nfc_get_record_tnf_n(void);
-static void utc_net_nfc_get_record_flags_p(void);
-static void utc_net_nfc_get_record_flags_n(void);
-static void utc_net_nfc_get_record_mb_p(void);
-static void utc_net_nfc_get_record_mb_n(void);
-static void utc_net_nfc_get_record_me_p(void);
-static void utc_net_nfc_get_record_me_n(void);
-static void utc_net_nfc_get_record_cf_p(void);
-static void utc_net_nfc_get_record_cf_n(void);
-static void utc_net_nfc_get_record_il_p(void);
-static void utc_net_nfc_get_record_il_n(void);
-static void utc_net_nfc_get_record_sr_p(void);
-static void utc_net_nfc_get_record_sr_n(void);
-static void utc_net_nfc_create_text_string_from_text_record_p(void);
-static void utc_net_nfc_create_text_string_from_text_record_n(void);
-static void utc_net_nfc_get_languange_code_string_from_text_record_p(void);
-static void utc_net_nfc_get_languange_code_string_from_text_record_n(void);
-static void utc_net_nfc_get_encoding_type_from_text_record_p(void);
-static void utc_net_nfc_get_encoding_type_from_text_record_n(void);
-static void utc_net_nfc_create_uri_string_from_uri_record_p(void);
-static void utc_net_nfc_create_uri_string_from_uri_record_n(void);
-
-
-
-
-
-
-
-struct tet_testlist tet_testlist[] = {
- { utc_net_nfc_create_record_p , POSITIVE_TC_IDX },
- { utc_net_nfc_create_record_n , NEGATIVE_TC_IDX },
- { utc_net_nfc_create_text_type_record_p, POSITIVE_TC_IDX },
- { utc_net_nfc_create_text_type_record_n , NEGATIVE_TC_IDX},
- { utc_net_nfc_create_uri_type_record_p, 1},
- { utc_net_nfc_create_uri_type_record_n, 2 },
- { utc_net_nfc_free_record_p, 1},
- { utc_net_nfc_free_record_n, 2},
- { utc_net_nfc_get_record_payload_p, 1},
- { utc_net_nfc_get_record_payload_n, 2},
- { utc_net_nfc_get_record_type_p, 1},
- { utc_net_nfc_get_record_type_n, 2},
- { utc_net_nfc_set_record_id_p, 1},
- { utc_net_nfc_set_record_id_n, 2},
- { utc_net_nfc_get_record_id_p, 1},
- { utc_net_nfc_get_record_id_n, 2},
- { utc_net_nfc_get_record_tnf_p, 1},
- { utc_net_nfc_get_record_tnf_n, 2},
- { utc_net_nfc_get_record_flags_p, 1},
- { utc_net_nfc_get_record_flags_n, 2},
- { utc_net_nfc_get_record_mb_p, 1},
- { utc_net_nfc_get_record_mb_n, 2},
- { utc_net_nfc_get_record_me_p, 1},
- { utc_net_nfc_get_record_me_n, 2},
- { utc_net_nfc_get_record_cf_p, 1},
- { utc_net_nfc_get_record_cf_n, 2},
- { utc_net_nfc_get_record_il_p, 1},
- { utc_net_nfc_get_record_il_n, 2},
- { utc_net_nfc_get_record_sr_p, 1},
- { utc_net_nfc_get_record_sr_n, 2},
- { utc_net_nfc_create_text_string_from_text_record_p, 1},
- { utc_net_nfc_create_text_string_from_text_record_n, 2},
- { utc_net_nfc_get_languange_code_string_from_text_record_p, 1},
- { utc_net_nfc_get_languange_code_string_from_text_record_n, 2},
- { utc_net_nfc_get_encoding_type_from_text_record_p, 1},
- { utc_net_nfc_get_encoding_type_from_text_record_n, 2},
- { utc_net_nfc_create_uri_string_from_uri_record_p, 1},
- { utc_net_nfc_create_uri_string_from_uri_record_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_net_nfc_create_record_p(void)
-{
- int ret ;
- ndef_record_h record = NULL;
- data_s* payload = NULL;
- data_s* typeName = NULL;
- uint8_t url[] = "samsung.com";
- uint8_t temp[] = "U";
-
- typeName = calloc(1, sizeof(data_s));
- payload = calloc(1, sizeof(data_s));
-
- typeName->buffer = temp;
- typeName->length = 1;
-
- payload->buffer = url;
- payload->length = 11;
-
- ret = net_nfc_create_record(&record, NET_NFC_RECORD_WELL_KNOWN_TYPE, (data_h)typeName, NULL, (data_h)payload);
-
- net_nfc_free_record(record);
-
- free(payload);
- free(typeName);
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_create_record is failed");
-}
-
-static void utc_net_nfc_create_record_n(void)
-{
- int ret=0;
-
- ret = net_nfc_create_record( NULL , 0 , NULL , NULL , NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_create_record not allow null");
-}
-
-static void utc_net_nfc_create_text_type_record_p(void)
-{
- int ret ;
- ndef_record_h record = NULL;
-
- ret = net_nfc_create_text_type_record(&record, "This is real NFC", "en-US", NET_NFC_ENCODE_UTF_8);
-
- net_nfc_free_record(record);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_create_text_type_record is failed");
-}
-
-static void utc_net_nfc_create_text_type_record_n(void)
-{
- int ret=0;
-
- ret = net_nfc_create_text_type_record( NULL , NULL , NULL , 0 );
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_create_text_type_record not allow null");
-}
-
-static void utc_net_nfc_create_uri_type_record_p(void)
-{
- int ret ;
- ndef_record_h record = NULL;
-
- ret = net_nfc_create_uri_type_record(&record ,"http://www.naver.com", NET_NFC_SCHEMA_FULL_URI);
-
- net_nfc_free_record(record);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_create_uri_type_record is failed");
-}
-
-static void utc_net_nfc_create_uri_type_record_n(void)
-{
- int ret=0;
-
- ret = net_nfc_create_uri_type_record( NULL , NULL , 0 );
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_create_uri_type_record not allow null");
-}
-
-static void utc_net_nfc_free_record_p(void)
-{
- int ret ;
- ndef_record_h record = NULL;
-
- net_nfc_create_uri_type_record(&record ,"http://www.naver.com", NET_NFC_SCHEMA_FULL_URI);
-
- ret = net_nfc_free_record(record);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_free_record is failed");
-}
-
-static void utc_net_nfc_free_record_n(void)
-{
- int ret=0;
-
- ret = net_nfc_free_record(NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_free_record not allow null");
-}
-
-static void utc_net_nfc_get_record_payload_p(void)
-{
- int ret ;
- ndef_record_h record = NULL;
- data_h payload = NULL;
-
- net_nfc_create_uri_type_record(&record ,"http://www.naver.com", NET_NFC_SCHEMA_FULL_URI);
-
- ret = net_nfc_get_record_payload(record, &payload);
-
- net_nfc_free_record(record);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_get_record_payload is failed");
-}
-
-static void utc_net_nfc_get_record_payload_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_record_payload(NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_get_record_payload not allow null");
-}
-
-static void utc_net_nfc_get_record_type_p(void)
-{
- int ret ;
- ndef_record_h record = NULL;
- data_h record_type = NULL;
-
- net_nfc_create_uri_type_record(&record ,"http://www.naver.com", NET_NFC_SCHEMA_FULL_URI);
-
- ret = net_nfc_get_record_type(record, &record_type);
-
- net_nfc_free_record(record);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_get_record_type is failed");
-}
-
-static void utc_net_nfc_get_record_type_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_record_type(NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_get_record_type not allow null");
-}
-
-static void utc_net_nfc_set_record_id_p(void)
-{
- int ret ;
- ndef_record_h record = NULL;
- data_s* id = NULL;
- uint8_t temp[] = "test";
-
- net_nfc_create_uri_type_record(&record ,"http://www.naver.com", NET_NFC_SCHEMA_FULL_URI);
-
- id = calloc(1, sizeof(data_s));
- id->buffer = temp;
- id->length = 4;
-
- ret = net_nfc_set_record_id(record, (data_h)id);
-
- net_nfc_free_record(record);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_set_record_id is failed");
-}
-
-static void utc_net_nfc_set_record_id_n(void)
-{
- int ret=0;
-
- ret = net_nfc_set_record_id(NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_set_record_id not allow null");
-}
-
-static void utc_net_nfc_get_record_id_p(void)
-{
- int ret ;
- ndef_record_h record = NULL;
- data_s* id = NULL;
- data_h id_data = NULL;
- uint8_t temp[] = "test";
-
- net_nfc_create_uri_type_record(&record ,"http://www.naver.com", NET_NFC_SCHEMA_FULL_URI);
-
- id = calloc(1, sizeof(data_s));
- id->buffer = temp;
- id->length = 4;
-
- net_nfc_set_record_id(record, (data_h)id);
-
- ret = net_nfc_get_record_id(record, &id_data);
-
- net_nfc_free_record(record);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_get_record_id is failed");
-}
-
-static void utc_net_nfc_get_record_id_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_record_id(NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_get_record_id not allow null");
-}
-
-static void utc_net_nfc_get_record_tnf_p(void)
-{
- int ret ;
- ndef_record_h record = NULL;
- net_nfc_record_tnf_e* tnf = NULL;
-
- record = calloc( 1 , sizeof(ndef_record_h));
-
- net_nfc_create_uri_type_record(&record ,"http://www.naver.com", NET_NFC_SCHEMA_FULL_URI);
-
- tnf = calloc( 1 , sizeof(net_nfc_record_tnf_e));
-
- ret = net_nfc_get_record_tnf(record, tnf);
-
- net_nfc_free_record(record);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_get_record_tnf is failed");
-}
-
-static void utc_net_nfc_get_record_tnf_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_record_tnf(NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_get_record_tnf not allow null");
-}
-
-static void utc_net_nfc_get_record_flags_p(void)
-{
- net_nfc_error_e ret=0;
- ndef_record_s* record = NULL;
- uint8_t temp = 0x80;
-
- record = calloc(1, sizeof(ndef_record_s));
-
- net_nfc_create_uri_type_record((ndef_record_h*)&record ,"http://www.naver.com", NET_NFC_SCHEMA_FULL_URI);
-
- ret = net_nfc_get_record_flags((ndef_record_h)record, &temp);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_get_record_flags is failed");
-}
-
-static void utc_net_nfc_get_record_flags_n(void)
-{
- net_nfc_error_e ret=0;
-
- ret = net_nfc_get_record_flags(NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_get_record_flags is failed");
-}
-
-static void utc_net_nfc_get_record_mb_p(void)
-{
- unsigned char ret=0;
- unsigned char flag = 0x80;
-
- ret = net_nfc_get_record_mb (flag);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_record_mb_n(void)
-{
- unsigned char ret=0;
-
- ret = net_nfc_get_record_mb(0x00);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_record_me_p(void)
-{
- unsigned char ret=0;
-
- ret = net_nfc_get_record_me(0xff);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_record_me_n(void)
-{
- unsigned char ret=0;
-
- ret = net_nfc_get_record_me(0xff);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_record_cf_p(void)
-{
- unsigned char ret=0;
-
- ret = net_nfc_get_record_cf(0xff);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_record_cf_n(void)
-{
- unsigned char ret=0;
-
- ret = net_nfc_get_record_cf(0xff);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_record_il_p(void)
-{
- unsigned char ret=0;
-
- ret = net_nfc_get_record_il(0xff);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_record_il_n(void)
-{
- unsigned char ret=0;
-
- ret = net_nfc_get_record_il(0xff);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_record_sr_p(void)
-{
- unsigned char ret=0;
-
- ret = net_nfc_get_record_sr (0xff);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_record_sr_n(void)
-{
- unsigned char ret=0;
-
- ret = net_nfc_get_record_sr(0xff);
-
- dts_pass(__func__, "PASS");
-}
-static void utc_net_nfc_create_text_string_from_text_record_p(void)
-{
- int ret ;
- ndef_record_h record = NULL;
- char *disp_text = NULL;
-
- net_nfc_create_text_type_record(&record, "This is real NFC", "en-US", NET_NFC_ENCODE_UTF_8);
-
- ret = net_nfc_create_text_string_from_text_record (record, &disp_text);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_create_text_string_from_text_record is failed");
-}
-
-static void utc_net_nfc_create_text_string_from_text_record_n(void)
-{
- int ret ;
-
- ret = net_nfc_create_text_string_from_text_record (NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_create_text_string_from_text_record not allow null");
-}
-
-static void utc_net_nfc_get_languange_code_string_from_text_record_p(void)
-{
- int ret ;
- ndef_record_h record = NULL;
- char* language_code_str = NULL;
-
- net_nfc_create_text_type_record(&record, "This is real NFC", "en-US", NET_NFC_ENCODE_UTF_8);
-
- ret = net_nfc_get_languange_code_string_from_text_record (record, &language_code_str);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_get_languange_code_string_from_text_record is failed");
-}
-
-static void utc_net_nfc_get_languange_code_string_from_text_record_n(void)
-{
- int ret ;
-
- ret = net_nfc_get_languange_code_string_from_text_record (NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_get_languange_code_string_from_text_record not allow null");
-}
-
-static void utc_net_nfc_get_encoding_type_from_text_record_p(void)
-{
- int ret ;
- ndef_record_h record = NULL;
- net_nfc_encode_type_e utf;
-
- net_nfc_create_text_type_record(&record, "This is real NFC", "en-US", NET_NFC_ENCODE_UTF_8);
-
- ret = net_nfc_get_encoding_type_from_text_record (record, &utf);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_get_encoding_type_from_text_record is failed");
-}
-
-static void utc_net_nfc_get_encoding_type_from_text_record_n(void)
-{
- int ret ;
-
- ret = net_nfc_get_encoding_type_from_text_record (NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_get_encoding_type_from_text_record not allow null");
-}
-
-static void utc_net_nfc_create_uri_string_from_uri_record_p(void)
-{
- int ret=0;
- ndef_record_h record = NULL;
- char *disp_text = NULL;
-
- net_nfc_create_uri_type_record(&record ,"http://www.naver.com", NET_NFC_SCHEMA_FULL_URI);
-
- net_nfc_create_uri_string_from_uri_record(record, &disp_text);
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_create_uri_string_from_uri_record is failed");
-}
-
-static void utc_net_nfc_create_uri_string_from_uri_record_n(void)
-{
- int ret=0;
-
- ret = net_nfc_create_uri_string_from_uri_record(NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_create_uri_string_from_uri_record is failed");
-}
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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"
-#include "net_nfc_typedef.h"
-#include "net_nfc_util_internal.h"
-
-#ifdef SECURITY_SERVER
-#include <security-server.h>
-#endif
-
-
-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_net_nfc_initialize_p(void);
-static void utc_net_nfc_initialize_n(void);
-static void utc_net_nfc_deinitialize_p(void);
-static void utc_net_nfc_deinitialize_n(void);
-static void utc_net_nfc_set_response_callback_p(void);
-static void utc_net_nfc_set_response_callback_n(void);
-static void utc_net_nfc_unset_response_callback_p(void);
-static void utc_net_nfc_unset_response_callback_n(void);
-
-static void net_nfc_test_client_cb(net_nfc_message_e message, net_nfc_error_e result, void* data, void* user_param, void * trans_data )
-{
-};
-
-
-
-struct tet_testlist tet_testlist[] = {
- { utc_net_nfc_initialize_p , POSITIVE_TC_IDX },
- { utc_net_nfc_initialize_n , NEGATIVE_TC_IDX },
- { utc_net_nfc_deinitialize_p, POSITIVE_TC_IDX },
- { utc_net_nfc_deinitialize_n , NEGATIVE_TC_IDX},
- { utc_net_nfc_set_response_callback_p, 1},
- { utc_net_nfc_set_response_callback_n, 2 },
- { utc_net_nfc_unset_response_callback_p, 1},
- { utc_net_nfc_unset_response_callback_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_net_nfc_initialize_p(void)
-{
- int ret ;
-
- ret = net_nfc_initialize();
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_initialize_n(void)
-{
- int ret=0;
-
- ret = net_nfc_initialize();
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_deinitialize_p(void)
-{
- int ret ;
-
- net_nfc_initialize();
- ret = net_nfc_deinitialize();
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_deinitialize is failed");
-}
-
-static void utc_net_nfc_deinitialize_n(void)
-{
- int ret=0;
-
- ret = net_nfc_deinitialize();
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_deinitialize not allow null");
-}
-
-static void utc_net_nfc_set_response_callback_p(void)
-{
- int ret ;
- //net_nfc_response_cb cb;
-
- net_nfc_initialize();
-
- ret = net_nfc_set_response_callback(net_nfc_test_client_cb, NULL);
-
- net_nfc_unset_response_callback();
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_set_response_callback is failed");
-}
-
-static void utc_net_nfc_set_response_callback_n(void)
-{
- int ret=0;
-
- ret = net_nfc_set_response_callback(NULL, NULL);
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_set_response_callback not allow null");
-}
-
-static void utc_net_nfc_unset_response_callback_p(void)
-{
- int ret ;
- //net_nfc_response_cb cb;
-
- net_nfc_initialize();
-
- net_nfc_set_response_callback(net_nfc_test_client_cb, NULL);
-
- ret = net_nfc_unset_response_callback();
-
- net_nfc_deinitialize();
-
- dts_check_eq(__func__, ret, NET_NFC_OK, "net_nfc_unset_response_callback is failed");
-}
-
-static void utc_net_nfc_unset_response_callback_n(void)
-{
- int ret=0;
-
- ret = net_nfc_unset_response_callback();
-
- dts_check_ne(__func__, ret, NET_NFC_OK, "net_nfc_unset_response_callback not allow null");
-}
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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>
-
-#include "net_nfc_typedef_internal.h"
-#include "net_nfc_util_internal.h"
-#include "net_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_net_nfc_format_ndef_p(void);
-static void utc_net_nfc_format_ndef_n(void);
-static void utc_net_nfc_set_tag_filter_p(void);
-static void utc_net_nfc_set_tag_filter_n(void);
-static void utc_net_nfc_get_tag_filter_p(void);
-static void utc_net_nfc_get_tag_filter_n(void);
-static void utc_net_nfc_transceive_p(void);
-static void utc_net_nfc_transceive_n(void);
-static void utc_net_nfc_read_ndef_p(void);
-static void utc_net_nfc_read_ndef_n(void);
-static void utc_net_nfc_write_ndef_p(void);
-static void utc_net_nfc_write_ndef_n(void);
-static void utc_net_nfc_make_read_only_ndef_tag_p(void);
-static void utc_net_nfc_make_read_only_ndef_tag_n(void);
-
-
-struct tet_testlist tet_testlist[] = {
- { utc_net_nfc_format_ndef_p , POSITIVE_TC_IDX },
- { utc_net_nfc_format_ndef_n , NEGATIVE_TC_IDX },
- { utc_net_nfc_set_tag_filter_p, POSITIVE_TC_IDX },
- { utc_net_nfc_set_tag_filter_n , NEGATIVE_TC_IDX},
- { utc_net_nfc_get_tag_filter_p, 1},
- { utc_net_nfc_get_tag_filter_n, 2 },
- { utc_net_nfc_transceive_p, 1},
- { utc_net_nfc_transceive_n, 2},
- { utc_net_nfc_read_ndef_p, 1},
- { utc_net_nfc_read_ndef_n, 2},
- { utc_net_nfc_write_ndef_p, 1},
- { utc_net_nfc_write_ndef_n, 2},
- { utc_net_nfc_make_read_only_ndef_tag_p, 1},
- { utc_net_nfc_make_read_only_ndef_tag_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_net_nfc_format_ndef_p(void)
-{
- int ret=0;
- data_h key;
- uint8_t data [] = {0xff,0xff,0xff,0xff,0xff,0xff};
-
- net_nfc_initialize();
-
- net_nfc_create_data (&key, data, 6);
-
- ret = net_nfc_format_ndef((net_nfc_target_handle_h) 0x302023, key, NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_format_ndef_n(void)
-{
- int ret=0;
-
- ret = net_nfc_format_ndef(NULL, NULL, NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_set_tag_filter_p(void)
-{
- int ret=0;
-
- net_nfc_initialize();
-
- ret = net_nfc_set_tag_filter(NET_NFC_ISO14443A_ENABLE);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_set_tag_filter_n(void)
-{
- int ret=0;
- net_nfc_event_filter_e config = NET_NFC_ALL_ENABLE;
-
- ret = net_nfc_set_tag_filter(config);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_filter_p(void)
-{
- net_nfc_event_filter_e ret=0;
-
- net_nfc_initialize();
-
- net_nfc_set_tag_filter(NET_NFC_ISO14443A_ENABLE);
-
- ret = net_nfc_get_tag_filter();
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_filter_n(void)
-{
- net_nfc_event_filter_e ret=0;
-
- ret = net_nfc_get_tag_filter();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_transceive_p(void)
-{
- int ret ;
- net_nfc_target_handle_h handle = NULL;
- void* trans_param = NULL;
- unsigned char send_buffer[6] = {0x00, };
-
- send_buffer[0] = 0x06;
- send_buffer[1] = 0x00;
-
- // use wild card for system code
- send_buffer[2] = 0xff;
- send_buffer[3] = 0xff;
-
- send_buffer[4] = 0xff;
- send_buffer[5] = 0xff;
-
- data_s rawdata;
-
- rawdata.buffer = send_buffer;
- rawdata.length = 6;
-
- ret = net_nfc_transceive(handle, (data_h)&rawdata, trans_param);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_transceive_n(void)
-{
- int ret ;
-
- ret = net_nfc_transceive(NULL, NULL, NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_read_ndef_p(void)
-{
- int ret ;
-
- ret = net_nfc_read_tag((net_nfc_target_handle_h) 0x302023, NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_read_ndef_n(void)
-{
- int ret ;
-
- ret = net_nfc_read_tag(NULL, NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_write_ndef_p(void)
-{
- int ret ;
- ndef_message_h message = NULL;
- ndef_record_h record = NULL;
-
- net_nfc_initialize();
-
- net_nfc_create_ndef_message (&message);
- net_nfc_create_text_type_record (&record, "abc" ,"en-US" ,NET_NFC_ENCODE_UTF_8);
- net_nfc_append_record_to_ndef_message (message ,record);
-
- ret = net_nfc_write_ndef ((net_nfc_target_handle_h)0x302023 ,message ,NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_write_ndef_n(void)
-{
- int ret ;
-
- ret = net_nfc_write_ndef(NULL, NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_make_read_only_ndef_tag_p(void)
-{
- int ret ;
-
- net_nfc_initialize();
-
- ret = net_nfc_make_read_only_ndef_tag ((net_nfc_target_handle_h)0x302023 , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_make_read_only_ndef_tag_n(void)
-{
- int ret;
-
- ret = net_nfc_make_read_only_ndef_tag(NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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"
-#include "net_nfc_ndef_message.h"
-#include "net_nfc_util_internal.h"
-#include "net_nfc_data.h"
-#include "net_nfc.h"
-#include "net_nfc_tag_felica.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_net_nfc_felica_poll_p(void);
-static void utc_net_nfc_felica_poll_n(void);
-static void utc_net_nfc_felica_request_service_p(void);
-static void utc_net_nfc_felica_request_service_n(void);
-static void utc_net_nfc_felica_request_response_p(void);
-static void utc_net_nfc_felica_request_response_n(void);
-static void utc_net_nfc_felica_read_without_encryption_p(void);
-static void utc_net_nfc_felica_read_without_encryption_n(void);
-static void utc_net_nfc_felica_write_without_encryption_p(void);
-static void utc_net_nfc_felica_write_without_encryption_n(void);
-static void utc_net_nfc_felica_request_system_code_p(void);
-static void utc_net_nfc_felica_request_system_code_n(void);
-
-
-struct tet_testlist tet_testlist[] = {
- { utc_net_nfc_felica_poll_p , POSITIVE_TC_IDX },
- { utc_net_nfc_felica_poll_n , NEGATIVE_TC_IDX },
- { utc_net_nfc_felica_request_service_p, POSITIVE_TC_IDX },
- { utc_net_nfc_felica_request_service_n , NEGATIVE_TC_IDX},
- { utc_net_nfc_felica_request_response_p, 1},
- { utc_net_nfc_felica_request_response_n, 2 },
- { utc_net_nfc_felica_read_without_encryption_p, 1},
- { utc_net_nfc_felica_read_without_encryption_n, 2},
- { utc_net_nfc_felica_write_without_encryption_p, 1},
- { utc_net_nfc_felica_write_without_encryption_n, 2},
- { utc_net_nfc_felica_request_system_code_p, 1},
- { utc_net_nfc_felica_request_system_code_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_net_nfc_felica_poll_p(void)
-{
- int ret=0;
-
- net_nfc_initialize();
-
- ret = net_nfc_felica_poll((net_nfc_target_handle_h) 0x302023, NET_NFC_FELICA_POLL_COMM_SPEED_REQUEST , 0x0 , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_felica_poll_n(void)
-{
- int ret=0;
- uint8_t temp[]= "a";
-
- ret = net_nfc_felica_poll(NULL , NET_NFC_FELICA_POLL_NO_REQUEST , temp[0] , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_felica_request_service_p(void)
-{
- int ret=0;
- unsigned short service_code = 0xffff;
-
- net_nfc_initialize();
-
- net_nfc_felica_poll((net_nfc_target_handle_h) 0x302023, NET_NFC_FELICA_POLL_COMM_SPEED_REQUEST , 0x0 , NULL);
-
- ret = net_nfc_felica_request_service((net_nfc_target_handle_h) 0x302023 , 1 , &service_code , 1 , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_felica_request_service_n(void)
-{
- int ret=0;
-
- ret = net_nfc_felica_request_service(NULL , 1 , NULL , 1, NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_felica_request_response_p(void)
-{
- int ret=0;
-
- net_nfc_initialize();
-
- net_nfc_felica_poll((net_nfc_target_handle_h) 0x302023, NET_NFC_FELICA_POLL_COMM_SPEED_REQUEST , 0x0 , NULL);
-
- ret = net_nfc_felica_request_response((net_nfc_target_handle_h) 0x302023 , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_felica_request_response_n(void)
-{
- int ret=0;
-
- ret = net_nfc_felica_request_response( NULL , NULL );
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_felica_read_without_encryption_p(void)
-{
- int ret=0;
- unsigned short service_code = 0xffff;
- unsigned char blocks = 0x2;
-
- net_nfc_initialize();
-
- net_nfc_felica_poll((net_nfc_target_handle_h) 0x302023, NET_NFC_FELICA_POLL_COMM_SPEED_REQUEST , 0x0 , NULL);
-
- ret = net_nfc_felica_read_without_encryption((net_nfc_target_handle_h) 0x302023, 1, &service_code, 1, &blocks, NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_felica_read_without_encryption_n(void)
-{
- int ret=0;
-
- ret = net_nfc_felica_read_without_encryption(NULL, 1, NULL, 1, NULL, NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_felica_write_without_encryption_p(void)
-{
- int ret=0;
- unsigned short service_code = 0xffff;
- unsigned char blocks = 0x2;
- unsigned char send_buffer[6] = {0x00, };
-
- send_buffer[0] = 0x06;
- send_buffer[1] = 0x00;
-
- // use wild card for system code
- send_buffer[2] = 0xff;
- send_buffer[3] = 0xff;
-
- send_buffer[4] = 0xff;
- send_buffer[5] = 0xff;
-
- data_h rawdata = NULL;
-
- rawdata = calloc(1,sizeof(data_h));
-
- net_nfc_initialize();
-
- net_nfc_felica_poll((net_nfc_target_handle_h) 0x302023, NET_NFC_FELICA_POLL_COMM_SPEED_REQUEST , 0x0 , NULL);
-
- ret = net_nfc_felica_write_without_encryption((net_nfc_target_handle_h) 0x302023, 1, &service_code, 1, &blocks, rawdata , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_felica_write_without_encryption_n(void)
-{
- int ret=0;
-
- ret = net_nfc_felica_write_without_encryption(NULL, 1, NULL, 1, NULL, NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_felica_request_system_code_p(void)
-{
- int ret=0;
- //unsigned short service_code = 0xffff;
- //unsigned char blocks = 0x2;
-
- net_nfc_initialize();
-
- net_nfc_felica_poll((net_nfc_target_handle_h) 0x302023, NET_NFC_FELICA_POLL_COMM_SPEED_REQUEST , 0x0 , NULL);
-
- ret = net_nfc_felica_request_system_code((net_nfc_target_handle_h) 0x302023 , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_felica_request_system_code_n(void)
-{
- int ret=0;
-
- ret = net_nfc_felica_request_system_code(NULL, NULL);
-
- dts_pass(__func__, "PASS");
-}
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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"
-#include "net_nfc_typedef_internal.h"
-#include "net_nfc_util_internal.h"
-#include "net_nfc_tag_jewel.h"
-#include "net_nfc_target_info.h"
-#include "net_nfc.h"
-
-#include <string.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_net_nfc_jewel_read_id_p(void);
-static void utc_net_nfc_jewel_read_id_n(void);
-static void utc_net_nfc_jewel_read_byte_p(void);
-static void utc_net_nfc_jewel_read_byte_n(void);
-static void utc_net_nfc_jewel_read_all_p(void);
-static void utc_net_nfc_jewel_read_all_n(void);
-static void utc_net_nfc_jewel_write_with_erase_p(void);
-static void utc_net_nfc_jewel_write_with_erase_n(void);
-static void utc_net_nfc_jewel_write_with_no_erase_p(void);
-static void utc_net_nfc_jewel_write_with_no_erase_n(void);
-
-
-struct tet_testlist tet_testlist[] = {
- { utc_net_nfc_jewel_read_id_p , POSITIVE_TC_IDX },
- { utc_net_nfc_jewel_read_id_n , NEGATIVE_TC_IDX },
- { utc_net_nfc_jewel_read_byte_p, POSITIVE_TC_IDX },
- { utc_net_nfc_jewel_read_byte_n , NEGATIVE_TC_IDX},
- { utc_net_nfc_jewel_read_all_p, 1},
- { utc_net_nfc_jewel_read_all_n, 2 },
- { utc_net_nfc_jewel_write_with_erase_p, 1},
- { utc_net_nfc_jewel_write_with_erase_n, 2},
- { utc_net_nfc_jewel_write_with_no_erase_p, 1},
- { utc_net_nfc_jewel_write_with_no_erase_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_net_nfc_jewel_read_id_p(void)
-{
- int ret=0;
-
- net_nfc_initialize();
-
- ret = net_nfc_jewel_read_id((net_nfc_target_handle_h) 0x302023, NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_jewel_read_id_n(void)
-{
- int ret=0;
-
- ret = net_nfc_jewel_read_id(NULL , NULL );
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_jewel_read_byte_p(void)
-{
- int ret=0;
-
- net_nfc_initialize();
-
- ret = net_nfc_jewel_read_byte((net_nfc_target_handle_h) 0x302023 , 1 , 0 , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_jewel_read_byte_n(void)
-{
- int ret=0;
-
- ret = net_nfc_jewel_read_byte(NULL , 0 , 0 , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_jewel_read_all_p(void)
-{
- int ret=0;
-
- net_nfc_initialize();
-
- ret = net_nfc_jewel_read_all((net_nfc_target_handle_h) 0x302023 , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_jewel_read_all_n(void)
-{
- int ret=0;
-
- ret = net_nfc_jewel_read_all( NULL , NULL );
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_jewel_write_with_erase_p(void)
-{
- int ret=0;
-
- net_nfc_initialize();
-
- ret = net_nfc_jewel_write_with_erase((net_nfc_target_handle_h) 0x302023 , 1 , 0 , 0xff , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_jewel_write_with_erase_n(void)
-{
- int ret=0;
-
- ret = net_nfc_jewel_write_with_erase(NULL, 0, 0, 0xff, NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_jewel_write_with_no_erase_p(void)
-{
- int ret=0;
-
- net_nfc_initialize();
-
- ret = net_nfc_jewel_write_with_no_erase((net_nfc_target_handle_h) 0x302023 , 1 , 0 , 0xff , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_jewel_write_with_no_erase_n(void)
-{
- int ret=0;
-
- ret = net_nfc_jewel_write_with_no_erase(NULL, 0, 0, 0xff, NULL);
-
- dts_pass(__func__, "PASS");
-}
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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"
-#include "net_nfc_typedef_internal.h"
-#include "net_nfc_util_internal.h"
-#include "net_nfc_tag_jewel.h"
-#include "net_nfc_target_info.h"
-#include "net_nfc.h"
-
-#include <string.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_net_nfc_mifare_create_default_key_p(void);
-static void utc_net_nfc_mifare_create_default_key_n(void);
-static void utc_net_nfc_mifare_create_application_directory_key_p(void);
-static void utc_net_nfc_mifare_create_application_directory_key_n(void);
-static void utc_net_nfc_mifare_create_net_nfc_forum_key_p(void);
-static void utc_net_nfc_mifare_create_net_nfc_forum_key_n(void);
-static void utc_net_nfc_mifare_authenticate_with_keyA_p(void);
-static void utc_net_nfc_mifare_authenticate_with_keyA_n(void);
-static void utc_net_nfc_mifare_authenticate_with_keyB_p(void);
-static void utc_net_nfc_mifare_authenticate_with_keyB_n(void);
-static void utc_net_nfc_mifare_read_p(void);
-static void utc_net_nfc_mifare_read_n(void);
-static void utc_net_nfc_mifare_write_block_p(void);
-static void utc_net_nfc_mifare_write_block_n(void);
-static void utc_net_nfc_mifare_write_page_p(void);
-static void utc_net_nfc_mifare_write_page_n(void);
-static void utc_net_nfc_mifare_increment_p(void);
-static void utc_net_nfc_mifare_increment_n(void);
-static void utc_net_nfc_mifare_decrement_p(void);
-static void utc_net_nfc_mifare_decrement_n(void);
-static void utc_net_nfc_mifare_transfer_p(void);
-static void utc_net_nfc_mifare_transfer_n(void);
-static void utc_net_nfc_mifare_restore_p(void);
-static void utc_net_nfc_mifare_restore_n(void);
-
-
-
-struct tet_testlist tet_testlist[] = {
- { utc_net_nfc_mifare_create_default_key_p , POSITIVE_TC_IDX },
- { utc_net_nfc_mifare_create_default_key_n , NEGATIVE_TC_IDX },
- { utc_net_nfc_mifare_create_application_directory_key_p, POSITIVE_TC_IDX },
- { utc_net_nfc_mifare_create_application_directory_key_n , NEGATIVE_TC_IDX},
- { utc_net_nfc_mifare_create_net_nfc_forum_key_p, 1},
- { utc_net_nfc_mifare_create_net_nfc_forum_key_n, 2 },
- { utc_net_nfc_mifare_authenticate_with_keyA_p, 1},
- { utc_net_nfc_mifare_authenticate_with_keyA_n, 2},
- { utc_net_nfc_mifare_authenticate_with_keyB_p, 1},
- { utc_net_nfc_mifare_authenticate_with_keyB_n, 2},
- { utc_net_nfc_mifare_read_p, 1},
- { utc_net_nfc_mifare_read_n, 2},
- { utc_net_nfc_mifare_write_block_p, 1},
- { utc_net_nfc_mifare_write_block_n, 2},
- { utc_net_nfc_mifare_write_page_p, 1},
- { utc_net_nfc_mifare_write_page_n, 2},
- { utc_net_nfc_mifare_increment_p, 1},
- { utc_net_nfc_mifare_increment_n, 2},
- { utc_net_nfc_mifare_decrement_p, 1},
- { utc_net_nfc_mifare_decrement_n, 2},
- { utc_net_nfc_mifare_transfer_p, 1},
- { utc_net_nfc_mifare_transfer_n, 2},
- { utc_net_nfc_mifare_restore_p, 1},
- { utc_net_nfc_mifare_restore_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_net_nfc_mifare_create_default_key_p(void)
-{
- int ret=0;
- data_h default_key = NULL;
-
- net_nfc_initialize();
-
- ret = net_nfc_mifare_create_default_key(&default_key);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_create_default_key_n(void)
-{
- int ret=0;
-
- ret = net_nfc_mifare_create_default_key(NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_create_application_directory_key_p(void)
-{
- int ret=0;
- data_h mad_key = NULL;
-
- net_nfc_initialize();
-
- ret = net_nfc_mifare_create_application_directory_key(&mad_key);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_create_application_directory_key_n(void)
-{
- int ret=0;
-
- ret = net_nfc_mifare_create_application_directory_key(NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_create_net_nfc_forum_key_p(void)
-{
- int ret=0;
- data_h net_nfc_forum_key = NULL;
-
- net_nfc_initialize();
-
- ret = net_nfc_mifare_create_net_nfc_forum_key(&net_nfc_forum_key);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_create_net_nfc_forum_key_n(void)
-{
- int ret=0;
-
- ret = net_nfc_mifare_create_net_nfc_forum_key( NULL );
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_authenticate_with_keyA_p(void)
-{
- data_h default_key = NULL;
- int sector = 1;
- data_h key = NULL;
-
- net_nfc_initialize();
-
- net_nfc_mifare_create_default_key(&default_key);
-
- key = default_key;
-
- net_nfc_mifare_authenticate_with_keyA((net_nfc_target_handle_h) 0x302023, sector, default_key, NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_authenticate_with_keyA_n(void)
-{
- int ret=0;
-
- ret = net_nfc_mifare_authenticate_with_keyA(NULL , 0 , NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_authenticate_with_keyB_p(void)
-{
- data_h default_key = NULL;
- int sector = 1;
- data_h key = NULL;
-
- net_nfc_initialize();
-
- net_nfc_mifare_create_default_key(&default_key);
-
- key = default_key;
-
- net_nfc_mifare_authenticate_with_keyB((net_nfc_target_handle_h) 0x302023, sector, key, NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_authenticate_with_keyB_n(void)
-{
- int ret=0;
-
- ret = net_nfc_mifare_authenticate_with_keyB(NULL , 0 , NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_read_p(void)
-{
- net_nfc_initialize();
-
- net_nfc_mifare_read((net_nfc_target_handle_h) 0x302023 , 5, NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_read_n(void)
-{
- int ret=0;
-
- ret = net_nfc_mifare_read(NULL , 0 , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_write_block_p(void)
-{
- net_nfc_initialize();
-
- net_nfc_mifare_write_block((net_nfc_target_handle_h) 0x302023 , 5, NULL , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_write_block_n(void)
-{
- int ret=0;
-
- ret = net_nfc_mifare_write_block(NULL , 0 , NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_write_page_p(void)
-{
- net_nfc_initialize();
-
- net_nfc_mifare_write_block((net_nfc_target_handle_h) 0x302023 , 5, NULL , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_write_page_n(void)
-{
- int ret=0;
-
- ret = net_nfc_mifare_write_block(NULL , 0 , NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_increment_p(void)
-{
- net_nfc_initialize();
-
- net_nfc_mifare_increment((net_nfc_target_handle_h) 0x302023 , 5 , 0 , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_increment_n(void)
-{
- int ret=0;
-
- ret = net_nfc_mifare_increment(NULL , 5 , 0 , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_decrement_p(void)
-{
- net_nfc_initialize();
-
- net_nfc_mifare_decrement((net_nfc_target_handle_h) 0x302023 , 5 , 0 , NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_decrement_n(void)
-{
- int ret=0;
-
- ret = net_nfc_mifare_decrement(NULL , 5 , 0 , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_transfer_p(void)
-{
- net_nfc_initialize();
-
- net_nfc_mifare_transfer((net_nfc_target_handle_h) 0x302023 , 5, NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_transfer_n(void)
-{
- int ret=0;
-
- ret = net_nfc_mifare_transfer(NULL , 5 , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_restore_p(void)
-{
- net_nfc_initialize();
-
- net_nfc_mifare_restore((net_nfc_target_handle_h) 0x302023 , 5, NULL);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_mifare_restore_n(void)
-{
- int ret=0;
-
- ret = net_nfc_mifare_restore(NULL , 5 , NULL);
-
- dts_pass(__func__, "PASS");
-}
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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"
-#include "net_nfc_typedef_internal.h"
-#include "net_nfc_target_info.h"
-#include "net_nfc_data.h"
-#include <stdbool.h>
-#include "net_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_net_nfc_get_tag_type_p(void);
-static void utc_net_nfc_get_tag_type_n(void);
-static void utc_net_nfc_get_tag_handle_p(void);
-static void utc_net_nfc_get_tag_handle_n(void);
-static void utc_net_nfc_get_tag_ndef_support_p(void);
-static void utc_net_nfc_get_tag_ndef_support_n(void);
-static void utc_net_nfc_get_tag_max_data_size_p(void);
-static void utc_net_nfc_get_tag_max_data_size_n(void);
-static void utc_net_nfc_get_tag_actual_data_size_p(void);
-static void utc_net_nfc_get_tag_actual_data_size_n(void);
-static void utc_net_nfc_get_tag_info_keys_p(void);
-static void utc_net_nfc_get_tag_info_keys_n(void);
-static void utc_net_nfc_get_tag_info_value_p(void);
-static void utc_net_nfc_get_tag_info_value_n(void);
-
-
-struct tet_testlist tet_testlist[] = {
- { utc_net_nfc_get_tag_type_p , POSITIVE_TC_IDX },
- { utc_net_nfc_get_tag_type_n , NEGATIVE_TC_IDX },
- { utc_net_nfc_get_tag_handle_p, POSITIVE_TC_IDX },
- { utc_net_nfc_get_tag_handle_n , NEGATIVE_TC_IDX},
- { utc_net_nfc_get_tag_ndef_support_p, 1},
- { utc_net_nfc_get_tag_ndef_support_n, 2 },
- { utc_net_nfc_get_tag_max_data_size_p, 1},
- { utc_net_nfc_get_tag_max_data_size_n, 2},
- { utc_net_nfc_get_tag_actual_data_size_p, 1},
- { utc_net_nfc_get_tag_actual_data_size_n, 2},
- { utc_net_nfc_get_tag_info_keys_p, 1},
- { utc_net_nfc_get_tag_info_keys_n, 2},
- { utc_net_nfc_get_tag_info_value_p, 1},
- { utc_net_nfc_get_tag_info_value_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_net_nfc_get_tag_type_p(void)
-{
- int ret=0;
- net_nfc_target_info_s* target_info;
- net_nfc_target_type_e type;
-
- target_info = calloc(1, sizeof(net_nfc_target_info_s));
-
- target_info->devType = NET_NFC_GENERIC_PICC;
-
- net_nfc_initialize();
-
- ret = net_nfc_get_tag_type((net_nfc_target_info_h)target_info , &type);
-
- net_nfc_deinitialize();
-
- free(target_info);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_type_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_tag_type(NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_handle_p(void)
-{
- int ret=0;
- net_nfc_target_info_s* target_info;
- net_nfc_target_handle_h id;
-
- target_info = calloc(1, sizeof(net_nfc_target_info_s));
-
- target_info->handle = (net_nfc_target_handle_s*)0x302023;
-
- net_nfc_initialize();
-
- ret = net_nfc_get_tag_handle((net_nfc_target_info_h)target_info , &id);
-
- net_nfc_deinitialize();
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_handle_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_tag_handle(NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_ndef_support_p(void)
-{
- int ret=0;
- net_nfc_target_info_s* target_info;
- bool is_ndef;
-
- target_info = calloc(1, sizeof(net_nfc_target_info_s));
- target_info->is_ndef_supported = 1;
-
- net_nfc_initialize();
-
- ret = net_nfc_get_tag_ndef_support((net_nfc_target_info_h)target_info , &is_ndef);
-
- net_nfc_deinitialize();
-
- free(target_info);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_ndef_support_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_tag_ndef_support(NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_max_data_size_p(void)
-{
- int ret=0;
- net_nfc_target_info_s* target_info;
- net_nfc_target_type_e max_size = 0;
-
- target_info = calloc(1, sizeof(net_nfc_target_info_s));
- target_info->maxDataSize = 128;
-
- net_nfc_initialize();
-
- ret = net_nfc_get_tag_max_data_size((net_nfc_target_info_h)target_info , &max_size);
-
- net_nfc_deinitialize();
-
- free(target_info);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_max_data_size_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_tag_max_data_size(NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_actual_data_size_p(void)
-{
- int ret=0;
- net_nfc_target_info_s* target_info;
- net_nfc_target_type_e size = 0;
-
- target_info = calloc(1, sizeof(net_nfc_target_info_s));
- target_info->actualDataSize = 128;
-
- net_nfc_initialize();
-
- ret = net_nfc_get_tag_actual_data_size((net_nfc_target_info_h)target_info , &size);
-
- net_nfc_deinitialize();
-
- free(target_info);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_actual_data_size_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_tag_actual_data_size(NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_info_keys_p(void)
-{
- int ret=0;
- net_nfc_target_info_s* target_info;
- char** keys = NULL;
- int nok = 0;
-
- target_info = calloc(1, sizeof(net_nfc_target_info_s));
-
- net_nfc_initialize();
-
- ret = net_nfc_get_tag_info_keys((net_nfc_target_info_h)target_info, &keys, &nok);
-
- net_nfc_deinitialize();
-
- free(target_info);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_info_keys_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_tag_info_keys(NULL , NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
-static void utc_net_nfc_get_tag_info_value_p(void)
-{
- net_nfc_target_info_s* target_info;
- data_h* value = NULL;
- char* keys = NULL;
-
- keys = calloc( 1 , sizeof(char));
-
- target_info = calloc(1, sizeof(net_nfc_target_info_s));
- target_info->actualDataSize = 128;
- target_info->tag_info_list = calloc(1 , sizeof(net_nfc_tag_info_s));
-
- target_info->tag_info_list->key = '1';
- target_info->tag_info_list->value = calloc(1 , sizeof(data_h));
-
- value = calloc(1, sizeof(data_h));
-
- net_nfc_initialize();
-
- //net_nfc_get_tag_info_keys((net_nfc_target_info_h)target_info, &keys, &nok);
-
- net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info , keys , value);
-
- net_nfc_deinitialize();
-
- free(target_info->tag_info_list->value);
- free(target_info->tag_info_list);
- free(target_info);
- free(keys);
- free(value);
-
- dts_pass(__func__, "PASS");
-}
-
-static void utc_net_nfc_get_tag_info_value_n(void)
-{
- int ret=0;
-
- ret = net_nfc_get_tag_info_value(NULL , NULL , NULL);
-
- dts_pass(__func__, "PASS");
-}
+++ /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 ?
--- /dev/null
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+INCLUDE_DIRECTORIES(include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/manager/include)
+
+SET(NFC_CLIENT "nfc")
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} CLIENT_SRCS)
+
+pkg_check_modules(client_pkgs REQUIRED security-server dlog ecore-x vconf)
+
+FOREACH(flag ${client_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_LIBRARY(${NFC_CLIENT} SHARED ${CLIENT_SRCS})
+TARGET_LINK_LIBRARIES(${NFC_CLIENT} ${client_pkgs_LDFLAGS} nfc-common)
+SET_TARGET_PROPERTIES(${NFC_CLIENT} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
+
+FILE(GLOB CLIENT_HEADER include/*.h)
+SET(CLIENT_HEADER ${CLIENT_HEADER} ${CMAKE_SOURCE_DIR}/common/include/net_nfc_typedef.h)
+
+CONFIGURE_FILE(${NFC_CLIENT}.pc.in ${NFC_CLIENT}.pc @ONLY)
+INSTALL(FILES ${NFC_CLIENT}.pc DESTINATION lib/pkgconfig)
+
+INSTALL(TARGETS ${NFC_CLIENT} DESTINATION lib)
+
+FOREACH(hfile ${CLIENT_HEADER})
+ INSTALL(FILES ${hfile} DESTINATION include/${NFC_CLIENT})
+ENDFOREACH(hfile)
#include "net_nfc_client_se.h"
#include "net_nfc_client_tag_felica.h"
#include "net_nfc_client_tag_jewel.h"
-#include "net_nfc_tag_mifare.h"
+#include "net_nfc_client_tag_mifare.h"
#include "net_nfc_client_test.h"
#endif //__NET_NFC_H__
#ifndef __NET_NFC_DATA_H__
#define __NET_NFC_DATA_H__
-#include <net_nfc_typedef.h>
+#include "net_nfc_typedef.h"
#ifdef __cplusplus
extern "C" {
switch(message)
{
case NET_NFC_MESSAGE_TAG_DISCOVERED:
- {
if(info != NULL)
{
net_nfc_target_info_h target_info = (net_nfc_target_info_h)data;
free(keys);
}
- }
}
}
@endcode
switch(message)
{
case NET_NFC_MESSAGE_TAG_DISCOVERED:
- {
if(info != NULL)
{
net_nfc_target_info_h target_info = (net_nfc_target_info_h)data;
}
}
}
- }
}
}
@endcode
switch(message)
{
case NET_NFC_MESSAGE_TAG_DISCOVERED:
- {
net_nfc_target_info_h target_info = (net_nfc_target_info_h)data;
net_nfc_target_info_h handle = NULL;
// do something...
net_nfc_release_tag_info(handle);
- }
- break;
+ break;
}
}
@endcode
#include "net_nfc_client_system_handler.h"
#include "net_nfc_client_handover.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
#ifdef SECURITY_SERVER
static uint8_t *cookie;
static size_t cookie_len;
cookie = g_new0(uint8_t, cookie_len);
if (cookie != NULL) {
if (security_server_request_cookie(
- (char *)cookie,
- cookie_len) < 0) {
+ (char *)cookie,
+ cookie_len) < 0) {
g_free(cookie);
cookie = NULL;
}
*/
#include <vconf.h>
+#include "net_nfc_debug_internal.h"
#include "net_nfc_typedef.h"
#include "net_nfc_client.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_initialize()
+API net_nfc_error_e net_nfc_client_initialize()
{
net_nfc_error_e result = NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_deinitialize()
+API net_nfc_error_e net_nfc_client_deinitialize()
{
net_nfc_error_e result = NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_is_nfc_supported(int *state)
+API net_nfc_error_e net_nfc_client_is_nfc_supported(int *state)
{
net_nfc_error_e ret;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_get_nfc_state(int *state)
+API net_nfc_error_e net_nfc_client_get_nfc_state(int *state)
{
net_nfc_error_e ret;
if (state != NULL)
{
if (vconf_get_bool(VCONFKEY_NFC_STATE, state) == 0)
- {
ret = NET_NFC_OK;
- }
else
- {
ret = NET_NFC_INVALID_STATE;
- }
}
else
{
#include "net_nfc_data.h"
#include "net_nfc_typedef_internal.h"
#include "net_nfc_util_internal.h"
+#include "net_nfc_debug_internal.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_data_only(data_h* data)
+API net_nfc_error_e net_nfc_create_data_only(data_h* data)
{
return net_nfc_create_data(data, NULL, 0);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_data(data_h* data, const uint8_t* bytes, const uint32_t length)
+API net_nfc_error_e net_nfc_create_data(data_h* data,
+ const uint8_t* bytes, const uint32_t length)
{
data_s *tmp_data = NULL;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_data(const data_h data, uint8_t** bytes, uint32_t * length)
+API net_nfc_error_e net_nfc_get_data(const data_h data, uint8_t** bytes, uint32_t * length)
{
if (data == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_set_data(const data_h data, const uint8_t* bytes, const uint32_t length)
+API net_nfc_error_e net_nfc_set_data(const data_h data, const uint8_t* bytes, const uint32_t length)
{
if (data == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API uint32_t net_nfc_get_data_length(const data_h data)
+API uint32_t net_nfc_get_data_length(const data_h data)
{
if (data == NULL)
{
return tmp_data->length;
}
-NET_NFC_EXPORT_API uint8_t * net_nfc_get_data_buffer(const data_h data)
+API uint8_t * net_nfc_get_data_buffer(const data_h data)
{
if (data == NULL)
{
return tmp_data->buffer;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_free_data(data_h data)
+API net_nfc_error_e net_nfc_free_data(data_h data)
{
if (data == NULL)
{
/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://floralicense.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.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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 <pthread.h>
static net_nfc_exchanger_cb gdbus_exch_cb = NULL;
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_create_exchanger_data(
- net_nfc_exchanger_data_h *ex_data,
- data_h payload)
+API net_nfc_error_e net_nfc_client_create_exchanger_data(
+ net_nfc_exchanger_data_h *ex_data,
+ data_h payload)
{
net_nfc_exchanger_data_s* tmp_ex_data = NULL;
}
_net_nfc_util_alloc_mem(
- tmp_ex_data,
- sizeof(net_nfc_exchanger_data_s));
+ tmp_ex_data,
+ sizeof(net_nfc_exchanger_data_s));
if (tmp_ex_data == NULL)
{
tmp_ex_data->type = NET_NFC_EXCHANGER_RAW;
_net_nfc_util_alloc_mem(
- tmp_ex_data->binary_data.buffer,
- ((data_s *)payload)->length);
+ tmp_ex_data->binary_data.buffer,
+ ((data_s *)payload)->length);
if (tmp_ex_data->binary_data.buffer == NULL)
{
}
memcpy(tmp_ex_data->binary_data.buffer,
- ((data_s *)payload)->buffer,
- ((data_s *)payload)->length);
+ ((data_s *)payload)->buffer,
+ ((data_s *)payload)->length);
tmp_ex_data->binary_data.length = ((data_s *)payload)->length;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_free_exchanger_data(
- net_nfc_exchanger_data_h ex_data)
+API net_nfc_error_e net_nfc_client_free_exchanger_data(
+ net_nfc_exchanger_data_h ex_data)
{
if (ex_data == NULL)
{
if (((net_nfc_exchanger_data_s *)ex_data)->binary_data.buffer != NULL)
{
_net_nfc_util_free_mem(
- ((net_nfc_exchanger_data_s *)ex_data)->binary_data.buffer);
+ ((net_nfc_exchanger_data_s *)ex_data)->binary_data.buffer);
}
_net_nfc_util_free_mem(ex_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_exchanger_cb net_nfc_client_get_exchanger_cb()
+API net_nfc_exchanger_cb net_nfc_client_get_exchanger_cb()
{
return gdbus_exch_cb;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_unset_exchanger_cb()
+API net_nfc_error_e net_nfc_client_unset_exchanger_cb()
{
if (gdbus_exch_cb == NULL)
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_send_exchanger_data(
- net_nfc_exchanger_data_h ex_handle,
- net_nfc_target_handle_h target_handle,
- void* trans_param)
+API net_nfc_error_e net_nfc_client_send_exchanger_data(
+ net_nfc_exchanger_data_h ex_handle,
+ net_nfc_target_handle_h target_handle,
+ void* trans_param)
{
net_nfc_error_e ret;
net_nfc_exchanger_data_s *ex_data = (net_nfc_exchanger_data_s *)ex_handle;
DEBUG_CLIENT_MSG("send reqeust :: exchanger data = "
- "[%p] target_handle = [%p]", ex_handle, target_handle);
+ "[%p] target_handle = [%p]", ex_handle, target_handle);
/*Sync call is used because there is no callback provided*/
ret = net_nfc_client_p2p_send_sync(ex_data,target_handle);
return ret;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_exchanger_request_connection_handover(
- net_nfc_target_handle_h target_handle,
- net_nfc_conn_handover_carrier_type_e type)
+API net_nfc_error_e net_nfc_client_exchanger_request_connection_handover(
+ net_nfc_target_handle_h target_handle,
+ net_nfc_conn_handover_carrier_type_e type)
{
net_nfc_error_e ret = NET_NFC_UNKNOWN_ERROR;
net_nfc_conn_handover_carrier_type_e carrier_type;
}
ret = net_nfc_client_p2p_connection_handover_sync(target_handle,
- type,
- &carrier_type,
- &data);
+ type,
+ &carrier_type,
+ &data);
return ret;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_exchanger_get_alternative_carrier_type(
- net_nfc_connection_handover_info_h info_handle,
- net_nfc_conn_handover_carrier_type_e *type)
+API net_nfc_error_e net_nfc_client_exchanger_get_alternative_carrier_type(
+ net_nfc_connection_handover_info_h info_handle,
+ net_nfc_conn_handover_carrier_type_e *type)
{
net_nfc_connection_handover_info_s *info = NULL;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_exchanger_get_alternative_carrier_data(
- net_nfc_connection_handover_info_h info_handle,
- data_h *data)
+API net_nfc_error_e net_nfc_client_exchanger_get_alternative_carrier_data(
+ net_nfc_connection_handover_info_h info_handle,
+ data_h *data)
{
net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
net_nfc_connection_handover_info_s *info = NULL;
return result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_exchanger_free_alternative_carrier_data(
- net_nfc_connection_handover_info_h info_handle)
+API net_nfc_error_e net_nfc_client_exchanger_free_alternative_carrier_data(
+ net_nfc_connection_handover_info_h info_handle)
{
net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
net_nfc_connection_handover_info_s *info = NULL;
#include "net_nfc_client_manager.h"
#include "net_nfc_client_handover.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
typedef struct _HandoverFuncData HandoverFuncData;
struct _HandoverFuncData
static NetNfcGDbusHandover *handover_proxy = NULL;
static void p2p_connection_handover(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void p2p_connection_handover(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
HandoverFuncData *func_data;
GVariant *data;
net_nfc_p2p_connection_handover_completed_cb callback;
if(net_nfc_gdbus_handover_call_request_finish (handover_proxy,
- (gint32 *)&event,
- (gint32 *)&type,
- &data,
- res,
- &error) == FALSE)
+ (gint32 *)&event,
+ (gint32 *)&type,
+ &data,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
DEBUG_ERR_MSG("Can not finish"
- " connection handover: %s", error->message);
+ " connection handover: %s", error->message);
g_error_free(error);
return;
}
net_nfc_util_gdbus_variant_to_data_s(data, &arg_data);
callback = (net_nfc_p2p_connection_handover_completed_cb)
- func_data->handover_callback;
+ func_data->handover_callback;
callback(result,
- type,
- &arg_data,
- func_data->handover_data);
+ type,
+ &arg_data,
+ func_data->handover_data);
net_nfc_util_free_data(&arg_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_handover_free_alternative_carrier_data(
- net_nfc_connection_handover_info_h info_handle)
+API net_nfc_error_e net_nfc_client_handover_free_alternative_carrier_data(
+ net_nfc_connection_handover_info_h info_handle)
{
net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
net_nfc_connection_handover_info_s *info = NULL;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_handover_get_alternative_carrier_type(
- net_nfc_connection_handover_info_h info_handle,
- net_nfc_conn_handover_carrier_type_e *type)
+API net_nfc_error_e net_nfc_client_handover_get_alternative_carrier_type(
+ net_nfc_connection_handover_info_h info_handle,
+ net_nfc_conn_handover_carrier_type_e *type)
{
net_nfc_connection_handover_info_s *info = NULL;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_handover_get_alternative_carrier_data(
- net_nfc_connection_handover_info_h info_handle,
- data_h *data)
+API net_nfc_error_e net_nfc_client_handover_get_alternative_carrier_data(
+ net_nfc_connection_handover_info_h info_handle,
+ data_h *data)
{
net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
net_nfc_connection_handover_info_s *info = NULL;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_p2p_connection_handover(
- net_nfc_target_handle_h handle,
- net_nfc_conn_handover_carrier_type_e arg_type,
- net_nfc_p2p_connection_handover_completed_cb callback,
- void *cb_data)
+API net_nfc_error_e net_nfc_client_p2p_connection_handover(
+ net_nfc_target_handle_h handle,
+ net_nfc_conn_handover_carrier_type_e arg_type,
+ net_nfc_p2p_connection_handover_completed_cb callback,
+ void *cb_data)
{
HandoverFuncData *funcdata = NULL;
funcdata->handover_data = cb_data;
net_nfc_gdbus_handover_call_request(handover_proxy,
- GPOINTER_TO_UINT(tag_handle),
- arg_type,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- p2p_connection_handover,
- funcdata);
+ GPOINTER_TO_UINT(tag_handle),
+ arg_type,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ p2p_connection_handover,
+ funcdata);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_p2p_connection_handover_sync(
- net_nfc_target_handle_h handle,
- net_nfc_conn_handover_carrier_type_e arg_type,
- net_nfc_conn_handover_carrier_type_e *out_carrier,
- data_h *out_ac_data)
+API net_nfc_error_e net_nfc_client_p2p_connection_handover_sync(
+ net_nfc_target_handle_h handle,
+ net_nfc_conn_handover_carrier_type_e arg_type,
+ net_nfc_conn_handover_carrier_type_e *out_carrier,
+ data_h *out_ac_data)
{
net_nfc_target_handle_s *tag_handle = (net_nfc_target_handle_s *)handle;
}
if(net_nfc_gdbus_handover_call_request_sync(handover_proxy,
- GPOINTER_TO_UINT(tag_handle),
- arg_type,
- net_nfc_client_gdbus_get_privilege(),
- (gint32 *)&out_event,
- (gint32 *)&out_type,
- &out_data,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(tag_handle),
+ arg_type,
+ net_nfc_client_gdbus_get_privilege(),
+ (gint32 *)&out_event,
+ (gint32 *)&out_type,
+ &out_data,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("handover (sync call) failed: %s",error->message);
g_error_free(error);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_handover_init(void)
+API net_nfc_error_e net_nfc_client_handover_init(void)
{
GError *error = NULL;
}
handover_proxy = net_nfc_gdbus_handover_proxy_new_for_bus_sync(
- G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.tizen.NetNfcService",
- "/org/tizen/NetNfcService/Handover",
- NULL,
- &error);
+ G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.tizen.NetNfcService",
+ "/org/tizen/NetNfcService/Handover",
+ NULL,
+ &error);
if(handover_proxy == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-void net_nfc_client_handover_deinit(void)
+API void net_nfc_client_handover_deinit(void)
{
if(handover_proxy)
{
#include "net_nfc_client_manager.h"
#include "net_nfc_client_llcp.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
typedef struct _LlcpFuncData LlcpFuncData;
struct _LlcpFuncData
void llcp_socket_data_remove(net_nfc_llcp_internal_socket_s *socket_data);
-net_nfc_llcp_internal_socket_s *llcp_socket_data_find
- (net_nfc_llcp_socket_t socket);
+net_nfc_llcp_internal_socket_s *llcp_socket_data_find(net_nfc_llcp_socket_t socket);
/* aysnc callback */
static void llcp_call_config(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void llcp_call_listen(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void llcp_call_connect(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void llcp_call_connect_sap(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void llcp_call_send(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void llcp_call_send_to(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void llcp_call_receive(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void llcp_call_receive_from(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void llcp_call_close(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void llcp_call_disconnect(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
/* signal callback */
static void llcp_error(NetNfcGDbusLlcp *object,
if (socket_data)
{
socket_data_list = g_list_append(socket_data_list,
- socket_data);
+ socket_data);
}
}
if (socket_data)
{
socket_data_list = g_list_remove(socket_data_list,
- socket_data);
+ socket_data);
g_free(socket_data->service_name);
g_free(socket_data);
}
}
-net_nfc_llcp_internal_socket_s *llcp_socket_data_find
- (net_nfc_llcp_socket_t socket)
+net_nfc_llcp_internal_socket_s *llcp_socket_data_find(net_nfc_llcp_socket_t socket)
{
GList *pos;
}
static void llcp_call_config(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
LlcpFuncData *func_data;
net_nfc_client_llcp_config_completed callback;
if (net_nfc_gdbus_llcp_call_config_finish(
- NET_NFC_GDBUS_LLCP(source_object),
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_LLCP(source_object),
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
}
static void llcp_call_listen(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
LlcpFuncData *func_data;
net_nfc_client_llcp_listen_completed callback;
if (net_nfc_gdbus_llcp_call_listen_finish(
- NET_NFC_GDBUS_LLCP(source_object),
- &out_client_socket,
- &out_oal_socket,
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_LLCP(source_object),
+ &out_client_socket,
+ &out_oal_socket,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
}
static void llcp_call_connect(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
LlcpFuncData *func_data;
net_nfc_client_llcp_connect_completed callback;
if (net_nfc_gdbus_llcp_call_connect_finish(
- NET_NFC_GDBUS_LLCP(source_object),
- &out_client_socket,
- &out_oal_socket,
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_LLCP(source_object),
+ &out_client_socket,
+ &out_oal_socket,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
}
static void llcp_call_connect_sap(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
LlcpFuncData *func_data;
net_nfc_client_llcp_connect_sap_completed callback;
if (net_nfc_gdbus_llcp_call_connect_sap_finish(
- NET_NFC_GDBUS_LLCP(source_object),
- &out_client_socket,
- &out_oal_socket,
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_LLCP(source_object),
+ &out_client_socket,
+ &out_oal_socket,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
}
callback = (net_nfc_client_llcp_connect_sap_completed)
- func_data->callback;
+ func_data->callback;
callback(result, out_client_socket, func_data->user_data);
}
static void llcp_call_send(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
LlcpFuncData *func_data;
net_nfc_client_llcp_send_completed callback;
if (net_nfc_gdbus_llcp_call_send_finish(
- NET_NFC_GDBUS_LLCP(source_object),
- &out_client_socket,
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_LLCP(source_object),
+ &out_client_socket,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
}
static void llcp_call_send_to(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
LlcpFuncData *func_data;
net_nfc_client_llcp_send_to_completed callback;
if (net_nfc_gdbus_llcp_call_send_to_finish(
- NET_NFC_GDBUS_LLCP(source_object),
- &out_client_socket,
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_LLCP(source_object),
+ &out_client_socket,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
}
static void llcp_call_receive(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
LlcpFuncData *func_data;
net_nfc_client_llcp_receive_completed callback;
if (net_nfc_gdbus_llcp_call_receive_finish(
- NET_NFC_GDBUS_LLCP(source_object),
- &variant,
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_LLCP(source_object),
+ &variant,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
}
static void llcp_call_receive_from(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
LlcpFuncData *func_data;
net_nfc_client_llcp_receive_from_completed callback;
if (net_nfc_gdbus_llcp_call_receive_from_finish(
- NET_NFC_GDBUS_LLCP(source_object),
- &sap,
- &variant,
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_LLCP(source_object),
+ &sap,
+ &variant,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
net_nfc_util_gdbus_variant_to_data_s(variant, &data);
callback = (net_nfc_client_llcp_receive_from_completed)
- func_data->callback;
+ func_data->callback;
callback(result, sap, &data, func_data->user_data);
net_nfc_util_free_data(&data);
}
static void llcp_call_close(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
LlcpFuncData *func_data;
net_nfc_client_llcp_close_completed callback;
if (net_nfc_gdbus_llcp_call_close_finish(
- NET_NFC_GDBUS_LLCP(source_object),
- &out_client_socket,
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_LLCP(source_object),
+ &out_client_socket,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
}
static void llcp_call_disconnect(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
LlcpFuncData *func_data;
net_nfc_client_llcp_disconnect_completed callback;
if (net_nfc_gdbus_llcp_call_disconnect_finish(
- NET_NFC_GDBUS_LLCP(source_object),
- &out_client_socket,
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_LLCP(source_object),
+ &out_client_socket,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
}
callback = (net_nfc_client_llcp_disconnect_completed)
- func_data->callback;
+ func_data->callback;
callback(result, out_client_socket, func_data->user_data);
}
}
/* Public APIs */
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_config(net_nfc_llcp_config_info_h config,
- net_nfc_client_llcp_config_completed callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_llcp_config(net_nfc_llcp_config_info_h config,
+ net_nfc_client_llcp_config_completed callback,
+ void *user_data)
{
LlcpFuncData *func_data;
GVariant *variant = NULL;
memcpy(&llcp_config, config, sizeof(net_nfc_llcp_config_info_s));
variant = g_variant_new("(qqyy)",
- config->miu,
- config->wks,
- config->lto,
- config->option);
+ config->miu,
+ config->wks,
+ config->lto,
+ config->option);
net_nfc_gdbus_llcp_call_config(llcp_proxy,
- variant,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- llcp_call_config,
- func_data);
+ variant,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ llcp_call_config,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_config_sync
- (net_nfc_llcp_config_info_h config)
+API net_nfc_error_e net_nfc_client_llcp_config_sync
+(net_nfc_llcp_config_info_h config)
{
GVariant *variant = NULL;
GError *error = NULL;
memcpy(&llcp_config, config, sizeof(net_nfc_llcp_config_info_s));
variant = g_variant_new("(qqyy)",
- config->miu,
- config->wks,
- config->lto,
- config->option);
+ config->miu,
+ config->wks,
+ config->lto,
+ config->option);
if (net_nfc_gdbus_llcp_call_config_sync(llcp_proxy,
- variant,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- &error) == FALSE)
+ variant,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not config: %s",
error->message);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_get_config
- (net_nfc_llcp_config_info_h *config)
+API net_nfc_error_e net_nfc_client_llcp_get_config
+(net_nfc_llcp_config_info_h *config)
{
if (config == NULL)
return NET_NFC_NULL_PARAMETER;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_listen(net_nfc_llcp_socket_t socket,
- const char *service_name,
- sap_t sap,
- net_nfc_client_llcp_listen_completed callback,
- void *user_data)
+ API net_nfc_error_e net_nfc_client_llcp_listen(net_nfc_llcp_socket_t socket,
+ const char *service_name,
+ sap_t sap,
+ net_nfc_client_llcp_listen_completed callback,
+ void *user_data)
{
LlcpFuncData *func_data;
net_nfc_llcp_internal_socket_s *socket_data = NULL;
func_data->user_data = user_data;
net_nfc_gdbus_llcp_call_listen(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- socket_data->miu,
- socket_data->rw,
- socket_data->type,
- socket_data->sap,
- service_name,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- llcp_call_listen,
- func_data);
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ socket_data->miu,
+ socket_data->rw,
+ socket_data->type,
+ socket_data->sap,
+ service_name,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ llcp_call_listen,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_listen_sync(net_nfc_llcp_socket_t socket,
- const char *service_name,
- sap_t sap,
- net_nfc_llcp_socket_t *out_socket)
+ API net_nfc_error_e net_nfc_client_llcp_listen_sync(net_nfc_llcp_socket_t socket,
+ const char *service_name,
+ sap_t sap,
+ net_nfc_llcp_socket_t *out_socket)
{
GError *error = NULL;
guint32 out_client_socket;
}
if (net_nfc_gdbus_llcp_call_listen_sync(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- socket_data->miu,
- socket_data->rw,
- socket_data->type,
- socket_data->sap,
- service_name,
- net_nfc_client_gdbus_get_privilege(),
- &out_client_socket,
- &out_oal_socket,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ socket_data->miu,
+ socket_data->rw,
+ socket_data->type,
+ socket_data->sap,
+ service_name,
+ net_nfc_client_gdbus_get_privilege(),
+ &out_client_socket,
+ &out_oal_socket,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not listen: %s",
error->message);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_connect(net_nfc_llcp_socket_t socket,
- const char *service_name,
- net_nfc_client_llcp_connect_completed callback,
- void *user_data)
+ API net_nfc_error_e net_nfc_client_llcp_connect(net_nfc_llcp_socket_t socket,
+ const char *service_name,
+ net_nfc_client_llcp_connect_completed callback,
+ void *user_data)
{
LlcpFuncData *func_data;
net_nfc_llcp_internal_socket_s *socket_data = NULL;
func_data->user_data = user_data;
net_nfc_gdbus_llcp_call_connect(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- socket_data->miu,
- socket_data->rw,
- socket_data->type,
- service_name,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- llcp_call_connect,
- func_data);
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ socket_data->miu,
+ socket_data->rw,
+ socket_data->type,
+ service_name,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ llcp_call_connect,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_connect_sync(net_nfc_llcp_socket_t socket,
- const char *service_name,
- net_nfc_llcp_socket_t *out_socket)
+ API net_nfc_error_e net_nfc_client_llcp_connect_sync(net_nfc_llcp_socket_t socket,
+ const char *service_name,
+ net_nfc_llcp_socket_t *out_socket)
{
GError *error = NULL;
guint32 out_client_socket;
}
if (net_nfc_gdbus_llcp_call_connect_sync(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- socket_data->miu,
- socket_data->rw,
- socket_data->type,
- service_name,
- net_nfc_client_gdbus_get_privilege(),
- &out_client_socket,
- &out_oal_socket,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ socket_data->miu,
+ socket_data->rw,
+ socket_data->type,
+ service_name,
+ net_nfc_client_gdbus_get_privilege(),
+ &out_client_socket,
+ &out_oal_socket,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not connect: %s",
error->message);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_connect_sap(net_nfc_llcp_socket_t socket,
- sap_t sap,
- net_nfc_client_llcp_connect_sap_completed callback,
- void *user_data)
+ API net_nfc_error_e net_nfc_client_llcp_connect_sap(net_nfc_llcp_socket_t socket,
+ sap_t sap,
+ net_nfc_client_llcp_connect_sap_completed callback,
+ void *user_data)
{
LlcpFuncData *func_data;
net_nfc_llcp_internal_socket_s *socket_data = NULL;
func_data->user_data = user_data;
net_nfc_gdbus_llcp_call_connect_sap(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- socket_data->miu,
- socket_data->rw,
- socket_data->type,
- sap,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- llcp_call_connect_sap,
- func_data);
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ socket_data->miu,
+ socket_data->rw,
+ socket_data->type,
+ sap,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ llcp_call_connect_sap,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_connect_sap_sync(
- net_nfc_llcp_socket_t socket,
- sap_t sap,
- net_nfc_llcp_socket_t *out_socket)
+ API net_nfc_error_e net_nfc_client_llcp_connect_sap_sync(
+ net_nfc_llcp_socket_t socket,
+ sap_t sap,
+ net_nfc_llcp_socket_t *out_socket)
{
GError *error = NULL;
guint32 out_client_socket;
}
if (net_nfc_gdbus_llcp_call_connect_sap_sync(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- socket_data->miu,
- socket_data->rw,
- socket_data->type,
- sap,
- net_nfc_client_gdbus_get_privilege(),
- &out_client_socket,
- &out_oal_socket,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ socket_data->miu,
+ socket_data->rw,
+ socket_data->type,
+ sap,
+ net_nfc_client_gdbus_get_privilege(),
+ &out_client_socket,
+ &out_oal_socket,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not connect: %s",
error->message);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_send(net_nfc_llcp_socket_t socket,
- data_h data,
- net_nfc_client_llcp_send_completed callback,
- void *user_data)
+ API net_nfc_error_e net_nfc_client_llcp_send(net_nfc_llcp_socket_t socket,
+ data_h data,
+ net_nfc_client_llcp_send_completed callback,
+ void *user_data)
{
LlcpFuncData *func_data;
GVariant *variant = NULL;
func_data->user_data = user_data;
net_nfc_gdbus_llcp_call_send(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- variant,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- llcp_call_send,
- func_data);
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ variant,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ llcp_call_send,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_send_sync(net_nfc_llcp_socket_t socket,
- data_h data,
- net_nfc_llcp_socket_t *out_socket)
+ API net_nfc_error_e net_nfc_client_llcp_send_sync(net_nfc_llcp_socket_t socket,
+ data_h data,
+ net_nfc_llcp_socket_t *out_socket)
{
GVariant *variant;
GError *error = NULL;
}
if (net_nfc_gdbus_llcp_call_send_sync(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- variant,
- net_nfc_client_gdbus_get_privilege(),
- &out_client_socket,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ variant,
+ net_nfc_client_gdbus_get_privilege(),
+ &out_client_socket,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not call send: %s",
error->message);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_send_to(net_nfc_llcp_socket_t socket,
- sap_t sap,
- data_h data,
- net_nfc_client_llcp_send_to_completed callback,
- void *user_data)
+ API net_nfc_error_e net_nfc_client_llcp_send_to(net_nfc_llcp_socket_t socket,
+ sap_t sap,
+ data_h data,
+ net_nfc_client_llcp_send_to_completed callback,
+ void *user_data)
{
LlcpFuncData *func_data;
GVariant *variant = NULL;
func_data->user_data = user_data;
net_nfc_gdbus_llcp_call_send_to(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- sap,
- variant,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- llcp_call_send_to,
- func_data);
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ sap,
+ variant,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ llcp_call_send_to,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_send_to_sync(net_nfc_llcp_socket_t socket,
- sap_t sap,
- data_h data,
- net_nfc_llcp_socket_t *out_socket)
+ API net_nfc_error_e net_nfc_client_llcp_send_to_sync(net_nfc_llcp_socket_t socket,
+ sap_t sap,
+ data_h data,
+ net_nfc_llcp_socket_t *out_socket)
{
GVariant *variant;
GError *error = NULL;
}
if (net_nfc_gdbus_llcp_call_send_to_sync(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- sap,
- variant,
- net_nfc_client_gdbus_get_privilege(),
- &out_client_socket,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ sap,
+ variant,
+ net_nfc_client_gdbus_get_privilege(),
+ &out_client_socket,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not call send to: %s",
error->message);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_receive(net_nfc_llcp_socket_t socket,
- size_t request_length,
- net_nfc_client_llcp_receive_completed callback,
- void *user_data)
+ API net_nfc_error_e net_nfc_client_llcp_receive(net_nfc_llcp_socket_t socket,
+ size_t request_length,
+ net_nfc_client_llcp_receive_completed callback,
+ void *user_data)
{
LlcpFuncData *func_data;
net_nfc_llcp_internal_socket_s *socket_data = NULL;
func_data->user_data = user_data;
net_nfc_gdbus_llcp_call_receive(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- request_length,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- llcp_call_receive,
- func_data);
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ request_length,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ llcp_call_receive,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_receive_sync(net_nfc_llcp_socket_t socket,
- size_t request_length,
- data_h *out_data)
+ API net_nfc_error_e net_nfc_client_llcp_receive_sync(net_nfc_llcp_socket_t socket,
+ size_t request_length,
+ data_h *out_data)
{
GVariant *variant = NULL;
GError *error = NULL;
}
if (net_nfc_gdbus_llcp_call_receive_sync(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- request_length,
- net_nfc_client_gdbus_get_privilege(),
- &variant,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ request_length,
+ net_nfc_client_gdbus_get_privilege(),
+ &variant,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not call receive: %s",
error->message);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_receive_from(net_nfc_llcp_socket_t socket,
- size_t request_length,
- net_nfc_client_llcp_receive_from_completed callback,
- void *user_data)
+ API net_nfc_error_e net_nfc_client_llcp_receive_from(net_nfc_llcp_socket_t socket,
+ size_t request_length,
+ net_nfc_client_llcp_receive_from_completed callback,
+ void *user_data)
{
LlcpFuncData *func_data;
net_nfc_llcp_internal_socket_s *socket_data = NULL;
func_data->user_data = user_data;
net_nfc_gdbus_llcp_call_receive_from(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- request_length,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- llcp_call_receive_from,
- func_data);
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ request_length,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ llcp_call_receive_from,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_receive_from_sync
- (net_nfc_llcp_socket_t socket,
- size_t request_length,
- sap_t *out_sap,
- data_h *out_data)
+API net_nfc_error_e net_nfc_client_llcp_receive_from_sync
+(net_nfc_llcp_socket_t socket,
+ size_t request_length,
+ sap_t *out_sap,
+ data_h *out_data)
{
GVariant *variant = NULL;
GError *error = NULL;
}
if (net_nfc_gdbus_llcp_call_receive_from_sync(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- request_length,
- net_nfc_client_gdbus_get_privilege(),
- &sap,
- &variant,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ request_length,
+ net_nfc_client_gdbus_get_privilege(),
+ &sap,
+ &variant,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not call receive from: %s",
error->message);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_close(net_nfc_llcp_socket_t socket,
- net_nfc_client_llcp_close_completed callback,
- void *user_data)
+ API net_nfc_error_e net_nfc_client_llcp_close(net_nfc_llcp_socket_t socket,
+ net_nfc_client_llcp_close_completed callback,
+ void *user_data)
{
LlcpFuncData *func_data;
net_nfc_llcp_internal_socket_s *socket_data = NULL;
func_data->user_data = user_data;
net_nfc_gdbus_llcp_call_close(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- llcp_call_close,
- func_data);
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ llcp_call_close,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_close_sync(net_nfc_llcp_socket_t socket,
- net_nfc_llcp_socket_t *out_socket)
+ API net_nfc_error_e net_nfc_client_llcp_close_sync(net_nfc_llcp_socket_t socket,
+ net_nfc_llcp_socket_t *out_socket)
{
GError *error = NULL;
guint32 out_client_socket;
}
if (net_nfc_gdbus_llcp_call_close_sync(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- net_nfc_client_gdbus_get_privilege(),
- &out_client_socket,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ net_nfc_client_gdbus_get_privilege(),
+ &out_client_socket,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not close: %s",
error->message);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_disconnect(net_nfc_llcp_socket_t socket,
- net_nfc_client_llcp_disconnect_completed callback,
- void *user_data)
+ API net_nfc_error_e net_nfc_client_llcp_disconnect(net_nfc_llcp_socket_t socket,
+ net_nfc_client_llcp_disconnect_completed callback,
+ void *user_data)
{
LlcpFuncData *func_data;
net_nfc_llcp_internal_socket_s *socket_data = NULL;
func_data->user_data = user_data;
net_nfc_gdbus_llcp_call_disconnect(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- llcp_call_disconnect,
- func_data);
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ llcp_call_disconnect,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_disconnect_sync(
- net_nfc_llcp_socket_t socket,
- net_nfc_llcp_socket_t *out_socket)
+ API net_nfc_error_e net_nfc_client_llcp_disconnect_sync(
+ net_nfc_llcp_socket_t socket,
+ net_nfc_llcp_socket_t *out_socket)
{
GError *error = NULL;
guint32 out_client_socket;
}
if (net_nfc_gdbus_llcp_call_disconnect_sync(llcp_proxy,
- GPOINTER_TO_UINT(llcp_handle),
- socket_data->client_socket,
- socket_data->oal_socket,
- net_nfc_client_gdbus_get_privilege(),
- &out_client_socket,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(llcp_handle),
+ socket_data->client_socket,
+ socket_data->oal_socket,
+ net_nfc_client_gdbus_get_privilege(),
+ &out_client_socket,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not disconnect: %s",
error->message);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-void net_nfc_client_llcp_create_socket(net_nfc_llcp_socket_t *socket,
- net_nfc_llcp_socket_option_h option)
+API void net_nfc_client_llcp_create_socket(net_nfc_llcp_socket_t *socket,
+ net_nfc_llcp_socket_option_h option)
{
net_nfc_llcp_internal_socket_s *socket_data = NULL;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_get_local_config(
- net_nfc_llcp_config_info_h *config)
+ API net_nfc_error_e net_nfc_client_llcp_get_local_config(
+ net_nfc_llcp_config_info_h *config)
{
if (config == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_get_local_socket_option(
- net_nfc_llcp_socket_t socket,
- net_nfc_llcp_socket_option_h *info)
+ API net_nfc_error_e net_nfc_client_llcp_get_local_socket_option(
+ net_nfc_llcp_socket_t socket,
+ net_nfc_llcp_socket_option_h *info)
{
net_nfc_llcp_internal_socket_s *socket_data = NULL;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_create_socket_option(
- net_nfc_llcp_socket_option_h *option,
- uint16_t miu,
- uint8_t rw,
- net_nfc_socket_type_e type)
+ API net_nfc_error_e net_nfc_client_llcp_create_socket_option(
+ net_nfc_llcp_socket_option_h *option,
+ uint16_t miu,
+ uint8_t rw,
+ net_nfc_socket_type_e type)
{
net_nfc_llcp_socket_option_s *struct_option = NULL;
}
if (miu < 128 || miu > 1152 ||
- rw < 1 || rw > 15 ||
- type < NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED ||
- type > NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONLESS)
+ rw < 1 || rw > 15 ||
+ type < NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED ||
+ type > NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONLESS)
{
return NET_NFC_OUT_OF_BOUND;
}
}
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_create_socket_option_default(
- net_nfc_llcp_socket_option_h *option)
+ API net_nfc_error_e net_nfc_client_llcp_create_socket_option_default(
+ net_nfc_llcp_socket_option_h *option)
{
return net_nfc_client_llcp_create_socket_option(
- option,
- 128,
- 1,
- NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED);
+ option,
+ 128,
+ 1,
+ NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_get_socket_option_miu(
- net_nfc_llcp_socket_option_h option,
- uint16_t *miu)
+ API net_nfc_error_e net_nfc_client_llcp_get_socket_option_miu(
+ net_nfc_llcp_socket_option_h option,
+ uint16_t *miu)
{
if (option == NULL || miu == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_set_socket_option_miu(
- net_nfc_llcp_socket_option_h option,
- uint16_t miu)
+ API net_nfc_error_e net_nfc_client_llcp_set_socket_option_miu(
+ net_nfc_llcp_socket_option_h option,
+ uint16_t miu)
{
if (option == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_get_socket_option_rw(
- net_nfc_llcp_socket_option_h option,
- uint8_t *rw)
+ API net_nfc_error_e net_nfc_client_llcp_get_socket_option_rw(
+ net_nfc_llcp_socket_option_h option,
+ uint8_t *rw)
{
if (option == NULL || rw == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_set_socket_option_rw(
- net_nfc_llcp_socket_option_h option,
- uint8_t rw)
+ API net_nfc_error_e net_nfc_client_llcp_set_socket_option_rw(
+ net_nfc_llcp_socket_option_h option,
+ uint8_t rw)
{
if (option == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_get_socket_option_type(
- net_nfc_llcp_socket_option_h option,
- net_nfc_socket_type_e * type)
+ API net_nfc_error_e net_nfc_client_llcp_get_socket_option_type(
+ net_nfc_llcp_socket_option_h option,
+ net_nfc_socket_type_e * type)
{
if (option == NULL || type == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_set_socket_option_type(
- net_nfc_llcp_socket_option_h option,
- net_nfc_socket_type_e type)
+ API net_nfc_error_e net_nfc_client_llcp_set_socket_option_type(
+ net_nfc_llcp_socket_option_h option,
+ net_nfc_socket_type_e type)
{
if (option == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_free_socket_option(
- net_nfc_llcp_socket_option_h option)
+ API net_nfc_error_e net_nfc_client_llcp_free_socket_option(
+ net_nfc_llcp_socket_option_h option)
{
if (option == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_create_config(
- net_nfc_llcp_config_info_h *config,
- uint16_t miu,
- uint16_t wks,
- uint8_t lto,
- uint8_t option)
+ API net_nfc_error_e net_nfc_client_llcp_create_config(
+ net_nfc_llcp_config_info_h *config,
+ uint16_t miu,
+ uint16_t wks,
+ uint8_t lto,
+ uint8_t option)
{
if (config == NULL)
{
}
net_nfc_llcp_config_info_s **tmp_config =
- (net_nfc_llcp_config_info_s **)config;
+ (net_nfc_llcp_config_info_s **)config;
_net_nfc_util_alloc_mem(*tmp_config,
- sizeof(net_nfc_llcp_config_info_s));
+ sizeof(net_nfc_llcp_config_info_s));
if (*tmp_config == NULL)
return NET_NFC_ALLOC_FAIL;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_create_config_default(net_nfc_llcp_config_info_h *config)
+ API net_nfc_error_e net_nfc_client_llcp_create_config_default(net_nfc_llcp_config_info_h *config)
{
return net_nfc_client_llcp_create_config(config, 128, 1, 10, 0);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_get_config_miu(
- net_nfc_llcp_config_info_h config,
- uint16_t *miu)
+ API net_nfc_error_e net_nfc_client_llcp_get_config_miu(
+ net_nfc_llcp_config_info_h config,
+ uint16_t *miu)
{
if (config == NULL || miu == NULL)
{
}
net_nfc_llcp_config_info_s *tmp_config =
- (net_nfc_llcp_config_info_s *)config;
+ (net_nfc_llcp_config_info_s *)config;
*miu = tmp_config->miu;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_get_config_wks(
- net_nfc_llcp_config_info_h config,
- uint16_t *wks)
+ API net_nfc_error_e net_nfc_client_llcp_get_config_wks(
+ net_nfc_llcp_config_info_h config,
+ uint16_t *wks)
{
if (config == NULL || wks == NULL)
{
}
net_nfc_llcp_config_info_s *tmp_config =
- (net_nfc_llcp_config_info_s *)config;
+ (net_nfc_llcp_config_info_s *)config;
*wks = tmp_config->wks;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_get_config_lto(
- net_nfc_llcp_config_info_h config,
- uint8_t *lto)
+ API net_nfc_error_e net_nfc_client_llcp_get_config_lto(
+ net_nfc_llcp_config_info_h config,
+ uint8_t *lto)
{
if (config == NULL || lto == NULL)
{
}
net_nfc_llcp_config_info_s *tmp_config =
- (net_nfc_llcp_config_info_s *)config;
+ (net_nfc_llcp_config_info_s *)config;
*lto = tmp_config->lto;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_get_config_option(
- net_nfc_llcp_config_info_h config,
- uint8_t *option)
+ API net_nfc_error_e net_nfc_client_llcp_get_config_option(
+ net_nfc_llcp_config_info_h config,
+ uint8_t *option)
{
if (config == NULL || option == NULL)
{
}
net_nfc_llcp_config_info_s *tmp_config =
- (net_nfc_llcp_config_info_s *)config;
+ (net_nfc_llcp_config_info_s *)config;
*option = tmp_config->option;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_set_config_miu(
- net_nfc_llcp_config_info_h config,
- uint16_t miu)
+ API net_nfc_error_e net_nfc_client_llcp_set_config_miu(
+ net_nfc_llcp_config_info_h config,
+ uint16_t miu)
{
if (config == NULL)
{
}
net_nfc_llcp_config_info_s * tmp_config =
- (net_nfc_llcp_config_info_s *)config;
+ (net_nfc_llcp_config_info_s *)config;
tmp_config->miu = miu;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_set_config_wks(
- net_nfc_llcp_config_info_h config,
- uint16_t wks)
+ API net_nfc_error_e net_nfc_client_llcp_set_config_wks(
+ net_nfc_llcp_config_info_h config,
+ uint16_t wks)
{
if (config == NULL)
{
}
net_nfc_llcp_config_info_s *tmp_config =
- (net_nfc_llcp_config_info_s *)config;
+ (net_nfc_llcp_config_info_s *)config;
tmp_config->wks = wks;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_set_config_lto(
- net_nfc_llcp_config_info_h config,
- uint8_t lto)
+ API net_nfc_error_e net_nfc_client_llcp_set_config_lto(
+ net_nfc_llcp_config_info_h config,
+ uint8_t lto)
{
if (config == NULL)
{
}
net_nfc_llcp_config_info_s *tmp_config =
- (net_nfc_llcp_config_info_s *)config;
+ (net_nfc_llcp_config_info_s *)config;
tmp_config->lto = lto;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_set_config_option(
- net_nfc_llcp_config_info_h config,
- uint8_t option)
+ API net_nfc_error_e net_nfc_client_llcp_set_config_option(
+ net_nfc_llcp_config_info_h config,
+ uint8_t option)
{
if (config == NULL)
{
}
net_nfc_llcp_config_info_s * tmp_config =
- (net_nfc_llcp_config_info_s *)config;
+ (net_nfc_llcp_config_info_s *)config;
tmp_config->option = option;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_llcp_free_config(net_nfc_llcp_config_info_h config)
+ API net_nfc_error_e net_nfc_client_llcp_free_config(net_nfc_llcp_config_info_h config)
{
if (config == NULL)
{
#include "net_nfc_client_context.h"
#include "net_nfc_client_manager.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
typedef struct _ManagerFuncData ManagerFuncData;
struct _ManagerFuncData
static int is_activated = -1;
static void manager_call_set_active_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void manager_call_get_server_state_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void manager_activated(NetNfcGDbusManager *manager,
- gboolean activated,
- gpointer user_data);
+ gboolean activated,
+ gpointer user_data);
static void manager_call_set_active_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
ManagerFuncData *func_data;
result = NET_NFC_UNKNOWN_ERROR;
DEBUG_ERR_MSG("Can not finish call_set_active: %s",
- error->message);
+ error->message);
g_error_free(error);
}
callback = (net_nfc_client_manager_set_active_completed)
- func_data->callback;
+ func_data->callback;
data = func_data->user_data;
callback(result, data);
}
static void manager_call_get_server_state_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
ManagerFuncData *func_data;
result = NET_NFC_UNKNOWN_ERROR;
DEBUG_ERR_MSG("Can not finish get_server_state: %s",
- error->message);
+ error->message);
g_error_free(error);
}
}
callback = (net_nfc_client_manager_get_server_state_completed)
- func_data->callback;
+ func_data->callback;
data = func_data->user_data;
callback(result, out_state, data);
static void manager_activated(NetNfcGDbusManager *manager,
- gboolean activated,
- gpointer user_data)
+ gboolean activated,
+ gpointer user_data)
{
bool state = false;
gpointer user_data;
callback = (net_nfc_client_manager_activated)
- (activated_func_data->callback);
+ (activated_func_data->callback);
user_data = activated_func_data->user_data;
callback(state, user_data);
}
}
-NET_NFC_EXPORT_API
-void net_nfc_client_manager_set_activated(
- net_nfc_client_manager_activated callback,
- void *user_data)
+API void net_nfc_client_manager_set_activated(
+ net_nfc_client_manager_activated callback,
+ void *user_data)
{
if (activated_func_data == NULL)
activated_func_data = g_new0(ManagerFuncData, 1);
activated_func_data->user_data = user_data;
}
-NET_NFC_EXPORT_API
-void net_nfc_client_manager_unset_activated(void)
+API void net_nfc_client_manager_unset_activated(void)
{
if (activated_func_data == NULL)
{
activated_func_data = NULL;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_manager_set_active(int state,
- net_nfc_client_manager_set_active_completed callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_manager_set_active(int state,
+ net_nfc_client_manager_set_active_completed callback,
+ void *user_data)
{
gboolean active = FALSE;
ManagerFuncData *func_data;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_manager_set_active_sync(int state)
+API net_nfc_error_e net_nfc_client_manager_set_active_sync(int state)
{
GError *error = NULL;
/* allow this function even nfc is off */
if (net_nfc_gdbus_manager_call_set_active_sync(manager_proxy,
- (gboolean)state,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- &error) == FALSE)
+ (gboolean)state,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ &error) == FALSE)
{
DEBUG_CLIENT_MSG("can not call SetActive: %s",
error->message);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_manager_get_server_state(
+API net_nfc_error_e net_nfc_client_manager_get_server_state(
net_nfc_client_manager_get_server_state_completed callback,
void *user_data)
{
func_data->user_data = user_data;
net_nfc_gdbus_manager_call_get_server_state(manager_proxy,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- manager_call_get_server_state_callback,
- func_data);
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ manager_call_get_server_state_callback,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_manager_get_server_state_sync(
- unsigned int *state)
+API net_nfc_error_e net_nfc_client_manager_get_server_state_sync(
+ unsigned int *state)
{
GError *error = NULL;
guint out_state;
}
if (net_nfc_gdbus_manager_call_get_server_state_sync(manager_proxy,
- net_nfc_client_gdbus_get_privilege(),
- &out_state,
- NULL,
- &error) == FALSE)
+ net_nfc_client_gdbus_get_privilege(),
+ &out_state,
+ NULL,
+ &error) == FALSE)
{
DEBUG_CLIENT_MSG("can not call GetServerState: %s",
error->message);
}
manager_proxy = net_nfc_gdbus_manager_proxy_new_for_bus_sync(
- G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.tizen.NetNfcService",
- "/org/tizen/NetNfcService/Manager",
- NULL,
- &error);
+ G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.tizen.NetNfcService",
+ "/org/tizen/NetNfcService/Manager",
+ NULL,
+ &error);
if (manager_proxy == NULL)
{
#include "net_nfc_client_ndef.h"
#include "net_nfc_client_tag_internal.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
typedef struct _NdefFuncData NdefFuncData;
struct _NdefFuncData
static gboolean ndef_is_supported_tag(void);
static void ndef_call_read(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void ndef_call_write(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void ndef_call_make_read_only(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void ndef_call_format(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static ndef_message_h ndef_variant_to_message(GVariant *variant)
{
if (data.buffer && data.length > 0)
{
if (net_nfc_create_ndef_message_from_rawdata(&message, &data)
- != NET_NFC_OK)
+ != NET_NFC_OK)
{
DEBUG_ERR_MSG("memory alloc fail...");
}
GVariant *variant = NULL;
length = net_nfc_util_get_ndef_message_length(
- (ndef_message_s *)message);
+ (ndef_message_s *)message);
if (length == 0)
{
data.buffer = g_new0(guint8, length);
if(net_nfc_util_convert_ndef_message_to_rawdata(
- (ndef_message_s *)message,
- &data) != NET_NFC_OK)
+ (ndef_message_s *)message,
+ &data) != NET_NFC_OK)
{
DEBUG_ERR_MSG("can not convert ndef_message to rawdata");
return NULL;
switch (target_info->devType)
{
- case NET_NFC_ISO14443_A_PICC :
- case NET_NFC_MIFARE_MINI_PICC :
- case NET_NFC_MIFARE_1K_PICC :
- case NET_NFC_MIFARE_4K_PICC :
- case NET_NFC_MIFARE_ULTRA_PICC :
- case NET_NFC_JEWEL_PICC :
- return TRUE;
- break;
- default:
- DEBUG_CLIENT_MSG(
+ case NET_NFC_ISO14443_A_PICC :
+ case NET_NFC_MIFARE_MINI_PICC :
+ case NET_NFC_MIFARE_1K_PICC :
+ case NET_NFC_MIFARE_4K_PICC :
+ case NET_NFC_MIFARE_ULTRA_PICC :
+ case NET_NFC_JEWEL_PICC :
+ return TRUE;
+ break;
+ default:
+ DEBUG_CLIENT_MSG(
"not supported tag for read only tag");
- return FALSE;
+ return FALSE;
}
}
static void ndef_call_read(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
NdefFuncData *func_data;
}
static void ndef_call_write(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
NdefFuncData *func_data;
}
static void ndef_call_make_read_only(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
NdefFuncData *func_data;
}
callback = (net_nfc_client_ndef_make_read_only_completed)
- func_data->callback;
+ func_data->callback;
callback(out_result, func_data->user_data);
g_free(func_data);
}
static void ndef_call_format(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
NdefFuncData *func_data;
g_free(func_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_ndef_read(net_nfc_target_handle_h handle,
- net_nfc_client_ndef_read_completed callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_ndef_read(net_nfc_target_handle_h handle,
+ net_nfc_client_ndef_read_completed callback,
+ void *user_data)
{
NdefFuncData *func_data;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_ndef_read_sync(net_nfc_target_handle_h handle,
- ndef_message_h *message)
+API net_nfc_error_e net_nfc_client_ndef_read_sync(net_nfc_target_handle_h handle,
+ ndef_message_h *message)
{
GVariant *out_data = NULL;
GError *error = NULL;
return NET_NFC_OPERATION_FAIL;
if (net_nfc_gdbus_ndef_call_read_sync(ndef_proxy,
- GPOINTER_TO_UINT(handle),
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&out_result,
- &out_data,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(handle),
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&out_result,
+ &out_data,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not call read: %s",
error->message);
return out_result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_ndef_write(net_nfc_target_handle_h handle,
- ndef_message_h message,
- net_nfc_client_ndef_write_completed callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_ndef_write(net_nfc_target_handle_h handle,
+ ndef_message_h message,
+ net_nfc_client_ndef_write_completed callback,
+ void *user_data)
{
NdefFuncData *func_data;
return NET_NFC_INVALID_PARAM;
net_nfc_gdbus_ndef_call_write(ndef_proxy,
- GPOINTER_TO_UINT(handle),
- arg_data,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- ndef_call_write,
- func_data);
+ GPOINTER_TO_UINT(handle),
+ arg_data,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ ndef_call_write,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_ndef_write_sync(net_nfc_target_handle_h handle,
- ndef_message_h message)
+API net_nfc_error_e net_nfc_client_ndef_write_sync(net_nfc_target_handle_h handle,
+ ndef_message_h message)
{
GVariant *arg_data = NULL;
GError *error = NULL;
return NET_NFC_INVALID_PARAM;
if (net_nfc_gdbus_ndef_call_write_sync(ndef_proxy ,
- GPOINTER_TO_UINT(handle),
- arg_data,
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&out_result,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(handle),
+ arg_data,
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&out_result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not call write: %s",
error->message);
return out_result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_ndef_make_read_only(
- net_nfc_target_handle_h handle,
- net_nfc_client_ndef_make_read_only_completed callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_ndef_make_read_only(
+ net_nfc_target_handle_h handle,
+ net_nfc_client_ndef_make_read_only_completed callback,
+ void *user_data)
{
NdefFuncData *func_data;
func_data->user_data = user_data;
net_nfc_gdbus_ndef_call_make_read_only(ndef_proxy,
- GPOINTER_TO_UINT(handle),
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- ndef_call_make_read_only,
- func_data);
+ GPOINTER_TO_UINT(handle),
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ ndef_call_make_read_only,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_ndef_make_read_only_sync(
- net_nfc_target_handle_h handle)
+API net_nfc_error_e net_nfc_client_ndef_make_read_only_sync(
+ net_nfc_target_handle_h handle)
{
GError *error = NULL;
return NET_NFC_NOT_SUPPORTED;
if (net_nfc_gdbus_ndef_call_make_read_only_sync(ndef_proxy,
- GPOINTER_TO_UINT(handle),
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&out_result,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(handle),
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&out_result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not make read only: %s",
error->message);
return out_result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_ndef_format(net_nfc_target_handle_h handle,
- data_h key,
- net_nfc_client_ndef_format_completed callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_ndef_format(net_nfc_target_handle_h handle,
+ data_h key,
+ net_nfc_client_ndef_format_completed callback,
+ void *user_data)
{
NdefFuncData *func_data;
GVariant *arg_data = NULL;
func_data->user_data = user_data;
net_nfc_gdbus_ndef_call_format(ndef_proxy ,
- GPOINTER_TO_UINT(handle),
- arg_data,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- ndef_call_format,
- func_data);
+ GPOINTER_TO_UINT(handle),
+ arg_data,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ ndef_call_format,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_ndef_format_sync(
- net_nfc_target_handle_h handle,
- data_h key)
+API net_nfc_error_e net_nfc_client_ndef_format_sync(
+ net_nfc_target_handle_h handle,
+ data_h key)
{
GVariant *arg_data = NULL;
GError *error = NULL;
return NET_NFC_INVALID_PARAM;
if (net_nfc_gdbus_ndef_call_format_sync(ndef_proxy ,
- GPOINTER_TO_UINT(handle),
- arg_data,
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&out_result,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(handle),
+ arg_data,
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&out_result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("can not call format: %s",
error->message);
}
ndef_proxy = net_nfc_gdbus_ndef_proxy_new_for_bus_sync(
- G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.tizen.NetNfcService",
- "/org/tizen/NetNfcService/Ndef",
- NULL,
- &error);
+ G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.tizen.NetNfcService",
+ "/org/tizen/NetNfcService/Ndef",
+ NULL,
+ &error);
if (ndef_proxy == NULL)
{
/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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.
- */
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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 "net_nfc_debug_internal.h"
#include "net_nfc_util_internal.h"
#include "net_nfc_data.h"
-
-#ifndef NET_NFC_MANAGER_DATA_PATH
-#define NET_NFC_MANAGER_DATA_PATH "/opt/data/nfc-manager-daemon"
-#endif
-
-#ifndef NET_NFC_MANAGER_DATA_PATH_MESSAGE
-#define NET_NFC_MANAGER_DATA_PATH_MESSAGE "message"
-#endif
-
-#ifndef NET_NFC_MANAGER_NDEF_FILE_NAME
-#define NET_NFC_MANAGER_NDEF_FILE_NAME "ndef-message.txt"
-#endif
-
-
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
-
/* public functions */
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_ndef_message(ndef_message_h *ndef_message)
+API net_nfc_error_e net_nfc_create_ndef_message(ndef_message_h *ndef_message)
{
return net_nfc_util_create_ndef_message((ndef_message_s **)ndef_message);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_rawdata_from_ndef_message(ndef_message_h ndef_message, data_h *rawdata)
+API net_nfc_error_e net_nfc_create_rawdata_from_ndef_message(ndef_message_h ndef_message, data_h *rawdata)
{
uint32_t count;
net_nfc_error_e result;
}
result = net_nfc_util_convert_ndef_message_to_rawdata(
- (ndef_message_s *)ndef_message, (data_s *)data);
+ (ndef_message_s *)ndef_message, (data_s *)data);
if (result == NET_NFC_OK) {
*rawdata = data;
} else {
return result;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_ndef_message_from_rawdata(ndef_message_h *ndef_message, data_h rawdata)
+API net_nfc_error_e net_nfc_create_ndef_message_from_rawdata(ndef_message_h *ndef_message, data_h rawdata)
{
net_nfc_error_e result;
ndef_message_h msg;
}
result = net_nfc_util_convert_rawdata_to_ndef_message(
- (data_s *)rawdata, (ndef_message_s *)msg);
+ (data_s *)rawdata, (ndef_message_s *)msg);
if (result == NET_NFC_OK) {
*ndef_message = msg;
} else {
return result;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_ndef_message_byte_length(ndef_message_h ndef_message, uint32_t *length)
+API net_nfc_error_e net_nfc_get_ndef_message_byte_length(ndef_message_h ndef_message, uint32_t *length)
{
net_nfc_error_e result;
return result;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_append_record_to_ndef_message(ndef_message_h ndef_message, ndef_record_h record)
+API net_nfc_error_e net_nfc_append_record_to_ndef_message(ndef_message_h ndef_message, ndef_record_h record)
{
if (ndef_message == NULL || record == NULL){
return NET_NFC_NULL_PARAMETER;
return net_nfc_util_append_record((ndef_message_s*)ndef_message, (ndef_record_s *)record);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_free_ndef_message(ndef_message_h ndef_message)
+API net_nfc_error_e net_nfc_free_ndef_message(ndef_message_h ndef_message)
{
if (ndef_message == NULL) {
return NET_NFC_NULL_PARAMETER;
return net_nfc_util_free_ndef_message((ndef_message_s *)ndef_message);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_ndef_message_record_count(ndef_message_h ndef_message, int *count)
+API net_nfc_error_e net_nfc_get_ndef_message_record_count(ndef_message_h ndef_message, int *count)
{
if (ndef_message == NULL || count == NULL) {
return NET_NFC_NULL_PARAMETER;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API void net_nfc_ndef_print_message (ndef_message_h ndef_message )
+API void net_nfc_ndef_print_message (ndef_message_h ndef_message )
{
net_nfc_util_print_ndef_message ((ndef_message_s *)(ndef_message) );
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_search_record_by_type (ndef_message_h ndef_message, net_nfc_record_tnf_e tnf, data_h type, ndef_record_h* record)
+API net_nfc_error_e net_nfc_search_record_by_type (ndef_message_h ndef_message, net_nfc_record_tnf_e tnf, data_h type, ndef_record_h* record)
{
return net_nfc_util_search_record_by_type ((ndef_message_s*)ndef_message, tnf, (data_s *)type, (ndef_record_s**)record);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_append_record_by_index (ndef_message_h ndef_message, int index, ndef_record_h record)
+API net_nfc_error_e net_nfc_append_record_by_index (ndef_message_h ndef_message, int index, ndef_record_h record)
{
return net_nfc_util_append_record_by_index ((ndef_message_s *) ndef_message, index, (ndef_record_s *) record);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_record_by_index (ndef_message_h ndef_message, int index, ndef_record_h* record)
+API net_nfc_error_e net_nfc_get_record_by_index (ndef_message_h ndef_message, int index, ndef_record_h* record)
{
return net_nfc_util_get_record_by_index ((ndef_message_s*) ndef_message, index, (ndef_record_s**) record);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_remove_record_by_index (ndef_message_h ndef_message, int index)
+API net_nfc_error_e net_nfc_remove_record_by_index (ndef_message_h ndef_message, int index)
{
return net_nfc_util_remove_record_by_index ((ndef_message_s*)ndef_message, index);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_retrieve_current_ndef_message(ndef_message_h* ndef_message)
+API net_nfc_error_e net_nfc_retrieve_current_ndef_message(ndef_message_h* ndef_message)
{
net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
char file_path[1024] = { 0, };
--- /dev/null
+/*
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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.h>
+
+#include "net_nfc_ndef_message_handover.h"
+#include "net_nfc_typedef_internal.h"
+#include "net_nfc_debug_internal.h"
+#include "net_nfc_util_internal.h"
+#include "net_nfc_util_handover.h"
+
+API net_nfc_error_e net_nfc_create_carrier_config (net_nfc_carrier_config_h * config, net_nfc_conn_handover_carrier_type_e type)
+{
+ return net_nfc_util_create_carrier_config ((net_nfc_carrier_config_s **) config, type);
+}
+
+API net_nfc_error_e net_nfc_add_carrier_config_property (net_nfc_carrier_config_h config, uint16_t attribute, uint16_t size, uint8_t * data)
+{
+ return net_nfc_util_add_carrier_config_property ((net_nfc_carrier_config_s *) config, attribute, size, data);
+}
+
+API net_nfc_error_e net_nfc_remove_carrier_config_property (net_nfc_carrier_config_h config, uint16_t attribute)
+{
+ return net_nfc_util_remove_carrier_config_property ((net_nfc_carrier_config_s *) config, attribute);
+}
+
+API net_nfc_error_e net_nfc_get_carrier_config_property (net_nfc_carrier_config_h config, uint16_t attribute, uint16_t * size, uint8_t ** data)
+{
+ return net_nfc_util_get_carrier_config_property ((net_nfc_carrier_config_s *) config, attribute, size, data);
+}
+
+API net_nfc_error_e net_nfc_append_carrier_config_group (net_nfc_carrier_config_h config, net_nfc_property_group_h group)
+{
+ return net_nfc_util_append_carrier_config_group ((net_nfc_carrier_config_s *) config, (net_nfc_carrier_property_s *) group);
+}
+
+API net_nfc_error_e net_nfc_remove_carrier_config_group (net_nfc_carrier_config_h config, net_nfc_property_group_h group)
+{
+ return net_nfc_util_remove_carrier_config_group ((net_nfc_carrier_config_s *) config, (net_nfc_carrier_property_s *) group);
+}
+
+API net_nfc_error_e net_nfc_get_carrier_config_group (net_nfc_carrier_config_h config, int index, net_nfc_property_group_h * group)
+{
+ return net_nfc_util_get_carrier_config_group ((net_nfc_carrier_config_s *) config, index, (net_nfc_carrier_property_s **) group);
+}
+
+API net_nfc_error_e net_nfc_free_carrier_config (net_nfc_carrier_config_h config)
+{
+ return net_nfc_util_free_carrier_config ((net_nfc_carrier_config_s *) config);
+}
+
+API net_nfc_error_e net_nfc_create_carrier_config_group (net_nfc_property_group_h * group, uint16_t attribute)
+{
+ return net_nfc_util_create_carrier_config_group ((net_nfc_carrier_property_s **) group, attribute);
+}
+
+API net_nfc_error_e net_nfc_add_carrier_config_group_property (net_nfc_property_group_h group, uint16_t attribute, uint16_t size, uint8_t * data)
+{
+ return net_nfc_util_add_carrier_config_group_property ((net_nfc_carrier_property_s*) group, attribute, size, data);
+}
+
+API net_nfc_error_e net_nfc_get_carrier_config_group_property (net_nfc_property_group_h group, uint16_t attribute, uint16_t *size, uint8_t ** data)
+{
+ return net_nfc_util_get_carrier_config_group_property ((net_nfc_carrier_property_s*) group, attribute, size, data);
+}
+
+API net_nfc_error_e net_nfc_remove_carrier_config_group_property (net_nfc_property_group_h group, uint16_t attribute)
+{
+ return net_nfc_util_remove_carrier_config_group_property ((net_nfc_carrier_property_s*) group, attribute);
+}
+
+API net_nfc_error_e net_nfc_free_carrier_group (net_nfc_property_group_h group)
+{
+ return net_nfc_util_free_carrier_group ((net_nfc_carrier_property_s*) group);
+}
+
+API net_nfc_error_e net_nfc_create_ndef_record_with_carrier_config (ndef_record_h * record, net_nfc_carrier_config_h config)
+{
+ return net_nfc_util_create_ndef_record_with_carrier_config ((ndef_record_s**) record, (net_nfc_carrier_config_s *) config);
+}
+
+API net_nfc_error_e net_nfc_create_carrier_config_from_config_record (net_nfc_carrier_config_h * config, ndef_record_h record)
+{
+ return net_nfc_util_create_carrier_config_from_config_record ((net_nfc_carrier_config_s **) config, (ndef_record_s *) record);
+
+}
+
+API net_nfc_error_e net_nfc_append_carrier_config_record (ndef_message_h message, ndef_record_h record, net_nfc_conn_handover_carrier_state_e power_status)
+{
+ return net_nfc_util_append_carrier_config_record ((ndef_message_s *) message, (ndef_record_s *) record, power_status);
+}
+
+API net_nfc_error_e net_nfc_remove_carrier_config_record (ndef_message_h message, ndef_record_h record)
+{
+ return net_nfc_util_remove_carrier_config_record ((ndef_message_s *) message, (ndef_record_s *) record);
+}
+
+API net_nfc_error_e net_nfc_get_carrier_config_record (ndef_message_h message, int index, ndef_record_h * record)
+{
+ return net_nfc_util_get_carrier_config_record ((ndef_message_s *) message, index, (ndef_record_s **) record);
+}
+
+API net_nfc_error_e net_nfc_get_handover_random_number(ndef_message_h message, unsigned short* random_number)
+{
+ return net_nfc_util_get_handover_random_number((ndef_message_s *) message, random_number);
+}
+
+API net_nfc_error_e net_nfc_get_alternative_carrier_record_count (ndef_message_h message, unsigned int * count)
+{
+ return net_nfc_util_get_alternative_carrier_record_count ((ndef_message_s *) message, count);
+}
+
+API net_nfc_error_e net_nfc_get_alternative_carrier_power_status (ndef_message_h message, int index, net_nfc_conn_handover_carrier_state_e * power_state)
+{
+ return net_nfc_util_get_alternative_carrier_power_status ((ndef_message_s *) message, index, power_state);
+}
+
+API net_nfc_error_e net_nfc_set_alternative_carrier_power_status (ndef_message_h message, int index, net_nfc_conn_handover_carrier_state_e power_status)
+{
+ return net_nfc_util_set_alternative_carrier_power_status ((ndef_message_s *) message, index, power_status);
+}
+
+API net_nfc_error_e net_nfc_get_alternative_carrier_type (ndef_message_h message, int index, net_nfc_conn_handover_carrier_type_e * type)
+{
+ return net_nfc_util_get_alternative_carrier_type ((ndef_message_s *) message, index, type);
+}
+
+API net_nfc_error_e net_nfc_create_handover_request_message (ndef_message_h * message)
+{
+ return net_nfc_util_create_handover_request_message ((ndef_message_s **) message);
+}
+
+API net_nfc_error_e net_nfc_create_handover_select_message (ndef_message_h * message)
+{
+ return net_nfc_util_create_handover_select_message((ndef_message_s **) message);
+}
+
+API net_nfc_error_e net_nfc_create_handover_error_record (ndef_record_h * record, uint8_t reason, uint32_t data)
+{
+ return net_nfc_util_create_handover_error_record ((ndef_record_s**) record, reason, data);
+}
+
+
* Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
-
+ *
* http://floralicense.org/license/
*
* Unless required by applicable law or agreed to in writing, software
#include "net_nfc_util_internal.h"
#include "net_nfc_util_ndef_record.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_record(ndef_record_h* record, net_nfc_record_tnf_e tnf, data_h typeName, data_h id, data_h payload)
+API net_nfc_error_e net_nfc_create_record(ndef_record_h* record, net_nfc_record_tnf_e tnf, data_h typeName, data_h id, data_h payload)
{
return net_nfc_util_create_record(tnf, (data_s*)typeName, (data_s*)id, (data_s*)payload, (ndef_record_s**)record);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_text_type_record(ndef_record_h* record, const char* text, const char* language_code_str, net_nfc_encode_type_e encode)
+API net_nfc_error_e net_nfc_create_text_type_record(ndef_record_h* record, const char* text, const char* language_code_str, net_nfc_encode_type_e encode)
{
return net_nfc_util_create_text_type_record(text, language_code_str, encode, (ndef_record_s**)record);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_uri_type_record(ndef_record_h* record, const char* uri, net_nfc_schema_type_e protocol_schema)
+API net_nfc_error_e net_nfc_create_uri_type_record(ndef_record_h* record, const char* uri, net_nfc_schema_type_e protocol_schema)
{
return net_nfc_util_create_uri_type_record(uri, protocol_schema, (ndef_record_s**)record);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_free_record(ndef_record_h record)
+API net_nfc_error_e net_nfc_free_record(ndef_record_h record)
{
return net_nfc_util_free_record((ndef_record_s*)record);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_record_payload(ndef_record_h record, data_h * payload)
+API net_nfc_error_e net_nfc_get_record_payload(ndef_record_h record, data_h * payload)
{
if (record == NULL || payload == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_record_type(ndef_record_h record, data_h * type)
+API net_nfc_error_e net_nfc_get_record_type(ndef_record_h record, data_h * type)
{
if (record == NULL || type == NULL)
{
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_record_id(ndef_record_h record, data_h * id)
+API net_nfc_error_e net_nfc_get_record_id(ndef_record_h record, data_h * id)
{
if (record == NULL || id == NULL)
{
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_record_tnf(ndef_record_h record, net_nfc_record_tnf_e * TNF)
+API net_nfc_error_e net_nfc_get_record_tnf(ndef_record_h record, net_nfc_record_tnf_e * TNF)
{
if (record == NULL || TNF == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_set_record_id(ndef_record_h record, data_h id)
+API net_nfc_error_e net_nfc_set_record_id(ndef_record_h record, data_h id)
{
ndef_record_s * tmp_record = (ndef_record_s *)record;
return net_nfc_util_set_record_id(tmp_record, tmp_id->buffer, tmp_id->length);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_record_flags(ndef_record_h record, uint8_t * flag)
+API net_nfc_error_e net_nfc_get_record_flags(ndef_record_h record, uint8_t * flag)
{
if (record == NULL || flag == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API uint8_t net_nfc_get_record_mb(uint8_t flag)
+API uint8_t net_nfc_get_record_mb(uint8_t flag)
{
return ((flag >> 7) & 0x01);
}
-NET_NFC_EXPORT_API uint8_t net_nfc_get_record_me(uint8_t flag)
+API uint8_t net_nfc_get_record_me(uint8_t flag)
{
return ((flag >> 6) & 0x01);
}
-NET_NFC_EXPORT_API uint8_t net_nfc_get_record_cf(uint8_t flag)
+API uint8_t net_nfc_get_record_cf(uint8_t flag)
{
return ((flag >> 5) & 0x01);
}
-NET_NFC_EXPORT_API uint8_t net_nfc_get_record_sr(uint8_t flag)
+API uint8_t net_nfc_get_record_sr(uint8_t flag)
{
return ((flag >> 4) & 0x01);
}
-NET_NFC_EXPORT_API uint8_t net_nfc_get_record_il(uint8_t flag)
+API uint8_t net_nfc_get_record_il(uint8_t flag)
{
return ((flag >> 3) & 0x01);
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_text_string_from_text_record(ndef_record_h record, char** buffer)
+API net_nfc_error_e net_nfc_create_text_string_from_text_record(ndef_record_h record, char** buffer)
{
if (record == NULL || buffer == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_languange_code_string_from_text_record(ndef_record_h record, char** lang_code_str)
+API net_nfc_error_e net_nfc_get_languange_code_string_from_text_record(ndef_record_h record, char** lang_code_str)
{
if (record == NULL || lang_code_str == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_encoding_type_from_text_record(ndef_record_h record, net_nfc_encode_type_e * encoding)
+API net_nfc_error_e net_nfc_get_encoding_type_from_text_record(ndef_record_h record, net_nfc_encode_type_e * encoding)
{
if (record == NULL || encoding == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_uri_string_from_uri_record(ndef_record_h record, char **uri)
+API net_nfc_error_e net_nfc_create_uri_string_from_uri_record(ndef_record_h record, char **uri)
{
return net_nfc_util_create_uri_string_from_uri_record((ndef_record_s *)record, uri);
}
#include "net_nfc_client_manager.h"
#include "net_nfc_client_p2p.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
typedef struct _P2pFuncData P2pFuncData;
struct _P2pFuncData
static P2pSignalHandler *p2p_signal_handler = NULL;
static void p2p_device_detached(GObject *source_object,
- gpointer user_data);
+ gpointer user_data);
static void p2p_device_discovered(GObject *source_object,
- guint arg_handle,
- gpointer user_data);
+ guint arg_handle,
+ gpointer user_data);
static void p2p_device_data_received(GObject *source_object,
- GVariant *arg_data,
- gpointer user_data);
+ GVariant *arg_data,
+ gpointer user_data);
static void p2p_call_send(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void p2p_device_detached(GObject *source_object,
- gpointer user_data)
+ gpointer user_data)
{
INFO_MSG(">>> SIGNAL arrived");
}
static void p2p_device_discovered(GObject *source_object,
- guint arg_handle,
- gpointer user_data)
+ guint arg_handle,
+ gpointer user_data)
{
net_nfc_target_handle_s *handle_info = NULL;
}
static void p2p_device_data_received(GObject *source_object,
- GVariant *arg_data,
- gpointer user_data)
+ GVariant *arg_data,
+ gpointer user_data)
{
INFO_MSG(">>> SIGNAL arrived");
}
static void p2p_call_send(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
P2pFuncData *func_data;
net_nfc_client_p2p_send_completed callback;
if (net_nfc_gdbus_p2p_call_send_finish(
- NET_NFC_GDBUS_P2P(source_object),
- (gint *)&out_result,
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_P2P(source_object),
+ (gint *)&out_result,
+ res,
+ &error) == FALSE)
{
out_result = NET_NFC_UNKNOWN_ERROR;
}
callback = (net_nfc_client_p2p_send_completed)
- func_data->p2p_send_callback;
+ func_data->p2p_send_callback;
callback(out_result, func_data->p2p_send_data);
g_free(func_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_p2p_send(net_nfc_exchanger_data_h exchg_data,
- net_nfc_target_handle_h handle,
- net_nfc_client_p2p_send_completed callback,
- void *cb_data)
+API net_nfc_error_e net_nfc_client_p2p_send(net_nfc_exchanger_data_h exchg_data,
+ net_nfc_target_handle_h handle,
+ net_nfc_client_p2p_send_completed callback,
+ void *cb_data)
{
GVariant *arg_data = NULL;
arg_data = net_nfc_util_gdbus_data_to_variant(&exch_data->binary_data);
net_nfc_gdbus_p2p_call_send(p2p_proxy,
- exch_data->type,
- arg_data,
- GPOINTER_TO_UINT(handle),
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- p2p_call_send,
- func_data);
+ exch_data->type,
+ arg_data,
+ GPOINTER_TO_UINT(handle),
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ p2p_call_send,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_p2p_send_sync(
- net_nfc_exchanger_data_h exchg_data,
- net_nfc_target_handle_h handle)
+API net_nfc_error_e net_nfc_client_p2p_send_sync(
+ net_nfc_exchanger_data_h exchg_data,
+ net_nfc_target_handle_h handle)
{
GVariant *arg_data = NULL;
GError *error = NULL;
arg_data = net_nfc_util_gdbus_data_to_variant(&exch_data->binary_data);
if (net_nfc_gdbus_p2p_call_send_sync(p2p_proxy,
- exch_data->type,
- arg_data,
- GPOINTER_TO_UINT(handle),
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&out_result,
- NULL,
- &error) == FALSE)
+ exch_data->type,
+ arg_data,
+ GPOINTER_TO_UINT(handle),
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&out_result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("p2p send (sync call) failed: %s",
- error->message);
+ error->message);
g_error_free(error);
return NET_NFC_UNKNOWN_ERROR;
}
-NET_NFC_EXPORT_API
-void net_nfc_client_p2p_set_device_discovered(
- net_nfc_client_p2p_device_discovered callback,
- void *user_data)
+API void net_nfc_client_p2p_set_device_discovered(
+ net_nfc_client_p2p_device_discovered callback,
+ void *user_data)
{
if(p2p_signal_handler == NULL)
{
}
-NET_NFC_EXPORT_API
-void net_nfc_client_p2p_set_device_detached(
- net_nfc_client_p2p_device_detached callback,
- void *user_data)
+API void net_nfc_client_p2p_set_device_detached(
+ net_nfc_client_p2p_device_detached callback,
+ void *user_data)
{
if(p2p_signal_handler == NULL)
{
}
-NET_NFC_EXPORT_API
-void net_nfc_client_p2p_set_data_received(
- net_nfc_client_p2p_data_received callback,
- void *user_data)
+API void net_nfc_client_p2p_set_data_received(
+ net_nfc_client_p2p_data_received callback,
+ void *user_data)
{
if(p2p_signal_handler == NULL)
{
}
-NET_NFC_EXPORT_API
-void net_nfc_client_p2p_unset_device_discovered(void)
+API void net_nfc_client_p2p_unset_device_discovered(void)
{
if(p2p_signal_handler == NULL)
{
}
-NET_NFC_EXPORT_API
-void net_nfc_client_p2p_unset_device_detached(void)
+API void net_nfc_client_p2p_unset_device_detached(void)
{
if(p2p_signal_handler == NULL)
{
}
-NET_NFC_EXPORT_API
-void net_nfc_client_p2p_unset_data_received(void)
+API void net_nfc_client_p2p_unset_data_received(void)
{
if(p2p_signal_handler == NULL)
{
}
p2p_proxy = net_nfc_gdbus_p2p_proxy_new_for_bus_sync(
- G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.tizen.NetNfcService",
- "/org/tizen/NetNfcService/P2p",
- NULL,
- &error);
+ G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.tizen.NetNfcService",
+ "/org/tizen/NetNfcService/P2p",
+ NULL,
+ &error);
if (p2p_proxy == NULL)
{
DEBUG_ERR_MSG("Can not create proxy : %s", error->message);
#include "net_nfc_client_manager.h"
#include "net_nfc_client_se.h"
-
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
typedef struct _SeFuncData SeFuncData;
struct _SeFuncData
static SeESEDetectedHandler se_esedetecthandler;
static void se_ese_detected(GObject *source_object,
- guint arg_handle,
- gint arg_se_type,
- GVariant *arg_data);
+ guint arg_handle,
+ gint arg_se_type,
+ GVariant *arg_data);
static void se_type_changed(GObject *source_object,
- gint arg_se_type);
+ gint arg_se_type);
static void set_secure_element(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void open_secure_element(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void close_secure_element(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void send_apdu_secure_element(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void get_atr_secure_element(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void se_ese_detected(GObject *source_object,
- guint arg_handle,
- gint arg_se_type,
- GVariant *arg_data)
+ guint arg_handle,
+ gint arg_se_type,
+ GVariant *arg_data)
{
INFO_MSG(">>> SIGNAL arrived");
net_nfc_util_gdbus_variant_to_data_s(arg_data, &buffer_data);
callback((net_nfc_target_handle_h)arg_handle,
- arg_se_type, &buffer_data,
- se_esedetecthandler.se_ese_detected_data);
+ arg_se_type, &buffer_data,
+ se_esedetecthandler.se_ese_detected_data);
net_nfc_util_free_data(&buffer_data);
}
static void se_type_changed(GObject *source_object,
- gint arg_se_type)
+ gint arg_se_type)
{
INFO_MSG(">>> SIGNAL arrived");
(net_nfc_client_se_event)se_eventhandler.se_event_cb;
callback((net_nfc_message_e)arg_se_type,
- se_eventhandler.se_event_data);
+ se_eventhandler.se_event_data);
}
}
static void se_transaction_event(GObject *source_object,
- gint arg_se_type,
- GVariant *arg_aid,
- GVariant *arg_param)
+ gint arg_se_type,
+ GVariant *arg_aid,
+ GVariant *arg_param)
{
INFO_MSG(">>> SIGNAL arrived");
net_nfc_util_gdbus_variant_to_data_s(arg_param, ¶m);
callback(&aid, ¶m,
- se_transeventhandler.se_transaction_event_data);
+ se_transeventhandler.se_transaction_event_data);
net_nfc_util_free_data(¶m);
net_nfc_util_free_data(&aid);
static void set_secure_element(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
SeFuncData *func_data = (SeFuncData *)user_data;
net_nfc_error_e result;
g_assert(user_data != NULL);
if (net_nfc_gdbus_secure_element_call_set_finish(se_proxy,
- &result,
- res,
- &error) == FALSE)
+ &result,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_IPC_FAIL;
static void open_secure_element(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
SeFuncData *func_data = (SeFuncData *)user_data;
net_nfc_error_e result;
g_assert(user_data != NULL);
if (net_nfc_gdbus_secure_element_call_open_secure_element_finish(
- se_proxy,
- &result,
- &out_handle,
- res,
- &error) == FALSE)
+ se_proxy,
+ &result,
+ &out_handle,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_IPC_FAIL;
(net_nfc_se_open_se_cb)func_data->se_callback;
se_callback(result,
- (net_nfc_target_handle_h)out_handle,
- func_data->se_data);
+ (net_nfc_target_handle_h)out_handle,
+ func_data->se_data);
}
g_free(func_data);
static void close_secure_element(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
SeFuncData *func_data = (SeFuncData *)user_data;
net_nfc_error_e result;
g_assert(user_data != NULL);
if (net_nfc_gdbus_secure_element_call_close_secure_element_finish(
- se_proxy,
- &result,
- res,
- &error) == FALSE)
+ se_proxy,
+ &result,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_IPC_FAIL;
static void send_apdu_secure_element(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
SeFuncData *func_data = (SeFuncData *)user_data;
net_nfc_error_e result;
g_assert(user_data != NULL);
if (net_nfc_gdbus_secure_element_call_send_apdu_finish(
- se_proxy,
- &result,
- &out_response,
- res,
- &error) == FALSE)
+ se_proxy,
+ &result,
+ &out_response,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_IPC_FAIL;
static void get_atr_secure_element(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
SeFuncData *func_data = (SeFuncData *)user_data;
net_nfc_error_e result;
g_assert(user_data != NULL);
if (net_nfc_gdbus_secure_element_call_get_atr_finish(
- se_proxy,
- &result,
- &out_atr,
- res,
- &error) == FALSE)
+ se_proxy,
+ &result,
+ &out_atr,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_IPC_FAIL;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_se_set_secure_element_type(
- net_nfc_se_type_e se_type,
- net_nfc_se_set_se_cb callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_se_set_secure_element_type(
+ net_nfc_se_type_e se_type,
+ net_nfc_se_set_se_cb callback,
+ void *user_data)
{
SeFuncData *func_data;
func_data->se_data = user_data;
net_nfc_gdbus_secure_element_call_set(
- se_proxy,
- (gint)se_type,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- set_secure_element,
- func_data);
+ se_proxy,
+ (gint)se_type,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ set_secure_element,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_se_set_secure_element_type_sync(
- net_nfc_se_type_e se_type)
+API net_nfc_error_e net_nfc_client_se_set_secure_element_type_sync(
+ net_nfc_se_type_e se_type)
{
net_nfc_error_e result;
GError *error = NULL;
}
if (net_nfc_gdbus_secure_element_call_set_sync(
- se_proxy,
- (gint)se_type,
- net_nfc_client_gdbus_get_privilege(),
- &result,
- NULL,
- &error) == FALSE)
+ se_proxy,
+ (gint)se_type,
+ net_nfc_client_gdbus_get_privilege(),
+ &result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("Set secure element failed: %s", error->message);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_se_open_internal_secure_element(
- net_nfc_se_type_e se_type,
- net_nfc_se_open_se_cb callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_se_open_internal_secure_element(
+ net_nfc_se_type_e se_type,
+ net_nfc_se_open_se_cb callback,
+ void *user_data)
{
SeFuncData *func_data;
func_data->se_data = user_data;
net_nfc_gdbus_secure_element_call_open_secure_element(
- se_proxy,
- (gint)se_type,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- open_secure_element,
- user_data);
+ se_proxy,
+ (gint)se_type,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ open_secure_element,
+ user_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_se_open_internal_secure_element_sync(
- net_nfc_se_type_e se_type,
- net_nfc_target_handle_h *handle)
+API net_nfc_error_e net_nfc_client_se_open_internal_secure_element_sync(
+ net_nfc_se_type_e se_type,
+ net_nfc_target_handle_h *handle)
{
net_nfc_error_e result;
guint out_handle;
/* allow this function even nfc is off */
if (net_nfc_gdbus_secure_element_call_open_secure_element_sync(
- se_proxy,
- se_type,
- net_nfc_client_gdbus_get_privilege(),
- &result,
- &out_handle,
- NULL,
- &error) == true) {
+ se_proxy,
+ se_type,
+ net_nfc_client_gdbus_get_privilege(),
+ &result,
+ &out_handle,
+ NULL,
+ &error) == true) {
*handle = GUINT_TO_POINTER(out_handle);
} else {
DEBUG_ERR_MSG("Open internal secure element failed: %s",
- error->message);
+ error->message);
g_error_free(error);
result = NET_NFC_IPC_FAIL;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_se_close_internal_secure_element(
- net_nfc_target_handle_h handle,
- net_nfc_se_close_se_cb callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_se_close_internal_secure_element(
+ net_nfc_target_handle_h handle,
+ net_nfc_se_close_se_cb callback,
+ void *user_data)
{
SeFuncData *func_data;
func_data->se_data = user_data;
net_nfc_gdbus_secure_element_call_close_secure_element(
- se_proxy,
- GPOINTER_TO_UINT(handle),
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- close_secure_element,
- user_data);
+ se_proxy,
+ GPOINTER_TO_UINT(handle),
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ close_secure_element,
+ user_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_se_close_internal_secure_element_sync(
- net_nfc_target_handle_h handle)
+API net_nfc_error_e net_nfc_client_se_close_internal_secure_element_sync(
+ net_nfc_target_handle_h handle)
{
net_nfc_error_e result;
GError *error = NULL;
&error) == FALSE)
{
DEBUG_ERR_MSG("close internal secure element failed: %s",
- error->message);
+ error->message);
g_error_free(error);
result = NET_NFC_IPC_FAIL;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_se_get_atr(
- net_nfc_target_handle_h handle,
- net_nfc_se_get_atr_cb callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_se_get_atr(
+ net_nfc_target_handle_h handle,
+ net_nfc_se_get_atr_cb callback,
+ void *user_data)
{
SeFuncData *func_data;
func_data->se_data = user_data;
net_nfc_gdbus_secure_element_call_get_atr(
- se_proxy,
- GPOINTER_TO_UINT(handle),
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- get_atr_secure_element,
- func_data);
+ se_proxy,
+ GPOINTER_TO_UINT(handle),
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ get_atr_secure_element,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_se_get_atr_sync(
- net_nfc_target_handle_h handle,
- data_h *atr)
+API net_nfc_error_e net_nfc_client_se_get_atr_sync(
+ net_nfc_target_handle_h handle,
+ data_h *atr)
{
net_nfc_error_e result;
GVariant *out_atr;
/* allow this function even nfc is off */
if (net_nfc_gdbus_secure_element_call_get_atr_sync(
- se_proxy,
- GPOINTER_TO_UINT(handle),
- net_nfc_client_gdbus_get_privilege(),
- &result,
- &out_atr,
- NULL,
- &error) == true) {
+ se_proxy,
+ GPOINTER_TO_UINT(handle),
+ net_nfc_client_gdbus_get_privilege(),
+ &result,
+ &out_atr,
+ NULL,
+ &error) == true) {
*atr = net_nfc_util_gdbus_variant_to_data(out_atr);
} else {
DEBUG_ERR_MSG("Get attributes failed: %s", error->message);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_se_send_apdu(
- net_nfc_target_handle_h handle,
- data_h apdu_data,
- net_nfc_se_send_apdu_cb callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_se_send_apdu(
+ net_nfc_target_handle_h handle,
+ data_h apdu_data,
+ net_nfc_se_send_apdu_cb callback,
+ void *user_data)
{
SeFuncData *func_data;
GVariant *arg_data;
func_data->se_data = user_data;
net_nfc_gdbus_secure_element_call_send_apdu(
- se_proxy,
- GPOINTER_TO_UINT(handle),
- arg_data,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- send_apdu_secure_element,
- func_data);
+ se_proxy,
+ GPOINTER_TO_UINT(handle),
+ arg_data,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ send_apdu_secure_element,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_se_send_apdu_sync(
- net_nfc_target_handle_h handle,
- data_h apdu_data,
- data_h *response)
+API net_nfc_error_e net_nfc_client_se_send_apdu_sync(
+ net_nfc_target_handle_h handle,
+ data_h apdu_data,
+ data_h *response)
{
net_nfc_error_e result;
GVariant *out_data;
return NET_NFC_INVALID_PARAM;
if (net_nfc_gdbus_secure_element_call_send_apdu_sync(
- se_proxy,
- GPOINTER_TO_UINT(handle),
- arg_data,
- net_nfc_client_gdbus_get_privilege(),
- &result,
- &out_data,
- NULL,
- &error) == true) {
+ se_proxy,
+ GPOINTER_TO_UINT(handle),
+ arg_data,
+ net_nfc_client_gdbus_get_privilege(),
+ &result,
+ &out_data,
+ NULL,
+ &error) == true) {
*response = net_nfc_util_gdbus_variant_to_data(out_data);
} else {
DEBUG_ERR_MSG("Send APDU failed: %s",
- error->message);
+ error->message);
g_error_free(error);
result = NET_NFC_IPC_FAIL;
}
-NET_NFC_EXPORT_API
-void net_nfc_client_se_set_ese_detection_cb(
- net_nfc_client_se_ese_detected_event callback,
- void *user_data)
+API void net_nfc_client_se_set_ese_detection_cb(
+ net_nfc_client_se_ese_detected_event callback,
+ void *user_data)
{
se_esedetecthandler.se_ese_detected_cb = callback;
se_esedetecthandler.se_ese_detected_data = user_data;
}
-NET_NFC_EXPORT_API
-void net_nfc_client_se_unset_ese_detection_cb(void)
+API void net_nfc_client_se_unset_ese_detection_cb(void)
{
net_nfc_client_se_set_ese_detection_cb(NULL, NULL);
}
-NET_NFC_EXPORT_API
-void net_nfc_client_se_set_transaction_event_cb(
- net_nfc_client_se_transaction_event callback,
- void *user_data)
+API void net_nfc_client_se_set_transaction_event_cb(
+ net_nfc_client_se_transaction_event callback,
+ void *user_data)
{
se_transeventhandler.se_transaction_event_cb = callback;
se_transeventhandler.se_transaction_event_data = user_data;
}
-NET_NFC_EXPORT_API
-void net_nfc_client_se_unset_transaction_event_cb(void)
+API void net_nfc_client_se_unset_transaction_event_cb(void)
{
net_nfc_client_se_set_transaction_event_cb(NULL, NULL);
}
-NET_NFC_EXPORT_API
-void net_nfc_client_se_set_event_cb(net_nfc_client_se_event callback,
- void *user_data)
+API void net_nfc_client_se_set_event_cb(net_nfc_client_se_event callback,
+ void *user_data)
{
se_eventhandler.se_event_cb = callback;
se_eventhandler.se_event_data = user_data;
}
-NET_NFC_EXPORT_API
-void net_nfc_client_se_unset_event_cb(void)
+API void net_nfc_client_se_unset_event_cb(void)
{
net_nfc_client_se_set_event_cb(NULL, NULL);
}
}
se_proxy = net_nfc_gdbus_secure_element_proxy_new_for_bus_sync(
- G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.tizen.NetNfcService",
- "/org/tizen/NetNfcService/SecureElement",
- NULL,
- &error);
+ G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.tizen.NetNfcService",
+ "/org/tizen/NetNfcService/SecureElement",
+ NULL,
+ &error);
if (se_proxy == NULL)
{
DEBUG_ERR_MSG("Can not create proxy : %s", error->message);
}
g_signal_connect(se_proxy, "se-type-changed",
- G_CALLBACK(se_type_changed), NULL);
+ G_CALLBACK(se_type_changed), NULL);
g_signal_connect(se_proxy, "ese-detected",
- G_CALLBACK(se_ese_detected), NULL);
+ G_CALLBACK(se_ese_detected), NULL);
g_signal_connect(se_proxy, "transaction-event",
- G_CALLBACK(se_transaction_event), NULL);
+ G_CALLBACK(se_transaction_event), NULL);
return NET_NFC_OK;
}
--- /dev/null
+/*
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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 "net_nfc_debug_internal.h"
+#include "net_nfc_util_sign_record.h"
+
+API net_nfc_error_e net_nfc_sign_records(ndef_message_h msg, int begin_index, int end_index, char *cert_file, char *password)
+{
+ return net_nfc_util_sign_records((ndef_message_s *)msg, begin_index, end_index, cert_file, password);
+}
+
+API net_nfc_error_e net_nfc_sign_ndef_message(ndef_message_h msg, char *cert_file, char *password)
+{
+ return net_nfc_util_sign_ndef_message((ndef_message_s *)msg, cert_file, password);
+}
+
+API net_nfc_error_e net_nfc_verify_signature_ndef_message(ndef_message_h msg)
+{
+ return net_nfc_util_verify_signature_ndef_message((ndef_message_s *)msg);
+}
+
+API net_nfc_error_e net_nfc_verify_signature_records(ndef_record_h begin_record, ndef_record_h sign_record)
+{
+ return net_nfc_util_verify_signature_records((ndef_record_s *)begin_record, (ndef_record_s *)sign_record);
+}
#include "net_nfc_client_manager.h"
#include "net_nfc_client_snep.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
static NetNfcGDbusSnep *snep_proxy = NULL;
/*******************************************************************/
/*********************************************************************/
static void snep_send_client_request(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
/*********************************************************************/
GVariant *variant = NULL;
if (net_nfc_create_rawdata_from_ndef_message(message,
- &data) != NET_NFC_OK)
+ &data) != NET_NFC_OK)
{
DEBUG_ERR_MSG("can not convert ndef_message to rawdata");
return NULL;
if (data.buffer && data.length > 0)
{
if (net_nfc_create_ndef_message_from_rawdata(&message, &data)
- != NET_NFC_OK)
+ != NET_NFC_OK)
{
DEBUG_ERR_MSG("memory alloc fail...");
}
}
static void snep_send_client_request(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
GVariant *parameter = (GVariant *)user_data;
GError *error = NULL;
GVariant *out_data;
if (net_nfc_gdbus_snep_call_client_request_finish(
- NET_NFC_GDBUS_SNEP(source_object),
- (gint *)&out_result,
- (guint *)&out_type,
- &out_data,
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_SNEP(source_object),
+ (gint *)&out_result,
+ (guint *)&out_type,
+ &out_data,
+ res,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("Can not finish send client request %s",
- error->message);
+ error->message);
g_error_free(error);
out_result = NET_NFC_UNKNOWN_ERROR;
ndef_message_h message = NULL;
g_variant_get(parameter, "(uuu)",
- (guint *)&callback,
- (guint *)&user_param,
- (guint *)&handle);
+ (guint *)&callback,
+ (guint *)&user_param,
+ (guint *)&handle);
if (callback != NULL) {
message = snep_variant_to_message(out_data);
callback(handle, out_type, out_result,
- message, user_param);
+ message, user_param);
}
g_object_unref(parameter);
}
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_snep_start_server(
- net_nfc_target_handle_h target,
- const char *san,
- sap_t sap,
- net_nfc_client_snep_event_cb callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_snep_start_server(
+ net_nfc_target_handle_h target,
+ const char *san,
+ sap_t sap,
+ net_nfc_client_snep_event_cb callback,
+ void *user_data)
{
net_nfc_error_e result = NET_NFC_OK;
GError *error = NULL;
}
parameter = g_variant_new("(uu)",
- GPOINTER_TO_UINT(callback),
- GPOINTER_TO_UINT(user_data));
+ GPOINTER_TO_UINT(callback),
+ GPOINTER_TO_UINT(user_data));
g_object_ref(parameter);
if (net_nfc_gdbus_snep_call_server_start_sync(snep_proxy,
- GPOINTER_TO_UINT(target),
- sap,
- san,
- GPOINTER_TO_UINT(parameter),
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&result,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(target),
+ sap,
+ san,
+ GPOINTER_TO_UINT(parameter),
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("snep server(sync call) failed: %s",
- error->message);
+ error->message);
g_error_free(error);
g_object_unref(parameter);
return result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_snep_start_client(
- net_nfc_target_handle_h target,
- const char *san,
- sap_t sap,
- net_nfc_client_snep_event_cb callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_snep_start_client(
+ net_nfc_target_handle_h target,
+ const char *san,
+ sap_t sap,
+ net_nfc_client_snep_event_cb callback,
+ void *user_data)
{
net_nfc_error_e result = NET_NFC_OK;
GError *error = NULL;
}
parameter = g_variant_new("(uu)",
- GPOINTER_TO_UINT(callback),
- GPOINTER_TO_UINT(user_data));
+ GPOINTER_TO_UINT(callback),
+ GPOINTER_TO_UINT(user_data));
g_object_ref(parameter);
if (net_nfc_gdbus_snep_call_client_start_sync(snep_proxy,
- GPOINTER_TO_UINT(target),
- sap,
- san,
- GPOINTER_TO_UINT(parameter),
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&result,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(target),
+ sap,
+ san,
+ GPOINTER_TO_UINT(parameter),
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("snep client(sync call) failed: %s",
- error->message);
+ error->message);
g_error_free(error);
g_object_unref(parameter);
return result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_snep_send_client_request(
- net_nfc_snep_handle_h target,
- net_nfc_snep_type_t snep_type,
- ndef_message_h msg,
- net_nfc_client_snep_event_cb callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_snep_send_client_request(
+ net_nfc_snep_handle_h target,
+ net_nfc_snep_type_t snep_type,
+ ndef_message_h msg,
+ net_nfc_client_snep_event_cb callback,
+ void *user_data)
{
GVariant *ndef_msg = NULL;
GVariant *parameter;
}
parameter = g_variant_new("(uuu)",
- GPOINTER_TO_UINT(callback),
- GPOINTER_TO_UINT(user_data),
- GPOINTER_TO_UINT(target));
+ GPOINTER_TO_UINT(callback),
+ GPOINTER_TO_UINT(user_data),
+ GPOINTER_TO_UINT(target));
g_object_ref(parameter);
ndef_msg = snep_message_to_variant(msg);
net_nfc_gdbus_snep_call_client_request(snep_proxy,
- GPOINTER_TO_UINT(target),
- snep_type,
- ndef_msg,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- snep_send_client_request,
- parameter);
+ GPOINTER_TO_UINT(target),
+ snep_type,
+ ndef_msg,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ snep_send_client_request,
+ parameter);
return NET_NFC_OK;
}
#if 0
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_snep_send_client_request_sync(
- net_nfc_target_handle_h target,
- net_nfc_snep_type_t snep_type,
- ndef_message_h msg,
- net_nfc_snep_type_t *resp_type,
- ndef_message_h *response)
+API net_nfc_error_e net_nfc_client_snep_send_client_request_sync(
+ net_nfc_target_handle_h target,
+ net_nfc_snep_type_t snep_type,
+ ndef_message_h msg,
+ net_nfc_snep_type_t *resp_type,
+ ndef_message_h *response)
{
GVariant *resp_msg = NULL;
GVariant *arg_msg = NULL;
arg_msg = snep_message_to_variant(msg);
if (net_nfc_gdbus_snep_call_client_request_sync(snep_proxy,
- GPOINTER_TO_UINT(target),
- snep_type,
- arg_msg,
- net_nfc_client_gdbus_get_privilege(),
- &result,
- resp_type,
- &resp_msg,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(target),
+ snep_type,
+ arg_msg,
+ net_nfc_client_gdbus_get_privilege(),
+ &result,
+ resp_type,
+ &resp_msg,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG(" send client request (sync call) failed: %s",
- error->message);
+ error->message);
g_error_free(error);
return NET_NFC_IPC_FAIL;
if (ndef_data.buffer != NULL && ndef_data.length > 0)
{
result = net_nfc_create_ndef_message_from_rawdata(
- response,
- &ndef_data);
+ response,
+ &ndef_data);
net_nfc_util_free_data(&ndef_data);
}
return result;
}
#endif
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_snep_stop_service_sync(
- net_nfc_target_handle_h target,
- net_nfc_snep_handle_h service)
+API net_nfc_error_e net_nfc_client_snep_stop_service_sync(
+ net_nfc_target_handle_h target,
+ net_nfc_snep_handle_h service)
{
net_nfc_error_e result = NET_NFC_OK;
GError *error = NULL;
}
if (net_nfc_gdbus_snep_call_stop_snep_sync(
- snep_proxy,
- GPOINTER_TO_UINT(target),
- GPOINTER_TO_UINT(service),
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&result,
- NULL,
- &error) == FALSE)
+ snep_proxy,
+ GPOINTER_TO_UINT(target),
+ GPOINTER_TO_UINT(service),
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("snep stop service(sync call) failed: %s",
- error->message);
+ error->message);
g_error_free(error);
return NET_NFC_IPC_FAIL;
}
static void _snep_event_cb(NetNfcGDbusSnep *object,
- guint arg_handle,
- guint arg_event,
- gint arg_result,
- GVariant *arg_ndef_msg,
- guint arg_user_data)
+ guint arg_handle,
+ guint arg_event,
+ gint arg_result,
+ GVariant *arg_ndef_msg,
+ guint arg_user_data)
{
GVariant *parameter = (GVariant *)GUINT_TO_POINTER(arg_user_data);
INFO_MSG(">>> SIGNAL arrived");
DEBUG_CLIENT_MSG("handle [%p], event [%d], result [%d], user_data [%p]",
- GUINT_TO_POINTER(arg_handle),
- arg_event,
- arg_result,
- parameter);
+ GUINT_TO_POINTER(arg_handle),
+ arg_event,
+ arg_result,
+ parameter);
if (parameter != NULL)
{
void *user_data;
g_variant_get(parameter,
- "(uu)",
- &callback,
- &user_data);
+ "(uu)",
+ &callback,
+ &user_data);
if (callback != NULL)
{
snep_variant_to_message(arg_ndef_msg);
callback(GUINT_TO_POINTER(arg_handle),
- arg_event,
- arg_result,
- message,
- user_data);
+ arg_event,
+ arg_result,
+ message,
+ user_data);
}
if (arg_event == NET_NFC_LLCP_UNREGISTERED) {
}
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_snep_register_server(const char *san,
- sap_t sap,
- net_nfc_client_snep_event_cb callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_snep_register_server(const char *san,
+ sap_t sap,
+ net_nfc_client_snep_event_cb callback,
+ void *user_data)
{
net_nfc_error_e result = NET_NFC_OK;
GError *error = NULL;
}
parameter = g_variant_new("(uu)",
- GPOINTER_TO_UINT(callback),
- GPOINTER_TO_UINT(user_data));
+ GPOINTER_TO_UINT(callback),
+ GPOINTER_TO_UINT(user_data));
if (net_nfc_gdbus_snep_call_server_register_sync(snep_proxy,
- sap,
- san,
- GPOINTER_TO_UINT(parameter),
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&result,
- NULL,
- &error) == FALSE)
+ sap,
+ san,
+ GPOINTER_TO_UINT(parameter),
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("snep register server(sync call) failed: %s",
- error->message);
+ error->message);
g_error_free(error);
g_variant_unref(parameter);
return result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_snep_unregister_server(const char *san,
- sap_t sap)
+API net_nfc_error_e net_nfc_client_snep_unregister_server(const char *san,
+ sap_t sap)
{
net_nfc_error_e result = NET_NFC_OK;
GError *error = NULL;
}
if (net_nfc_gdbus_snep_call_server_unregister_sync(snep_proxy,
- sap,
- san,
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&result,
- NULL,
- &error) == FALSE)
+ sap,
+ san,
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("snep unregister server(sync call) failed: %s",
- error->message);
+ error->message);
g_error_free(error);
result = NET_NFC_UNKNOWN_ERROR;
}
snep_proxy = net_nfc_gdbus_snep_proxy_new_for_bus_sync(
- G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.tizen.NetNfcService",
- "/org/tizen/NetNfcService/Snep",
- NULL,
- &error);
+ G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.tizen.NetNfcService",
+ "/org/tizen/NetNfcService/Snep",
+ NULL,
+ &error);
if (snep_proxy == NULL)
{
DEBUG_ERR_MSG("Can not create proxy : %s", error->message);
#include "net_nfc_client_manager.h"
#include "net_nfc_client_system_handler.h"
-
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
typedef struct _PopupFuncData PopupFuncData;
struct _PopupFuncData
static int popup_state = 0;
static void popup_set_active_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void popup_set_active_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
PopupFuncData *func_data;
gpointer data;
if (net_nfc_gdbus_popup_call_set_finish(
- NET_NFC_GDBUS_POPUP(source_object),
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_POPUP(source_object),
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
DEBUG_ERR_MSG("Can not finish popup_set_active: %s",
- error->message);
+ error->message);
g_error_free(error);
}
g_free(func_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_sys_handler_set_state(int state,
- net_nfc_client_popup_set_state_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_sys_handler_set_state(int state,
+ net_nfc_client_popup_set_state_callback callback,
+ void *user_data)
{
gboolean active = FALSE;
PopupFuncData *func_data;
active = TRUE;
net_nfc_gdbus_popup_call_set(popup_proxy,
- active,
- focus_state,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- popup_set_active_callback,
- func_data);
+ active,
+ focus_state,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ popup_set_active_callback,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_sys_handler_set_state_sync(int state)
+API net_nfc_error_e net_nfc_client_sys_handler_set_state_sync(int state)
{
GError *error = NULL;
net_nfc_launch_popup_check_e focus_state = CHECK_FOREGROUND;
}
if (net_nfc_gdbus_popup_call_set_sync(popup_proxy,
- (gboolean)state,
- focus_state,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- &error) == FALSE)
+ (gboolean)state,
+ focus_state,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ &error) == FALSE)
{
DEBUG_CLIENT_MSG("can not call SetActive: %s",
- error->message);
+ error->message);
g_error_free(error);
return NET_NFC_IPC_FAIL;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_sys_handler_set_state_force(int state,
- net_nfc_client_popup_set_state_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_sys_handler_set_state_force(int state,
+ net_nfc_client_popup_set_state_callback callback,
+ void *user_data)
{
gboolean active = FALSE;
PopupFuncData *func_data;
active = TRUE;
net_nfc_gdbus_popup_call_set(popup_proxy,
- active,
- focus_state,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- popup_set_active_callback,
- func_data);
+ active,
+ focus_state,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ popup_set_active_callback,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_sys_handler_set_state_force_sync(int state)
+API net_nfc_error_e net_nfc_client_sys_handler_set_state_force_sync(int state)
{
GError *error = NULL;
net_nfc_launch_popup_check_e focus_state = NO_CHECK_FOREGROUND;
}
if (net_nfc_gdbus_popup_call_set_sync(popup_proxy,
- (gboolean)state,
- focus_state,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- &error) == FALSE)
+ (gboolean)state,
+ focus_state,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ &error) == FALSE)
{
DEBUG_CLIENT_MSG("can not call SetActive: %s",
- error->message);
+ error->message);
g_error_free(error);
return NET_NFC_IPC_FAIL;
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_sys_handler_set_launch_popup_state(
- int enable)
+API net_nfc_error_e net_nfc_client_sys_handler_set_launch_popup_state(
+ int enable)
{
net_nfc_error_e ret;
if (enable)
{
ret = net_nfc_client_sys_handler_set_state_sync(
- NET_NFC_LAUNCH_APP_SELECT);
+ NET_NFC_LAUNCH_APP_SELECT);
}
else
{
ret = net_nfc_client_sys_handler_set_state_sync(
- NET_NFC_NO_LAUNCH_APP_SELECT);
+ NET_NFC_NO_LAUNCH_APP_SELECT);
}
return ret;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_sys_handler_set_launch_popup_state_force(
- int enable)
+API net_nfc_error_e net_nfc_client_sys_handler_set_launch_popup_state_force(
+ int enable)
{
net_nfc_error_e ret;
if (enable)
{
ret = net_nfc_client_sys_handler_set_state_force_sync(
- NET_NFC_LAUNCH_APP_SELECT);
+ NET_NFC_LAUNCH_APP_SELECT);
}
else
{
ret = net_nfc_client_sys_handler_set_state_force_sync(
- NET_NFC_NO_LAUNCH_APP_SELECT);
+ NET_NFC_NO_LAUNCH_APP_SELECT);
}
return ret;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_sys_handler_get_launch_popup_state(
- int *state)
+API net_nfc_error_e net_nfc_client_sys_handler_get_launch_popup_state(
+ int *state)
{
if (state == NULL)
return NET_NFC_NULL_PARAMETER;
}
if (net_nfc_gdbus_popup_call_get_sync(popup_proxy,
- net_nfc_client_gdbus_get_privilege(),
- state,
- NULL,
- &error) == false) {
+ net_nfc_client_gdbus_get_privilege(),
+ state,
+ NULL,
+ &error) == false) {
DEBUG_CLIENT_MSG("net_nfc_gdbus_popup_call_get_sync failed: %s",
error->message);
g_error_free(error);
}
popup_proxy = net_nfc_gdbus_popup_proxy_new_for_bus_sync(
- G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.tizen.NetNfcService",
- "/org/tizen/NetNfcService/Popup",
- NULL,
- &error);
+ G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.tizen.NetNfcService",
+ "/org/tizen/NetNfcService/Popup",
+ NULL,
+ &error);
if (popup_proxy == NULL)
{
DEBUG_ERR_MSG("Can not create proxy : %s", error->message);
#include "net_nfc_client_tag.h"
#include "net_nfc_client_tag_internal.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
typedef struct _TagFuncData TagFuncData;
struct _TagFuncData
static gboolean tag_check_filter(net_nfc_target_type_e type);
static void tag_get_info_list(guint8 *buffer,
- gint number_of_keys,
- net_nfc_tag_info_s **list);
+ gint number_of_keys,
+ net_nfc_tag_info_s **list);
static void tag_get_target_info(guint handle,
- guint dev_type,
- gboolean is_ndef_supported,
- guchar ndef_card_state,
- guint max_data_size,
- guint actual_data_size,
- guint number_of_keys,
- GVariant *target_info_values,
- GVariant *raw_data,
- net_nfc_target_info_s **info);
+ guint dev_type,
+ gboolean is_ndef_supported,
+ guchar ndef_card_state,
+ guint max_data_size,
+ guint actual_data_size,
+ guint number_of_keys,
+ GVariant *target_info_values,
+ GVariant *raw_data,
+ net_nfc_target_info_s **info);
/* async callback */
static void tag_is_tag_connected(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void tag_get_current_tag_info(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void tag_get_current_target_handle(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
/* signal callback */
static void tag_tag_discovered(NetNfcGDbusTag *object,
- guint arg_handle,
- gint arg_dev_type,
- gboolean arg_is_ndef_supported,
- guchar arg_ndef_card_state,
- guint arg_max_data_size,
- guint arg_actual_data_size,
- guint arg_number_of_keys,
- GVariant *arg_target_info_values,
- GVariant *arg_raw_data,
- gpointer user_data);
+ guint arg_handle,
+ gint arg_dev_type,
+ gboolean arg_is_ndef_supported,
+ guchar arg_ndef_card_state,
+ guint arg_max_data_size,
+ guint arg_actual_data_size,
+ guint arg_number_of_keys,
+ GVariant *arg_target_info_values,
+ GVariant *arg_raw_data,
+ gpointer user_data);
static void tag_tag_detached(NetNfcGDbusTag *object,
- guint arg_handle,
- gint arg_dev_type,
- gpointer user_data);
+ guint arg_handle,
+ gint arg_dev_type,
+ gpointer user_data);
static gboolean tag_check_filter(net_nfc_target_type_e type)
{
DEBUG_CLIENT_MSG("client filter = %d", client_filter);
if (type >= NET_NFC_ISO14443_A_PICC &&
- type <= NET_NFC_MIFARE_DESFIRE_PICC)
+ type <= NET_NFC_MIFARE_DESFIRE_PICC)
{
converted = NET_NFC_ISO14443A_ENABLE;
}
else if (type >= NET_NFC_ISO14443_B_PICC &&
- type <= NET_NFC_ISO14443_BPRIME_PICC)
+ type <= NET_NFC_ISO14443_BPRIME_PICC)
{
converted = NET_NFC_ISO14443B_ENABLE;
}
}
static void tag_get_info_list(guint8 *buffer,
- gint number_of_keys,
- net_nfc_tag_info_s **list)
+ gint number_of_keys,
+ net_nfc_tag_info_s **list)
{
net_nfc_tag_info_s *tmp_list = NULL;
net_nfc_tag_info_s *current = NULL;
}
static void tag_get_target_info(guint handle,
- guint dev_type,
- gboolean is_ndef_supported,
- guchar ndef_card_state,
- guint max_data_size,
- guint actual_data_size,
- guint number_of_keys,
- GVariant *target_info_values,
- GVariant *raw_data,
- net_nfc_target_info_s **info)
+ guint dev_type,
+ gboolean is_ndef_supported,
+ guchar ndef_card_state,
+ guint max_data_size,
+ guint actual_data_size,
+ guint number_of_keys,
+ GVariant *target_info_values,
+ GVariant *raw_data,
+ net_nfc_target_info_s **info)
{
guint8 *buffer = NULL;
net_nfc_target_info_s *info_data = NULL;
}
static void tag_is_tag_connected(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
TagFuncData *func_data;
result = NET_NFC_NOT_CONNECTED;
callback = (net_nfc_client_tag_is_tag_connected_completed)
- func_data->callback;
+ func_data->callback;
callback(result, out_dev_type, func_data->user_data);
g_free(func_data);
}
static void tag_get_current_tag_info(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
TagFuncData *func_data;
net_nfc_target_info_s *info_s = NULL;
if (net_nfc_gdbus_tag_call_get_current_tag_info_finish (
- NET_NFC_GDBUS_TAG(source_object),
- &out_is_connected,
- &out_handle,
- (gint *)&out_dev_type,
- &out_is_ndef_supported,
- &out_ndef_card_state,
- &out_max_data_size,
- &out_actual_data_size,
- &out_number_of_keys,
- &out_target_info_values,
- &out_raw_data,
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_TAG(source_object),
+ &out_is_connected,
+ &out_handle,
+ (gint *)&out_dev_type,
+ &out_is_ndef_supported,
+ &out_ndef_card_state,
+ &out_max_data_size,
+ &out_actual_data_size,
+ &out_number_of_keys,
+ &out_target_info_values,
+ &out_raw_data,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
result = NET_NFC_NOT_CONNECTED;
callback = (net_nfc_client_tag_get_current_tag_info_completed)
- func_data->callback;
+ func_data->callback;
if (result != NET_NFC_OK)
{
}
static void tag_get_current_target_handle(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
TagFuncData *func_data;
net_nfc_client_tag_get_current_target_handle_completed callback;
if (net_nfc_gdbus_tag_call_get_current_target_handle_finish(
- NET_NFC_GDBUS_TAG(source_object),
- &out_is_connected,
- &out_handle,
- (gint *)&out_dev_type,
- res,
- &error) == FALSE)
+ NET_NFC_GDBUS_TAG(source_object),
+ &out_is_connected,
+ &out_handle,
+ (gint *)&out_dev_type,
+ res,
+ &error) == FALSE)
{
result = NET_NFC_UNKNOWN_ERROR;
}
callback = (net_nfc_client_tag_get_current_target_handle_completed)
- func_data->callback;
+ func_data->callback;
if (out_is_connected == FALSE)
result = NET_NFC_NOT_CONNECTED;
}
static void tag_tag_discovered(NetNfcGDbusTag *object,
- guint arg_handle,
- gint arg_dev_type,
- gboolean arg_is_ndef_supported,
- guchar arg_ndef_card_state,
- guint arg_max_data_size,
- guint arg_actual_data_size,
- guint arg_number_of_keys,
- GVariant *arg_target_info_values,
- GVariant *arg_raw_data,
- gpointer user_data)
+ guint arg_handle,
+ gint arg_dev_type,
+ gboolean arg_is_ndef_supported,
+ guchar arg_ndef_card_state,
+ guint arg_max_data_size,
+ guint arg_actual_data_size,
+ guint arg_number_of_keys,
+ GVariant *arg_target_info_values,
+ GVariant *arg_raw_data,
+ gpointer user_data)
{
/*FIXME: currently SAVE_TARGET_INFO_IN_CC support only */
net_nfc_target_info_s *info_s = NULL;
client_target_info = info_s;
callback = (net_nfc_client_tag_tag_discovered)
- tag_discovered_func_data->callback;
+ tag_discovered_func_data->callback;
callback(info_s, tag_discovered_func_data->user_data);
}
static void tag_tag_detached(NetNfcGDbusTag *object,
- guint arg_handle,
- gint arg_dev_type,
- gpointer user_data)
+ guint arg_handle,
+ gint arg_dev_type,
+ gpointer user_data)
{
net_nfc_client_tag_tag_detached callback;
client_target_info = NULL;
callback = (net_nfc_client_tag_tag_detached)
- tag_detached_func_data->callback;
+ tag_detached_func_data->callback;
callback(tag_detached_func_data->user_data);
}
return client_target_info;
}
-/* public APIs */
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_tag_is_tag_connected(
- net_nfc_client_tag_is_tag_connected_completed callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_tag_is_tag_connected(
+ net_nfc_client_tag_is_tag_connected_completed callback,
+ void *user_data)
{
TagFuncData *func_data;
func_data->user_data = user_data;
net_nfc_gdbus_tag_call_is_tag_connected(tag_proxy,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- tag_is_tag_connected,
- func_data);
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ tag_is_tag_connected,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_tag_is_tag_connected_sync(
- net_nfc_target_type_e *dev_type)
+API net_nfc_error_e net_nfc_client_tag_is_tag_connected_sync(
+ net_nfc_target_type_e *dev_type)
{
net_nfc_target_type_e out_dev_type;
}
if (net_nfc_gdbus_tag_call_is_tag_connected_sync(tag_proxy,
- net_nfc_client_gdbus_get_privilege(),
- &out_is_connected,
- (gint *)&out_dev_type,
- NULL,
- &error) == FALSE)
+ net_nfc_client_gdbus_get_privilege(),
+ &out_is_connected,
+ (gint *)&out_dev_type,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("Can not get is_tag_connected result: %s",
error->message);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_tag_get_current_tag_info(
+API net_nfc_error_e net_nfc_client_tag_get_current_tag_info(
net_nfc_client_tag_get_current_tag_info_completed callback,
void *user_data)
{
net_nfc_gdbus_tag_call_get_current_tag_info(tag_proxy,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- tag_get_current_tag_info,
- func_data);
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ tag_get_current_tag_info,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_tag_get_current_tag_info_sync(
- net_nfc_target_info_h *info)
+API net_nfc_error_e net_nfc_client_tag_get_current_tag_info_sync(
+ net_nfc_target_info_h *info)
{
net_nfc_target_type_e out_dev_type;
gboolean out_is_connected = FALSE;
}
if (net_nfc_gdbus_tag_call_get_current_tag_info_sync(tag_proxy,
- net_nfc_client_gdbus_get_privilege(),
- &out_is_connected,
- &out_handle,
- (gint *)&out_dev_type,
- &out_is_ndef_supported,
- &out_ndef_card_state,
- &out_max_data_size,
- &out_actual_data_size,
- &out_number_of_keys,
- &out_target_info_values,
- &out_raw_data,
- NULL,
- &error) == FALSE)
+ net_nfc_client_gdbus_get_privilege(),
+ &out_is_connected,
+ &out_handle,
+ (gint *)&out_dev_type,
+ &out_is_ndef_supported,
+ &out_ndef_card_state,
+ &out_max_data_size,
+ &out_actual_data_size,
+ &out_number_of_keys,
+ &out_target_info_values,
+ &out_raw_data,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("Can no get current_tag_info result: %s",
error->message);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_tag_get_current_target_handle(
- net_nfc_client_tag_get_current_target_handle_completed callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_tag_get_current_target_handle(
+ net_nfc_client_tag_get_current_target_handle_completed callback,
+ void *user_data)
{
TagFuncData *func_data;
func_data->user_data = user_data;
net_nfc_gdbus_tag_call_get_current_target_handle(tag_proxy,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- tag_get_current_target_handle,
- func_data);
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ tag_get_current_target_handle,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_tag_get_current_target_handle_sync(
- net_nfc_target_handle_h *handle)
+API net_nfc_error_e net_nfc_client_tag_get_current_target_handle_sync(
+ net_nfc_target_handle_h *handle)
{
net_nfc_target_type_e out_dev_type;
gboolean out_is_connected = FALSE;
}
if (net_nfc_gdbus_tag_call_get_current_target_handle_sync(tag_proxy,
- net_nfc_client_gdbus_get_privilege(),
- &out_is_connected,
- &out_handle,
- (gint *)&out_dev_type,
- NULL,
- &error) == FALSE)
+ net_nfc_client_gdbus_get_privilege(),
+ &out_is_connected,
+ &out_handle,
+ (gint *)&out_dev_type,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("Can no get current_target_handle result: %s",
error->message);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-void net_nfc_client_tag_set_tag_discovered(
- net_nfc_client_tag_tag_discovered callback,
- void *user_data)
+API void net_nfc_client_tag_set_tag_discovered(
+ net_nfc_client_tag_tag_discovered callback,
+ void *user_data)
{
if (tag_discovered_func_data == NULL)
tag_discovered_func_data = g_new0(TagFuncData, 1);
tag_discovered_func_data->user_data = user_data;
}
-NET_NFC_EXPORT_API
-void net_nfc_client_tag_unset_tag_discovered(void)
+API void net_nfc_client_tag_unset_tag_discovered(void)
{
if (tag_discovered_func_data)
{
}
-NET_NFC_EXPORT_API
-void net_nfc_client_tag_set_tag_detached(
- net_nfc_client_tag_tag_detached callback,
- void *user_data)
+API void net_nfc_client_tag_set_tag_detached(
+ net_nfc_client_tag_tag_detached callback,
+ void *user_data)
{
if (tag_detached_func_data == NULL)
tag_detached_func_data = g_new0(TagFuncData, 1);
tag_detached_func_data->user_data = user_data;
}
-NET_NFC_EXPORT_API
-void net_nfc_client_tag_unset_tag_detached(void)
+API void net_nfc_client_tag_unset_tag_detached(void)
{
if (tag_detached_func_data)
{
}
}
-NET_NFC_EXPORT_API
-void net_nfc_client_tag_set_filter(net_nfc_event_filter_e filter)
+API void net_nfc_client_tag_set_filter(net_nfc_event_filter_e filter)
{
client_filter = filter;
}
-NET_NFC_EXPORT_API
-net_nfc_event_filter_e net_nfc_client_tag_get_filter(void)
+API net_nfc_event_filter_e net_nfc_client_tag_get_filter(void)
{
return client_filter;
}
client_filter = NET_NFC_ALL_ENABLE;
tag_proxy = net_nfc_gdbus_tag_proxy_new_for_bus_sync(
- G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.tizen.NetNfcService",
- "/org/tizen/NetNfcService/Tag",
- NULL,
- &error);
+ G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.tizen.NetNfcService",
+ "/org/tizen/NetNfcService/Tag",
+ NULL,
+ &error);
if (tag_proxy == NULL)
{
DEBUG_ERR_MSG("Can not create proxy : %s", error->message);
* Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
-
+ *
* http://floralicense.org/license/
*
* Unless required by applicable law or agreed to in writing, software
#include "net_nfc_util_internal.h"
#include "net_nfc_target_info.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
#define FELICA_CMD_POLL 0x00
#define FELICA_CMD_REQ_SERVICE 0x02
#define FELICA_CMD_REQ_RESPONSE 0x04
#define FELICA_CMD_REQ_SYSTEM_CODE 0x0C
#define FELICA_TAG_KEY "IDm"
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_felica_poll(net_nfc_target_handle_h handle,
- net_nfc_felica_poll_request_code_e req_code,
- uint8_t time_slote,
- nfc_transceive_data_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_felica_poll(net_nfc_target_handle_h handle,
+ net_nfc_felica_poll_request_code_e req_code,
+ uint8_t time_slote,
+ nfc_transceive_data_callback callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
rawdata.length = 6;
return net_nfc_client_transceive_data(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_felica_request_service(
- net_nfc_target_handle_h handle,
- uint8_t number_of_area_service,
- uint16_t area_service_list[],
- uint8_t number_of_services,
- nfc_transceive_data_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_felica_request_service(
+ net_nfc_target_handle_h handle,
+ uint8_t number_of_area_service,
+ uint16_t area_service_list[],
+ uint8_t number_of_services,
+ nfc_transceive_data_callback callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
net_nfc_error_e result = NET_NFC_OK;
result = net_nfc_client_transceive_data(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
if (temp != NULL)
_net_nfc_util_free_mem(temp);
return result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_felica_request_response(
- net_nfc_target_handle_h handle,
- nfc_transceive_data_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_felica_request_response(
+ net_nfc_target_handle_h handle,
+ nfc_transceive_data_callback callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
send_buffer[1] = FELICA_CMD_REQ_RESPONSE;
memcpy(send_buffer + 2,
- ((data_s*)IDm)->buffer,
- ((data_s*)IDm)->length);
+ ((data_s*)IDm)->buffer,
+ ((data_s*)IDm)->length);
DEBUG_MSG_PRINT_BUFFER(send_buffer, 10);
rawdata.length = 10;
return net_nfc_client_transceive_data(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_felica_read_without_encryption(
- net_nfc_target_handle_h handle,
- uint8_t number_of_services,
- uint16_t service_list[],
- uint8_t number_of_blocks,
- uint8_t block_list[],
- nfc_transceive_data_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_felica_read_without_encryption(
+ net_nfc_target_handle_h handle,
+ uint8_t number_of_services,
+ uint16_t service_list[],
+ uint8_t number_of_blocks,
+ uint8_t block_list[],
+ nfc_transceive_data_callback callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
return NET_NFC_OUT_OF_BOUND;
send_buffer_length = 1 + 1 + 8 + 1 + (2 * number_of_services)
- + 1 + number_of_blocks;
+ + 1 + number_of_blocks;
_net_nfc_util_alloc_mem(send_buffer,
send_buffer_length * sizeof(uint8_t));
net_nfc_error_e result = NET_NFC_OK;
result = net_nfc_client_transceive_data(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
if (temp != NULL)
_net_nfc_util_free_mem(temp);
return result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_felica_write_without_encryption(
- net_nfc_target_handle_h handle,
- uint8_t number_of_services,
- uint16_t service_list[],
- uint8_t number_of_blocks,
- uint8_t block_list[],
- data_h data,
- nfc_transceive_data_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_felica_write_without_encryption(
+ net_nfc_target_handle_h handle,
+ uint8_t number_of_services,
+ uint16_t service_list[],
+ uint8_t number_of_blocks,
+ uint8_t block_list[],
+ data_h data,
+ nfc_transceive_data_callback callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
return NET_NFC_OUT_OF_BOUND;
send_buffer_length = 1 + 1 + 8 + 1 + (2 * number_of_services)
- + 1 + number_of_blocks
- +((data_s*)data)->length;
+ + 1 + number_of_blocks
+ +((data_s*)data)->length;
_net_nfc_util_alloc_mem(send_buffer,
send_buffer_length * sizeof(uint8_t));
net_nfc_error_e result = NET_NFC_OK;
result = net_nfc_client_transceive_data(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
if (temp != NULL)
_net_nfc_util_free_mem(temp);
return result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_felica_request_system_code(
- net_nfc_target_handle_h handle,
- nfc_transceive_data_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_felica_request_system_code(
+ net_nfc_target_handle_h handle,
+ nfc_transceive_data_callback callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
send_buffer[1] = FELICA_CMD_REQ_SYSTEM_CODE;
memcpy(send_buffer + 2,
- ((data_s *)IDm)->buffer,
- ((data_s *)IDm)->length);
+ ((data_s *)IDm)->buffer,
+ ((data_s *)IDm)->length);
DEBUG_MSG_PRINT_BUFFER(send_buffer, 10);
rawdata.length = 10;
return net_nfc_client_transceive_data(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
}
#include "net_nfc_target_info.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
-
#define JEWEL_CMD_REQA 0x26
#define JEWEL_CMD_WUPA 0x52
#define JEWEL_CMD_RID 0x78
#define JEWEL_CMD_WRITE_NE 0x1A
#define JEWEL_TAG_KEY "UID"
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_jewel_read_id(net_nfc_target_handle_h handle,
- nfc_transceive_data_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_jewel_read_id(net_nfc_target_handle_h handle,
+ nfc_transceive_data_callback callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
rawdata.length = 9;
return net_nfc_client_transceive_data(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_jewel_read_byte(net_nfc_target_handle_h handle,
- uint8_t block,
- uint8_t byte,
- nfc_transceive_data_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_jewel_read_byte(net_nfc_target_handle_h handle,
+ uint8_t block,
+ uint8_t byte,
+ nfc_transceive_data_callback callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
/* UID0 ~ 3 */
memcpy(&(send_buffer[3]),
- ((data_s*)UID)->buffer,
- ((data_s*)UID)->length);
+ ((data_s*)UID)->buffer,
+ ((data_s*)UID)->length);
net_nfc_util_compute_CRC(CRC_B, send_buffer, 9);
rawdata.length = 9;
return net_nfc_client_transceive_data(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_jewel_read_all(net_nfc_target_handle_h handle,
- nfc_transceive_data_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_jewel_read_all(net_nfc_target_handle_h handle,
+ nfc_transceive_data_callback callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
/* UID0 ~ 3 */
memcpy(&(send_buffer[3]),
- ((data_s*)UID)->buffer,
- ((data_s*)UID)->length);
+ ((data_s*)UID)->buffer,
+ ((data_s*)UID)->length);
net_nfc_util_compute_CRC(CRC_B, send_buffer, 9);
rawdata.length = 9;
return net_nfc_client_transceive_data(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_jewel_write_with_erase(
- net_nfc_target_handle_h handle,
- uint8_t block,
- uint8_t byte,
- uint8_t data,
- nfc_transceive_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_jewel_write_with_erase(
+ net_nfc_target_handle_h handle,
+ uint8_t block,
+ uint8_t byte,
+ uint8_t data,
+ nfc_transceive_callback callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
/* UID0 ~ 3 */
memcpy(&(send_buffer[3]),
- ((data_s*)UID)->buffer,
- ((data_s*)UID)->length);
+ ((data_s*)UID)->buffer,
+ ((data_s*)UID)->length);
net_nfc_util_compute_CRC(CRC_B, send_buffer, 9);
rawdata.length = 9;
return net_nfc_client_transceive(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_jewel_write_with_no_erase(
- net_nfc_target_handle_h handle,
- uint8_t block,
- uint8_t byte,
- uint8_t data,
- nfc_transceive_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_jewel_write_with_no_erase(
+ net_nfc_target_handle_h handle,
+ uint8_t block,
+ uint8_t byte,
+ uint8_t data,
+ nfc_transceive_callback callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
/* UID0 ~ 3 */
memcpy(&(send_buffer[3]),
- ((data_s*)UID)->buffer,
- ((data_s*)UID)->length);
+ ((data_s*)UID)->buffer,
+ ((data_s*)UID)->length);
net_nfc_util_compute_CRC(CRC_B, send_buffer, 9);
rawdata.length = 9;
return net_nfc_client_transceive(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
}
* Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
-
+ *
* http://floralicense.org/license/
*
* Unless required by applicable law or agreed to in writing, software
#include "net_nfc_client_transceive.h"
#include "net_nfc_client_tag_internal.h"
-
-#include "net_nfc_tag_mifare.h"
-
+#include "net_nfc_client_tag_mifare.h"
#include "net_nfc_data.h"
#include "net_nfc_typedef_internal.h"
#include "net_nfc_debug_internal.h"
#include "net_nfc_target_info.h"
#include "net_nfc_util_internal.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
#define MIFARE_CMD_RAW 0x00U
#define MIFARE_CMD_AUTH_A 0x60U /**< authenticate with key A */
#define MIFARE_CMD_AUTH_B 0x61U /**< authenticate with key B */
#define MIFARE_PAGE_SIZE 4 /* 1 page is 4 byte */
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyA(
- net_nfc_target_handle_h handle,
- uint8_t sector,
- data_h auth_key,
- void *callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyA(
+ net_nfc_target_handle_h handle,
+ uint8_t sector,
+ data_h auth_key,
+ void *callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
}
if (net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info,
- MIFARE_TAG_KEY,
- &UID) != NET_NFC_OK)
+ MIFARE_TAG_KEY,
+ &UID) != NET_NFC_OK)
{
return NET_NFC_NO_DATA_FOUND;
}
switch (target_info->devType)
{
case NET_NFC_MIFARE_MINI_PICC :
- {
- /* 0 ~ 4 : 5 sector and 4 block with 16 bytes */
- if (sector > MIFARE_MINI_SECTORS - 1)
- return NET_NFC_OUT_OF_BOUND;
+ /* 0 ~ 4 : 5 sector and 4 block with 16 bytes */
+ if (sector > MIFARE_MINI_SECTORS - 1)
+ return NET_NFC_OUT_OF_BOUND;
- sector_to_block = sector * MIFARE_BLOCK_4 + 3;
- }
+ sector_to_block = sector * MIFARE_BLOCK_4 + 3;
break;
case NET_NFC_MIFARE_1K_PICC :
- {
- /* 0 ~ 15 : 16 sector and 4 block with 16 bytes */
- if (sector > MIFARE_1K_SECTORS)
- return NET_NFC_OUT_OF_BOUND;
+ /* 0 ~ 15 : 16 sector and 4 block with 16 bytes */
+ if (sector > MIFARE_1K_SECTORS)
+ return NET_NFC_OUT_OF_BOUND;
- sector_to_block = sector * MIFARE_BLOCK_4 + 3;
- }
+ sector_to_block = sector * MIFARE_BLOCK_4 + 3;
break;
case NET_NFC_MIFARE_4K_PICC :
- {
- /* 0 ~ 31 : 32 sector and 4 block with 16 bytes
- * 32 ~ 39 : 8 sector and 16 block with 16 bytes
- */
- if (sector > MIFARE_4K_SECTORS)
- return NET_NFC_OUT_OF_BOUND;
+ /* 0 ~ 31 : 32 sector and 4 block with 16 bytes
+ * 32 ~ 39 : 8 sector and 16 block with 16 bytes
+ */
+ if (sector > MIFARE_4K_SECTORS)
+ return NET_NFC_OUT_OF_BOUND;
- if (sector < 32)
- sector_to_block = sector * MIFARE_BLOCK_4 + 3;
- else
- {
- sector_to_block = (31 * MIFARE_BLOCK_4 + 3)
- + (sector - 32)
- * MIFARE_BLOCK_16 + 15;
- }
+ if (sector < 32)
+ sector_to_block = sector * MIFARE_BLOCK_4 + 3;
+ else
+ {
+ sector_to_block = (31 * MIFARE_BLOCK_4 + 3)
+ + (sector - 32)
+ * MIFARE_BLOCK_16 + 15;
}
break;
default :
/* cmd + addr + UID + AUTH_KEY + CRC_A */
send_buffer_length = 1 + 1 + ((data_s*)UID)->length
- + key->length + 2;
+ + key->length + 2;
_net_nfc_util_alloc_mem(send_buffer,
send_buffer_length * sizeof(uint8_t));
rawdata.length = send_buffer_length;
net_nfc_error_e result = net_nfc_client_transceive(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
if (send_buffer != NULL)
_net_nfc_util_free_mem(send_buffer);
return result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyB(
- net_nfc_target_handle_h handle,
- uint8_t sector,
- data_h auth_key,
- void *callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_mifare_authenticate_with_keyB(
+ net_nfc_target_handle_h handle,
+ uint8_t sector,
+ data_h auth_key,
+ void *callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
}
if (net_nfc_get_tag_info_value((net_nfc_target_info_h)target_info,
- MIFARE_TAG_KEY,
- &UID) != NET_NFC_OK)
+ MIFARE_TAG_KEY,
+ &UID) != NET_NFC_OK)
{
return NET_NFC_NO_DATA_FOUND;
}
switch (target_info->devType)
{
case NET_NFC_MIFARE_MINI_PICC :
- {
- /* 0 ~ 4 : 5 sector and 4 block with 16 bytes */
- if (sector > MIFARE_MINI_SECTORS)
- return NET_NFC_OUT_OF_BOUND;
+ /* 0 ~ 4 : 5 sector and 4 block with 16 bytes */
+ if (sector > MIFARE_MINI_SECTORS)
+ return NET_NFC_OUT_OF_BOUND;
- sector_to_block = sector * MIFARE_BLOCK_4 + 3;
- }
+ sector_to_block = sector * MIFARE_BLOCK_4 + 3;
break;
case NET_NFC_MIFARE_1K_PICC :
- {
- /* 0 ~ 15 : 16 sector and 4 block with 16 bytes */
- if (sector > MIFARE_1K_SECTORS)
- return NET_NFC_OUT_OF_BOUND;
+ /* 0 ~ 15 : 16 sector and 4 block with 16 bytes */
+ if (sector > MIFARE_1K_SECTORS)
+ return NET_NFC_OUT_OF_BOUND;
- sector_to_block = sector * MIFARE_BLOCK_4 + 3;
- }
+ sector_to_block = sector * MIFARE_BLOCK_4 + 3;
break;
case NET_NFC_MIFARE_4K_PICC :
- {
- /* 0 ~ 31 : 32 sector and 4 block with 16 bytes
- * 32 ~ 39 : 8 sector and 16 block with 16 bytes
- */
- if (sector > MIFARE_4K_SECTORS)
- return NET_NFC_OUT_OF_BOUND;
+ /* 0 ~ 31 : 32 sector and 4 block with 16 bytes
+ * 32 ~ 39 : 8 sector and 16 block with 16 bytes
+ */
+ if (sector > MIFARE_4K_SECTORS)
+ return NET_NFC_OUT_OF_BOUND;
- if (sector < 32)
- sector_to_block = sector * MIFARE_BLOCK_4 + 3;
- else
- {
- sector_to_block = (31 * MIFARE_BLOCK_4 + 3)
- + (sector - 32)
- * MIFARE_BLOCK_16 + 15;
- }
+ if (sector < 32)
+ sector_to_block = sector * MIFARE_BLOCK_4 + 3;
+ else
+ {
+ sector_to_block = (31 * MIFARE_BLOCK_4 + 3)
+ + (sector - 32)
+ * MIFARE_BLOCK_16 + 15;
}
break;
default :
+ key->length + 2; /* cmd + addr + UID + AUTH_KEY + CRC_A */
_net_nfc_util_alloc_mem(send_buffer, send_buffer_length
- * sizeof(uint8_t));
+ * sizeof(uint8_t));
if (send_buffer == NULL)
{
net_nfc_free_data(UID);
rawdata.length = send_buffer_length;
net_nfc_error_e result = net_nfc_client_transceive(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
if (send_buffer != NULL)
_net_nfc_util_free_mem(send_buffer);
return result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_mifare_read(net_nfc_target_handle_h handle,
- uint8_t addr,
- void *callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_mifare_read(net_nfc_target_handle_h handle,
+ uint8_t addr,
+ void *callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
if (target_info != NULL)
{
if (target_info->devType < NET_NFC_MIFARE_MINI_PICC ||
- target_info->devType > NET_NFC_MIFARE_ULTRA_PICC)
+ target_info->devType > NET_NFC_MIFARE_ULTRA_PICC)
{
DEBUG_CLIENT_MSG("not a MIFARE TAG = [%d]",
- target_info->devType);
+ target_info->devType);
return NET_NFC_NOT_SUPPORTED;
}
rawdata.length = 4;
return net_nfc_client_transceive_data(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_mifare_write_block(
- net_nfc_target_handle_h handle,
- uint8_t addr,
- data_h data,
- void *callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_mifare_write_block(
+ net_nfc_target_handle_h handle,
+ uint8_t addr,
+ data_h data,
+ void *callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
target_info->devType > NET_NFC_MIFARE_ULTRA_PICC)
{
DEBUG_CLIENT_MSG("not a MIFARE TAG = [%d] \n",
- target_info->devType);
+ target_info->devType);
return NET_NFC_NOT_SUPPORTED;
}
temp++;
memcpy(temp,
- ((data_s*)data)->buffer,
- MIFARE_PAGE_SIZE);
+ ((data_s*)data)->buffer,
+ MIFARE_PAGE_SIZE);
}
else
/* cmd + addr + page + CRC */
send_buffer_length = 1 + 1 +
- ((data_s*)data)->length + 2;
+ ((data_s*)data)->length + 2;
_net_nfc_util_alloc_mem(send_buffer,
send_buffer_length * sizeof(uint8_t));
temp++;
memcpy(temp,
- ((data_s*)data)->buffer,
- ((data_s*)data)->length);
+ ((data_s*)data)->buffer,
+ ((data_s*)data)->length);
}
}
temp++;
memcpy(temp,
- ((data_s*)data)->buffer,
- MIFARE_BLOCK_SIZE);
+ ((data_s*)data)->buffer,
+ MIFARE_BLOCK_SIZE);
}
else
{
/* cmd + addr + page + CRC */
send_buffer_length = 1 + 1 + ((data_s*)data)->length
- + 2;
+ + 2;
_net_nfc_util_alloc_mem(send_buffer,
send_buffer_length * sizeof(uint8_t));
temp++;
memcpy(temp,
- ((data_s*)data)->buffer,
- ((data_s*)data)->length);
+ ((data_s*)data)->buffer,
+ ((data_s*)data)->length);
}
}
rawdata.length = send_buffer_length;
net_nfc_error_e result = net_nfc_client_transceive(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
if (send_buffer != NULL)
_net_nfc_util_free_mem(send_buffer);
return result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_mifare_write_page(
- net_nfc_target_handle_h handle,
- uint8_t addr,
- data_h data,
- void *callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_mifare_write_page(
+ net_nfc_target_handle_h handle,
+ uint8_t addr,
+ data_h data,
+ void *callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
temp++;
memcpy(temp,
- ((data_s*)data)->buffer,
- MIFARE_PAGE_SIZE);
+ ((data_s*)data)->buffer,
+ MIFARE_PAGE_SIZE);
}
else
{
/* cmd + addr + page + CRC */
send_buffer_length = 1 + 1 + ((data_s*)data)->length
- + 2;
+ + 2;
_net_nfc_util_alloc_mem(send_buffer,
send_buffer_length * sizeof(uint8_t));
temp++;
memcpy(temp,
- ((data_s*)data)->buffer,
- ((data_s*)data)->length);
+ ((data_s*)data)->buffer,
+ ((data_s*)data)->length);
}
}
temp++;
memcpy(temp,
- ((data_s*)data)->buffer,
- MIFARE_PAGE_SIZE);
+ ((data_s*)data)->buffer,
+ MIFARE_PAGE_SIZE);
}
else
/* cmd + addr + page + CRC */
send_buffer_length = 1 + 1 + ((data_s*)data)->length
- + 2;
+ + 2;
_net_nfc_util_alloc_mem(send_buffer,
send_buffer_length * sizeof(uint8_t));
temp++;
memcpy(temp,
- ((data_s*)data)->buffer,
- ((data_s*)data)->length);
+ ((data_s*)data)->buffer,
+ ((data_s*)data)->length);
}
}
rawdata.length = send_buffer_length;
net_nfc_error_e result = net_nfc_client_transceive(handle,
- (data_h)&rawdata,
- callback,
- user_data);
+ (data_h)&rawdata,
+ callback,
+ user_data);
if (send_buffer != NULL)
_net_nfc_util_free_mem(send_buffer);
return result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_mifare_increment(net_nfc_target_handle_h handle,
- uint8_t addr,
- int value,
- void *callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_mifare_increment(net_nfc_target_handle_h handle,
+ uint8_t addr,
+ int value,
+ void *callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
send_buffer[1] = addr;
/* little endian.
- little value of byte array will be saved first in memory */
+ little value of byte array will be saved first in memory */
send_buffer[5] = (value & 0xFF000000) >> 24;
send_buffer[4] = (value & 0x00FF0000) >> 16;
send_buffer[3] = (value & 0x0000FF00) >> 8;
rawdata.length = 8;
return net_nfc_client_transceive(handle, (data_h)&rawdata, callback,
- user_data);
+ user_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_mifare_decrement(net_nfc_target_handle_h handle,
- uint8_t addr,
- int value,
- void *callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_mifare_decrement(net_nfc_target_handle_h handle,
+ uint8_t addr,
+ int value,
+ void *callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
send_buffer[1] = addr;
/* little endian.
- little value of byte array will be saved first in memory */
+ little value of byte array will be saved first in memory */
send_buffer[5] = (value & 0xFF000000) >> 24;
send_buffer[4] = (value & 0x00FF0000) >> 16;
send_buffer[3] = (value & 0x0000FF00) >> 8;
rawdata.length = 8;
return net_nfc_client_transceive(handle, (data_h)&rawdata, callback,
- user_data);
+ user_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_mifare_transfer(net_nfc_target_handle_h handle,
- uint8_t addr,
- void *callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_mifare_transfer(net_nfc_target_handle_h handle,
+ uint8_t addr,
+ void *callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
rawdata.length = 4;
return net_nfc_client_transceive(handle, (data_h)&rawdata, callback,
- user_data);
+ user_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_mifare_restore(net_nfc_target_handle_h handle,
- uint8_t addr,
- void *callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_mifare_restore(net_nfc_target_handle_h handle,
+ uint8_t addr,
+ void *callback,
+ void *user_data)
{
net_nfc_target_info_s* target_info = NULL;
rawdata.length = 4;
return net_nfc_client_transceive(handle, (data_h)&rawdata, callback,
- user_data);
+ user_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_mifare_create_default_key(data_h* key)
+API net_nfc_error_e net_nfc_client_mifare_create_default_key(data_h* key)
{
if (key == NULL)
return NET_NFC_NULL_PARAMETER;
return net_nfc_create_data(key, default_key, 6);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_mifare_create_application_directory_key(
- data_h* key)
+API net_nfc_error_e net_nfc_client_mifare_create_application_directory_key(
+ data_h* key)
{
if (key == NULL)
return NET_NFC_NULL_PARAMETER;
return net_nfc_create_data(key, mad_key, 6);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_mifare_create_net_nfc_forum_key(data_h* key)
+API net_nfc_error_e net_nfc_client_mifare_create_net_nfc_forum_key(data_h* key)
{
if (key == NULL)
return NET_NFC_NULL_PARAMETER;
#include "net_nfc_target_info.h"
#include "net_nfc_util_internal.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_tag_type(net_nfc_target_info_h target_info, net_nfc_target_type_e * type)
+API net_nfc_error_e net_nfc_get_tag_type(net_nfc_target_info_h target_info, net_nfc_target_type_e * type)
{
if (target_info == NULL || type == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_tag_handle(net_nfc_target_info_h target_info, net_nfc_target_handle_h * handle)
+API net_nfc_error_e net_nfc_get_tag_handle(net_nfc_target_info_h target_info, net_nfc_target_handle_h * handle)
{
if (target_info == NULL || handle == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_tag_ndef_support(net_nfc_target_info_h target_info, bool * is_support)
+API net_nfc_error_e net_nfc_get_tag_ndef_support(net_nfc_target_info_h target_info, bool * is_support)
{
if (target_info == NULL || is_support == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_tag_max_data_size(net_nfc_target_info_h target_info, uint32_t * max_size)
+API net_nfc_error_e net_nfc_get_tag_max_data_size(net_nfc_target_info_h target_info, uint32_t * max_size)
{
if (target_info == NULL || max_size == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_tag_actual_data_size(net_nfc_target_info_h target_info, uint32_t * actual_data)
+API net_nfc_error_e net_nfc_get_tag_actual_data_size(net_nfc_target_info_h target_info, uint32_t * actual_data)
{
if (target_info == NULL || actual_data == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_tag_info_keys(net_nfc_target_info_h target_info, char ***keys, int* number_of_keys)
+API net_nfc_error_e net_nfc_get_tag_info_keys(net_nfc_target_info_h target_info, char ***keys, int* number_of_keys)
{
if (keys == NULL || number_of_keys == NULL || target_info == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_tag_info_value(net_nfc_target_info_h target_info, const char* key, data_h* value)
+API net_nfc_error_e net_nfc_get_tag_info_value(net_nfc_target_info_h target_info, const char* key, data_h* value)
{
if (target_info == NULL || key == NULL || value == NULL)
{
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_duplicate_target_info(net_nfc_target_info_h origin, net_nfc_target_info_h *result)
+API net_nfc_error_e net_nfc_duplicate_target_info(net_nfc_target_info_h origin, net_nfc_target_info_h *result)
{
net_nfc_target_info_s *handle = (net_nfc_target_info_s *)origin;
net_nfc_target_info_s *temp = NULL;
return result;
}
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_release_tag_info(net_nfc_target_info_h target_info)
+API net_nfc_error_e net_nfc_release_tag_info(net_nfc_target_info_h target_info)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_info_s *info = (net_nfc_target_info_s *)target_info;
#include "net_nfc_client_manager.h"
#include "net_nfc_client_test.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
typedef struct _TestFuncData TestFuncData;
struct _TestFuncData
};
static void test_call_sim_test_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void test_call_prbs_test_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void test_call_get_firmware_version_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void test_call_set_ee_data_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static NetNfcGDbusTest *test_proxy = NULL;
static void test_call_sim_test_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
TestFuncData *func_data;
out_result = NET_NFC_UNKNOWN_ERROR;
DEBUG_ERR_MSG("Can not finish sim_test: %s",
- error->message);
+ error->message);
g_error_free(error);
}
}
static void test_call_prbs_test_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
TestFuncData *func_data;
out_result = NET_NFC_UNKNOWN_ERROR;
DEBUG_ERR_MSG("Can not finish prbs test: %s",
- error->message);
+ error->message);
g_error_free(error);
}
}
callback = (net_nfc_client_test_prbs_test_completed)
- func_data->callback;
+ func_data->callback;
data = func_data->user_data;
callback(out_result, data);
}
static void test_call_get_firmware_version_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
TestFuncData *func_data;
out_result = NET_NFC_UNKNOWN_ERROR;
DEBUG_ERR_MSG("Can not finish get_firmware_version: %s",
- error->message);
+ error->message);
g_error_free(error);
}
}
callback = (net_nfc_client_test_get_firmware_version_completed)
- func_data->callback;
+ func_data->callback;
data = func_data->user_data;
callback(out_result, out_version, data);
}
static void test_call_set_ee_data_callback(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
TestFuncData *func_data;
out_result = NET_NFC_UNKNOWN_ERROR;
DEBUG_ERR_MSG("Can not finish set_ee_data: %s\n",
- error->message);
+ error->message);
g_error_free(error);
}
}
callback = (net_nfc_client_test_set_ee_data_completed)
- func_data->callback;
+ func_data->callback;
callback(out_result, func_data->user_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_test_sim_test(
- net_nfc_client_test_sim_test_completed callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_test_sim_test(
+ net_nfc_client_test_sim_test_completed callback,
+ void *user_data)
{
TestFuncData *func_data;
func_data->user_data = user_data;
net_nfc_gdbus_test_call_sim_test(test_proxy,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- test_call_sim_test_callback,
- func_data);
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ test_call_sim_test_callback,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_test_sim_test_sync(void)
+API net_nfc_error_e net_nfc_client_test_sim_test_sync(void)
{
GError *error = NULL;
net_nfc_error_e out_result = NET_NFC_OK;
}
if (net_nfc_gdbus_test_call_sim_test_sync(test_proxy,
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&out_result,
- NULL,
- &error) == FALSE)
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&out_result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_CLIENT_MSG("can not call SimTest: %s",
error->message);
return out_result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_test_prbs_test(uint32_t tech,
- uint32_t rate,
- net_nfc_client_test_prbs_test_completed callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_test_prbs_test(uint32_t tech,
+ uint32_t rate,
+ net_nfc_client_test_prbs_test_completed callback,
+ void *user_data)
{
TestFuncData *func_data;
func_data->user_data = user_data;
net_nfc_gdbus_test_call_prbs_test(test_proxy,
- tech,
- rate,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- test_call_prbs_test_callback,
- func_data);
+ tech,
+ rate,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ test_call_prbs_test_callback,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_test_prbs_test_sync(uint32_t tech,
- uint32_t rate)
+API net_nfc_error_e net_nfc_client_test_prbs_test_sync(uint32_t tech,
+ uint32_t rate)
{
GError *error = NULL;
net_nfc_error_e out_result = NET_NFC_OK;
}
if (net_nfc_gdbus_test_call_prbs_test_sync(test_proxy,
- tech,
- rate,
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&out_result,
- NULL,
- &error) == FALSE)
+ tech,
+ rate,
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&out_result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_CLIENT_MSG("can not call PrbsTest: %s",
error->message);
return out_result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_test_get_firmware_version(
+API net_nfc_error_e net_nfc_client_test_get_firmware_version(
net_nfc_client_test_get_firmware_version_completed callback,
void *user_data)
{
func_data->user_data = user_data;
net_nfc_gdbus_test_call_get_firmware_version(test_proxy,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- test_call_get_firmware_version_callback,
- func_data);
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ test_call_get_firmware_version_callback,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_test_get_firmware_version_sync(char **version)
+API net_nfc_error_e net_nfc_client_test_get_firmware_version_sync(char **version)
{
gchar *out_version = NULL;
GError *error = NULL;
}
if (net_nfc_gdbus_test_call_get_firmware_version_sync(test_proxy,
- net_nfc_client_gdbus_get_privilege(),
- (gint *)out_result,
- &out_version,
- NULL,
- &error) == FALSE)
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)out_result,
+ &out_version,
+ NULL,
+ &error) == FALSE)
{
DEBUG_CLIENT_MSG("can not call PrbsTest: %s",
error->message);
return out_result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_test_set_ee_data(int mode,
- int reg_id,
- data_h data,
- net_nfc_client_test_set_ee_data_completed callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_test_set_ee_data(int mode,
+ int reg_id,
+ data_h data,
+ net_nfc_client_test_set_ee_data_completed callback,
+ void *user_data)
{
TestFuncData *func_data;
GVariant *variant = NULL;
variant = net_nfc_util_gdbus_data_to_variant((data_s *)data);
net_nfc_gdbus_test_call_set_ee_data(test_proxy,
- mode,
- reg_id,
- variant,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- test_call_set_ee_data_callback,
- func_data);
+ mode,
+ reg_id,
+ variant,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ test_call_set_ee_data_callback,
+ func_data);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_test_set_ee_data_sync(int mode,
- int reg_id,
- data_h data)
+API net_nfc_error_e net_nfc_client_test_set_ee_data_sync(int mode,
+ int reg_id,
+ data_h data)
{
GVariant *variant = NULL;
GError *error = NULL;
variant = net_nfc_util_gdbus_data_to_variant((data_s *)data);
if (net_nfc_gdbus_test_call_set_ee_data_sync(test_proxy,
- mode,
- reg_id,
- variant,
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&out_result,
- NULL,
- &error) == FALSE)
+ mode,
+ reg_id,
+ variant,
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&out_result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_CLIENT_MSG("can not call SetEeTest: %s",
error->message);
}
test_proxy = net_nfc_gdbus_test_proxy_new_for_bus_sync(
- G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.tizen.NetNfcService",
- "/org/tizen/NetNfcService/Test",
- NULL,
- &error);
+ G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.tizen.NetNfcService",
+ "/org/tizen/NetNfcService/Test",
+ NULL,
+ &error);
if (test_proxy == NULL)
{
#include "net_nfc_client_tag_internal.h"
#include "net_nfc_client_transceive.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
static NetNfcGDbusTransceive *transceive_proxy = NULL;
static GVariant *transceive_data_to_transceive_variant(
- net_nfc_target_type_e dev_type,
- data_s *data);
+ net_nfc_target_type_e dev_type,
+ data_s *data);
static void transceive_call(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
static void transceive_data_call(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data);
+ GAsyncResult *res,
+ gpointer user_data);
typedef struct _TransceiveFuncData TransceiveFuncData;
};
static GVariant *transceive_data_to_transceive_variant(
- net_nfc_target_type_e devType,
- data_s *data)
+ net_nfc_target_type_e devType,
+ data_s *data)
{
GVariant *variant = NULL;
data_s transceive_info = {NULL,};
case NET_NFC_MIFARE_1K_PICC :
case NET_NFC_MIFARE_4K_PICC :
case NET_NFC_MIFARE_ULTRA_PICC :
+ if(net_nfc_util_alloc_data(&transceive_info,
+ data->length + 2) == true)
{
- if(net_nfc_util_alloc_data(&transceive_info,
- data->length + 2) == true)
- {
- memcpy(transceive_info.buffer,
+ memcpy(transceive_info.buffer,
data->buffer,
data->length);
- net_nfc_util_compute_CRC(CRC_A,
- transceive_info.buffer,
- transceive_info.length);
- }
+ net_nfc_util_compute_CRC(CRC_A,
+ transceive_info.buffer,
+ transceive_info.length);
}
break;
case NET_NFC_JEWEL_PICC :
+ if (data->length > 9)
+ {
+ DEBUG_ERR_MSG("data length is larger than 9");
+ return NULL;
+ }
+
+ if(net_nfc_util_alloc_data(&transceive_info, 9) == true)
{
- if (data->length > 9)
- {
- DEBUG_ERR_MSG("data length is larger than 9");
- return NULL;
- }
-
- if(net_nfc_util_alloc_data(&transceive_info, 9) == true)
- {
- memcpy(transceive_info.buffer,
+ memcpy(transceive_info.buffer,
data->buffer,
data->length);
- net_nfc_util_compute_CRC(CRC_B,
- transceive_info.buffer,
- transceive_info.length);
- }
-
+ net_nfc_util_compute_CRC(CRC_B,
+ transceive_info.buffer,
+ transceive_info.length);
}
+
break;
default :
+ if(net_nfc_util_alloc_data(&transceive_info,
+ data->length) == true)
{
- if(net_nfc_util_alloc_data(&transceive_info,
- data->length) == true)
- {
- memcpy(transceive_info.buffer,
+ memcpy(transceive_info.buffer,
data->buffer,
data->length);
- }
}
break;
}
}
static void transceive_data_call(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
TransceiveFuncData *func_data;
net_nfc_util_gdbus_variant_to_data_s(out_data, &resp);
((nfc_transceive_data_callback)func_data->transceive_send_callback)(
- out_result,
- &resp,
- func_data->transceive_send_data);
+ out_result,
+ &resp,
+ func_data->transceive_send_data);
net_nfc_util_free_data(&resp);
}
static void transceive_call(GObject *source_object,
- GAsyncResult *res,
- gpointer user_data)
+ GAsyncResult *res,
+ gpointer user_data)
{
TransceiveFuncData *func_data;
}
((nfc_transceive_callback)func_data->transceive_send_callback)(
- out_result,
- func_data->transceive_send_data);
+ out_result,
+ func_data->transceive_send_data);
g_free(func_data);
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_transceive(net_nfc_target_handle_h handle,
- data_h rawdata,
- nfc_transceive_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_transceive(net_nfc_target_handle_h handle,
+ data_h rawdata,
+ nfc_transceive_callback callback,
+ void *user_data)
{
net_nfc_target_info_s *target_info = NULL;
data_s *data = (data_s *)rawdata;
return NET_NFC_OPERATION_FAIL;
arg_data = transceive_data_to_transceive_variant(target_info->devType,
- data);
+ data);
if (arg_data == NULL)
return NET_NFC_OPERATION_FAIL;
funcdata->transceive_send_data = user_data;
net_nfc_gdbus_transceive_call_transceive(transceive_proxy,
- GPOINTER_TO_UINT(handle),
- target_info->devType,
- arg_data,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- transceive_call,
- funcdata);
+ GPOINTER_TO_UINT(handle),
+ target_info->devType,
+ arg_data,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ transceive_call,
+ funcdata);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_transceive_data(net_nfc_target_handle_h handle,
- data_h rawdata,
- nfc_transceive_data_callback callback,
- void *user_data)
+API net_nfc_error_e net_nfc_client_transceive_data(net_nfc_target_handle_h handle,
+ data_h rawdata,
+ nfc_transceive_data_callback callback,
+ void *user_data)
{
net_nfc_target_info_s *target_info = NULL;
data_s *data = (data_s *)rawdata;
return NET_NFC_OPERATION_FAIL;
arg_data = transceive_data_to_transceive_variant(target_info->devType,
- data);
+ data);
if (arg_data == NULL)
return NET_NFC_OPERATION_FAIL;
funcdata->transceive_send_data = user_data;
net_nfc_gdbus_transceive_call_transceive_data(transceive_proxy,
- GPOINTER_TO_UINT(handle),
- target_info->devType,
- arg_data,
- net_nfc_client_gdbus_get_privilege(),
- NULL,
- transceive_data_call,
- funcdata);
+ GPOINTER_TO_UINT(handle),
+ target_info->devType,
+ arg_data,
+ net_nfc_client_gdbus_get_privilege(),
+ NULL,
+ transceive_data_call,
+ funcdata);
return NET_NFC_OK;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_transceive_sync(net_nfc_target_handle_h handle,
- data_h rawdata)
+API net_nfc_error_e net_nfc_client_transceive_sync(net_nfc_target_handle_h handle,
+ data_h rawdata)
{
net_nfc_target_info_s *target_info = NULL;
data_s *data = (data_s *)rawdata;
return NET_NFC_OPERATION_FAIL;
arg_data = transceive_data_to_transceive_variant(target_info->devType,
- data);
+ data);
if (arg_data == NULL)
return NET_NFC_OPERATION_FAIL;
if(net_nfc_gdbus_transceive_call_transceive_sync(transceive_proxy,
- GPOINTER_TO_UINT(handle),
- target_info->devType,
- arg_data,
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&out_result,
- NULL,
- &error) == FALSE)
+ GPOINTER_TO_UINT(handle),
+ target_info->devType,
+ arg_data,
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&out_result,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("Transceive (sync call) failed: %s",
- error->message);
+ error->message);
g_error_free(error);
return NET_NFC_UNKNOWN_ERROR;
return out_result;
}
-NET_NFC_EXPORT_API
-net_nfc_error_e net_nfc_client_transceive_data_sync(
- net_nfc_target_handle_h handle,
- data_h rawdata,
- data_h *response)
+API net_nfc_error_e net_nfc_client_transceive_data_sync(
+ net_nfc_target_handle_h handle,
+ data_h rawdata,
+ data_h *response)
{
net_nfc_target_info_s *target_info = NULL;
data_s *data = (data_s *)rawdata;
return NET_NFC_OPERATION_FAIL;
arg_data = transceive_data_to_transceive_variant(target_info->devType,
- data);
+ data);
if (arg_data == NULL)
return NET_NFC_OPERATION_FAIL;
if (net_nfc_gdbus_transceive_call_transceive_data_sync(
- transceive_proxy,
- GPOINTER_TO_UINT(handle),
- target_info->devType,
- arg_data,
- net_nfc_client_gdbus_get_privilege(),
- (gint *)&out_result,
- &out_data,
- NULL,
- &error) == FALSE)
+ transceive_proxy,
+ GPOINTER_TO_UINT(handle),
+ target_info->devType,
+ arg_data,
+ net_nfc_client_gdbus_get_privilege(),
+ (gint *)&out_result,
+ &out_data,
+ NULL,
+ &error) == FALSE)
{
DEBUG_ERR_MSG("Transceive (sync call) failed: %s",
- error->message);
+ error->message);
g_error_free(error);
return NET_NFC_UNKNOWN_ERROR;
}
}
transceive_proxy = net_nfc_gdbus_transceive_proxy_new_for_bus_sync(
- G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- "org.tizen.NetNfcService",
- "/org/tizen/NetNfcService/Transceive",
- NULL,
- &error);
+ G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ "org.tizen.NetNfcService",
+ "/org/tizen/NetNfcService/Transceive",
+ NULL,
+ &error);
if (transceive_proxy == NULL)
{
DEBUG_ERR_MSG("Can not create proxy : %s", error->message);
--- /dev/null
+prefix=@PREFIX@
+exec_prefix=${prefix}/bin
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@/@NFC_CLIENT@
+
+Name: @NFC_CLIENT@
+Description: NFC
+Version: @FULLVER@
+Requires: glib-2.0
+Libs: -L${libdir} -l@NFC_CLIENT@
+Cflags: -I${includedir}
--- /dev/null
+INCLUDE_DIRECTORIES(include)
+
+SET(NFC_COMMON "nfc-common")
+
+FIND_PROGRAM(GDBUS_CODEGEN NAMES gdbus-codegen)
+EXEC_PROGRAM(${GDBUS_CODEGEN} ARGS
+ " --generate-c-code ${CMAKE_CURRENT_SOURCE_DIR}/net_nfc_gdbus"
+ " --c-namespace NetNfcGDbus"
+ " --interface-prefix org.tizen.NetNfcService."
+ " ${CMAKE_CURRENT_SOURCE_DIR}/net_nfc.xml"
+)
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} COMMON_SRCS)
+
+pkg_check_modules(common_pkgs REQUIRED glib-2.0 gio-2.0 gio-unix-2.0 dlog bluetooth-api
+ libssl)
+
+SET(EXTRA_CFLAGS "-fPIC -Wall -Werror-implicit-function-declaration")
+
+FOREACH(flag ${common_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_LIBRARY(${NFC_COMMON} SHARED ${COMMON_SRCS})
+SET_TARGET_PROPERTIES(${NFC_COMMON} PROPERTIES VERSION ${FULLVER} SOVERSION ${MAJORVER})
+TARGET_LINK_LIBRARIES(${NFC_COMMON} ${common_pkgs_LDFLAGS})
+
+FILE(GLOB COMMON_HEADER include/*.h)
+
+CONFIGURE_FILE(${NFC_COMMON}.pc.in ${NFC_COMMON}.pc @ONLY)
+INSTALL(FILES ${NFC_COMMON}.pc DESTINATION lib/pkgconfig)
+
+INSTALL(TARGETS ${NFC_COMMON} DESTINATION lib)
+
+FOREACH(hfile ${COMMON_HEADER})
+ INSTALL(FILES ${hfile} DESTINATION include/${NFC_COMMON})
+ENDFOREACH(hfile)
+
#ifndef __NET_NFC_TYPEDEF_H__
#define __NET_NFC_TYPEDEF_H__
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
/**
NFC Manager
NFC Manager controls the nfc device with high level APIs such as SmartPoster and Connection handover.
This documents provide the NFC defines
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
/**
net_nfc_error_e is enum type that returned from each functions
#define LOG_COLOR_LIGHTBLUE "\033[0;37m"
#define LOG_COLOR_END "\033[0;m"
+#ifndef API
+#define API __attribute__((visibility("default")))
+#endif
+
+
/* nfc_log_to_file */
extern FILE *nfc_log_file;
#define NFC_DLOG_FILE "/opt/usr/share/nfc_debug/nfc_mgr_dlog.txt"
/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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.
- */
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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.
+ */
// libc header
#include <stdlib.h>
#include "net_nfc_oem_controller.h"
#include "net_nfc_util_defines.h"
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
static const char *schema[] =
{
"",
"urn:epc:nfc:",
};
-// defines for bluetooth api
-#define USE_BLUETOOTH_API
static uint8_t *bt_addr = NULL;
/* for log tag */
}
}
-NET_NFC_EXPORT_API void __net_nfc_util_free_mem(void **mem, char *filename, unsigned int line)
+API void __net_nfc_util_free_mem(void **mem, char *filename, unsigned int line)
{
if (mem == NULL)
{
*mem = NULL;
}
-NET_NFC_EXPORT_API void __net_nfc_util_alloc_mem(void **mem, int size, char *filename, unsigned int line)
+API void __net_nfc_util_alloc_mem(void **mem, int size, char *filename, unsigned int line)
{
if (mem == NULL || size <= 0)
{
}
}
-NET_NFC_EXPORT_API void __net_nfc_util_strdup(char **output, const char *origin, char *filename, unsigned int line)
+API void __net_nfc_util_strdup(char **output, const char *origin, char *filename, unsigned int line)
{
if (output == NULL || origin == NULL)
{
}
}
-NET_NFC_EXPORT_API bool net_nfc_util_alloc_data(data_s *data, uint32_t length)
+API bool net_nfc_util_alloc_data(data_s *data, uint32_t length)
{
if (data == NULL || length == 0)
return false;
return true;
}
-NET_NFC_EXPORT_API bool net_nfc_util_duplicate_data(data_s *dest, net_nfc_data_s *src)
+API bool net_nfc_util_duplicate_data(data_s *dest, net_nfc_data_s *src)
{
if (dest == NULL || src == NULL || src->length == 0)
return false;
return true;
}
-NET_NFC_EXPORT_API void net_nfc_util_free_data(data_s *data)
+API void net_nfc_util_free_data(data_s *data)
{
if (data == NULL || data->buffer == NULL)
return;
/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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.
- */
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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.
+ */
// libc header
#include "net_nfc_util_gdbus_internal.h"
void net_nfc_util_gdbus_variant_to_buffer(GVariant *variant, uint8_t **buffer,
- size_t *length)
+ size_t *length)
{
GVariantIter *iter;
guint8 *buf = NULL;
}
GVariant *net_nfc_util_gdbus_buffer_to_variant(const uint8_t *buffer,
- size_t length)
+ size_t length)
{
GVariantBuilder builder;
if (data != NULL)
{
return net_nfc_util_gdbus_buffer_to_variant(data->buffer,
- data->length);
+ data->length);
}
else
{
/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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.
- */
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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.h>
return NET_NFC_OK;
}
-/*
- inner_msg should be freed after using
- */
+/* inner_msg should be freed after using */
static net_nfc_error_e __net_nfc_get_inner_message(ndef_message_s *message, ndef_message_s *inner_msg)
{
}
if (strncmp((char*)(inner_record->type_s.buffer), CH_REQ_RECORD_TYPE, (size_t)(inner_record->type_s.length)) != 0
- && strncmp((char*)(inner_record->type_s.buffer), CH_SEL_RECORD_TYPE, (size_t)(inner_record->type_s.length)) != 0)
+ && strncmp((char*)(inner_record->type_s.buffer), CH_SEL_RECORD_TYPE, (size_t)(inner_record->type_s.length)) != 0)
{
// This message is not connection handover message
return NET_NFC_INVALID_FORMAT;
}
if (strncmp((char *)(inner_record->type_s.buffer), CH_REQ_RECORD_TYPE, (size_t)(inner_record->type_s.length)) != 0
- && strncmp((char *)(inner_record->type_s.buffer), CH_SEL_RECORD_TYPE, (size_t)(inner_record->type_s.length)) != 0)
+ && strncmp((char *)(inner_record->type_s.buffer), CH_SEL_RECORD_TYPE, (size_t)(inner_record->type_s.length)) != 0)
{
// This message is not connection handover message
DEBUG_ERR_MSG("unknown type [%s]", inner_record->type_s.buffer);
{
/* selector record type can include empty inner message. so that case, we will continue */
if (message->records != NULL &&
- memcmp((char *)message->records->type_s.buffer, CH_SEL_RECORD_TYPE, (size_t)message->records->type_s.length) != 0)
+ memcmp((char *)message->records->type_s.buffer, CH_SEL_RECORD_TYPE, (size_t)message->records->type_s.length) != 0)
{
DEBUG_ERR_MSG("ERROR [%d]", error);
config_ref_count++;
offset = 0;
-// id = '0' + config_ref_count;
+ // id = '0' + config_ref_count;
id = 'b';
/* carrier flag */
if (strncmp((char *)current->type_s.buffer, ALTERNATIVE_RECORD_TYPE, (size_t)current->type_s.length) == 0)
{
if ((uint32_t)(current->payload_s.buffer[1]) == record_priv->id_s.length &&
- strncmp((char *)(current->payload_s.buffer + 2), (char*)(record_priv->id_s.buffer), (size_t)current->payload_s.buffer[1]) == 0)
+ strncmp((char *)(current->payload_s.buffer + 2), (char*)(record_priv->id_s.buffer), (size_t)current->payload_s.buffer[1]) == 0)
{
// comparing the instance
break;
{
cr_record = inner_msg->records;
if (strncmp((char*)cr_record->type_s.buffer, COLLISION_DETECT_RECORD_TYPE, (size_t)cr_record->type_s.length) != 0
- || cr_record->payload_s.length < 2)
+ || cr_record->payload_s.length < 2)
{
DEBUG_MSG("There is no Collision resolution record");
#include "net_nfc_typedef_internal.h"
+#define NET_NFC_MANAGER_DATA_PATH "/opt/data/nfc-manager-daemon"
+#define NET_NFC_MANAGER_DATA_PATH_MESSAGE "message"
+#define NET_NFC_MANAGER_NDEF_FILE_NAME "ndef-message.txt"
+
#define NET_NFC_REVERSE_ORDER_6_BYTES(__array) \
do \
{ \
/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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.
- */
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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 "net_nfc_debug_internal.h"
}
DEBUG_MSG("---------- Record -----------------------------------------\n");
DEBUG_MSG("MB:%d ME:%d CF:%d SR:%d IL:%d TNF:0x%02X\n",
- current->MB, current->ME, current->CF, current->SR, current->IL, current->TNF);
+ current->MB, current->ME, current->CF, current->SR, current->IL, current->TNF);
DEBUG_MSG("TypeLength:%d PayloadLength:%d IDLength:%d\n",
- current->type_s.length, current->payload_s.length, current->id_s.length);
+ current->type_s.length, current->payload_s.length, current->id_s.length);
if (current->type_s.buffer != NULL)
{
memcpy(buffer, current->type_s.buffer, current->type_s.length);
if (type_length > 12)
{
if (memcmp(buf, "urn:nfc:ext:", 12) == 0 ||
- memcmp(buf, "urn:nfc:wkt:", 12) == 0)
+ memcmp(buf, "urn:nfc:wkt:", 12) == 0)
{
buf += 12;
type_length -= 12;
}
if (tmp_record->TNF == tnf &&
- type_length == tmp_record->type_s.length &&
- memcmp(buf, tmp_record->type_s.buffer, type_length) == 0)
+ type_length == tmp_record->type_s.length &&
+ memcmp(buf, tmp_record->type_s.buffer, type_length) == 0)
{
*record = tmp_record;
return NET_NFC_INVALID_FORMAT;
}
if (id_length == record_in_msg->id_s.length &&
- memcmp(buf, record_in_msg->id_s.buffer, id_length) == 0)
+ memcmp(buf, record_in_msg->id_s.buffer, id_length) == 0)
{
*record = record_in_msg;
/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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.
- */
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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 "net_nfc_debug_internal.h"
#include "net_nfc_util_defines.h"
return 0;
/* Type length is present only for following TNF
- NET_NFC_TNF_NFCWELLKNOWN
- NET_NFC_TNF_MEDIATYPE
- SLP_FRINET_NFC_NDEFRECORD_TNF_ABSURI
- SLP_FRINET_NFC_NDEFRECORD_TNF_NFCEXT
- */
+ NET_NFC_TNF_NFCWELLKNOWN
+ NET_NFC_TNF_MEDIATYPE
+ SLP_FRINET_NFC_NDEFRECORD_TNF_ABSURI
+ SLP_FRINET_NFC_NDEFRECORD_TNF_NFCEXT
+ */
/* ++ is for the Type Length Byte */
RecordLength++;
if (Record->TNF != NET_NFC_NDEF_TNF_EMPTY &&
- Record->TNF != NET_NFC_NDEF_TNF_UNKNOWN &&
- Record->TNF != NET_NFC_NDEF_TNF_UNCHANGED)
+ Record->TNF != NET_NFC_NDEF_TNF_UNKNOWN &&
+ Record->TNF != NET_NFC_NDEF_TNF_UNCHANGED)
{
RecordLength += Record->type_s.length;
}
*uri = NULL;
if (record->TNF == NET_NFC_RECORD_WELL_KNOWN_TYPE &&
- (record->type_s.length == 1 && record->type_s.buffer[0] == 'U'))
+ (record->type_s.length == 1 && record->type_s.buffer[0] == 'U'))
{
data_s *payload = &record->payload_s;
/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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.
- */
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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>
/* RSASSA-PSS, RSASSA-PKCS1-v1_5 */
case 1 :
- case 2 :
+ case 2 :
/* md */
md = EVP_get_digestbyname("sha1");
#define IS_SIGN_RECORD(__x) \
(((__x)->TNF == NET_NFC_RECORD_WELL_KNOWN_TYPE) && \
- ((__x)->type_s.length == 3) && \
- (memcmp((__x)->type_s.buffer, "Sig", 3) == 0))
+ ((__x)->type_s.length == 3) && \
+ (memcmp((__x)->type_s.buffer, "Sig", 3) == 0))
#define IS_EMPTY_RECORD(__x) \
((__x->TNF == NET_NFC_RECORD_EMPTY))
data_info = (net_nfc_sub_field_s *)chain_info->cert_store;
DEBUG_MSG("certficate length : %d", data_info->length);
- // DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);
+ // DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);
/* the first certificate is signer's one
* verify signature of content */
/* verify certificate using certificate chain */
for (i = 1, data_info = (net_nfc_sub_field_s *)__NEXT_SUB_FIELD(data_info);
- i < chain_info->num_of_certs;
- i++, data_info = (net_nfc_sub_field_s *)__NEXT_SUB_FIELD(data_info))
+ i < chain_info->num_of_certs;
+ i++, data_info = (net_nfc_sub_field_s *)__NEXT_SUB_FIELD(data_info))
{
DEBUG_MSG("certficate length : %d", data_info->length);
-// DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);
+ //DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);
net_nfc_util_openssl_add_certificate_of_ca(context, data_info->value, data_info->length);
}
_net_nfc_util_free_mem(buffer);
return result;
-// DEBUG_MSG("certficate length : %d", data_info->length);
-// DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);
+ //DEBUG_MSG("certficate length : %d", data_info->length);
+ //DEBUG_MSG_PRINT_BUFFER(data_info->value, data_info->length);
}
/* verify buffer with cert chain and signature bytes */
--- /dev/null
+prefix=@PREFIX@
+exec_prefix=${prefix}/bin
+libdir=@LIB_INSTALL_DIR@
+includedir=@INCLUDE_INSTALL_DIR@/@NFC_COMMON@
+
+Name: @NFC_COMMON@
+Description: NFC Common Library
+Version: @FULLVER@
+Requires:
+Libs: -L${libdir} -l@NFC_COMMON@
+Cflags: -I${includedir}
--- /dev/null
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/include)
+
+SET(NFC_DAEMON "nfc-manager-daemon")
+
+FILE(GLOB DAEMON_SRCS *.c)
+
+pkg_check_modules(daemon_pkgs REQUIRED aul glib-2.0 gio-unix-2.0 security-server
+ vconf dlog tapi appsvc libcurl bluetooth-api libssl svi capi-media-wav-player
+ pkgmgr pkgmgr-info capi-network-wifi ecore-x pmapi)
+
+FOREACH(flag ${daemon_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_EXECUTABLE(${NFC_DAEMON} ${DAEMON_SRCS})
+TARGET_LINK_LIBRARIES(${NFC_DAEMON} ${daemon_pkgs_LDFLAGS} pthread dl rt nfc-common)
+
+INSTALL(TARGETS ${NFC_DAEMON} DESTINATION bin)
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.tizen.NetNfcService.service DESTINATION share/dbus-1/services)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/nfc-manager.xml DESTINATION share/packages)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/sounds DESTINATION share/nfc-manager-daemon)
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
+#include <glib.h>
#include <gio/gio.h>
+#include <vconf.h>
#include "net_nfc_debug_internal.h"
+#include "net_nfc_util_internal.h"
#include "net_nfc_gdbus.h"
-#include "net_nfc_server_common.h"
#include "net_nfc_server.h"
+#include "net_nfc_server_common.h"
+#include "net_nfc_server_vconf.h"
#include "net_nfc_server_manager.h"
+#include "net_nfc_server_util.h"
+#include "net_nfc_server_controller.h"
#include "net_nfc_server_tag.h"
#include "net_nfc_server_ndef.h"
#include "net_nfc_server_llcp.h"
#include "net_nfc_server_se.h"
#include "net_nfc_server_snep.h"
#include "net_nfc_server_system_handler.h"
-#include "net_nfc_server_context_internal.h"
+#include "net_nfc_server_context.h"
+
+static gboolean use_daemon = FALSE;
+static GMainLoop *loop = NULL;
static GDBusConnection *connection = NULL;
static guint subscribe_id;
+GOptionEntry option_entries[] = {
+ { "daemon", 'd', 0, G_OPTION_ARG_NONE, &use_daemon,
+ "Use Daemon mode", NULL },
+ { NULL }
+};
+
pid_t net_nfc_server_gdbus_get_pid(const char *name)
{
guint pid = 0;
GVariant *_ret;
_ret = g_dbus_connection_call_sync(connection,
- "org.freedesktop.DBus",
- "/org/freedesktop/DBus",
- "org.freedesktop.DBus",
- "GetConnectionUnixProcessID",
- g_variant_new("(s)", name),
- NULL,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &error);
+ "org.freedesktop.DBus",
+ "/org/freedesktop/DBus",
+ "org.freedesktop.DBus",
+ "GetConnectionUnixProcessID",
+ g_variant_new("(s)", name),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
if (_ret != NULL) {
g_variant_get(_ret, "(u)", &pid);
g_variant_unref(_ret);
}
static void _name_owner_changed(GDBusProxy *proxy,
- const gchar *name, const gchar *old_owner,
- const gchar *new_owner, void *user_data)
+ const gchar *name, const gchar *old_owner,
+ const gchar *new_owner, void *user_data)
{
if (name == NULL || old_owner == NULL || new_owner == NULL) {
DEBUG_ERR_MSG("invalid parameter");
}
static void _on_name_owner_changed(GDBusConnection *connection,
- const gchar *sender_name, const gchar *object_path,
- const gchar *interface_name, const gchar *signal_name,
- GVariant *parameters, gpointer user_data)
+ const gchar *sender_name, const gchar *object_path,
+ const gchar *interface_name, const gchar *signal_name,
+ GVariant *parameters, gpointer user_data)
{
gchar *name;
gchar *old_owner;
gchar *new_owner;
g_variant_get(parameters,
- "(sss)",
- &name,
- &old_owner,
- &new_owner);
+ "(sss)",
+ &name,
+ &old_owner,
+ &new_owner);
_name_owner_changed((GDBusProxy *)connection,
- name, old_owner, new_owner, user_data);
+ name, old_owner, new_owner, user_data);
}
static void _subscribe_name_owner_changed_event()
/* subscribe signal */
subscribe_id = g_dbus_connection_signal_subscribe(connection,
- "org.freedesktop.DBus", /* bus name */
- "org.freedesktop.DBus", /* interface */
- "NameOwnerChanged", /* member */
- "/org/freedesktop/DBus", /* path */
- NULL, /* arg0 */
- G_DBUS_SIGNAL_FLAGS_NONE,
- _on_name_owner_changed,
- NULL, NULL);
+ "org.freedesktop.DBus", /* bus name */
+ "org.freedesktop.DBus", /* interface */
+ "NameOwnerChanged", /* member */
+ "/org/freedesktop/DBus", /* path */
+ NULL, /* arg0 */
+ G_DBUS_SIGNAL_FLAGS_NONE,
+ _on_name_owner_changed,
+ NULL, NULL);
}
static void _unsubscribe_name_owner_changed_event()
}
}
-void net_nfc_server_gdbus_init(void)
+static void net_nfc_server_gdbus_init(void)
{
GError *error = NULL;
_subscribe_name_owner_changed_event();
}
-void net_nfc_server_gdbus_deinit(void)
+static void net_nfc_server_gdbus_deinit(void)
{
_unsubscribe_name_owner_changed_event();
connection = NULL;
}
}
+
+void net_nfc_manager_quit()
+{
+ DEBUG_MSG("net_nfc_manager_quit kill the nfc-manager daemon!!");
+
+ if (loop != NULL)
+ g_main_loop_quit(loop);
+}
+
+static void on_bus_acquired(GDBusConnection *connection, const gchar *path,
+ gpointer user_data)
+{
+ gint state;
+
+ DEBUG_MSG("bus path : %s", path);
+
+ net_nfc_server_gdbus_init();
+
+ net_nfc_server_controller_init();
+
+ if (vconf_get_bool(VCONFKEY_NFC_STATE, &state) != 0)
+ {
+ DEBUG_MSG("VCONFKEY_NFC_STATE is not exist");
+ net_nfc_manager_quit();
+
+ return;
+ }
+
+ net_nfc_server_vconf_init();
+
+ if (state == 1)
+ net_nfc_server_manager_set_active(TRUE);
+#ifndef ESE_ALWAYS_ON
+ else if (use_daemon == TRUE)
+ net_nfc_server_controller_deinit();
+#endif
+}
+
+static void on_name_acquired(GDBusConnection *connection, const gchar *name,
+ gpointer user_data)
+{
+ DEBUG_SERVER_MSG("name : %s", name);
+}
+
+static void on_name_lost(GDBusConnection *connnection, const gchar *name,
+ gpointer user_data)
+{
+ DEBUG_SERVER_MSG("name : %s", name);
+
+ net_nfc_manager_quit();
+}
+
+
+int main(int argc, char *argv[])
+{
+
+ void *handle = NULL;
+ guint id = 0;
+ gboolean use_daemon = FALSE;
+ GOptionContext *option_context;
+ GError *error = NULL;
+
+ option_context = g_option_context_new("Nfc manager");
+ g_option_context_add_main_entries(option_context, option_entries, NULL);
+
+ if (g_option_context_parse(option_context, &argc, &argv, &error) == FALSE)
+ {
+ DEBUG_ERR_MSG("can not parse option: %s", error->message);
+ g_error_free(error);
+
+ g_option_context_free(option_context);
+ return 0;
+ }
+
+ DEBUG_SERVER_MSG("start nfc manager");
+ DEBUG_SERVER_MSG("use_daemon : %d", use_daemon);
+
+ net_nfc_manager_init_log();
+
+ net_nfc_app_util_clean_storage(MESSAGE_STORAGE);
+
+ handle = net_nfc_controller_onload();
+ if (handle == NULL)
+ {
+ DEBUG_ERR_MSG("load plugin library is failed");
+
+ if (vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_OFF) != 0)
+ DEBUG_ERR_MSG("VCONFKEY_NFC_FEATURE set to %d failed", VCONFKEY_NFC_FEATURE_OFF);
+
+ if (vconf_set_bool(VCONFKEY_NFC_STATE, 0) != 0)
+ DEBUG_ERR_MSG("VCONFKEY_NFC_STATE set to %d failed", 0);
+
+ goto EXIT;
+ }
+
+ if (vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_ON) != 0)
+ DEBUG_ERR_MSG("VCONFKEY_NFC_FEATURE set to %d failed", VCONFKEY_NFC_FEATURE_ON);
+
+ id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
+ "org.tizen.NetNfcService",
+ G_BUS_NAME_OWNER_FLAGS_NONE,
+ on_bus_acquired,
+ on_name_acquired,
+ on_name_lost,
+ NULL,
+ NULL);
+
+ loop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(loop);
+
+EXIT :
+ net_nfc_server_vconf_deinit();
+ net_nfc_server_controller_deinit();
+ net_nfc_server_gdbus_deinit();
+
+ if (id)
+ g_bus_unown_name(id);
+
+ net_nfc_controller_unload(handle);
+
+ net_nfc_manager_fini_log();
+
+ g_option_context_free(option_context);
+
+ return 0;
+}
\ No newline at end of file
#ifndef __NET_NFC_SERVER_H__
#define __NET_NFC_SERVER_H__
-void net_nfc_server_gdbus_init(void);
+pid_t net_nfc_server_gdbus_get_pid(const char *name);
-void net_nfc_server_gdbus_deinit(void);
+void net_nfc_manager_quit();
-pid_t net_nfc_server_gdbus_get_pid(const char *name);
#endif //__NET_NFC_SERVER_H__
#include "net_nfc_debug_internal.h"
#include "net_nfc_util_internal.h"
-#include "net_nfc_manager.h"
-#include "net_nfc_manager_util_internal.h"
-#include "net_nfc_controller_internal.h"
+#include "net_nfc_server.h"
+#include "net_nfc_server_util.h"
+#include "net_nfc_server_controller.h"
#include "net_nfc_server_common.h"
#include "net_nfc_server_tag.h"
#include "net_nfc_server_llcp.h"
static void controller_thread_deinit_thread_func(gpointer user_data);
static void controller_target_detected_cb(void *info,
- void *user_context);
+ void *user_context);
static void controller_se_transaction_cb(void *info,
- void *user_context);
+ void *user_context);
static void controller_llcp_event_cb(void *info,
- void *user_context);
+ void *user_context);
static void controller_init_thread_func(gpointer user_data);
/* FIXME: it works as broadcast only now */
static void controller_target_detected_cb(void *info,
- void *user_context)
+ void *user_context)
{
net_nfc_request_target_detected_t *req =
(net_nfc_request_target_detected_t *)info;
if (req->devType != NET_NFC_UNKNOWN_TARGET) {
if (req->devType == NET_NFC_NFCIP1_TARGET ||
- req->devType == NET_NFC_NFCIP1_INITIATOR) {
+ req->devType == NET_NFC_NFCIP1_INITIATOR) {
/* llcp target detected */
net_nfc_server_llcp_target_detected(info);
} else {
/* FIXME : net_nfc_dispatcher_queue_push() need to be removed */
static void controller_se_transaction_cb(void *info,
- void *user_context)
+ void *user_context)
{
net_nfc_request_se_event_t *req = (net_nfc_request_se_event_t *)info;
/* FIXME : net_nfc_dispatcher_queue_push() need to be removed */
static void controller_llcp_event_cb(void *info,
- void *user_context)
+ void *user_context)
{
net_nfc_request_llcp_msg_t *req_llcp_msg;
net_nfc_request_msg_t *req_msg;
result);
if (net_nfc_controller_register_listener(controller_target_detected_cb,
- controller_se_transaction_cb,
- controller_llcp_event_cb,
- &result) == false)
+ controller_se_transaction_cb,
+ controller_llcp_event_cb,
+ &result) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
"net_nfc_contorller_register_listener",
net_nfc_error_e result;
net_nfc_controller_configure_discovery(NET_NFC_DISCOVERY_MODE_CONFIG,
- NET_NFC_ALL_DISABLE,
- &result);
+ NET_NFC_ALL_DISABLE,
+ &result);
net_nfc_server_free_target_info();
if (pm_state == VCONFKEY_PM_STATE_NORMAL)
{
if (net_nfc_controller_configure_discovery(
- NET_NFC_DISCOVERY_MODE_CONFIG,
- NET_NFC_ALL_ENABLE,
- &result) == true)
+ NET_NFC_DISCOVERY_MODE_CONFIG,
+ NET_NFC_ALL_ENABLE,
+ &result) == true)
{
DEBUG_SERVER_MSG("polling enable");
}
if (pm_state == VCONFKEY_PM_STATE_LCDOFF)
{
if (net_nfc_controller_configure_discovery(
- NET_NFC_DISCOVERY_MODE_CONFIG,
- NET_NFC_ALL_DISABLE,
- &result) == true)
+ NET_NFC_DISCOVERY_MODE_CONFIG,
+ NET_NFC_ALL_DISABLE,
+ &result) == true)
{
DEBUG_SERVER_MSG("polling disabled");
}
GError *error = NULL;
controller_async_queue = g_async_queue_new_full(
- controller_async_queue_free_func);
+ controller_async_queue_free_func);
controller_thread = g_thread_try_new("controller_thread",
- controller_thread_func,
- NULL,
- &error);
+ controller_thread_func,
+ NULL,
+ &error);
if (controller_thread == NULL)
{
void net_nfc_server_controller_thread_deinit(void)
{
if(net_nfc_server_controller_async_queue_push(
- controller_thread_deinit_thread_func,
- NULL)==FALSE)
+ controller_thread_deinit_thread_func,
+ NULL)==FALSE)
{
DEBUG_ERR_MSG("Failed to push onto the queue");
}
void net_nfc_server_controller_init(void)
{
if(net_nfc_server_controller_async_queue_push(
- controller_init_thread_func,
- NULL)==FALSE)
+ controller_init_thread_func,
+ NULL)==FALSE)
{
DEBUG_ERR_MSG("Failed to push onto the queue");
}
void net_nfc_server_controller_deinit(void)
{
net_nfc_server_controller_async_queue_push(
- controller_deinit_thread_func,
- NULL);
+ controller_deinit_thread_func,
+ NULL);
}
#endif
gboolean net_nfc_server_controller_async_queue_push(
- net_nfc_server_controller_func func,
- gpointer user_data)
+ net_nfc_server_controller_func func,
+ gpointer user_data)
{
ControllerFuncData *func_data;
void net_nfc_server_restart_polling_loop(void)
{
if(net_nfc_server_controller_async_queue_push(
- restart_polling_loop_thread_func,
- NULL) == FALSE)
+ restart_polling_loop_thread_func,
+ NULL) == FALSE)
{
DEBUG_ERR_MSG("Failed to push onto the queue");
}
#include "security-server.h"
#endif
-#include "net_nfc_manager.h"
+#include "net_nfc_server.h"
#include "net_nfc_debug_internal.h"
#include "net_nfc_util_internal.h"
#include "net_nfc_util_defines.h"
#include "net_nfc_util_gdbus_internal.h"
#include "net_nfc_server.h"
-#include "net_nfc_server_context_internal.h"
+#include "net_nfc_server_context.h"
static GHashTable *client_contexts;
/* TODO */
bool net_nfc_server_gdbus_check_privilege(GDBusMethodInvocation *invocation,
- GVariant *privilege,
- const char *object,
- const char *right)
+ GVariant *privilege,
+ const char *object,
+ const char *right)
{
#ifdef SECURITY_SERVER
data_s priv = { NULL, 0 };
if (result < 0) {
DEBUG_ERR_MSG("permission denied : \"%s\", \"%s\"", object, right);
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Privilege",
- "Permission denied");
+ "org.tizen.NetNfcService.Privilege",
+ "Permission denied");
return false;
}
}
net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context_no_lock(
- const char *id)
+ const char *id)
{
net_nfc_client_context_info_t *result;
}
net_nfc_client_context_info_t *net_nfc_server_gdbus_get_client_context(
- const char *id)
+ const char *id)
{
net_nfc_client_context_info_t *result;
}
void net_nfc_server_gdbus_add_client_context(const char *id,
- client_state_e state)
+ client_state_e state)
{
pthread_mutex_lock(&context_lock);
info->launch_popup_state_no_check = NET_NFC_LAUNCH_APP_SELECT;
g_hash_table_insert(client_contexts,
- (gpointer)info->id,
- (gpointer)info);
+ (gpointer)info->id,
+ (gpointer)info);
DEBUG_SERVER_MSG("current client count = [%d]",
- net_nfc_server_gdbus_get_client_count_no_lock());
+ net_nfc_server_gdbus_get_client_count_no_lock());
}
else
{
if (info != NULL)
{
DEBUG_SERVER_MSG("clean up client context, [%s, %d]", info->id,
- info->pid);
+ info->pid);
g_hash_table_remove(client_contexts, id);
_cleanup_client_context(info);
DEBUG_SERVER_MSG("current client count = [%d]",
- net_nfc_server_gdbus_get_client_count_no_lock());
-
-// /* TODO : exit when no client */
-// if (net_nfc_server_gdbus_get_client_count_no_lock() == 0)
-// {
-// /* terminate service */
-// net_nfc_manager_quit();
-// }
+ net_nfc_server_gdbus_get_client_count_no_lock());
+
+ ///* TODO : exit when no client */
+ //if (net_nfc_server_gdbus_get_client_count_no_lock() == 0)
+ //{
+ // /* terminate service */
+ // net_nfc_manager_quit();
+ //}
}
pthread_mutex_unlock(&context_lock);
}
void net_nfc_server_gdbus_for_each_client_context(
- net_nfc_server_gdbus_for_each_client_cb cb,
- void *user_param)
+ net_nfc_server_gdbus_for_each_client_cb cb,
+ void *user_param)
{
GHashTableIter iter;
char *id;
g_hash_table_iter_init(&iter, client_contexts);
while (g_hash_table_iter_next(&iter, (gpointer *)&id,
- (gpointer *)&info) == true) {
+ (gpointer *)&info) == true) {
cb(info, user_param);
}
}
void net_nfc_server_gdbus_set_launch_state(const char *id,
- net_nfc_launch_popup_state_e popup_state,
- net_nfc_launch_popup_check_e check_foreground)
+ net_nfc_launch_popup_state_e popup_state,
+ net_nfc_launch_popup_check_e check_foreground)
{
net_nfc_client_context_info_t *info;
}
net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_launch_state(
- const char *id)
+ const char *id)
{
net_nfc_client_context_info_t *info;
net_nfc_launch_popup_state_e result = NET_NFC_LAUNCH_APP_SELECT;
info = net_nfc_server_gdbus_get_client_context_no_lock(id);
if (info != NULL) {
if (info->launch_popup_state_no_check ==
- NET_NFC_NO_LAUNCH_APP_SELECT) {
+ NET_NFC_NO_LAUNCH_APP_SELECT) {
result = NET_NFC_NO_LAUNCH_APP_SELECT;
} else {
result = info->launch_popup_state;
}
net_nfc_launch_popup_state_e net_nfc_server_gdbus_get_client_popup_state(
- pid_t pid)
+ pid_t pid)
{
GHashTableIter iter;
char *id;
g_hash_table_iter_init(&iter, client_contexts);
while (g_hash_table_iter_next(&iter, (gpointer *)&id,
- (gpointer *)&temp) == true) {
+ (gpointer *)&temp) == true) {
if (temp->launch_popup_state_no_check ==
- NET_NFC_NO_LAUNCH_APP_SELECT) {
+ NET_NFC_NO_LAUNCH_APP_SELECT) {
state = NET_NFC_NO_LAUNCH_APP_SELECT;
break;
}
g_hash_table_iter_init(&iter, client_contexts);
while (g_hash_table_iter_next(&iter, (gpointer *)&id,
- (gpointer *)&info) == true) {
+ (gpointer *)&info) == true) {
if (info->ref_se > 0) {
result = true;
break;
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __NET_NFC_SERVER_CONTEXT_INTERNAL_H__
-#define __NET_NFC_SERVER_CONTEXT_INTERNAL_H__
+#ifndef __NET_NFC_SERVER_CONTEXT_H__
+#define __NET_NFC_SERVER_CONTEXT_H__
#include <unistd.h>
#include <glib.h>
bool net_nfc_server_gdbus_is_server_busy();
-#endif //__NET_NFC_SERVER_CONTEXT_INTERNAL_H__
+#endif //__NET_NFC_SERVER_CONTEXT_H__
\ No newline at end of file
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#define _GNU_SOURCE
#include <linux/limits.h>
#include <stdio.h>
#include <dlfcn.h>
#include <pmapi.h>/*for pm lock*/
#include "net_nfc_oem_controller.h"
-#include "net_nfc_controller_internal.h"
+#include "net_nfc_server_controller.h"
#include "net_nfc_util_internal.h"
#include "net_nfc_debug_internal.h"
#include "net_nfc_server_tag.h"
static net_nfc_oem_interface_s g_interface;
static void *net_nfc_controller_load_file(const char *dir_path,
- const char *filename)
+ const char *filename)
{
void *handle = NULL;
char path[PATH_MAX] = { '\0' };
if (handle == NULL) {
char buffer[1024];
DEBUG_ERR_MSG("dlopen failed, [%d] : %s",
- errno, strerror_r(errno, buffer, sizeof(buffer)));
+ errno, strerror_r(errno, buffer, sizeof(buffer)));
goto ERROR;
}
if (onload == NULL) {
char buffer[1024];
DEBUG_ERR_MSG("dlsym failed, [%d] : %s",
- errno, strerror_r(errno, buffer, sizeof(buffer)));
+ errno, strerror_r(errno, buffer, sizeof(buffer)));
goto ERROR;
}
if (net_nfc_controller_support_nfc(&result) == false) {
DEBUG_ERR_MSG("net_nfc_controller_support_nfc failed, [%d]",
- result);
+ result);
goto ERROR;
}
continue;
handle = net_nfc_controller_load_file(NFC_MANAGER_MODULEDIR,
- dir->d_name);
+ dir->d_name);
if (handle)
{
SECURE_LOGD("Successfully loaded : %s",
/* load default plugin */
handle = net_nfc_controller_load_file(NFC_MANAGER_MODULEDIR,
- NET_NFC_DEFAULT_PLUGIN);
+ NET_NFC_DEFAULT_PLUGIN);
if (handle)
{
}
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)
+ se_transaction_listener_cb se_transaction_listener, llcp_event_listener_cb llcp_event_listener, net_nfc_error_e *result)
{
if (g_interface.register_listener != NULL)
{
ret_val = pm_lock_state(LCD_NORMAL, GOTO_STATE_NOW, 0);
+ DEBUG_SERVER_MSG("pm_lock_state [%d]!!", ret_val);
+
if (g_interface.secure_element_open != NULL)
{
return g_interface.secure_element_open(element_type, handle, result);
int ret_val = 0;
ret_val = pm_unlock_state(LCD_NORMAL, PM_RESET_TIMER);
+ DEBUG_SERVER_MSG("pm_unlock_state [%d]!!", ret_val);
if (g_interface.secure_element_close != NULL)
{
}
}
-bool net_nfc_controller_write_ndef(net_nfc_target_handle_s *handle, data_s *data, net_nfc_error_e *result)
+bool net_nfc_controller_write_ndef(net_nfc_target_handle_s *handle, data_s *data,
+ net_nfc_error_e *result)
{
if (g_interface.write_ndef != NULL)
{
}
}
-bool net_nfc_controller_make_read_only_ndef(net_nfc_target_handle_s *handle, net_nfc_error_e *result)
+bool net_nfc_controller_make_read_only_ndef(net_nfc_target_handle_s *handle,
+ net_nfc_error_e *result)
{
if (g_interface.make_read_only_ndef != NULL)
{
}
}
-bool net_nfc_controller_format_ndef(net_nfc_target_handle_s *handle, data_s *secure_key, net_nfc_error_e *result)
+bool net_nfc_controller_format_ndef(net_nfc_target_handle_s *handle,
+ data_s *secure_key, net_nfc_error_e *result)
{
if (g_interface.format_ndef != NULL)
{
}
}
-bool net_nfc_controller_transceive(net_nfc_target_handle_s *handle, net_nfc_transceive_info_s *info, data_s **data, net_nfc_error_e *result)
+bool net_nfc_controller_transceive(net_nfc_target_handle_s *handle,
+ net_nfc_transceive_info_s *info, data_s **data, net_nfc_error_e *result)
{
if (g_interface.transceive != NULL)
{
}
}
-bool net_nfc_controller_llcp_config(net_nfc_llcp_config_info_s *config, net_nfc_error_e *result)
+bool net_nfc_controller_llcp_config(net_nfc_llcp_config_info_s *config,
+ net_nfc_error_e *result)
{
if (g_interface.config_llcp != NULL)
{
return false;
}
}
-bool net_nfc_controller_llcp_check_llcp(net_nfc_target_handle_s *handle, net_nfc_error_e *result)
+bool net_nfc_controller_llcp_check_llcp(net_nfc_target_handle_s *handle,
+ net_nfc_error_e *result)
{
if (g_interface.check_llcp_status != NULL)
{
return false;
}
}
-bool net_nfc_controller_llcp_activate_llcp(net_nfc_target_handle_s *handle, net_nfc_error_e *result)
+bool net_nfc_controller_llcp_activate_llcp(net_nfc_target_handle_s *handle,
+ net_nfc_error_e *result)
{
if (g_interface.activate_llcp != NULL)
{
GSList *item;
item = g_slist_find_custom(llcp_sockets, GUINT_TO_POINTER(socket),
- _compare_socket_info);
+ _compare_socket_info);
if (item != NULL) {
result = (socket_info_t *)item->data;
} else {
GSList *item;
item = g_slist_find_custom(llcp_sockets, GUINT_TO_POINTER(socket),
- _compare_socket_info);
+ _compare_socket_info);
if (item != NULL) {
llcp_sockets = g_slist_remove_link(llcp_sockets, item);
free(item->data);
}
}
-static void _destroy_function(gpointer data)
-{
- free(data);
-}
-
-static void _clear_socket_info()
-{
- g_slist_free_full(llcp_sockets, _destroy_function);
- llcp_sockets = NULL;
-}
-
void net_nfc_controller_llcp_socket_error_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result, void *data, void *user_param)
+ net_nfc_error_e result, void *data, void *user_param)
{
socket_info_t *info;
}
}
-bool net_nfc_controller_llcp_create_socket(net_nfc_llcp_socket_t *socket, net_nfc_socket_type_e socketType, uint16_t miu, uint8_t rw, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_create_socket(net_nfc_llcp_socket_t *socket,
+ net_nfc_socket_type_e socketType, uint16_t miu, uint8_t rw, net_nfc_error_e *result,
+ net_nfc_service_llcp_cb cb, void *user_param)
{
if (g_interface.create_llcp_socket != NULL)
{
}
}
-bool net_nfc_controller_llcp_bind(net_nfc_llcp_socket_t socket, uint8_t service_access_point, net_nfc_error_e *result)
+bool net_nfc_controller_llcp_bind(net_nfc_llcp_socket_t socket,
+ uint8_t service_access_point, net_nfc_error_e *result)
{
if (g_interface.bind_llcp_socket != NULL)
{
}
void net_nfc_controller_llcp_incoming_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result, void *data, void *user_param)
+ net_nfc_error_e result, void *data, void *user_param)
{
socket_info_t *info = (socket_info_t *)user_param;
if (_add_socket_info(socket) != NULL) {
if (info->work_cb != NULL) {
info->work_cb(socket, result, NULL, NULL,
- info->work_param);
+ info->work_param);
}
} else {
DEBUG_ERR_MSG("_net_nfc_util_alloc_mem failed");
}
}
-bool net_nfc_controller_llcp_listen(net_nfc_target_handle_s* handle, uint8_t *service_access_name, net_nfc_llcp_socket_t socket, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_listen(net_nfc_target_handle_s* handle,
+ uint8_t *service_access_name, net_nfc_llcp_socket_t socket, net_nfc_error_e *result,
+ net_nfc_service_llcp_cb cb, void *user_param)
{
if (g_interface.listen_llcp_socket != NULL)
{
}
}
-bool net_nfc_controller_llcp_accept(net_nfc_llcp_socket_t socket, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_accept(net_nfc_llcp_socket_t socket,
+ net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
{
if (g_interface.accept_llcp_socket != NULL)
{
}
}
-bool net_nfc_controller_llcp_reject(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, net_nfc_error_e *result)
+bool net_nfc_controller_llcp_reject(net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket, net_nfc_error_e *result)
{
if (g_interface.reject_llcp != NULL)
{
}
void net_nfc_controller_llcp_connected_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result, void *data, void *user_param)
+ net_nfc_error_e result, void *data, void *user_param)
{
net_nfc_llcp_param_t *param = (net_nfc_llcp_param_t *)user_param;
_net_nfc_util_free_mem(param);
}
-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, net_nfc_service_llcp_cb cb, void *user_param)
+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,
+ net_nfc_service_llcp_cb cb, void *user_param)
{
int ret_val = 0;
}
}
-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, net_nfc_service_llcp_cb cb, void *user_param)
+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,
+ net_nfc_service_llcp_cb cb, void *user_param)
{
int ret_val = 0;
}
void net_nfc_controller_llcp_disconnected_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result, void *data, void *user_param)
+ net_nfc_error_e result, void *data, void *user_param)
{
net_nfc_llcp_param_t *param = (net_nfc_llcp_param_t *)user_param;
_net_nfc_util_free_mem(param);
}
-bool net_nfc_controller_llcp_disconnect(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_disconnect(net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket, net_nfc_error_e *result, net_nfc_service_llcp_cb cb,
+ void *user_param)
{
int ret_val = 0;
}
}
-bool net_nfc_controller_llcp_socket_close(net_nfc_llcp_socket_t socket, net_nfc_error_e *result)
+bool net_nfc_controller_llcp_socket_close(net_nfc_llcp_socket_t socket,
+ net_nfc_error_e *result)
{
if (g_interface.close_llcp_socket != NULL)
{
}
void net_nfc_controller_llcp_received_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result, void *data, void *user_param)
+ net_nfc_error_e result, void *data, void *user_param)
{
net_nfc_llcp_param_t *param = (net_nfc_llcp_param_t *)user_param;
_net_nfc_util_free_mem(param);
}
-bool net_nfc_controller_llcp_recv(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, uint32_t max_len, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_recv(net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket, uint32_t max_len, net_nfc_error_e *result,
+ net_nfc_service_llcp_cb cb, void *user_param)
{
if (g_interface.recv_llcp != NULL)
{
}
void net_nfc_controller_llcp_sent_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result, void *data, void *user_param)
+ net_nfc_error_e result, void *data, void *user_param)
{
net_nfc_llcp_param_t *param = (net_nfc_llcp_param_t *)user_param;
_net_nfc_util_free_mem(param);
}
-bool net_nfc_controller_llcp_send(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, data_s *data, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_send(net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket, data_s *data, net_nfc_error_e *result,
+ net_nfc_service_llcp_cb cb, void *user_param)
{
if (g_interface.send_llcp != NULL)
{
return false;
}
}
-bool net_nfc_controller_llcp_recv_from(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, uint32_t max_len, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_recv_from(net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket, uint32_t max_len, net_nfc_error_e *result,
+ net_nfc_service_llcp_cb cb, void *user_param)
{
if (g_interface.recv_from_llcp != NULL)
{
return false;
}
}
-bool net_nfc_controller_llcp_send_to(net_nfc_target_handle_s *handle, net_nfc_llcp_socket_t socket, data_s *data, uint8_t service_access_point, net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
+bool net_nfc_controller_llcp_send_to(net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket, data_s *data, uint8_t service_access_point,
+ net_nfc_error_e *result, net_nfc_service_llcp_cb cb, void *user_param)
{
if (g_interface.send_to_llcp != NULL)
{
}
}
-bool net_nfc_controller_llcp_get_remote_config(net_nfc_target_handle_s *handle, net_nfc_llcp_config_info_s *config, net_nfc_error_e *result)
+bool net_nfc_controller_llcp_get_remote_config(net_nfc_target_handle_s *handle,
+ net_nfc_llcp_config_info_s *config, net_nfc_error_e *result)
{
if (g_interface.get_remote_config != NULL)
{
return false;
}
}
-bool net_nfc_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)
+bool net_nfc_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)
{
if (g_interface.get_remote_socket_info != NULL)
{
}
}
-bool net_nfc_controller_eedata_register_set(net_nfc_error_e *result, uint32_t mode, uint32_t reg_id, data_s *data)
+bool net_nfc_controller_eedata_register_set(net_nfc_error_e *result,
+ uint32_t mode, uint32_t reg_id, data_s *data)
{
if (g_interface.eedata_register_set != NULL)
{
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __NET_NFC_CONTROLLER_INTERNAL_H__
-#define __NET_NFC_CONTROLLER_INTERNAL_H__
+#ifndef __NET_NFC_SERVER_CONTROLLER_H__
+#define __NET_NFC_SERVER_CONTROLLER_H__
#include "net_nfc_typedef_internal.h"
socket_info_t *_get_socket_info(net_nfc_llcp_socket_t socket);
socket_info_t *_add_socket_info(net_nfc_llcp_socket_t socket);
-#endif //__NET_NFC_CONTROLLER_INTERNAL_H__
+#endif //__NET_NFC_SERVER_CONTROLLER_H__
\ No newline at end of file
#include "net_nfc_server_process_handover.h"
#include "net_nfc_server_handover.h"
#include "net_nfc_debug_internal.h"
-#include "net_nfc_controller_internal.h"
+#include "net_nfc_server_controller.h"
#include "net_nfc_util_gdbus_internal.h"
-#include "net_nfc_server_context_internal.h"
+#include "net_nfc_server_context.h"
static NetNfcGDbusHandover *handover_skeleton = NULL;
static void handover_request_thread_func(gpointer user_data);
static gboolean handover_handle_request(NetNfcGDbusHandover *hdover,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- gint32 arg_type,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ gint32 arg_type,
+ GVariant *smack_privilege,
+ gpointer user_data);
static void handover_request_thread_func(gpointer user_data)
{
if (handover_data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- handover_data->invocation,
- "org.tizen.NetNfcService.Handover.DataError",
- "Handover invocation is NULL");
+ handover_data->invocation,
+ "org.tizen.NetNfcService.Handover.DataError",
+ "Handover invocation is NULL");
g_object_unref(handover_data->invocation);
}
handle = GUINT_TO_POINTER(handover_data->handle);
if ((error = net_nfc_server_handover_default_client_start(
- handle,
- (void *)handover_data)) != NET_NFC_OK)
+ handle,
+ (void *)handover_data)) != NET_NFC_OK)
{
if (handover_data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- handover_data->invocation,
- "org.tizen.NetNfcService.Handover.SendError",
- "handover operation unsuccessfull");
+ handover_data->invocation,
+ "org.tizen.NetNfcService.Handover.SendError",
+ "handover operation unsuccessfull");
g_object_unref(handover_data->invocation);
}
}
static gboolean handover_handle_request(NetNfcGDbusHandover *hdover,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- gint32 arg_type,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ gint32 arg_type,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
HandoverRequestData *data;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::p2p",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager::p2p",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->invocation = g_object_ref(invocation);
if (net_nfc_server_controller_async_queue_push(
- handover_request_thread_func, data) == FALSE)
+ handover_request_thread_func, data) == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
"org.tizen.NetNfcService.Handover.ThreadError",
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#include <glib.h>
+#include "net_nfc_debug_internal.h"
+#include "net_nfc_util_internal.h"
#include "net_nfc_util_handover.h"
+#include "net_nfc_util_ndef_message.h"
+#include "net_nfc_util_ndef_record.h"
+#include "net_nfc_server_llcp.h"
#include "net_nfc_server_handover_bss.h"
static int _net_nfc_handover_bss_process_carrier_record(
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-
#ifndef __NET_NFC_SERVER_HANDOVER_BSS_H__
#define __NET_NFC_SERVER_HANDOVER_BSS_H__
-#include <gio/gio.h>
+
#include <wifi.h>
-#include "net_nfc_debug_internal.h"
-#include "net_nfc_util_internal.h"
-#include "net_nfc_util_ndef_message.h"
-#include "net_nfc_util_ndef_record.h"
-#include "net_nfc_util_handover.h"
-#include "net_nfc_server_handover_internal.h"
-#include "net_nfc_server_llcp.h"
+
+#include "net_nfc_typedef_internal.h"
+#include "net_nfc_server_handover_bt.h"
typedef struct _net_nfc_handover_bss_process_context_t
{
ndef_record_s *record,
net_nfc_server_handover_process_carrier_record_cb cb,
void *user_param);
+
#endif //__NET_NFC_SERVER_HANDOVER_BSS_H__
#include "net_nfc_util_ndef_message.h"
#include "net_nfc_util_ndef_record.h"
#include "net_nfc_util_handover.h"
-#include "net_nfc_server_handover_internal.h"
+#include "net_nfc_server_handover_bt.h"
#include "net_nfc_server_llcp.h"
static int _net_nfc_handover_bt_get_carrier_record(
- net_nfc_handover_bt_get_context_t *context);
+ net_nfc_handover_bt_get_context_t *context);
static int _net_nfc_handover_bt_process_carrier_record(
- net_nfc_handover_bt_process_context_t *context);
+ net_nfc_handover_bt_process_context_t *context);
static net_nfc_error_e _net_nfc_handover_bt_get_oob_data(
- net_nfc_carrier_config_s *config,
- bt_oob_data_t *oob)
+ net_nfc_carrier_config_s *config,
+ bt_oob_data_t *oob)
{
net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
data_s hash = { NULL, 0 };
else
{
DEBUG_ERR_MSG("randomizer.length error :"
- " [%d] bytes", randomizer.length);
+ " [%d] bytes", randomizer.length);
}
}
}
static void _net_nfc_handover_bt_get_carrier_config_cb(
- int event,
- bluetooth_event_param_t *param,
- void *user_data)
+ int event,
+ bluetooth_event_param_t *param,
+ void *user_data)
{
net_nfc_handover_bt_get_context_t *context =
(net_nfc_handover_bt_get_context_t *)user_data;
default :
DEBUG_SERVER_MSG("unhandled bt event [%d],"
- "[0x%04x]", event, param->result);
+ "[0x%04x]", event, param->result);
break;
}
}
static net_nfc_error_e _net_nfc_handover_bt_create_config_record(
- ndef_record_s **record)
+ ndef_record_s **record)
{
bluetooth_device_address_t bt_addr = { { 0, } };
net_nfc_carrier_config_s *config = NULL;
== BLUETOOTH_ERROR_NONE)
{
if ((result = net_nfc_util_create_carrier_config(
- &config,
- NET_NFC_CONN_HANDOVER_CARRIER_BT)) == NET_NFC_OK)
+ &config,
+ NET_NFC_CONN_HANDOVER_CARRIER_BT)) == NET_NFC_OK)
{
bt_oob_data_t oob = { { 0 }, };
NET_NFC_REVERSE_ORDER_6_BYTES(bt_addr.addr);
if ((result = net_nfc_util_add_carrier_config_property(
- config,
- NET_NFC_BT_ATTRIBUTE_ADDRESS,
- sizeof(bt_addr.addr), bt_addr.addr)) != NET_NFC_OK)
+ config,
+ NET_NFC_BT_ATTRIBUTE_ADDRESS,
+ sizeof(bt_addr.addr), bt_addr.addr)) != NET_NFC_OK)
{
DEBUG_ERR_MSG("net_nfc_util_add_carrier"
- "_config_property failed"
- "[%d]", result);
+ "_config_property failed"
+ "[%d]", result);
}
/* get oob data */
if (oob.hash_len == 16 && oob.randomizer_len == 16)
{
DEBUG_SERVER_MSG("oob.hash_len "
- "[%d]", oob.hash_len);
+ "[%d]", oob.hash_len);
DEBUG_SERVER_MSG("oob.randomizer_len"
- " [%d]", oob.randomizer_len);
+ " [%d]", oob.randomizer_len);
NET_NFC_REVERSE_ORDER_16_BYTES(oob.hash);
if ((result =
- net_nfc_util_add_carrier_config_property(
- config,
- NET_NFC_BT_ATTRIBUTE_OOB_HASH_C,
- oob.hash_len, oob.hash)) != NET_NFC_OK)
+ net_nfc_util_add_carrier_config_property(
+ config,
+ NET_NFC_BT_ATTRIBUTE_OOB_HASH_C,
+ oob.hash_len, oob.hash)) != NET_NFC_OK)
{
DEBUG_ERR_MSG("net_nfc_util_add_carrier"
- "_config_property failed"
- " [%d]",result);
+ "_config_property failed"
+ " [%d]",result);
}
NET_NFC_REVERSE_ORDER_16_BYTES(oob.randomizer);
if ((result = net_nfc_util_add_carrier_config_property(
- config,
- NET_NFC_BT_ATTRIBUTE_OOB_HASH_R,
- oob.randomizer_len,
- oob.randomizer)) != NET_NFC_OK)
+ config,
+ NET_NFC_BT_ATTRIBUTE_OOB_HASH_R,
+ oob.randomizer_len,
+ oob.randomizer)) != NET_NFC_OK)
{
DEBUG_ERR_MSG("net_nfc_util_add_carrier"
- "_config_property failed"
- " [%d]",result);
+ "_config_property failed"
+ " [%d]",result);
}
}
else
}
if ((result = net_nfc_util_create_ndef_record_with_carrier_config(
- record,
- config)) != NET_NFC_OK)
+ record,
+ config)) != NET_NFC_OK)
{
DEBUG_ERR_MSG("net_nfc_util_create_ndef_record"
- "_with_carrier_config failed"
- "[%d]",result);
+ "_with_carrier_config failed"
+ "[%d]",result);
}
net_nfc_util_free_carrier_config(config);
else
{
DEBUG_ERR_MSG("net_nfc_util_create_carrier_config failed "
- "[%d]", result);
+ "[%d]", result);
}
}
else
{
DEBUG_ERR_MSG("bluetooth_get_local_address failed"
- " [%d]", result);
+ " [%d]", result);
result = NET_NFC_OPERATION_FAIL;
}
}
static int _net_nfc_handover_bt_get_carrier_record(
- net_nfc_handover_bt_get_context_t *context)
+ net_nfc_handover_bt_get_context_t *context)
{
LOGD("[%s:%d] START", __func__, __LINE__);
if (context->result != NET_NFC_OK && context->result != NET_NFC_BUSY)
{
DEBUG_ERR_MSG("context->result is error"
- " [%d]", context->result);
+ " [%d]", context->result);
context->step = NET_NFC_LLCP_STEP_RETURN;
}
DEBUG_MSG("STEP [1]");
if (bluetooth_register_callback(
- _net_nfc_handover_bt_get_carrier_config_cb,
- context) >= BLUETOOTH_ERROR_NONE)
+ _net_nfc_handover_bt_get_carrier_config_cb,
+ context) >= BLUETOOTH_ERROR_NONE)
{
context->step = NET_NFC_LLCP_STEP_02;
context->result = NET_NFC_OK;
/* do next step */
g_idle_add((GSourceFunc)
- _net_nfc_handover_bt_get_carrier_record,
- (gpointer)context);
+ _net_nfc_handover_bt_get_carrier_record,
+ (gpointer)context);
}
}
else
context->result = NET_NFC_OPERATION_FAIL;
g_idle_add((GSourceFunc)
- _net_nfc_handover_bt_get_carrier_record,
- (gpointer)context);
+ _net_nfc_handover_bt_get_carrier_record,
+ (gpointer)context);
}
break;
/* append config to ndef message */
if ((context->result =
- _net_nfc_handover_bt_create_config_record(
- &context->carrier)) != NET_NFC_OK)
+ _net_nfc_handover_bt_create_config_record(
+ &context->carrier)) != NET_NFC_OK)
{
DEBUG_ERR_MSG("_ch_create_bt_config_record failed"
- "[%d]", context->result);
+ "[%d]", context->result);
}
/* complete and return to upper step */
g_idle_add((GSourceFunc)
- _net_nfc_handover_bt_get_carrier_record,
- (gpointer)context);
+ _net_nfc_handover_bt_get_carrier_record,
+ (gpointer)context);
break;
case NET_NFC_LLCP_STEP_RETURN :
/* complete and return to upper step */
context->cb(context->result,
- context->cps,
- context->carrier,
- context->aux_data_count,
- context->aux_data,
- context->user_param);
+ context->cps,
+ context->carrier,
+ context->aux_data_count,
+ context->aux_data,
+ context->user_param);
break;
default :
context->cps = NET_NFC_CONN_HANDOVER_CARRIER_ACTIVATE;
g_idle_add((GSourceFunc)_net_nfc_handover_bt_get_carrier_record,
- (gpointer)context);
+ (gpointer)context);
}
else
{
bluetooth_device_info_t *ptr;
DEBUG_SERVER_MSG("g pointer array count :"
- " [%d]", devinfo->len);
+ " [%d]", devinfo->len);
for (i = 0; i < devinfo->len; i++)
{
{
SECURE_LOGD("Name [%s]", ptr->device_name.name);
DEBUG_SERVER_MSG("Major Class [%d]",
- ptr->device_class.major_class);
+ ptr->device_class.major_class);
DEBUG_SERVER_MSG("Minor Class [%d]",
- ptr->device_class.minor_class);
+ ptr->device_class.minor_class);
DEBUG_SERVER_MSG("Service Class [%d]",
- ptr->device_class.service_class);
+ ptr->device_class.service_class);
DEBUG_SERVER_MSG("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
- ptr->device_address.addr[0],
- ptr->device_address.addr[1],
- ptr->device_address.addr[2],
- ptr->device_address.addr[3],
- ptr->device_address.addr[4],
- ptr->device_address.addr[5]);
+ ptr->device_address.addr[0],
+ ptr->device_address.addr[1],
+ ptr->device_address.addr[2],
+ ptr->device_address.addr[3],
+ ptr->device_address.addr[4],
+ ptr->device_address.addr[5]);
/* compare selector address */
if (memcmp(&(ptr->device_address),
- address,
- sizeof(ptr->device_address)) == 0)
+ address,
+ sizeof(ptr->device_address)) == 0)
{
DEBUG_SERVER_MSG("Found!!!");
result = true;
else
{
DEBUG_ERR_MSG("bluetooth_get_bonded_device_list failed with"
- " [%d]", ret);
+ " [%d]", ret);
}
/* free g_pointer_array */
if (context->result != NET_NFC_OK && context->result != NET_NFC_BUSY)
{
DEBUG_ERR_MSG("context->result is error"
- " [%d]", context->result);
+ " [%d]", context->result);
context->step = NET_NFC_LLCP_STEP_RETURN;
}
DEBUG_MSG("STEP [1]");
if (bluetooth_register_callback(
- _net_nfc_handover_bt_process_carrier_record_cb,
- context) >= BLUETOOTH_ERROR_NONE)
+ _net_nfc_handover_bt_process_carrier_record_cb,
+ context) >= BLUETOOTH_ERROR_NONE)
{
/* next step */
context->step = NET_NFC_LLCP_STEP_02;
context->result = NET_NFC_OK;
g_idle_add((GSourceFunc)
- _net_nfc_handover_bt_process_carrier_record,
- (gpointer)context);
+ _net_nfc_handover_bt_process_carrier_record,
+ (gpointer)context);
}
}
else
context->result = NET_NFC_OPERATION_FAIL;
g_idle_add(
- (GSourceFunc)_net_nfc_handover_bt_process_carrier_record,
- (gpointer)context);
+ (GSourceFunc)_net_nfc_handover_bt_process_carrier_record,
+ (gpointer)context);
}
break;
context->carrier);
net_nfc_util_get_carrier_config_property(config,
- NET_NFC_BT_ATTRIBUTE_ADDRESS,
- (uint16_t *)&temp.length, &temp.buffer);
+ NET_NFC_BT_ATTRIBUTE_ADDRESS,
+ (uint16_t *)&temp.length, &temp.buffer);
if (temp.length == 6)
{
memcpy(context->addr.addr,
temp.buffer,
MIN(sizeof(context->addr.addr),
- temp.length));
+ temp.length));
if (_net_nfc_handover_bt_check_bond_device
- (&context->addr) == true)
+ (&context->addr) == true)
{
DEBUG_SERVER_MSG("already paired with"
- " [%02x:%02x:%02x:%02x:%02x:%02x]",
- context->addr.addr[0],
- context->addr.addr[1],
- context->addr.addr[2],
- context->addr.addr[3],
- context->addr.addr[4],
- context->addr.addr[5]);
+ " [%02x:%02x:%02x:%02x:%02x:%02x]",
+ context->addr.addr[0],
+ context->addr.addr[1],
+ context->addr.addr[2],
+ context->addr.addr[3],
+ context->addr.addr[4],
+ context->addr.addr[5]);
/* return */
context->step = NET_NFC_LLCP_STEP_RETURN;
bt_oob_data_t oob = { { 0 } , };
if (_net_nfc_handover_bt_get_oob_data(
- config,
- &oob) == NET_NFC_OK)
+ config,
+ &oob) == NET_NFC_OK)
{
/* set oob data */
bluetooth_oob_add_remote_data(
else
{
DEBUG_ERR_MSG("bluetooth address is invalid."
- " [%d] bytes", temp.length);
+ " [%d] bytes", temp.length);
context->step = NET_NFC_LLCP_STEP_RETURN;
context->result = NET_NFC_OPERATION_FAIL;
net_nfc_util_free_carrier_config(config);
g_idle_add(
- (GSourceFunc)_net_nfc_handover_bt_process_carrier_record,
- (gpointer)context);
+ (GSourceFunc)_net_nfc_handover_bt_process_carrier_record,
+ (gpointer)context);
}
break;
bluetooth_unregister_callback();
context->cb(context->result,
- NET_NFC_CONN_HANDOVER_CARRIER_BT,
- &data,
- context->user_param);
+ NET_NFC_CONN_HANDOVER_CARRIER_BT,
+ &data,
+ context->user_param);
}
break;
}
net_nfc_error_e net_nfc_server_handover_bt_process_carrier_record(
- ndef_record_s *record,
- net_nfc_server_handover_process_carrier_record_cb cb,
- void *user_param)
+ ndef_record_s *record,
+ net_nfc_server_handover_process_carrier_record_cb cb,
+ void *user_param)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_handover_bt_process_context_t *context = NULL;
context->user_param = user_param;
context->step = NET_NFC_LLCP_STEP_01;
net_nfc_util_create_record(record->TNF, &record->type_s,
- &record->id_s, &record->payload_s, &context->carrier);
+ &record->id_s, &record->payload_s, &context->carrier);
g_idle_add(
- (GSourceFunc)_net_nfc_handover_bt_process_carrier_record,
- (gpointer)context);
+ (GSourceFunc)_net_nfc_handover_bt_process_carrier_record,
+ (gpointer)context);
}
else
{
}
static void _net_nfc_handover_bt_post_process_cb(int event,
- bluetooth_event_param_t *param, void *user_data)
+ bluetooth_event_param_t *param, void *user_data)
{
net_nfc_handover_bt_process_context_t *context =
(net_nfc_handover_bt_process_context_t *)user_data;
case BLUETOOTH_EVENT_BONDING_FINISHED :
DEBUG_SERVER_MSG("BLUETOOTH_EVENT_BONDING_FINISHED,"
- " result [0x%04x]",param->result);
+ " result [0x%04x]",param->result);
if (param->result < BLUETOOTH_ERROR_NONE)
{
}
context->cb(context->result,
- NET_NFC_CONN_HANDOVER_CARRIER_BT,
- NULL,
- context->user_param);
+ NET_NFC_CONN_HANDOVER_CARRIER_BT,
+ NULL,
+ context->user_param);
break;
default :
DEBUG_SERVER_MSG("unhandled bt event"
- " [%d], [0x%04x]", event, param->result);
+ " [%d], [0x%04x]", event, param->result);
break;
}
}
net_nfc_error_e net_nfc_server_handover_bt_post_process(
- data_s *data,
- net_nfc_server_handover_process_carrier_record_cb cb,
- void *user_param)
+ data_s *data,
+ net_nfc_server_handover_process_carrier_record_cb cb,
+ void *user_param)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_handover_bt_process_context_t *context = NULL;
memcpy(&bt_addr.addr, data->buffer, sizeof(bt_addr.addr));
if (bluetooth_register_callback(
- _net_nfc_handover_bt_post_process_cb,
- context) >= BLUETOOTH_ERROR_NONE)
+ _net_nfc_handover_bt_post_process_cb,
+ context) >= BLUETOOTH_ERROR_NONE)
{
bluetooth_bond_device(&bt_addr);
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __NET_NFC_SERVER_HANDOVER_INTERNAL_H__
-#define __NET_NFC_SERVER_HANDOVER_INTERNAL_H__
+#ifndef __NET_NFC_SERVER_HANDOVER_BT_H__
+#define __NET_NFC_SERVER_HANDOVER_BT_H__
#include "net_nfc_typedef_internal.h"
data_s *data,
void *user_param);
-
/* alternative carrier functions */
net_nfc_error_e net_nfc_server_handover_bt_get_carrier_record(
net_nfc_server_handover_get_carrier_record_cb cb, void *user_param);
ndef_record_s *record, net_nfc_server_handover_process_carrier_record_cb cb,
void *user_param);
-net_nfc_error_e net_nfc_server_handover_bt_post_process(
- data_s *data, net_nfc_server_handover_process_carrier_record_cb cb,
+net_nfc_error_e net_nfc_server_handover_bt_post_process(data_s *data,
+ net_nfc_server_handover_process_carrier_record_cb cb,
void *user_param);
-
-
-/* handover server/client functions */
-net_nfc_error_e net_nfc_server_handover_default_server_start(
- net_nfc_target_handle_s *handle);
-
-net_nfc_error_e net_nfc_server_handover_default_client_start(
- net_nfc_target_handle_s *handle,
- void *user_data);
-
-#endif //__NET_NFC_SERVER_HANDOVER_INTERNAL_H__
+#endif //__NET_NFC_SERVER_HANDOVER_BT_H__
#include "net_nfc_server_tag.h"
#include "net_nfc_debug_internal.h"
-#include "net_nfc_controller_internal.h"
+#include "net_nfc_server_controller.h"
#include "net_nfc_util_gdbus_internal.h"
-#include "net_nfc_server_context_internal.h"
+#include "net_nfc_server_context.h"
/* default llcp configurations */
#define NET_NFC_LLCP_MIU 128
static void llcp_add_async_queue(net_nfc_request_msg_t *req_msg,
- net_nfc_server_controller_func func);
+ net_nfc_server_controller_func func);
static void llcp_socket_error_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void llcp_listen_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void llcp_connect_by_url_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void llcp_connect_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void llcp_send_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void llcp_receive_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void llcp_receive_from_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void llcp_disconnect_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
/* client method */
static void llcp_handle_config_thread_func(gpointer user_data);
/* methods */
static gboolean llcp_handle_config(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- GVariant *arg_config,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ GVariant *arg_config,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean llcp_handle_listen(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- guint16 arg_miu,
- guint8 arg_rw,
- gint32 arg_type,
- guint8 arg_sap,
- const gchar *arg_service_name,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ guint16 arg_miu,
+ guint8 arg_rw,
+ gint32 arg_type,
+ guint8 arg_sap,
+ const gchar *arg_service_name,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean llcp_handle_connect(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- guint16 arg_miu,
- guint8 arg_rw,
- gint32 arg_type,
- const gchar *arg_service_name,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ guint16 arg_miu,
+ guint8 arg_rw,
+ gint32 arg_type,
+ const gchar *arg_service_name,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean llcp_handle_connect_sap(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- guint16 arg_miu,
- guint8 arg_rw,
- gint32 arg_type,
- guint8 arg_sap,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ guint16 arg_miu,
+ guint8 arg_rw,
+ gint32 arg_type,
+ guint8 arg_sap,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean llcp_handle_send(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- GVariant *arg_data,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ GVariant *arg_data,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean llcp_handle_send_to(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- guint8 arg_sap,
- GVariant *arg_data,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ guint8 arg_sap,
+ GVariant *arg_data,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean llcp_handle_receive(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- guint32 arg_req_length,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ guint32 arg_req_length,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean llcp_handle_receive_from(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- guint32 arg_req_length,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ guint32 arg_req_length,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean llcp_handle_close(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean llcp_handle_disconnect(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ GVariant *smack_privilege,
+ gpointer user_data);
/* server side */
/* simple */
static void llcp_simple_socket_error_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void llcp_simple_listen_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void llcp_simple_connect_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void llcp_simple_server_error_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void llcp_simple_send_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void llcp_simple_receive_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void llcp_add_async_queue(net_nfc_request_msg_t *req_msg,
- net_nfc_server_controller_func func)
+ net_nfc_server_controller_func func)
{
ServerLlcpData *data = NULL;
}
static void llcp_socket_error_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpData *llcp_data;
}
static void llcp_listen_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpListenData *llcp_data;
if (llcp_data->invocation)
{
net_nfc_gdbus_llcp_complete_listen(llcp_data->llcp,
- llcp_data->invocation,
- llcp_data->client_socket,
- socket);
+ llcp_data->invocation,
+ llcp_data->client_socket,
+ socket);
g_object_unref(llcp_data->invocation);
}
}
static void llcp_connect_by_url_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpConnectData *llcp_data;
if (llcp_data->invocation)
{
net_nfc_gdbus_llcp_complete_connect(llcp_data->llcp,
- llcp_data->invocation,
- llcp_data->client_socket,
- socket);
+ llcp_data->invocation,
+ llcp_data->client_socket,
+ socket);
g_object_unref(llcp_data->invocation);
}
}
static void llcp_connect_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpConnectSapData *llcp_data;
if (llcp_data->invocation)
{
net_nfc_gdbus_llcp_complete_connect_sap(
- llcp_data->llcp,
- llcp_data->invocation,
- llcp_data->client_socket,
- socket);
+ llcp_data->llcp,
+ llcp_data->invocation,
+ llcp_data->client_socket,
+ socket);
g_object_unref(llcp_data->invocation);
}
}
static void llcp_send_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpData *llcp_data;
if (llcp_data->invocation)
{
net_nfc_gdbus_llcp_complete_send(
- llcp_data->llcp,
- llcp_data->invocation,
- socket);
+ llcp_data->llcp,
+ llcp_data->invocation,
+ socket);
g_object_unref(llcp_data->invocation);
}
}
static void llcp_receive_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpData *llcp_data;
variant = net_nfc_util_gdbus_data_to_variant(data);
net_nfc_gdbus_llcp_complete_receive(
- llcp_data->llcp,
- llcp_data->invocation,
- variant);
+ llcp_data->llcp,
+ llcp_data->invocation,
+ variant);
g_object_unref(llcp_data->invocation);
}
}
static void llcp_receive_from_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpData *llcp_data;
variant = net_nfc_util_gdbus_data_to_variant(data);
net_nfc_gdbus_llcp_complete_receive_from(
- llcp_data->llcp,
- llcp_data->invocation,
- (guint8) (int)extra,
- variant);
+ llcp_data->llcp,
+ llcp_data->invocation,
+ (guint8) (int)extra,
+ variant);
g_object_unref(llcp_data->invocation);
}
static void llcp_disconnect_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpData *llcp_data;
if (llcp_data->invocation)
{
net_nfc_gdbus_llcp_complete_disconnect(
- llcp_data->llcp,
- llcp_data->invocation,
- socket);
+ llcp_data->llcp,
+ llcp_data->invocation,
+ socket);
g_object_unref(llcp_data->invocation);
}
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ConfigError",
- "can not get llcp");
+ data->invocation,
+ "org.tizen.NetNfcService.ConfigError",
+ "can not get llcp");
g_object_unref(data->invocation);
}
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ConfigError",
- "can not get llcp");
+ data->invocation,
+ "org.tizen.NetNfcService.ConfigError",
+ "can not get llcp");
g_object_unref(data->invocation);
}
if (data->invocation)
{
net_nfc_gdbus_llcp_complete_config(data->llcp,
- data->invocation);
+ data->invocation);
g_object_unref(data->invocation);
}
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ListenError",
- "can not get llcp");
+ data->invocation,
+ "org.tizen.NetNfcService.ListenError",
+ "can not get llcp");
g_object_unref(data->invocation);
}
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(data->invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return;
}
error_data->llcp = g_object_ref(data->llcp);
error_data->invocation = g_object_ref(data->invocation);
if (net_nfc_controller_llcp_create_socket(&socket,
- data->type,
- data->miu,
- data->rw,
- &result,
- llcp_socket_error_cb,
- error_data) == false)
+ data->type,
+ data->miu,
+ data->rw,
+ &result,
+ llcp_socket_error_cb,
+ error_data) == false)
{
DEBUG_ERR_MSG("%s fiailed [%d]",
- "net_nfc_controller_llcp_create_socket" ,result);
+ "net_nfc_controller_llcp_create_socket" ,result);
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ListenError",
- "can not create socket");
+ data->invocation,
+ "org.tizen.NetNfcService.ListenError",
+ "can not create socket");
g_object_unref(data->invocation);
}
}
if (net_nfc_controller_llcp_bind(socket,
- data->sap,
- &result) == false)
+ data->sap,
+ &result) == false)
{
DEBUG_ERR_MSG("%s fiailed [%d]",
- "net_nfc_controller_llcp_create_socket" ,result);
+ "net_nfc_controller_llcp_create_socket" ,result);
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ListenError",
- "can not bind socket");
+ data->invocation,
+ "org.tizen.NetNfcService.ListenError",
+ "can not bind socket");
g_object_unref(data->invocation);
}
DEBUG_SERVER_MSG("OAL socket in Listen : %d\n", socket);
if (net_nfc_controller_llcp_listen(GUINT_TO_POINTER(data->handle),
- (uint8_t *)data->service_name,
- socket,
- &result,
- llcp_listen_cb,
- data) == false)
+ (uint8_t *)data->service_name,
+ socket,
+ &result,
+ llcp_listen_cb,
+ data) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
"net_nfc_controller_llcp_listen",
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ListenError",
- "can not listen socket");
+ data->invocation,
+ "org.tizen.NetNfcService.ListenError",
+ "can not listen socket");
g_object_unref(data->invocation);
}
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ConnectError",
- "can not get llcp");
+ data->invocation,
+ "org.tizen.NetNfcService.ConnectError",
+ "can not get llcp");
g_object_unref(data->invocation);
}
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(data->invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return;
}
error_data->llcp = g_object_ref(data->llcp);
error_data->invocation = g_object_ref(data->invocation);
if (net_nfc_controller_llcp_create_socket(&socket,
- data->type,
- data->miu,
- data->rw,
- &result,
- llcp_socket_error_cb,
- error_data) == false)
+ data->type,
+ data->miu,
+ data->rw,
+ &result,
+ llcp_socket_error_cb,
+ error_data) == false)
{
DEBUG_ERR_MSG("%s fiailed [%d]",
- "net_nfc_controller_llcp_create_socket" ,result);
+ "net_nfc_controller_llcp_create_socket" ,result);
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ConnectError",
- "can not create socket");
+ data->invocation,
+ "org.tizen.NetNfcService.ConnectError",
+ "can not create socket");
g_object_unref(data->invocation);
}
DEBUG_SERVER_MSG("OAL socket in Listen :%d", socket);
if (net_nfc_controller_llcp_connect_by_url(
- GUINT_TO_POINTER(data->handle),
- socket,
- (uint8_t *)data->service_name,
- &result,
- llcp_connect_by_url_cb,
- data) == false)
+ GUINT_TO_POINTER(data->handle),
+ socket,
+ (uint8_t *)data->service_name,
+ &result,
+ llcp_connect_by_url_cb,
+ data) == false)
{
DEBUG_ERR_MSG("%s failed, [%d]",
- "net_nfc_controller_llcp_connect_by_url",
- result);
+ "net_nfc_controller_llcp_connect_by_url",
+ result);
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ConnectError",
- "can not listen socket");
+ data->invocation,
+ "org.tizen.NetNfcService.ConnectError",
+ "can not listen socket");
g_object_unref(data->invocation);
}
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ConnectSapError",
- "can not get llcp");
+ data->invocation,
+ "org.tizen.NetNfcService.ConnectSapError",
+ "can not get llcp");
g_object_unref(data->invocation);
}
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(data->invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return;
}
error_data->llcp = g_object_ref(data->llcp);
error_data->invocation = g_object_ref(data->invocation);
if (net_nfc_controller_llcp_create_socket(&socket,
- data->type,
- data->miu,
- data->rw,
- &result,
- llcp_socket_error_cb,
- error_data) == false)
+ data->type,
+ data->miu,
+ data->rw,
+ &result,
+ llcp_socket_error_cb,
+ error_data) == false)
{
DEBUG_ERR_MSG("%s fiailed [%d]",
- "net_nfc_controller_llcp_create_socket" ,result);
+ "net_nfc_controller_llcp_create_socket" ,result);
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ConnectSapError",
- "can not create socket");
+ data->invocation,
+ "org.tizen.NetNfcService.ConnectSapError",
+ "can not create socket");
g_object_unref(data->invocation);
}
DEBUG_SERVER_MSG("OAL socket in Listen :%d", socket);
if (net_nfc_controller_llcp_connect(GUINT_TO_POINTER(data->handle),
- socket,
- data->sap,
- &result,
- llcp_connect_cb,
- data) == false)
+ socket,
+ data->sap,
+ &result,
+ llcp_connect_cb,
+ data) == false)
{
DEBUG_ERR_MSG("%s failed, [%d]",
- "net_nfc_controller_llcp_connect",
- result);
+ "net_nfc_controller_llcp_connect",
+ result);
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ConnectSapError",
- "can not connect socket");
+ data->invocation,
+ "org.tizen.NetNfcService.ConnectSapError",
+ "can not connect socket");
g_object_unref(data->invocation);
}
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.SendError",
- "can not get llcp");
+ data->invocation,
+ "org.tizen.NetNfcService.SendError",
+ "can not get llcp");
g_object_unref(data->invocation);
}
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(data->invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return;
}
llcp_data->llcp = g_object_ref(data->llcp);
llcp_data->invocation = g_object_ref(data->invocation);
if (net_nfc_controller_llcp_send(GUINT_TO_POINTER(data->handle),
- data->oal_socket,
- data->data,
- &result,
- llcp_send_cb,
- llcp_data) == false)
+ data->oal_socket,
+ data->data,
+ &result,
+ llcp_send_cb,
+ llcp_data) == false)
{
DEBUG_ERR_MSG("%s failed, [%d]",
- "net_nfc_controller_llcp_send",
- result);
+ "net_nfc_controller_llcp_send",
+ result);
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.SendError",
- "can not send socket");
+ data->invocation,
+ "org.tizen.NetNfcService.SendError",
+ "can not send socket");
g_object_unref(data->invocation);
}
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.SendToError",
- "can not get llcp");
+ data->invocation,
+ "org.tizen.NetNfcService.SendToError",
+ "can not get llcp");
g_object_unref(data->invocation);
}
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(data->invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return;
}
llcp_data->llcp = g_object_ref(data->llcp);
llcp_data->invocation = g_object_ref(data->invocation);
if (net_nfc_controller_llcp_send_to(GUINT_TO_POINTER(data->handle),
- data->oal_socket,
- data->data,
- data->sap,
- &result,
- llcp_send_cb,
- llcp_data) == false)
+ data->oal_socket,
+ data->data,
+ data->sap,
+ &result,
+ llcp_send_cb,
+ llcp_data) == false)
{
DEBUG_ERR_MSG("%s failed, [%d]",
- "net_nfc_controller_llcp_send_to",
- result);
+ "net_nfc_controller_llcp_send_to",
+ result);
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.SendToError",
- "can not send socket");
+ data->invocation,
+ "org.tizen.NetNfcService.SendToError",
+ "can not send socket");
g_object_unref(data->invocation);
}
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ReceiveError",
- "can not get llcp");
+ data->invocation,
+ "org.tizen.NetNfcService.ReceiveError",
+ "can not get llcp");
g_object_unref(data->invocation);
}
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(data->invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return;
}
llcp_data->llcp = g_object_ref(data->llcp);
llcp_data->invocation = g_object_ref(data->invocation);
if (net_nfc_controller_llcp_recv(GUINT_TO_POINTER(data->handle),
- data->oal_socket,
- data->req_length,
- &result,
- llcp_receive_cb,
- llcp_data) == false)
+ data->oal_socket,
+ data->req_length,
+ &result,
+ llcp_receive_cb,
+ llcp_data) == false)
{
DEBUG_ERR_MSG("%s failed, [%d]",
- "net_nfc_controller_llcp_receive",
- result);
+ "net_nfc_controller_llcp_receive",
+ result);
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ReceiveError",
- "can not receive");
+ data->invocation,
+ "org.tizen.NetNfcService.ReceiveError",
+ "can not receive");
g_object_unref(data->invocation);
}
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ReceiveFromError",
- "can not get llcp");
+ data->invocation,
+ "org.tizen.NetNfcService.ReceiveFromError",
+ "can not get llcp");
g_object_unref(data->invocation);
}
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(data->invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return;
}
llcp_data->llcp = g_object_ref(data->llcp);
llcp_data->invocation = g_object_ref(data->invocation);
if (net_nfc_controller_llcp_recv_from(GUINT_TO_POINTER(data->handle),
- data->oal_socket,
- data->req_length,
- &result,
- llcp_receive_from_cb,
- llcp_data) == false)
+ data->oal_socket,
+ data->req_length,
+ &result,
+ llcp_receive_from_cb,
+ llcp_data) == false)
{
DEBUG_ERR_MSG("%s failed, [%d]",
- "net_nfc_controller_llcp_receive",
- result);
+ "net_nfc_controller_llcp_receive",
+ result);
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.ReceiveFromError",
- "can not receive");
+ data->invocation,
+ "org.tizen.NetNfcService.ReceiveFromError",
+ "can not receive");
g_object_unref(data->invocation);
}
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.CloseError",
- "can not get llcp");
+ data->invocation,
+ "org.tizen.NetNfcService.CloseError",
+ "can not get llcp");
g_object_unref(data->invocation);
}
}
net_nfc_controller_llcp_socket_close(data->oal_socket,
- &result);
+ &result);
net_nfc_gdbus_llcp_complete_close(data->llcp,
- data->invocation,
- data->client_socket);
+ data->invocation,
+ data->client_socket);
}
static void llcp_handle_disconnect_thread_func(gpointer user_data)
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.DisconnectError",
- "can not get llcp");
+ data->invocation,
+ "org.tizen.NetNfcService.DisconnectError",
+ "can not get llcp");
g_object_unref(data->invocation);
}
net_nfc_server_free_target_info();
ret_val = pm_unlock_state(LCD_NORMAL, PM_RESET_TIMER);
DEBUG_SERVER_MSG("net_nfc_controller_disconnect pm_unlock_state"
- "[%d]!!", ret_val);
+ "[%d]!!", ret_val);
}
llcp_data = g_new0(LlcpData, 1);
llcp_data->invocation = g_object_ref(data->invocation);
if (net_nfc_controller_llcp_disconnect(GUINT_TO_POINTER(data->handle),
- data->oal_socket,
- &result,
- llcp_disconnect_cb,
- llcp_data) == false)
+ data->oal_socket,
+ &result,
+ llcp_disconnect_cb,
+ llcp_data) == false)
{
DEBUG_ERR_MSG("%s failed, [%d]",
- "net_nfc_controller_llcp_receive",
- result);
+ "net_nfc_controller_llcp_receive",
+ result);
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.DisconnectError",
- "can not disconnect socket");
+ data->invocation,
+ "org.tizen.NetNfcService.DisconnectError",
+ "can not disconnect socket");
g_object_unref(data->invocation);
}
static gboolean llcp_handle_config(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- GVariant *arg_config,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ GVariant *arg_config,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
LlcpConfigData *data;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::p2p",
- "w") == false) {
+ smack_privilege,
+ "nfc-manager::p2p",
+ "w") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->llcp = g_object_ref(llcp);
data->invocation = g_object_ref(invocation);
g_variant_get(arg_config,
- "(qqyy)",
- &data->miu,
- &data->wks,
- &data->lto,
- &data->option);
+ "(qqyy)",
+ &data->miu,
+ &data->wks,
+ &data->lto,
+ &data->option);
if (net_nfc_server_controller_async_queue_push(
llcp_handle_config_thread_func,
}
static gboolean llcp_handle_listen(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- guint16 arg_miu,
- guint8 arg_rw,
- gint32 arg_type,
- guint8 arg_sap,
- const gchar *arg_service_name,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ guint16 arg_miu,
+ guint8 arg_rw,
+ gint32 arg_type,
+ guint8 arg_sap,
+ const gchar *arg_service_name,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
LlcpListenData *data;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::p2p",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager::p2p",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->llcp = g_object_ref(llcp);
}
static gboolean llcp_handle_connect(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- guint16 arg_miu,
- guint8 arg_rw,
- gint32 arg_type,
- const gchar *arg_service_name,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ guint16 arg_miu,
+ guint8 arg_rw,
+ gint32 arg_type,
+ const gchar *arg_service_name,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
LlcpConnectData *data;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::p2p",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager::p2p",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->llcp = g_object_ref(llcp);
}
static gboolean llcp_handle_connect_sap(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- guint16 arg_miu,
- guint8 arg_rw,
- gint32 arg_type,
- guint8 arg_sap,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ guint16 arg_miu,
+ guint8 arg_rw,
+ gint32 arg_type,
+ guint8 arg_sap,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
LlcpConnectSapData *data;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::p2p",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager::p2p",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->llcp = g_object_ref(llcp);
}
static gboolean llcp_handle_send(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- GVariant *arg_data,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ GVariant *arg_data,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
LlcpSendData *data;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::p2p",
- "w") == false) {
+ smack_privilege,
+ "nfc-manager::p2p",
+ "w") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->llcp = g_object_ref(llcp);
}
static gboolean llcp_handle_send_to(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- guint8 arg_sap,
- GVariant *arg_data,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ guint8 arg_sap,
+ GVariant *arg_data,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
LlcpSendToData *data;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::p2p",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager::p2p",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->llcp = g_object_ref(llcp);
}
static gboolean llcp_handle_receive(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- guint32 arg_req_length,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ guint32 arg_req_length,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
LlcpReceiveData *data;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::p2p",
- "w") == false) {
+ smack_privilege,
+ "nfc-manager::p2p",
+ "w") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->llcp = g_object_ref(llcp);
}
static gboolean llcp_handle_receive_from(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- guint32 arg_req_length,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ guint32 arg_req_length,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
LlcpReceiveData *data;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::p2p",
- "w") == false) {
+ smack_privilege,
+ "nfc-manager::p2p",
+ "w") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->llcp = g_object_ref(llcp);
}
static gboolean llcp_handle_close(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
LlcpCloseData *data;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::p2p",
- "w") == false) {
+ smack_privilege,
+ "nfc-manager::p2p",
+ "w") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->llcp = g_object_ref(llcp);
}
static gboolean llcp_handle_disconnect(NetNfcGDbusLlcp *llcp,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- guint32 arg_client_socket,
- guint32 arg_oal_socket,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ guint32 arg_client_socket,
+ guint32 arg_oal_socket,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
LlcpDisconnectData *data;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::p2p",
- "w") == false) {
+ smack_privilege,
+ "nfc-manager::p2p",
+ "w") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->llcp = g_object_ref(llcp);
if (handle == NULL)
{
DEBUG_SERVER_MSG(
- "the target ID = [0x%p] was not connected before."
- "current device may be a TARGET", handle);
+ "the target ID = [0x%p] was not connected before."
+ "current device may be a TARGET", handle);
}
else
{
if (info->work_cb != NULL)
{
info->work_cb(listen_socket->client_socket,
- listen_socket->result, NULL, NULL,info->work_param);
+ listen_socket->result, NULL, NULL,info->work_param);
}
}
else
if (param->cb)
{
param->cb(req_llcp_msg->llcp_socket,
- req_llcp_msg->result,
- NULL,
- NULL,
- param->user_param);
+ req_llcp_msg->result,
+ NULL,
+ NULL,
+ param->user_param);
}
g_free(param);
if (param->cb)
{
param->cb(param->socket,
- req_llcp_msg->result,
- NULL,
- NULL,
- param->user_param);
+ req_llcp_msg->result,
+ NULL,
+ NULL,
+ param->user_param);
}
g_free(param);
if (param->cb)
{
param->cb(param->socket,
- req_receive_socket->result,
- ¶m->data,
- NULL,
- param->user_param);
+ req_receive_socket->result,
+ ¶m->data,
+ NULL,
+ param->user_param);
}
if (param->data.buffer)
}
req_receive_from_socket = (net_nfc_request_receive_from_socket_t *)
- data->req_msg;
+ data->req_msg;
param = (net_nfc_llcp_param_t *)req_receive_from_socket->user_param;
if (param)
if (param->cb)
{
param->cb(param->socket,
- req_receive_from_socket->result,
- ¶m->data,
- (void *)(int)req_receive_from_socket->sap,
- param->user_param);
+ req_receive_from_socket->result,
+ ¶m->data,
+ (void *)(int)req_receive_from_socket->sap,
+ param->user_param);
}
if (param->data.buffer)
if (param->cb)
{
param->cb(param->socket,
- req_llcp_msg->result,
- NULL,
- NULL,
- param->user_param);
+ req_llcp_msg->result,
+ NULL,
+ NULL,
+ param->user_param);
}
g_free(param);
if (param->cb)
{
param->cb(param->socket,
- req_llcp_msg->result,
- NULL,
- NULL,
- param->user_param);
+ req_llcp_msg->result,
+ NULL,
+ NULL,
+ param->user_param);
}
g_free(param);
}
static void llcp_simple_socket_error_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpSimpleData *simple_data;
}
static void llcp_simple_listen_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpSimpleData *simple_data;
}
static void llcp_simple_connect_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpSimpleData *simple_data;
}
static void llcp_simple_server_error_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpSimpleData *simple_data;
if (simple_data->error_callback)
{
simple_data->error_callback(result,
- simple_data->handle,
- socket,
- data,
- simple_data->user_data);
+ simple_data->handle,
+ socket,
+ data,
+ simple_data->user_data);
}
g_free(simple_data);
}
static void llcp_simple_send_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpSimpleData *simple_data;
}
static void llcp_simple_receive_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
LlcpSimpleData *simple_data;
}
net_nfc_error_e net_nfc_server_llcp_set_config(
- net_nfc_llcp_config_info_s *config)
+ net_nfc_llcp_config_info_s *config)
{
net_nfc_error_e result;
}
net_nfc_error_e net_nfc_server_llcp_simple_server(
- net_nfc_target_handle_s *handle,
- const char *san,
- sap_t sap,
- net_nfc_server_llcp_callback callback,
- net_nfc_server_llcp_callback error_callback,
- gpointer user_data)
+ net_nfc_target_handle_s *handle,
+ const char *san,
+ sap_t sap,
+ net_nfc_server_llcp_callback callback,
+ net_nfc_server_llcp_callback error_callback,
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
return NET_NFC_NULL_PARAMETER;
if (net_nfc_controller_llcp_get_remote_config(handle,
- &config,
- &result) == false)
+ &config,
+ &result) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
"net_nfc_controller_llcp_get_remote_config",
simple_data->miu = MIN(config.miu, net_nfc_server_llcp_get_miu());
if (net_nfc_controller_llcp_create_socket(&socket,
- NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED,
- simple_data->miu,
- 1,
- &result,
- llcp_simple_socket_error_cb,
- simple_data) == false)
+ NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED,
+ simple_data->miu,
+ 1,
+ &result,
+ llcp_simple_socket_error_cb,
+ simple_data) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
"net_nfc_controller_llcp_create_socket",
simple_data->socket = socket;
if (net_nfc_controller_llcp_bind(socket,
- sap,
- &result) == false)
+ sap,
+ &result) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
"nte_nfc_controller_llcp_bind",
}
if (net_nfc_controller_llcp_listen(handle,
- (uint8_t *)san,
- socket,
- &result,
- llcp_simple_listen_cb,
- simple_data) == false)
+ (uint8_t *)san,
+ socket,
+ &result,
+ llcp_simple_listen_cb,
+ simple_data) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
"net_nfc_controller_llcp_listen",
if (simple_data->socket != 1)
{
net_nfc_controller_llcp_socket_close(
- simple_data->socket,
- &result);
+ simple_data->socket,
+ &result);
}
g_free(simple_data);
}
net_nfc_error_e net_nfc_server_llcp_simple_client(
- net_nfc_target_handle_s *handle,
- const char *san,
- sap_t sap,
- net_nfc_server_llcp_callback callback,
- net_nfc_server_llcp_callback error_callback,
- gpointer user_data)
+ net_nfc_target_handle_s *handle,
+ const char *san,
+ sap_t sap,
+ net_nfc_server_llcp_callback callback,
+ net_nfc_server_llcp_callback error_callback,
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
return NET_NFC_NULL_PARAMETER;
if (net_nfc_controller_llcp_get_remote_config(handle,
- &config,
- &result) == false)
+ &config,
+ &result) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
"net_nfc_controller_llcp_get_remote_config",
simple_data->miu = MIN(config.miu, net_nfc_server_llcp_get_miu());
if (net_nfc_controller_llcp_create_socket(&socket,
- NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED,
- simple_data->miu,
- 1,
- &result,
- llcp_simple_socket_error_cb,
- simple_data) == false)
+ NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED,
+ simple_data->miu,
+ 1,
+ &result,
+ llcp_simple_socket_error_cb,
+ simple_data) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
"net_nfc_controller_llcp_create_socket",
if (san == NULL)
{
if (net_nfc_controller_llcp_connect(handle,
- simple_data->socket,
- sap,
- &result,
- llcp_simple_connect_cb,
- simple_data) == false)
+ simple_data->socket,
+ sap,
+ &result,
+ llcp_simple_connect_cb,
+ simple_data) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
- "net_nfc_controller_llcp_connect",
- result);
+ "net_nfc_controller_llcp_connect",
+ result);
if (simple_data->socket != -1)
{
net_nfc_controller_llcp_socket_close(
- simple_data->socket,
- &result);
+ simple_data->socket,
+ &result);
}
g_free(simple_data);
else
{
if (net_nfc_controller_llcp_connect_by_url(handle,
- simple_data->socket,
- (uint8_t *)san,
- &result,
- llcp_simple_connect_cb,
- simple_data) == false)
+ simple_data->socket,
+ (uint8_t *)san,
+ &result,
+ llcp_simple_connect_cb,
+ simple_data) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
- "net_nfc_controller_llcp_connect_by_url",
- result);
+ "net_nfc_controller_llcp_connect_by_url",
+ result);
if (simple_data->socket != -1)
{
net_nfc_controller_llcp_socket_close(
- simple_data->socket,
- &result);
+ simple_data->socket,
+ &result);
}
g_free(simple_data);
}
net_nfc_error_e net_nfc_server_llcp_simple_accept(
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- net_nfc_server_llcp_callback error_callback,
- gpointer user_data)
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ net_nfc_server_llcp_callback error_callback,
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
simple_data->user_data = user_data;
if (net_nfc_controller_llcp_accept(socket,
- &result,
- llcp_simple_server_error_cb,
- simple_data) == false)
+ &result,
+ llcp_simple_server_error_cb,
+ simple_data) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
- "net_nfc_controller_llcp_accept",
- result);
+ "net_nfc_controller_llcp_accept",
+ result);
}
if (result == NET_NFC_BUSY)
}
net_nfc_error_e net_nfc_server_llcp_simple_send(
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- net_nfc_server_llcp_callback callback,
- gpointer user_data)
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ net_nfc_server_llcp_callback callback,
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
simple_data->user_data = user_data;
if (net_nfc_controller_llcp_send(handle,
- socket,
- data,
- &result,
- llcp_simple_send_cb,
- simple_data) == false)
+ socket,
+ data,
+ &result,
+ llcp_simple_send_cb,
+ simple_data) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
- "net_nfc_controller_llcp_send",
- result);
+ "net_nfc_controller_llcp_send",
+ result);
}
if (result == NET_NFC_BUSY)
}
net_nfc_error_e net_nfc_server_llcp_simple_receive(
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- net_nfc_server_llcp_callback callback,
- gpointer user_data)
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ net_nfc_server_llcp_callback callback,
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
simple_data->user_data = user_data;
if (net_nfc_controller_llcp_recv(handle,
- socket,
- net_nfc_server_llcp_get_miu(),
- &result,
- llcp_simple_receive_cb,
- simple_data) == false)
+ socket,
+ net_nfc_server_llcp_get_miu(),
+ &result,
+ llcp_simple_receive_cb,
+ simple_data) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
- "net_nfc_controller_llcp_send",
- result);
+ "net_nfc_controller_llcp_send",
+ result);
}
if (result == NET_NFC_BUSY)
inline static service_t *_llcp_find_service(uint32_t sap)
{
return (service_t *)g_hash_table_lookup(service_table,
- (gconstpointer)sap);
+ (gconstpointer)sap);
}
static net_nfc_error_e _llcp_add_service(const char *id, uint32_t sap,
- const char *san, net_nfc_server_llcp_activate_cb cb, void *user_data)
+ const char *san, net_nfc_server_llcp_activate_cb cb, void *user_data)
{
service_t *service = NULL;
net_nfc_error_e result;
service->user_data = user_data;
g_hash_table_insert(service_table, (gpointer)sap,
- (gpointer)service);
+ (gpointer)service);
result = NET_NFC_OK;
} else {
}
static void _llcp_start_services_cb(gpointer key, gpointer value,
- gpointer user_data)
+ gpointer user_data)
{
service_t *service = (service_t *)value;
/* TODO : start service */
if (service != NULL && service->cb != NULL) {
service->cb(NET_NFC_LLCP_START,
- (net_nfc_target_handle_s *)user_data,
- service->sap,
- service->san, service->user_data);
+ (net_nfc_target_handle_s *)user_data,
+ service->sap,
+ service->san, service->user_data);
}
}
}
net_nfc_error_e net_nfc_server_llcp_register_service(const char *id,
- sap_t sap, const char *san, net_nfc_server_llcp_activate_cb cb,
- void *user_param)
+ sap_t sap, const char *san, net_nfc_server_llcp_activate_cb cb,
+ void *user_param)
{
return _llcp_add_service(id, sap, san, cb, user_param);
}
net_nfc_error_e net_nfc_server_llcp_unregister_service(const char *id,
- sap_t sap, const char *san)
+ sap_t sap, const char *san)
{
net_nfc_error_e result;
service_t *service;
if (service != NULL) {
/* invoke callback */
service->cb(NET_NFC_LLCP_UNREGISTERED, NULL, service->sap,
- service->san, service->user_data);
+ service->san, service->user_data);
_llcp_remove_service(sap);
while (g_hash_table_iter_next(&iter, &key, (gpointer)&service)) {
service->cb(NET_NFC_LLCP_UNREGISTERED, NULL, service->sap,
- service->san, service->user_data);
+ service->san, service->user_data);
g_free(service->san);
g_free(service->id);
}
net_nfc_error_e net_nfc_server_llcp_start_registered_services(
- net_nfc_target_handle_s *handle)
+ net_nfc_target_handle_s *handle)
{
_llcp_start_services(handle);
result);
if (net_nfc_controller_configure_discovery(
- NET_NFC_DISCOVERY_MODE_RESUME,
- NET_NFC_ALL_ENABLE,
- &result) == false)
+ NET_NFC_DISCOVERY_MODE_RESUME,
+ NET_NFC_ALL_ENABLE,
+ &result) == false)
{
DEBUG_ERR_MSG("%s is failed [%d]",
- "net_nfc_controller_configure_discovery",
- result);
+ "net_nfc_controller_configure_discovery",
+ result);
net_nfc_controller_exception_handler();
}
if (net_nfc_controller_llcp_check_llcp(handle, &result) == false)
{
DEBUG_ERR_MSG("%s is failed [%d]",
- "net_nfc_controller_llcp_check_llcp",
- result);
+ "net_nfc_controller_llcp_check_llcp",
+ result);
return;
}
if (net_nfc_controller_llcp_activate_llcp(handle, &result) == false)
{
DEBUG_ERR_MSG("%s is failed [%d]",
- "net_nfc_controller_llcp_activate_llcp",
- result);
+ "net_nfc_controller_llcp_activate_llcp",
+ result);
return;
}
void net_nfc_server_llcp_target_detected(void *info)
{
if (net_nfc_server_controller_async_queue_push(
- net_nfc_server_llcp_process, NULL) == FALSE)
+ net_nfc_server_llcp_process, NULL) == FALSE)
{
DEBUG_ERR_MSG("can not push to controller thread");
}
#include "net_nfc_typedef_internal.h"
#include "net_nfc_debug_internal.h"
-#include "net_nfc_controller_internal.h"
-#include "net_nfc_manager.h"
+#include "net_nfc_server_controller.h"
+#include "net_nfc_server.h"
#include "net_nfc_server_se.h"
#include "net_nfc_server_llcp.h"
#include "net_nfc_server_process_snep.h"
#include "net_nfc_server_process_npp.h"
#include "net_nfc_server_process_handover.h"
-#include "net_nfc_server_context_internal.h"
+#include "net_nfc_server_context.h"
typedef struct _ManagerData ManagerData;
static void manager_handle_active_thread_func(gpointer user_data);
static gboolean manager_handle_set_active(NetNfcGDbusManager *manager,
- GDBusMethodInvocation *invocation,
- gboolean arg_is_active,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ gboolean arg_is_active,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean manager_handle_get_server_state(NetNfcGDbusManager *manager,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data);
static void manager_active_thread_func(gpointer user_data);
return TRUE;
}
-static void manager_handle_active_thread_func(gpointer user_data)
+static void manager_handle_active_thread_func(gpointer user_data)
{
gboolean ret;
if(data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.SetActiveError",
- "Can not get manager");
+ data->invocation,
+ "org.tizen.NetNfcService.SetActiveError",
+ "Can not get manager");
g_object_unref(data->invocation);
}
if (data->invocation)
{
g_dbus_method_invocation_return_dbus_error(
- data->invocation,
- "org.tizen.NetNfcService.SetActiveError",
- "Can not set activation");
+ data->invocation,
+ "org.tizen.NetNfcService.SetActiveError",
+ "Can not set activation");
g_object_unref(data->invocation);
}
}
net_nfc_gdbus_manager_emit_activated(data->manager,
- data->is_active);
+ data->is_active);
if (data->invocation)
{
net_nfc_gdbus_manager_complete_set_active(data->manager,
- data->invocation);
+ data->invocation);
g_object_unref(data->invocation);
}
/* shutdown process if it doesn't need */
if (data->is_active == false &&
- net_nfc_server_gdbus_is_server_busy() == false) {
+ net_nfc_server_gdbus_is_server_busy() == false) {
net_nfc_manager_quit();
}
static gboolean manager_handle_set_active(NetNfcGDbusManager *manager,
- GDBusMethodInvocation *invocation,
- gboolean arg_is_active,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ gboolean arg_is_active,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
ManagerActivationData *data;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::admin",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager::admin",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->is_active = arg_is_active;
if (net_nfc_server_controller_async_queue_push(
- manager_handle_active_thread_func,
- data) == FALSE)
+ manager_handle_active_thread_func,
+ data) == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
"org.tizen.NetNfcService.ThreadError",
return FALSE;
}
- if (arg_is_active)
- net_nfc_server_restart_polling_loop();
-
return TRUE;
}
static gboolean manager_handle_get_server_state(NetNfcGDbusManager *manager,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
guint32 state;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::admin",
- "r") == false) {
+ smack_privilege,
+ "nfc-manager::admin",
+ "r") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
state = net_nfc_server_get_state();
net_nfc_gdbus_manager_complete_get_server_state(manager,
- invocation,
- state);
+ invocation,
+ state);
return TRUE;
}
}
net_nfc_gdbus_manager_emit_activated(data->manager,
- data->is_active);
+ data->is_active);
g_free(data);
}
data->is_active = is_active;
if (net_nfc_server_controller_async_queue_push(
- manager_active_thread_func,
- data) == FALSE)
+ manager_active_thread_func,
+ data) == FALSE)
{
DEBUG_ERR_MSG("can not push to controller thread");
}
}
- if (is_active)
- net_nfc_server_restart_polling_loop();
-
return;
}
#include "net_nfc_debug_internal.h"
#include "net_nfc_util_internal.h"
#include "net_nfc_util_gdbus_internal.h"
-#include "net_nfc_controller_internal.h"
+#include "net_nfc_server_controller.h"
#include "net_nfc_gdbus.h"
#include "net_nfc_server_common.h"
-#include "net_nfc_server_context_internal.h"
+#include "net_nfc_server_context.h"
#include "net_nfc_server_tag.h"
#include "net_nfc_server_ndef.h"
/* methods */
static gboolean ndef_handle_read(NetNfcGDbusNdef *ndef,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean ndef_handle_write(NetNfcGDbusNdef *ndef,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- GVariant *arg_data,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ GVariant *arg_data,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean ndef_handle_make_read_only(NetNfcGDbusNdef *ndef,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean ndef_handle_format(NetNfcGDbusNdef *ndef,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- GVariant *arg_key,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ GVariant *arg_key,
+ GVariant *smack_privilege,
+ gpointer user_data);
static void ndef_read_thread_func(gpointer user_data)
data_variant = net_nfc_util_gdbus_data_to_variant(read_data);
net_nfc_gdbus_ndef_complete_read(data->ndef,
- data->invocation,
- (gint)result,
- data_variant);
+ data->invocation,
+ (gint)result,
+ data_variant);
if (read_data) {
net_nfc_util_free_data(read_data);
}
net_nfc_gdbus_ndef_complete_write(data->ndef,
- data->invocation,
- (gint)result);
+ data->invocation,
+ (gint)result);
net_nfc_util_free_data(&data->data);
}
net_nfc_gdbus_ndef_complete_make_read_only(data->ndef,
- data->invocation,
- (gint)result);
+ data->invocation,
+ (gint)result);
g_object_unref(data->invocation);
g_object_unref(data->ndef);
}
net_nfc_gdbus_ndef_complete_format(data->ndef,
- data->invocation,
- (gint)result);
+ data->invocation,
+ (gint)result);
net_nfc_util_free_data(&data->key);
}
static gboolean ndef_handle_read(NetNfcGDbusNdef *ndef,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
ReadData *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::tag",
- "r") == false) {
+ smack_privilege,
+ "nfc-manager::tag",
+ "r") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->handle = arg_handle;
result = net_nfc_server_controller_async_queue_push(
- ndef_read_thread_func,
- data);
+ ndef_read_thread_func,
+ data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
}
static gboolean ndef_handle_write(NetNfcGDbusNdef *ndef,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- GVariant *arg_data,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ GVariant *arg_data,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
WriteData *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::tag",
- "w") == false) {
+ smack_privilege,
+ "nfc-manager::tag",
+ "w") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
net_nfc_util_gdbus_variant_to_data_s(arg_data, &data->data);
result = net_nfc_server_controller_async_queue_push(
- ndef_write_thread_func,
- data);
+ ndef_write_thread_func,
+ data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
}
static gboolean ndef_handle_make_read_only(NetNfcGDbusNdef *ndef,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
MakeReadOnlyData *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::tag",
- "w") == false) {
+ smack_privilege,
+ "nfc-manager::tag",
+ "w") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->handle = arg_handle;
result = net_nfc_server_controller_async_queue_push(
- ndef_make_read_only_thread_func,
- data);
+ ndef_make_read_only_thread_func,
+ data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
}
static gboolean ndef_handle_format(NetNfcGDbusNdef *ndef,
- GDBusMethodInvocation *invocation,
- guint32 arg_handle,
- GVariant *arg_key,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_handle,
+ GVariant *arg_key,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
FormatData *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::tag",
- "w") == false) {
+ smack_privilege,
+ "nfc-manager::tag",
+ "w") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
net_nfc_util_gdbus_variant_to_data_s(arg_key, &data->key);
result = net_nfc_server_controller_async_queue_push(
- ndef_format_thread_func,
- data);
+ ndef_format_thread_func,
+ data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
NULL);
result = g_dbus_interface_skeleton_export(
- G_DBUS_INTERFACE_SKELETON(ndef_skeleton),
- connection,
- "/org/tizen/NetNfcService/Ndef",
- &error);
+ G_DBUS_INTERFACE_SKELETON(ndef_skeleton),
+ connection,
+ "/org/tizen/NetNfcService/Ndef",
+ &error);
if (result == FALSE)
{
g_error_free(error);
#include "net_nfc_debug_internal.h"
#include "net_nfc_util_internal.h"
#include "net_nfc_util_gdbus_internal.h"
-#include "net_nfc_controller_internal.h"
+#include "net_nfc_server_controller.h"
#include "net_nfc_gdbus.h"
#include "net_nfc_server_common.h"
-#include "net_nfc_server_context_internal.h"
+#include "net_nfc_server_context.h"
#include "net_nfc_server_process_snep.h"
#include "net_nfc_server_p2p.h"
NetNfcGDbusP2p *p2p;
GDBusMethodInvocation *invocation;
gint32 type;
- guint32 p2p_handle;
+ net_nfc_target_handle_s *p2p_handle;
data_s data;
};
static void p2p_send_data_thread_func(gpointer user_data);
static gboolean p2p_handle_send(NetNfcGDbusP2p *p2p,
- GDBusMethodInvocation *invocation,
- gint32 arg_type,
- GVariant *arg_data,
- guint32 handle,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ gint32 arg_type,
+ GVariant *arg_data,
+ guint32 handle,
+ GVariant *smack_privilege,
+ gpointer user_data);
static NetNfcGDbusP2p *p2p_skeleton = NULL;
{
P2pSendData *p2p_data = (P2pSendData *)user_data;
net_nfc_error_e result;
- net_nfc_target_handle_s *handle;
g_assert(p2p_data != NULL);
g_assert(p2p_data->p2p != NULL);
g_assert(p2p_data->invocation != NULL);
- handle = GUINT_TO_POINTER(p2p_data->p2p_handle);
-
result = net_nfc_server_snep_default_client_start(
- GUINT_TO_POINTER(p2p_data->p2p_handle),
- SNEP_REQ_PUT,
- &p2p_data->data,
- -1,
- p2p_data);
+ p2p_data->p2p_handle,
+ SNEP_REQ_PUT,
+ &p2p_data->data,
+ -1,
+ p2p_data);
if (result != NET_NFC_OK)
{
net_nfc_gdbus_p2p_complete_send(p2p_data->p2p,
- p2p_data->invocation,
- (gint)result);
+ p2p_data->invocation,
+ (gint)result);
net_nfc_util_free_data(&p2p_data->data);
}
static gboolean p2p_handle_send(NetNfcGDbusP2p *p2p,
- GDBusMethodInvocation *invocation,
- gint32 arg_type,
- GVariant *arg_data,
- guint32 handle,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ gint32 arg_type,
+ GVariant *arg_data,
+ guint32 handle,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
gboolean result;
P2pSendData *data;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::p2p",
- "w") == false) {
+ smack_privilege,
+ "nfc-manager::p2p",
+ "w") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->p2p = g_object_ref(p2p);
data->invocation = g_object_ref(invocation);
data->type = arg_type;
- data->p2p_handle = handle;
+ data->p2p_handle = GUINT_TO_POINTER(handle);
net_nfc_util_gdbus_variant_to_data_s(arg_data, &data->data);
result = net_nfc_server_controller_async_queue_push(
- p2p_send_data_thread_func, data);
+ p2p_send_data_thread_func, data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
NULL);
result = g_dbus_interface_skeleton_export(
- G_DBUS_INTERFACE_SKELETON(p2p_skeleton),
- connection,
- "/org/tizen/NetNfcService/P2p",
- &error);
+ G_DBUS_INTERFACE_SKELETON(p2p_skeleton),
+ connection,
+ "/org/tizen/NetNfcService/P2p",
+ &error);
if (result == FALSE)
{
g_error_free(error);
DEBUG_ERR_MSG("Emitting p2p discovered signal");
net_nfc_gdbus_p2p_emit_discovered(p2p_skeleton,
- GPOINTER_TO_UINT(handle));
+ GPOINTER_TO_UINT(handle));
}
void net_nfc_server_p2p_received(data_h user_data)
}
void net_nfc_server_p2p_data_sent(net_nfc_error_e result,
- gpointer user_data)
+ gpointer user_data)
{
P2pSendData *data = (P2pSendData *)user_data;
g_assert(data->invocation != NULL);
net_nfc_gdbus_p2p_complete_send(data->p2p,
- data->invocation,
- (gint)result);
+ data->invocation,
+ (gint)result);
net_nfc_util_free_data(&data->data);
#include "net_nfc_util_ndef_message.h"
#include "net_nfc_util_ndef_record.h"
#include "net_nfc_util_handover.h"
-#include "net_nfc_manager_util_internal.h"
-#include "net_nfc_controller_internal.h"
+#include "net_nfc_server_controller.h"
#include "net_nfc_server_llcp.h"
-#include "net_nfc_server_handover_internal.h"
+#include "net_nfc_server_process_handover.h"
#include "net_nfc_server_process_snep.h"
#include "net_nfc_util_gdbus_internal.h"
#include "net_nfc_server_handover_bss.h"
+#include "net_nfc_server_handover_bt.h"
typedef void (*_net_nfc_server_handover_create_carrier_msg_cb)(
- net_nfc_error_e result,
- ndef_message_s *selector,
- void *user_param);
+ net_nfc_error_e result,
+ ndef_message_s *selector,
+ void *user_param);
typedef struct _net_nfc_handover_context_t
{
net_nfc_handover_context_t;
#define NET_NFC_CH_CONTEXT net_nfc_target_handle_s *handle;\
- net_nfc_llcp_socket_t socket;\
- net_nfc_error_e result;\
- int step;\
- net_nfc_conn_handover_carrier_type_e type;\
- void *user_param;
+ net_nfc_llcp_socket_t socket;\
+ net_nfc_error_e result;\
+ int step;\
+ net_nfc_conn_handover_carrier_type_e type;\
+ void *user_param;
typedef struct _net_nfc_server_handover_create_config_context_t
{
NET_NFC_CH_CONTEXT;
net_nfc_server_handover_process_carrier_record_cb cb;
-}
-net_nfc_server_handover_process_config_context_t;
+}net_nfc_server_handover_process_config_context_t;
static void _net_nfc_server_handover_send_response(void *user_param,
- data_h ac_data,
- net_nfc_error_e result);
+ data_h ac_data,
+ net_nfc_error_e result);
static void _net_nfc_server_handover_client_process(
- net_nfc_handover_context_t *context);
+ net_nfc_handover_context_t *context);
static void _net_nfc_server_handover_client_error_cb(
- net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param);
+ net_nfc_error_e result,
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param);
static void _net_nfc_server_handover_client_connected_cb(
- net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param);
+ net_nfc_error_e result,
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param);
static void _net_nfc_server_handover_get_response_process(
- net_nfc_handover_context_t *context);
+ net_nfc_handover_context_t *context);
static int _net_nfc_server_handover_append_wifi_carrier_config(
net_nfc_server_handover_create_config_context_t *context);
static net_nfc_error_e
_net_nfc_server_handover_create_requester_from_rawdata(
- ndef_message_s **requestor,
- data_s *data);
+ ndef_message_s **requestor,
+ data_s *data);
static net_nfc_error_e
_net_nfc_server_handover_create_requester_carrier_configs(
- net_nfc_conn_handover_carrier_type_e type,
- void *cb,
- void *user_param);
+ net_nfc_conn_handover_carrier_type_e type,
+ void *cb,
+ void *user_param);
static bool _net_nfc_server_handover_check_hr_record_validation(
- ndef_message_s *message);
+ ndef_message_s *message);
static bool _net_nfc_server_handover_check_hs_record_validation(
- ndef_message_s *message);
+ ndef_message_s *message);
static net_nfc_error_e
_net_nfc_server_handover_create_selector_carrier_configs(
- net_nfc_conn_handover_carrier_type_e type,
- void *cb,
- void *user_param);
+ net_nfc_conn_handover_carrier_type_e type,
+ void *cb,
+ void *user_param);
static int _net_nfc_server_handover_iterate_create_carrier_configs(
net_nfc_server_handover_create_config_context_t *context);
net_nfc_server_handover_create_config_context_t *context);
static void _net_nfc_server_handover_server_process(
- net_nfc_handover_context_t *context);
+ net_nfc_handover_context_t *context);
static net_nfc_error_e
_net_nfc_server_handover_create_low_power_selector_message(
- ndef_message_s *request_msg,
- ndef_message_s *select_msg);
+ ndef_message_s *request_msg,
+ ndef_message_s *select_msg);
////////////////////////////////////////////////////////////////////////////
static void _net_nfc_server_handover_send_response(
- void *user_param,
- data_h ac_data,
- net_nfc_error_e result)
+ void *user_param,
+ data_h ac_data,
+ net_nfc_error_e result)
{
HandoverRequestData *handover_data = NULL;
guint32 resp_event;
if (handover_data->invocation)
{
net_nfc_gdbus_handover_complete_request(
- handover_data->handoverobj,
- handover_data->invocation,
- resp_event,
- resp_type,
- data);
+ handover_data->handoverobj,
+ handover_data->invocation,
+ resp_event,
+ resp_type,
+ data);
g_object_unref(handover_data->invocation);
}
}
static net_nfc_error_e _net_nfc_server_handover_convert_ndef_message_to_data(
- ndef_message_s *msg,
- data_s *data)
+ ndef_message_s *msg,
+ data_s *data)
{
net_nfc_error_e result;
uint32_t length;
}
static void _net_nfc_server_handover_bt_get_carrier_record_cb(
- net_nfc_error_e result,
- net_nfc_conn_handover_carrier_state_e cps,
- ndef_record_s *carrier,
- uint32_t aux_data_count,
- ndef_record_s *aux_data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_conn_handover_carrier_state_e cps,
+ ndef_record_s *carrier,
+ uint32_t aux_data_count,
+ ndef_record_s *aux_data,
+ void *user_param)
{
net_nfc_server_handover_create_config_context_t *context =
(net_nfc_server_handover_create_config_context_t *)user_param;
/* FIXME : copy record and append */
net_nfc_util_create_record(carrier->TNF,
- &carrier->type_s,
- &carrier->id_s,
- &carrier->payload_s,
- &record);
+ &carrier->type_s,
+ &carrier->id_s,
+ &carrier->payload_s,
+ &record);
if ((result = net_nfc_util_append_carrier_config_record(
- context->ndef_message,
- record,
- cps)) == NET_NFC_OK)
+ context->ndef_message,
+ record,
+ cps)) == NET_NFC_OK)
{
DEBUG_SERVER_MSG("net_nfc_util_append_carrier"
- "_config_record success");
+ "_config_record success");
}
else
{
DEBUG_ERR_MSG("net_nfc_util_append_carrier"
"_config_record failed [%d]",
- result);
+ result);
net_nfc_util_free_record(record);
}
g_idle_add(
- (GSourceFunc)_net_nfc_server_handover_iterate_carrier_configs_to_next,
- (gpointer)context);
+ (GSourceFunc)_net_nfc_server_handover_iterate_carrier_configs_to_next,
+ (gpointer)context);
}
/* don't free context */
}
static void _net_nfc_server_handover_bt_process_carrier_record_cb(
- net_nfc_error_e result,
- net_nfc_conn_handover_carrier_type_e type,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_conn_handover_carrier_type_e type,
+ data_s *data,
+ void *user_param)
{
net_nfc_server_handover_process_config_context_t *context =
(net_nfc_server_handover_process_config_context_t *)user_param;
else
{
DEBUG_ERR_MSG("_handover_bt_process_carrier_record failed [%d]",
- result);
+ result);
}
_net_nfc_util_free_mem(context);
}
-net_nfc_error_e
-_net_nfc_server_handover_get_carrier_record_by_priority_order(
- ndef_message_s *request,
- ndef_record_s **record)
+net_nfc_error_e _net_nfc_server_handover_get_carrier_record_by_priority_order(
+ ndef_message_s *request,
+ ndef_record_s **record)
{
net_nfc_error_e result;
unsigned int carrier_count = 0;
*record = NULL;
if ((result = net_nfc_util_get_alternative_carrier_record_count(
- request,
- &carrier_count)) == NET_NFC_OK)
+ request,
+ &carrier_count)) == NET_NFC_OK)
{
int idx, priority;
net_nfc_conn_handover_carrier_type_e carrier_type =
- NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+ NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
for (priority = NET_NFC_CONN_HANDOVER_CARRIER_BT;*record == NULL
- && priority < NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;priority++)
+ && priority < NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;priority++)
{
/* check each carrier record and create matched record */
for (idx = 0; idx < carrier_count; idx++)
{
if ((net_nfc_util_get_alternative_carrier_type(
- request,
- idx,
- &carrier_type)== NET_NFC_OK)
- && (carrier_type == priority))
+ request,
+ idx,
+ &carrier_type)== NET_NFC_OK)
+ && (carrier_type == priority))
{
DEBUG_SERVER_MSG("selected carrier type"
" = [%d]", carrier_type);
net_nfc_util_get_carrier_config_record(
- request,
- idx,
- record);
+ request,
+ idx,
+ record);
result = NET_NFC_OK;
break;
}
else
{
DEBUG_ERR_MSG("net_nfc_util_get_alternative_carrier"
- "_record_count failed");
+ "_record_count failed");
}
LOGD("[%s] END", __func__);
}
static net_nfc_error_e _net_nfc_server_handover_create_requester_from_rawdata(
- ndef_message_s **requestor,
- data_s *data)
+ ndef_message_s **requestor,
+ data_s *data)
{
net_nfc_error_e result;
if (result == NET_NFC_OK)
{
result = net_nfc_util_convert_rawdata_to_ndef_message(data,
- *requestor);
+ *requestor);
if (result == NET_NFC_OK)
{
else
{
DEBUG_ERR_MSG("_net_nfc_ndef_rawdata_to_ndef"
- "failed [%d]",result);
+ "failed [%d]",result);
}
} else {
DEBUG_ERR_MSG("net_nfc_util_create_ndef_message failed [%d]",
- result);
+ result);
}
return result;
}
net_nfc_error_e _net_nfc_server_handover_create_selector_from_rawdata(
- ndef_message_s **selector,
- data_s *data)
+ ndef_message_s **selector,
+ data_s *data)
{
net_nfc_error_e result;
*selector = NULL;
if ((result = net_nfc_util_create_ndef_message(selector))
- == NET_NFC_OK)
+ == NET_NFC_OK)
{
if ((result = net_nfc_util_convert_rawdata_to_ndef_message(data,
- *selector)) == NET_NFC_OK)
+ *selector)) == NET_NFC_OK)
{
/* if record is not Hs record, then */
if (_net_nfc_server_handover_check_hs_record_validation(
- *selector) == true)
+ *selector) == true)
{
result = NET_NFC_OK;
}
else
{
DEBUG_ERR_MSG("_net_nfc_ndef_rawdata_to_ndef"
- " failed [%d]",result);
+ " failed [%d]",result);
}
}
else
}
static bool _net_nfc_server_handover_check_hr_record_validation(
- ndef_message_s *message)
+ ndef_message_s *message)
{
unsigned int count;
ndef_record_s *rec;
rec = (ndef_record_s *)message->records;
if (memcmp(rec->type_s.buffer, CH_REQ_RECORD_TYPE,
- rec->type_s.length) != 0)
+ rec->type_s.length) != 0)
{
DEBUG_ERR_MSG("This is not connection handover"
- " request message");
+ " request message");
goto ERROR;
}
}
if (net_nfc_util_get_alternative_carrier_record_count(message, &count)
- != NET_NFC_OK || count == 0)
+ != NET_NFC_OK || count == 0)
{
DEBUG_ERR_MSG("there is no carrier reference");
goto ERROR;
}
static bool _net_nfc_server_handover_check_hs_record_validation(
- ndef_message_s *message)
+ ndef_message_s *message)
{
unsigned int count;
ndef_record_s *rec;
rec = (ndef_record_s *)message->records;
if (memcmp(rec->type_s.buffer, CH_SEL_RECORD_TYPE,
- rec->type_s.length) != 0)
+ rec->type_s.length) != 0)
{
DEBUG_ERR_MSG("This is not connection handover"
- " request message");
+ " request message");
goto ERROR;
}
if (net_nfc_util_get_alternative_carrier_record_count(
- message,&count)!= NET_NFC_OK || count == 0)
+ message,&count)!= NET_NFC_OK || count == 0)
{
DEBUG_ERR_MSG("there is no carrrier reference");
goto ERROR;
if (rec->payload_s.buffer[0] != CH_VERSION)
{
DEBUG_ERR_MSG("connection handover version"
- " is not matched");
+ " is not matched");
goto ERROR;
}
if (context->cb != NULL)
{
context->cb(NET_NFC_OK, context->ndef_message,
- context->user_param);
+ context->user_param);
}
if (context->ndef_message != NULL)
}
static int _net_nfc_server_handover_append_wifi_carrier_config(
- net_nfc_server_handover_create_config_context_t *context)
+ net_nfc_server_handover_create_config_context_t *context)
{
LOGD("[%s:%d] START", __func__, __LINE__);
/* complete and return to upper step */
g_idle_add(
- (GSourceFunc)_net_nfc_server_handover_iterate_carrier_configs_to_next,
- (gpointer)context);
+ (GSourceFunc)_net_nfc_server_handover_iterate_carrier_configs_to_next,
+ (gpointer)context);
break;
default :
else
{
context->current_type =
- NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+ NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
}
g_idle_add(
- (GSourceFunc)_net_nfc_server_handover_iterate_create_carrier_configs,
- (gpointer)context);
+ (GSourceFunc)_net_nfc_server_handover_iterate_create_carrier_configs,
+ (gpointer)context);
}
else
{
DEBUG_ERR_MSG("context->result is error [%d]", context->result);
g_idle_add(
- (GSourceFunc)_net_nfc_server_handover_iterate_carrier_configs_step,
- (gpointer)context);
+ (GSourceFunc)_net_nfc_server_handover_iterate_carrier_configs_step,
+ (gpointer)context);
}
return 0;
case NET_NFC_CONN_HANDOVER_CARRIER_BT :
DEBUG_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_BT]");
net_nfc_server_handover_bt_get_carrier_record(
- _net_nfc_server_handover_bt_get_carrier_record_cb,
- context);
+ _net_nfc_server_handover_bt_get_carrier_record_cb,
+ context);
break;
-// case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS :
-// DEBUG_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS]");
-// g_idle_add(
-// (GSourceFunc)net_nfc_service_llcp_handover_append_wifi_carrier_config,
-// context);
-// break;
+ // case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS :
+ // DEBUG_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS]");
+ // g_idle_add(
+ // (GSourceFunc)net_nfc_service_llcp_handover_append_wifi_carrier_config,
+ // context);
+ // break;
-// case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_IBSS :
-// DEBUG_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS]");
-// g_idle_add(
-// (GSourceFunc)_net_nfc_server_handover_append_wifi_carrier_config,
-// context);
-// break;
+ // case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_IBSS :
+ // DEBUG_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS]");
+ // g_idle_add(
+ // (GSourceFunc)_net_nfc_server_handover_append_wifi_carrier_config,
+ // context);
+ // break;
case NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN :
DEBUG_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN]");
g_idle_add(
- (GSourceFunc)_net_nfc_server_handover_iterate_carrier_configs_step,
- (gpointer)context);
+ (GSourceFunc)_net_nfc_server_handover_iterate_carrier_configs_step,
+ (gpointer)context);
break;
default :
DEBUG_MSG("[unknown : %d]", context->current_type);
g_idle_add(
- (GSourceFunc)_net_nfc_server_handover_iterate_carrier_configs_step,
- (gpointer)context);
+ (GSourceFunc)_net_nfc_server_handover_iterate_carrier_configs_step,
+ (gpointer)context);
break;
}
return 0;
}
-static net_nfc_error_e
-_net_nfc_server_handover_create_requester_carrier_configs(
- net_nfc_conn_handover_carrier_type_e type,
- void *cb,
- void *user_param)
+static net_nfc_error_e _net_nfc_server_handover_create_requester_carrier_configs(
+ net_nfc_conn_handover_carrier_type_e type,
+ void *cb,
+ void *user_param)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_server_handover_create_config_context_t *context = NULL;
if (type == NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN)
{
context->current_type =
- NET_NFC_CONN_HANDOVER_CARRIER_BT;
+ NET_NFC_CONN_HANDOVER_CARRIER_BT;
}
else
context->current_type = context->type;
context->cb = cb;
context->user_param = user_param;
net_nfc_util_create_handover_request_message(
- &context->ndef_message);
+ &context->ndef_message);
/* append carrier record */
g_idle_add(
- (GSourceFunc)_net_nfc_server_handover_iterate_create_carrier_configs,
- (gpointer)context);
+ (GSourceFunc)_net_nfc_server_handover_iterate_create_carrier_configs,
+ (gpointer)context);
}
else
{
return result;
}
-static net_nfc_error_e
-_net_nfc_server_handover_create_selector_carrier_configs(
- net_nfc_conn_handover_carrier_type_e type,
- void *cb,
- void *user_param)
+static net_nfc_error_e _net_nfc_server_handover_create_selector_carrier_configs(
+ net_nfc_conn_handover_carrier_type_e type,
+ void *cb,
+ void *user_param)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_server_handover_create_config_context_t *context = NULL;
{
context->type = type;
if (type == NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN)
- {
- context->current_type =
- NET_NFC_CONN_HANDOVER_CARRIER_BT;
- }
+ context->current_type = NET_NFC_CONN_HANDOVER_CARRIER_BT;
else
context->current_type = context->type;
- context->cb = cb;
- context->user_param = user_param;
- net_nfc_util_create_handover_select_message(
- &context->ndef_message);
+
+ context->cb = cb;
+ context->user_param = user_param;
+ net_nfc_util_create_handover_select_message(
+ &context->ndef_message);
/* append carrier record */
g_idle_add(
- (GSourceFunc)_net_nfc_server_handover_iterate_create_carrier_configs,
- (gpointer)context);
+ (GSourceFunc)_net_nfc_server_handover_iterate_create_carrier_configs,
+ (gpointer)context);
}
else
{
return result;
}
-static net_nfc_error_e
+ static net_nfc_error_e
_net_nfc_server_handover_create_low_power_selector_message(
- ndef_message_s *request_msg,
- ndef_message_s *select_msg)
+ ndef_message_s *request_msg,
+ ndef_message_s *select_msg)
{
net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
unsigned int carrier_count = 0;
int idx;
ndef_record_s *carrier_record = NULL;
net_nfc_conn_handover_carrier_type_e carrier_type =
- NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+ NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
/* check each carrier record and create matched record */
for (idx = 0; idx < carrier_count; idx++)
{
if ((net_nfc_util_get_alternative_carrier_type(
- request_msg,idx,&carrier_type) != NET_NFC_OK) ||
- (carrier_type == NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN))
+ request_msg,idx,&carrier_type) != NET_NFC_OK) ||
+ (carrier_type == NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN))
{
DEBUG_ERR_MSG("net_nfc_util_get_alternative"
"_carrier_type failed or unknown");
net_nfc_carrier_config_s *config = NULL;
if ((result = net_nfc_util_create_carrier_config(
- &config,carrier_type)) == NET_NFC_OK)
+ &config,carrier_type)) == NET_NFC_OK)
{
if ((result =
- net_nfc_util_create_ndef_record_with_carrier_config(
- &carrier_record,config)) == NET_NFC_OK)
+ net_nfc_util_create_ndef_record_with_carrier_config(
+ &carrier_record,config)) == NET_NFC_OK)
{
DEBUG_SERVER_MSG("net_nfc_util_create_ndef_record_"
- "with_carrier_config success");
+ "with_carrier_config success");
}
else
{
DEBUG_ERR_MSG("create_ndef_record_with_carrier_config "
- "failed [%d]", result);
+ "failed [%d]", result);
net_nfc_util_free_carrier_config(config);
continue;
}
/* append carrier configure record to selector message */
if ((result = net_nfc_util_append_carrier_config_record(
- select_msg,
- carrier_record,
- NET_NFC_CONN_HANDOVER_CARRIER_INACTIVATE)) == NET_NFC_OK)
+ select_msg,
+ carrier_record,
+ NET_NFC_CONN_HANDOVER_CARRIER_INACTIVATE)) == NET_NFC_OK)
{
DEBUG_SERVER_MSG("net_nfc_util_append_carrier_config_record success");
}
else
{
DEBUG_ERR_MSG("net_nfc_util_append_carrier_config_record"
- " failed [%d]", result);
+ " failed [%d]", result);
net_nfc_util_free_record(carrier_record);
}
}
net_nfc_error_e _net_nfc_server_handover_process_carrier_record(
- ndef_record_s *carrier,
- void *cb,
- void *user_param)
+ ndef_record_s *carrier,
+ void *cb,
+ void *user_param)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_server_handover_process_config_context_t *context = NULL;
net_nfc_conn_handover_carrier_type_e type;
net_nfc_util_get_alternative_carrier_type_from_record(
- carrier,
- &type);
+ carrier,
+ &type);
context->type = type;
context->user_param = user_param;
case NET_NFC_CONN_HANDOVER_CARRIER_BT :
DEBUG_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_BT]");
net_nfc_server_handover_bt_process_carrier_record(
- carrier,
- _net_nfc_server_handover_bt_process_carrier_record_cb,
- context);
+ carrier,
+ _net_nfc_server_handover_bt_process_carrier_record_cb,
+ context);
break;
case NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS :
DEBUG_MSG("[NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS]");
net_nfc_server_handover_bss_process_carrier_record(
- carrier,
- NULL,
- NULL);
+ carrier,
+ NULL,
+ NULL);
_net_nfc_util_free_mem(context);
break;
#if 0
static net_nfc_error_e _net_nfc_server_handover_snep_client_cb(
- net_nfc_snep_handle_h handle,
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ net_nfc_snep_handle_h handle,
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
_net_nfc_server_handover_client_context_t *context =
(_net_nfc_server_handover_client_context_t *)user_param;
DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]",
- type, result, data, user_param);
+ type, result, data, user_param);
switch (type) {
case SNEP_RESP_SUCCESS :
ndef_message_s *selector;
result = _net_nfc_server_handover_create_selector_from_rawdata(
- &selector,
- data);
+ &selector,
+ data);
if (result == NET_NFC_OK) {
if (false /* is low power ??? */) {
result =
_net_nfc_server_handover_process_selector_msg(
- selector,
- user_param);
+ selector,
+ user_param);
} else {
result =
- _net_nfc_server_handover_process_selector_msg(
- selector,
- user_param);
+ _net_nfc_server_handover_process_selector_msg(
+ selector,
+ user_param);
}
if (result != NET_NFC_OK) {
DEBUG_ERR_MSG("_net_nfc_server_handover_process"
- "_selector_msg failed [%d]",result);
+ "_selector_msg failed [%d]",result);
if (context->cb != NULL) {
context->cb(result,
- context->type,
- NULL,
- context->user_param);
+ context->type,
+ NULL,
+ context->user_param);
}
_net_nfc_util_free_mem(context);
}
net_nfc_util_free_ndef_message(selector);
} else {
DEBUG_ERR_MSG("_net_nfc_server_handover_create"
- "_selector_from_rawdata failed [%d]",result);
+ "_selector_from_rawdata failed [%d]",result);
if (context->cb != NULL) {
context->cb(result,
- context->type,
- NULL,
- context->user_param);
+ context->type,
+ NULL,
+ context->user_param);
}
_net_nfc_util_free_mem(context);
}
DEBUG_ERR_MSG("error response [0x%02x]", type);
if (context->cb != NULL) {
context->cb(result, context->type, NULL,
- context->user_param);
+ context->user_param);
}
_net_nfc_util_free_mem(context);
}
static void _net_nfc_server_handover_create_requester_carrier_configs_cb(
- net_nfc_error_e result,
- ndef_message_s *msg,
- void *user_param)
+ net_nfc_error_e result,
+ ndef_message_s *msg,
+ void *user_param)
{
_net_nfc_server_handover_client_context_t *context =
(_net_nfc_server_handover_client_context_t *)user_param;
if (msg != NULL) {
/* convert ndef message */
if ((result = _net_nfc_server_handover_convert_ndef_message_to_data(msg,
- &data)) == NET_NFC_OK) {
+ &data)) == NET_NFC_OK) {
net_nfc_service_snep_client(context->handle,
- SNEP_SAN,
- 0,
- SNEP_REQ_GET,
- &data,
- _net_nfc_server_handover_snep_client_cb,
- context);
+ SNEP_SAN,
+ 0,
+ SNEP_REQ_GET,
+ &data,
+ _net_nfc_server_handover_snep_client_cb,
+ context);
net_nfc_util_free_data(&data);
}
else
{
DEBUG_ERR_MSG("_net_nfc_server_handover_convert"
- "_ndef_message_to_datafailed [%d]",result);
+ "_ndef_message_to_datafailed [%d]",result);
if (context->cb != NULL)
{
context->cb(result,
- context->type,
- NULL,
- context->user_param);
+ context->type,
+ NULL,
+ context->user_param);
}
_net_nfc_util_free_mem(context);
}
if (context->cb != NULL)
{
context->cb(result,
- context->type,
- NULL,
- context->user_param);
+ context->type,
+ NULL,
+ context->user_param);
}
_net_nfc_util_free_mem(context);
}
#if 0
static void _net_nfc_server_handover_server_create_carrier_configs_cb(
- net_nfc_error_e result,
- ndef_message_s *selector,
- void *user_param)
+ net_nfc_error_e result,
+ ndef_message_s *selector,
+ void *user_param)
{
_net_nfc_server_handover_create_config_context_t *context =
- (_net_nfc_server_handover_create_config_context_t *)user_param;
+ (_net_nfc_server_handover_create_config_context_t *)user_param;
data_s data;
if (context == NULL)
if (result == NET_NFC_OK)
{
result = _net_nfc_server_handover_convert_ndef_message_to_data(
- selector,
- &data);
+ selector,
+ &data);
if (result == NET_NFC_OK)
{
/* process message */
_net_nfc_server_handover_process_carrier_record(
- context->record,
- NULL,
- NULL);
+ context->record,
+ NULL,
+ NULL);
result = net_nfc_service_snep_server_send_get_response(
- context->user_param,
- &data);
+ context->user_param,
+ &data);
if (result != NET_NFC_OK)
{
DEBUG_ERR_MSG("net_nfc_service_snep_server"
- "_send_get_response failed [%d]",result);
+ "_send_get_response failed [%d]",result);
}
net_nfc_util_free_data(&data);
}
else
{
DEBUG_ERR_MSG("_net_nfc_server_handover_convert_ndef_message_to_data"
- "failed [%d]",result);
+ "failed [%d]",result);
}
}
else
{
DEBUG_ERR_MSG("_net_nfc_server_handover_create_selector_msg"
- "failed [%d]",result);
+ "failed [%d]",result);
}
_net_nfc_util_free_mem(context);
}
static net_nfc_error_e _net_nfc_server_handover_create_selector_msg(
- net_nfc_snep_handle_h handle,
- ndef_message_s *request,
- void *user_param)
+ net_nfc_snep_handle_h handle,
+ ndef_message_s *request,
+ void *user_param)
{
net_nfc_error_e result;
uint32_t count;
/* fill alternative carrier information */
if ((result =
- _net_nfc_server_handover_get_carrier_record_by_priority_order(
- request,
- &record)) == NET_NFC_OK)
+ _net_nfc_server_handover_get_carrier_record_by_priority_order(
+ request,
+ &record)) == NET_NFC_OK)
{
net_nfc_conn_handover_carrier_type_e type =
- NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
+ NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN;
if ((result = net_nfc_util_get_alternative_carrier_type_from_record(
record,
context->user_param = handle;
net_nfc_util_create_record(record->TNF,
- &record->type_s, &record->id_s,
- &record->payload_s,
- &context->record);
+ &record->type_s, &record->id_s,
+ &record->payload_s,
+ &context->record);
if ((result = _net_nfc_server_handover_create_selector_carrier_configs(
- type,
- _net_nfc_server_handover_server_create_carrier_configs_cb,
- context)) != NET_NFC_OK)
+ type,
+ _net_nfc_server_handover_server_create_carrier_configs_cb,
+ context)) != NET_NFC_OK)
{
DEBUG_ERR_MSG("_create_selector_carrier_configs "
- "failed [%d]", result);
+ "failed [%d]", result);
}
}
else
{
DEBUG_ERR_MSG("get_alternative_carrier_type_from_record "
- "failed [%d]", result);
+ "failed [%d]", result);
}
}
else
{
DEBUG_ERR_MSG("r_get_carrier_record_by_priority_order"
- " failed [%d]", result);
+ " failed [%d]", result);
}
}
else /* low power && count > 1 */
ndef_message_s selector;
if ((result = _net_nfc_server_handover_create_low_power_selector_message(
- request,
- &selector)) == NET_NFC_OK)
+ request,
+ &selector)) == NET_NFC_OK)
{
_net_nfc_server_handover_server_create_carrier_configs_cb(
- NET_NFC_OK,
- &selector,
- user_param);
+ NET_NFC_OK,
+ &selector,
+ user_param);
net_nfc_util_free_ndef_message(&selector);
}
else
{
DEBUG_ERR_MSG("_create_low_power_selector_message"
- "failed [%d]", result);
+ "failed [%d]", result);
}
}
}
else
{
DEBUG_ERR_MSG("net_nfc_util_get_alternative_carrier_record_count"
- "failed [%d]", result);
+ "failed [%d]", result);
}
return result;
static net_nfc_error_e _net_nfc_server_handover_create_server_cb(
- net_nfc_snep_handle_h handle,
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ net_nfc_snep_handle_h handle,
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
DEBUG_SERVER_MSG("type [0x%02x], result [%d], data [%p], user_param [%p]",
- type, result, data, user_param);
+ type, result, data, user_param);
if (result != NET_NFC_OK || data == NULL || data->buffer == NULL)
{
/* TODO : send select response to requester */
result =
- _net_nfc_server_handover_create_requester_from_rawdata(
- &request,
- data);
+ _net_nfc_server_handover_create_requester_from_rawdata(
+ &request,
+ data);
if (result == NET_NFC_OK) {
if (1/* TODO : check version */)
{
_net_nfc_server_handover_create_selector_msg(
- handle,
- request,
- user_param);
+ handle,
+ request,
+ user_param);
}
else
{
DEBUG_ERR_MSG("not supported version [0x%x]",
- result);
+ result);
result = NET_NFC_NOT_SUPPORTED;
}
else
{
DEBUG_ERR_MSG("_net_nfc_server_handover_create"
- "_requester_from_rawdata failed [%d]",result);
+ "_requester_from_rawdata failed [%d]",result);
}
}
break;
static net_nfc_error_e _net_nfc_server_handover_select_carrier_record(
- ndef_message_s *request,
- net_nfc_conn_handover_carrier_type_e *type,
- ndef_record_s **record)
+ ndef_message_s *request,
+ net_nfc_conn_handover_carrier_type_e *type,
+ ndef_record_s **record)
{
net_nfc_error_e result;
uint32_t count;
/* get requester message */
if ((result = net_nfc_util_get_alternative_carrier_record_count(request,
- &count)) == NET_NFC_OK)
+ &count)) == NET_NFC_OK)
{
if (1/* power state */ || count == 1)
{
/* fill alternative carrier information */
if ((result =
- _net_nfc_server_handover_get_carrier_record_by_priority_order(
+ _net_nfc_server_handover_get_carrier_record_by_priority_order(
request,
&temp)) == NET_NFC_OK)
{
if ((result =
- net_nfc_util_get_alternative_carrier_type_from_record(
- temp,
- type)) == NET_NFC_OK)
+ net_nfc_util_get_alternative_carrier_type_from_record(
+ temp,
+ type)) == NET_NFC_OK)
{
net_nfc_util_create_record(temp->TNF,
- &temp->type_s, &temp->id_s,
- &temp->payload_s,
- record);
+ &temp->type_s, &temp->id_s,
+ &temp->payload_s,
+ record);
}
else
{
DEBUG_ERR_MSG("net_nfc_util_get_alternative"
- "_carrier_type_from_record failed [%d]", result);
+ "_carrier_type_from_record failed [%d]", result);
}
}
else
else
{
DEBUG_ERR_MSG("net_nfc_util_get_alternative_carrier_record_count "
- "failed [%d]", result);
+ "failed [%d]", result);
}
return result;
#endif
static void _net_nfc_server_handover_create_carrier_configs_2_cb(
- net_nfc_error_e result,
- ndef_message_s *selector,
- void *user_param)
+ net_nfc_error_e result,
+ ndef_message_s *selector,
+ void *user_param)
{
net_nfc_handover_context_t *context =
(net_nfc_handover_context_t *)user_param;
DEBUG_SERVER_MSG("_net_nfc_server_handover_server_create_carrier_config_cb"
- "result [%d]",result);
+ "result [%d]",result);
if (context == NULL)
{
if (result == NET_NFC_OK) {
result = _net_nfc_server_handover_convert_ndef_message_to_data(
- selector,
- &context->data);
+ selector,
+ &context->data);
DEBUG_SERVER_MSG("selector message created, length [%d]",
- context->data.length);
+ context->data.length);
context->state = NET_NFC_LLCP_STEP_03;
}
else
{
DEBUG_ERR_MSG("_net_nfc_server_handover_create_selector_msg failed [%d]",
- result);
+ result);
context->state = NET_NFC_MESSAGE_LLCP_ERROR;
}
}
static void _net_nfc_server_handover_process_carrier_record_2_cb(
- net_nfc_error_e result,
- net_nfc_conn_handover_carrier_type_e type,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_conn_handover_carrier_type_e type,
+ data_s *data,
+ void *user_param)
{
net_nfc_handover_context_t *context =
(net_nfc_handover_context_t *)user_param;
DEBUG_SERVER_MSG("_net_nfc_server_handover_server_process_carrier_record_cb"
- "result [%d]",result);
+ "result [%d]",result);
context->result = result;
if (result == NET_NFC_OK)
}
static void _net_nfc_server_handover_get_response_process(
- net_nfc_handover_context_t *context)
+ net_nfc_handover_context_t *context)
{
net_nfc_error_e result;
if (result != NET_NFC_OK)
{
DEBUG_ERR_MSG("_net_nfc_server_handover_create_"
- "selector_carrier_config failed [%d]",result);
+ "selector_carrier_config failed [%d]",result);
}
break;
if (result != NET_NFC_OK)
{
DEBUG_ERR_MSG("_net_nfc_server_handover_process_carrier_record"
- "failed [%d]",result);
+ "failed [%d]",result);
}
break;
/* response select message */
result = net_nfc_server_snep_server_send_get_response(
- (net_nfc_snep_handle_h)context->handle,
- &context->data);
+ (net_nfc_snep_handle_h)context->handle,
+ &context->data);
break;
case NET_NFC_STATE_ERROR :
}
static bool _net_nfc_server_handover_get_response_cb(
- net_nfc_snep_handle_h handle,
- uint32_t type,
- uint32_t max_len,
- data_s *data,
- void *user_param)
+ net_nfc_snep_handle_h handle,
+ uint32_t type,
+ uint32_t max_len,
+ data_s *data,
+ void *user_param)
{
net_nfc_error_e result;
ndef_message_s *request;
DEBUG_SERVER_MSG("type [%d], data [%p], user_param [%p]",
- type, data, user_param);
+ type, data, user_param);
if (data == NULL || data->buffer == NULL)
{
/* TODO : send select response to requester */
result = _net_nfc_server_handover_create_requester_from_rawdata(
- &request,
- data);
+ &request,
+ data);
if (result == NET_NFC_OK)
{
ndef_record_s *record;
if (_net_nfc_server_handover_select_carrier_record(
- request,
- &type,
- &record) == NET_NFC_OK)
+ request,
+ &type,
+ &record) == NET_NFC_OK)
{
net_nfc_handover_context_t *context = NULL;
context->state = NET_NFC_LLCP_STEP_02;
net_nfc_util_create_record(record->TNF,
- &record->type_s,
- &record->id_s,
- &record->payload_s,
- &context->record);
+ &record->type_s,
+ &record->id_s,
+ &record->payload_s,
+ &context->record);
_net_nfc_server_handover_get_response_process(context);
}
else
{
DEBUG_SERVER_MSG("it is not handover requester message, [%d]",
- result);
+ result);
}
return (result == NET_NFC_OK);
////////////////////////////////////////////////////////////////////////////////
static void _net_nfc_server_handover_server_process_carrier_record_cb(
- net_nfc_error_e result,
- net_nfc_conn_handover_carrier_type_e type,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_conn_handover_carrier_type_e type,
+ data_s *data,
+ void *user_param)
{
net_nfc_handover_context_t *context =
(net_nfc_handover_context_t *)user_param;
}
static void _net_nfc_server_handover_server_create_carrier_config_cb(
- net_nfc_error_e result,
- ndef_message_s *selector,
- void *user_param)
+ net_nfc_error_e result,
+ ndef_message_s *selector,
+ void *user_param)
{
net_nfc_handover_context_t *context =
(net_nfc_handover_context_t *)user_param;
if (result == NET_NFC_OK)
{
result = _net_nfc_server_handover_convert_ndef_message_to_data(
- selector,
- &context->data);
+ selector,
+ &context->data);
DEBUG_SERVER_MSG("selector message created, length [%d]",
- context->data.length);
+ context->data.length);
context->state = NET_NFC_LLCP_STEP_03;
}
else
}
static void _net_nfc_server_handover_server_recv_cb(
- net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param)
{
net_nfc_handover_context_t *context =
(net_nfc_handover_context_t *)user_param;
if (result == NET_NFC_OK)
{
result = _net_nfc_server_handover_create_requester_from_rawdata(
- &request,
- data);
+ &request,
+ data);
if (result == NET_NFC_OK)
{
ndef_record_s *record;
if (_net_nfc_server_handover_select_carrier_record(
- request,
- &context->type,
- &record) == NET_NFC_OK)
+ request,
+ &context->type,
+ &record) == NET_NFC_OK)
{
net_nfc_util_create_record(record->TNF,
- &record->type_s, &record->id_s,
- &record->payload_s,
- &context->record);
+ &record->type_s, &record->id_s,
+ &record->payload_s,
+ &context->record);
context->state = NET_NFC_LLCP_STEP_02;
}
}
net_nfc_util_free_ndef_message(request);
- }
+ }
else
{
DEBUG_ERR_MSG("_net_nfc_server_handover_create"
- "_requester_from_rawdata failed [%d]",result);
+ "_requester_from_rawdata failed [%d]",result);
context->state = NET_NFC_MESSAGE_LLCP_ERROR;
}
}
else
{
DEBUG_ERR_MSG("net_nfc_server_llcp_simple_receive failed [%d]",
- result);
+ result);
context->state = NET_NFC_MESSAGE_LLCP_ERROR;
}
}
static void _net_nfc_server_handover_server_send_cb(net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param)
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param)
{
net_nfc_handover_context_t *context =
(net_nfc_handover_context_t *)user_param;
DEBUG_SERVER_MSG("_net_nfc_server_handover_server_send_cb"
- " socket [%x], result [%d]", socket, result);
+ " socket [%x], result [%d]", socket, result);
context->result = result;
else
{
DEBUG_ERR_MSG("net_nfc_server_llcp_simple_send failed [%d]",
- result);
+ result);
context->state = NET_NFC_MESSAGE_LLCP_ERROR;
}
}
static void _net_nfc_server_handover_server_process(
- net_nfc_handover_context_t *context)
+ net_nfc_handover_context_t *context)
{
if (context == NULL)
{
DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_02");
context->result = _net_nfc_server_handover_create_selector_carrier_configs(
- context->type,
- _net_nfc_server_handover_server_create_carrier_config_cb,
- context);
+ context->type,
+ _net_nfc_server_handover_server_create_carrier_config_cb,
+ context);
if (context->result != NET_NFC_OK)
{
DEBUG_ERR_MSG("_net_nfc_server_handover_create_selector"
- "_carrier_configs failed [%d]", context->result);
+ "_carrier_configs failed [%d]", context->result);
}
break;
DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_03");
context->result = _net_nfc_server_handover_process_carrier_record(
- context->record,
- _net_nfc_server_handover_server_process_carrier_record_cb,
- context);
+ context->record,
+ _net_nfc_server_handover_server_process_carrier_record_cb,
+ context);
if (context->result != NET_NFC_OK)
{
DEBUG_ERR_MSG("_net_nfc_server_handover_process_carrier_"
- "record failed [%d]",context->result);
+ "record failed [%d]",context->result);
}
break;
/* send select message */
net_nfc_server_llcp_simple_send(
- context->handle,
- context->socket,
- &context->data,
- _net_nfc_server_handover_server_send_cb,
- context);
+ context->handle,
+ context->socket,
+ &context->data,
+ _net_nfc_server_handover_server_send_cb,
+ context);
break;
case NET_NFC_STATE_ERROR :
/* error, invoke callback */
DEBUG_ERR_MSG("handover_server failed, [%d]",
- context->result);
+ context->result);
/* restart?? */
break;
}
static void _net_nfc_server_handover_server_error_cb(
- net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param)
{
net_nfc_handover_context_t *context =
(net_nfc_handover_context_t *)user_param;
DEBUG_ERR_MSG("result [%d], socket [%x], user_param [%p]",
- result, socket, user_param);
+ result, socket, user_param);
if (context == NULL)
{
}
static void _net_nfc_server_handover_server_incomming_cb(
- net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param)
{
DEBUG_SERVER_MSG("result [%d], socket [%x], user_param [%p]",
- result, socket, user_param);
+ result, socket, user_param);
net_nfc_handover_context_t *accept_context = NULL;
if (result != NET_NFC_OK)
{
DEBUG_ERR_MSG("net_nfc_server_llcp_simple_accept failed, [%d]",
- result);
+ result);
goto ERROR;
}
}
net_nfc_error_e net_nfc_server_handover_default_server_start(
- net_nfc_target_handle_s *handle)
+ net_nfc_target_handle_s *handle)
{
net_nfc_error_e result;
/* start default handover server using snep */
result =
- net_nfc_server_snep_default_server_register_get_response_cb(
- _net_nfc_server_handover_get_response_cb,
- NULL);
+ net_nfc_server_snep_default_server_register_get_response_cb(
+ _net_nfc_server_handover_get_response_cb,
+ NULL);
/* start default handover server */
result = net_nfc_server_llcp_simple_server(
if (result == NET_NFC_OK)
{
DEBUG_SERVER_MSG("start handover server, san [%s], sap [%d]",
- CH_SAN,CH_SAP);
+ CH_SAN,CH_SAP);
}
else
{
DEBUG_ERR_MSG("net_nfc_server_llcp_simple_server failed, [%d]",
- result);
+ result);
}
return result;
}
static void _handover_default_activate_cb(int event,
- net_nfc_target_handle_s *handle,
- uint32_t sap, const char *san, void *user_param)
+ net_nfc_target_handle_s *handle,
+ uint32_t sap, const char *san, void *user_param)
{
net_nfc_error_e result;
DEBUG_SERVER_MSG("event [%d], handle [%p], sap [%d], san [%s]",
- event, handle, sap, san);
+ event, handle, sap, san);
if (event == NET_NFC_LLCP_START) {
/* start default handover server using snep */
result = net_nfc_server_snep_default_server_register_get_response_cb(
- _net_nfc_server_handover_get_response_cb, NULL);
+ _net_nfc_server_handover_get_response_cb, NULL);
/* start default handover server */
result = net_nfc_server_llcp_simple_server(handle,
- CH_SAN, CH_SAP,
- _net_nfc_server_handover_server_incomming_cb,
- _net_nfc_server_handover_server_error_cb, NULL);
+ CH_SAN, CH_SAP,
+ _net_nfc_server_handover_server_incomming_cb,
+ _net_nfc_server_handover_server_error_cb, NULL);
if (result == NET_NFC_OK) {
DEBUG_SERVER_MSG("start handover server, san [%s], sap [%d]",
- CH_SAN, CH_SAP);
+ CH_SAN, CH_SAP);
} else {
DEBUG_ERR_MSG("net_nfc_service_llcp_server failed, [%d]",
- result);
+ result);
}
} else if (event == NET_NFC_LLCP_UNREGISTERED) {
/* unregister server, do nothing */
/* start default snep server */
return net_nfc_server_llcp_register_service(id,
- CH_SAP,
- CH_SAN,
- _handover_default_activate_cb,
- NULL);
+ CH_SAP,
+ CH_SAN,
+ _handover_default_activate_cb,
+ NULL);
}
net_nfc_error_e net_nfc_server_handover_default_server_unregister()
/* start default snep server */
return net_nfc_server_llcp_unregister_service(id,
- CH_SAP,
- CH_SAN);
+ CH_SAP,
+ CH_SAN);
}
////////////////////////////////////////////////////////////////////////////////
static void _net_nfc_server_handover_client_post_process_cb(
- net_nfc_error_e result,
- net_nfc_conn_handover_carrier_type_e type,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_conn_handover_carrier_type_e type,
+ data_s *data,
+ void *user_param)
{
net_nfc_handover_context_t *context =
(net_nfc_handover_context_t *)user_param;
}
static void _net_nfc_server_handover_client_process_carrier_record_cb(
- net_nfc_error_e result,
- net_nfc_conn_handover_carrier_type_e type,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_conn_handover_carrier_type_e type,
+ data_s *data,
+ void *user_param)
{
net_nfc_handover_context_t *context =
(net_nfc_handover_context_t *)user_param;
}
static void _net_nfc_server_handover_client_recv_cb(
- net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param)
{
net_nfc_handover_context_t *context =
(net_nfc_handover_context_t *)user_param;
ndef_record_s *record;
result = _net_nfc_server_handover_create_selector_from_rawdata(
- &selector,
- data);
+ &selector,
+ data);
if (result == NET_NFC_OK)
{
result =
- _net_nfc_server_handover_get_carrier_record_by_priority_order(
- selector,
- &record);
+ _net_nfc_server_handover_get_carrier_record_by_priority_order(
+ selector,
+ &record);
if (result == NET_NFC_OK)
{
net_nfc_util_create_record(
- record->TNF,
- &record->type_s, &record->id_s,
- &record->payload_s,
- &context->record);
+ record->TNF,
+ &record->type_s, &record->id_s,
+ &record->payload_s,
+ &context->record);
context->state = NET_NFC_LLCP_STEP_04;
}
else
{
DEBUG_ERR_MSG("_net_nfc_server_handover_create"
- "_selector_from_rawdata failed, [%d]",result);
+ "_selector_from_rawdata failed, [%d]",result);
context->state = NET_NFC_STATE_ERROR;
}
}
else
{
DEBUG_ERR_MSG("net_nfc_server_llcp_simple_receive failed, [%d]",
- result);
+ result);
context->state = NET_NFC_STATE_ERROR;
}
}
static void _net_nfc_server_handover_client_send_cb(
- net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param)
{
net_nfc_handover_context_t *context =
(net_nfc_handover_context_t *)user_param;
else
{
DEBUG_ERR_MSG("net_nfc_server_llcp_simple_client failed, [%d]",
- result);
+ result);
context->state = NET_NFC_STATE_ERROR;
}
}
static void _net_nfc_server_handover_client_create_carrier_configs_cb(
- net_nfc_error_e result,
- ndef_message_s *msg,
- void *user_param)
+ net_nfc_error_e result,
+ ndef_message_s *msg,
+ void *user_param)
{
net_nfc_handover_context_t *context =
(net_nfc_handover_context_t *)user_param;
if (msg != NULL)
{
if ((result =
- _net_nfc_server_handover_convert_ndef_message_to_data(
- msg,
- &context->data)) == NET_NFC_OK)
+ _net_nfc_server_handover_convert_ndef_message_to_data(
+ msg,
+ &context->data)) == NET_NFC_OK)
{
context->state = NET_NFC_LLCP_STEP_02;
}
else
{
DEBUG_ERR_MSG("_net_nfc_server_handover_convert_ndef_"
- "message_to_data failed [%d]",result);
+ "message_to_data failed [%d]",result);
context->state = NET_NFC_STATE_ERROR;
context->result = result;
}
////////////////////////////////////////////////////////////////////////////////
static void _net_nfc_server_handover_client_process(
- net_nfc_handover_context_t *context)
+ net_nfc_handover_context_t *context)
{
net_nfc_error_e result;
DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_01");
if ((result = _net_nfc_server_handover_create_requester_carrier_configs(
- context->type,
- _net_nfc_server_handover_client_create_carrier_configs_cb,
- context)) != NET_NFC_OK)
+ context->type,
+ _net_nfc_server_handover_client_create_carrier_configs_cb,
+ context)) != NET_NFC_OK)
{
DEBUG_ERR_MSG("_net_nfc_server_handover_create_requester"
- "_carrier_configs failed [%d]",result);
+ "_carrier_configs failed [%d]",result);
}
break;
/* send request */
net_nfc_server_llcp_simple_send(
- context->handle,
- context->socket,
- &context->data,
- _net_nfc_server_handover_client_send_cb,
- context);
+ context->handle,
+ context->socket,
+ &context->data,
+ _net_nfc_server_handover_client_send_cb,
+ context);
break;
case NET_NFC_LLCP_STEP_03 :
/* receive response */
net_nfc_server_llcp_simple_receive(context->handle,
- context->socket,
- _net_nfc_server_handover_client_recv_cb,
- context);
+ context->socket,
+ _net_nfc_server_handover_client_recv_cb,
+ context);
break;
case NET_NFC_LLCP_STEP_04 :
if (result != NET_NFC_OK)
{
DEBUG_ERR_MSG("_net_nfc_server_handover_process_carrier_record"
- "failed [%d]",result);
+ "failed [%d]",result);
}
break;
if (context->type == NET_NFC_CONN_HANDOVER_CARRIER_BT)
{
net_nfc_server_handover_bt_post_process(
- &context->data,
- _net_nfc_server_handover_client_post_process_cb,
- context);
+ &context->data,
+ _net_nfc_server_handover_client_post_process_cb,
+ context);
}
else
{
static void _net_nfc_server_handover_client_connected_cb(
- net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param)
{
DEBUG_SERVER_MSG("result [%d], socket [%x], user_param [%p]",
- result, socket, user_param);
+ result, socket, user_param);
if (result == NET_NFC_OK)
{
}
static void _net_nfc_server_handover_client_error_cb(
- net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param)
{
DEBUG_ERR_MSG("result [%d], socket [%x], user_param [%p]",
- result, socket, user_param);
+ result, socket, user_param);
if (false)
{
net_nfc_error_e net_nfc_server_handover_default_client_start(
- net_nfc_target_handle_s *handle,
- void *user_data)
+ net_nfc_target_handle_s *handle,
+ void *user_data)
{
net_nfc_error_e result;
if (result != NET_NFC_OK)
{
- DEBUG_ERR_MSG("net_nfc_server_llcp_simple_client"
- " failed, [%d]",result);
+ DEBUG_ERR_MSG("net_nfc_server_llcp_simple_client"
+ " failed, [%d]",result);
}
return result;
*/
#include <arpa/inet.h>
+#include "net_nfc_debug_internal.h"
#include "net_nfc_server_p2p.h"
#include "net_nfc_server_llcp.h"
-
+#include "net_nfc_server_controller.h"
+#include "net_nfc_server_util.h"
#include "net_nfc_server_process_npp.h"
-#include "net_nfc_controller_internal.h"
-#include "net_nfc_app_util_internal.h"
-#include "net_nfc_debug_internal.h"
-
typedef struct _net_nfc_npp_entity_t
{
uint8_t op;
#define NPP_ACTION_CODE 0x01
static net_nfc_error_e npp_create_message(data_s *data,
- data_s *message);
+ data_s *message);
/* server */
static void npp_server_receive_cb(net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- gpointer user_data);
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ gpointer user_data);
static void npp_server_process(NppData *npp_data);
static void npp_listen_cb(net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- gpointer user_data);
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ gpointer user_data);
/* client */
static void npp_client_disconnected_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param);
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param);
static void npp_client_send_cb(net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- gpointer user_data);
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ gpointer user_data);
static void npp_client_process(NppData *npp_data);
static void npp_connected_cb(net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- gpointer user_data);
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ gpointer user_data);
static void npp_socket_error_cb(net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- gpointer user_data);
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ gpointer user_data);
static void npp_default_server_cb(net_nfc_error_e result,
- data_s *data,
- gpointer user_data);
+ data_s *data,
+ gpointer user_data);
static void npp_default_client_cb(net_nfc_error_e result,
- data_s *data,
- gpointer user_data);
+ data_s *data,
+ gpointer user_data);
static net_nfc_error_e npp_create_message(data_s *data,
- data_s *message)
+ data_s *message)
{
uint32_t length = NPP_HEADER_LEN;
net_nfc_npp_msg_t *msg;
}
static void npp_server_receive_cb(net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- gpointer user_data)
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ gpointer user_data)
{
NppData *npp_data;
if (data->length < NPP_HEADER_LEN)
{
DEBUG_ERR_MSG("too short data, length [%d]",
- data->length);
+ data->length);
/* FIXME!!! what should I do. */
if(npp_data->callback)
{
GET_MINOR_VER(message->version > NPP_MINOR_VER))
{
DEBUG_ERR_MSG("not supported version, version [0x%02x]",
- message->version);
+ message->version);
if(npp_data->callback)
{
if (entity_count > NPP_NDEF_ENTRY)
{
DEBUG_ERR_MSG("too many entities, [%d]",
- message->entity_count);
+ message->entity_count);
if(npp_data->callback)
{
if (entity->op != NPP_ACTION_CODE) {
DEBUG_ERR_MSG("not supported action code, [0x%02x]",
- entity->op);
+ entity->op);
if(npp_data->callback)
{
length = htonl(entity->length);
DEBUG_SERVER_MSG("action code [0x%02x], length [%d]",
- entity->op, length);
+ entity->op, length);
if (length > 0)
{
/* receive request */
result = net_nfc_server_llcp_simple_receive(npp_data->handle,
- npp_data->socket,
- npp_server_receive_cb,
- npp_data);
+ npp_data->socket,
+ npp_server_receive_cb,
+ npp_data);
if (result != NET_NFC_OK)
{
if (npp_data->callback)
}
static void npp_listen_cb(net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- gpointer user_data)
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ gpointer user_data)
{
NppData *npp_data;
NppData *accept_data;
accept_data->user_data = npp_data->user_data;
result = net_nfc_server_llcp_simple_accept(handle,
- socket,
- npp_socket_error_cb,
- accept_data);
+ socket,
+ npp_socket_error_cb,
+ accept_data);
if (result != NET_NFC_OK)
{
DEBUG_ERR_MSG("%s failed",
/* client */
static void npp_client_disconnected_cb(net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
DEBUG_SERVER_MSG("disconnected! [%d]", result);
}
static void npp_client_send_cb(net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- gpointer user_data)
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ gpointer user_data)
{
NppData *npp_data;
}
net_nfc_controller_llcp_disconnect(npp_data->handle,
- npp_data->socket,
- &result,
- npp_client_disconnected_cb,
- NULL);
+ npp_data->socket,
+ &result,
+ npp_client_disconnected_cb,
+ NULL);
g_free(npp_data->data.buffer);
g_free(npp_data);
/* send request */
result = net_nfc_server_llcp_simple_send(npp_data->handle,
- npp_data->socket,
- &data,
- npp_client_send_cb,
- npp_data);
+ npp_data->socket,
+ &data,
+ npp_client_send_cb,
+ npp_data);
if (result != NET_NFC_OK)
{
DEBUG_ERR_MSG("%s failed [%d]",
- "net_nfc_server_llcp_simple_send",
- result);
+ "net_nfc_server_llcp_simple_send",
+ result);
if (npp_data->callback)
npp_data->callback(result, NULL, npp_data->user_data);
}
static void npp_connected_cb(net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- gpointer user_data)
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ gpointer user_data)
{
NppData *npp_data;
}
static void npp_socket_error_cb(net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- gpointer user_data)
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ gpointer user_data)
{
NppData *npp_data;
}
static void npp_default_server_cb(net_nfc_error_e result,
- data_s *data,
- gpointer user_data)
+ data_s *data,
+ gpointer user_data)
{
DEBUG_SERVER_MSG("result [%d], data [%p], user_data [%p]",
result, data, user_data);
}
static void npp_default_client_cb(net_nfc_error_e result,
- data_s *data,
- gpointer user_data)
+ data_s *data,
+ gpointer user_data)
{
NppClientStartData *npp_client_data;
/* public apis */
net_nfc_error_e net_nfc_server_npp_server(net_nfc_target_handle_s *handle,
- char *san,
- sap_t sap,
- net_nfc_server_npp_callback callback,
- gpointer user_data)
+ char *san,
+ sap_t sap,
+ net_nfc_server_npp_callback callback,
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
npp_data->user_data = user_data;
result = net_nfc_server_llcp_simple_server(handle,
- san,
- sap,
- npp_listen_cb,
- npp_socket_error_cb,
- npp_data);
+ san,
+ sap,
+ npp_listen_cb,
+ npp_socket_error_cb,
+ npp_data);
if (result != NET_NFC_OK)
{
DEBUG_ERR_MSG("%s failed",
- "net_nfc_server_llcp_simple_server");
+ "net_nfc_server_llcp_simple_server");
if (npp_data->callback)
npp_data->callback(result, NULL, npp_data->user_data);
}
net_nfc_error_e net_nfc_server_npp_client(net_nfc_target_handle_s *handle,
- char *san,
- sap_t sap,
- data_s *data,
- net_nfc_server_npp_callback callback,
- gpointer user_data)
+ char *san,
+ sap_t sap,
+ data_s *data,
+ net_nfc_server_npp_callback callback,
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;;
net_nfc_llcp_config_info_s config;
}
if(net_nfc_controller_llcp_get_remote_config(handle,
- &config,
- &result) == false)
+ &config,
+ &result) == false)
{
DEBUG_ERR_MSG("%s failed [%d]",
- "net_nfc_controller_llcp_get_remote_config",
- result);
+ "net_nfc_controller_llcp_get_remote_config",
+ result);
return result;
}
if (config.miu <
- data->length + NPP_HEADER_LEN + NPP_ENTITY_HEADER_LEN)
+ data->length + NPP_HEADER_LEN + NPP_ENTITY_HEADER_LEN)
{
DEBUG_ERR_MSG("too large message, max [%d], request [%d]",
- config.miu - (NPP_HEADER_LEN + NPP_ENTITY_HEADER_LEN),
- data->length);
+ config.miu - (NPP_HEADER_LEN + NPP_ENTITY_HEADER_LEN),
+ data->length);
return NET_NFC_INSUFFICIENT_STORAGE;
}
npp_data->data.length = data->length;
result = net_nfc_server_llcp_simple_client(handle,
- san,
- sap,
- npp_connected_cb,
- npp_socket_error_cb,
- npp_data);
+ san,
+ sap,
+ npp_connected_cb,
+ npp_socket_error_cb,
+ npp_data);
if (result != NET_NFC_OK)
{
DEBUG_ERR_MSG("%s failed",
- "net_nfc_server_llcp_simple_client");
+ "net_nfc_server_llcp_simple_client");
if (npp_data->callback)
{
if (san != NULL)
{
DEBUG_SERVER_MSG("start npp client, san [%s], result [%d]",
- san, result);
+ san, result);
}
else
{
DEBUG_SERVER_MSG("start npp client, sap [%d], result [%d]",
- sap, result);
+ sap, result);
}
return result;
}
net_nfc_error_e net_nfc_server_npp_default_server_start(
- net_nfc_target_handle_s *handle)
+ net_nfc_target_handle_s *handle)
{
/* start default npp server */
return net_nfc_server_npp_server(handle,
- NPP_SAN,
- NPP_SAP,
- npp_default_server_cb,
- (gpointer)1234);
+ NPP_SAN,
+ NPP_SAP,
+ npp_default_server_cb,
+ (gpointer)1234);
}
static void _npp_default_activate_cb(int event,
- net_nfc_target_handle_s *handle,
- uint32_t sap, const char *san, void *user_param)
+ net_nfc_target_handle_s *handle,
+ uint32_t sap, const char *san, void *user_param)
{
net_nfc_error_e result;
DEBUG_SERVER_MSG("event [%d], handle [%p], sap [%d], san [%s]",
- event, handle, sap, san);
+ event, handle, sap, san);
if (event == NET_NFC_LLCP_START) {
/* start default npp server */
result = net_nfc_server_npp_server(handle, (char *)san, sap,
- npp_default_server_cb, user_param);
+ npp_default_server_cb, user_param);
if (result != NET_NFC_OK) {
DEBUG_ERR_MSG("net_nfc_server_npp_server failed, [%d]",
- result);
+ result);
}
} else if (event == NET_NFC_LLCP_UNREGISTERED) {
/* unregister server, do nothing */
/* start default npp server */
return net_nfc_server_llcp_register_service(id,
- NPP_SAP,
- NPP_SAN,
- _npp_default_activate_cb,
- NULL);
+ NPP_SAP,
+ NPP_SAN,
+ _npp_default_activate_cb,
+ NULL);
}
net_nfc_error_e net_nfc_server_npp_default_server_unregister()
/* start default npp server */
return net_nfc_server_llcp_unregister_service(id,
- NPP_SAP,
- NPP_SAN);
+ NPP_SAP,
+ NPP_SAN);
}
net_nfc_error_e net_nfc_server_npp_default_client_start(
- net_nfc_target_handle_s *handle,
- data_s *data,
- int client,
- gpointer user_data)
+ net_nfc_target_handle_s *handle,
+ data_s *data,
+ int client,
+ gpointer user_data)
{
NppClientStartData *npp_client_data;
npp_client_data->user_data = user_data;
result = net_nfc_server_npp_client(handle,
- NPP_SAN,
- NPP_SAP,
- data,
- npp_default_client_cb,
- npp_client_data);
+ NPP_SAN,
+ NPP_SAP,
+ data,
+ npp_default_client_cb,
+ npp_client_data);
if (result != NET_NFC_OK)
{
*/
#include <glib.h>
-#include "net_nfc_server_p2p.h"
#include "net_nfc_debug_internal.h"
#include "net_nfc_util_defines.h"
#include "net_nfc_util_internal.h"
+#include "net_nfc_util_gdbus_internal.h"
#include "net_nfc_server_llcp.h"
-#include "net_nfc_controller_internal.h"
+#include "net_nfc_server_p2p.h"
+#include "net_nfc_server_controller.h"
#include "net_nfc_server_snep.h"
+#include "net_nfc_server_util.h"
#include "net_nfc_server_process_snep.h"
-#include "net_nfc_app_util_internal.h"
-#include "net_nfc_util_gdbus_internal.h"
typedef struct _net_nfc_server_snep_msg_t
_net_nfc_server_snep_service_context_t;
typedef void (*_net_nfc_server_snep_operation_cb)(
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param);
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param);
typedef struct _net_nfc_server_snep_op_context_t
{
static GList *list_listen_cb = NULL;
static void _net_nfc_server_snep_recv(
- net_nfc_server_snep_op_context_t *context);
+ net_nfc_server_snep_op_context_t *context);
static void _net_nfc_server_snep_send(
- net_nfc_server_snep_op_context_t *context);
+ net_nfc_server_snep_op_context_t *context);
static net_nfc_error_e net_nfc_server_snep_recv(
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- _net_nfc_server_snep_operation_cb cb,
- void *user_param);
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ _net_nfc_server_snep_operation_cb cb,
+ void *user_param);
static net_nfc_error_e net_nfc_server_snep_send(
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- uint32_t type,
- data_s *data,
- _net_nfc_server_snep_operation_cb cb,
- void *user_param);
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ uint32_t type,
+ data_s *data,
+ _net_nfc_server_snep_operation_cb cb,
+ void *user_param);
static void _net_nfc_server_snep_client_process(
- net_nfc_server_snep_job_t *job);
+ net_nfc_server_snep_job_t *job);
static void _net_nfc_server_snep_server_process(
- net_nfc_server_snep_context_t *context);
+ net_nfc_server_snep_context_t *context);
/**********************************************************************/
static bool _net_nfc_server_snep_add_get_response_cb(
- net_nfc_server_snep_listen_cb cb,
- void *user_param)
+ net_nfc_server_snep_listen_cb cb,
+ void *user_param)
{
net_nfc_server_cb_data_t *data = NULL;
bool result = false;
}
static gint _net_nfc_server_snep_compare_func_cb(
- gconstpointer a,
- gconstpointer b)
+ gconstpointer a,
+ gconstpointer b)
{
net_nfc_server_cb_data_t *data = (net_nfc_server_cb_data_t *)a;
}
static void _net_nfc_server_snep_del_get_response_cb(
- net_nfc_server_snep_listen_cb cb)
+ net_nfc_server_snep_listen_cb cb)
{
GList *list;
list = g_list_find_custom(list_listen_cb,
- cb,
- _net_nfc_server_snep_compare_func_cb);
+ cb,
+ _net_nfc_server_snep_compare_func_cb);
if (list != NULL)
list_listen_cb = g_list_delete_link(list_listen_cb, list);
}
static bool _net_nfc_server_snep_process_get_response_cb(
- net_nfc_target_handle_s *handle,
- data_s *data,
- uint32_t max_len)
+ net_nfc_target_handle_s *handle,
+ data_s *data,
+ uint32_t max_len)
{
GList *list = list_listen_cb;
{
DEBUG_SERVER_MSG("invoke callback [%p]", cb_data->cb);
if (cb_data->cb(handle,
- SNEP_REQ_GET,
- max_len,
- data,
- cb_data->user_param) == true)
- return true;
+ SNEP_REQ_GET,
+ max_len,
+ data,
+ cb_data->user_param) == true)
+ return true;
}
}
return false;
}
-static net_nfc_server_snep_op_context_t *
+ static net_nfc_server_snep_op_context_t *
_net_nfc_server_snep_create_send_context(uint32_t type,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *cb,
- void *user_param)
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *cb,
+ void *user_param)
{
net_nfc_server_snep_op_context_t *context = NULL;
uint32_t data_len = 0;
net_nfc_error_e result;
if (net_nfc_controller_llcp_get_remote_config(handle,
- &config, &result) == false)
+ &config, &result) == false)
{
DEBUG_ERR_MSG("net_nfc_controller_llcp_get_remote_config failed, [%d]",
- result);
+ result);
return NULL;
}
return context;
}
-static net_nfc_server_snep_op_context_t *
+ static net_nfc_server_snep_op_context_t *
_net_nfc_server_snep_create_recv_context(
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- void *cb,
- void *user_param)
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ void *cb,
+ void *user_param)
{
net_nfc_server_snep_op_context_t *context = NULL;
net_nfc_llcp_config_info_s config;
net_nfc_error_e result;
if (net_nfc_controller_llcp_get_remote_config(handle,
- &config,
- &result) == false)
+ &config,
+ &result) == false)
{
DEBUG_ERR_MSG("net_nfc_controller_llcp_get_remote_config failed, [%d]",
- result);
+ result);
return NULL;
}
}
static void _net_nfc_server_snep_destory_context(
- net_nfc_server_snep_op_context_t *context)
+ net_nfc_server_snep_op_context_t *context)
{
if (context != NULL)
{
if (context->data.buffer != NULL)
net_nfc_util_free_data(&context->data);
- _net_nfc_util_free_mem(context);
+ _net_nfc_util_free_mem(context);
}
}
static void _net_nfc_server_recv_fragment_cb(
- net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_llcp_socket_t socket,
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
net_nfc_server_snep_op_context_t *context =
(net_nfc_server_snep_op_context_t *)user_param;
uint32_t length;
DEBUG_SERVER_MSG("_net_nfc_server_recv_fragment_cb,"
- " socket [%x], result [%d]",socket, result);
+ " socket [%x], result [%d]",socket, result);
if (context == NULL)
return;
if (data->length < SNEP_HEADER_LEN)
{
DEBUG_ERR_MSG("too short data, length [%d]",
- data->length);
+ data->length);
/* FIXME!!! what should I do. */
context->type = SNEP_RESP_BAD_REQ;
context->state = NET_NFC_STATE_ERROR;
if (length > SNEP_MAX_LEN)
{
DEBUG_ERR_MSG("too long snep message, length [%d]",
- length);
+ length);
if (IS_SNEP_REQ(msg->op))
{
context->type = SNEP_RESP_EXCESS_DATA;
}
if (IS_SNEP_REQ(msg->op) &&
- GET_MAJOR_VER(msg->version) > SNEP_MAJOR_VER)
+ GET_MAJOR_VER(msg->version) > SNEP_MAJOR_VER)
{
DEBUG_ERR_MSG("not supported version, version [0x%02x]",
- msg->version);
+ msg->version);
context->type = SNEP_RESP_UNSUPPORTED_VER;
context->state = NET_NFC_LLCP_STEP_04;
context->result = NET_NFC_NOT_SUPPORTED;
}
DEBUG_SERVER_MSG("incoming message, type [0x%02x], length [%d]",
- msg->op, length);
+ msg->op, length);
context->type = msg->op;
buffer = msg->data;
{
/* copy data */
memcpy(context->data.buffer + context->offset,
- buffer, length);
+ buffer, length);
context->offset += length;
DEBUG_SERVER_MSG("receive progress... [%d|%d]",
- context->offset, context->data.length);
+ context->offset, context->data.length);
if (context->offset >= context->data.length)
- context->state = NET_NFC_LLCP_STEP_RETURN;
+ context->state = NET_NFC_LLCP_STEP_RETURN;
}
else
static void _net_nfc_server_recv_fragment(
- net_nfc_server_snep_op_context_t *context)
+ net_nfc_server_snep_op_context_t *context)
{
net_nfc_error_e result;
void _net_nfc_server_snep_recv_send_cb(
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
net_nfc_server_snep_op_context_t *context =
- (net_nfc_server_snep_op_context_t *)user_param;
+ (net_nfc_server_snep_op_context_t *)user_param;
DEBUG_SERVER_MSG("_net_nfc_server_snep_recv_send_cb, result [%d]", result);
else
{
DEBUG_ERR_MSG("net_nfc_server_snep_send failed, [0x%x][%d]",
- type, result);
+ type, result);
context->state = NET_NFC_STATE_ERROR;
context->result = result;
}
}
void _net_nfc_server_snep_recv_send_reject_cb(
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
net_nfc_server_snep_op_context_t *context =
- (net_nfc_server_snep_op_context_t *)user_param;
+ (net_nfc_server_snep_op_context_t *)user_param;
DEBUG_SERVER_MSG("_net_nfc_server_snep_recv_send_reject_cb,"
" result [%d]", result);
}
static void _net_nfc_server_snep_recv(
- net_nfc_server_snep_op_context_t *context)
+ net_nfc_server_snep_op_context_t *context)
{
if (context == NULL)
return;
{
case NET_NFC_LLCP_STEP_01 :
case NET_NFC_LLCP_STEP_03 :
- DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_%02d",
+ DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_%02d",
context->state - NET_NFC_LLCP_STEP_01 + 1);
- /* receive fragment */
- _net_nfc_server_recv_fragment(context);
- break;
+ /* receive fragment */
+ _net_nfc_server_recv_fragment(context);
+ break;
case NET_NFC_LLCP_STEP_02 :
- {
- uint8_t op = context->type;
+ {
+ uint8_t op = context->type;
- DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_02");
+ DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_02");
- /* make correct request/response code */
- op = SNEP_MAKE_PAIR_OP(op, SNEP_REQ_CONTINUE);
+ /* make correct request/response code */
+ op = SNEP_MAKE_PAIR_OP(op, SNEP_REQ_CONTINUE);
- /* send response */
- net_nfc_server_snep_send(
+ /* send response */
+ net_nfc_server_snep_send(
context->handle,
context->socket,
op,
NULL,
_net_nfc_server_snep_recv_send_cb, context);
- }
- break;
+ }
+ break;
case NET_NFC_LLCP_STEP_04 :
- {
- DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_04");
+ {
+ DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_04");
- /* send response */
- net_nfc_server_snep_send(
+ /* send response */
+ net_nfc_server_snep_send(
context->handle,
context->socket,
context->type, NULL,
_net_nfc_server_snep_recv_send_reject_cb, context);
- }
- break;
+ }
+ break;
case NET_NFC_LLCP_STEP_RETURN :
- {
- DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_RETURN");
+ {
+ DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_RETURN");
- /* complete and invoke callback */
- context->cb(
+ /* complete and invoke callback */
+ context->cb(
context->result,
context->type,
&context->data,
context->user_param);
- _net_nfc_server_snep_destory_context(context);
- }
- break;
+ _net_nfc_server_snep_destory_context(context);
+ }
+ break;
case NET_NFC_STATE_ERROR :
default :
- DEBUG_ERR_MSG("NET_NFC_STATE_ERROR");
+ DEBUG_ERR_MSG("NET_NFC_STATE_ERROR");
- /* error, invoke callback */
- DEBUG_ERR_MSG("net_nfc_server_snep_recv failed, [%d]",
- context->result);
+ /* error, invoke callback */
+ DEBUG_ERR_MSG("net_nfc_server_snep_recv failed, [%d]",
+ context->result);
- context->cb(
+ context->cb(
context->result,
context->type,
NULL,
context->user_param);
- _net_nfc_server_snep_destory_context(context);
+ _net_nfc_server_snep_destory_context(context);
- break;
+ break;
}
}
-static net_nfc_error_e
+ static net_nfc_error_e
net_nfc_server_snep_recv(
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- _net_nfc_server_snep_operation_cb cb,
- void *user_param)
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ _net_nfc_server_snep_operation_cb cb,
+ void *user_param)
{
net_nfc_server_snep_op_context_t *context;
net_nfc_error_e result = NET_NFC_OK;
/* create context */
context = _net_nfc_server_snep_create_recv_context(
- handle,
- socket,
- cb,
- user_param);
+ handle,
+ socket,
+ cb,
+ user_param);
if (context != NULL)/* send response */
_net_nfc_server_snep_recv(context);
}
static void _net_nfc_server_send_fragment_cb(
- net_nfc_llcp_socket_t socket,
- net_nfc_error_e result,
- data_s *data,
- void *extra,
- void *user_param)
+ net_nfc_llcp_socket_t socket,
+ net_nfc_error_e result,
+ data_s *data,
+ void *extra,
+ void *user_param)
{
net_nfc_server_snep_op_context_t *context =
(net_nfc_server_snep_op_context_t *)user_param;
else
{
DEBUG_ERR_MSG("net_nfc_controller_llcp_send failed, [%d]",
- result);
+ result);
context->state = NET_NFC_STATE_ERROR;
}
_net_nfc_server_snep_send(context);
}
static void _net_nfc_server_send_fragment(
- net_nfc_server_snep_op_context_t *context)
+ net_nfc_server_snep_op_context_t *context)
{
data_s req_msg;
uint32_t remain_len;
context->offset += req_msg.length;
if (net_nfc_controller_llcp_send(context->handle,
- context->socket,
- &req_msg,
- &result,
- _net_nfc_server_send_fragment_cb,
- context) == false)
+ context->socket,
+ &req_msg,
+ &result,
+ _net_nfc_server_send_fragment_cb,
+ context) == false)
{
DEBUG_ERR_MSG("net_nfc_controller_llcp_send failed, [%d]",
- result);
+ result);
context->state = NET_NFC_STATE_ERROR;
context->result = result;
_net_nfc_server_snep_send(context);
}
void _net_nfc_server_snep_send_recv_cb(
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
net_nfc_server_snep_op_context_t *context =
(net_nfc_server_snep_op_context_t *)user_param;
DEBUG_SERVER_MSG("_net_nfc_server_snep_send_recv_cb,"
- " result [%d]", result);
+ " result [%d]", result);
if (context == NULL)/* TODO */
return;
{
case SNEP_REQ_CONTINUE :
case SNEP_RESP_CONT :
- context->state = NET_NFC_LLCP_STEP_03;
- break;
+ context->state = NET_NFC_LLCP_STEP_03;
+ break;
case SNEP_REQ_REJECT :
case SNEP_RESP_REJECT :
- context->state = NET_NFC_STATE_ERROR;
- context->result = NET_NFC_LLCP_SOCKET_FRAME_REJECTED;
- break;
+ context->state = NET_NFC_STATE_ERROR;
+ context->result = NET_NFC_LLCP_SOCKET_FRAME_REJECTED;
+ break;
case SNEP_RESP_NOT_FOUND :
- context->state = NET_NFC_STATE_ERROR;
- context->result = NET_NFC_NO_DATA_FOUND;
- break;
+ context->state = NET_NFC_STATE_ERROR;
+ context->result = NET_NFC_NO_DATA_FOUND;
+ break;
case SNEP_RESP_EXCESS_DATA :
- context->state = NET_NFC_STATE_ERROR;
- context->result = NET_NFC_INSUFFICIENT_STORAGE;
- break;
+ context->state = NET_NFC_STATE_ERROR;
+ context->result = NET_NFC_INSUFFICIENT_STORAGE;
+ break;
case SNEP_RESP_BAD_REQ :
- context->state = NET_NFC_STATE_ERROR;
- context->result = NET_NFC_INVALID_FORMAT;
- break;
+ context->state = NET_NFC_STATE_ERROR;
+ context->result = NET_NFC_INVALID_FORMAT;
+ break;
case SNEP_RESP_NOT_IMPLEMENT :
case SNEP_RESP_UNSUPPORTED_VER :
- context->state = NET_NFC_STATE_ERROR;
- context->result = NET_NFC_NOT_ALLOWED_OPERATION;
- break;
+ context->state = NET_NFC_STATE_ERROR;
+ context->result = NET_NFC_NOT_ALLOWED_OPERATION;
+ break;
default :
- context->state = NET_NFC_STATE_ERROR;
- context->result = NET_NFC_OPERATION_FAIL;
- break;
+ context->state = NET_NFC_STATE_ERROR;
+ context->result = NET_NFC_OPERATION_FAIL;
+ break;
}
_net_nfc_server_snep_send(context);
}
static void _net_nfc_server_snep_send(
- net_nfc_server_snep_op_context_t *context)
+ net_nfc_server_snep_op_context_t *context)
{
if (context == NULL)
{
{
case NET_NFC_LLCP_STEP_01 :
case NET_NFC_LLCP_STEP_03 :
- DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_%02d",
- context->state - NET_NFC_LLCP_STEP_01 + 1);
+ DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_%02d",
+ context->state - NET_NFC_LLCP_STEP_01 + 1);
- /* send fragment */
- _net_nfc_server_send_fragment(context);
- break;
+ /* send fragment */
+ _net_nfc_server_send_fragment(context);
+ break;
case NET_NFC_LLCP_STEP_02 :
- DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_02");
+ DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_02");
- /* receive response */
- net_nfc_server_snep_recv(
+ /* receive response */
+ net_nfc_server_snep_recv(
context->handle,
context->socket,
_net_nfc_server_snep_send_recv_cb,
context);
- break;
+ break;
case NET_NFC_LLCP_STEP_RETURN :
- DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_RETURN");
+ DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_RETURN");
- /* complete and invoke callback */
- context->cb(
+ /* complete and invoke callback */
+ context->cb(
context->result,
context->type,
NULL,
context->user_param);
- _net_nfc_server_snep_destory_context(context);
- break;
+ _net_nfc_server_snep_destory_context(context);
+ break;
case NET_NFC_STATE_ERROR :
- DEBUG_ERR_MSG("NET_NFC_STATE_ERROR");
+ DEBUG_ERR_MSG("NET_NFC_STATE_ERROR");
- /* error, invoke callback */
- DEBUG_ERR_MSG("net_nfc_server_snep_send failed, [%d]",
- context->result);
+ /* error, invoke callback */
+ DEBUG_ERR_MSG("net_nfc_server_snep_send failed, [%d]",
+ context->result);
- context->cb(
+ context->cb(
context->result,
context->type,
NULL,
context->user_param);
- _net_nfc_server_snep_destory_context(context);
- break;
+ _net_nfc_server_snep_destory_context(context);
+ break;
default :
- DEBUG_ERR_MSG("NET_NFC_LLCP_STEP_??");
+ DEBUG_ERR_MSG("NET_NFC_LLCP_STEP_??");
- context->cb(NET_NFC_OPERATION_FAIL,
+ context->cb(NET_NFC_OPERATION_FAIL,
context->type,
NULL,
context->user_param);
- _net_nfc_server_snep_destory_context(context);
- break;
+ _net_nfc_server_snep_destory_context(context);
+ break;
}
}
net_nfc_error_e net_nfc_server_snep_send(
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- uint32_t type,
- data_s *data,
- _net_nfc_server_snep_operation_cb cb,
- void *user_param)
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ uint32_t type,
+ data_s *data,
+ _net_nfc_server_snep_operation_cb cb,
+ void *user_param)
{
net_nfc_server_snep_op_context_t *context;
net_nfc_error_e result = NET_NFC_OK;
/* create context */
context = _net_nfc_server_snep_create_send_context(
- type,
- handle,
- socket,
- data,
- cb,
- user_param);
+ type,
+ handle,
+ socket,
+ data,
+ cb,
+ user_param);
if (context != NULL)
{
}
static void _net_nfc_server_snep_server_recv_cb(
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
net_nfc_server_snep_context_t *context =
- (net_nfc_server_snep_context_t *)user_param;
+ (net_nfc_server_snep_context_t *)user_param;
DEBUG_SERVER_MSG("_net_nfc_server_snep_server_recv_cb"
- "result [%d]", result);
+ "result [%d]", result);
if (context == NULL)
{
switch (type)
{
case SNEP_REQ_GET :
- context->state = NET_NFC_LLCP_STEP_02;
- break;
+ context->state = NET_NFC_LLCP_STEP_02;
+ break;
case SNEP_REQ_PUT :
- context->state = NET_NFC_LLCP_STEP_04;
- break;
+ context->state = NET_NFC_LLCP_STEP_04;
+ break;
default :
- DEBUG_ERR_MSG("invalid request, [%d]", type);
- context->state = NET_NFC_STATE_ERROR;
- context->result = NET_NFC_NOT_ALLOWED_OPERATION;
- break;
+ DEBUG_ERR_MSG("invalid request, [%d]", type);
+ context->state = NET_NFC_STATE_ERROR;
+ context->result = NET_NFC_NOT_ALLOWED_OPERATION;
+ break;
}
}
else
static void _net_nfc_server_snep_server_send_cb(net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
net_nfc_server_snep_context_t *context =
- (net_nfc_server_snep_context_t *)user_param;
+ (net_nfc_server_snep_context_t *)user_param;
DEBUG_SERVER_MSG("_net_nfc_server_snep_server_send_cb"
- ", result [%d]", result);
+ ", result [%d]", result);
if (context == NULL)/* TODO */
return;
static void _net_nfc_server_snep_server_process(
- net_nfc_server_snep_context_t *context)
+ net_nfc_server_snep_context_t *context)
{
if (context == NULL)
return;
switch (context->state)
{
case NET_NFC_LLCP_STEP_01 :
- DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_01");
+ DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_01");
- /* receive request */
- net_nfc_server_snep_recv(
- context->handle,
- context->socket,
- _net_nfc_server_snep_server_recv_cb,
- context);
- break;
+ /* receive request */
+ net_nfc_server_snep_recv(
+ context->handle,
+ context->socket,
+ _net_nfc_server_snep_server_recv_cb,
+ context);
+ break;
case NET_NFC_LLCP_STEP_02 :
- DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_02");
-
- context->state = NET_NFC_LLCP_STEP_03;
+ DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_02");
- if (context->cb == NULL ||
- context->cb((net_nfc_snep_handle_h)context,
- context->result,
- context->type,
- &context->data,
- context->user_param) != NET_NFC_OK)
- {
- /* there is no response for GET request */
- DEBUG_ERR_MSG("there is no response for GET request");
-
- /* receive request */
- net_nfc_server_snep_send(context->handle,
- context->socket,
- SNEP_RESP_NOT_FOUND,
- NULL,
- _net_nfc_server_snep_server_send_cb,
- context);
- }
- break;
+ context->state = NET_NFC_LLCP_STEP_03;
- case NET_NFC_LLCP_STEP_03 :
- DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_03");
+ if (context->cb == NULL ||
+ context->cb((net_nfc_snep_handle_h)context,
+ context->result,
+ context->type,
+ &context->data,
+ context->user_param) != NET_NFC_OK)
+ {
+ /* there is no response for GET request */
+ DEBUG_ERR_MSG("there is no response for GET request");
/* receive request */
net_nfc_server_snep_send(context->handle,
- context->socket,
- SNEP_RESP_SUCCESS,
- &context->data,
- _net_nfc_server_snep_server_send_cb,
- context);
- break;
+ context->socket,
+ SNEP_RESP_NOT_FOUND,
+ NULL,
+ _net_nfc_server_snep_server_send_cb,
+ context);
+ }
+ break;
+
+ case NET_NFC_LLCP_STEP_03 :
+ DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_03");
+
+ /* receive request */
+ net_nfc_server_snep_send(context->handle,
+ context->socket,
+ SNEP_RESP_SUCCESS,
+ &context->data,
+ _net_nfc_server_snep_server_send_cb,
+ context);
+ break;
case NET_NFC_LLCP_STEP_04 :
- DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_04");
+ DEBUG_SERVER_MSG("NET_NFC_LLCP_STEP_04");
- if (context->cb != NULL)
- {
- /* complete and invoke callback */
- context->cb(
+ if (context->cb != NULL)
+ {
+ /* complete and invoke callback */
+ context->cb(
(net_nfc_snep_handle_h)context,
NET_NFC_OK,
context->type,
&context->data,
context->user_param);
- }
+ }
- /* receive request */
- net_nfc_server_snep_send(context->handle,
- context->socket,
- SNEP_RESP_SUCCESS,
- NULL,
- _net_nfc_server_snep_server_send_cb,
- context);
- break;
+ /* receive request */
+ net_nfc_server_snep_send(context->handle,
+ context->socket,
+ SNEP_RESP_SUCCESS,
+ NULL,
+ _net_nfc_server_snep_server_send_cb,
+ context);
+ break;
case NET_NFC_LLCP_STEP_10 : /* server error, and need to send error code to client */
- {
- /* FIXME : */
- }
- break;
+ {
+ /* FIXME : */
+ }
+ break;
case NET_NFC_STATE_ERROR :
- DEBUG_SERVER_MSG("NET_NFC_STATE_ERROR");
+ DEBUG_SERVER_MSG("NET_NFC_STATE_ERROR");
- /* error, invoke callback */
- DEBUG_ERR_MSG("_snep_server_recv failed, [%d]",
- context->result);
+ /* error, invoke callback */
+ DEBUG_ERR_MSG("_snep_server_recv failed, [%d]",
+ context->result);
- if (context->cb != NULL)
- {
- context->cb((net_nfc_snep_handle_h)context,
- context->result,
- context->type,
- NULL,
- context->user_param);
- }
+ if (context->cb != NULL)
+ {
+ context->cb((net_nfc_snep_handle_h)context,
+ context->result,
+ context->type,
+ NULL,
+ context->user_param);
+ }
- /* restart?? */
- break;
+ /* restart?? */
+ break;
default :
- DEBUG_ERR_MSG("NET_NFC_LLCP_STEP_??");
- /* TODO */
- break;
+ DEBUG_ERR_MSG("NET_NFC_LLCP_STEP_??");
+ /* TODO */
+ break;
}
}
static void _net_nfc_server_snep_clear_queue(
- gpointer data,
- gpointer user_data)
+ gpointer data,
+ gpointer user_data)
{
net_nfc_server_snep_job_t *job = (net_nfc_server_snep_job_t *)data;
if (job->cb != NULL)
{
job->cb((net_nfc_snep_handle_h)job->context,
- NET_NFC_OPERATION_FAIL, job->type,
- NULL, job->user_param);
+ NET_NFC_OPERATION_FAIL, job->type,
+ NULL, job->user_param);
}
if (job->data.buffer != NULL)
static void _net_nfc_server_snep_incomming_socket_error_cb(
- net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param)
{
net_nfc_server_snep_context_t *context =
(net_nfc_server_snep_context_t *)user_param;
DEBUG_SERVER_MSG("_net_nfc_server_snep_incomming_socket_error_cb,"
- " socket [%x], result [%d]",socket, result);
+ " socket [%x], result [%d]",socket, result);
if (context == NULL)
{
}
g_queue_foreach(&context->queue,
- _net_nfc_server_snep_clear_queue,
- NULL);
+ _net_nfc_server_snep_clear_queue,
+ NULL);
_net_nfc_util_free_mem(context);
}
static void _net_nfc_server_snep_socket_error_cb(
- net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param)
{
net_nfc_server_snep_context_t *context =
- (net_nfc_server_snep_context_t *)user_param;
+ (net_nfc_server_snep_context_t *)user_param;
DEBUG_SERVER_MSG("_net_nfc_server_snep_socket_error_cb"
" socket [%x], result [%d]",socket, result);
if (context->cb != NULL)
{
context->cb((net_nfc_snep_handle_h)context,
- result,
- NET_NFC_LLCP_STOP,
- NULL,
- context->user_param);
+ result,
+ NET_NFC_LLCP_STOP,
+ NULL,
+ context->user_param);
}
/*net_nfc_controller_llcp_socket_close(socket, &result);*/
}
g_queue_foreach(&context->queue,
- _net_nfc_server_snep_clear_queue,
- NULL);
+ _net_nfc_server_snep_clear_queue,
+ NULL);
_net_nfc_util_free_mem(context);
}
static void _net_nfc_server_snep_incoming_cb(
- net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param)
{
net_nfc_server_snep_context_t *context =
- (net_nfc_server_snep_context_t *)user_param;
+ (net_nfc_server_snep_context_t *)user_param;
net_nfc_server_snep_context_t *accept_context = NULL;
if (context == NULL)
accept_context->state = NET_NFC_LLCP_STEP_01;
result = net_nfc_server_llcp_simple_accept(handle,
- socket,
- _net_nfc_server_snep_incomming_socket_error_cb,
- accept_context);
+ socket,
+ _net_nfc_server_snep_incomming_socket_error_cb,
+ accept_context);
if (result != NET_NFC_OK)
{
if (context->cb != NULL)
{
context->cb((net_nfc_snep_handle_h)context,
- result,
- context->type,
- NULL,
- context->user_param);
+ result,
+ context->type,
+ NULL,
+ context->user_param);
}
}
net_nfc_error_e net_nfc_server_snep_server(
- net_nfc_target_handle_s *handle,
- const char *san,
- sap_t sap,
- net_nfc_server_snep_cb cb,
- void *user_param)
+ net_nfc_target_handle_s *handle,
+ const char *san,
+ sap_t sap,
+ net_nfc_server_snep_cb cb,
+ void *user_param)
{
net_nfc_error_e result;
net_nfc_server_snep_context_t *context = NULL;
context->state = NET_NFC_LLCP_STEP_01;
result = net_nfc_server_llcp_simple_server(handle,
- san,
- sap,
- _net_nfc_server_snep_incoming_cb,
- _net_nfc_server_snep_socket_error_cb,
- context);
+ san,
+ sap,
+ _net_nfc_server_snep_incoming_cb,
+ _net_nfc_server_snep_socket_error_cb,
+ context);
if (result != NET_NFC_OK)
{
}
net_nfc_error_e net_nfc_server_snep_server_send_get_response(
- net_nfc_snep_handle_h snep_handle,
- data_s *data)
+ net_nfc_snep_handle_h snep_handle,
+ data_s *data)
{
net_nfc_server_snep_context_t *context =
- (net_nfc_server_snep_context_t *)snep_handle;
+ (net_nfc_server_snep_context_t *)snep_handle;
net_nfc_error_e result = NET_NFC_OK;
if (context == NULL/* && check valid handle */)
}
static void _net_nfc_server_snep_client_send_cb(
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
net_nfc_server_snep_job_t*job =
- (net_nfc_server_snep_job_t *)user_param;
+ (net_nfc_server_snep_job_t *)user_param;
if (job == NULL)
{
}
static void _net_nfc_server_snep_client_recv_cb(
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
net_nfc_server_snep_job_t *job =
- (net_nfc_server_snep_job_t *)user_param;
+ (net_nfc_server_snep_job_t *)user_param;
if (job == NULL)
{
if (job->data.buffer != NULL)
{
memcpy(job->data.buffer, data->buffer,
- data->length);
+ data->length);
}
else
{
static void _net_nfc_server_snep_client_do_job(net_nfc_server_snep_context_t *context)
{
if (context->state == NET_NFC_LLCP_IDLE &&
- g_queue_is_empty(&context->queue) == false) {
+ g_queue_is_empty(&context->queue) == false) {
net_nfc_server_snep_job_t *job;
job = g_queue_pop_head(&context->queue);
}
static void _net_nfc_server_snep_client_process(
- net_nfc_server_snep_job_t *job)
+ net_nfc_server_snep_job_t *job)
{
bool finish = false;
/* send request */
net_nfc_server_snep_send(job->handle,
- job->socket,
- job->type,
- &job->data,
- _net_nfc_server_snep_client_send_cb,
- job);
+ job->socket,
+ job->type,
+ &job->data,
+ _net_nfc_server_snep_client_send_cb,
+ job);
break;
case NET_NFC_LLCP_STEP_02 :
/* receive response */
net_nfc_server_snep_recv(job->handle,
- job->socket,
- _net_nfc_server_snep_client_recv_cb,
- job);
+ job->socket,
+ _net_nfc_server_snep_client_recv_cb,
+ job);
break;
case NET_NFC_LLCP_STEP_RETURN :
if (job->cb != NULL)
{
job->cb((net_nfc_snep_handle_h)job->context,
- NET_NFC_OK,
- job->type,
- &job->data,
- job->user_param);
+ NET_NFC_OK,
+ job->type,
+ &job->data,
+ job->user_param);
}
/* finish job */
/* error, invoke callback */
DEBUG_ERR_MSG("_snep_server_send failed, [%d]",
- job->result);
+ job->result);
if (job->cb != NULL)
{
job->cb((net_nfc_snep_handle_h)job->context,
- job->result,
- job->type,
- &job->data,
- job->user_param);
+ job->result,
+ job->type,
+ &job->data,
+ job->user_param);
}
/* finish job */
}
static void _net_nfc_server_snep_connected_cb(
- net_nfc_error_e result,
- net_nfc_target_handle_s *handle,
- net_nfc_llcp_socket_t socket,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ net_nfc_target_handle_s *handle,
+ net_nfc_llcp_socket_t socket,
+ data_s *data,
+ void *user_param)
{
net_nfc_server_snep_context_t *context =
- (net_nfc_server_snep_context_t *)user_param;
+ (net_nfc_server_snep_context_t *)user_param;
if (context == NULL)
{
if (context->cb != NULL)
{
context->cb((net_nfc_snep_handle_h)context,
- result,
- NET_NFC_LLCP_START,
- NULL,
- context->user_param);
+ result,
+ NET_NFC_LLCP_START,
+ NULL,
+ context->user_param);
}
}
net_nfc_error_e net_nfc_server_snep_client(
- net_nfc_target_handle_s *handle,
- const char *san,
- sap_t sap,
- net_nfc_server_snep_cb cb,
- void *user_param)
+ net_nfc_target_handle_s *handle,
+ const char *san,
+ sap_t sap,
+ net_nfc_server_snep_cb cb,
+ void *user_param)
{
net_nfc_error_e result;
net_nfc_server_snep_context_t *context = NULL;
context->user_param = user_param;
result = net_nfc_server_llcp_simple_client(handle,
- san,
- sap,
- _net_nfc_server_snep_connected_cb,
- _net_nfc_server_snep_socket_error_cb,
- context);
+ san,
+ sap,
+ _net_nfc_server_snep_connected_cb,
+ _net_nfc_server_snep_socket_error_cb,
+ context);
if (result != NET_NFC_OK)
{
net_nfc_error_e net_nfc_server_snep_client_request(
- net_nfc_snep_handle_h snep,
- uint8_t type,
- data_s *data,
- net_nfc_server_snep_cb cb,
- void *user_param)
+ net_nfc_snep_handle_h snep,
+ uint8_t type,
+ data_s *data,
+ net_nfc_server_snep_cb cb,
+ void *user_param)
{
net_nfc_server_snep_context_t *context = (net_nfc_server_snep_context_t *)snep;
net_nfc_error_e result = NET_NFC_OK;
}
static net_nfc_error_e _net_nfc_server_default_server_cb_(
- net_nfc_snep_handle_h handle,
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ net_nfc_snep_handle_h handle,
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]",
type, result, data, user_param);
switch (type)
{
case SNEP_REQ_GET:
- {
- net_nfc_server_snep_get_msg_t *msg =
+ {
+ net_nfc_server_snep_get_msg_t *msg =
(net_nfc_server_snep_get_msg_t *)data->buffer;
- uint32_t max_len = htonl(msg->length);
- data_s get_msg = { msg->data,data->length - sizeof(msg->length)};
+ uint32_t max_len = htonl(msg->length);
+ data_s get_msg = { msg->data,data->length - sizeof(msg->length)};
- DEBUG_SERVER_MSG("GET : acceptable max_len [%d], message [%d]",
- max_len, data->length - sizeof(msg->length));
+ DEBUG_SERVER_MSG("GET : acceptable max_len [%d], message [%d]",
+ max_len, data->length - sizeof(msg->length));
- if (_net_nfc_server_snep_process_get_response_cb(handle, &get_msg, max_len))
- {
- result = NET_NFC_OK;
- }
- else
- {
- result = NET_NFC_NOT_SUPPORTED;
+ if (_net_nfc_server_snep_process_get_response_cb(handle, &get_msg, max_len))
+ {
+ result = NET_NFC_OK;
+ }
+ else
+ {
+ result = NET_NFC_NOT_SUPPORTED;
+ }
}
- }
- break;
+ break;
case SNEP_REQ_PUT :
- {
- net_nfc_server_p2p_received(data);
- net_nfc_app_util_process_ndef(data);;
+ {
+ net_nfc_server_p2p_received(data);
+ net_nfc_app_util_process_ndef(data);;
- result = NET_NFC_OK;
- }
- break;
+ result = NET_NFC_OK;
+ }
+ break;
default :
DEBUG_ERR_MSG("error [%d]", result);
static net_nfc_error_e _net_nfc_server_default_client_cb_(
- net_nfc_snep_handle_h handle,
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ net_nfc_snep_handle_h handle,
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
_net_nfc_server_snep_service_context_t *context =
(_net_nfc_server_snep_service_context_t*)user_param;
switch (type)
{
- case SNEP_RESP_SUCCESS :
- case SNEP_RESP_BAD_REQ :
- case SNEP_RESP_EXCESS_DATA :
- case SNEP_RESP_NOT_FOUND :
- case SNEP_RESP_NOT_IMPLEMENT :
- case SNEP_RESP_REJECT :
- case SNEP_RESP_UNSUPPORTED_VER :
- context = (_net_nfc_server_snep_service_context_t *)user_param;
+ case SNEP_RESP_SUCCESS :
+ case SNEP_RESP_BAD_REQ :
+ case SNEP_RESP_EXCESS_DATA :
+ case SNEP_RESP_NOT_FOUND :
+ case SNEP_RESP_NOT_IMPLEMENT :
+ case SNEP_RESP_REJECT :
+ case SNEP_RESP_UNSUPPORTED_VER :
+ context = (_net_nfc_server_snep_service_context_t *)user_param;
- net_nfc_server_p2p_data_sent(result,
- context->user_param);
+ net_nfc_server_p2p_data_sent(result,
+ context->user_param);
- _net_nfc_util_free_mem(context);
- break;
+ _net_nfc_util_free_mem(context);
+ break;
- default :
- DEBUG_ERR_MSG("error [%d]", result);
- break;
+ default :
+ DEBUG_ERR_MSG("error [%d]", result);
+ break;
}
return result;
static net_nfc_error_e _net_nfc_server_default_client_connected_cb_(
- net_nfc_snep_handle_h handle,
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ net_nfc_snep_handle_h handle,
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
_net_nfc_server_snep_service_context_t *context =
(_net_nfc_server_snep_service_context_t *)user_param;
DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]",
- type, result, data, user_param);
+ type, result, data, user_param);
if (context == NULL)
{
if (result == NET_NFC_OK)
{
net_nfc_server_snep_client_request(handle,
- context->type,
- &context->data,
- _net_nfc_server_default_client_cb_,
- context);
+ context->type,
+ &context->data,
+ _net_nfc_server_default_client_cb_,
+ context);
}
else
{
net_nfc_error_e net_nfc_server_snep_default_server_start(
- net_nfc_target_handle_s *handle)
+ net_nfc_target_handle_s *handle)
{
/* start default snep server, register your callback */
return net_nfc_server_snep_server(handle,
- SNEP_SAN,
- SNEP_SAP,
- _net_nfc_server_default_server_cb_,
- (void *)1234);
+ SNEP_SAN,
+ SNEP_SAP,
+ _net_nfc_server_default_server_cb_,
+ (void *)1234);
}
net_nfc_error_e net_nfc_server_snep_default_client_start(
- net_nfc_target_handle_s *handle,
- int type,
- data_s *data,
- int client,
- void *user_param)
+ net_nfc_target_handle_s *handle,
+ int type,
+ data_s *data,
+ int client,
+ void *user_param)
{
_net_nfc_server_snep_service_context_t *context = NULL;
if (context->data.buffer != NULL)
{
memcpy(context->data.buffer, data->buffer,
- data->length);
+ data->length);
context->data.length = data->length;
}
/* start default snep client, register your callback */
return net_nfc_server_snep_client(handle,
- SNEP_SAN,
- SNEP_SAP,
- _net_nfc_server_default_client_connected_cb_,
- context);
+ SNEP_SAN,
+ SNEP_SAP,
+ _net_nfc_server_default_client_connected_cb_,
+ context);
}
else
{
}
}
-net_nfc_error_e
+ net_nfc_error_e
net_nfc_server_snep_default_server_register_get_response_cb(
- net_nfc_server_snep_listen_cb cb,
- void *user_param)
+ net_nfc_server_snep_listen_cb cb,
+ void *user_param)
{
net_nfc_error_e result;
return result;
}
-net_nfc_error_e
+ net_nfc_error_e
net_nfc_server_snep_default_server_unregister_get_response_cb(
- net_nfc_server_snep_listen_cb cb)
+ net_nfc_server_snep_listen_cb cb)
{
_net_nfc_server_snep_del_get_response_cb(cb);
}
net_nfc_error_e net_nfc_server_snep_default_server_send_get_response(
- net_nfc_snep_handle_h snep_handle, data_s *data)
+ net_nfc_snep_handle_h snep_handle, data_s *data)
{
net_nfc_server_snep_context_t *context =
- (net_nfc_server_snep_context_t *)snep_handle;
+ (net_nfc_server_snep_context_t *)snep_handle;
net_nfc_error_e result = NET_NFC_OK;
if (context == NULL/* && check valid handle */)
}
static void _snep_default_activate_cb(int event,
- net_nfc_target_handle_s *handle,
- uint32_t sap, const char *san, void *user_param)
+ net_nfc_target_handle_s *handle,
+ uint32_t sap, const char *san, void *user_param)
{
net_nfc_error_e result;
DEBUG_SERVER_MSG("event [%d], handle [%p], sap [%d], san [%s]",
- event, handle, sap, san);
+ event, handle, sap, san);
if (event == NET_NFC_LLCP_START) {
/* start snep server */
result = net_nfc_server_snep_server(handle, (char *)san, sap,
- _net_nfc_server_default_server_cb_, user_param);
+ _net_nfc_server_default_server_cb_, user_param);
if (result != NET_NFC_OK) {
DEBUG_ERR_MSG("net_nfc_service_snep_server failed, [%d]",
- result);
+ result);
}
} else if (event == NET_NFC_LLCP_UNREGISTERED) {
/* unregister server, do nothing */
/* start default snep server */
return net_nfc_server_llcp_register_service(id,
- SNEP_SAP,
- SNEP_SAN,
- _snep_default_activate_cb,
- NULL);
+ SNEP_SAP,
+ SNEP_SAN,
+ _snep_default_activate_cb,
+ NULL);
}
net_nfc_error_e net_nfc_server_snep_default_server_unregister()
/* start default snep server */
return net_nfc_server_llcp_unregister_service(id,
- SNEP_SAP,
- SNEP_SAN);
+ SNEP_SAP,
+ SNEP_SAN);
}
net_nfc_error_e net_nfc_server_snep_parse_get_request(data_s *request,
- size_t *max_len, data_s *message)
+ size_t *max_len, data_s *message)
{
net_nfc_server_snep_msg_t *msg = NULL;
if (request == NULL || request->buffer == NULL ||
- request->length == 0 || max_len == NULL || message == NULL) {
+ request->length == 0 || max_len == NULL || message == NULL) {
return NET_NFC_NULL_PARAMETER;
}
#include "net_nfc_debug_internal.h"
#include "net_nfc_util_internal.h"
#include "net_nfc_util_gdbus_internal.h"
-#include "net_nfc_controller_internal.h"
#include "net_nfc_gdbus.h"
-#include "net_nfc_manager.h"
+#include "net_nfc_server.h"
#include "net_nfc_server_common.h"
-#include "net_nfc_server_context_internal.h"
+#include "net_nfc_server_context.h"
#include "net_nfc_server_manager.h"
+#include "net_nfc_server_controller.h"
+#include "net_nfc_server_util.h"
#include "net_nfc_server_se.h"
-#include "net_nfc_app_util_internal.h"
typedef struct _nfc_se_setting_t
static void se_set_data_thread_func(gpointer user_data);
static gboolean se_handle_close_secure_element(
- NetNfcGDbusSecureElement *object,
- GDBusMethodInvocation *invocation,
- guint arg_handle,
- GVariant *smack_privilege);
+ NetNfcGDbusSecureElement *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_handle,
+ GVariant *smack_privilege);
static gboolean se_handle_get_atr(
- NetNfcGDbusSecureElement *object,
- GDBusMethodInvocation *invocation,
- guint arg_handle,
- GVariant *smack_privilege);
+ NetNfcGDbusSecureElement *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_handle,
+ GVariant *smack_privilege);
static gboolean se_handle_open_secure_element(
- NetNfcGDbusSecureElement *object,
- GDBusMethodInvocation *invocation,
- gint arg_type,
- GVariant *smack_privilege);
+ NetNfcGDbusSecureElement *object,
+ GDBusMethodInvocation *invocation,
+ gint arg_type,
+ GVariant *smack_privilege);
static gboolean se_handle_send_apdu(
- NetNfcGDbusSecureElement *object,
- GDBusMethodInvocation *invocation,
- guint arg_handle,
- GVariant* apdudata,
- GVariant *smack_privilege);
+ NetNfcGDbusSecureElement *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_handle,
+ GVariant* apdudata,
+ GVariant *smack_privilege);
static gboolean se_handle_set(
- NetNfcGDbusSecureElement *object,
- GDBusMethodInvocation *invocation,
- gint arg_type,
- GVariant *smack_privilege);
+ NetNfcGDbusSecureElement *object,
+ GDBusMethodInvocation *invocation,
+ gint arg_type,
+ GVariant *smack_privilege);
uint8_t net_nfc_server_se_get_se_type()
static bool net_nfc_server_se_is_ese_handle(net_nfc_target_handle_s *handle)
{
return (gdbus_ese_handle != NULL &&
- gdbus_ese_handle == handle);
+ gdbus_ese_handle == handle);
}
static void net_nfc_server_se_set_current_ese_handle(
- net_nfc_target_handle_s *handle)
+ net_nfc_target_handle_s *handle)
{
gdbus_ese_handle = handle;
}
net_nfc_target_handle_s *handle;
if (net_nfc_controller_secure_element_open(
- SECURE_ELEMENT_TYPE_ESE,
- &handle, &result) == true)
+ SECURE_ELEMENT_TYPE_ESE,
+ &handle, &result) == true)
{
net_nfc_server_se_set_current_ese_handle(handle);
else
{
DEBUG_ERR_MSG("net_nfc_controller_secure_element_open failed [%d]",
- result);
+ result);
}
}
net_nfc_error_e result = NET_NFC_OK;
if (gdbus_ese_handle != NULL &&
- net_nfc_server_gdbus_is_server_busy() == false) {
+ net_nfc_server_gdbus_is_server_busy() == false) {
if (net_nfc_controller_secure_element_close(
- gdbus_ese_handle,
- &result) == false)
+ gdbus_ese_handle,
+ &result) == false)
{
net_nfc_controller_exception_handler();
}
int error;
error = tel_get_sim_init_info(handle,
- &state,
- &b_card_changed);
+ &state,
+ &b_card_changed);
if (error != 0)
{
DEBUG_ERR_MSG("error = [%d]", error);
gdbus_se_setting.busy = false;
net_nfc_controller_set_secure_element_mode(
- SECURE_ELEMENT_TYPE_UICC,
- SECURE_ELEMENT_VIRTUAL_MODE, &result);
+ SECURE_ELEMENT_TYPE_UICC,
+ SECURE_ELEMENT_VIRTUAL_MODE, &result);
if (result == NET_NFC_OK) {
DEBUG_SERVER_MSG(
- "changed to SECURE_ELEMENT_TYPE_UICC");
+ "changed to SECURE_ELEMENT_TYPE_UICC");
net_nfc_server_se_set_se_type(
- SECURE_ELEMENT_TYPE_UICC);
+ SECURE_ELEMENT_TYPE_UICC);
net_nfc_server_se_set_se_mode(
- SECURE_ELEMENT_VIRTUAL_MODE);
+ SECURE_ELEMENT_VIRTUAL_MODE);
if (vconf_set_int(VCONFKEY_NFC_SE_TYPE,
- VCONFKEY_NFC_SE_TYPE_UICC) != 0) {
+ VCONFKEY_NFC_SE_TYPE_UICC) != 0) {
DEBUG_ERR_MSG("vconf_set_int failed");
}
} else {
DEBUG_ERR_MSG(
- "SECURE_ELEMENT_TYPE_UICC, SECURE_ELEMENT_VIRTUAL_MODE failed [%d]",
- result);
+ "SECURE_ELEMENT_TYPE_UICC, SECURE_ELEMENT_VIRTUAL_MODE failed [%d]",
+ result);
}
}
break;
gdbus_uicc_handle = tel_init(cpList[0]);
if (gdbus_uicc_handle != NULL) {
tel_register_noti_event(gdbus_uicc_handle,
- TAPI_NOTI_SIM_STATUS,
- _se_uicc_status_noti_cb,
- NULL);
+ TAPI_NOTI_SIM_STATUS,
+ _se_uicc_status_noti_cb,
+ NULL);
} else {
DEBUG_ERR_MSG("tel_init() failed");
static void _se_uicc_deinit()
{
tel_deregister_noti_event(gdbus_uicc_handle,
- TAPI_NOTI_SIM_STATUS);
+ TAPI_NOTI_SIM_STATUS);
tel_deinit(gdbus_uicc_handle);
static bool _se_is_uicc_handle(net_nfc_target_handle_s *handle)
{
return (gdbus_uicc_handle != NULL &&
- (TapiHandle *)handle == gdbus_uicc_handle);
+ (TapiHandle *)handle == gdbus_uicc_handle);
}
static void _se_uicc_close(net_nfc_target_handle_s *handle)
/*turn off ESE*/
net_nfc_controller_set_secure_element_mode(
- SECURE_ELEMENT_TYPE_ESE,
- SECURE_ELEMENT_OFF_MODE,
- &result);
+ SECURE_ELEMENT_TYPE_ESE,
+ SECURE_ELEMENT_OFF_MODE,
+ &result);
state = _se_uicc_check_state(gdbus_uicc_handle);
if (state == TAPI_SIM_STATUS_SIM_INIT_COMPLETED ||
- state == TAPI_SIM_STATUS_CARD_NOT_PRESENT ||
- state == TAPI_SIM_STATUS_CARD_REMOVED) {
+ state == TAPI_SIM_STATUS_CARD_NOT_PRESENT ||
+ state == TAPI_SIM_STATUS_CARD_REMOVED) {
/*turn on UICC*/
net_nfc_controller_set_secure_element_mode(
- SECURE_ELEMENT_TYPE_UICC,
- SECURE_ELEMENT_VIRTUAL_MODE, &result);
+ SECURE_ELEMENT_TYPE_UICC,
+ SECURE_ELEMENT_VIRTUAL_MODE, &result);
if (result == NET_NFC_OK) {
DEBUG_SERVER_MSG(
- "changed to SECURE_ELEMENT_TYPE_UICC");
+ "changed to SECURE_ELEMENT_TYPE_UICC");
net_nfc_server_se_set_se_type(
- SECURE_ELEMENT_TYPE_UICC);
+ SECURE_ELEMENT_TYPE_UICC);
net_nfc_server_se_set_se_mode(
- SECURE_ELEMENT_VIRTUAL_MODE);
+ SECURE_ELEMENT_VIRTUAL_MODE);
if (vconf_set_int(
- VCONFKEY_NFC_SE_TYPE,
- VCONFKEY_NFC_SE_TYPE_UICC) != 0)
- {
+ VCONFKEY_NFC_SE_TYPE,
+ VCONFKEY_NFC_SE_TYPE_UICC) != 0)
+ {
DEBUG_ERR_MSG("vconf_set_int failed");
}
} else {
DEBUG_ERR_MSG("SECURE_ELEMENT_TYPE_UICC, SECURE_ELEMENT_VIRTUAL_MODE failed [%d]",
- result);
+ result);
}
} else {
DEBUG_SERVER_MSG("UICC is not ready. waiting UICC event");
case SECURE_ELEMENT_TYPE_ESE :
/*turn off UICC*/
net_nfc_controller_set_secure_element_mode(
- SECURE_ELEMENT_TYPE_UICC,
- SECURE_ELEMENT_OFF_MODE,
- &result);
+ SECURE_ELEMENT_TYPE_UICC,
+ SECURE_ELEMENT_OFF_MODE,
+ &result);
/*turn on ESE*/
net_nfc_controller_set_secure_element_mode(
- SECURE_ELEMENT_TYPE_ESE,
- SECURE_ELEMENT_VIRTUAL_MODE,
- &result);
+ SECURE_ELEMENT_TYPE_ESE,
+ SECURE_ELEMENT_VIRTUAL_MODE,
+ &result);
if (result == NET_NFC_OK) {
DEBUG_SERVER_MSG("changed to SECURE_ELEMENT_TYPE_ESE");
net_nfc_server_se_set_se_mode(SECURE_ELEMENT_VIRTUAL_MODE);
if (vconf_set_int(VCONFKEY_NFC_SE_TYPE,
- VCONFKEY_NFC_SE_TYPE_ESE) != 0) {
+ VCONFKEY_NFC_SE_TYPE_ESE) != 0) {
DEBUG_ERR_MSG("vconf_set_int failed");
}
} else {
net_nfc_error_e result_ese, result_uicc;
net_nfc_server_se_set_se_type(
- SECURE_ELEMENT_TYPE_INVALID);
+ SECURE_ELEMENT_TYPE_INVALID);
net_nfc_server_se_set_se_mode(SECURE_ELEMENT_OFF_MODE);
/*turn off ESE*/
net_nfc_controller_set_secure_element_mode(
- SECURE_ELEMENT_TYPE_ESE,
- SECURE_ELEMENT_OFF_MODE,
- &result_ese);
+ SECURE_ELEMENT_TYPE_ESE,
+ SECURE_ELEMENT_OFF_MODE,
+ &result_ese);
/*turn off UICC*/
net_nfc_controller_set_secure_element_mode(
- SECURE_ELEMENT_TYPE_UICC,
- SECURE_ELEMENT_OFF_MODE,
- &result_uicc);
+ SECURE_ELEMENT_TYPE_UICC,
+ SECURE_ELEMENT_OFF_MODE,
+ &result_uicc);
if (result_ese != NET_NFC_INVALID_HANDLE
- && result_uicc != NET_NFC_INVALID_HANDLE) {
+ && result_uicc != NET_NFC_INVALID_HANDLE) {
DEBUG_SERVER_MSG("SE off all");
if (vconf_set_int(VCONFKEY_NFC_SE_TYPE,
- VCONFKEY_NFC_SE_TYPE_NONE) != 0) {
+ VCONFKEY_NFC_SE_TYPE_NONE) != 0) {
DEBUG_ERR_MSG("vconf_set_int failed");
}
{
/* decrease client reference count */
net_nfc_server_gdbus_decrease_se_count(
- g_dbus_method_invocation_get_sender(
- detail->invocation));
+ g_dbus_method_invocation_get_sender(
+ detail->invocation));
result = net_nfc_server_se_close_ese();
}
}
#if 0
if ((gdbus_se_prev_type != net_nfc_server_se_get_se_type()) ||
- (gdbus_se_prev_mode != net_nfc_server_se_get_se_mode()))
+ (gdbus_se_prev_mode != net_nfc_server_se_get_se_mode()))
{
/*return back se mode*/
net_nfc_controller_set_secure_element_mode(gdbus_se_prev_type,
- gdbus_se_prev_mode, &result);
+ gdbus_se_prev_mode, &result);
net_nfc_server_se_set_se_type(gdbus_se_prev_type);
net_nfc_server_se_set_se_mode(gdbus_se_prev_mode);
}
#endif
net_nfc_gdbus_secure_element_complete_close_secure_element(
- detail->object, detail->invocation, result);
+ detail->object, detail->invocation, result);
g_object_unref(detail->invocation);
g_object_unref(detail->object);
/* shutdown process if it doesn't need */
if (net_nfc_server_manager_get_active() == false &&
- net_nfc_server_gdbus_is_server_busy() == false) {
+ net_nfc_server_gdbus_is_server_busy() == false) {
net_nfc_manager_quit();
}
}
static gboolean se_handle_close_secure_element(
- NetNfcGDbusSecureElement *object,
- GDBusMethodInvocation *invocation,
- guint arg_handle,
- GVariant *smack_privilege)
+ NetNfcGDbusSecureElement *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_handle,
+ GVariant *smack_privilege)
{
SeDataHandle *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->handle = (net_nfc_target_handle_s *)arg_handle;
result = net_nfc_server_controller_async_queue_push(
- se_close_secure_element_thread_func, data);
+ se_close_secure_element_thread_func, data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Se.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.Se.ThreadError",
+ "can not push to controller thread");
g_object_unref(data->object);
g_object_unref(data->invocation);
else if (net_nfc_server_se_is_ese_handle(detail->handle) == true)
{
net_nfc_controller_secure_element_get_atr(detail->handle, &atr,
- &result);
+ &result);
}
else
{
data = net_nfc_util_gdbus_data_to_variant(atr);
net_nfc_gdbus_secure_element_complete_get_atr(
- detail->object,
- detail->invocation,
- result,
- data);
+ detail->object,
+ detail->invocation,
+ result,
+ data);
if (atr != NULL) {
net_nfc_util_free_data(atr);
}
static gboolean se_handle_get_atr(
- NetNfcGDbusSecureElement *object,
- GDBusMethodInvocation *invocation,
- guint arg_handle,
- GVariant *smack_privilege)
+ NetNfcGDbusSecureElement *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_handle,
+ GVariant *smack_privilege)
{
SeDataHandle *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager",
- "r") == false) {
+ smack_privilege,
+ "nfc-manager",
+ "r") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->handle = (net_nfc_target_handle_s *)arg_handle;
result = net_nfc_server_controller_async_queue_push(
- se_get_atr_thread_func, data);
+ se_get_atr_thread_func, data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Se.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.Se.ThreadError",
+ "can not push to controller thread");
g_object_unref(data->object);
g_object_unref(data->invocation);
#if 0 /* opening SE doesn't affect card emulation */
/*off ESE*/
net_nfc_controller_set_secure_element_mode(
- SECURE_ELEMENT_TYPE_ESE,
- SECURE_ELEMENT_OFF_MODE, &result);
+ SECURE_ELEMENT_TYPE_ESE,
+ SECURE_ELEMENT_OFF_MODE, &result);
/*Off UICC. UICC SHOULD not be detected by external reader when
- being communicated in internal process*/
+ being communicated in internal process*/
net_nfc_controller_set_secure_element_mode(SECURE_ELEMENT_TYPE_UICC,
- SECURE_ELEMENT_OFF_MODE, &result);
+ SECURE_ELEMENT_OFF_MODE, &result);
net_nfc_server_se_set_se_type(SECURE_ELEMENT_TYPE_UICC);
net_nfc_server_se_set_se_mode(SECURE_ELEMENT_OFF_MODE);
#if 0 /* opening SE doesn't affect card emulation */
/*off UICC*/
net_nfc_controller_set_secure_element_mode(
- SECURE_ELEMENT_TYPE_UICC,
- SECURE_ELEMENT_OFF_MODE, &result);
+ SECURE_ELEMENT_TYPE_UICC,
+ SECURE_ELEMENT_OFF_MODE, &result);
#endif
handle = net_nfc_server_se_open_ese();
if (handle != NULL)
/* increase client reference count */
net_nfc_server_gdbus_increase_se_count(
- g_dbus_method_invocation_get_sender(
- detail->invocation));
+ g_dbus_method_invocation_get_sender(
+ detail->invocation));
}
else
{
}
net_nfc_gdbus_secure_element_complete_open_secure_element(
- detail->object,
- detail->invocation,
- result,
- (guint)handle);
+ detail->object,
+ detail->invocation,
+ result,
+ (guint)handle);
g_object_unref(detail->invocation);
g_object_unref(detail->object);
}
static gboolean se_handle_open_secure_element(
- NetNfcGDbusSecureElement *object,
- GDBusMethodInvocation *invocation,
- gint arg_type,
- GVariant *smack_privilege)
+ NetNfcGDbusSecureElement *object,
+ GDBusMethodInvocation *invocation,
+ gint arg_type,
+ GVariant *smack_privilege)
{
SeDataSeType *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->se_type= arg_type;
result = net_nfc_server_controller_async_queue_push(
- se_open_secure_element_thread_func, data);
+ se_open_secure_element_thread_func, data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Se.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.Se.ThreadError",
+ "can not push to controller thread");
g_object_unref(data->object);
g_object_unref(data->invocation);
}
else if (net_nfc_server_se_is_ese_handle(detail->handle) == true)
{
- ret = net_nfc_controller_secure_element_send_apdu(
- detail->handle, &apdu_data, &response, &result);
+ ret = net_nfc_controller_secure_element_send_apdu(detail->handle,
+ &apdu_data, &response, &result);
+ if (false == ret)
+ {
+ DEBUG_ERR_MSG("net_nfc_controller_secure_element_send_apdu() Failed");
+ return;
+ }
}
else
{
rspdata = net_nfc_util_gdbus_data_to_variant(response);
net_nfc_gdbus_secure_element_complete_send_apdu(
- detail->object,
- detail->invocation,
- result,
- rspdata);
+ detail->object,
+ detail->invocation,
+ result,
+ rspdata);
if (response != NULL)
{
}
static gboolean se_handle_send_apdu(
- NetNfcGDbusSecureElement *object,
- GDBusMethodInvocation *invocation,
- guint arg_handle,
- GVariant *apdudata,
- GVariant *smack_privilege)
+ NetNfcGDbusSecureElement *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_handle,
+ GVariant *apdudata,
+ GVariant *smack_privilege)
{
SeDataApdu *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->data = g_variant_ref(apdudata);
result = net_nfc_server_controller_async_queue_push(
- se_send_apdu_thread_func, data);
+ se_send_apdu_thread_func, data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Se.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.Se.ThreadError",
+ "can not push to controller thread");
g_variant_unref(data->data);
}
net_nfc_gdbus_secure_element_complete_set(data->object,
- data->invocation, result);
+ data->invocation, result);
if (isTypeChanged)
net_nfc_gdbus_secure_element_emit_se_type_changed(data->object,
}
static gboolean se_handle_set(
- NetNfcGDbusSecureElement *object,
- GDBusMethodInvocation *invocation,
- gint arg_type,
- GVariant *smack_privilege)
+ NetNfcGDbusSecureElement *object,
+ GDBusMethodInvocation *invocation,
+ gint arg_type,
+ GVariant *smack_privilege)
{
SeDataSeType *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager",
- "w") == false) {
+ smack_privilege,
+ "nfc-manager",
+ "w") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->se_type = arg_type;
result = net_nfc_server_controller_async_queue_push(
- se_set_data_thread_func, data);
+ se_set_data_thread_func, data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Se.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.Se.ThreadError",
+ "can not push to controller thread");
g_object_unref(data->object);
g_object_unref(data->invocation);
se_skeleton = net_nfc_gdbus_secure_element_skeleton_new();
g_signal_connect(se_skeleton,
- "handle-set",
- G_CALLBACK(se_handle_set),
- NULL);
+ "handle-set",
+ G_CALLBACK(se_handle_set),
+ NULL);
g_signal_connect(se_skeleton,
- "handle-open-secure-element",
- G_CALLBACK(se_handle_open_secure_element),
- NULL);
+ "handle-open-secure-element",
+ G_CALLBACK(se_handle_open_secure_element),
+ NULL);
g_signal_connect(se_skeleton,
- "handle-close-secure-element",
- G_CALLBACK(se_handle_close_secure_element),
- NULL);
+ "handle-close-secure-element",
+ G_CALLBACK(se_handle_close_secure_element),
+ NULL);
g_signal_connect(se_skeleton,
- "handle-get-atr",
- G_CALLBACK(se_handle_get_atr),
- NULL);
+ "handle-get-atr",
+ G_CALLBACK(se_handle_get_atr),
+ NULL);
g_signal_connect(se_skeleton,
- "handle-send-apdu",
- G_CALLBACK(se_handle_send_apdu),
- NULL);
+ "handle-send-apdu",
+ G_CALLBACK(se_handle_send_apdu),
+ NULL);
result = g_dbus_interface_skeleton_export(
- G_DBUS_INTERFACE_SKELETON(se_skeleton),
- connection,
- "/org/tizen/NetNfcService/SecureElement",
- &error);
+ G_DBUS_INTERFACE_SKELETON(se_skeleton),
+ connection,
+ "/org/tizen/NetNfcService/SecureElement",
+ &error);
if (result == FALSE)
{
DEBUG_ERR_MSG("can not skeleton_export %s", error->message);
}
g_variant_get((GVariant *)user_data,
- "uu@a(y)",
- (guint *)&handle,
- &devType,
- &data);
+ "uu@a(y)",
+ (guint *)&handle,
+ &devType,
+ &data);
net_nfc_server_se_set_current_ese_handle(handle);
}
net_nfc_gdbus_secure_element_emit_ese_detected(
- se_skeleton,
- GPOINTER_TO_UINT(handle),
- devType,
- data);
+ se_skeleton,
+ GPOINTER_TO_UINT(handle),
+ devType,
+ data);
g_variant_unref((GVariant *)user_data);
}
DEBUG_SERVER_MSG("launch se app");
net_nfc_app_util_launch_se_transaction_app(
- detail->aid.buffer,
- detail->aid.length,
- detail->param.buffer,
- detail->param.length);
+ detail->aid.buffer,
+ detail->aid.length,
+ detail->param.buffer,
+ detail->param.length);
DEBUG_SERVER_MSG("launch se app end");
}
GVariant *data;
data = net_nfc_util_gdbus_buffer_to_variant(
- se_target->target_info_values.buffer,
- se_target->target_info_values.length);
+ se_target->target_info_values.buffer,
+ se_target->target_info_values.length);
parameter = g_variant_new("uu@a(y)",
- GPOINTER_TO_UINT(se_target->handle),
- se_target->devType,
- data);
+ GPOINTER_TO_UINT(se_target->handle),
+ se_target->devType,
+ data);
if (parameter != NULL) {
if (net_nfc_server_controller_async_queue_push(
- se_detected_thread_func,
- parameter) == FALSE) {
+ se_detected_thread_func,
+ parameter) == FALSE) {
DEBUG_ERR_MSG("can not push to controller thread");
g_variant_unref(parameter);
if (se_event->aid.buffer != NULL && se_event->aid.length > 0) {
if (net_nfc_util_alloc_data(&detail->aid,
- se_event->aid.length) == true) {
+ se_event->aid.length) == true) {
memcpy(detail->aid.buffer, se_event->aid.buffer,
- se_event->aid.length);
+ se_event->aid.length);
}
}
if (se_event->param.buffer != NULL &&
- se_event->param.length > 0) {
+ se_event->param.length > 0) {
if (net_nfc_util_alloc_data(&detail->param,
- se_event->param.length) == true) {
+ se_event->param.length) == true) {
memcpy(detail->param.buffer,
- se_event->param.buffer,
- se_event->param.length);
+ se_event->param.buffer,
+ se_event->param.length);
}
}
if (net_nfc_server_controller_async_queue_push(
- se_transcation_thread_func, detail) == FALSE) {
+ se_transcation_thread_func, detail) == FALSE) {
DEBUG_ERR_MSG("can not push to controller thread");
net_nfc_util_free_data(&detail->param);
#include "net_nfc_debug_internal.h"
#include "net_nfc_util_defines.h"
#include "net_nfc_util_internal.h"
-#include "net_nfc_controller_internal.h"
+#include "net_nfc_server_controller.h"
#include "net_nfc_server_common.h"
#include "net_nfc_server_llcp.h"
#include "net_nfc_server_snep.h"
#include "net_nfc_server_process_snep.h"
#include "net_nfc_util_gdbus_internal.h"
-#include "net_nfc_server_context_internal.h"
+#include "net_nfc_server_context.h"
/* declaration */
static gboolean _handle_start_server(
- NetNfcGDbusSnep *object,
- GDBusMethodInvocation *invocation,
- guint arg_handle,
- guint arg_sap,
- const gchar *arg_san,
- guint arg_user_data,
- GVariant *arg_privilege);
+ NetNfcGDbusSnep *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_handle,
+ guint arg_sap,
+ const gchar *arg_san,
+ guint arg_user_data,
+ GVariant *arg_privilege);
static gboolean _handle_start_client(
- NetNfcGDbusSnep *object,
- GDBusMethodInvocation *invocation,
- guint arg_handle,
- guint arg_sap,
- const gchar *arg_san,
- guint arg_user_data,
- GVariant *arg_privilege);
+ NetNfcGDbusSnep *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_handle,
+ guint arg_sap,
+ const gchar *arg_san,
+ guint arg_user_data,
+ GVariant *arg_privilege);
static gboolean _handle_client_send_request(
- NetNfcGDbusSnep *object,
- GDBusMethodInvocation *invocation,
- guint arg_snep_handle,
- guint arg_type,
- GVariant *arg_ndef_msg,
- GVariant *arg_privilege);
+ NetNfcGDbusSnep *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_snep_handle,
+ guint arg_type,
+ GVariant *arg_ndef_msg,
+ GVariant *arg_privilege);
static gboolean _handle_stop_snep(
- NetNfcGDbusSnep *object,
- GDBusMethodInvocation *invocation,
- guint arg_handle,
- guint arg_snep_handle,
- GVariant *arg_privilege);
+ NetNfcGDbusSnep *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_handle,
+ guint arg_snep_handle,
+ GVariant *arg_privilege);
static void snep_server_start_thread_func(gpointer user_data);
static NetNfcGDbusSnep *snep_skeleton = NULL;
static void _emit_snep_event_signal(GVariant *parameter,
- net_nfc_snep_handle_h handle,
- net_nfc_error_e result,
- uint32_t type,
- data_s *data)
+ net_nfc_snep_handle_h handle,
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data)
{
GDBusConnection *connection;
char *client_id;
GError *error = NULL;
g_variant_get(parameter, "(usu)",
- (guint *)&connection,
- &client_id,
- (guint *)&user_data);
+ (guint *)&connection,
+ &client_id,
+ (guint *)&user_data);
arg_data = net_nfc_util_gdbus_data_to_variant(data);
if (g_dbus_connection_emit_signal(
- connection,
- client_id,
- "/org/tizen/NetNfcService/Snep",
- "org.tizen.NetNfcService.Snep",
- "SnepEvent",
- g_variant_new("(uui@a(y)u)",
- GPOINTER_TO_UINT(handle),
- type,
- (gint)result,
- arg_data,
- GPOINTER_TO_UINT(user_data)),
- &error) == false) {
+ connection,
+ client_id,
+ "/org/tizen/NetNfcService/Snep",
+ "org.tizen.NetNfcService.Snep",
+ "SnepEvent",
+ g_variant_new("(uui@a(y)u)",
+ GPOINTER_TO_UINT(handle),
+ type,
+ (gint)result,
+ arg_data,
+ GPOINTER_TO_UINT(user_data)),
+ &error) == false) {
if (error != NULL && error->message != NULL) {
DEBUG_ERR_MSG("g_dbus_connection_emit_signal failed : %s", error->message);
} else {
}
static net_nfc_error_e _snep_server_cb(net_nfc_snep_handle_h handle,
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
GVariant *parameter = (GVariant *)user_param;
uint32_t max_len = 0;
net_nfc_server_snep_parse_get_request(data, &max_len,
- temp);
+ temp);
}
break;
case SNEP_REQ_PUT :
- break;
+ break;
default :
DEBUG_ERR_MSG("error [%d]", result);
}
_emit_snep_event_signal(parameter, handle,
- result, type, data);
+ result, type, data);
if (type == NET_NFC_LLCP_STOP) {
g_object_unref(parameter);
}
g_variant_get((GVariant *)user_data,
- "(uuuusu)",
- (guint *)&object,
- (guint *)&invocation,
- (guint *)&arg_handle,
- &arg_sap,
- &arg_san,
- (guint *)&arg_user_data);
+ "(uuuusu)",
+ (guint *)&object,
+ (guint *)&invocation,
+ (guint *)&arg_handle,
+ &arg_sap,
+ &arg_san,
+ (guint *)&arg_user_data);
g_assert(object != NULL);
g_assert(invocation != NULL);
connection = g_dbus_method_invocation_get_connection(invocation);
parameter = g_variant_new("(usu)",
- GPOINTER_TO_UINT(g_object_ref(connection)),
- g_dbus_method_invocation_get_sender(invocation),
- GPOINTER_TO_UINT(arg_user_data));
+ GPOINTER_TO_UINT(g_object_ref(connection)),
+ g_dbus_method_invocation_get_sender(invocation),
+ GPOINTER_TO_UINT(arg_user_data));
if (parameter != NULL) {
result = net_nfc_server_snep_server(arg_handle,
- arg_san,
- arg_sap,
- _snep_server_cb,
- parameter);
+ arg_san,
+ arg_sap,
+ _snep_server_cb,
+ parameter);
if (result != NET_NFC_OK) {
DEBUG_ERR_MSG("net_nfc_server_snep_server failed, [%d]",
result);
}
static gboolean _handle_start_server(
- NetNfcGDbusSnep *object,
- GDBusMethodInvocation *invocation,
- guint arg_handle,
- guint arg_sap,
- const gchar *arg_san,
- guint arg_user_data,
- GVariant *arg_privilege)
+ NetNfcGDbusSnep *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_handle,
+ guint arg_sap,
+ const gchar *arg_san,
+ guint arg_user_data,
+ GVariant *arg_privilege)
{
GVariant *parameter;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- arg_privilege,
- "nfc-manager::p2p",
- "rw") == false) {
+ arg_privilege,
+ "nfc-manager::p2p",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
}
parameter = g_variant_new("(uuuusu)",
- GPOINTER_TO_UINT(g_object_ref(object)),
- GPOINTER_TO_UINT(g_object_ref(invocation)),
- arg_handle,
- arg_sap,
- arg_san,
- arg_user_data);
+ GPOINTER_TO_UINT(g_object_ref(object)),
+ GPOINTER_TO_UINT(g_object_ref(invocation)),
+ arg_handle,
+ arg_sap,
+ arg_san,
+ arg_user_data);
if (parameter != NULL)
{
if ((result = net_nfc_server_controller_async_queue_push(
- snep_server_start_thread_func, parameter)) == FALSE)
+ snep_server_start_thread_func, parameter)) == FALSE)
{
DEBUG_ERR_MSG("net_nfc_server_controller_async_queue_push failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Snep.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.Snep.ThreadError",
+ "can not push to controller thread");
g_object_unref(invocation);
g_object_unref(object);
DEBUG_ERR_MSG("g_variant_new failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Snep.MemoryError",
- "Out of memory");
+ "org.tizen.NetNfcService.Snep.MemoryError",
+ "Out of memory");
result = FALSE;
}
}
static net_nfc_error_e _snep_start_client_cb(
- net_nfc_snep_handle_h handle,
- net_nfc_error_e result,
- uint32_t type,
- data_s *data,
- void *user_param)
+ net_nfc_snep_handle_h handle,
+ net_nfc_error_e result,
+ uint32_t type,
+ data_s *data,
+ void *user_param)
{
GVariant *parameter = (GVariant *)user_param;
}
g_variant_get((GVariant *)user_data,
- "(uuuusu)",
- (guint *)&object,
- (guint *)&invocation,
- (guint *)&arg_handle,
- &arg_sap,
- &arg_san,
- (guint *)&arg_user_data);
+ "(uuuusu)",
+ (guint *)&object,
+ (guint *)&invocation,
+ (guint *)&arg_handle,
+ &arg_sap,
+ &arg_san,
+ (guint *)&arg_user_data);
g_assert(object != NULL);
g_assert(invocation != NULL);
connection = g_dbus_method_invocation_get_connection(invocation);
parameter = g_variant_new("(usu)",
- GPOINTER_TO_UINT(g_object_ref(connection)),
- g_dbus_method_invocation_get_sender(invocation),
- GPOINTER_TO_UINT(arg_user_data));
+ GPOINTER_TO_UINT(g_object_ref(connection)),
+ g_dbus_method_invocation_get_sender(invocation),
+ GPOINTER_TO_UINT(arg_user_data));
if (parameter != NULL) {
result = net_nfc_server_snep_client(arg_handle,
- arg_san,
- arg_sap,
- _snep_start_client_cb,
- parameter);
+ arg_san,
+ arg_sap,
+ _snep_start_client_cb,
+ parameter);
if (result != NET_NFC_OK) {
DEBUG_ERR_MSG("net_nfc_server_snep_client failed, [%d]",
result);
}
static gboolean _handle_start_client(
- NetNfcGDbusSnep *object,
- GDBusMethodInvocation *invocation,
- guint arg_handle,
- guint arg_sap,
- const gchar *arg_san,
- guint arg_user_data,
- GVariant *arg_privilege)
+ NetNfcGDbusSnep *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_handle,
+ guint arg_sap,
+ const gchar *arg_san,
+ guint arg_user_data,
+ GVariant *arg_privilege)
{
GVariant *parameter;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- arg_privilege,
- "nfc-manager::p2p",
- "rw") == false) {
+ arg_privilege,
+ "nfc-manager::p2p",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
}
parameter = g_variant_new("(uuuusu)",
- GPOINTER_TO_UINT(g_object_ref(object)),
- GPOINTER_TO_UINT(g_object_ref(invocation)),
- arg_handle,
- arg_sap,
- arg_san,
- arg_user_data);
+ GPOINTER_TO_UINT(g_object_ref(object)),
+ GPOINTER_TO_UINT(g_object_ref(invocation)),
+ arg_handle,
+ arg_sap,
+ arg_san,
+ arg_user_data);
if (parameter != NULL)
{
if ((result = net_nfc_server_controller_async_queue_push(
- snep_client_start_thread_func, parameter)) == FALSE)
+ snep_client_start_thread_func, parameter)) == FALSE)
{
DEBUG_ERR_MSG("net_nfc_server_controller_async_queue_push failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Snep.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.Snep.ThreadError",
+ "can not push to controller thread");
g_object_unref(invocation);
g_object_unref(object);
DEBUG_ERR_MSG("g_variant_new failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Snep.MemoryError",
- "Out of memory");
+ "org.tizen.NetNfcService.Snep.MemoryError",
+ "Out of memory");
result = FALSE;
}
}
static net_nfc_error_e _snep_client_request_cb(
- net_nfc_snep_handle_h handle,
- net_nfc_error_e result,
- net_nfc_snep_type_t type,
- data_s *data,
- void *user_param)
+ net_nfc_snep_handle_h handle,
+ net_nfc_error_e result,
+ net_nfc_snep_type_t type,
+ data_s *data,
+ void *user_param)
{
GVariant *parameter = (GVariant *)user_param;
DEBUG_SERVER_MSG("type [%d], result [%d], data [%p], user_param [%p]",
- type, result, data, user_param);
+ type, result, data, user_param);
if (parameter != NULL) {
NetNfcGDbusSnep *object;
GVariant *arg_data = NULL;
g_variant_get(parameter,
- "(uuuu@a(y))",
- (guint *)&object,
- (guint *)&invocation,
- (guint *)&arg_snep_handle,
- (guint *)&arg_type,
- &arg_ndef_msg);
+ "(uuuu@a(y))",
+ (guint *)&object,
+ (guint *)&invocation,
+ (guint *)&arg_snep_handle,
+ (guint *)&arg_type,
+ &arg_ndef_msg);
if (data != NULL && data->buffer != NULL && data->length > 0) {
arg_data = net_nfc_util_gdbus_data_to_variant(data);
}
net_nfc_gdbus_snep_complete_client_request(object,
- invocation,
- result,
- type,
- arg_data);
+ invocation,
+ result,
+ type,
+ arg_data);
g_variant_unref(arg_ndef_msg);
}
g_variant_get((GVariant *)user_data,
- "(uuuu@a(y))",
- (guint *)&object,
- (guint *)&invocation,
- (guint *)&arg_snep_handle,
- (guint *)&arg_type,
- &arg_ndef_msg);
+ "(uuuu@a(y))",
+ (guint *)&object,
+ (guint *)&invocation,
+ (guint *)&arg_snep_handle,
+ (guint *)&arg_type,
+ &arg_ndef_msg);
g_assert(object != NULL);
g_assert(invocation != NULL);
net_nfc_util_gdbus_variant_to_data_s(arg_ndef_msg, &data);
result = net_nfc_server_snep_client_request(arg_snep_handle,
- arg_type,
- &data,
- _snep_client_request_cb,
- user_data);
+ arg_type,
+ &data,
+ _snep_client_request_cb,
+ user_data);
if (result != NET_NFC_OK)
{
GVariant *resp;
DEBUG_ERR_MSG("net_nfc_server_snep_client_request "
- "failed, [%d]",result);
+ "failed, [%d]",result);
resp = net_nfc_util_gdbus_buffer_to_variant(NULL, 0);
net_nfc_gdbus_snep_complete_client_request(object,
- invocation, result, NET_NFC_LLCP_STOP, resp);
+ invocation, result, NET_NFC_LLCP_STOP, resp);
g_object_unref(invocation);
g_object_unref(object);
}
static gboolean _handle_client_send_request(
- NetNfcGDbusSnep *object,
- GDBusMethodInvocation *invocation,
- guint arg_snep_handle,
- guint arg_type,
- GVariant *arg_ndef_msg,
- GVariant *arg_privilege)
+ NetNfcGDbusSnep *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_snep_handle,
+ guint arg_type,
+ GVariant *arg_ndef_msg,
+ GVariant *arg_privilege)
{
GVariant *parameter;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- arg_privilege,
- "nfc-manager::p2p",
- "rw") == false) {
+ arg_privilege,
+ "nfc-manager::p2p",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
}
parameter = g_variant_new("(uuuu@a(y))",
- GPOINTER_TO_UINT(g_object_ref(object)),
- GPOINTER_TO_UINT(g_object_ref(invocation)),
- arg_snep_handle,
- arg_type,
- arg_ndef_msg);
+ GPOINTER_TO_UINT(g_object_ref(object)),
+ GPOINTER_TO_UINT(g_object_ref(invocation)),
+ arg_snep_handle,
+ arg_type,
+ arg_ndef_msg);
if (parameter != NULL)
{
if ((result = net_nfc_server_controller_async_queue_push(
- snep_client_send_request_thread_func, parameter)) == FALSE)
+ snep_client_send_request_thread_func, parameter)) == FALSE)
{
DEBUG_ERR_MSG("net_nfc_server_controller_async_queue_push failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Snep.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.Snep.ThreadError",
+ "can not push to controller thread");
g_object_unref(invocation);
g_object_unref(object);
DEBUG_ERR_MSG("g_variant_new failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Snep.MemoryError",
- "Out of memory");
+ "org.tizen.NetNfcService.Snep.MemoryError",
+ "Out of memory");
result = FALSE;
}
}
g_variant_get((GVariant *)user_data,
- "(uuuu)",
- (guint *)&object,
- (guint *)&invocation,
- (guint *)&handle,
- (guint *)&snep_handle);
+ "(uuuu)",
+ (guint *)&object,
+ (guint *)&invocation,
+ (guint *)&handle,
+ (guint *)&snep_handle);
g_assert(object != NULL);
g_assert(invocation != NULL);
/* TODO :
- g_dbus_method_invocation_return_dbus_error(
+ g_dbus_method_invocation_return_dbus_error(
invocation,
"org.tizen.NetNfcService.Snep.DataError",
"Cannot stop SNEP service");
- */
+ */
net_nfc_gdbus_snep_complete_stop_snep(object,
- invocation,
- NET_NFC_OK);
+ invocation,
+ NET_NFC_OK);
g_object_unref(invocation);
g_object_unref(object);
}
static gboolean _handle_stop_snep(
- NetNfcGDbusSnep *object,
- GDBusMethodInvocation *invocation,
- guint arg_handle,
- guint arg_snep_handle,
- GVariant *arg_privilege)
+ NetNfcGDbusSnep *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_handle,
+ guint arg_snep_handle,
+ GVariant *arg_privilege)
{
GVariant *parameter;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- arg_privilege,
- "nfc-manager::p2p",
- "rw") == false) {
+ arg_privilege,
+ "nfc-manager::p2p",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
}
parameter = g_variant_new("(uuuu)",
- GPOINTER_TO_UINT(g_object_ref(object)),
- GPOINTER_TO_UINT(g_object_ref(invocation)),
- arg_handle,
- arg_snep_handle);
+ GPOINTER_TO_UINT(g_object_ref(object)),
+ GPOINTER_TO_UINT(g_object_ref(invocation)),
+ arg_handle,
+ arg_snep_handle);
if (parameter != NULL)
{
if ((result = net_nfc_server_controller_async_queue_push(
- snep_stop_service_thread_func, parameter)) == FALSE)
+ snep_stop_service_thread_func, parameter)) == FALSE)
{
DEBUG_ERR_MSG("net_nfc_server_controller_async_queue_push failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Snep.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.Snep.ThreadError",
+ "can not push to controller thread");
g_object_unref(invocation);
g_object_unref(object);
DEBUG_ERR_MSG("g_variant_new failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Snep.MemoryError",
- "Out of memory");
+ "org.tizen.NetNfcService.Snep.MemoryError",
+ "Out of memory");
result = FALSE;
}
}
static void _snep_activate_cb(int event, net_nfc_target_handle_s *handle,
- uint32_t sap, const char *san, void *user_param)
+ uint32_t sap, const char *san, void *user_param)
{
GVariant *parameter = (GVariant *)user_param;
net_nfc_error_e result = NET_NFC_OK;
DEBUG_SERVER_MSG("event [%d], handle [%p], sap [%d], san [%s]",
- event, handle, sap, san);
+ event, handle, sap, san);
if (event == NET_NFC_LLCP_START) {
GDBusConnection *connection;
/* start server */
g_variant_get(parameter, "(usu)",
- (guint *)&connection,
- &client_id,
- (guint *)&user_data);
+ (guint *)&connection,
+ &client_id,
+ (guint *)&user_data);
param = g_variant_new("(usu)",
- GPOINTER_TO_UINT(g_object_ref(connection)),
- client_id,
- GPOINTER_TO_UINT(user_data));
+ GPOINTER_TO_UINT(g_object_ref(connection)),
+ client_id,
+ GPOINTER_TO_UINT(user_data));
g_free(client_id);
result = net_nfc_server_snep_server(handle, (char *)san, sap,
- _snep_server_cb, param);
+ _snep_server_cb, param);
if (result == NET_NFC_OK) {
_emit_snep_event_signal(parameter, handle,
- result, event, NULL);
+ result, event, NULL);
} else {
DEBUG_ERR_MSG("net_nfc_server_snep_server failed, [%d]",
- result);
+ result);
g_variant_unref(param);
}
} else {
_emit_snep_event_signal(parameter, handle,
- result, NET_NFC_LLCP_UNREGISTERED, NULL);
+ result, NET_NFC_LLCP_UNREGISTERED, NULL);
/* unregister server */
g_variant_unref(parameter);
g_assert(user_data != NULL);
g_variant_get((GVariant *)user_data,
- "(uuusu)",
- (guint *)&object,
- (guint *)&invocation,
- &arg_sap,
- &arg_san,
- &arg_user_data);
+ "(uuusu)",
+ (guint *)&object,
+ (guint *)&invocation,
+ &arg_sap,
+ &arg_san,
+ &arg_user_data);
g_assert(object != NULL);
g_assert(invocation != NULL);
connection = g_dbus_method_invocation_get_connection(invocation);
parameter = g_variant_new("(usu)",
- GPOINTER_TO_UINT(g_object_ref(connection)),
- g_dbus_method_invocation_get_sender(invocation),
- arg_user_data);
+ GPOINTER_TO_UINT(g_object_ref(connection)),
+ g_dbus_method_invocation_get_sender(invocation),
+ arg_user_data);
if (parameter != NULL) {
/* register default snep server */
result = net_nfc_server_llcp_register_service(
- g_dbus_method_invocation_get_sender(invocation),
- arg_sap,
- arg_san,
- _snep_activate_cb,
- parameter);
+ g_dbus_method_invocation_get_sender(invocation),
+ arg_sap,
+ arg_san,
+ _snep_activate_cb,
+ parameter);
if (result != NET_NFC_OK) {
DEBUG_ERR_MSG("net_nfc_service_llcp_register_service failed, [%d]", result);
g_object_unref(connection);
}
net_nfc_gdbus_snep_complete_server_register(object,
- invocation,
- result);
+ invocation,
+ result);
g_free(arg_san);
}
static gboolean _handle_register_server(
- NetNfcGDbusSnep *object,
- GDBusMethodInvocation *invocation,
- guint arg_sap,
- const gchar *arg_san,
- guint arg_user_data,
- GVariant *arg_privilege)
+ NetNfcGDbusSnep *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_sap,
+ const gchar *arg_san,
+ guint arg_user_data,
+ GVariant *arg_privilege)
{
GVariant *parameter;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- arg_privilege,
- "nfc-manager::p2p",
- "rw") == false) {
+ arg_privilege,
+ "nfc-manager::p2p",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
}
parameter = g_variant_new("(uuusu)",
- GPOINTER_TO_UINT(g_object_ref(object)),
- GPOINTER_TO_UINT(g_object_ref(invocation)),
- arg_sap,
- arg_san,
- arg_user_data);
+ GPOINTER_TO_UINT(g_object_ref(object)),
+ GPOINTER_TO_UINT(g_object_ref(invocation)),
+ arg_sap,
+ arg_san,
+ arg_user_data);
if (parameter != NULL)
{
if ((result = net_nfc_server_controller_async_queue_push(
- snep_register_server_thread_func, parameter)) == FALSE)
+ snep_register_server_thread_func, parameter)) == FALSE)
{
DEBUG_ERR_MSG("net_nfc_server_controller_async_queue_push failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Snep.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.Snep.ThreadError",
+ "can not push to controller thread");
g_object_unref(invocation);
g_object_unref(object);
DEBUG_ERR_MSG("g_variant_new failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Snep.MemoryError",
- "Out of memory");
+ "org.tizen.NetNfcService.Snep.MemoryError",
+ "Out of memory");
result = FALSE;
}
g_assert(user_data != NULL);
g_variant_get((GVariant *)user_data,
- "(uuus)",
- (guint *)&object,
- (guint *)&invocation,
- &arg_sap,
- &arg_san);
+ "(uuus)",
+ (guint *)&object,
+ (guint *)&invocation,
+ &arg_sap,
+ &arg_san);
g_assert(object != NULL);
g_assert(invocation != NULL);
result = net_nfc_server_llcp_unregister_service(
- g_dbus_method_invocation_get_sender(invocation),
- arg_sap,
- arg_san);
+ g_dbus_method_invocation_get_sender(invocation),
+ arg_sap,
+ arg_san);
net_nfc_gdbus_snep_complete_server_unregister(object,
- invocation,
- result);
+ invocation,
+ result);
g_free(arg_san);
}
static gboolean _handle_unregister_server(
- NetNfcGDbusSnep *object,
- GDBusMethodInvocation *invocation,
- guint arg_sap,
- const gchar *arg_san,
- GVariant *arg_privilege)
+ NetNfcGDbusSnep *object,
+ GDBusMethodInvocation *invocation,
+ guint arg_sap,
+ const gchar *arg_san,
+ GVariant *arg_privilege)
{
GVariant *parameter;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- arg_privilege,
- "nfc-manager::p2p",
- "rw") == false) {
+ arg_privilege,
+ "nfc-manager::p2p",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
}
parameter = g_variant_new("(uuus)",
- GPOINTER_TO_UINT(g_object_ref(object)),
- GPOINTER_TO_UINT(g_object_ref(invocation)),
- arg_sap,
- arg_san);
+ GPOINTER_TO_UINT(g_object_ref(object)),
+ GPOINTER_TO_UINT(g_object_ref(invocation)),
+ arg_sap,
+ arg_san);
if (parameter != NULL)
{
if ((result = net_nfc_server_controller_async_queue_push(
- snep_unregister_server_thread_func, parameter)) == FALSE)
+ snep_unregister_server_thread_func, parameter)) == FALSE)
{
DEBUG_ERR_MSG("net_nfc_server_controller_async_queue_push failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Snep.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.Snep.ThreadError",
+ "can not push to controller thread");
g_object_unref(invocation);
g_object_unref(object);
DEBUG_ERR_MSG("g_variant_new failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Snep.MemoryError",
- "Out of memory");
+ "org.tizen.NetNfcService.Snep.MemoryError",
+ "Out of memory");
result = FALSE;
}
snep_skeleton = net_nfc_gdbus_snep_skeleton_new();
g_signal_connect(snep_skeleton,
- "handle-server-register",
- G_CALLBACK(_handle_register_server),
- NULL);
+ "handle-server-register",
+ G_CALLBACK(_handle_register_server),
+ NULL);
g_signal_connect(snep_skeleton,
- "handle-server-unregister",
- G_CALLBACK(_handle_unregister_server),
- NULL);
+ "handle-server-unregister",
+ G_CALLBACK(_handle_unregister_server),
+ NULL);
g_signal_connect(snep_skeleton,
- "handle-server-start",
- G_CALLBACK(_handle_start_server),
- NULL);
+ "handle-server-start",
+ G_CALLBACK(_handle_start_server),
+ NULL);
g_signal_connect(snep_skeleton,
- "handle-client-start",
- G_CALLBACK(_handle_start_client),
- NULL);
+ "handle-client-start",
+ G_CALLBACK(_handle_start_client),
+ NULL);
g_signal_connect(snep_skeleton,
- "handle-client-request",
- G_CALLBACK(_handle_client_send_request),
- NULL);
+ "handle-client-request",
+ G_CALLBACK(_handle_client_send_request),
+ NULL);
g_signal_connect(snep_skeleton,
- "handle-stop-snep",
- G_CALLBACK(_handle_stop_snep),
- NULL);
+ "handle-stop-snep",
+ G_CALLBACK(_handle_stop_snep),
+ NULL);
result = g_dbus_interface_skeleton_export(
- G_DBUS_INTERFACE_SKELETON(snep_skeleton),
- connection,
- "/org/tizen/NetNfcService/Snep",
- &error);
+ G_DBUS_INTERFACE_SKELETON(snep_skeleton),
+ connection,
+ "/org/tizen/NetNfcService/Snep",
+ &error);
if (result == FALSE)
{
g_error_free(error);
#include "net_nfc_gdbus.h"
#include "net_nfc_debug_internal.h"
#include "net_nfc_server_common.h"
-#include "net_nfc_server_context_internal.h"
+#include "net_nfc_server_context.h"
#include "net_nfc_server_system_handler.h"
static NetNfcGDbusPopup *popup_skeleton = NULL;
static gboolean popup_handle_set(NetNfcGDbusPopup *popup_manager,
- GDBusMethodInvocation *invocation,
- gboolean state,
- gint focus_state,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ gboolean state,
+ gint focus_state,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean popup_handle_get(NetNfcGDbusPopup *popup_manager,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean popup_handle_set(NetNfcGDbusPopup *popup_manager,
- GDBusMethodInvocation *invocation,
- gboolean state,
- gint focus_state,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ gboolean state,
+ gint focus_state,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager",
- "w") == false) {
+ smack_privilege,
+ "nfc-manager",
+ "w") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
}
net_nfc_server_gdbus_set_launch_state(
- g_dbus_method_invocation_get_sender(invocation),
- state, focus_state);
+ g_dbus_method_invocation_get_sender(invocation),
+ state, focus_state);
net_nfc_gdbus_popup_complete_set(popup_manager, invocation);
}
static gboolean popup_handle_get(NetNfcGDbusPopup *popup_manager,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
gboolean state;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager",
- "r") == false) {
+ smack_privilege,
+ "nfc-manager",
+ "r") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
}
state = net_nfc_server_gdbus_get_launch_state(
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
net_nfc_gdbus_popup_complete_get(popup_manager, invocation, state);
}
g_signal_connect(popup_skeleton,
- "handle-set",
- G_CALLBACK(popup_handle_set),
- NULL);
+ "handle-set",
+ G_CALLBACK(popup_handle_set),
+ NULL);
g_signal_connect(popup_skeleton,
- "handle-get",
- G_CALLBACK(popup_handle_get),
- NULL);
+ "handle-get",
+ G_CALLBACK(popup_handle_get),
+ NULL);
result = g_dbus_interface_skeleton_export(
- G_DBUS_INTERFACE_SKELETON(popup_skeleton),
- connection,
- "/org/tizen/NetNfcService/Popup",
- &error);
+ G_DBUS_INTERFACE_SKELETON(popup_skeleton),
+ connection,
+ "/org/tizen/NetNfcService/Popup",
+ &error);
if (result == FALSE)
{
DEBUG_ERR_MSG("Can not skeleton_export %s", error->message);
#include "net_nfc_debug_internal.h"
#include "net_nfc_util_internal.h"
#include "net_nfc_util_gdbus_internal.h"
-#include "net_nfc_controller_internal.h"
-#include "net_nfc_app_util_internal.h"
#include "net_nfc_gdbus.h"
+#include "net_nfc_server_controller.h"
#include "net_nfc_server_common.h"
-#include "net_nfc_server_context_internal.h"
-#include "net_nfc_server_tag.h"
+#include "net_nfc_server_context.h"
+#include "net_nfc_server_util.h"
#include "net_nfc_server_p2p.h"
#include "net_nfc_server_process_handover.h"
#include "net_nfc_util_ndef_record.h"
+#include "net_nfc_server_tag.h"
typedef struct _CurrentTagInfoData CurrentTagInfoData;
static gboolean tag_is_isp_dep_ndef_formatable(net_nfc_target_handle_s *handle,
- int dev_type);
+ int dev_type);
static gboolean tag_read_ndef_message(net_nfc_target_handle_s *handle,
- int dev_type,
- data_s **read_ndef);
+ int dev_type,
+ data_s **read_ndef);
static void tag_watchdog_thread_func(gpointer user_data);
/* methods */
static gboolean tag_handle_is_tag_connected(NetNfcGDbusTag *tag,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean tag_handle_get_current_tag_info(NetNfcGDbusTag *tag,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean tag_handle_get_current_target_handle(NetNfcGDbusTag *tag,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data);
static NetNfcGDbusTag *tag_skeleton = NULL;
static net_nfc_current_target_info_s *current_target_info = NULL;
static gboolean tag_is_isp_dep_ndef_formatable(net_nfc_target_handle_s *handle,
- int dev_type)
+ int dev_type)
{
uint8_t cmd[] = { 0x90, 0x60, 0x00, 0x00, 0x00 };
if (response != NULL)
{
if (response->length == 9 &&
- response->buffer[7] == (uint8_t)0x91 &&
- response->buffer[8] == (uint8_t)0xAF)
+ response->buffer[7] == (uint8_t)0x91 &&
+ response->buffer[8] == (uint8_t)0xAF)
{
result = TRUE;
}
}
static gboolean tag_read_ndef_message(net_nfc_target_handle_s *handle,
- int dev_type,
- data_s **read_ndef)
+ int dev_type,
+ data_s **read_ndef)
{
net_nfc_error_e result = NET_NFC_OK;
data_s *temp = NULL;
if (tag_is_isp_dep_ndef_formatable(handle, dev_type) == FALSE)
{
DEBUG_ERR_MSG(
- "DESFIRE : ISO-DEP ndef not formatable");
+ "DESFIRE : ISO-DEP ndef not formatable");
return FALSE;
}
/* IMPORTANT, TEMPORARY : switching context to another thread
- for give CPU time */
+ for give CPU time */
g_usleep(10000);
handle = watch_dog->handle;
handle->connection_type == NET_NFC_TAG_CONNECTION)
{
is_present_target = net_nfc_controller_check_target_presence(
- handle, &result);
+ handle, &result);
}
if (is_present_target == true)
net_nfc_server_set_state(NET_NFC_SERVER_IDLE);
net_nfc_gdbus_tag_emit_tag_detached(tag_skeleton,
- GPOINTER_TO_UINT(handle),
- watch_dog->dev_type);
+ GPOINTER_TO_UINT(handle),
+ watch_dog->dev_type);
g_free(watch_dog);
}
target_info = net_nfc_server_get_target_info();
if (target_info != NULL &&
- target_info->devType != NET_NFC_NFCIP1_TARGET &&
- target_info->devType != NET_NFC_NFCIP1_INITIATOR)
+ target_info->devType != NET_NFC_NFCIP1_TARGET &&
+ target_info->devType != NET_NFC_NFCIP1_INITIATOR)
{
handle = target_info->handle;
number_of_keys = target_info->number_of_keys;
if (is_ndef_supported)
{
if (net_nfc_controller_read_ndef(target_info->handle,
- &raw_data, &result) == true)
+ &raw_data, &result) == true)
{
DEBUG_SERVER_MSG("%s is success",
"net_nfc_controller_read_ndef");
}
net_nfc_gdbus_tag_complete_get_current_tag_info(info_data->tag,
- info_data->invocation,
- (dev_type != NET_NFC_UNKNOWN_TARGET),
- GPOINTER_TO_UINT(handle),
- dev_type,
- is_ndef_supported,
- ndef_card_state,
- max_data_size,
- actual_data_size,
- number_of_keys,
- net_nfc_util_gdbus_data_to_variant(&target_info_values),
- net_nfc_util_gdbus_data_to_variant(raw_data));
+ info_data->invocation,
+ (dev_type != NET_NFC_UNKNOWN_TARGET),
+ GPOINTER_TO_UINT(handle),
+ dev_type,
+ is_ndef_supported,
+ ndef_card_state,
+ max_data_size,
+ actual_data_size,
+ number_of_keys,
+ net_nfc_util_gdbus_data_to_variant(&target_info_values),
+ net_nfc_util_gdbus_data_to_variant(raw_data));
if (raw_data != NULL) {
net_nfc_util_free_data(raw_data);
watch_dog->handle = target->handle;
if (net_nfc_server_controller_async_queue_push(
- tag_watchdog_thread_func,
- watch_dog) == FALSE)
+ tag_watchdog_thread_func,
+ watch_dog) == FALSE)
{
DEBUG_ERR_MSG("can not create watch dog");
g_free(watch_dog);
static gboolean tag_handle_is_tag_connected(NetNfcGDbusTag *tag,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
/* FIXME : net_nfc_current_target_info_s should be removed */
net_nfc_current_target_info_s *target_info;
gboolean is_connected = FALSE;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::tag",
- "r") == false) {
+ smack_privilege,
+ "nfc-manager::tag",
+ "r") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
}
net_nfc_gdbus_tag_complete_is_tag_connected(tag,
- invocation,
- is_connected,
- (gint32)dev_type);
+ invocation,
+ is_connected,
+ (gint32)dev_type);
return TRUE;
}
static gboolean tag_handle_get_current_tag_info(NetNfcGDbusTag *tag,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
CurrentTagInfoData *info_data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::tag",
- "r") == false) {
+ smack_privilege,
+ "nfc-manager::tag",
+ "r") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
info_data->invocation = g_object_ref(invocation);
result = net_nfc_server_controller_async_queue_push(
- tag_get_current_tag_info_thread_func,
- info_data);
+ tag_get_current_tag_info_thread_func,
+ info_data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
}
static gboolean tag_handle_get_current_target_handle(NetNfcGDbusTag *tag,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
/* FIXME : net_nfc_current_target_info_s should be removed */
net_nfc_current_target_info_s *target_info;
uint32_t devType = NET_NFC_UNKNOWN_TARGET;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager::tag",
- "r") == false) {
+ smack_privilege,
+ "nfc-manager::tag",
+ "r") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
}
net_nfc_gdbus_tag_complete_get_current_target_handle(tag,
- invocation,
- (handle != NULL),
- GPOINTER_TO_UINT(handle),
- devType);
+ invocation,
+ (handle != NULL),
+ GPOINTER_TO_UINT(handle),
+ devType);
return TRUE;
}
NULL);
result = g_dbus_interface_skeleton_export(
- G_DBUS_INTERFACE_SKELETON(tag_skeleton),
- connection,
- "/org/tizen/NetNfcService/Tag",
- &error);
+ G_DBUS_INTERFACE_SKELETON(tag_skeleton),
+ connection,
+ "/org/tizen/NetNfcService/Tag",
+ &error);
if (result == FALSE)
{
DEBUG_ERR_MSG("can not skeleton_export %s", error->message);
target = (net_nfc_request_target_detected_t *)info;
current_target_info = g_malloc0(
- sizeof(net_nfc_current_target_info_s) +
- target->target_info_values.length);
+ sizeof(net_nfc_current_target_info_s) +
+ target->target_info_values.length);
current_target_info->handle = target->handle;
current_target_info->devType = target->devType;
{
current_target_info->number_of_keys = target->number_of_keys;
current_target_info->target_info_values.length =
- target->target_info_values.length;
+ target->target_info_values.length;
memcpy(¤t_target_info->target_info_values,
- &target->target_info_values,
- current_target_info->target_info_values.length);
+ &target->target_info_values,
+ current_target_info->target_info_values.length);
}
}
void net_nfc_server_tag_target_detected(void *info)
{
if (net_nfc_server_controller_async_queue_push(
- tag_slave_target_detected_thread_func,
- NULL) == FALSE)
+ tag_slave_target_detected_thread_func,
+ NULL) == FALSE)
{
DEBUG_ERR_MSG("can not push to controller thread");
}
#include "net_nfc_debug_internal.h"
#include "net_nfc_util_internal.h"
#include "net_nfc_util_gdbus_internal.h"
-#include "net_nfc_controller_internal.h"
+#include "net_nfc_server_controller.h"
#include "net_nfc_gdbus.h"
#include "net_nfc_server_common.h"
-#include "net_nfc_server_context_internal.h"
+#include "net_nfc_server_context.h"
#include "net_nfc_server_test.h"
typedef struct _TestData TestData;
static gboolean test_handle_sim_test(NetNfcGDbusTest *test,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean test_handle_prbs_test(NetNfcGDbusTest *test,
- GDBusMethodInvocation *invocation,
- guint32 arg_tech,
- guint32 arg_rate,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 arg_tech,
+ guint32 arg_rate,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean test_handle_get_firmware_version(NetNfcGDbusTest *test,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean test_handle_set_ee_data(NetNfcGDbusTest *test,
- GDBusMethodInvocation *invocation,
- guint32 mode,
- guint32 reg_id,
- GVariant *variant,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint32 mode,
+ guint32 reg_id,
+ GVariant *variant,
+ GVariant *smack_privilege,
+ gpointer user_data);
static NetNfcGDbusTest *test_skeleton = NULL;
net_nfc_controller_sim_test(&result);
net_nfc_gdbus_test_complete_sim_test(data->test,
- data->invocation,
- (gint)result);
+ data->invocation,
+ (gint)result);
g_object_unref(data->invocation);
g_object_unref(data->test);
net_nfc_controller_prbs_test(&result, data->tech, data->rate);
net_nfc_gdbus_test_complete_prbs_test(data->test,
- data->invocation,
- (gint)result);
+ data->invocation,
+ (gint)result);
g_object_unref(data->invocation);
g_object_unref(data->test);
}
net_nfc_gdbus_test_complete_get_firmware_version(data->test,
- data->invocation,
- (gint)result,
- version);
+ data->invocation,
+ (gint)result,
+ version);
g_free(version);
g_assert(data->invocation != NULL);
net_nfc_controller_eedata_register_set(&result,
- data->mode,
- data->reg_id,
- &data->data);
+ data->mode,
+ data->reg_id,
+ &data->data);
net_nfc_gdbus_test_complete_set_ee_data(data->test,
- data->invocation,
- (gint)result);
+ data->invocation,
+ (gint)result);
net_nfc_util_free_data(&data->data);
}
static gboolean test_handle_sim_test(NetNfcGDbusTest *test,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
TestData *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->invocation = g_object_ref(invocation);
result = net_nfc_server_controller_async_queue_push(
- test_handle_sim_test_thread_func,
- data);
+ test_handle_sim_test_thread_func,
+ data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
}
static gboolean test_handle_prbs_test(NetNfcGDbusTest *test,
- GDBusMethodInvocation *invocation,
- guint32 arg_tech,
- guint32 arg_rate,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 arg_tech,
+ guint32 arg_rate,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
TestPrbsData *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return TRUE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->rate = arg_rate;
result = net_nfc_server_controller_async_queue_push(
- test_handle_prbs_test_thread_func,
- data);
+ test_handle_prbs_test_thread_func,
+ data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
}
static gboolean test_handle_get_firmware_version(NetNfcGDbusTest *test,
- GDBusMethodInvocation *invocation,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
TestData *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->invocation = g_object_ref(invocation);
result = net_nfc_server_controller_async_queue_push(
- test_handle_get_firmware_version_thread_func,
- data);
+ test_handle_get_firmware_version_thread_func,
+ data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
}
static gboolean test_handle_set_ee_data(NetNfcGDbusTest *test,
- GDBusMethodInvocation *invocation,
- guint32 mode,
- guint32 reg_id,
- GVariant *variant,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint32 mode,
+ guint32 reg_id,
+ GVariant *variant,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
TestSetEeData *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
net_nfc_util_gdbus_variant_to_data_s(variant, &data->data);
result = net_nfc_server_controller_async_queue_push(
- test_handle_set_ee_data_thread_func, data);
+ test_handle_set_ee_data_thread_func, data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.ThreadError",
+ "can not push to controller thread");
net_nfc_util_free_data(&data->data);
NULL);
result = g_dbus_interface_skeleton_export(
- G_DBUS_INTERFACE_SKELETON(test_skeleton),
- connection,
- "/org/tizen/NetNfcService/Test",
- &error);
+ G_DBUS_INTERFACE_SKELETON(test_skeleton),
+ connection,
+ "/org/tizen/NetNfcService/Test",
+ &error);
if (result == FALSE)
{
DEBUG_ERR_MSG("Can not skeleton_export %s", error->message);
#include "net_nfc_debug_internal.h"
#include "net_nfc_util_internal.h"
#include "net_nfc_util_gdbus_internal.h"
-#include "net_nfc_controller_internal.h"
+#include "net_nfc_server_controller.h"
#include "net_nfc_gdbus.h"
#include "net_nfc_server_common.h"
#include "net_nfc_server_tag.h"
-#include "net_nfc_server_context_internal.h"
+#include "net_nfc_server_context.h"
#include "net_nfc_server_transceive.h"
static void transceive_data_thread_func(gpointer user_data);
static gboolean transceive_handle(NetNfcGDbusTransceive *transceive,
- GDBusMethodInvocation *invocation,
- guint handle,
- guint dev_type,
- GVariant *arg_data,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint handle,
+ guint dev_type,
+ GVariant *arg_data,
+ GVariant *smack_privilege,
+ gpointer user_data);
static gboolean transceive_data_handle(NetNfcGDbusTransceive *transceive,
- GDBusMethodInvocation *invocation,
- guint handle,
- guint dev_type,
- GVariant *arg_data,
- GVariant *smack_privilege,
- gpointer user_data);
+ GDBusMethodInvocation *invocation,
+ guint handle,
+ guint dev_type,
+ GVariant *arg_data,
+ GVariant *smack_privilege,
+ gpointer user_data);
typedef struct _TransceiveSendData TransceiveSendData;
DEBUG_SERVER_MSG("call transceive");
if (net_nfc_controller_transceive(handle,
- &transceive_data->transceive_info,
- &data,
- &result) == true)
+ &transceive_data->transceive_info,
+ &data,
+ &result) == true)
{
if (data != NULL)
{
DEBUG_SERVER_MSG("Transceive data received [%d]",
- data->length);
+ data->length);
}
}
}
resp_data = net_nfc_util_gdbus_data_to_variant(data);
net_nfc_gdbus_transceive_complete_transceive_data(
- transceive_data->transceive,
- transceive_data->invocation,
- (gint)result,
- resp_data);
+ transceive_data->transceive,
+ transceive_data->invocation,
+ (gint)result,
+ resp_data);
if (data)
{
}
static gboolean transceive_data_handle(NetNfcGDbusTransceive *transceive,
- GDBusMethodInvocation *invocation,
- guint handle,
- guint dev_type,
- GVariant *arg_data,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint handle,
+ guint dev_type,
+ GVariant *arg_data,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
TransceiveSendData *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->transceive_handle = handle;
data->transceive_info.dev_type = dev_type;
net_nfc_util_gdbus_variant_to_data_s(arg_data,
- &data->transceive_info.trans_data);
+ &data->transceive_info.trans_data);
result = net_nfc_server_controller_async_queue_push(
- transceive_data_thread_func, data);
+ transceive_data_thread_func, data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Transceive.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.Transceive.ThreadError",
+ "can not push to controller thread");
net_nfc_util_free_data(&data->transceive_info.trans_data);
DEBUG_MSG("call transceive");
if (net_nfc_controller_transceive(handle,
- &transceive_data->transceive_info,
- &data,
- &result) == true)
+ &transceive_data->transceive_info,
+ &data,
+ &result) == true)
{
if (data != NULL)
{
DEBUG_SERVER_MSG(
- "Transceive data received [%d]",
- data->length);
+ "Transceive data received [%d]",
+ data->length);
/* free resource because it doesn't need */
g_free(data->buffer);
DEBUG_SERVER_MSG("transceive result : %d", result);
net_nfc_gdbus_transceive_complete_transceive(
- transceive_data->transceive,
- transceive_data->invocation,
- (gint)result);
+ transceive_data->transceive,
+ transceive_data->invocation,
+ (gint)result);
net_nfc_util_free_data(&transceive_data->transceive_info.trans_data);
}
static gboolean transceive_handle(NetNfcGDbusTransceive *transceive,
- GDBusMethodInvocation *invocation,
- guint handle,
- guint dev_type,
- GVariant *arg_data,
- GVariant *smack_privilege,
- gpointer user_data)
+ GDBusMethodInvocation *invocation,
+ guint handle,
+ guint dev_type,
+ GVariant *arg_data,
+ GVariant *smack_privilege,
+ gpointer user_data)
{
TransceiveSendData *data;
gboolean result;
INFO_MSG(">>> REQUEST from [%s]",
- g_dbus_method_invocation_get_sender(invocation));
+ g_dbus_method_invocation_get_sender(invocation));
/* check privilege and update client context */
if (net_nfc_server_gdbus_check_privilege(invocation,
- smack_privilege,
- "nfc-manager",
- "rw") == false) {
+ smack_privilege,
+ "nfc-manager",
+ "rw") == false) {
DEBUG_ERR_MSG("permission denied, and finished request");
return FALSE;
{
DEBUG_ERR_MSG("Memory allocation failed");
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.AllocationError",
- "Can not allocate memory");
+ "org.tizen.NetNfcService.AllocationError",
+ "Can not allocate memory");
return FALSE;
}
data->transceive_handle = handle;
data->transceive_info.dev_type = dev_type;
net_nfc_util_gdbus_variant_to_data_s(arg_data,
- &data->transceive_info.trans_data);
+ &data->transceive_info.trans_data);
result = net_nfc_server_controller_async_queue_push(
- transceive_thread_func, data);
+ transceive_thread_func, data);
if (result == FALSE)
{
g_dbus_method_invocation_return_dbus_error(invocation,
- "org.tizen.NetNfcService.Transceive.ThreadError",
- "can not push to controller thread");
+ "org.tizen.NetNfcService.Transceive.ThreadError",
+ "can not push to controller thread");
net_nfc_util_free_data(&data->transceive_info.trans_data);
NULL);
result = g_dbus_interface_skeleton_export(
- G_DBUS_INTERFACE_SKELETON(transceive_skeleton),
- connection,
- "/org/tizen/NetNfcService/Transceive",
- &error);
+ G_DBUS_INTERFACE_SKELETON(transceive_skeleton),
+ connection,
+ "/org/tizen/NetNfcService/Transceive",
+ &error);
if (result == FALSE)
{
g_error_free(error);
/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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.
- */
-
-
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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.
+ */
+#define _GNU_SOURCE
+#include <string.h>
#include <dirent.h>
+#include <errno.h>
#include <pwd.h>
#include <grp.h>
#include <sys/stat.h>
-#include <time.h>
#include <sys/time.h>
+#include <time.h>
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#include <openssl/bio.h>
#include <openssl/buffer.h>
-#include "appsvc.h"
-#include "aul.h"
-#include "vconf.h"
-#include "Ecore_X.h"
+#include <vconf.h>
+#include <svi.h>
+#include <wav_player.h>
+#include <appsvc.h>
+#include <aul.h>
+#include <Ecore_X.h>
#include "net_nfc_typedef.h"
#include "net_nfc_typedef_internal.h"
#include "net_nfc_util_internal.h"
#include "net_nfc_util_ndef_message.h"
#include "net_nfc_util_ndef_record.h"
-#include "net_nfc_manager_util_internal.h"
-#include "net_nfc_app_util_internal.h"
-#include "net_nfc_server_context_internal.h"
+#include "net_nfc_server_context.h"
#include "net_nfc_server_se.h"
-//#include "syspopup_caller.h"
+#include "net_nfc_server_util.h"
+
+#define NET_NFC_MANAGER_SOUND_PATH_TASK_START "/usr/share/nfc-manager-daemon/sounds/Operation_sdk.wav"
+#define NET_NFC_MANAGER_SOUND_PATH_TASK_END "/usr/share/nfc-manager-daemon/sounds/Operation_sdk.wav"
+#define NET_NFC_MANAGER_SOUND_PATH_TASK_ERROR "/usr/share/nfc-manager-daemon/sounds/Operation_sdk.wav"
#define OSP_K_COND "__OSP_COND_NAME__"
#define OSP_K_COND_TYPE "nfc"
#define OSP_K_LAUNCH_TYPE "__OSP_LAUNCH_TYPE__"
-static bool _net_nfc_app_util_get_operation_from_record(ndef_record_s *record, char *operation, size_t length);
-static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s *record, char *mime, size_t length);
-#ifdef USE_FULL_URI
-static bool _net_nfc_app_util_get_uri_from_record(ndef_record_s *record, char *uri, size_t length);
-#endif
-static bool _net_nfc_app_util_get_data_from_record(ndef_record_s *record, char *data, size_t length);
-
static const char osp_launch_type_condition[] = "condition";
-net_nfc_error_e net_nfc_app_util_process_ndef(data_s *data)
-{
- net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
- ndef_message_s *msg = NULL;
- char operation[2048] = { 0, };
- char mime[2048] = { 0, };
- char text[2048] = { 0, };
-#ifdef USE_FULL_URI
- char uri[2048] = { 0, };
-#endif
- int ret = 0;
-
- if (data == NULL || data->buffer == NULL || data->length == 0)
- {
- DEBUG_ERR_MSG("net_nfc_app_util_process_ndef NET_NFC_NULL_PARAMETER");
- return NET_NFC_NULL_PARAMETER;
- }
-
- /* create file */
- if ((result = net_nfc_app_util_store_ndef_message(data)) != NET_NFC_OK)
- {
- DEBUG_ERR_MSG("net_nfc_app_util_store_ndef_message failed [%d]", result);
- return result;
- }
-
- /* check state of launch popup */
- if(net_nfc_app_util_check_launch_state() == TRUE)
- {
- DEBUG_SERVER_MSG("skip launch popup!!!");
- result = NET_NFC_OK;
- return result;
- }
-
- if (net_nfc_util_create_ndef_message(&msg) != NET_NFC_OK)
- {
- DEBUG_ERR_MSG("memory alloc fail..");
- return NET_NFC_ALLOC_FAIL;
- }
-
- /* parse ndef message and fill appsvc data */
- if ((result = net_nfc_util_convert_rawdata_to_ndef_message(data, msg)) != NET_NFC_OK)
- {
- DEBUG_ERR_MSG("net_nfc_app_util_store_ndef_message failed [%d]", result);
- goto ERROR;
- }
-
- if (_net_nfc_app_util_get_operation_from_record(msg->records, operation, sizeof(operation)) == FALSE)
- {
- DEBUG_ERR_MSG("_net_nfc_app_util_get_operation_from_record failed [%d]", result);
- result = NET_NFC_UNKNOWN_ERROR;
- goto ERROR;
- }
-
- if (_net_nfc_app_util_get_mime_from_record(msg->records, mime, sizeof(mime)) == FALSE)
- {
- DEBUG_ERR_MSG("_net_nfc_app_util_get_mime_from_record failed [%d]", result);
- result = NET_NFC_UNKNOWN_ERROR;
- goto ERROR;
- }
-#ifdef USE_FULL_URI
- if (_net_nfc_app_util_get_uri_from_record(msg->records, uri, sizeof(uri)) == FALSE)
- {
- DEBUG_ERR_MSG("_net_nfc_app_util_get_uri_from_record failed [%d]", result);
- result = NET_NFC_UNKNOWN_ERROR;
- goto ERROR;
- }
-#endif
- /* launch appsvc */
- if (_net_nfc_app_util_get_data_from_record(msg->records, text, sizeof(text)) == FALSE)
- {
- DEBUG_ERR_MSG("_net_nfc_app_util_get_data_from_record failed [%d]", result);
- result = NET_NFC_UNKNOWN_ERROR;
- goto ERROR;
- }
-
- ret = net_nfc_app_util_appsvc_launch(operation, uri, mime, text);
-#if 0
- if (ret == APPSVC_RET_ENOMATCH)
- {
- /* TODO : check again */
- ret = net_nfc_app_util_appsvc_launch(operation, uri, mime, text);
- }
-#endif
-
- DEBUG_SERVER_MSG("net_nfc_app_util_appsvc_launch return %d", ret);
-
- result = NET_NFC_OK;
-
-ERROR :
- net_nfc_util_free_ndef_message(msg);
-
- return result;
-}
-
-bool _net_nfc_app_util_change_file_owner_permission(FILE *file)
+static bool _net_nfc_app_util_change_file_owner_permission(FILE *file)
{
char *buffer = NULL;
size_t buffer_len = 0;
return true;
}
-net_nfc_error_e net_nfc_app_util_store_ndef_message(data_s *data)
+static net_nfc_error_e net_nfc_app_util_store_ndef_message(data_s *data)
{
net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
char file_name[1024] = { 0, };
/* check and make directory */
snprintf(file_name, sizeof(file_name), "%s/%s", NET_NFC_MANAGER_DATA_PATH,
- NET_NFC_MANAGER_DATA_PATH_MESSAGE);
+ NET_NFC_MANAGER_DATA_PATH_MESSAGE);
if (stat(file_name, &st) == -1)
{
/* create file */
snprintf(file_name, sizeof(file_name), "%s/%s/%s", NET_NFC_MANAGER_DATA_PATH,
- NET_NFC_MANAGER_DATA_PATH_MESSAGE, NET_NFC_MANAGER_NDEF_FILE_NAME);
+ NET_NFC_MANAGER_DATA_PATH_MESSAGE, NET_NFC_MANAGER_NDEF_FILE_NAME);
SECURE_LOGD("file path : %s", file_name);
unlink(file_name);
return result;
}
-bool net_nfc_app_util_is_dir(const char* path_name)
-{
- struct stat statbuf = { 0 };
-
- if (stat(path_name, &statbuf) == -1)
- {
- return false;
- }
-
- if (S_ISDIR(statbuf.st_mode) != 0)
- {
- return true;
- }
- else
- {
- return false;
- }
-}
-
-void net_nfc_app_util_clean_storage(char* src_path)
-{
- struct dirent* ent = NULL;
- DIR* dir = NULL;
-
- char path[1024] = { 0 };
-
- if ((dir = opendir(src_path)) == NULL)
- {
- return;
- }
-
- while ((ent = readdir(dir)) != NULL)
- {
- if (strncmp(ent->d_name, ".", 1) == 0 || strncmp(ent->d_name, "..", 2) == 0)
- {
- continue;
- }
- else
- {
- snprintf(path, 1024, "%s/%s", src_path, ent->d_name);
-
- if (net_nfc_app_util_is_dir(path) != false)
- {
- net_nfc_app_util_clean_storage(path);
- rmdir(path);
- }
- else
- {
- unlink(path);
- }
- }
- }
-
- closedir(dir);
-
- rmdir(src_path);
-}
-
-static void _to_lower_utf_8(char *str)
-{
- while (*str != 0)
- {
- if (*str >= 'A' && *str <= 'Z')
- *str += ('a' - 'A');
-
- str++;
- }
-}
-
-static void _to_lower(int type, char *str)
-{
- _to_lower_utf_8(str);
-}
-
static bool _net_nfc_app_util_get_operation_from_record(ndef_record_s *record, char *operation, size_t length)
{
bool result = false;
case NET_NFC_RECORD_MIME_TYPE :
op_text = "http://tizen.org/appcontrol/operation/nfc/mime";
- break;
+ break;
case NET_NFC_RECORD_URI : /* Absolute URI */
op_text = "http://tizen.org/appcontrol/operation/nfc/uri";
return result;
}
+static void _to_lower_utf_8(char *str)
+{
+ while (*str != 0)
+ {
+ if (*str >= 'A' && *str <= 'Z')
+ *str += ('a' - 'A');
+
+ str++;
+ }
+}
+
+static void _to_lower(int type, char *str)
+{
+ _to_lower_utf_8(str);
+}
+
static bool _net_nfc_app_util_get_mime_from_record(ndef_record_s *record, char *mime, size_t length)
{
bool result = false;
case NET_NFC_RECORD_WELL_KNOWN_TYPE :
{
if (record->type_s.buffer == NULL || record->type_s.length == 0 ||
- record->payload_s.buffer == NULL || record->payload_s.length == 0)
+ record->payload_s.buffer == NULL || record->payload_s.length == 0)
{
DEBUG_ERR_MSG("Broken NDEF Message [NET_NFC_RECORD_WELL_KNOWN_TYPE]");
break;
char *uri = NULL;
if (net_nfc_util_create_uri_string_from_uri_record(record, &uri) == NET_NFC_OK &&
- uri != NULL)
+ uri != NULL)
{
//DEBUG_SERVER_MSG("uri record : %s", uri);
snprintf(data, length, "%s", uri);
case NET_NFC_RECORD_WELL_KNOWN_TYPE :
{
if (record->type_s.buffer == NULL || record->type_s.length == 0
- || record->payload_s.buffer == NULL || record->payload_s.length == 0)
+ || record->payload_s.buffer == NULL || record->payload_s.length == 0)
{
DEBUG_ERR_MSG("Broken NDEF Message [NET_NFC_RECORD_WELL_KNOWN_TYPE]");
break;
return result;
}
+net_nfc_error_e net_nfc_app_util_process_ndef(data_s *data)
+{
+ net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR;
+ ndef_message_s *msg = NULL;
+ char operation[2048] = { 0, };
+ char mime[2048] = { 0, };
+ char text[2048] = { 0, };
+#ifdef USE_FULL_URI
+ char uri[2048] = { 0, };
+#endif
+ int ret = 0;
+
+ if (data == NULL || data->buffer == NULL || data->length == 0)
+ {
+ DEBUG_ERR_MSG("net_nfc_app_util_process_ndef NET_NFC_NULL_PARAMETER");
+ return NET_NFC_NULL_PARAMETER;
+ }
+
+ /* create file */
+ if ((result = net_nfc_app_util_store_ndef_message(data)) != NET_NFC_OK)
+ {
+ DEBUG_ERR_MSG("net_nfc_app_util_store_ndef_message failed [%d]", result);
+ return result;
+ }
+
+ /* check state of launch popup */
+ if(net_nfc_app_util_check_launch_state() == TRUE)
+ {
+ DEBUG_SERVER_MSG("skip launch popup!!!");
+ result = NET_NFC_OK;
+ return result;
+ }
+
+ if (net_nfc_util_create_ndef_message(&msg) != NET_NFC_OK)
+ {
+ DEBUG_ERR_MSG("memory alloc fail..");
+ return NET_NFC_ALLOC_FAIL;
+ }
+
+ /* parse ndef message and fill appsvc data */
+ if ((result = net_nfc_util_convert_rawdata_to_ndef_message(data, msg)) != NET_NFC_OK)
+ {
+ DEBUG_ERR_MSG("net_nfc_app_util_store_ndef_message failed [%d]", result);
+ goto ERROR;
+ }
+
+ if (_net_nfc_app_util_get_operation_from_record(msg->records, operation, sizeof(operation)) == FALSE)
+ {
+ DEBUG_ERR_MSG("_net_nfc_app_util_get_operation_from_record failed [%d]", result);
+ result = NET_NFC_UNKNOWN_ERROR;
+ goto ERROR;
+ }
+
+ if (_net_nfc_app_util_get_mime_from_record(msg->records, mime, sizeof(mime)) == FALSE)
+ {
+ DEBUG_ERR_MSG("_net_nfc_app_util_get_mime_from_record failed [%d]", result);
+ result = NET_NFC_UNKNOWN_ERROR;
+ goto ERROR;
+ }
+#ifdef USE_FULL_URI
+ if (_net_nfc_app_util_get_uri_from_record(msg->records, uri, sizeof(uri)) == FALSE)
+ {
+ DEBUG_ERR_MSG("_net_nfc_app_util_get_uri_from_record failed [%d]", result);
+ result = NET_NFC_UNKNOWN_ERROR;
+ goto ERROR;
+ }
+#endif
+ /* launch appsvc */
+ if (_net_nfc_app_util_get_data_from_record(msg->records, text, sizeof(text)) == FALSE)
+ {
+ DEBUG_ERR_MSG("_net_nfc_app_util_get_data_from_record failed [%d]", result);
+ result = NET_NFC_UNKNOWN_ERROR;
+ goto ERROR;
+ }
+
+ ret = net_nfc_app_util_appsvc_launch(operation, uri, mime, text);
+#if 0
+ if (ret == APPSVC_RET_ENOMATCH)
+ {
+ /* TODO : check again */
+ ret = net_nfc_app_util_appsvc_launch(operation, uri, mime, text);
+ }
+#endif
+
+ DEBUG_SERVER_MSG("net_nfc_app_util_appsvc_launch return %d", ret);
+
+ result = NET_NFC_OK;
+
+ERROR :
+ net_nfc_util_free_ndef_message(msg);
+
+ return result;
+}
+
+static bool net_nfc_app_util_is_dir(const char* path_name)
+{
+ struct stat statbuf = { 0 };
+
+ if (stat(path_name, &statbuf) == -1)
+ {
+ return false;
+ }
+
+ if (S_ISDIR(statbuf.st_mode) != 0)
+ {
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+void net_nfc_app_util_clean_storage(char* src_path)
+{
+ struct dirent* ent = NULL;
+ DIR* dir = NULL;
+
+ char path[1024] = { 0 };
+
+ if ((dir = opendir(src_path)) == NULL)
+ {
+ return;
+ }
+
+ while ((ent = readdir(dir)) != NULL)
+ {
+ if (strncmp(ent->d_name, ".", 1) == 0 || strncmp(ent->d_name, "..", 2) == 0)
+ {
+ continue;
+ }
+ else
+ {
+ snprintf(path, 1024, "%s/%s", src_path, ent->d_name);
+
+ if (net_nfc_app_util_is_dir(path) != false)
+ {
+ net_nfc_app_util_clean_storage(path);
+ rmdir(path);
+ }
+ else
+ {
+ unlink(path);
+ }
+ }
+ }
+
+ closedir(dir);
+
+ rmdir(src_path);
+}
+
void net_nfc_app_util_aul_launch_app(char* package_name, bundle* kb)
{
int result = 0;
{
DEBUG_SERVER_MSG("operation : %s", operation);
appsvc_set_operation(bd, operation);
- }
+ }
if (uri != NULL && strlen(uri) > 0)
{
return result;
}
+
+static void _play_sound_callback(int id, void *data)
+{
+ DEBUG_MSG("_play_sound_callback");
+
+ if (WAV_PLAYER_ERROR_NONE != wav_player_stop(id))
+ {
+ DEBUG_MSG("wav_player_stop failed");
+ }
+}
+
+void net_nfc_manager_util_play_sound(net_nfc_sound_type_e sound_type)
+{
+ int bSoundOn = 0;
+ int bVibrationOn = 0;
+
+ if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &bSoundOn) != 0)
+ {
+ DEBUG_MSG("vconf_get_bool failed for Sound");
+ return;
+ }
+
+ if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &bVibrationOn) != 0)
+ {
+ DEBUG_MSG("vconf_get_bool failed for Vibration");
+ return;
+ }
+
+ if ((sound_type > NET_NFC_TASK_ERROR) || (sound_type < NET_NFC_TASK_START))
+ {
+ DEBUG_MSG("Invalid Sound Type");
+ return;
+ }
+
+ if (bVibrationOn)
+ {
+ int svi_handle = -1;
+
+ DEBUG_MSG("Play Vibration");
+
+ if (SVI_SUCCESS == svi_init(&svi_handle))
+ {
+ if (SVI_SUCCESS == svi_play_vib(svi_handle, SVI_VIB_TOUCH_SIP))
+ {
+ DEBUG_MSG("svi_play_vib success");
+ }
+
+ svi_fini(svi_handle);
+ }
+ }
+
+ if (bSoundOn)
+ {
+ char *sound_path = NULL;
+
+ DEBUG_MSG("Play Sound");
+
+ switch (sound_type)
+ {
+ case NET_NFC_TASK_START :
+ sound_path = strdup(NET_NFC_MANAGER_SOUND_PATH_TASK_START);
+ break;
+ case NET_NFC_TASK_END :
+ sound_path = strdup(NET_NFC_MANAGER_SOUND_PATH_TASK_END);
+ break;
+ case NET_NFC_TASK_ERROR :
+ sound_path = strdup(NET_NFC_MANAGER_SOUND_PATH_TASK_ERROR);
+ break;
+ }
+
+ if (sound_path != NULL)
+ {
+ if (WAV_PLAYER_ERROR_NONE == wav_player_start(sound_path, SOUND_TYPE_MEDIA, _play_sound_callback, NULL, NULL))
+ {
+ DEBUG_MSG("wav_player_start success");
+ }
+
+ _net_nfc_util_free_mem(sound_path);
+ }
+ else
+ {
+ DEBUG_ERR_MSG("Invalid Sound Path");
+ }
+ }
+}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef __NET_NFC_APP_UTIL_INTERNAL_H__
-#define __NET_NFC_APP_UTIL_INTERNAL_H__
+#ifndef __NET_NFC_SERVER_UTIL_H__
+#define __NET_NFC_SERVER_UTIL_H__
#include <aul.h>
#include "net_nfc_typedef_internal.h"
#define MESSAGE_STORAGE "/opt/share/service/nfc-manager"
#endif
-net_nfc_error_e net_nfc_app_util_store_ndef_message(data_s *data);
+typedef enum
+{
+ NET_NFC_TASK_START = 0x00,
+ NET_NFC_TASK_END,
+ NET_NFC_TASK_ERROR
+} net_nfc_sound_type_e;
+
+void net_nfc_manager_util_play_sound(net_nfc_sound_type_e sound_type);
+
net_nfc_error_e net_nfc_app_util_process_ndef(data_s *data);
void net_nfc_app_util_aul_launch_app(char* package_name, bundle* kb);
void net_nfc_app_util_clean_storage(char* src_path);
-bool net_nfc_app_util_is_dir(const char* path_name);
int net_nfc_app_util_appsvc_launch(const char *operation, const char *uri, const char *mime, const char *data);
int net_nfc_app_util_launch_se_transaction_app(uint8_t *aid, uint32_t aid_len, uint8_t *param, uint32_t param_len);
int net_nfc_app_util_encode_base64(uint8_t *buffer, uint32_t buf_len, char *result, uint32_t max_result);
int net_nfc_app_util_decode_base64(const char *buffer, uint32_t buf_len, uint8_t *result, uint32_t *res_len);
bool net_nfc_app_util_check_launch_state();
-#endif //__NET_NFC_APP_UTIL_INTERNAL_H__
+#endif //__NET_NFC_SERVER_UTIL_H__
static void vconf_set_flight_mode(int boolval);
static void net_nfc_server_vconf_pm_state_changed(keynode_t *key,
- void *user_data);
+ void *user_data);
static void net_nfc_server_vconf_flight_mode_changed(keynode_t *key,
- void *user_data);
+ void *user_data);
static void vconf_set_flight_mode(int boolval)
}
static void net_nfc_server_vconf_pm_state_changed(keynode_t *key,
- void *user_data)
+ void *user_data)
{
gint state = 0;
gint pm_state = 0;
}
static void net_nfc_server_vconf_flight_mode_changed(keynode_t *key,
- void *user_data)
+ void *user_data)
{
gint flight_mode = 0;
gint nfc_state = 0;
if (result != 0)
{
DEBUG_ERR_MSG("Can not get %s",
- "VCONFKEY_NET_STATE");
+ "VCONFKEY_NET_STATE");
}
DEBUG_SERVER_MSG("nfc_state %d", nfc_state);
+++ /dev/null
-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
-
- * Modify the spec & net_nfc_set_state's return value
- * Git: slp/pkgs/n/nfc-manager
- * Tag: nfc-manager_0.0.1-64
-
- -- 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
-
+++ /dev/null
-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, libssl-dev, smartcard-service-dev, smartcard-service-common-dev, libslp-pm-dev
-Standards-Version: 0.0.1
-
-Package: libnfc-common-lib-0
-Section: libs
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: NFC Common Library
-
-Package: libnfc-common-lib-dev
-Section: libs
-Architecture: any
-Depends: ${misc:Depends}, libnfc-common-lib-0 (= ${Source-Version})
-Description: NFC Common Library
-
-Package: libnfc-common-lib-dbg
-Section: debug
-Architecture: any
-Depends: ${misc:Depends}, libnfc-common-lib-0 (= ${Source-Version})
-Description: NFC Common Library (unstripped)
-
-Package: libnfc-manager-0
-Section: libs
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libnfc-common-lib-0 (= ${Source-Version})
-Description: NFC freamework
-
-Package: libnfc-manager-dev
-Section: libs
-Architecture: any
-Depends: ${misc:Depends}, libnfc-manager-0 (= ${Source-Version})
-Description: NFC freamework
-
-Package: libnfc-manager-dbg
-Section: debug
-Architecture: any
-Depends: ${misc:Depends}, libnfc-manager-0 (= ${Source-Version})
-Description: NFC-manager (unstripped)
+++ /dev/null
-@PREFIX@/lib/libnfc-common-lib.so.*
+++ /dev/null
-#!/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
+++ /dev/null
-@PREFIX@/lib/pkgconfig/nfc-common-lib.pc
-@PREFIX@/include/nfc-common-lib/*
-@PREFIX@/lib/libnfc-common-lib.so
+++ /dev/null
-#!/bin/sh
-### BEGIN INIT INFO
-# Provides: nfc-agent
-# Required-Start:
-# Required-Stop:
-# Default-Start: 3 5
-# Default-Stop: 0
-# Short-Description: NFC agent
-# Description: NFC agent
-#
-#
-### END INIT INFO
-
-# Author: Wonkyu Kwon <wonkyu.kwon@samsung.com>
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-DAEMON=/usr/bin/nfc-manager-daemon
-DAEMON_ARGS="" # Arguments to run the daemon with
-
-# Exit if the package is not installed
-[ -x $DAEMON ] || exit 0
-
-$DAEMON $DAEMON_ARGS &
+++ /dev/null
-@PREFIX@/lib/libnfc.so.*
-@PREFIX@/bin/*
-/etc/init.d/*
-/etc/rc.d/*
-
+++ /dev/null
-#!/bin/sh
-#Add boot sequence script
-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
+++ /dev/null
-@PREFIX@/lib/pkgconfig/nfc.pc
-@PREFIX@/include/nfc/*
-@PREFIX@/lib/libnfc.so
+++ /dev/null
-#!/usr/bin/make -f
-# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-CFLAGS ?= -Wall -g
-CXXFLAGS ?= -Wall -g
-LDFLAGS ?=
-PREFIX ?= /usr
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
- CXXFLAGS += -O0
-else
- CFLAGS += -O2
- CXXFLAGS += -O2
-endif
-
-LDFLAGS += -Wl,--rpath=$(PREFIX)/lib -Wl,--as-needed
-
-CMAKE_TMP_DIR = $(CURDIR)/cmake_tmp
-
-
-configure: configure-stamp
-configure-stamp:
- dh_testdir
- # Add here commands to configure the package.
- mkdir -p $(CMAKE_TMP_DIR);
- cd $(CMAKE_TMP_DIR); CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" cmake .. -DCMAKE_INSTALL_PREFIX=$(PREFIX)
-
- touch configure-stamp
-
-build: build-stamp
-
-build-stamp: configure-stamp
- dh_testdir
-
- # Add here commands to compile the package.
- cd $(CMAKE_TMP_DIR) && $(MAKE)
- #docbook-to-man debian/wavplayer.sgml > wavplayer.1
-
- for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
- cat $$f > $${f%.in}; \
- sed -i -e "s#@PREFIX@#$(PREFIX)#g" $${f%.in}; \
- done
-
-
- touch $@
-
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp configure-stamp
-
- # Add here commands to clean up after the build process.
- -cd $(CMAKE_TMP_DIR) && $(MAKE) clean
- rm -rf $(CMAKE_TMP_DIR)
-
- rm -rf CMakeCache.txt
- rm -rf CMakeFiles
- rm -rf cmake_install.cmake
- rm -rf Makefile
- rm -rf install_manifest.txt
- rm -rf *.so
-
- for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
- rm -f $${f%.in}; \
- done
-
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- 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
-
- # Add here commands to install the package into debian/wavplayer.
- cd $(CMAKE_TMP_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
-
- mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/
- mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/
-
- ln -s /etc/init.d/libnfc-manager-0 $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S81libnfc-manager-0
- ln -s /etc/init.d/libnfc-manager-0 $(CURDIR)/debian/tmp/etc/rc.d/rc5.d/S81libnfc-manager-0
-
-# Build architecture-independent files here.
-binary-indep: build install
-# We have nothing to do by default.
-
-# Build architecture-dependent files here.
-binary-arch: build install
- dh_testdir
- dh_testroot
-# dh_installchangelogs
-# dh_installdocs
-# dh_installexamples
- dh_install --sourcedir=debian/tmp
-# dh_installmenu
-# dh_installdebconf
-# dh_installlogrotate
-# dh_installemacsen
-# dh_installpam
-# dh_installmime
-# dh_python
-# dh_installinit
-# dh_installcron
-# dh_installinfo
-# dh_installman
- dh_link
- dh_strip --dbg-package=libnfc-manager-dbg --dbg-package=libnfc-common-lib-dbg
- dh_compress
- dh_fixperms
-# dh_perl
- dh_makeshlibs
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-#INPUT = ..
-INPUT = ../src/commonlib/include/net_nfc_typedef.h ../src/clientlib/include/net_nfc_target_info.h ../src/clientlib/include/net_nfc_llcp.h ../src/clientlib/include/net_nfc_exchanger.h ../src/clientlib/include/net_nfc_ndef_message.h ../src/clientlib/include/net_nfc_data.h ../src/clientlib/include/net_nfc_ndef_record.h ../src/clientlib/include/net_nfc_apdu.h ../src/clientlib/include/net_nfc_tag.h ../src/clientlib/include/net_nfc.h ../src/clientlib/include/net_nfc_ndef_message_handover.h ../src/clientlib/include/net_nfc_tag_felica.h ../src/clientlib/include/net_nfc_tag_jewel.h ../src/clientlib/include/net_nfc_tag_mifare.h
+INPUT = ../common/include/ ../client/include/
# This tag can be used to specify the character encoding of the source files that
+++ /dev/null
-#!/bin/sh
-### BEGIN INIT INFO
-# Provides: nfc-manager-daemon
-# Required-Start:
-# Required-Stop:
-# Default-Start: 3 5
-# Default-Stop: 0
-# Short-Description: NFC manager
-# Description: NFC manager
-#
-#
-### END INIT INFO
-
-# Author: Wonkyu Kwon <wonkyu.kwon@samsung.com>
-
-# PATH should only include /usr/* if it runs after the mountnfs.sh script
-DAEMON=/usr/bin/nfc-manager-daemon
-DAEMON_ARGS="--daemon" # Arguments to run the daemon with
-VCONFTOOL=/usr/bin/vconftool
-
-# Exit if the package is not installed
-[ -x $DAEMON ] || exit 0
-[ -x $VCONFTOOL ] || exit 0
-
-#if vconftool get db/nfc/enable | grep -q "db/nfc/enable, value = 1 (bool)"
-#then
- if ! ps -f --ppid 1 | grep -q nfc-manager-daemon
- then
- $DAEMON $DAEMON_ARGS &
- fi
-#fi
Summary: NFC framework manager
Version: 0.1.0
Release: 0
-Group: libs
+Group: Network & Connectivity/NFC
License: Flora Software License
Source0: %{name}-%{version}.tar.gz
-Source1: libnfc-manager-0.init.in
-Source2: nfc-manager.service
+Source1: %{name}.service
Source1001: %{name}.manifest
BuildRequires: cmake
BuildRequires: pkgconfig(aul)
%description
-NFC library Manager.
+Tizen NFC framework manager.
%prep
%package -n nfc-common-lib
Summary: NFC common library
-Group: Development/Libraries
+Group: Network & Connectivity/Development
%description -n nfc-common-lib
%package -n nfc-common-lib-devel
Summary: NFC common library (devel)
-Group: libs
+Group: Network & Connectivity/Development
Requires: nfc-common-lib = %{version}
%description -n nfc-common-lib-devel
-NFC common library (devel)
+NFC manager common library for internal development.
%package -n nfc-client-lib
Summary: NFC client library
-Group: Development/Libraries
+Group: Network & Connectivity/NFC
Requires: nfc-common-lib = %{version}
%description -n nfc-client-lib
-NFC Client library.
+NFC manager Client library for NFC client applications.
%package -n nfc-client-lib-devel
Summary: NFC client library (devel)
-Group: libs
+Group: Network & Connectivity/Development
Requires: nfc-client-lib = %{version}
%description -n nfc-client-lib-devel
-NFC client library (devel)
+NFC manager Client library for developing NFC client applications.
-#%package -n nfc-client-test
+
+#%%package -n nfc-client-test
#Summary: NFC client test
-#Group: Development/Libraries
-#Requires: %{name} = %{version}-%{release}
+#Group: Network & Connectivity/NFC
+#Requires: %%{name} = %%{version}
-#%description -n nfc-client-test
+#%%description -n nfc-client-test
#NFC client test (devel)
%build
-export LDFLAGS+="-Wl,--rpath=%{_prefix}/lib -Wl,--as-needed"
-LDFLAGS="$LDFLAGS" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
+%cmake . -DMAJORVER=${MAJORVER} -DFULLVER=%{version}
%install
%make_install
-install -D -m 0755 %SOURCE1 %{buildroot}%{_sysconfdir}/init.d/libnfc-manager-0
mkdir -p %{buildroot}/opt/usr/share/nfc_debug
mkdir -p %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants
-cp -af %{SOURCE2} %{buildroot}%{_libdir}/systemd/system/
+cp -af %{SOURCE1} %{buildroot}%{_libdir}/systemd/system/
ln -s ../%{name}.service %{buildroot}%{_libdir}/systemd/system/multi-user.target.wants/%{name}.service
%post
/sbin/ldconfig
-#ln -s /etc/init.d/libnfc-manager-0 /etc/rc.d/rc3.d/S81libnfc-manager-0 -f
-#ln -s /etc/init.d/libnfc-manager-0 /etc/rc.d/rc5.d/S81libnfc-manager-0 -f
-
systemctl daemon-reload
if [ $1 == 1 ]; then
systemctl restart %{name}.service
fi
+%post -n nfc-common-lib -p /sbin/ldconfig
%post -n nfc-client-lib
/sbin/ldconfig
%postun
/sbin/ldconfig
-#mkdir -p /etc/rc.d/rc3.d
-#mkdir -p /etc/rc.d/rc5.d
-#rm -f /etc/rc.d/rc3.d/S81libnfc-manager-0
-#rm -f /etc/rc.d/rc5.d/S81libnfc-manager-0
-
if [ $1 == 0 ]; then
systemctl stop %{name}.service
fi
systemctl daemon-reload
-
-%post -n nfc-common-lib -p /sbin/ldconfig
-
-
%postun -n nfc-common-lib -p /sbin/ldconfig
+%postun -n nfc-client-lib -p /sbin/ldconfig
+
%files
%manifest %{name}.manifest
%defattr(-,root,root,-)
%{_bindir}/nfc-manager-daemon
-#%{_bindir}/ndef-tool
+#%%{_bindir}/ndef-tool
%{_libdir}/systemd/system/%{name}.service
%{_libdir}/systemd/system/multi-user.target.wants/%{name}.service
-%{_sysconfdir}/init.d/libnfc-manager-0
%{_datadir}/dbus-1/services/org.tizen.NetNfcService.service
%{_datadir}/packages/%{name}.xml
%{_datadir}/nfc-manager-daemon/sounds/*
%files -n nfc-client-lib-devel
-%manifest %{name}.manifest
%defattr(-,root,root,-)
%{_libdir}/libnfc.so
%{_libdir}/pkgconfig/nfc.pc
%files -n nfc-common-lib
%manifest %{name}.manifest
%defattr(-,root,root,-)
-%{_libdir}/libnfc-common-lib.so.*
-%{_datadir}/nfc-manager-daemon/sounds/*
+%{_libdir}/libnfc-common.so.*
%license LICENSE.Flora
%files -n nfc-common-lib-devel
-%manifest %{name}.manifest
%defattr(-,root,root,-)
-%{_libdir}/libnfc-common-lib.so
-%{_libdir}/pkgconfig/nfc-common-lib.pc
-%{_includedir}/nfc-common-lib/*.h
+%{_libdir}/libnfc-common.so
+%{_libdir}/pkgconfig/nfc-common.pc
+%{_includedir}/nfc-common/*.h
-#%files -n nfc-client-test
-#%manifest nfc-client-test.manifest
-#%defattr(-,root,root,-)
-#%{_bindir}/nfc_client
-#%license LICENSE.Flora
+#%%files -n nfc-client-test
+#%%manifest nfc-client-test.manifest
+#%%defattr(-,root,root,-)
+#%%{_bindir}/nfc_client
+#%%license LICENSE.Flora
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(nfc-client-lib C)
-
-#SET(NFC_CLIENT_LIB "nfc-client-lib")
-SET(NFC_CLIENT_LIB "nfc")
-SET(VERSION_MAJOR 1)
-SET(VERSION ${VERSION_MAJOR}.0.0)
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-include_directories(${CMAKE_SOURCE_DIR}/src/commonlib)
-include_directories(${CMAKE_SOURCE_DIR}/src/commonlib/include)
-include_directories(${CMAKE_SOURCE_DIR}/src/manager/include)
-
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} CLIENT_SRCS)
-
-IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
- SET(CMAKE_BUILD_TYPE "Release")
-ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(clientlib_pkges REQUIRED security-server dlog ecore-x vconf)
-
-FOREACH(flag ${clientlib_pkges_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-MESSAGE("CHECK MODULE in MANAGER ${clientlib_pkges_LDFLAGS}")
-
-# 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 -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}\"")
-
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
-
-ADD_LIBRARY(${NFC_CLIENT_LIB} SHARED ${CLIENT_SRCS})
-SET_TARGET_PROPERTIES(${NFC_CLIENT_LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
-SET_TARGET_PROPERTIES(${NFC_CLIENT_LIB} PROPERTIES VERSION ${VERSION})
-TARGET_LINK_LIBRARIES(${NFC_CLIENT_LIB} ${clientlib_pkges_LDFLAGS} nfc-common-lib)
-
-LINK_DIRECTORIES(${CMAKE_BUILD_DIR}/src/commonlib)
-
-
-SET(CLIENT_HEADER
- ${CMAKE_SOURCE_DIR}/src/commonlib/include/net_nfc_typedef.h
- include/net_nfc.h
- include/net_nfc_data.h
- include/net_nfc_target_info.h
- include/net_nfc_ndef_message.h
- include/net_nfc_ndef_record.h
- include/net_nfc_sign_record.h
- include/net_nfc_ndef_message_handover.h
- include/net_nfc_client_context.h
- include/net_nfc_client_manager.h
- include/net_nfc_client_system_handler.h
- include/net_nfc_client_transceive.h
- include/net_nfc_client_tag.h
- include/net_nfc_client_ndef.h
- include/net_nfc_client_llcp.h
- include/net_nfc_client_p2p.h
- include/net_nfc_client_snep.h
- include/net_nfc_client_exchanger.h
- include/net_nfc_client_handover.h
- include/net_nfc_client_se.h
- include/net_nfc_client_tag_felica.h
- include/net_nfc_client_tag_jewel.h
- include/net_nfc_tag_mifare.h
- include/net_nfc_client_test.h
-)
-
-CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/nfc.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/nfc.pc)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/nfc.pc DESTINATION lib/pkgconfig)
-
-INSTALL(TARGETS ${NFC_CLIENT_LIB} DESTINATION lib)
-
-FOREACH(hfile ${CLIENT_HEADER})
- INSTALL(FILES ${hfile} DESTINATION include/nfc)
-ENDFOREACH(hfile)
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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 "net_nfc_ndef_message_handover.h"
-
-#include "net_nfc_typedef_internal.h"
-#include "net_nfc_debug_internal.h"
-#include "net_nfc_util_internal.h"
-#include "net_nfc_util_handover.h"
-
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
-#include <glib.h>
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_carrier_config (net_nfc_carrier_config_h * config, net_nfc_conn_handover_carrier_type_e type)
-{
- return net_nfc_util_create_carrier_config ((net_nfc_carrier_config_s **) config, type);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_add_carrier_config_property (net_nfc_carrier_config_h config, uint16_t attribute, uint16_t size, uint8_t * data)
-{
- return net_nfc_util_add_carrier_config_property ((net_nfc_carrier_config_s *) config, attribute, size, data);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_remove_carrier_config_property (net_nfc_carrier_config_h config, uint16_t attribute)
-{
- return net_nfc_util_remove_carrier_config_property ((net_nfc_carrier_config_s *) config, attribute);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_carrier_config_property (net_nfc_carrier_config_h config, uint16_t attribute, uint16_t * size, uint8_t ** data)
-{
- return net_nfc_util_get_carrier_config_property ((net_nfc_carrier_config_s *) config, attribute, size, data);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_append_carrier_config_group (net_nfc_carrier_config_h config, net_nfc_property_group_h group)
-{
- return net_nfc_util_append_carrier_config_group ((net_nfc_carrier_config_s *) config, (net_nfc_carrier_property_s *) group);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_remove_carrier_config_group (net_nfc_carrier_config_h config, net_nfc_property_group_h group)
-{
- return net_nfc_util_remove_carrier_config_group ((net_nfc_carrier_config_s *) config, (net_nfc_carrier_property_s *) group);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_carrier_config_group (net_nfc_carrier_config_h config, int index, net_nfc_property_group_h * group)
-{
- return net_nfc_util_get_carrier_config_group ((net_nfc_carrier_config_s *) config, index, (net_nfc_carrier_property_s **) group);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_free_carrier_config (net_nfc_carrier_config_h config)
-{
- return net_nfc_util_free_carrier_config ((net_nfc_carrier_config_s *) config);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_carrier_config_group (net_nfc_property_group_h * group, uint16_t attribute)
-{
- return net_nfc_util_create_carrier_config_group ((net_nfc_carrier_property_s **) group, attribute);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_add_carrier_config_group_property (net_nfc_property_group_h group, uint16_t attribute, uint16_t size, uint8_t * data)
-{
- return net_nfc_util_add_carrier_config_group_property ((net_nfc_carrier_property_s*) group, attribute, size, data);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_carrier_config_group_property (net_nfc_property_group_h group, uint16_t attribute, uint16_t *size, uint8_t ** data)
-{
- return net_nfc_util_get_carrier_config_group_property ((net_nfc_carrier_property_s*) group, attribute, size, data);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_remove_carrier_config_group_property (net_nfc_property_group_h group, uint16_t attribute)
-{
- return net_nfc_util_remove_carrier_config_group_property ((net_nfc_carrier_property_s*) group, attribute);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_free_carrier_group (net_nfc_property_group_h group)
-{
- return net_nfc_util_free_carrier_group ((net_nfc_carrier_property_s*) group);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_ndef_record_with_carrier_config (ndef_record_h * record, net_nfc_carrier_config_h config)
-{
- return net_nfc_util_create_ndef_record_with_carrier_config ((ndef_record_s**) record, (net_nfc_carrier_config_s *) config);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_carrier_config_from_config_record (net_nfc_carrier_config_h * config, ndef_record_h record)
-{
- return net_nfc_util_create_carrier_config_from_config_record ((net_nfc_carrier_config_s **) config, (ndef_record_s *) record);
-
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_append_carrier_config_record (ndef_message_h message, ndef_record_h record, net_nfc_conn_handover_carrier_state_e power_status)
-{
- return net_nfc_util_append_carrier_config_record ((ndef_message_s *) message, (ndef_record_s *) record, power_status);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_remove_carrier_config_record (ndef_message_h message, ndef_record_h record)
-{
- return net_nfc_util_remove_carrier_config_record ((ndef_message_s *) message, (ndef_record_s *) record);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_carrier_config_record (ndef_message_h message, int index, ndef_record_h * record)
-{
- return net_nfc_util_get_carrier_config_record ((ndef_message_s *) message, index, (ndef_record_s **) record);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_handover_random_number(ndef_message_h message, unsigned short* random_number)
-{
- return net_nfc_util_get_handover_random_number((ndef_message_s *) message, random_number);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_alternative_carrier_record_count (ndef_message_h message, unsigned int * count)
-{
- return net_nfc_util_get_alternative_carrier_record_count ((ndef_message_s *) message, count);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_alternative_carrier_power_status (ndef_message_h message, int index, net_nfc_conn_handover_carrier_state_e * power_state)
-{
- return net_nfc_util_get_alternative_carrier_power_status ((ndef_message_s *) message, index, power_state);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_set_alternative_carrier_power_status (ndef_message_h message, int index, net_nfc_conn_handover_carrier_state_e power_status)
-{
- return net_nfc_util_set_alternative_carrier_power_status ((ndef_message_s *) message, index, power_status);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_get_alternative_carrier_type (ndef_message_h message, int index, net_nfc_conn_handover_carrier_type_e * type)
-{
- return net_nfc_util_get_alternative_carrier_type ((ndef_message_s *) message, index, type);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_handover_request_message (ndef_message_h * message)
-{
- return net_nfc_util_create_handover_request_message ((ndef_message_s **) message);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_handover_select_message (ndef_message_h * message)
-{
- return net_nfc_util_create_handover_select_message((ndef_message_s **) message);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_create_handover_error_record (ndef_record_h * record, uint8_t reason, uint32_t data)
-{
- return net_nfc_util_create_handover_error_record ((ndef_record_s**) record, reason, data);
-}
-
-
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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 "net_nfc_util_sign_record.h"
-
-#ifndef NET_NFC_EXPORT_API
-#define NET_NFC_EXPORT_API __attribute__((visibility("default")))
-#endif
-
-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)
-{
- return net_nfc_util_sign_records((ndef_message_s *)msg, begin_index, end_index, cert_file, password);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_sign_ndef_message(ndef_message_h msg, char *cert_file, char *password)
-{
- return net_nfc_util_sign_ndef_message((ndef_message_s *)msg, cert_file, password);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_verify_signature_ndef_message(ndef_message_h msg)
-{
- return net_nfc_util_verify_signature_ndef_message((ndef_message_s *)msg);
-}
-
-NET_NFC_EXPORT_API net_nfc_error_e net_nfc_verify_signature_records(ndef_record_h begin_record, ndef_record_h sign_record)
-{
- return net_nfc_util_verify_signature_records((ndef_record_s *)begin_record, (ndef_record_s *)sign_record);
-}
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.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 <string.h>
-
-#include "net_nfc_client_util_internal.h"
-
+++ /dev/null
-prefix=/usr
-exec_prefix=${prefix}/bin
-libdir=@LIB_INSTALL_DIR@
-includedir=${prefix}/include
-
-Name: nfc
-Description: NFC
-Version: $version
-Requires:
-Libs: -lnfc
-Cflags: -I/usr/include/nfc
\ No newline at end of file
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(nfc-common-lib C)
-
-SET(NFC_COMMON_LIB "nfc-common-lib")
-SET(VERSION_MAJOR 1)
-SET(VERSION ${VERSION_MAJOR}.0.0)
-
-FIND_PROGRAM(GDBUS_CODEGEN NAMES gdbus-codegen)
-EXEC_PROGRAM(${GDBUS_CODEGEN} ARGS
- " \\
- --generate-c-code ${CMAKE_CURRENT_SOURCE_DIR}/net_nfc_gdbus \\
- --c-namespace NetNfcGDbus\\
- --interface-prefix org.tizen.NetNfcService. \\
- ${CMAKE_CURRENT_SOURCE_DIR}/net_nfc.xml \\
- ")
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} COMMON_LIB_SRCS)
-
-IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
- SET(CMAKE_BUILD_TYPE "Release")
-ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(commonlib_pkges REQUIRED
- glib-2.0 gio-2.0 gio-unix-2.0 dlog bluetooth-api libssl)
-
-FOREACH(flag ${commonlib_pkges_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-MESSAGE("CHECK MODULE in COMMON_LIB ${commonlib_pkges_LDFLAGS}")
-
-# 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")
-
-SET(ARM_CFLAGS "${ARM_CLAGS} -mapcs -mno-sched-prolog -mabi=aapcs-linux -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_LIBRARY(${NFC_COMMON_LIB} SHARED ${COMMON_LIB_SRCS})
-SET_TARGET_PROPERTIES(${NFC_COMMON_LIB} PROPERTIES SOVERSION ${VERSION_MAJOR})
-SET_TARGET_PROPERTIES(${NFC_COMMON_LIB} PROPERTIES VERSION ${VERSION})
-
-TARGET_LINK_LIBRARIES(${NFC_COMMON_LIB} ${commonlib_pkges_LDFLAGS})
-
-SET(COMMON_LIB_HEADER
- include/net_nfc_typedef.h
- include/net_nfc_util_internal.h
- include/net_nfc_oem_controller.h
- include/net_nfc_typedef_internal.h
- 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)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${NFC_COMMON_LIB}.pc DESTINATION lib/pkgconfig)
-INSTALL(TARGETS ${NFC_COMMON_LIB} DESTINATION lib)
-
-FOREACH(hfile ${COMMON_LIB_HEADER})
- INSTALL(FILES ${hfile} DESTINATION include/nfc-common-lib)
-ENDFOREACH(hfile)
-
+++ /dev/null
-# Package Information for pkg-config
-
-prefix=/usr
-exec_prefix=/usr/bin
-libdir=/usr/lib
-includedir=/usr/include/nfc-common-lib
-
-Name: nfc-common-lib
-Description: NFC Common Library
-Version: 1.0
-Requires:
-Libs: -L/usr/lib -lnfc-common-lib
-Cflags: -I/usr/include/nfc-common-lib
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-#PROJECT(nfc C)
-PROJECT(nfc-manager-daemon C)
-
-SET(NFC_MANAGER_DAEMON "nfc-manager-daemon")
-
-include_directories(${CMAKE_SOURCE_DIR}/src/commonlib/)
-include_directories(${CMAKE_SOURCE_DIR}/src/commonlib/include)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-
-AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/ MANAGER_SRCS)
-
-IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
- SET(CMAKE_BUILD_TYPE "Release")
-ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(manager_pkges REQUIRED aul glib-2.0 gio-unix-2.0 security-server vconf dlog tapi appsvc libcurl bluetooth-api libssl svi capi-media-wav-player pkgmgr pkgmgr-info capi-network-wifi ecore-x pmapi)
-FOREACH(flag ${manager_pkges_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-MESSAGE("CHECK MODULE in MANAGER ${manager_pkges_LDFLAGS}")
-
-# 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 -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=\"${PREFIX}\"")
-ADD_DEFINITIONS("-DNFC_MANAGER_MODULEDIR=\"${MODULEDIR}\"")
-
-ADD_DEFINITIONS("-DUSE_FULL_URI")
-#ADD_DEFINITIONS("-DESE_ALWAYS_ON")
-
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
-
-ADD_EXECUTABLE(${NFC_MANAGER_DAEMON} ${MANAGER_SRCS})
-
-TARGET_LINK_LIBRARIES(${NFC_MANAGER_DAEMON} ${manager_pkges_LDFLAGS} pthread dl rt nfc-common-lib nfc)
-LINK_DIRECTORIES(${CMAKE_BUILD_DIR}/src/commonlib ${CMAKE_BUILD_DIR}/src/clientlib)
-INSTALL(TARGETS ${NFC_MANAGER_DAEMON} DESTINATION bin)
-
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/org.tizen.NetNfcService.service DESTINATION share/dbus-1/services)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/nfc-manager.xml DESTINATION share/packages)
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/sounds DESTINATION share/nfc-manager-daemon)
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.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_MANAGER_H__
-#define __NET_NFC_MANAGER_H__
-
-void net_nfc_manager_quit();
-
-#endif //__NET_NFC_MANAGER_H__
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.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_MANAGER_UTIL_INTERNAL_H__
-#define __NET_NFC_MANAGER_UTIL_INTERNAL_H__
-
-#define NET_NFC_MANAGER_DATA_PATH "/opt/data/nfc-manager-daemon"
-#define NET_NFC_MANAGER_DATA_PATH_MESSAGE "message"
-#define NET_NFC_MANAGER_DATA_PATH_CONFIG "config"
-#define NET_NFC_MANAGER_NDEF_FILE_NAME "ndef-message.txt"
-#define NET_NFC_MANAGER_LLCP_CONFIG_FILE_NAME "nfc-manager-config.txt"
-
-#define NET_NFC_MANAGER_SOUND_PATH_TASK_START "/usr/share/nfc-manager-daemon/sounds/Operation_sdk.wav"
-#define NET_NFC_MANAGER_SOUND_PATH_TASK_END "/usr/share/nfc-manager-daemon/sounds/Operation_sdk.wav"
-#define NET_NFC_MANAGER_SOUND_PATH_TASK_ERROR "/usr/share/nfc-manager-daemon/sounds/Operation_sdk.wav"
-
-#define BUFFER_LENGTH_MAX 1024
-
-#define READ_BUFFER_LENGTH_MAX BUFFER_LENGTH_MAX
-#define WRITE_BUFFER_LENGTH_MAX BUFFER_LENGTH_MAX
-#define NET_NFC_MAX_LLCP_SOCKET_BUFFER BUFFER_LENGTH_MAX
-
-typedef enum
-{
- NET_NFC_TASK_START = 0x00,
- NET_NFC_TASK_END,
- NET_NFC_TASK_ERROR
-} net_nfc_sound_type_e;
-
-void net_nfc_manager_util_play_sound(net_nfc_sound_type_e sound_type);
-
-#endif //__NET_NFC_MANAGER_UTIL_INTERNAL_H__
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.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 <unistd.h>
-#include <glib.h>
-#include <pthread.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-bindings.h>
-#include <gio/gio.h>
-#include <sys/utsname.h>
-
-#include <vconf.h>
-
-#include "net_nfc_server_common.h"
-#include "net_nfc_server_vconf.h"
-#include "net_nfc_server_manager.h"
-#include "net_nfc_server_se.h"
-#include "net_nfc_server_tag.h"
-#include "net_nfc_debug_internal.h"
-#include "net_nfc_typedef_internal.h"
-#include "net_nfc_app_util_internal.h"
-#include "net_nfc_controller_internal.h"
-#include "net_nfc_util_internal.h"
-#include "net_nfc_util_defines.h"
-#include "net_nfc_manager.h"
-#include "net_nfc_server.h"
-
-static gboolean use_daemon = FALSE;
-
-GOptionEntry option_entries[] = {
- { "daemon", 'd', 0, G_OPTION_ARG_NONE, &use_daemon,
- "Use Daemon mode", NULL },
- { NULL }
-};
-
-static GMainLoop *loop = NULL;
-
-void net_nfc_manager_quit()
-{
- DEBUG_MSG("net_nfc_manager_quit kill the nfc-manager daemon!!");
- if (loop != NULL) {
- g_main_loop_quit(loop);
- }
-}
-
-static void on_bus_acquired(GDBusConnection *connection,
- const gchar *path,
- gpointer user_data)
-{
- gint state;
-
- DEBUG_MSG("bus path : %s", path);
-
- net_nfc_server_gdbus_init();
-
- net_nfc_server_controller_init();
-
- if (vconf_get_bool(VCONFKEY_NFC_STATE, &state) != 0)
- {
- DEBUG_MSG("VCONFKEY_NFC_STATE is not exist");
- net_nfc_manager_quit();
-
- return;
- }
-
- net_nfc_server_vconf_init();
-
- if (state == 1)
- net_nfc_server_manager_set_active(TRUE);
-#ifndef ESE_ALWAYS_ON
- else if (use_daemon == TRUE)
- net_nfc_server_controller_deinit();
-#endif
-}
-
-static void on_name_acquired(GDBusConnection *connection,
- const gchar *name,
- gpointer user_data)
-{
- DEBUG_SERVER_MSG("name : %s", name);
-}
-
-static void on_name_lost(GDBusConnection *connnection,
- const gchar *name,
- gpointer user_data)
-{
- DEBUG_SERVER_MSG("name : %s", name);
-
- net_nfc_manager_quit();
-}
-
-
-int main(int argc, char *argv[])
-{
-
- void *handle = NULL;
- guint id = 0;
- gboolean use_daemon = FALSE;
-
- GOptionContext *option_context;
- GError *error = NULL;
-
- if (!g_thread_supported())
- {
- g_thread_init(NULL);
- }
-
- g_type_init();
-
- option_context = g_option_context_new("Nfc manager");
- g_option_context_add_main_entries(option_context,
- option_entries,
- NULL);
-
- if (g_option_context_parse(option_context,
- &argc,
- &argv,
- &error) == FALSE)
- {
- DEBUG_ERR_MSG("can not parse option: %s",
- error->message);
- g_error_free(error);
-
- g_option_context_free(option_context);
- return 0;
- }
-
- DEBUG_SERVER_MSG("start nfc manager");
- DEBUG_SERVER_MSG("use_daemon : %d", use_daemon);
-
- net_nfc_manager_init_log();
-
- net_nfc_app_util_clean_storage(MESSAGE_STORAGE);
-
- handle = net_nfc_controller_onload();
- if (handle == NULL)
- {
- DEBUG_ERR_MSG("load plugin library is failed");
-
- if (vconf_set_bool(VCONFKEY_NFC_FEATURE,
- VCONFKEY_NFC_FEATURE_OFF) != 0)
- {
- DEBUG_ERR_MSG("VCONFKEY_NFC_FEATURE set to %d failed",
- VCONFKEY_NFC_FEATURE_OFF);
- }
-
- if (vconf_set_bool(VCONFKEY_NFC_STATE, 0) != 0)
- {
- DEBUG_ERR_MSG("VCONFKEY_NFC_STATE set to %d failed",
- 0);
- }
-
- goto EXIT;
- }
-
- if (vconf_set_bool(VCONFKEY_NFC_FEATURE, VCONFKEY_NFC_FEATURE_ON) != 0)
- {
- DEBUG_ERR_MSG("VCONFKEY_NFC_FEATURE set to %d failed",
- VCONFKEY_NFC_FEATURE_ON);
- }
-
- id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
- "org.tizen.NetNfcService",
- G_BUS_NAME_OWNER_FLAGS_NONE,
- on_bus_acquired,
- on_name_acquired,
- on_name_lost,
- NULL,
- NULL);
-
- loop = g_main_loop_new(NULL, FALSE);
- g_main_loop_run(loop);
-
-EXIT :
- net_nfc_server_vconf_deinit();
- net_nfc_server_controller_deinit();
- net_nfc_server_gdbus_deinit();
-
- if (id)
- {
- g_bus_unown_name(id);
- }
-
- net_nfc_controller_unload(handle);
-
- net_nfc_manager_fini_log();
-
- g_option_context_free(option_context);
-
- return 0;
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.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 <string.h>
-
-#include "vconf.h"
-#include "svi.h"
-#include "wav_player.h"
-
-#include "net_nfc_debug_internal.h"
-#include "net_nfc_util_internal.h"
-#include "net_nfc_manager_util_internal.h"
-
-static void _play_sound_callback(int id, void *data)
-{
- DEBUG_MSG("_play_sound_callback");
-
- if (WAV_PLAYER_ERROR_NONE != wav_player_stop(id))
- {
- DEBUG_MSG("wav_player_stop failed");
- }
-}
-
-void net_nfc_manager_util_play_sound(net_nfc_sound_type_e sound_type)
-{
- int bSoundOn = 0;
- int bVibrationOn = 0;
-
- if (vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &bSoundOn) != 0)
- {
- DEBUG_MSG("vconf_get_bool failed for Sound");
- return;
- }
-
- if (vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &bVibrationOn) != 0)
- {
- DEBUG_MSG("vconf_get_bool failed for Vibration");
- return;
- }
-
- if ((sound_type > NET_NFC_TASK_ERROR) || (sound_type < NET_NFC_TASK_START))
- {
- DEBUG_MSG("Invalid Sound Type");
- return;
- }
-
- if (bVibrationOn)
- {
- int svi_handle = -1;
-
- DEBUG_MSG("Play Vibration");
-
- if (SVI_SUCCESS == svi_init(&svi_handle))
- {
- if (SVI_SUCCESS == svi_play_vib(svi_handle, SVI_VIB_TOUCH_SIP))
- {
- DEBUG_MSG("svi_play_vib success");
- }
-
- svi_fini(svi_handle);
- }
- }
-
- if (bSoundOn)
- {
- char *sound_path = NULL;
-
- DEBUG_MSG("Play Sound");
-
- switch (sound_type)
- {
- case NET_NFC_TASK_START :
- sound_path = strdup(NET_NFC_MANAGER_SOUND_PATH_TASK_START);
- break;
- case NET_NFC_TASK_END :
- sound_path = strdup(NET_NFC_MANAGER_SOUND_PATH_TASK_END);
- break;
- case NET_NFC_TASK_ERROR :
- sound_path = strdup(NET_NFC_MANAGER_SOUND_PATH_TASK_ERROR);
- break;
- }
-
- if (sound_path != NULL)
- {
- if (WAV_PLAYER_ERROR_NONE == wav_player_start(sound_path, SOUND_TYPE_MEDIA, _play_sound_callback, NULL, NULL))
- {
- DEBUG_MSG("wav_player_start success");
- }
-
- _net_nfc_util_free_mem(sound_path);
- }
- else
- {
- DEBUG_ERR_MSG("Invalid Sound Path");
- }
- }
-}
+++ /dev/null
-LOCAL_PATH=.
-
-#phLibNfc
-
-export PKG_CONFIG_PATH=/usr/lib/pkgconfig/
-
-#sources
-
-SRCS = $(LOCAL_PATH)/bt_paring.c
-
-#includes
-
-USER_HEADER =`pkg-config --cflags nfc bluetooth-api`
-
-LOCAL_CFLAGS = $(USER_HEADER)
-
-CC = arm-linux-gnueabi-gcc
-
-TARGET = bt_paring
-
-
-CFLAGS = $(LOCAL_CFLAGS) -g
-LDFLAGS = -lpthread `pkg-config --libs nfc bluetooth-api`
-
-
-SRC = $(SRCS)
-OBJS = $(SRC:.c=.o)
-RM = rm
-
-
-.SUFFIXES: .c .o
-
-.c.o:
- $(CC) -c $(CFLAGS) -o $*.o $<
-
-all: $(TARGET)
-
-$(TARGET): $(OBJS)
- $(CC) -o $@ $(OBJS) $(LDFLAGS) -g
-
-run: all
- $(TARGET)
-
-clean:
- $(RM) -f $(OBJS) $(TARGET)
-
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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 <stdlib.h>
-
-#include <bluetooth-api.h>
-#include <glib.h>
-
-#include <net_nfc.h>
-
-#include <pthread.h>
-
-void bt_event_callback(int event, bluetooth_event_param_t* param, void *user_data);
-void bt_test_bond_device(bluetooth_device_address_t* bt_address);
-GMainLoop* main_loop = NULL;
-
-void initialize()
-{
- if(!g_thread_supported())
- {
- g_thread_init(NULL);
- }
-
- dbus_g_thread_init();
- g_type_init();
-}
-
-
-int main()
-{
- initialize();
-
- //bluetooth_enable_adapter();
-
- //main_loop = g_main_loop_new(NULL, FALSE);
- //g_main_loop_run(main_loop);
-
-#if 1
-
- ndef_message_h ndef_message = NULL;
- net_nfc_conn_handover_info_h conn_handover_info = NULL;
-
-
- if(net_nfc_retrieve_current_ndef_message(&ndef_message) == NET_NFC_OK)
- {
- printf("retrieve ndef message from nfc storage \n");
-
- int count = 0;
-
- net_nfc_get_ndef_message_record_count(ndef_message, &count);
-
- int i = 0;
- while(i < count){
-
- ndef_record_h record = NULL;
- net_nfc_get_record_by_index(ndef_message, i++, &record);
-
- if(record != NULL){
-
- net_nfc_record_tnf_e TNF = NET_NFC_RECORD_EMPTY;
- data_h record_type = NULL;
-
- if((net_nfc_get_record_tnf(record, &TNF) == NET_NFC_OK) && (net_nfc_get_record_type(record, &record_type) == NET_NFC_OK ) ){
-
- uint8_t* buffer = net_nfc_get_data_buffer(record_type);
- int buffer_length = net_nfc_get_data_length(record_type);
-
- // record is WTK and Hs
- if((TNF == NET_NFC_RECORD_WELL_KNOWN_TYPE) && (buffer != NULL) && (buffer_length > 1) && (buffer[0] == 'H') && (buffer[1] == 's')){
- printf("record is found \n");
- net_nfc_parse_connection_handover_ndef_message(ndef_message, &conn_handover_info);
-
- if(conn_handover_info != NULL){
- uint8_t carrier_count = 0;
- net_nfc_get_connection_handover_alternative_carrier_count(conn_handover_info, &carrier_count);
-
- int j = 0;
- while(j < carrier_count){
-
- net_nfc_conn_handover_carrier_info_h carrier_info = NULL;
- net_nfc_get_connection_handover_carrier_handle_by_index(conn_handover_info, j++, &carrier_info);
-
- if(carrier_info != NULL){
- data_h configuration = NULL;
- net_nfc_get_carrier_configuration(carrier_info, &configuration);
-
- if(configuration != NULL)
- {
- uint8_t* buffer = net_nfc_get_data_buffer(configuration);
- if(buffer != NULL)
- {
- printf("bt addr [%X][%X][%X][%X][%X][%X] \n", buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7]);
- bluetooth_device_address_t bt_address = {{buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7]}};
- bt_test_bond_device(&bt_address);
- }
- else
- printf("buffer is NULL");
- }
- }
-
- }
- }
- }
- }
- }
- }
-
- }
-
-#endif
- return 0;
-}
-
-void bt_test_bond_device(bluetooth_device_address_t* bt_address)
-{
- int ret_val;
-
- ret_val = bluetooth_register_callback(bt_event_callback, NULL);
-
- if (ret_val >= BLUETOOTH_ERROR_NONE)
- {
- printf("bluetooth_register_callback returned Success");
- }
- else
- {
- printf("bluetooth_register_callback returned failiure [0x%04x]", ret_val);
- return ;
- }
-
- ret_val = bluetooth_check_adapter();
-
- if (ret_val < BLUETOOTH_ERROR_NONE)
- {
- printf("bluetooth_check_adapter returned failiure [0x%04x]", ret_val);
- }
- else
- {
- printf("BT state [0x%04x]", ret_val);
- }
-
- int error = 0;
-
- if((error = bluetooth_bond_device(bt_address)) < 0)
- {
- printf("Api failed: %d", error);
- }
- else
- {
- main_loop = g_main_loop_new(NULL, FALSE);
- g_main_loop_run(main_loop);
- }
-
-}
-
-void bt_event_callback(int event, bluetooth_event_param_t* param, void *user_data)
-{
- switch(event)
- {
- case BLUETOOTH_EVENT_ENABLED:
- printf("BLUETOOTH_EVENT_ENABLED:\n");
- break;
- case BLUETOOTH_EVENT_DISABLED:
- printf("BLUETOOTH_EVENT_DISABLED:\n");
- break;
- case BLUETOOTH_EVENT_LOCAL_NAME_CHANGED:
- printf("BLUETOOTH_EVENT_LOCAL_NAME_CHANGED:\n");
- break;
- case BLUETOOTH_EVENT_DISCOVERY_STARTED:
- printf("BLUETOOTH_EVENT_DISCOVERY_STARTED:\n");
- break;
- case BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:
- printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:\n");
- break;
- case BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:
- printf("BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:\n");
- break;
- case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
- printf("BLUETOOTH_EVENT_DISCOVERY_FINISHED:\n");
- break;
- case BLUETOOTH_EVENT_BONDING_FINISHED:
- printf("BLUETOOTH_EVENT_BONDING_FINISHED:\n");
-
- if (param->result >= BLUETOOTH_ERROR_NONE)
- {
- bluetooth_device_info_t *device_info = NULL;
- device_info = (bluetooth_device_info_t *)param->param_data;
- printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X] mjr[%#x] min[%#x] srv[%#x] \n", device_info->device_name.name, \
- device_info->device_address.addr[0], device_info->device_address.addr[1], device_info->device_address.addr[2], \
- device_info->device_address.addr[3], device_info->device_address.addr[4], device_info->device_address.addr[5], \
- device_info->device_class.major_class, device_info->device_class.minor_class, device_info->device_class.service_class);
- }
-
- g_main_loop_quit (main_loop);
-
- break;
- default:
- printf("BLUETOOTH_EVENT = [%d]:\n", event);
- break;
- }
-}
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(ndef-tool C)
-
-SET(NDEF_TOOL "ndef-tool")
-
-include_directories(${CMAKE_SOURCE_DIR}/src/commonlib)
-include_directories(${CMAKE_SOURCE_DIR}/src/commonlib/include)
-include_directories(${CMAKE_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 -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 -pie")
-
-ADD_EXECUTABLE(${NDEF_TOOL} ${TOOL_SRC})
-
-TARGET_LINK_LIBRARIES(${NDEF_TOOL} ${tool_pkgs_LDFLAGS} pthread dl rt nfc-common-lib nfc)
-LINK_DIRECTORIES(${CMAKE_BUILD_DIR}/src/commonlib ${CMAKE_BUILD_DIR}/src/clientlib)
-
-INSTALL(TARGETS ${NDEF_TOOL} DESTINATION bin)
-
-
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(nfc_client C)
-
-SET(NFC_CLIENT "nfc_client")
-
-include_directories(${CMAKE_SOURCE_DIR}/src/commonlib/include)
-include_directories(${CMAKE_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 -Uarm -fno-common -fpie")
-
-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 -pie")
-
-ADD_EXECUTABLE(${NFC_CLIENT} ${TOOL_SRC})
-
-TARGET_LINK_LIBRARIES(${NFC_CLIENT} ${tool_pkgs_LDFLAGS} pthread dl rt nfc-common-lib nfc)
-LINK_DIRECTORIES(${CMAKE_BUILD_DIR}/src/commonlib ${CMAKE_BUILD_DIR}/src/clientlib)
-
-INSTALL(TARGETS ${NFC_CLIENT} DESTINATION bin)
-
-
+++ /dev/null
-LOCAL_PATH=.
-
-#phLibNfc
-
-export PKG_CONFIG_PATH=/usr/lib/pkgconfig/
-
-#sources
-
-SRCS = $(LOCAL_PATH)/main.c
-
-#includes
-
-USER_HEADER =`pkg-config --cflags nfc glib-2.0 gobject-2.0`
-
-LOCAL_CFLAGS = $(USER_HEADER)
-
-CC = arm-linux-gnueabi-gcc
-
-TARGET = nfc-test
-
-
-CFLAGS = $(LOCAL_CFLAGS) -g
-LDFLAGS = -lpthread `pkg-config --libs nfc glib-2.0 gobject-2.0`
-
-
-SRC = $(SRCS)
-OBJS = $(SRC:.c=.o)
-RM = rm
-
-
-.SUFFIXES: .c .o
-
-.c.o:
- $(CC) -c $(CFLAGS) -o $*.o $<
-
-all: $(TARGET)
-
-$(TARGET): $(OBJS)
- $(CC) -o $@ $(OBJS) $(LDFLAGS)
-
-run: all
- $(TARGET)
-
-clean:
- $(RM) -f $(OBJS) $(TARGET)
-
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-
-PROJECT(tests C)
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/client/include)
SET(NFC_CLIENT_TEST "nfc-client-test")
-include_directories(${CMAKE_SOURCE_DIR}/src/clientlib/include)
-include_directories(${CMAKE_SOURCE_DIR}/src/commonlib/include)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
+FILE(GLOB TESTS_SRCS *.c)
-INCLUDE(FindPkgConfig)
pkg_check_modules(tests_pkgs REQUIRED glib-2.0)
-
FOREACH(flag ${tests_pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fpie")
-SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
-
-SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -pie")
-ADD_EXECUTABLE(${NFC_CLIENT_TEST}
- main.c
- net_nfc_test_manager.c
- net_nfc_test_tag.c
- net_nfc_test_ndef.c
- net_nfc_test_test.c
- net_nfc_test_p2p.c
- net_nfc_test_transceive.c
- net_nfc_test_handover.c
- net_nfc_test_client.c
- net_nfc_test_jewel.c
- net_nfc_test_tag_mifare.c
- net_nfc_test_tag_felica.c
- net_nfc_test_exchanger.c
- net_nfc_test_llcp.c
- net_nfc_test_snep.c
- net_nfc_test_se.c
- net_nfc_test_sys_handler.c
- net_nfc_test_util.c
- )
-
-TARGET_LINK_LIBRARIES(${NFC_CLIENT_TEST} ${tests_pkgs_LD_FLAGS} nfc)
-LINK_DIRECTORIES(${CMAKE_BUILD_DIR}/src/clientlib
- ${CMAKE_BUILD_DIR}/src/commonlib)
+ADD_EXECUTABLE(${NFC_CLIENT_TEST} ${TESTS_SRCS})
+TARGET_LINK_LIBRARIES(${NFC_CLIENT_TEST} ${tests_pkgs_LDFLAGS} nfc)
+++ /dev/null
-/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://floralicense.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_TEST_CLIENT_H__
-#define __NET_NFC_TEST_CLIENT_H__
-
-#include <glib.h>
-
-
-void net_nfc_test_initialize(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_deinitialize(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_is_nfc_supported(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_get_nfc_state(gpointer data,
- gpointer user_data);
-
-#endif//__NET_NFC_TEST_CLIENT_H__
-
+++ /dev/null
-/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.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_TEST_LLCP_H__
-#define __NET_NFC_TEST_LLCP_H__
-
-#include <glib.h>
-
-
-void net_nfc_test_llcp_default_config(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_default_config_sync(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_get_local_config(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_custom_config(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_custom_config_sync(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_get_local_config(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_get_config_miu(gpointer data,
- gpointer user_data);
-
-
-void net_nfc_test_llcp_get_config_wks(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_get_config_lto(gpointer data,
- gpointer user_data);
-
-
-void net_nfc_test_llcp_get_config_option(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_set_config_miu(gpointer data,
- gpointer user_data);
-
-
-void net_nfc_test_llcp_set_config_wks(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_set_config_lto(gpointer data,
- gpointer user_data);
-
-
-void net_nfc_test_llcp_set_config_option(gpointer data,
- gpointer user_data);
-
-
-void net_nfc_test_llcp_free_config(gpointer data,
- gpointer user_data);
-
-
-void net_nfc_test_llcp_create_custom_socket_option(gpointer data,
- gpointer user_data);
-
-
-void net_nfc_test_llcp_create_default_socket_option(gpointer data,
- gpointer user_data);
-
-
-void net_nfc_test_llcp_get_local_socket_option(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_get_socket_option_miu(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_set_socket_option_miu(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_get_socket_option_rw(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_set_socket_option_rw(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_get_socket_option_type(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_set_socket_option_type(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_free_socket_option(gpointer data,
- gpointer user_data);
-
-
-void net_nfc_test_llcp_listen(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_listen_sync(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_receive(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_receive_sync(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_receive_from(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_receive_from_sync(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_create_socket(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_close_socket(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_close_socket_sync(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_connect(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_connect_sync(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_connect_sap(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_connect_sap_sync(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_send(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_send_sync(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_send_to(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_send_to_sync(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_llcp_disconnect(gpointer func_data,
- gpointer user_data);
-
-void net_nfc_test_llcp_disconnect_server(gpointer func_data,
- gpointer user_data);
-
-void net_nfc_test_llcp_disconnect_sync(gpointer func_data,
- gpointer user_data);
-
-#endif//__NET_NFC_TEST_LLCP_H__
-
+++ /dev/null
-/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://floralicense.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_TEST_SYS_HANDLER_H__
-#define __NET_NFC_TEST_SYS_HANDLER_H__
-
-#include <glib.h>
-
-void net_nfc_test_sys_handler_set_launch_popup_state(gpointer data,
- gpointer user_data);
-
-void net_nfc_test_sys_handler_get_launch_popup_state(gpointer data,
- gpointer user_data);
-
-#endif//__NET_NFC_TEST_SYS_HANDLER_H__
{
gint i;
- g_type_init();
-
if (argc == 2 && strcmp(argv[1], "--help") == 0)
{
g_print("nfc-client-test: nfc-client-test [inteface.name]\n");
strv = pos->data;
if (strcmp(strv[0], "Manager") != 0 ||
- strcmp(strv[1], "SetActive") != 0)
+ strcmp(strv[1], "SetActive") != 0)
{
gchar **manager_strv;
*/
#include <glib-object.h>
+
#include "net_nfc_test_client.h"
#include "net_nfc_client_context.h"
#include "net_nfc_test_client.h"
}
}
-void net_nfc_test_initialize(gpointer data,
- gpointer user_data)
+void net_nfc_test_initialize(gpointer data, gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
run_next_callback(user_data);
}
-void net_nfc_test_deinitialize(gpointer data,
- gpointer user_data)
+void net_nfc_test_deinitialize(gpointer data, gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
g_print("Client Deinitialization Completed & Result is %d\n", result);
}
-void net_nfc_test_is_nfc_supported(gpointer data,
- gpointer user_data)
+void net_nfc_test_is_nfc_supported(gpointer data, gpointer user_data)
{
int feature = 0;
net_nfc_error_e result = NET_NFC_OK;
run_next_callback(user_data);
}
-void net_nfc_test_get_nfc_state(gpointer data,
- gpointer user_data)
+void net_nfc_test_get_nfc_state(gpointer data, gpointer user_data)
{
int state = 0;
net_nfc_error_e result = NET_NFC_OK;
--- /dev/null
+/*
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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_TEST_CLIENT_H__
+#define __NET_NFC_TEST_CLIENT_H__
+
+#include <glib.h>
+
+void net_nfc_test_initialize(gpointer data, gpointer user_data);
+void net_nfc_test_deinitialize(gpointer data, gpointer user_data);
+void net_nfc_test_is_nfc_supported(gpointer data, gpointer user_data);
+void net_nfc_test_get_nfc_state(gpointer data, gpointer user_data);
+
+#endif //__NET_NFC_TEST_CLIENT_H__
+
return exch_data;
}
-void net_nfc_test_handle_exchanger_data(gpointer data,
- gpointer user_data)
+void net_nfc_test_handle_exchanger_data(gpointer data, gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
ndef_message_h msg = NULL;
return;
}
-void net_nfc_test_send_exchanger_data(gpointer data,
- gpointer user_data)
+void net_nfc_test_send_exchanger_data(gpointer data, gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
handle = net_nfc_test_device_get_target_handle();
result = net_nfc_client_send_exchanger_data(exch_data,
- handle,
- user_data);
+ handle,
+ user_data);
g_print("Send exchanger result : %d\n", result);
run_next_callback(user_data);
}
-void net_nfc_test_exchanger_request_connection_handover(gpointer data,
- gpointer user_data)
+void net_nfc_test_exchanger_request_connection_handover(gpointer data, gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_conn_handover_carrier_type_e type = NET_NFC_CONN_HANDOVER_CARRIER_BT;
run_next_callback(user_data);
}
-void net_nfc_test_exchanger_get_alternative_carrier_type(gpointer data,
- gpointer user_data)
+void net_nfc_test_exchanger_get_alternative_carrier_type(gpointer data, gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
/*Handover info needs to check-.As of now passing NULL*/
}
void net_nfc_test_exchanger_get_alternative_carrier_data(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
/*Handover info needs to check-.As of now passing NULL*/
void net_nfc_test_exchanger_get_alternative_carrier_data(gpointer data,
gpointer user_data);
-#endif//__NET_NFC_TEST_EXCHANGER_H__
+#endif //__NET_NFC_TEST_EXCHANGER_H__
static void run_next_callback(gpointer user_data);
static void p2p_connection_handover_cb(net_nfc_error_e result,
- net_nfc_conn_handover_carrier_type_e type,
- data_h data,
- void *user_data);
+ net_nfc_conn_handover_carrier_type_e type,
+ data_h data,
+ void *user_data);
net_nfc_connection_handover_info_h global_info = NULL;
}
static void p2p_connection_handover_cb(net_nfc_error_e result,
- net_nfc_conn_handover_carrier_type_e type,
- data_h data,
- void *user_data)
+ net_nfc_conn_handover_carrier_type_e type,
+ data_h data,
+ void *user_data)
{
g_print("Connection handover completed\n");
}
void net_nfc_test_p2p_connection_handover(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_conn_handover_carrier_type_e type = NET_NFC_CONN_HANDOVER_CARRIER_BT;
g_print("handle for handover : %p \n", handle);
result = net_nfc_client_p2p_connection_handover(
- handle,
- type,
- p2p_connection_handover_cb,
- user_data);
+ handle,
+ type,
+ p2p_connection_handover_cb,
+ user_data);
}
void net_nfc_test_p2p_connection_handover_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_conn_handover_carrier_type_e type;
handle = net_nfc_test_device_get_target_handle();
result = net_nfc_client_p2p_connection_handover_sync(
- handle,
- type,
- &out_carrier,
- &out_data);
+ handle,
+ type,
+ &out_carrier,
+ &out_data);
g_print("Received out carrier type & carrier type %d, %d\n", out_carrier, type);
print_received_data(out_data);
run_next_callback(user_data);
}
-
void net_nfc_test_handover_get_alternative_carrier_type(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_conn_handover_carrier_type_e type;
}
void net_nfc_test_handover_handle_alternative_carrier_data(gpointer data,
- gpointer user_datarrierData)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
data_h out_data = NULL;
result = net_nfc_client_handover_free_alternative_carrier_data(hand_info);
g_print("Free alternative carrier data %d", result);
-
}
gpointer user_data);
-#endif//__NET_NFC_TEST_HANDOVER_H__
+#endif //__NET_NFC_TEST_HANDOVER_H__
/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://floralicense.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.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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 "net_nfc_test_jewel.h"
#include "net_nfc_typedef_internal.h"
static void run_next_callback(gpointer user_data);
static void jewel_read_cb(net_nfc_error_e result,
- data_h resp_data,
- void *user_data);
+ data_h resp_data,
+ void *user_data);
;
static void jewel_write_cb(net_nfc_error_e result,
- void* user_data);
+ void* user_data);
static net_nfc_target_handle_h get_handle()
/*********************************** Callbacks *************************************/
static void jewel_read_cb(net_nfc_error_e result,
- data_h resp_data,
- void *user_data)
+ data_h resp_data,
+ void *user_data)
{
g_print("jewel_read_cb Completed %d\n", result);
}
static void jewel_write_cb(net_nfc_error_e result,
- void* user_data)
+ void* user_data)
{
g_print("jewel_write_cb Completed %d\n", result);
void net_nfc_test_tag_jewel_read_id(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
handle = get_handle();
result = net_nfc_client_jewel_read_id(handle,
- jewel_read_cb,
- user_data);
+ jewel_read_cb,
+ user_data);
}
void net_nfc_test_tag_jewel_read_byte(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
handle = get_handle();
result = net_nfc_client_jewel_read_byte(handle,
- block,
- byte,
- jewel_read_cb,
- user_data);
+ block,
+ byte,
+ jewel_read_cb,
+ user_data);
}
void net_nfc_test_tag_jewel_read_all(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
handle = get_handle();
result = net_nfc_client_jewel_read_all(handle,
- jewel_read_cb,
- user_data);
+ jewel_read_cb,
+ user_data);
}
void net_nfc_test_tag_jewel_write_with_erase(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
handle = get_handle();
result = net_nfc_client_jewel_write_with_erase(handle,
- block,
- byte,
- data_to_write,
- jewel_write_cb,
- user_data);
+ block,
+ byte,
+ data_to_write,
+ jewel_write_cb,
+ user_data);
}
void net_nfc_test_tag_jewel_write_with_no_erase(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
handle = get_handle();
result = net_nfc_client_jewel_write_with_erase(handle,
- block,
- byte,
- data_to_write,
- jewel_write_cb,
- user_data);
+ block,
+ byte,
+ data_to_write,
+ jewel_write_cb,
+ user_data);
}
-
}
static void llcp_listen_socket_cb(net_nfc_error_e result,
- net_nfc_llcp_socket_t client_socket,
- void *user_data)
+ net_nfc_llcp_socket_t client_socket,
+ void *user_data)
{
g_print("llcp_listen_socket_cb Completed %d\n", client_socket);
}
static void llcp_receive_socket_cb(net_nfc_error_e result,
- data_h data,
- void *user_data)
+ data_h data,
+ void *user_data)
{
data_h received_data = data;
}
static void llcp_receive_from_socket_cb(net_nfc_error_e result,
- sap_t sap,
- data_h data,
- void *user_data)
+ sap_t sap,
+ data_h data,
+ void *user_data)
{
data_h received_data = data;
static void llcp_connect_socket_cb(net_nfc_error_e result,
- net_nfc_llcp_socket_t client_socket,
- void *user_data)
+ net_nfc_llcp_socket_t client_socket,
+ void *user_data)
{
g_print("llcp_connect_socket_cb Completed %d\n", client_socket);
g_print("llcp_connect_socket_cb Completed %d\n", result);
static void llcp_connect_sap_cb(net_nfc_error_e result,
- net_nfc_llcp_socket_t client_socket,
- void *user_data)
+ net_nfc_llcp_socket_t client_socket,
+ void *user_data)
{
g_print("llcp_connect_socket_cb Completed %d\n", client_socket);
g_print("llcp_connect_socket_cb Completed %d\n", result);
static void llcp_send_socket_cb(net_nfc_error_e result,
- net_nfc_llcp_socket_t client_socket,
- void *user_data)
+ net_nfc_llcp_socket_t client_socket,
+ void *user_data)
{
g_print("llcp_send_socket_cb Completed %d\n", client_socket);
g_print("llcp_send_socket_cb Completed %d\n", result);
}
static void llcp_send_to_socket_cb(net_nfc_error_e result,
- net_nfc_llcp_socket_t client_socket,
- void *user_data)
+ net_nfc_llcp_socket_t client_socket,
+ void *user_data)
{
g_print("llcp_send_to_socket_cb Completed %d\n", client_socket);
g_print("llcp_send_to_socket_cb Completed %d\n", result);
}
static void llcp_disconnect_socket_cb(net_nfc_error_e result,
- net_nfc_llcp_socket_t client_socket,
- void *user_data)
+ net_nfc_llcp_socket_t client_socket,
+ void *user_data)
{
g_print("llcp_send_to_socket_cb Completed %d\n", client_socket);
g_print("llcp_send_to_socket_cb Completed %d\n", result);
}
static void llcp_close_completed_cb(net_nfc_error_e result,
- net_nfc_llcp_socket_t client_socket,
- void *user_data)
+ net_nfc_llcp_socket_t client_socket,
+ void *user_data)
{
g_print("llcp_close_completed_cb Completed %d\n", client_socket);
/*********************************** Function Calls *************************************/
void net_nfc_test_llcp_default_config(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
}
result = net_nfc_client_llcp_config(llcp_config_default,
- llcp_default_config_cb,
- user_data);
+ llcp_default_config_cb,
+ user_data);
}
void net_nfc_test_llcp_default_config_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
void net_nfc_test_llcp_custom_config(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
}
result = net_nfc_client_llcp_config(llcp_config,
- llcp_custom_config_cb,
- user_data);
+ llcp_custom_config_cb,
+ user_data);
}
void net_nfc_test_llcp_custom_config_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
}
void net_nfc_test_llcp_get_local_config(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_llcp_config_info_h local_config;
net_nfc_error_e result;
/*commented because remote config API is not available*/
/*
-void net_nfc_test_llcp_get_remote_config(gpointer data,
- gpointer user_data)
-{
+ void net_nfc_test_llcp_get_remote_config(gpointer data,
+ gpointer user_data)
+ {
net_nfc_llcp_config_info_h local_config;
net_nfc_error_e result;
if(result != NET_NFC_OK)
{
- g_print(" llcp create custom config failed: %d\n", result);
- run_next_callback(user_data);
- return;
+ g_print(" llcp create custom config failed: %d\n", result);
+ run_next_callback(user_data);
+ return;
}
g_print(" net_nfc_test_llcp_get_local_config: %d\n", local_config->lto);
g_print("net_nfc_test_llcp_get_local_config: %d\n", local_config->option);
-}
-*/
+ }
+ */
void net_nfc_test_llcp_get_config_miu(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
void net_nfc_test_llcp_get_config_wks(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
uint16_t wks;
}
void net_nfc_test_llcp_get_config_lto(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
uint8_t lto;
void net_nfc_test_llcp_get_config_option(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
uint8_t option;
void net_nfc_test_llcp_set_config_miu(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
uint16_t miu = 128;
void net_nfc_test_llcp_set_config_wks(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
uint16_t wks = 1;
void net_nfc_test_llcp_set_config_lto(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
uint16_t lto = 10;
void net_nfc_test_llcp_set_config_option(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
void net_nfc_test_llcp_free_config(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
void net_nfc_test_llcp_create_custom_socket_option(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
-
net_nfc_error_e result;
result = net_nfc_client_llcp_create_socket_option(&test_option,
- 128,
- 1,
- NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED);
+ 128,
+ 1,
+ NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED);
if(result != NET_NFC_OK)
{
}
void net_nfc_test_llcp_create_default_socket_option(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
-
net_nfc_error_e result;
result = net_nfc_client_llcp_create_socket_option_default(&test_option);
}
void net_nfc_test_llcp_get_local_socket_option(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
net_nfc_llcp_socket_option_h option_local;
result = net_nfc_client_llcp_get_local_socket_option(client_test_socket,&option_local);
-if(result != NET_NFC_OK)
-{
- g_print(" net_nfc_test_llcp_get_local_socket_option failed: %d\n", result);
- run_next_callback(user_data);
- return;
-}
-
-g_print(" net_nfc_test_llcp_get_local_socket_option: %d\n", option_local->miu);
-g_print("net_nfc_test_llcp_get_local_socket_option: %d\n", option_local->rw);
-g_print(" net_nfc_test_llcp_get_local_socket_option: %d\n", option_local->type);
-
-run_next_callback(user_data);
+ if(result != NET_NFC_OK)
+ {
+ g_print(" net_nfc_test_llcp_get_local_socket_option failed: %d\n", result);
+ run_next_callback(user_data);
+ return;
+ }
+ g_print(" net_nfc_test_llcp_get_local_socket_option: %d\n", option_local->miu);
+ g_print("net_nfc_test_llcp_get_local_socket_option: %d\n", option_local->rw);
+ g_print(" net_nfc_test_llcp_get_local_socket_option: %d\n", option_local->type);
+ run_next_callback(user_data);
}
void net_nfc_test_llcp_get_socket_option_miu(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
uint16_t miu;
void net_nfc_test_llcp_set_socket_option_miu(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
uint16_t miu = 128;
}
void net_nfc_test_llcp_get_socket_option_rw(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
-
net_nfc_error_e result;
uint8_t rw;
void net_nfc_test_llcp_set_socket_option_rw(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
-
net_nfc_error_e result;
uint8_t rw = 1;
}
void net_nfc_test_llcp_get_socket_option_type(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
net_nfc_socket_type_e type;
void net_nfc_test_llcp_set_socket_option_type(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
-
net_nfc_error_e result;
net_nfc_socket_type_e type = NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED;
}
void net_nfc_test_llcp_free_socket_option(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
void net_nfc_test_llcp_listen(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
net_nfc_client_llcp_create_socket(&server_test_socket,NULL);
result = net_nfc_client_llcp_listen(server_test_socket,
- "urn:nfc:xsn:samsung.com:testllcp" ,
- 16 ,
- llcp_listen_socket_cb,
- NULL);
+ "urn:nfc:xsn:samsung.com:testllcp" ,
+ 16 ,
+ llcp_listen_socket_cb,
+ NULL);
if(result != NET_NFC_OK)
{
}
void net_nfc_test_llcp_listen_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
net_nfc_llcp_socket_t out_socket;
net_nfc_client_llcp_create_socket(&server_test_socket,NULL);
result = net_nfc_client_llcp_listen_sync(server_test_socket,
- "urn:nfc:xsn:samsung.com:testllcp" ,
- 16 ,
- &out_socket);
+ "urn:nfc:xsn:samsung.com:testllcp" ,
+ 16 ,
+ &out_socket);
if(result != NET_NFC_OK)
{
void net_nfc_test_llcp_receive(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
result = net_nfc_client_llcp_receive(server_test_socket,
- 512,
- llcp_receive_socket_cb,
- NULL);
+ 512,
+ llcp_receive_socket_cb,
+ NULL);
if(result != NET_NFC_OK)
{
void net_nfc_test_llcp_receive_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
data_h out_data;
result = net_nfc_client_llcp_receive_sync(server_test_socket,
- 512,
- &out_data);
+ 512,
+ &out_data);
if(result != NET_NFC_OK)
{
void net_nfc_test_llcp_receive_from(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
result = net_nfc_client_llcp_receive_from(server_test_socket,
- 512,
- llcp_receive_from_socket_cb,
- NULL);
+ 512,
+ llcp_receive_from_socket_cb,
+ NULL);
if(result != NET_NFC_OK)
{
}
void net_nfc_test_llcp_receive_from_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
data_h out_data;
sap_t sap_data;
result = net_nfc_client_llcp_receive_from_sync(server_test_socket,
- 512,
- &sap_data,
- &out_data);
+ 512,
+ &sap_data,
+ &out_data);
if(result != NET_NFC_OK)
{
void net_nfc_test_llcp_create_socket(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_llcp_create_socket(&client_test_socket, NULL);
void net_nfc_test_llcp_close_socket(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
result = net_nfc_client_llcp_close(client_test_socket,
- llcp_close_completed_cb,
- user_data);
+ llcp_close_completed_cb,
+ user_data);
g_print(" net_nfc_test_llcp_close_socket %d\n",result);
void net_nfc_test_llcp_close_socket_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_llcp_socket_t out_socket;
net_nfc_error_e result;
result = net_nfc_client_llcp_close_sync(client_test_socket,
- &out_socket);
+ &out_socket);
g_print(" net_nfc_test_llcp_close_socket %d\n",result);
void net_nfc_test_llcp_connect(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
net_nfc_client_llcp_create_socket(&client_test_socket, NULL);
result = net_nfc_client_llcp_connect(client_test_socket,
- "urn:nfc:xsn:samsung.com:testllcp",
- llcp_connect_socket_cb,
- user_data);
+ "urn:nfc:xsn:samsung.com:testllcp",
+ llcp_connect_socket_cb,
+ user_data);
if(result != NET_NFC_OK)
{
}
void net_nfc_test_llcp_connect_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
net_nfc_llcp_socket_t out_socket;
net_nfc_client_llcp_create_socket(&client_test_socket, NULL);
result = net_nfc_client_llcp_connect_sync(client_test_socket,
- "urn:nfc:xsn:samsung.com:testllcp",
- &out_socket);
+ "urn:nfc:xsn:samsung.com:testllcp",
+ &out_socket);
if(result != NET_NFC_OK)
{
}
void net_nfc_test_llcp_connect_sap(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
net_nfc_client_llcp_create_socket(&client_test_socket, NULL);
result = net_nfc_client_llcp_connect_sap(client_test_socket,
- 16,
- llcp_connect_sap_cb,
- user_data);
+ 16,
+ llcp_connect_sap_cb,
+ user_data);
if(result != NET_NFC_OK)
{
}
void net_nfc_test_llcp_connect_sap_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
net_nfc_llcp_socket_t out_socket;
net_nfc_client_llcp_create_socket(&client_test_socket, NULL);
result = net_nfc_client_llcp_connect_sap_sync(client_test_socket,
- 16,
- &out_socket);
+ 16,
+ &out_socket);
if(result != NET_NFC_OK)
{
void net_nfc_test_llcp_send(gpointer func_data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
data_h data;
net_nfc_create_data (&data, (const uint8_t*)str ,strlen (str) + 1);
result = net_nfc_client_llcp_send(client_test_socket,
- data,
- llcp_send_socket_cb,
- user_data);
+ data,
+ llcp_send_socket_cb,
+ user_data);
if(result != NET_NFC_OK)
{
void net_nfc_test_llcp_send_sync(gpointer func_data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
data_h data;
net_nfc_create_data (&data, (const uint8_t*)str ,strlen (str) + 1);
result = net_nfc_client_llcp_send_sync(client_test_socket,
- data,
- &out_socket);
+ data,
+ &out_socket);
if(result != NET_NFC_OK)
{
void net_nfc_test_llcp_send_to(gpointer func_data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
data_h data;
net_nfc_create_data (&data, (const uint8_t*)str ,strlen (str) + 1);
result = net_nfc_client_llcp_send_to(client_test_socket,
- 16,
- data,
- llcp_send_to_socket_cb,
- user_data);
+ 16,
+ data,
+ llcp_send_to_socket_cb,
+ user_data);
if(result != NET_NFC_OK)
{
void net_nfc_test_llcp_send_to_sync(gpointer func_data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
data_h data;
net_nfc_create_data (&data, (const uint8_t*)str ,strlen (str) + 1);
result = net_nfc_client_llcp_send_to_sync(client_test_socket,
- 16,
- data,
- &out_socket);
+ 16,
+ data,
+ &out_socket);
if(result != NET_NFC_OK)
{
void net_nfc_test_llcp_disconnect(gpointer func_data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
result = net_nfc_client_llcp_disconnect(client_test_socket,
- llcp_disconnect_socket_cb,
- user_data);
+ llcp_disconnect_socket_cb,
+ user_data);
if(result != NET_NFC_OK)
{
}
void net_nfc_test_llcp_disconnect_server(gpointer func_data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
result = net_nfc_client_llcp_disconnect(server_test_socket,
- llcp_disconnect_socket_cb,
- user_data);
+ llcp_disconnect_socket_cb,
+ user_data);
if(result != NET_NFC_OK)
{
void net_nfc_test_llcp_disconnect_sync(gpointer func_data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
net_nfc_llcp_socket_t out_socket;
--- /dev/null
+/*
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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_TEST_LLCP_H__
+#define __NET_NFC_TEST_LLCP_H__
+
+#include <glib.h>
+
+
+void net_nfc_test_llcp_default_config(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_default_config_sync(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_get_local_config(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_custom_config(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_custom_config_sync(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_get_local_config(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_get_config_miu(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_get_config_wks(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_get_config_lto(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_get_config_option(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_set_config_miu(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_set_config_wks(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_set_config_lto(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_set_config_option(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_free_config(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_create_custom_socket_option(gpointer data,
+ gpointer user_data);
+void net_nfc_test_llcp_create_default_socket_option(gpointer data,
+ gpointer user_data);
+void net_nfc_test_llcp_get_local_socket_option(gpointer data,
+ gpointer user_data);
+void net_nfc_test_llcp_get_socket_option_miu(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_set_socket_option_miu(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_get_socket_option_rw(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_set_socket_option_rw(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_get_socket_option_type(gpointer data,
+ gpointer user_data);
+void net_nfc_test_llcp_set_socket_option_type(gpointer data,
+ gpointer user_data);
+void net_nfc_test_llcp_free_socket_option(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_listen(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_listen_sync(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_receive(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_receive_sync(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_receive_from(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_receive_from_sync(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_create_socket(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_close_socket(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_close_socket_sync(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_connect(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_connect_sync(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_connect_sap(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_connect_sap_sync(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_send(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_send_sync(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_send_to(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_send_to_sync(gpointer data, gpointer user_data);
+void net_nfc_test_llcp_disconnect(gpointer func_data, gpointer user_data);
+void net_nfc_test_llcp_disconnect_server(gpointer func_data, gpointer user_data);
+void net_nfc_test_llcp_disconnect_sync(gpointer func_data, gpointer user_data);
+
+#endif //__NET_NFC_TEST_LLCP_H__
\ No newline at end of file
void *user_data);
static void set_active_completed_cb(net_nfc_error_e result,
- void *user_data);
+ void *user_data);
static void get_server_state_completed_cb(net_nfc_error_e result,
- unsigned int state,
- void *user_data);
+ unsigned int state,
+ void *user_data);
static void run_next_callback(gpointer user_data)
{
if (state & NET_NFC_SNEP_CLIENT_CONNECTED)
{
g_print("\tNET_NFC_SNEP_CLIENT_CONNECTED(%d)\n",
- state);
+ state);
}
if (state & NET_NFC_NPP_CLIENT_CONNECTED)
g_print("\tNET_NFC_NPP_CLIENT_CONNECTED(%d)\n", state);
}
static void set_activated_cb(bool state,
- void *user_data)
+ void *user_data)
{
g_print("Activated state %d\n", state);
}
static void set_active_completed_cb(net_nfc_error_e result,
- void *user_data)
+ void *user_data)
{
g_print("SetActive Completed %d\n", result);
run_next_callback(user_data);
}
static void get_server_state_completed_cb(net_nfc_error_e result,
- unsigned int state,
- void *user_data)
+ unsigned int state,
+ void *user_data)
{
g_print("GetServerState Completed %d\n", result);
}
void net_nfc_test_manager_set_active(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_manager_set_activated(set_activated_cb, NULL);
net_nfc_client_manager_set_active(1,
- set_active_completed_cb,
- user_data);
+ set_active_completed_cb,
+ user_data);
}
void net_nfc_test_manager_get_server_state(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_manager_get_server_state(get_server_state_completed_cb,
- user_data);
+ user_data);
}
void net_nfc_test_manager_set_active_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
gint i;
}
void net_nfc_test_manager_get_server_state_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
guint state = 0;
static net_nfc_target_handle_h ndef_get_handle(void);
static ndef_message_h create_ndef_message_text(const gchar *str,
- const gchar *lang,
- net_nfc_encode_type_e encode);
+ const gchar *lang,
+ net_nfc_encode_type_e encode);
static void set_string(const gchar *str);
void *user_data);
static void ndef_make_read_only_cb(net_nfc_error_e result,
- void *user_data);
+ void *user_data);
static void ndef_format_cb(net_nfc_error_e result,
void *user_data);
net_nfc_get_encoding_type_from_text_record(record, &enc);
switch (enc)
{
- case NET_NFC_ENCODE_UTF_8:
- g_print("Encoding: UTF-8\n");
- break;
- case NET_NFC_ENCODE_UTF_16:
- g_print("Encoding: UTF-16\n");
- break;
- default:
- g_print("Encoding: Unknown\n");
+ case NET_NFC_ENCODE_UTF_8:
+ g_print("Encoding: UTF-8\n");
+ break;
+ case NET_NFC_ENCODE_UTF_16:
+ g_print("Encoding: UTF-16\n");
+ break;
+ default:
+ g_print("Encoding: Unknown\n");
}
}
switch(tnf)
{
- case NET_NFC_RECORD_EMPTY:
- break;
- case NET_NFC_RECORD_WELL_KNOWN_TYPE:
- print_record_well_known_type(record);
- break;
- case NET_NFC_RECORD_MIME_TYPE:
- break;
- case NET_NFC_RECORD_URI:
- break;
- case NET_NFC_RECORD_EXTERNAL_RTD:
- break;
- case NET_NFC_RECORD_UNKNOWN:
- break;
- case NET_NFC_RECORD_UNCHAGNED:
- break;
- default:
- g_print("TNF: unknown error\n");
- break;
+ case NET_NFC_RECORD_EMPTY:
+ break;
+ case NET_NFC_RECORD_WELL_KNOWN_TYPE:
+ print_record_well_known_type(record);
+ break;
+ case NET_NFC_RECORD_MIME_TYPE:
+ break;
+ case NET_NFC_RECORD_URI:
+ break;
+ case NET_NFC_RECORD_EXTERNAL_RTD:
+ break;
+ case NET_NFC_RECORD_UNKNOWN:
+ break;
+ case NET_NFC_RECORD_UNCHAGNED:
+ break;
+ default:
+ g_print("TNF: unknown error\n");
+ break;
}
}
}
if (net_nfc_get_ndef_message_record_count(message,
- &count) != NET_NFC_OK)
+ &count) != NET_NFC_OK)
{
g_print("can not get count of record\n");
return;
g_print("Record count : %d\n", i+1);
if (net_nfc_get_record_by_index(message,
- i,
- &record) != NET_NFC_OK)
+ i,
+ &record) != NET_NFC_OK)
{
g_print("can not get record from index %d\n", i);
continue;
}
static ndef_message_h create_ndef_message_text(const gchar *str,
- const gchar *lang,
- net_nfc_encode_type_e encode)
+ const gchar *lang,
+ net_nfc_encode_type_e encode)
{
ndef_record_h record = NULL;
ndef_message_h message = NULL;
}
if (net_nfc_create_text_type_record(&record,
- str,
- lang,
- encode) != NET_NFC_OK)
+ str,
+ lang,
+ encode) != NET_NFC_OK)
{
g_printerr("Can not create text record(%s, %d): %s\n",
lang, encode, str);
}
if (net_nfc_append_record_to_ndef_message(message,
- record) != NET_NFC_OK)
+ record) != NET_NFC_OK)
{
g_printerr("Can not append record to message\n");
net_nfc_free_ndef_message(message);
static void ndef_make_read_only_cb(net_nfc_error_e result,
- void *user_data)
+ void *user_data)
{
g_print("Make Read only Completed %d\n", result);
void net_nfc_test_ndef_read(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_target_handle_h handle;
g_print("Handle is %#x\n", GPOINTER_TO_UINT(handle));
net_nfc_client_ndef_read(handle,
- ndef_read_cb,
- user_data);
+ ndef_read_cb,
+ user_data);
}
void net_nfc_test_ndef_write(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_target_handle_h handle;
ndef_message_h message;
}
message = create_ndef_message_text(str,
- "en-US",
- NET_NFC_ENCODE_UTF_8);
+ "en-US",
+ NET_NFC_ENCODE_UTF_8);
g_free(str);
}
net_nfc_client_ndef_write(handle,
- message,
- ndef_write_cb,
- user_data);
+ message,
+ ndef_write_cb,
+ user_data);
}
void net_nfc_test_ndef_make_read_only(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_target_handle_h handle;
g_print("Handle is %#x\n", GPOINTER_TO_UINT(handle));
net_nfc_client_ndef_make_read_only(handle,
- ndef_make_read_only_cb,
- user_data);
+ ndef_make_read_only_cb,
+ user_data);
}
void net_nfc_test_ndef_format(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_target_handle_h handle;
data_h key;
net_nfc_create_data(&key, format_data, 6);
net_nfc_client_ndef_format(handle,
- key,
- ndef_format_cb,
- user_data);
+ key,
+ ndef_format_cb,
+ user_data);
net_nfc_free_data(key);
}
void net_nfc_test_ndef_read_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_target_handle_h handle;
ndef_message_h message = NULL;
g_print("Handle is %#x\n", GPOINTER_TO_UINT(handle));
result = net_nfc_client_ndef_read_sync(handle,
- &message);
+ &message);
g_print("Read Ndef: %d\n", result);
}
void net_nfc_test_ndef_write_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
gchar *str = NULL;
}
message = create_ndef_message_text(str,
- "en-US",
- NET_NFC_ENCODE_UTF_8);
+ "en-US",
+ NET_NFC_ENCODE_UTF_8);
g_free(str);
}
void net_nfc_test_ndef_make_read_only_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_target_handle_h handle;
net_nfc_error_e result;
}
void net_nfc_test_ndef_format_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_target_handle_h handle;
net_nfc_error_e result;
static void run_next_callback(gpointer user_data);
static void p2p_send(net_nfc_error_e result,
- void *user_data);
+ void *user_data);
static void p2p_device_discovered(net_nfc_target_handle_h handle,
- void *user_data);
+ void *user_data);
static void p2p_device_detached(void * user_data);
}
static void p2p_send(net_nfc_error_e result,
- void *user_data)
+ void *user_data)
{
g_print("P2P send Completed %d\n", result);
}
static void p2p_device_discovered(net_nfc_target_handle_h handle,
- void *user_data)
+ void *user_data)
{
g_print("Target is Discovered\n");
global_handle = handle;
}
void net_nfc_test_p2p_send(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
g_print("Handle is %#x\n", GPOINTER_TO_UINT(global_handle));
net_nfc_client_p2p_send(
- exch_data,
- global_handle,
- p2p_send,
- user_data);
+ exch_data,
+ global_handle,
+ p2p_send,
+ user_data);
}
void net_nfc_test_p2p_send_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
ndef_message_h msg = NULL;
}
void net_nfc_test_p2p_set_device_discovered(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
g_print("Waiting for Device Discovered Singal\n");
}
void net_nfc_test_p2p_set_device_detached(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_p2p_set_device_detached(p2p_device_detached,
- user_data);
+ user_data);
}
void net_nfc_test_p2p_set_data_received(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_p2p_set_data_received(p2p_device_data_received,
- user_data);
+ user_data);
}
net_nfc_target_handle_h net_nfc_test_device_get_target_handle(void)
static void set_secure_element_cb(net_nfc_error_e result, void *user_data);
static void open_secure_element_cb(net_nfc_error_e result,
- net_nfc_target_handle_h handle, void *user_data);
+ net_nfc_target_handle_h handle, void *user_data);
static void close_secure_element_cb(net_nfc_error_e result, void *user_data);
static void get_atr_secure_element_cb(net_nfc_error_e result, data_h data,
- void *user_data);
+ void *user_data);
static void se_set_event_cb(net_nfc_message_e event, void *user_data);
static void se_ese_detection_cb(net_nfc_target_handle_h handle,
- int dev_type, data_h data, void *user_data);
+ int dev_type, data_h data, void *user_data);
static void se_set_transaction_cb(data_h aid,
- data_h param,
- void *user_data);
+ data_h param,
+ void *user_data);
/*This handle would be intialized by open secure element callback function*/
static net_nfc_target_handle_h global_handle = NULL;
}
static void open_secure_element_cb(net_nfc_error_e result,
- net_nfc_target_handle_h handle, void* user_data)
+ net_nfc_target_handle_h handle, void* user_data)
{
g_print("Open secure element completed\n");
// assigning received handle
}
static void get_atr_secure_element_cb(net_nfc_error_e result, data_h data,
- void* user_data)
+ void* user_data)
{
g_print("get atr completed\n");
print_received_data(data);
}
static void se_ese_detection_cb(net_nfc_target_handle_h handle,
- int dev_type,
- data_h data,
- void *user_data)
+ int dev_type,
+ data_h data,
+ void *user_data)
{
g_print("Set ese detection callback successfully\n");
g_print("Handle is %#x\n", GPOINTER_TO_UINT(handle));
}
static void se_set_transaction_cb(data_h aid,
- data_h param,
- void *user_data)
+ data_h param,
+ void *user_data)
{
g_print("Set transaction callback successfully\n");
g_print("*****displaying Aid data****\n");
}
void net_nfc_test_se_send_apdu(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
data_h apdu_data = NULL;
net_nfc_create_data(&apdu_data, apdu_cmd, 4);
result = net_nfc_client_se_send_apdu(global_handle,
- apdu_data,
- send_apdu_cb,
- user_data);
+ apdu_data,
+ send_apdu_cb,
+ user_data);
}
void net_nfc_test_se_send_apdu_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
data_h apdu_data = NULL;
net_nfc_create_data(&apdu_data, apdu_cmd, 4);
result = net_nfc_client_se_send_apdu_sync(global_handle,
- apdu_data,
- &response);
+ apdu_data,
+ &response);
g_print(" Send apdu data sync completed %d\n", result);
print_received_data(response);
}
void net_nfc_test_se_set_secure_element_type(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_se_type_e se_type = NET_NFC_SE_TYPE_UICC;
result = net_nfc_client_se_set_secure_element_type(
- se_type,
- set_secure_element_cb,
- user_data);
+ se_type,
+ set_secure_element_cb,
+ user_data);
}
void net_nfc_test_se_set_secure_element_type_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_se_type_e se_type = NET_NFC_SE_TYPE_UICC;
}
void net_nfc_test_se_open_internal_secure_element(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_se_type_e se_type = NET_NFC_SE_TYPE_UICC;
result = net_nfc_client_se_open_internal_secure_element(
- se_type,
- open_secure_element_cb,
- user_data);
-
+ se_type,
+ open_secure_element_cb,
+ user_data);
}
void net_nfc_test_se_open_internal_secure_element_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_se_type_e se_type = NET_NFC_SE_TYPE_UICC;
result = net_nfc_client_se_open_internal_secure_element_sync(
- se_type,
- &global_handle);
+ se_type,
+ &global_handle);
g_print("Handle is %#x\n", GPOINTER_TO_UINT(global_handle));
g_print(" open secure element completed %d\n", result);
}
void net_nfc_test_se_close_internal_secure_element(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
result = net_nfc_client_se_close_internal_secure_element(
- global_handle,
- close_secure_element_cb,
- user_data);
-
+ global_handle,
+ close_secure_element_cb,
+ user_data);
}
void net_nfc_test_se_close_internal_secure_element_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
}
void net_nfc_test_se_get_atr(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
result = net_nfc_client_se_get_atr(
- global_handle,
- get_atr_secure_element_cb,
- user_data);
-
+ global_handle,
+ get_atr_secure_element_cb,
+ user_data);
}
void net_nfc_test_se_get_atr_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
data_h attr_data = NULL;
result = net_nfc_client_se_get_atr_sync(
- global_handle,
- &attr_data);
+ global_handle,
+ &attr_data);
g_print("Get atr data sync completed %d\n", result);
print_received_data(attr_data);
}
void net_nfc_test_se_set_event_cb(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_se_set_event_cb(se_set_event_cb,
- user_data);
+ user_data);
}
void net_nfc_test_se_unset_event_cb(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_se_unset_event_cb();
g_print(" Event unset callback successfully\n");
}
void net_nfc_test_se_set_ese_detection_cb(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_se_set_ese_detection_cb(se_ese_detection_cb,
- user_data);
+ user_data);
}
void net_nfc_test_se_unset_ese_detection_cb(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_se_unset_ese_detection_cb();
g_print("Detection unset callback successfuly\n");
}
void net_nfc_test_se_set_transaction_event_cb(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_se_set_transaction_event_cb(se_set_transaction_cb,
- user_data);
+ user_data);
}
void net_nfc_test_se_unset_transaction_event_cb(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_se_unset_transaction_event_cb();
g_print("Transaction unset callback successfully\n");
static void run_next_callback(gpointer user_data);
static void snep_tag_discovered_cb(net_nfc_target_info_h info,
- void *user_data);
+ void *user_data);
static void snep_tag_detached_cb(void *user_data);
static void snep_start_server_cb(net_nfc_snep_handle_h target,
- net_nfc_snep_type_t event,
- net_nfc_error_e result,
- ndef_message_h msg,
- void *user_data);
+ net_nfc_snep_type_t event,
+ net_nfc_error_e result,
+ ndef_message_h msg,
+ void *user_data);
static void snep_start_client_cb(net_nfc_snep_handle_h target,
- net_nfc_snep_type_t event,
- net_nfc_error_e result,
- ndef_message_h msg,
- void *user_data);
+ net_nfc_snep_type_t event,
+ net_nfc_error_e result,
+ ndef_message_h msg,
+ void *user_data);
static void snep_send_request_cb(net_nfc_snep_handle_h target,
- net_nfc_snep_type_t event,
- net_nfc_error_e result,
- ndef_message_h msg,
- void *user_data);
+ net_nfc_snep_type_t event,
+ net_nfc_error_e result,
+ ndef_message_h msg,
+ void *user_data);
static void snep_register_server_cb(net_nfc_snep_handle_h target,
- net_nfc_snep_type_t event,
- net_nfc_error_e result,
- ndef_message_h msg,
- void *user_data);
+ net_nfc_snep_type_t event,
+ net_nfc_error_e result,
+ ndef_message_h msg,
+ void *user_data);
/******************************Callbacks*********************************************/
}
static void snep_tag_discovered_cb(net_nfc_target_info_h info,
- void *user_data)
+ void *user_data)
{
g_print("TagDiscovered\n");
}
static void snep_start_server_cb(net_nfc_snep_handle_h target,
- net_nfc_snep_type_t event,
- net_nfc_error_e result,
- ndef_message_h msg,
- void *user_data)
+ net_nfc_snep_type_t event,
+ net_nfc_error_e result,
+ ndef_message_h msg,
+ void *user_data)
{
snep_handle = target;
}
static void snep_start_client_cb(net_nfc_snep_handle_h target,
- net_nfc_snep_type_t event,
- net_nfc_error_e result,
- ndef_message_h msg,
- void *user_data)
+ net_nfc_snep_type_t event,
+ net_nfc_error_e result,
+ ndef_message_h msg,
+ void *user_data)
{
g_print("snep_start_client_cb Completed %d\n", event);
static void snep_send_request_cb(net_nfc_snep_handle_h target,
- net_nfc_snep_type_t event,
- net_nfc_error_e result,
- ndef_message_h msg,
- void *user_data)
+ net_nfc_snep_type_t event,
+ net_nfc_error_e result,
+ ndef_message_h msg,
+ void *user_data)
{
g_print("snep_send_request_cb Completed %d\n", event);
static void snep_register_server_cb(net_nfc_snep_handle_h target,
- net_nfc_snep_type_t event,
- net_nfc_error_e result,
- ndef_message_h msg,
- void *user_data)
- {
+ net_nfc_snep_type_t event,
+ net_nfc_error_e result,
+ ndef_message_h msg,
+ void *user_data)
+{
- g_print("snep_register_server_cb Completed %d\n", event);
- g_print("snep_register_server_cb Completed %d\n", result);
+ g_print("snep_register_server_cb Completed %d\n", event);
+ g_print("snep_register_server_cb Completed %d\n", result);
- net_nfc_util_print_ndef_message (msg);
+ net_nfc_util_print_ndef_message (msg);
- run_next_callback(user_data);
- }
+ run_next_callback(user_data);
+}
/*
static void snep_unregister_server_cb(net_nfc_snep_handle_h target,
/******************************API Calls*********************************************/
void net_nfc_test_snep_set_tag_discovered(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
g_print("Waiting for TagDiscovered Singal\n");
void net_nfc_test_snep_start_server(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
result = net_nfc_client_snep_start_server(target_info->handle,
- "urn:nfc:xsn:samsung.com:testllcp",
- 16,
- snep_start_server_cb,
- user_data);
+ "urn:nfc:xsn:samsung.com:testllcp",
+ 16,
+ snep_start_server_cb,
+ user_data);
if(result != NET_NFC_OK)
{
void net_nfc_test_snep_start_server_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
/*
void net_nfc_test_snep_start_client(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
result = net_nfc_client_snep_start_client(target_info->handle,
- "urn:nfc:xsn:samsung.com:testllcp",
- 16,
- snep_start_client_cb,
- user_data);
+ "urn:nfc:xsn:samsung.com:testllcp",
+ 16,
+ snep_start_client_cb,
+ user_data);
if(result != NET_NFC_OK)
{
void net_nfc_test_snep_start_client_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
/*
}
void net_nfc_test_snep_send_client_request(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result= NET_NFC_OK;
net_nfc_error_e error = NET_NFC_OK;
ndef_record_h record = NULL;
if( (error = net_nfc_create_uri_type_record(&record,
- "http://www.naver.com",
- NET_NFC_SCHEMA_FULL_URI)) == NET_NFC_OK)
+ "http://www.naver.com",
+ NET_NFC_SCHEMA_FULL_URI)) == NET_NFC_OK)
+ {
+ if( (error = net_nfc_create_ndef_message(&msg)) == NET_NFC_OK)
{
- if( (error = net_nfc_create_ndef_message(&msg)) == NET_NFC_OK)
- {
- if( (error = net_nfc_append_record_to_ndef_message(
+ if( (error = net_nfc_append_record_to_ndef_message(
msg,
record)) == NET_NFC_OK)
- {
- result = net_nfc_client_snep_send_client_request(
- target_info->handle,
- NET_NFC_SNEP_GET,
- msg,
- snep_send_request_cb,
- user_data);
- }
- }
+ {
+ result = net_nfc_client_snep_send_client_request(
+ target_info->handle,
+ NET_NFC_SNEP_GET,
+ msg,
+ snep_send_request_cb,
+ user_data);
+ }
}
+ }
if(result != NET_NFC_OK)
{
void net_nfc_test_snep_send_client_request_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
/*
void net_nfc_test_snep_register_server(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result= NET_NFC_OK;
result = net_nfc_client_snep_register_server(
- "urn:nfc:xsn:samsung.com:testllcp",
- 16,
- snep_register_server_cb,
- user_data);
+ "urn:nfc:xsn:samsung.com:testllcp",
+ 16,
+ snep_register_server_cb,
+ user_data);
if(result != NET_NFC_OK)
{
}
void net_nfc_test_snep_unregister_server(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result= NET_NFC_OK;
result = net_nfc_client_snep_unregister_server(
- "urn:nfc:xsn:samsung.com:testllcp",
- 16);
+ "urn:nfc:xsn:samsung.com:testllcp",
+ 16);
if(result != NET_NFC_OK)
{
void net_nfc_test_snep_stop_service(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
/*
net_nfc_error_e result= NET_NFC_OK;
void net_nfc_test_snep_stop_service_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result= NET_NFC_OK;
result = net_nfc_client_snep_stop_service_sync(
- target_info->handle,
- snep_handle);
+ target_info->handle,
+ snep_handle);
if(result != NET_NFC_OK)
{
/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://floralicense.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.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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>
static void run_next_callback(gpointer user_data)
{
- if (user_data)
+ if (user_data)
{
GCallback callback;
/********************** Function Calls ******************************/
void net_nfc_test_sys_handler_set_launch_popup_state(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
int enable = 1;
}
void net_nfc_test_sys_handler_get_launch_popup_state(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
int state = 0;
* limitations under the License.
*/
-#ifndef __NET_NFC_CLIENT_UTIL_INTERNAL_H__
-#define __NET_NFC_CLIENT_UTIL_INTERNAL_H__
+#ifndef __NET_NFC_TEST_SYS_HANDLER_H__
+#define __NET_NFC_TEST_SYS_HANDLER_H__
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <glib.h>
+void net_nfc_test_sys_handler_set_launch_popup_state(gpointer data,
+ gpointer user_data);
-#ifdef __cplusplus
-}
-#endif
+void net_nfc_test_sys_handler_get_launch_popup_state(gpointer data,
+ gpointer user_data);
-#endif //__NET_NFC_CLIENT_UTIL_INTERNAL_H__
\ No newline at end of file
+#endif //__NET_NFC_TEST_SYS_HANDLER_H__
static void print_get_current_target_handle(net_nfc_target_handle_h handle);
static void is_tag_connected_completed(net_nfc_error_e result,
- net_nfc_target_type_e dev_type,
- void *user_data);
+ net_nfc_target_type_e dev_type,
+ void *user_data);
static void get_current_tag_info_completed(net_nfc_error_e result,
- net_nfc_target_info_h info,
- void *user_data);
+ net_nfc_target_info_h info,
+ void *user_data);
static void get_current_target_handle_completed(net_nfc_error_e result,
- net_nfc_target_handle_h handle,
- void *user_data);
+ net_nfc_target_handle_h handle,
+ void *user_data);
static void tag_detached(void *user_data);
static void tag_discovered(net_nfc_target_info_h info,
- void *user_data);
+ void *user_data);
static net_nfc_target_info_h global_info = NULL;
{
switch(dev_type)
{
- case NET_NFC_UNKNOWN_TARGET:
- return "Unknown Target";
- case NET_NFC_GENERIC_PICC:
- return "Generic PICC";
- case NET_NFC_ISO14443_A_PICC:
- return "ISO14443 PICC";
- case NET_NFC_ISO14443_4A_PICC:
- return "ISO14443 4A PICC";
- case NET_NFC_ISO14443_3A_PICC:
- return "ISO14443 3A PICC";
- case NET_NFC_MIFARE_MINI_PICC:
- return "Mifare mini PICC";
- case NET_NFC_MIFARE_1K_PICC:
- return "Mifare 1K PICC";
- case NET_NFC_MIFARE_4K_PICC:
- return "Mifare 4K PICC";
- case NET_NFC_MIFARE_ULTRA_PICC:
- return "Mifare Ultra PICC";
- case NET_NFC_MIFARE_DESFIRE_PICC:
- return "Mifare Desfire PICC";
- case NET_NFC_ISO14443_B_PICC:
- return "ISO14443 B PICC";
- case NET_NFC_ISO14443_4B_PICC:
- return "ISO14443 4B PICC";
- case NET_NFC_ISO14443_BPRIME_PICC:
- return "ISO14443 BPRIME PICC";
- case NET_NFC_FELICA_PICC:
- return "Felica PICC";
- case NET_NFC_JEWEL_PICC:
- return "Jewel PICC";
- case NET_NFC_ISO15693_PICC:
- return "ISO15693 PICC";
- case NET_NFC_NFCIP1_TARGET:
- return "NFCIP1 Target";
- case NET_NFC_NFCIP1_INITIATOR:
- return "NFCIP1 Initiator";
- default:
- break;
+ case NET_NFC_UNKNOWN_TARGET:
+ return "Unknown Target";
+ case NET_NFC_GENERIC_PICC:
+ return "Generic PICC";
+ case NET_NFC_ISO14443_A_PICC:
+ return "ISO14443 PICC";
+ case NET_NFC_ISO14443_4A_PICC:
+ return "ISO14443 4A PICC";
+ case NET_NFC_ISO14443_3A_PICC:
+ return "ISO14443 3A PICC";
+ case NET_NFC_MIFARE_MINI_PICC:
+ return "Mifare mini PICC";
+ case NET_NFC_MIFARE_1K_PICC:
+ return "Mifare 1K PICC";
+ case NET_NFC_MIFARE_4K_PICC:
+ return "Mifare 4K PICC";
+ case NET_NFC_MIFARE_ULTRA_PICC:
+ return "Mifare Ultra PICC";
+ case NET_NFC_MIFARE_DESFIRE_PICC:
+ return "Mifare Desfire PICC";
+ case NET_NFC_ISO14443_B_PICC:
+ return "ISO14443 B PICC";
+ case NET_NFC_ISO14443_4B_PICC:
+ return "ISO14443 4B PICC";
+ case NET_NFC_ISO14443_BPRIME_PICC:
+ return "ISO14443 BPRIME PICC";
+ case NET_NFC_FELICA_PICC:
+ return "Felica PICC";
+ case NET_NFC_JEWEL_PICC:
+ return "Jewel PICC";
+ case NET_NFC_ISO15693_PICC:
+ return "ISO15693 PICC";
+ case NET_NFC_NFCIP1_TARGET:
+ return "NFCIP1 Target";
+ case NET_NFC_NFCIP1_INITIATOR:
+ return "NFCIP1 Initiator";
+ default:
+ break;
}
return "Invalid Target";
}
handle_id = GPOINTER_TO_UINT(handle);
g_print("Tag handle %x, Current Tag handle %x\n",
- global_handle_id,
- handle_id);
+ global_handle_id,
+ handle_id);
if (global_handle_id == handle_id)
g_print("Current Tag is matched discovered Tag\n");
}
}
static void is_tag_connected_completed(net_nfc_error_e result,
- net_nfc_target_type_e dev_type,
- void *user_data)
+ net_nfc_target_type_e dev_type,
+ void *user_data)
{
g_print("IsTagConnected Completed %d\n", result);
g_print("--- dev type : %s (%d)\n", tag_type_to_string(dev_type),
- dev_type);
+ dev_type);
if (result == NET_NFC_OK)
print_is_tag_connected(dev_type);
}
static void get_current_tag_info_completed(net_nfc_error_e result,
- net_nfc_target_info_h info,
- void *user_data)
+ net_nfc_target_info_h info,
+ void *user_data)
{
g_print("GetCurrentTagInfo Completed %d\n", result);
}
static void get_current_target_handle_completed(net_nfc_error_e result,
- net_nfc_target_handle_h handle,
- void *user_data)
+ net_nfc_target_handle_h handle,
+ void *user_data)
{
g_print("GetCurrentTargetHandle Completed %d\n", result);
static void tag_discovered(net_nfc_target_info_h info,
- void *user_data)
+ void *user_data)
{
g_print("TagDiscovered\n");
void net_nfc_test_tag_is_tag_connected(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_tag_is_tag_connected(is_tag_connected_completed,
- user_data);
+ user_data);
}
void net_nfc_test_tag_get_current_tag_info(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_tag_get_current_tag_info(get_current_tag_info_completed,
- user_data);
+ user_data);
}
void net_nfc_test_tag_get_current_target_handle(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_tag_get_current_target_handle(
- get_current_target_handle_completed,
- user_data);
+ get_current_target_handle_completed,
+ user_data);
}
void net_nfc_test_tag_is_tag_connected_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
net_nfc_target_type_e dev_type;
}
void net_nfc_test_tag_get_current_tag_info_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
net_nfc_target_info_h info;
}
void net_nfc_test_tag_get_current_target_handle_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
net_nfc_target_handle_h handle;
}
void net_nfc_test_tag_set_tag_discovered(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
g_print("Waiting for TagDiscovered Signal\n");
}
void net_nfc_test_tag_set_tag_detached(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
g_print("Waiting for TagDetached Singal\n");
/*
-* Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
-*
-* Licensed under the Flora License, Version 1.1 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://floralicense.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.
-*/
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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 "net_nfc_test_tag_felica.h"
#include "net_nfc_typedef_internal.h"
static void run_next_callback(gpointer user_data);
static void felica_cb(net_nfc_error_e result,
- data_h resp_data,
- void *user_data);
+ data_h resp_data,
+ void *user_data);
static net_nfc_target_handle_h get_handle()
}
static void felica_cb(net_nfc_error_e result,
- data_h resp_data,
- void *user_data)
+ data_h resp_data,
+ void *user_data)
{
g_print("felica_cb Completed %d\n", result);
}
void net_nfc_test_felica_poll(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
if (handle == NULL)
return ;
- result = net_nfc_client_felica_poll(handle,
- req_code,
- time_slot,
- felica_cb,
- user_data);
+ result = net_nfc_client_felica_poll(handle, req_code, time_slot, felica_cb, user_data);
}
void net_nfc_test_felica_request_service(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
return ;
result = net_nfc_client_felica_request_service(handle,
- number_of_area_service,
- area_service_list,
- number_of_services,
- felica_cb,
- user_data);
+ number_of_area_service,
+ area_service_list,
+ number_of_services,
+ felica_cb,
+ user_data);
}
void net_nfc_test_felica_request_response(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
if (handle == NULL)
return ;
- result = net_nfc_client_felica_request_response(handle,
- felica_cb,
- user_data);
+ result = net_nfc_client_felica_request_response(handle, felica_cb, user_data);
}
void net_nfc_test_felica_read_without_encryption(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
return ;
result = net_nfc_client_felica_read_without_encryption(handle,
- number_of_services,
- service_list,
- number_of_blocks,
- block_list,
- felica_cb,
- user_data);
+ number_of_services,
+ service_list,
+ number_of_blocks,
+ block_list,
+ felica_cb,
+ user_data);
}
void net_nfc_test_felica_write_without_encryption(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
return ;
result = net_nfc_client_felica_write_without_encryption(handle,
- number_of_services,
- service_list,
- number_of_blocks,
- block_list,
- data_to_write,
- felica_cb,
- user_data);
+ number_of_services,
+ service_list,
+ number_of_blocks,
+ block_list,
+ data_to_write,
+ felica_cb,
+ user_data);
}
void net_nfc_test_felica_request_system_code(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
if (handle == NULL)
return ;
- result = net_nfc_client_felica_request_system_code(handle,
- felica_cb,
- user_data);
+ result = net_nfc_client_felica_request_system_code(handle, felica_cb, user_data);
}
*/
-#include "net_nfc_tag_mifare.h"
+#include "net_nfc_client_tag_mifare.h"
#include "net_nfc_test_tag_mifare.h"
#include "net_nfc_target_info.h"
#include "net_nfc_typedef_internal.h"
static net_nfc_target_handle_h tag_get_handle(void);
static void mifare_read_cb(net_nfc_error_e result,
- data_h resp_data,
- void *user_data);
+ data_h resp_data,
+ void *user_data);
static void mifare_write_block_cb(net_nfc_error_e result, void* user_data);
}
static void mifare_read_cb(net_nfc_error_e result,
- data_h resp_data,
- void *user_data)
+ data_h resp_data,
+ void *user_data)
{
g_print("mifare_read_cb Completed %d\n", result);
print_received_data(resp_data);
void net_nfc_test_tag_mifare_read(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
g_print("Handle is %#x\n", GPOINTER_TO_UINT(handle));
result = net_nfc_client_mifare_read(handle,
- block_index,
- mifare_read_cb,
- user_data);
+ block_index,
+ mifare_read_cb,
+ user_data);
}
void net_nfc_test_tag_mifare_write_block(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
g_print("Handle is %#x\n", GPOINTER_TO_UINT(handle));
result = net_nfc_client_mifare_write_block(handle,
- block_index,
- (data_h)& write_data,
- mifare_write_block_cb,
- user_data);
+ block_index,
+ (data_h)& write_data,
+ mifare_write_block_cb,
+ user_data);
}
void net_nfc_test_tag_mifare_write_page(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
g_print("Handle is %#x\n", GPOINTER_TO_UINT(handle));
result = net_nfc_client_mifare_write_page(handle,
- block_index,
- (data_h)& write_data,
- mifare_write_page_cb,
- user_data);
+ block_index,
+ (data_h)& write_data,
+ mifare_write_page_cb,
+ user_data);
}
void net_nfc_test_tag_mifare_increment(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
return;
}
g_print("Handle is %#x\n", GPOINTER_TO_UINT(handle));
+
result = net_nfc_client_mifare_increment(handle,
- block_index,
- value,
- mifare_write_mifare_incr_cb,
- user_data);
+ block_index,
+ value,
+ mifare_write_mifare_incr_cb,
+ user_data);
}
void net_nfc_test_tag_mifare_decrement(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
return;
}
g_print("Handle is %#x\n", GPOINTER_TO_UINT(handle));
+
result = net_nfc_client_mifare_decrement(handle,
- block_index,
- value,
- mifare_write_mifare_decr_cb,
- user_data);
+ block_index,
+ value,
+ mifare_write_mifare_decr_cb,
+ user_data);
}
void net_nfc_test_tag_mifare_transfer(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
return;
}
g_print("Handle is %#x\n", GPOINTER_TO_UINT(handle));
+
result = net_nfc_client_mifare_transfer(handle,
- block_index,
- mifare_write_mifare_transfer_cb,
- user_data);
+ block_index,
+ mifare_write_mifare_transfer_cb,
+ user_data);
}
void net_nfc_test_tag_mifare_restore(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
g_print("Handle is %#x\n", GPOINTER_TO_UINT(handle));
result = net_nfc_client_mifare_restore(handle,
- block_index,
- mifare_write_mifare_restore_cb,
- user_data);
+ block_index,
+ mifare_write_mifare_restore_cb,
+ user_data);
}
void net_nfc_test_tag_mifare_authenticate_with_keyA(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
g_print("default key create %d", result);
result = net_nfc_client_mifare_authenticate_with_keyA(
- handle,
- sector_index,
- auth_key,
- mifare_write_auth_keyA_cb,
- user_data);
+ handle,
+ sector_index,
+ auth_key,
+ mifare_write_auth_keyA_cb,
+ user_data);
}
void net_nfc_test_tag_mifare_authenticate_with_keyB(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
net_nfc_target_handle_h handle = NULL;
g_print("default key create %d", result);
result = net_nfc_client_mifare_authenticate_with_keyB(
- handle,
- sector_index,
- auth_key,
- mifare_write_auth_keyB_cb,
- user_data);
+ handle,
+ sector_index,
+ auth_key,
+ mifare_write_auth_keyB_cb,
+ user_data);
}
static void run_next_callback(gpointer user_data);
static void sim_test_completed(net_nfc_error_e result,
- void *user_data);
+ void *user_data);
static void prbs_test_completed(net_nfc_error_e result,
- void *user_data);
+ void *user_data);
static void get_firmware_version_completed(net_nfc_error_e result,
- char *version,
- void *user_data);
+ char *version,
+ void *user_data);
static void set_ee_data_completed(net_nfc_error_e reuslt,
- void *user_data);
+ void *user_data);
static void sim_test_completed(net_nfc_error_e result,
- void *user_data)
+ void *user_data)
{
g_print("SimTestCompleted Completed %d\n", result);
run_next_callback(user_data);
static void prbs_test_completed(net_nfc_error_e result,
- void *user_data)
+ void *user_data)
{
g_print("PrbsTest Completed %d\n", result);
run_next_callback(user_data);
static void get_firmware_version_completed(net_nfc_error_e result,
- char *version,
- void *user_data)
+ char *version,
+ void *user_data)
{
g_print("GetFirmwareVersion Completed %d: %s\n", result, version);
run_next_callback(user_data);
static void set_ee_data_completed(net_nfc_error_e result,
- void *user_data)
+ void *user_data)
{
g_print("SetEeData Completed %d\n", result);
run_next_callback(user_data);
void net_nfc_test_test_sim_test(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_test_sim_test(sim_test_completed, user_data);
}
void net_nfc_test_test_prbs_test(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
/* FIXME : fill right value */
uint32_t tech = 0;
uint32_t rate = 0;
net_nfc_client_test_prbs_test(tech,
- rate,
- prbs_test_completed,
- user_data);
+ rate,
+ prbs_test_completed,
+ user_data);
}
void net_nfc_test_test_get_firmware_version(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_client_test_get_firmware_version(
- get_firmware_version_completed,
- user_data);
+ get_firmware_version_completed,
+ user_data);
}
void net_nfc_test_test_set_ee_data(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
/* FIXME : fill right value */
data_h ee_data = (data_h)data;
net_nfc_client_test_set_ee_data(mode,
- reg_id,
- ee_data,
- set_ee_data_completed,
- user_data);
+ reg_id,
+ ee_data,
+ set_ee_data_completed,
+ user_data);
}
void net_nfc_test_test_sim_test_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
result = net_nfc_client_test_sim_test_sync();
void net_nfc_test_test_prbs_test_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
void net_nfc_test_test_get_firmware_version_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
char *version = NULL;
void net_nfc_test_test_set_ee_data_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result;
data_h ee_data = (data_h)data;
result = net_nfc_client_test_set_ee_data_sync(mode,
- reg_id,
- ee_data);
+ reg_id,
+ ee_data);
g_print("SetEeData: %d\n", result);
run_next_callback(user_data);
static void call_transceive_data_cb(net_nfc_error_e result,
- data_h resp_data,
- void *user_data);
+ data_h resp_data,
+ void *user_data);
static void call_transceive_cb(net_nfc_error_e result,
- void* user_data);
+ void* user_data);
static void run_next_callback(gpointer user_data);
static void call_transceive_cb(net_nfc_error_e result,
- void* user_data)
+ void* user_data)
{
g_print("call_transceive_cb Completed %d\n", result);
}
static void call_transceive_data_cb(net_nfc_error_e result,
- data_h resp_data,
- void *user_data)
+ data_h resp_data,
+ void *user_data)
{
g_print("call_transceive_data_cb Completed %d\n", result);
print_received_data(resp_data);
}
void net_nfc_test_transceive(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
data_s raw_data = {NULL,};
net_nfc_get_tag_handle(info, &handle);
result =net_nfc_client_transceive(handle,
- (data_h)&raw_data,
- call_transceive_cb,
- user_data);
+ (data_h)&raw_data,
+ call_transceive_cb,
+ user_data);
}
void net_nfc_test_transceive_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
data_s raw_data = {NULL,};
}
void net_nfc_test_transceive_data(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
data_s raw_data = {NULL,};
net_nfc_get_tag_handle(info, &handle);
result = net_nfc_client_transceive_data(handle,
- (data_h) &raw_data,
- call_transceive_data_cb,
- user_data);
+ (data_h) &raw_data,
+ call_transceive_data_cb,
+ user_data);
}
void net_nfc_test_transceive_data_sync(gpointer data,
- gpointer user_data)
+ gpointer user_data)
{
net_nfc_error_e result = NET_NFC_OK;
data_s raw_data = {NULL};
net_nfc_get_tag_handle(info, &handle);
- result = net_nfc_client_transceive_data_sync(handle,
- &raw_data,
- &response);
- print_received_data(response);
+ result = net_nfc_client_transceive_data_sync(handle, &raw_data, &response);
+
+ if (NET_NFC_OK == result)
+ print_received_data(response);
}
--- /dev/null
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/client/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+SET(BT_PARING "bt-paring")
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/ BT_SRC)
+
+pkg_check_modules(bt_pkgs REQUIRED bluetooth-api)
+
+FOREACH(flag ${bt_pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_EXECUTABLE(${BT_PARING} ${BT_SRC})
+
+TARGET_LINK_LIBRARIES(${BT_PARING} ${bt_pkgs_LDFLAGS} pthread nfc)
+
+INSTALL(TARGETS ${BT_PARING} DESTINATION bin)
--- /dev/null
+/*
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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 <stdlib.h>
+
+#include <bluetooth-api.h>
+#include <glib.h>
+
+#include <net_nfc.h>
+
+#include <pthread.h>
+
+void bt_event_callback(int event, bluetooth_event_param_t* param, void *user_data);
+void bt_test_bond_device(bluetooth_device_address_t* bt_address);
+GMainLoop* main_loop = NULL;
+
+void initialize()
+{
+ if(!g_thread_supported())
+ {
+ g_thread_init(NULL);
+ }
+
+ dbus_g_thread_init();
+ g_type_init();
+}
+
+
+int main()
+{
+ initialize();
+
+ //bluetooth_enable_adapter();
+
+ //main_loop = g_main_loop_new(NULL, FALSE);
+ //g_main_loop_run(main_loop);
+
+#if 1
+
+ ndef_message_h ndef_message = NULL;
+ net_nfc_conn_handover_info_h conn_handover_info = NULL;
+
+
+ if(net_nfc_retrieve_current_ndef_message(&ndef_message) == NET_NFC_OK)
+ {
+ printf("retrieve ndef message from nfc storage \n");
+
+ int count = 0;
+
+ net_nfc_get_ndef_message_record_count(ndef_message, &count);
+
+ int i = 0;
+ while(i < count)
+ {
+ ndef_record_h record = NULL;
+ net_nfc_get_record_by_index(ndef_message, i++, &record);
+
+ if (record != NULL)
+ {
+
+ net_nfc_record_tnf_e TNF = NET_NFC_RECORD_EMPTY;
+ data_h record_type = NULL;
+
+ if ((net_nfc_get_record_tnf(record, &TNF) == NET_NFC_OK)
+ && (net_nfc_get_record_type(record, &record_type) == NET_NFC_OK ))
+ {
+
+ uint8_t* buffer = net_nfc_get_data_buffer(record_type);
+ int buffer_length = net_nfc_get_data_length(record_type);
+
+ // record is WTK and Hs
+ if((TNF == NET_NFC_RECORD_WELL_KNOWN_TYPE) && (buffer != NULL)
+ && (buffer_length > 1) && (buffer[0] == 'H') && (buffer[1] == 's'))
+ {
+ printf("record is found \n");
+ net_nfc_parse_connection_handover_ndef_message(ndef_message, &conn_handover_info);
+
+ if (conn_handover_info != NULL)
+ {
+ uint8_t carrier_count = 0;
+ net_nfc_get_connection_handover_alternative_carrier_count(conn_handover_info, &carrier_count);
+
+ int j = 0;
+ while(j < carrier_count)
+ {
+ net_nfc_conn_handover_carrier_info_h carrier_info = NULL;
+ net_nfc_get_connection_handover_carrier_handle_by_index(conn_handover_info, j++, &carrier_info);
+
+ if(carrier_info != NULL)
+ {
+ data_h configuration = NULL;
+ net_nfc_get_carrier_configuration(carrier_info, &configuration);
+
+ if(configuration != NULL)
+ {
+ uint8_t* buffer = net_nfc_get_data_buffer(configuration);
+ if(buffer != NULL)
+ {
+ printf("bt addr [%X][%X][%X][%X][%X][%X] \n", buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7]);
+ bluetooth_device_address_t bt_address = {{buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7]}};
+ bt_test_bond_device(&bt_address);
+ }
+ else
+ printf("buffer is NULL");
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+#endif
+ return 0;
+}
+
+void bt_test_bond_device(bluetooth_device_address_t* bt_address)
+{
+ int ret_val;
+
+ ret_val = bluetooth_register_callback(bt_event_callback, NULL);
+
+ if (ret_val >= BLUETOOTH_ERROR_NONE)
+ {
+ printf("bluetooth_register_callback returned Success");
+ }
+ else
+ {
+ printf("bluetooth_register_callback returned failiure [0x%04x]", ret_val);
+ return ;
+ }
+
+ ret_val = bluetooth_check_adapter();
+
+ if (ret_val < BLUETOOTH_ERROR_NONE)
+ {
+ printf("bluetooth_check_adapter returned failiure [0x%04x]", ret_val);
+ }
+ else
+ {
+ printf("BT state [0x%04x]", ret_val);
+ }
+
+ int error = 0;
+
+ if((error = bluetooth_bond_device(bt_address)) < 0)
+ {
+ printf("Api failed: %d", error);
+ }
+ else
+ {
+ main_loop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(main_loop);
+ }
+
+}
+
+void bt_event_callback(int event, bluetooth_event_param_t* param, void *user_data)
+{
+ switch(event)
+ {
+ case BLUETOOTH_EVENT_ENABLED:
+ printf("BLUETOOTH_EVENT_ENABLED:\n");
+ break;
+ case BLUETOOTH_EVENT_DISABLED:
+ printf("BLUETOOTH_EVENT_DISABLED:\n");
+ break;
+ case BLUETOOTH_EVENT_LOCAL_NAME_CHANGED:
+ printf("BLUETOOTH_EVENT_LOCAL_NAME_CHANGED:\n");
+ break;
+ case BLUETOOTH_EVENT_DISCOVERY_STARTED:
+ printf("BLUETOOTH_EVENT_DISCOVERY_STARTED:\n");
+ break;
+ case BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:
+ printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:\n");
+ break;
+ case BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:
+ printf("BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:\n");
+ break;
+ case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
+ printf("BLUETOOTH_EVENT_DISCOVERY_FINISHED:\n");
+ break;
+ case BLUETOOTH_EVENT_BONDING_FINISHED:
+ printf("BLUETOOTH_EVENT_BONDING_FINISHED:\n");
+
+ if (param->result >= BLUETOOTH_ERROR_NONE)
+ {
+ bluetooth_device_info_t *device_info = NULL;
+ device_info = (bluetooth_device_info_t *)param->param_data;
+ printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X] mjr[%#x] min[%#x] srv[%#x] \n", device_info->device_name.name, \
+ device_info->device_address.addr[0], device_info->device_address.addr[1], device_info->device_address.addr[2], \
+ device_info->device_address.addr[3], device_info->device_address.addr[4], device_info->device_address.addr[5], \
+ device_info->device_class.major_class, device_info->device_class.minor_class, device_info->device_class.service_class);
+ }
+
+ g_main_loop_quit (main_loop);
+
+ break;
+ default:
+ printf("BLUETOOTH_EVENT = [%d]:\n", event);
+ break;
+ }
+}
--- /dev/null
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/client/include)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+SET(NDEF_TOOL "ndef-tool")
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/ TOOL_SRC)
+
+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)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_EXECUTABLE(${NDEF_TOOL} ${TOOL_SRC})
+
+TARGET_LINK_LIBRARIES(${NDEF_TOOL} ${tool_pkgs_LDFLAGS} pthread dl rt nfc)
+
+INSTALL(TARGETS ${NDEF_TOOL} DESTINATION bin)
+
+
/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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.
- */
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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>
uint32_t length = net_nfc_get_data_length(data);
fprintf(stdout, " Version : %d.%d\n", ((*buffer) >> 4) & 0x0F,
- (*buffer) & 0x0F);
+ (*buffer) & 0x0F);
fprintf(stdout, " -- Containing NDEF message -- \n");
ndef_message_h msg;
uint32_t length = net_nfc_get_data_length(data);
fprintf(stdout, " Version : %d.%d\n", ((*buffer) >> 4) & 0x0F,
- (*buffer) & 0x0F);
+ (*buffer) & 0x0F);
fprintf(stdout, " -- Containing NDEF message -- \n");
ndef_message_h msg;
net_nfc_get_record_tnf(record, &tnf);
if (tnf != NET_NFC_RECORD_EMPTY &&
- tnf != NET_NFC_RECORD_UNKNOWN &&
- tnf != NET_NFC_RECORD_UNCHAGNED)
+ tnf != NET_NFC_RECORD_UNKNOWN &&
+ tnf != NET_NFC_RECORD_UNCHAGNED)
{
data_h data;
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));
+ net_nfc_get_record_cf(header), net_nfc_get_record_sr(header), net_nfc_get_record_il(header));
_display_tnf(record);
/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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.
- */
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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>
/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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.
- */
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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>
}
static void _handover_completed_cb(net_nfc_error_e result,
- data_h data, void *user_data)
+ data_h data, void *user_data)
{
-// response_context_t *context = (response_context_t *)user_data;
-// data_h rawdata;
+ // response_context_t *context = (response_context_t *)user_data;
+ // data_h rawdata;
if (result == NET_NFC_OK)
fprintf(stdout, "handover success!!!\n\n");
else
fprintf(stdout, "handover failed.\n\n");
-// net_nfc_create_rawdata_from_ndef_message((ndef_message_h)context->user_param, &rawdata);
-//
-// net_nfc_ex
+ // net_nfc_create_rawdata_from_ndef_message((ndef_message_h)context->user_param, &rawdata);
+ //
+ // net_nfc_ex
g_main_loop_quit(main_loop);
}
static void _send_apdu_se_cb(net_nfc_error_e result, net_nfc_target_handle_h handle, void *user_data)
{
-// response_context_t *context = (response_context_t *)user_data;
-// data_h rawdata;
+ // response_context_t *context = (response_context_t *)user_data;
+ // data_h rawdata;
if (result == NET_NFC_OK)
{
fprintf(stdout, "\ntry to handover...\n\n");
net_nfc_exchanger_request_connection_handover(handle,
- NET_NFC_CONN_HANDOVER_CARRIER_BT);
+ NET_NFC_CONN_HANDOVER_CARRIER_BT);
}
void _nfc_response_cb(net_nfc_message_e message, net_nfc_error_e result,
- void *data, void *user_param, void *trans_data)
+ void *data, void *user_param, void *trans_data)
{
response_context_t *context = (response_context_t *)user_param;
{
int ret = 0;
- if (!g_thread_supported())
- {
- g_thread_init(NULL);
- }
-
ret = net_nfc_initialize();
if (ret == NET_NFC_OK)
{
/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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.
- */
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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>
static GMainLoop *main_loop = NULL;
void _activation_complete_cb(net_nfc_message_e message, net_nfc_error_e result,
- void *data, void *user_param, void *trans_data)
+ void *data, void *user_param, void *trans_data)
{
switch (message)
{
#define __COMPARE_OPTION(__dst, __s, __l) \
((__IS_SHORT_OPTION(__dst) && ((__dst)[1] == (__s))) || \
- (__IS_LONG_OPTION(__dst) && (strcmp((__dst) + 2, (__l)) == 0)))
+ (__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; \
- }
+ if (++i >= argc || __IS_OPTION(argv[i]) == true) \
+ { \
+ operation = OPERATION_ERROR; \
+ break; \
+ }
int main(int argc, char *argv[])
{
* Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
-
+ *
* http://floralicense.org/license/
*
* Unless required by applicable law or agreed to in writing, software
--- /dev/null
+LINK_DIRECTORIES(${CMAKE_BINARY_DIR})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/common/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/client/include)
+
+SET(NFC_CLIENT "nfc-client")
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/ TOOL_SRC)
+
+IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+ SET(CMAKE_BUILD_TYPE "Release")
+ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "")
+
+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)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
+
+ADD_EXECUTABLE(${NFC_CLIENT} ${TOOL_SRC})
+TARGET_LINK_LIBRARIES(${NFC_CLIENT} ${tool_pkgs_LDFLAGS} pthread dl rt nfc)
+
+INSTALL(TARGETS ${NFC_CLIENT} DESTINATION bin)
+
+
/*
- * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
-
- * http://floralicense.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.
- */
+ * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.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>
static nfcTestType nfcTestMatrix[] =
{
-// {"API STRESS_WRITE_READ TEST", nfcTestReadWriteMode, NET_NFC_TEST_NOT_YET}, // OK
-// {"Remove tag while writing", nfcTestWriteMode, NET_NFC_TEST_NOT_YET}, //OK
-// {"Remove tag while reading", nfcTestAPIBasicTest2, NET_NFC_TEST_NOT_YET}, // OK
+ // {"API STRESS_WRITE_READ TEST", nfcTestReadWriteMode, NET_NFC_TEST_NOT_YET}, // OK
+ // {"Remove tag while writing", nfcTestWriteMode, NET_NFC_TEST_NOT_YET}, //OK
+ // {"Remove tag while reading", nfcTestAPIBasicTest2, NET_NFC_TEST_NOT_YET}, // OK
//{"API BASIC TEST3", nfcTestAPIBasicTest3, NET_NFC_TEST_NOT_YET},
-// {"API MUTIPLE REQUEST", nfcTestAPIMultipleRequest, NET_NFC_TEST_NOT_YET}, // OK
-// {"API BASIC TEST1", nfcTestAPIBasicTest1, NET_NFC_TEST_NOT_YET}, // OK
-// {"Check NDEF message", nfcTestNdefParser, NET_NFC_TEST_NOT_YET}, // OK
-// {"write mode", nfcTestWriteMode, NET_NFC_TEST_NOT_YET},
-// {"reader mode", nfcTestReaderMode, NET_NFC_TEST_NOT_YET},
-// {"format ndef", nfcTestFormatNdef, NET_NFC_TEST_NOT_YET},
-// {"internal_se_test", nfcTestInternalSe, NET_NFC_TEST_NOT_YET},
-// {"exchange mode", nfcTestExchanger, NET_NFC_TEST_NOT_YET},
-// {"Transceive Test", nfcTestTransceive, NET_NFC_TEST_NOT_YET},
-// {"LLCP Test", nfcTestLLCP, NET_NFC_TEST_NOT_YET},
-// {"connection handover msg test", nfcConnHandover, NET_NFC_TEST_NOT_YET},
-// {"API Exception Test", nfcTestAPIException, NET_NFC_TEST_NOT_YET},
-// {"API Exception Test2", nfcTestAPIException_tagAPI, NET_NFC_TEST_NOT_YET},
-/// {"API Exception Test3", nfcTestAPIException_targetInfo, NET_NFC_TEST_NOT_YET},
-// {"LLCP Test", nfcTestLLCP, NET_NFC_TEST_NOT_YET},
-// {"LLCP Test", nfcTestStressLLCP, NET_NFC_TEST_NOT_YET},
-// {"Handover Message", nfcConnHandoverMessageTest , NET_NFC_TEST_NOT_YET},
+ // {"API MUTIPLE REQUEST", nfcTestAPIMultipleRequest, NET_NFC_TEST_NOT_YET}, // OK
+ // {"API BASIC TEST1", nfcTestAPIBasicTest1, NET_NFC_TEST_NOT_YET}, // OK
+ // {"Check NDEF message", nfcTestNdefParser, NET_NFC_TEST_NOT_YET}, // OK
+ // {"write mode", nfcTestWriteMode, NET_NFC_TEST_NOT_YET},
+ // {"reader mode", nfcTestReaderMode, NET_NFC_TEST_NOT_YET},
+ // {"format ndef", nfcTestFormatNdef, NET_NFC_TEST_NOT_YET},
+ // {"internal_se_test", nfcTestInternalSe, NET_NFC_TEST_NOT_YET},
+ // {"exchange mode", nfcTestExchanger, NET_NFC_TEST_NOT_YET},
+ // {"Transceive Test", nfcTestTransceive, NET_NFC_TEST_NOT_YET},
+ // {"LLCP Test", nfcTestLLCP, NET_NFC_TEST_NOT_YET},
+ // {"connection handover msg test", nfcConnHandover, NET_NFC_TEST_NOT_YET},
+ // {"API Exception Test", nfcTestAPIException, NET_NFC_TEST_NOT_YET},
+ // {"API Exception Test2", nfcTestAPIException_tagAPI, NET_NFC_TEST_NOT_YET},
+ /// {"API Exception Test3", nfcTestAPIException_targetInfo, NET_NFC_TEST_NOT_YET},
+ // {"LLCP Test", nfcTestLLCP, NET_NFC_TEST_NOT_YET},
+ // {"LLCP Test", nfcTestStressLLCP, NET_NFC_TEST_NOT_YET},
+ // {"Handover Message", nfcConnHandoverMessageTest , NET_NFC_TEST_NOT_YET},
{"snep test", nfcTestSnep, NET_NFC_TEST_NOT_YET},
{NULL, NULL, NET_NFC_TEST_NOT_YET},
};
/* Below smart poster data can has problem or parser has some problem.
Need to check */
uint8_t nfcTestSpHex[]= {0xD1,0x02,0x37,0x53,0x70,0x91,0x01,0x18,0x54,0x04,
- 0x74,0x65,0x73,0x74,0x53,0x6D,0x61,0x72,0x74,0x70,
- 0x6F,0x73,0x74,0x65,0x72,0x20,0x45,0x78,0x61,0x6D,
- 0x70,0x6C,0x65,0x11,0x03,0x01,0x61,0x63,0x74,0x00,
- 0x51,0x01,0x10,0x55,0x00,0x77,0x77,0x77,0x2E,0x73,
- 0x61,0x6D,0x73,0x75,0x6E,0x67,0x2E,0x63,0x6F,0x6D};
+ 0x74,0x65,0x73,0x74,0x53,0x6D,0x61,0x72,0x74,0x70,
+ 0x6F,0x73,0x74,0x65,0x72,0x20,0x45,0x78,0x61,0x6D,
+ 0x70,0x6C,0x65,0x11,0x03,0x01,0x61,0x63,0x74,0x00,
+ 0x51,0x01,0x10,0x55,0x00,0x77,0x77,0x77,0x2E,0x73,
+ 0x61,0x6D,0x73,0x75,0x6E,0x67,0x2E,0x63,0x6F,0x6D};
/*
-uint8_t nfcTestSp[]={0xD1,0x02,0x24,0x53,0x70,0x91,0x01,0x14,0x54
- ,0x00,0x53,0x6D,0x61,0x72,0x74,0x70,0x6F,0x73
- ,0x74,0x65,0x72,0x20,0x45,0x78,0x61,0x6D,0x70
- ,0x6C,0x65,0x11,0x03,0x01,0x61,0x63,0x74,0x00
- ,0x51,0x01,0x01,0x55,0x00};
-*/
+ uint8_t nfcTestSp[]={0xD1,0x02,0x24,0x53,0x70,0x91,0x01,0x14,0x54
+ ,0x00,0x53,0x6D,0x61,0x72,0x74,0x70,0x6F,0x73
+ ,0x74,0x65,0x72,0x20,0x45,0x78,0x61,0x6D,0x70
+ ,0x6C,0x65,0x11,0x03,0x01,0x61,0x63,0x74,0x00
+ ,0x51,0x01,0x01,0x55,0x00};
+ */
// test Text "Samsung Linux Platform NFC TEST"
uint8_t nfcTestTextHex[]= {0xD1,0x01,0x20,0x54,0x00,0x53,0x61,0x6D,0x73,0x75
- ,0x6E,0x67,0x20,0x4C,0x69,0x6E,0x75,0x78,0x20,0x50
- ,0x6C,0x61,0x74,0x66,0x6F,0x72,0x6D,0x20,0x4E,0x46
- ,0x43,0x20,0x54,0x45,0x53,0x54};
+ ,0x6E,0x67,0x20,0x4C,0x69,0x6E,0x75,0x78,0x20,0x50
+ ,0x6C,0x61,0x74,0x66,0x6F,0x72,0x6D,0x20,0x4E,0x46
+ ,0x43,0x20,0x54,0x45,0x53,0x54};
// test URI "http://www.samsunglinuxplatform.nfctest.com"
uint8_t nfcTestUriHex[]={0xD1,0x01,0x2C,0x55,0x00,0x68,0x74,0x74,0x70,0x3A
- ,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x73,0x61,0x6D,0x73
- ,0x75,0x6E,0x67,0x6C,0x69,0x6E,0x75,0x78,0x70,0x6C
- ,0x61,0x74,0x66,0x6F,0x72,0x6D,0x2E,0x6E,0x66,0x63
- ,0x74,0x65,0x73,0x74,0x2E,0x63,0x6F,0x6D};
+ ,0x2F,0x2F,0x77,0x77,0x77,0x2E,0x73,0x61,0x6D,0x73
+ ,0x75,0x6E,0x67,0x6C,0x69,0x6E,0x75,0x78,0x70,0x6C
+ ,0x61,0x74,0x66,0x6F,0x72,0x6D,0x2E,0x6E,0x66,0x63
+ ,0x74,0x65,0x73,0x74,0x2E,0x63,0x6F,0x6D};
uint8_t nfcTestText[] = "payload http://www.samsunglinuxplatform.nfctest.com";
uint8_t nfcTestUri[] = {0xD1,0x01,0x13,0x55,0x1,0x73,0x61,0x6D,0x73,0x75,0x6E,0x67,0x6D,0x6F,0x62,0x69,0x6C,0x65,0x2E,0x63,0x6F,0x6D,0x2F};
net_nfc_error_e error = NET_NFC_OK;
data_h payload = NULL;
-/*
+ /*
uint8_t buffer[1024] = {0};
int i = 0;
}
net_nfc_create_data(&payload, buffer, 1024);
-*/
+ */
if((error = net_nfc_create_exchanger_data(&ex_data, payload/*(uint8_t *)"http://www.samsung.com"*/)) == NET_NFC_OK)
//if((error = net_nfc_create_exchanger_url_type_data(&ex_data, NET_NFC_SCHEMA_FULL_URI, (uint8_t *)"file://test.txt")) == NET_NFC_OK)
{
//int user_context;
- PRINT_INFO("user_param = [%p] trans_param = [%p]", user_param, trans_data);
+ PRINT_INFO("user_param = [%d] trans_param = [%d]", (int)user_param, (int)trans_data);
switch(message)
{
net_nfc_get_tag_handle(target_info, &id);
net_nfc_get_tag_ndef_support (target_info, &is_ndef);
PRINT_INFO("target type: %d\n", type);
- PRINT_INFO("target id: %p\n", id);
+ PRINT_INFO("target id: %X\n", (unsigned int)id);
PRINT_INFO("Is NDEF supoort: %d\n", is_ndef);
if (is_ndef){
{
//int user_context;
- PRINT_INFO("user_param = [%p] trans_param = [%p]", user_param, trans_data);
+ PRINT_INFO("user_param = [%d] trans_param = [%d]", (int)user_param, (int)trans_data);
switch(message)
{
net_nfc_get_tag_handle(target_info, &id);
net_nfc_get_tag_ndef_support (target_info, &is_ndef);
PRINT_INFO("target type: %d\n", type);
- PRINT_INFO("target id: %p\n", id);
+ PRINT_INFO("target id: %X\n", (unsigned int)id);
PRINT_INFO("Is NDEF supoort: %d\n", is_ndef);
data_h ndef_key = NULL;
break;
case NET_NFC_MESSAGE_OPEN_INTERNAL_SE :
{
- PRINT_INFO("NET_NFC_MESSAGE_OPEN_INTERNAL_SE result = [%p] and handle = [%p]", result, data);
+ PRINT_INFO("NET_NFC_MESSAGE_OPEN_INTERNAL_SE result = [%d] and handle = [0x%x]", result, (unsigned int)data);
data_h apdu = NULL;
uint8_t apdu_cmd[4] = {0x00, 0xA4, 0x00, 0x0C} ; // CLA 0-> use default channel and no secure message. 0xA4 -> select instruction
net_nfc_create_data(&apdu, apdu_cmd, 4);
break;
}
- PRINT_INFO("user_param = [%p] trans_param = [%p]", user_param, trans_data);
+ PRINT_INFO("user_param = [%d] trans_param = [%d]", (int)user_param, (int)trans_data);
}
/*=================================================================================*/
net_nfc_get_tag_handle(target_info, &id);
net_nfc_get_tag_ndef_support (target_info, &is_ndef);
PRINT_INFO("target type: %d\n", type);
- PRINT_INFO("target id: %p\n", id);
+ PRINT_INFO("target id: %X\n", (unsigned int)id);
PRINT_INFO("Is NDEF supoort: %d\n", is_ndef);
if (is_ndef){
{
PRINT_INFO("%s is start", __func__);
- int user_context = 0;
+ //int user_context = 0;
net_nfc_error_e result;
test_case_result = NET_NFC_TEST_FAIL;
net_nfc_get_tag_handle (target_info, &handle);
net_nfc_get_tag_ndef_support (target_info, &is_ndef);
PRINT_INFO("target type: %d\n", type);
- PRINT_INFO("target id: %p\n", handle);
+ PRINT_INFO("target id: %X\n", (unsigned int)handle);
PRINT_INFO("Is NDEF supoort: %d\n", is_ndef);
tag_handle = handle;
net_nfc_get_tag_handle (target_info, &id);
net_nfc_get_tag_ndef_support (target_info, &is_ndef);
PRINT_INFO("target type: %d\n", type);
- PRINT_INFO("target id: %p\n", id);
+ PRINT_INFO("target id: %X\n", (unsigned int)id);
PRINT_INFO("Is NDEF supoort: %d\n", is_ndef);
tag_handle = id;
net_nfc_get_tag_handle (target_info, &handle);
net_nfc_get_tag_ndef_support (target_info, &is_ndef);
PRINT_INFO("target type: %d\n", type);
- PRINT_INFO("target handle: %p\n", handle);
+ PRINT_INFO("target handle: %X\n", (unsigned int)handle);
PRINT_INFO("Is NDEF supoort: %d\n", is_ndef);
test_case_result = NET_NFC_TEST_OK;
net_nfc_get_tag_ndef_support (target_info, &is_ndef);
PRINT_INFO("target type: %d\n", type);
- PRINT_INFO("target handle: %p\n", id);
+ PRINT_INFO("target handle: %X\n", (unsigned int)id);
PRINT_INFO("Is NDEF supoort: %d\n", is_ndef);
char** keys = NULL;
net_nfc_get_tag_handle (target_info, &handle);
net_nfc_get_tag_ndef_support (target_info, &is_ndef);
PRINT_INFO("target type: %d\n", type);
- PRINT_INFO("target handle: %p\n", handle);
+ PRINT_INFO("target handle: %X\n", (unsigned int)handle);
PRINT_INFO("Is NDEF supoort: %d\n", is_ndef);
if(is_ndef)
net_nfc_get_tag_handle (target_info, &handle);
net_nfc_get_tag_ndef_support (target_info, &is_ndef);
PRINT_INFO("target type: %d\n", type);
- PRINT_INFO("target handle: %p\n", handle);
+ PRINT_INFO("target handle: %X\n", (unsigned int)handle);
PRINT_INFO("Is NDEF supoort: %d\n", is_ndef);
if(is_ndef)
if(net_nfc_get_record_type(record, &type) == NET_NFC_OK && net_nfc_get_record_payload(record, &payload) == NET_NFC_OK)
{
- if(strcmp((char*)net_nfc_get_data_buffer(type), "Sp") == 0)
+ if(strcmp((const char*)net_nfc_get_data_buffer(type), "Sp") == 0)
{
}
- else if(strcmp((char*)net_nfc_get_data_buffer(type), "T") == 0)
+ else if(strcmp((const char*)net_nfc_get_data_buffer(type), "T") == 0)
{
net_nfc_encode_type_e utf;
if(net_nfc_get_encoding_type_from_text_record(record, &utf) == NET_NFC_OK)
{
- PRINT_INFO("utf = [%d]", utf);
+ PRINT_INFO("utf = [%X]", utf);
}
else
{
test_case_result = NET_NFC_TEST_OK;
*/
}
- else if(strcmp((char*)net_nfc_get_data_buffer(type), "U") == 0)
+ else if(strcmp((const char*)net_nfc_get_data_buffer(type), "U") == 0)
{
}
//_//net_nfc_ndef_print_message (uriMsg);
- result = net_nfc_create_data (&type_data ,(uint8_t*)"U", 1);
+ result = net_nfc_create_data (&type_data ,(const uint8_t*)"U", 1);
CHECK_RESULT(result);
result = net_nfc_search_record_by_type (uriMsg ,NET_NFC_RECORD_WELL_KNOWN_TYPE ,type_data ,&record);
result = net_nfc_create_rawdata_from_ndef_message (uriMsg, &raw_data);
CHECK_RESULT(result);
- result = net_nfc_create_data (&type_data, (uint8_t*)smart_poster_type, strlen (smart_poster_type));
+ result = net_nfc_create_data (&type_data, (const uint8_t*)smart_poster_type, strlen (smart_poster_type));
if (result != NET_NFC_OK) {
net_nfc_free_data(raw_data);
net_nfc_free_data(type_data);
PRINT_INFO ("LLCP connect is completed with error code %d", result);
data_h data;
char * str = "Client message: Hello, server!";
- net_nfc_create_data (&data, (uint8_t*)str ,strlen (str) + 1);
+ net_nfc_create_data (&data, (const uint8_t*)str ,strlen (str) + 1);
net_nfc_send_llcp (client_socket, data, NULL);
net_nfc_free_data(data);
}
data_h data;
char * str = "Server message: Welcome NFC llcp world!";
- net_nfc_create_data (&data, (uint8_t*)str ,strlen (str) + 1);
+ net_nfc_create_data (&data, (const uint8_t*)str ,strlen (str) + 1);
net_nfc_send_llcp (accepted_socket, data, NULL);
net_nfc_free_data(data);
}
PRINT_INFO ("LLCP connect is completed with error code %d", result);
data_h data;
char * str = "Client message: Hello, server!";
- net_nfc_create_data (&data, (uint8_t*)str ,strlen (str) + 1);
+ net_nfc_create_data (&data, (const uint8_t*)str ,strlen (str) + 1);
net_nfc_send_llcp (client_socket, data, NULL);
net_nfc_free_data(data);
}
data_h data;
char * str = "Server message: Welcome NFC llcp world!";
- net_nfc_create_data (&data, (uint8_t*)str ,strlen (str) + 1);
+ net_nfc_create_data (&data, (const uint8_t*)str ,strlen (str) + 1);
net_nfc_send_llcp (server_socket, data, NULL);
net_nfc_free_data(data);
}
net_nfc_get_tag_handle (target_info, &id);
net_nfc_get_tag_ndef_support (target_info, &is_ndef);
PRINT_INFO("target type: %d\n", type);
- PRINT_INFO("target id: %p\n", id);
+ PRINT_INFO("target id: %X\n", (unsigned int)id);
PRINT_INFO("Is NDEF supoort: %d\n", is_ndef);
net_nfc_deinitialize (); // Before calling transceive
net_nfc_target_handle_h id;
data_h key;
char data [] = {0xff,0xff,0xff,0xff,0xff,0xff};
- net_nfc_create_data (&key, (uint8_t*)data, 6);
+ net_nfc_create_data (&key, (const uint8_t*)data, 6);
net_nfc_get_tag_handle (target_info, &id);
net_nfc_deinitialize();
if (NET_NFC_OK == net_nfc_format_ndef(id, key, NULL)){
* Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
-
+ *
* http://floralicense.org/license/
*
* Unless required by applicable law or agreed to in writing, software