From f57591e76d9450227f027c29556c38904b77fe45 Mon Sep 17 00:00:00 2001 From: Youngjae Shin Date: Thu, 29 Aug 2013 14:02:15 +0900 Subject: [PATCH] fix build warning Change-Id: I9ff2e947089c86b3da252a0c1cdf457836cbb9f4 --- common/net_nfc_util_internal.h | 18 ---- daemon/net_nfc_server_handover_bss.c | 97 ++++++-------------- daemon/net_nfc_server_handover_bt.c | 23 +++-- daemon/net_nfc_server_process_handover.c | 151 +------------------------------ daemon/net_nfc_server_util.c | 6 +- tests/net_nfc_test_handover.c | 5 +- tests/net_nfc_test_jewel.c | 16 ++-- tests/net_nfc_test_jewel.h | 2 +- tests/net_nfc_test_p2p.h | 35 ++----- tests/net_nfc_test_se.c | 78 ++++++---------- tests/net_nfc_test_tag_felica.c | 29 +++--- tests/net_nfc_test_tag_mifare.c | 44 +++++---- tests/net_nfc_test_transceive.c | 17 ++-- 13 files changed, 148 insertions(+), 373 deletions(-) diff --git a/common/net_nfc_util_internal.h b/common/net_nfc_util_internal.h index 16d3a8b..0f3034b 100644 --- a/common/net_nfc_util_internal.h +++ b/common/net_nfc_util_internal.h @@ -26,24 +26,6 @@ #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 \ - { \ - uint16_t __x = htons(*(uint16_t *)(__array + 4)); \ - *(uint32_t *)(__array + 2) = htonl(*(uint32_t *)(__array)); \ - *(uint16_t *)(__array) = __x; \ - } while (0) - -#define NET_NFC_REVERSE_ORDER_16_BYTES(array) \ - do \ - { \ - uint32_t __x1 = htonl(*(uint32_t *)(array + 12)); \ - uint32_t __x2 = htonl(*(uint32_t *)(array + 8)); \ - *(uint32_t *)(array + 8) = htonl(*(uint32_t *)(array + 4)); \ - *(uint32_t *)(array + 12) = htonl(*(uint32_t *)(array)); \ - *(uint32_t *)(array) = __x1; \ - *(uint32_t *)(array + 4) = __x2; \ - } while (0) typedef enum { diff --git a/daemon/net_nfc_server_handover_bss.c b/daemon/net_nfc_server_handover_bss.c index 3f12982..c4b75b9 100644 --- a/daemon/net_nfc_server_handover_bss.c +++ b/daemon/net_nfc_server_handover_bss.c @@ -23,8 +23,7 @@ #include "net_nfc_server_llcp.h" #include "net_nfc_server_handover_bss.h" -static int _net_nfc_handover_bss_process_carrier_record( - net_nfc_handover_bss_process_context_t *context); +static gboolean _net_nfc_handover_bss_process_carrier_record(gpointer user_data); int _net_nfc_handover_bss_convert_security_type(int value) { @@ -188,9 +187,7 @@ _net_nfc_handover_bss_wifi_for_each_access_point_found( DEBUG_ERR_MSG("Invalid context"); context->result = NET_NFC_OPERATION_FAIL; context->step = NET_NFC_LLCP_STEP_RETURN; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); return false; } @@ -204,9 +201,7 @@ _net_nfc_handover_bss_wifi_for_each_access_point_found( DEBUG_ERR_MSG("Wifi get carrier config failed"); context->result = NET_NFC_OPERATION_FAIL; context->step = NET_NFC_LLCP_STEP_RETURN; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); return false; } @@ -224,9 +219,8 @@ _net_nfc_handover_bss_wifi_for_each_access_point_found( return true; } -void -_net_nfc_handover_bss_on_wifi_bgscan_completed(wifi_error_e errorCode, - void* user_data) +void _net_nfc_handover_bss_on_wifi_bgscan_completed( + wifi_error_e errorCode, void* user_data) { int err = WIFI_ERROR_NONE; net_nfc_handover_bss_process_context_t *context = user_data; @@ -236,10 +230,8 @@ _net_nfc_handover_bss_on_wifi_bgscan_completed(wifi_error_e errorCode, DEBUG_ERR_MSG("Invalid context"); context->result = NET_NFC_OPERATION_FAIL; context->step = NET_NFC_LLCP_STEP_RETURN; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); - return false; + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); + return; } if(errorCode != WIFI_ERROR_NONE) @@ -247,9 +239,7 @@ _net_nfc_handover_bss_on_wifi_bgscan_completed(wifi_error_e errorCode, DEBUG_ERR_MSG("Wifi scan failed"); context->result = NET_NFC_OPERATION_FAIL; context->step = NET_NFC_LLCP_STEP_RETURN; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record,context); } else { @@ -264,9 +254,7 @@ _net_nfc_handover_bss_on_wifi_bgscan_completed(wifi_error_e errorCode, DEBUG_ERR_MSG("wifi_foreach_found_aps failed Err[%x]",err); context->result = NET_NFC_OPERATION_FAIL; context->step = NET_NFC_LLCP_STEP_RETURN; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); } if(context->ap_handle == NULL) { @@ -301,15 +289,12 @@ _net_nfc_handover_bss_on_wifi_bgscan_completed(wifi_error_e errorCode, DEBUG_MSG("Authentication type %x", sec_type); } context->step = NET_NFC_LLCP_STEP_03; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); } } -void -_net_nfc_handover_bss_on_wifi_scan_completed(wifi_error_e errorCode, +void _net_nfc_handover_bss_on_wifi_scan_completed(wifi_error_e errorCode, void* user_data) { int err = WIFI_ERROR_NONE; @@ -320,10 +305,8 @@ _net_nfc_handover_bss_on_wifi_scan_completed(wifi_error_e errorCode, DEBUG_ERR_MSG("Invalid context"); context->result = NET_NFC_OPERATION_FAIL; context->step = NET_NFC_LLCP_STEP_RETURN; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); - return false; + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); + return; } if(errorCode != WIFI_ERROR_NONE) @@ -331,9 +314,7 @@ _net_nfc_handover_bss_on_wifi_scan_completed(wifi_error_e errorCode, DEBUG_ERR_MSG("Wifi scan failed"); context->result = NET_NFC_OPERATION_FAIL; context->step = NET_NFC_LLCP_STEP_RETURN; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); } else { @@ -348,9 +329,7 @@ _net_nfc_handover_bss_on_wifi_scan_completed(wifi_error_e errorCode, DEBUG_ERR_MSG("wifi_foreach_found_aps failed Err[%x]",err); context->result = NET_NFC_OPERATION_FAIL; context->step = NET_NFC_LLCP_STEP_RETURN; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); } if(context->ap_handle == NULL) @@ -385,9 +364,7 @@ _net_nfc_handover_bss_on_wifi_scan_completed(wifi_error_e errorCode, DEBUG_MSG("Authentication type %x", sec_type); } context->step = NET_NFC_LLCP_STEP_03; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); } @@ -403,10 +380,8 @@ _net_nfc_handover_bss_on_wifi_connected(wifi_error_e errorCode, void* user_data) DEBUG_ERR_MSG("Invalid context"); context->result = NET_NFC_OPERATION_FAIL; context->step = NET_NFC_LLCP_STEP_RETURN; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); - return false; + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); + return; } if(errorCode == WIFI_ERROR_NONE) @@ -420,14 +395,13 @@ _net_nfc_handover_bss_on_wifi_connected(wifi_error_e errorCode, void* user_data) context->result = NET_NFC_OPERATION_FAIL; } context->step = NET_NFC_LLCP_STEP_RETURN; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record,context); } -static int _net_nfc_handover_bss_process_carrier_record( - net_nfc_handover_bss_process_context_t *context) +static gboolean _net_nfc_handover_bss_process_carrier_record(gpointer user_data) { + net_nfc_handover_bss_process_context_t *context = user_data; + LOGD("[%s:%d] START", __func__, __LINE__); if(context == NULL) @@ -439,14 +413,13 @@ static int _net_nfc_handover_bss_process_carrier_record( if (context->result != NET_NFC_OK && context->result != NET_NFC_BUSY) { - DEBUG_ERR_MSG("context->result is error" - " [%d]", context->result); + DEBUG_ERR_MSG("context->result is error [%d]", context->result); context->step = NET_NFC_LLCP_STEP_RETURN; } switch (context->step) { - case NET_NFC_LLCP_STEP_01 : + case NET_NFC_LLCP_STEP_01: { int err = WIFI_ERROR_NONE; DEBUG_MSG("STEP [1]"); @@ -474,9 +447,7 @@ static int _net_nfc_handover_bss_process_carrier_record( DEBUG_MSG("Wifi is enabled already, go next step"); context->result = NET_NFC_OK; context->step = NET_NFC_LLCP_STEP_02; - g_idle_add((GSourceFunc) - _net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); } } else @@ -484,14 +455,12 @@ static int _net_nfc_handover_bss_process_carrier_record( DEBUG_ERR_MSG("Wifi init failed"); context->result = NET_NFC_OPERATION_FAIL; context->step = NET_NFC_LLCP_STEP_RETURN; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); } } break; - case NET_NFC_LLCP_STEP_02 : + case NET_NFC_LLCP_STEP_02: { int err = WIFI_ERROR_NONE; @@ -503,9 +472,7 @@ static int _net_nfc_handover_bss_process_carrier_record( DEBUG_ERR_MSG("Wifi scan failed"); context->result = NET_NFC_OPERATION_FAIL; context->step = NET_NFC_LLCP_STEP_RETURN; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); } } @@ -521,9 +488,7 @@ static int _net_nfc_handover_bss_process_carrier_record( DEBUG_ERR_MSG("Wifi Connect failed"); context->result = NET_NFC_OPERATION_FAIL; context->step = NET_NFC_LLCP_STEP_RETURN; - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); } } break; @@ -568,9 +533,7 @@ net_nfc_error_e net_nfc_server_handover_bss_process_carrier_record( net_nfc_util_create_record(record->TNF, &record->type_s, &record->id_s, &record->payload_s, &context->carrier); - g_idle_add( - (GSourceFunc)_net_nfc_handover_bss_process_carrier_record, - (gpointer)context); + g_idle_add(_net_nfc_handover_bss_process_carrier_record, context); } else { diff --git a/daemon/net_nfc_server_handover_bt.c b/daemon/net_nfc_server_handover_bt.c index 44d79f7..4b411fa 100644 --- a/daemon/net_nfc_server_handover_bt.c +++ b/daemon/net_nfc_server_handover_bt.c @@ -55,6 +55,17 @@ static int _net_nfc_handover_bt_get_carrier_record( static int _net_nfc_handover_bt_process_carrier_record( net_nfc_handover_bt_process_context_t *context); +static inline void _net_nfc_convert_byte_order(unsigned char *array, int size) +{ + int i; + unsigned char tmp_char; + + for (i=0;ihash_len = MIN(sizeof(oob->hash), hash.length); memcpy(oob->hash, hash.buffer, oob->hash_len); @@ -104,7 +115,7 @@ static net_nfc_error_e _net_nfc_handover_bt_get_oob_data( { DEBUG_MSG("randomizer.length == 16"); - NET_NFC_REVERSE_ORDER_16_BYTES(randomizer.buffer); + _net_nfc_convert_byte_order(randomizer.buffer, 16); oob->randomizer_len = MIN(sizeof(oob->randomizer), randomizer.length); memcpy(oob->randomizer, randomizer.buffer, oob->randomizer_len); @@ -182,7 +193,7 @@ static net_nfc_error_e _net_nfc_handover_bt_create_config_record( { bt_oob_data_t oob = { { 0 }, }; - NET_NFC_REVERSE_ORDER_6_BYTES(bt_addr.addr); + _net_nfc_convert_byte_order(bt_addr.addr, 6); if ((result = net_nfc_util_add_carrier_config_property( config, @@ -204,7 +215,7 @@ static net_nfc_error_e _net_nfc_handover_bt_create_config_record( DEBUG_SERVER_MSG("oob.randomizer_len" " [%d]", oob.randomizer_len); - NET_NFC_REVERSE_ORDER_16_BYTES(oob.hash); + _net_nfc_convert_byte_order(oob.hash, 16); if ((result = net_nfc_util_add_carrier_config_property( @@ -217,7 +228,7 @@ static net_nfc_error_e _net_nfc_handover_bt_create_config_record( " [%d]",result); } - NET_NFC_REVERSE_ORDER_16_BYTES(oob.randomizer); + _net_nfc_convert_byte_order(oob.randomizer, 16); if ((result = net_nfc_util_add_carrier_config_property( config, @@ -584,7 +595,7 @@ static int _net_nfc_handover_bt_process_carrier_record( if (temp.length == 6) { - NET_NFC_REVERSE_ORDER_6_BYTES(temp.buffer); + _net_nfc_convert_byte_order(temp.buffer, 6); memcpy(context->addr.addr, temp.buffer, diff --git a/daemon/net_nfc_server_process_handover.c b/daemon/net_nfc_server_process_handover.c index dbdda0f..4b4fba8 100644 --- a/daemon/net_nfc_server_process_handover.c +++ b/daemon/net_nfc_server_process_handover.c @@ -100,9 +100,6 @@ static void _net_nfc_server_handover_client_connected_cb( static void _net_nfc_server_handover_get_response_process( 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, @@ -138,11 +135,6 @@ static int _net_nfc_server_handover_iterate_carrier_configs_step( static void _net_nfc_server_handover_server_process( 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); - //////////////////////////////////////////////////////////////////////////// static void _net_nfc_server_handover_send_response( @@ -185,8 +177,8 @@ static void _net_nfc_server_handover_send_response( } g_object_unref(handover_data->handoverobj); - g_free(handover_data); + g_free(handover_data); } static net_nfc_error_e _net_nfc_server_handover_convert_ndef_message_to_data( @@ -555,49 +547,6 @@ static int _net_nfc_server_handover_iterate_carrier_configs_step( return 0; } -static int _net_nfc_server_handover_append_wifi_carrier_config( - net_nfc_server_handover_create_config_context_t *context) -{ - LOGD("[%s:%d] START", __func__, __LINE__); - - switch (context->step) - { - case NET_NFC_LLCP_STEP_01 : - DEBUG_MSG("STEP [1]"); - - context->step = NET_NFC_LLCP_STEP_02; - break; - - case NET_NFC_LLCP_STEP_02 : - DEBUG_MSG("STEP [2]"); - - context->step = NET_NFC_LLCP_STEP_03; - break; - - case NET_NFC_LLCP_STEP_03 : - DEBUG_MSG("STEP [3]"); - - context->step = NET_NFC_LLCP_STEP_RETURN; - break; - - case NET_NFC_LLCP_STEP_RETURN : - DEBUG_MSG("STEP return"); - - /* complete and return to upper step */ - g_idle_add( - (GSourceFunc)_net_nfc_server_handover_iterate_carrier_configs_to_next, - (gpointer)context); - break; - - default : - break; - } - - LOGD("[%s:%d] END", __func__, __LINE__); - - return 0; -} - static int _net_nfc_server_handover_iterate_carrier_configs_to_next( net_nfc_server_handover_create_config_context_t *context) { @@ -764,104 +713,6 @@ static net_nfc_error_e _net_nfc_server_handover_create_selector_carrier_configs( return result; } - static net_nfc_error_e -_net_nfc_server_handover_create_low_power_selector_message( - ndef_message_s *request_msg, - ndef_message_s *select_msg) -{ - net_nfc_error_e result = NET_NFC_UNKNOWN_ERROR; - unsigned int carrier_count = 0; - - LOGD("[%s] START", __func__); - - if (request_msg == NULL || select_msg == NULL) - { - return NET_NFC_NULL_PARAMETER; - } - - if ((result = net_nfc_util_get_alternative_carrier_record_count( - request_msg, - &carrier_count)) == NET_NFC_OK) - { - int idx; - ndef_record_s *carrier_record = NULL; - net_nfc_conn_handover_carrier_type_e carrier_type = - 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)) - { - DEBUG_ERR_MSG("net_nfc_util_get_alternative" - "_carrier_type failed or unknown"); - continue; - } - - DEBUG_SERVER_MSG("carrier type = [%d]", carrier_type); - - /* add temporary config record */ - { - net_nfc_carrier_config_s *config = NULL; - - if ((result = net_nfc_util_create_carrier_config( - &config,carrier_type)) == NET_NFC_OK) - { - if ((result = - 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"); - } - else - { - DEBUG_ERR_MSG("create_ndef_record_with_carrier_config " - "failed [%d]", result); - net_nfc_util_free_carrier_config(config); - continue; - } - - net_nfc_util_free_carrier_config(config); - } - else - { - DEBUG_ERR_MSG("net_nfc_util_get_local_bt_address return NULL"); - 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) - { - 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); - - net_nfc_util_free_record(carrier_record); - } - } - - result = NET_NFC_OK; - } - else - { - DEBUG_ERR_MSG("net_nfc_util_get_alternative_carrier_record_count failed"); - } - - LOGD("[%s] END", __func__); - - return result; -} - net_nfc_error_e net_nfc_server_handover_process_carrier_record( ndef_record_s *carrier, void *cb, void *user_param) { diff --git a/daemon/net_nfc_server_util.c b/daemon/net_nfc_server_util.c index 88d7f86..3596c51 100644 --- a/daemon/net_nfc_server_util.c +++ b/daemon/net_nfc_server_util.c @@ -132,18 +132,18 @@ static net_nfc_error_e net_nfc_app_util_store_ndef_message(data_s *data) if (stat(file_name, &st) == -1) { - int result; + int ret; char command[1024]; SECURE_LOGD("path doesn't exist, do mkdir : %s", file_name); snprintf(command, sizeof(command), "mkdir -p -m 755 %s", file_name); - result = system(command); + ret = system(command); if (stat(file_name, &st) == -1) { - DEBUG_ERR_MSG("mkdir failed"); + DEBUG_ERR_MSG("mkdir failed(%d)", ret); return NET_NFC_UNKNOWN_ERROR; } } diff --git a/tests/net_nfc_test_handover.c b/tests/net_nfc_test_handover.c index ced566d..4a1cf44 100644 --- a/tests/net_nfc_test_handover.c +++ b/tests/net_nfc_test_handover.c @@ -31,7 +31,7 @@ static void p2p_connection_handover_cb(net_nfc_error_e result, data_h data, void *user_data); -net_nfc_connection_handover_info_h global_info = NULL; +static net_nfc_connection_handover_info_h global_info = NULL; static void run_next_callback(gpointer user_data) @@ -82,6 +82,7 @@ void net_nfc_test_p2p_connection_handover(gpointer data, type, p2p_connection_handover_cb, user_data); + g_print("net_nfc_client_p2p_connection_handover() : %d\n", result); } void net_nfc_test_p2p_connection_handover_sync(gpointer data, @@ -101,6 +102,7 @@ void net_nfc_test_p2p_connection_handover_sync(gpointer data, type, &out_carrier, &out_data); + g_print("net_nfc_client_p2p_connection_handover_sync() : %d\n", result); g_print("Received out carrier type & carrier type %d, %d\n", out_carrier, type); print_received_data(out_data); @@ -114,6 +116,7 @@ void net_nfc_test_handover_get_alternative_carrier_type(gpointer data, net_nfc_conn_handover_carrier_type_e type; result = net_nfc_client_handover_get_alternative_carrier_type(global_info, &type); + g_print("net_nfc_client_handover_get_alternative_carrier_type() : %d\n", result); g_print("Handover alternative carrier type -> %d", type); } diff --git a/tests/net_nfc_test_jewel.c b/tests/net_nfc_test_jewel.c index ebd1479..a72032f 100644 --- a/tests/net_nfc_test_jewel.c +++ b/tests/net_nfc_test_jewel.c @@ -23,16 +23,9 @@ static net_nfc_target_handle_h get_handle(); - 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); -; -static void jewel_write_cb(net_nfc_error_e result, - void* user_data); - +static void jewel_read_cb(net_nfc_error_e result, data_h resp_data, void *user_data); +static void jewel_write_cb(net_nfc_error_e result, void* user_data); static net_nfc_target_handle_h get_handle() { @@ -96,6 +89,7 @@ void net_nfc_test_tag_jewel_read_id(gpointer data, result = net_nfc_client_jewel_read_id(handle, jewel_read_cb, user_data); + g_print("net_nfc_client_jewel_read_id() : %d\n", result); } void net_nfc_test_tag_jewel_read_byte(gpointer data, @@ -113,6 +107,7 @@ void net_nfc_test_tag_jewel_read_byte(gpointer data, byte, jewel_read_cb, user_data); + g_print("net_nfc_client_jewel_read_byte() : %d\n", result); } void net_nfc_test_tag_jewel_read_all(gpointer data, @@ -126,6 +121,7 @@ void net_nfc_test_tag_jewel_read_all(gpointer data, result = net_nfc_client_jewel_read_all(handle, jewel_read_cb, user_data); + g_print("net_nfc_client_jewel_read_all() : %d\n", result); } void net_nfc_test_tag_jewel_write_with_erase(gpointer data, @@ -145,6 +141,7 @@ void net_nfc_test_tag_jewel_write_with_erase(gpointer data, data_to_write, jewel_write_cb, user_data); + g_print("net_nfc_client_jewel_write_with_erase() : %d\n", result); } void net_nfc_test_tag_jewel_write_with_no_erase(gpointer data, @@ -164,4 +161,5 @@ void net_nfc_test_tag_jewel_write_with_no_erase(gpointer data, data_to_write, jewel_write_cb, user_data); + g_print("net_nfc_client_jewel_write_with_erase() : %d\n", result); } diff --git a/tests/net_nfc_test_jewel.h b/tests/net_nfc_test_jewel.h index 7277c50..4fa16fc 100644 --- a/tests/net_nfc_test_jewel.h +++ b/tests/net_nfc_test_jewel.h @@ -35,4 +35,4 @@ void net_nfc_test_tag_jewel_write_with_erase(gpointer data, void net_nfc_test_tag_jewel_write_with_no_erase(gpointer data, gpointer user_data); -#endif +#endif //__NET_NFC_TEST_JEWEL_TAG_H__ \ No newline at end of file diff --git a/tests/net_nfc_test_p2p.h b/tests/net_nfc_test_p2p.h index cfb5aec..05e791c 100644 --- a/tests/net_nfc_test_p2p.h +++ b/tests/net_nfc_test_p2p.h @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - #ifndef __NET_NFC_TEST_P2P_H__ #define __NET_NFC_TEST_P2P_H__ @@ -21,31 +20,15 @@ #include #include "net_nfc_target_info.h" -void net_nfc_test_p2p_send(gpointer data, - gpointer user_data); - -void net_nfc_test_p2p_send_sync(gpointer data, - gpointer user_data); - -void net_nfc_test_p2p_set_device_discovered(gpointer data, - gpointer user_data); - -void net_nfc_test_p2p_set_device_detached(gpointer data, - gpointer user_data); - -void net_nfc_test_p2p_set_data_received(gpointer data, - gpointer user_data); - -void net_nfc_test_p2p_unset_device_discovered(gpointer data, - gpointer user_data); - -void net_nfc_test_p2p_unset_device_detached(gpointer data, - gpointer user_data); - -void net_nfc_test_p2p_unset_data_received(gpointer data, - gpointer user_data); - +void net_nfc_test_p2p_send(gpointer data, gpointer user_data); +void net_nfc_test_p2p_send_sync(gpointer data, gpointer user_data); +void net_nfc_test_p2p_set_device_discovered(gpointer data,gpointer user_data); +void net_nfc_test_p2p_set_device_detached(gpointer data, gpointer user_data); +void net_nfc_test_p2p_set_data_received(gpointer data, gpointer user_data); +void net_nfc_test_p2p_unset_device_discovered(gpointer data, gpointer user_data); +void net_nfc_test_p2p_unset_device_detached(gpointer data, gpointer user_data); +void net_nfc_test_p2p_unset_data_received(gpointer data, gpointer user_data); net_nfc_target_handle_h net_nfc_test_device_get_target_handle(void); -#endif +#endif //__NET_NFC_TEST_P2P_H__ diff --git a/tests/net_nfc_test_se.c b/tests/net_nfc_test_se.c index 5222b86..64b7111 100644 --- a/tests/net_nfc_test_se.c +++ b/tests/net_nfc_test_se.c @@ -40,12 +40,10 @@ static void get_atr_secure_element_cb(net_nfc_error_e result, data_h 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); +static void se_ese_detection_cb(net_nfc_target_handle_h handle, int dev_type, + data_h data, void *user_data); -static void se_set_transaction_cb(data_h aid, - data_h param, - void *user_data); +static void se_set_transaction_cb(data_h aid, 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; @@ -105,10 +103,8 @@ static void se_set_event_cb(net_nfc_message_e event, void* user_data) run_next_callback(user_data); } -static void se_ese_detection_cb(net_nfc_target_handle_h handle, - int dev_type, - data_h data, - void *user_data) +static void se_ese_detection_cb(net_nfc_target_handle_h handle, 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)); @@ -116,9 +112,7 @@ static void se_ese_detection_cb(net_nfc_target_handle_h handle, print_received_data(data); } -static void se_set_transaction_cb(data_h aid, - data_h param, - void *user_data) +static void se_set_transaction_cb(data_h aid, data_h param, void *user_data) { g_print("Set transaction callback successfully\n"); g_print("*****displaying Aid data****\n"); @@ -128,8 +122,7 @@ static void se_set_transaction_cb(data_h aid, run_next_callback(user_data); } -void net_nfc_test_se_send_apdu(gpointer data, - gpointer user_data) +void net_nfc_test_se_send_apdu(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; data_h apdu_data = NULL; @@ -137,14 +130,11 @@ void net_nfc_test_se_send_apdu(gpointer data, 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); + result = net_nfc_client_se_send_apdu(global_handle, apdu_data, send_apdu_cb, user_data); + g_print("net_nfc_client_se_send_apdu() : %d\n", result); } -void net_nfc_test_se_send_apdu_sync(gpointer data, - gpointer user_data) +void net_nfc_test_se_send_apdu_sync(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; data_h apdu_data = NULL; @@ -152,17 +142,14 @@ void net_nfc_test_se_send_apdu_sync(gpointer data, data_h response = NULL; net_nfc_create_data(&apdu_data, apdu_cmd, 4); - result = net_nfc_client_se_send_apdu_sync(global_handle, - apdu_data, - &response); + result = net_nfc_client_se_send_apdu_sync(global_handle, apdu_data, &response); g_print(" Send apdu data sync completed %d\n", result); print_received_data(response); run_next_callback(user_data); } -void net_nfc_test_se_set_secure_element_type(gpointer data, - gpointer user_data) +void net_nfc_test_se_set_secure_element_type(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; net_nfc_se_type_e se_type = NET_NFC_SE_TYPE_UICC; @@ -171,6 +158,7 @@ void net_nfc_test_se_set_secure_element_type(gpointer data, se_type, set_secure_element_cb, user_data); + g_print("net_nfc_client_se_set_secure_element_type() : %d\n", result); } void net_nfc_test_se_set_secure_element_type_sync(gpointer data, @@ -194,6 +182,7 @@ void net_nfc_test_se_open_internal_secure_element(gpointer data, se_type, open_secure_element_cb, user_data); + g_print("net_nfc_client_se_open_internal_secure_element() : %d\n", result); } void net_nfc_test_se_open_internal_secure_element_sync(gpointer data, @@ -207,7 +196,7 @@ void net_nfc_test_se_open_internal_secure_element_sync(gpointer data, &global_handle); g_print("Handle is %#x\n", GPOINTER_TO_UINT(global_handle)); - g_print(" open secure element completed %d\n", result); + g_print("open secure element completed %d\n", result); run_next_callback(user_data); } @@ -220,6 +209,7 @@ void net_nfc_test_se_close_internal_secure_element(gpointer data, global_handle, close_secure_element_cb, user_data); + g_print("net_nfc_client_se_close_internal_secure_element() : %d\n", result); } void net_nfc_test_se_close_internal_secure_element_sync(gpointer data, @@ -232,66 +222,54 @@ void net_nfc_test_se_close_internal_secure_element_sync(gpointer data, run_next_callback(user_data); } -void net_nfc_test_se_get_atr(gpointer data, - gpointer user_data) +void net_nfc_test_se_get_atr(gpointer 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); + g_print("net_nfc_client_se_get_atr() : %d\n", result); } -void net_nfc_test_se_get_atr_sync(gpointer data, - gpointer user_data) +void net_nfc_test_se_get_atr_sync(gpointer 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); + result = net_nfc_client_se_get_atr_sync(global_handle, &attr_data); g_print("Get atr data sync completed %d\n", result); print_received_data(attr_data); run_next_callback(user_data); } -void net_nfc_test_se_set_event_cb(gpointer data, - gpointer user_data) +void net_nfc_test_se_set_event_cb(gpointer data, gpointer user_data) { - net_nfc_client_se_set_event_cb(se_set_event_cb, - user_data); + net_nfc_client_se_set_event_cb(se_set_event_cb, user_data); } -void net_nfc_test_se_unset_event_cb(gpointer data, - gpointer user_data) +void net_nfc_test_se_unset_event_cb(gpointer 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) +void net_nfc_test_se_set_ese_detection_cb(gpointer data, gpointer user_data) { - net_nfc_client_se_set_ese_detection_cb(se_ese_detection_cb, - user_data); + net_nfc_client_se_set_ese_detection_cb(se_ese_detection_cb, user_data); } -void net_nfc_test_se_unset_ese_detection_cb(gpointer data, - gpointer user_data) +void net_nfc_test_se_unset_ese_detection_cb(gpointer 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) +void net_nfc_test_se_set_transaction_event_cb(gpointer data, gpointer user_data) { - net_nfc_client_se_set_transaction_event_cb(se_set_transaction_cb, - user_data); + net_nfc_client_se_set_transaction_event_cb(se_set_transaction_cb, user_data); } void net_nfc_test_se_unset_transaction_event_cb(gpointer data, diff --git a/tests/net_nfc_test_tag_felica.c b/tests/net_nfc_test_tag_felica.c index 5d65c1d..ea10a3e 100644 --- a/tests/net_nfc_test_tag_felica.c +++ b/tests/net_nfc_test_tag_felica.c @@ -26,9 +26,7 @@ static net_nfc_target_handle_h get_handle(); static void run_next_callback(gpointer user_data); -static void felica_cb(net_nfc_error_e result, - data_h resp_data, - void *user_data); +static void felica_cb(net_nfc_error_e result, data_h resp_data, void *user_data); static net_nfc_target_handle_h get_handle() @@ -55,9 +53,7 @@ static void run_next_callback(gpointer user_data) } } -static void felica_cb(net_nfc_error_e result, - data_h resp_data, - void *user_data) +static void felica_cb(net_nfc_error_e result, data_h resp_data, void *user_data) { g_print("felica_cb Completed %d\n", result); @@ -66,8 +62,7 @@ static void felica_cb(net_nfc_error_e result, run_next_callback(user_data); } -void net_nfc_test_felica_poll(gpointer data, - gpointer user_data) +void net_nfc_test_felica_poll(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; net_nfc_target_handle_h handle = NULL; @@ -79,10 +74,11 @@ void net_nfc_test_felica_poll(gpointer data, return ; result = net_nfc_client_felica_poll(handle, req_code, time_slot, felica_cb, user_data); + + g_print("net_nfc_client_felica_poll() : %d\n", result); } -void net_nfc_test_felica_request_service(gpointer data, - gpointer user_data) +void net_nfc_test_felica_request_service(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; net_nfc_target_handle_h handle = NULL; @@ -100,10 +96,10 @@ void net_nfc_test_felica_request_service(gpointer data, number_of_services, felica_cb, user_data); + g_print("net_nfc_client_felica_request_service() : %d\n", result); } -void net_nfc_test_felica_request_response(gpointer data, - gpointer user_data) +void net_nfc_test_felica_request_response(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; net_nfc_target_handle_h handle = NULL; @@ -113,6 +109,7 @@ void net_nfc_test_felica_request_response(gpointer data, return ; result = net_nfc_client_felica_request_response(handle, felica_cb, user_data); + g_print("net_nfc_client_felica_request_response() : %d\n", result); } void net_nfc_test_felica_read_without_encryption(gpointer data, @@ -121,7 +118,7 @@ void net_nfc_test_felica_read_without_encryption(gpointer data, net_nfc_error_e result = NET_NFC_OK; net_nfc_target_handle_h handle = NULL; uint8_t number_of_services = 10; - uint16_t service_list[2] = {0,}; + uint16_t service_list[10] = {0,}; uint8_t number_of_blocks = 1; uint8_t block_list[3] = {0,}; @@ -136,6 +133,7 @@ void net_nfc_test_felica_read_without_encryption(gpointer data, block_list, felica_cb, user_data); + g_print("net_nfc_client_felica_read_without_encryption() : %d\n", result); } void net_nfc_test_felica_write_without_encryption(gpointer data, @@ -161,10 +159,10 @@ void net_nfc_test_felica_write_without_encryption(gpointer data, data_to_write, felica_cb, user_data); + g_print("net_nfc_client_felica_write_without_encryption() : %d\n", result); } -void net_nfc_test_felica_request_system_code(gpointer data, - gpointer user_data) +void net_nfc_test_felica_request_system_code(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; net_nfc_target_handle_h handle = NULL; @@ -174,4 +172,5 @@ void net_nfc_test_felica_request_system_code(gpointer data, return ; result = net_nfc_client_felica_request_system_code(handle, felica_cb, user_data); + g_print("net_nfc_client_felica_request_system_code() : %d\n", result); } diff --git a/tests/net_nfc_test_tag_mifare.c b/tests/net_nfc_test_tag_mifare.c index 439356f..5ac6352 100644 --- a/tests/net_nfc_test_tag_mifare.c +++ b/tests/net_nfc_test_tag_mifare.c @@ -136,8 +136,7 @@ static void mifare_write_auth_keyB_cb(net_nfc_error_e result, void* user_data) } -void net_nfc_test_tag_mifare_read(gpointer data, - gpointer user_data) +void net_nfc_test_tag_mifare_read(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; net_nfc_target_handle_h handle = NULL; @@ -153,14 +152,12 @@ void net_nfc_test_tag_mifare_read(gpointer data, } g_print("Handle is %#x\n", GPOINTER_TO_UINT(handle)); - result = net_nfc_client_mifare_read(handle, - block_index, - mifare_read_cb, - user_data); + result = net_nfc_client_mifare_read(handle, block_index, mifare_read_cb, user_data); + + g_print("net_nfc_client_mifare_read() : %d\n", result); } -void net_nfc_test_tag_mifare_write_block(gpointer data, - gpointer user_data) +void net_nfc_test_tag_mifare_write_block(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; net_nfc_target_handle_h handle = NULL; @@ -187,10 +184,11 @@ void net_nfc_test_tag_mifare_write_block(gpointer data, (data_h)& write_data, mifare_write_block_cb, user_data); + + g_print("net_nfc_client_mifare_write_block() : %d\n", result); } -void net_nfc_test_tag_mifare_write_page(gpointer data, - gpointer user_data) +void net_nfc_test_tag_mifare_write_page(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; net_nfc_target_handle_h handle = NULL; @@ -217,10 +215,11 @@ void net_nfc_test_tag_mifare_write_page(gpointer data, (data_h)& write_data, mifare_write_page_cb, user_data); + + g_print("net_nfc_client_mifare_write_page() : %d\n", result); } -void net_nfc_test_tag_mifare_increment(gpointer data, - gpointer user_data) +void net_nfc_test_tag_mifare_increment(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; net_nfc_target_handle_h handle = NULL; @@ -242,10 +241,11 @@ void net_nfc_test_tag_mifare_increment(gpointer data, value, mifare_write_mifare_incr_cb, user_data); + + g_print("net_nfc_client_mifare_increment() : %d\n", result); } -void net_nfc_test_tag_mifare_decrement(gpointer data, - gpointer user_data) +void net_nfc_test_tag_mifare_decrement(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; net_nfc_target_handle_h handle = NULL; @@ -267,10 +267,11 @@ void net_nfc_test_tag_mifare_decrement(gpointer data, value, mifare_write_mifare_decr_cb, user_data); + + g_print("net_nfc_client_mifare_decrement() : %d\n", result); } -void net_nfc_test_tag_mifare_transfer(gpointer data, - gpointer user_data) +void net_nfc_test_tag_mifare_transfer(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; net_nfc_target_handle_h handle = NULL; @@ -290,10 +291,11 @@ void net_nfc_test_tag_mifare_transfer(gpointer data, block_index, mifare_write_mifare_transfer_cb, user_data); + + g_print("net_nfc_client_mifare_transfer() : %d\n", result); } -void net_nfc_test_tag_mifare_restore(gpointer data, - gpointer user_data) +void net_nfc_test_tag_mifare_restore(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; net_nfc_target_handle_h handle = NULL; @@ -313,6 +315,8 @@ void net_nfc_test_tag_mifare_restore(gpointer data, block_index, mifare_write_mifare_restore_cb, user_data); + + g_print("net_nfc_client_mifare_restore() : %d\n", result); } void net_nfc_test_tag_mifare_authenticate_with_keyA(gpointer data, @@ -342,6 +346,8 @@ void net_nfc_test_tag_mifare_authenticate_with_keyA(gpointer data, auth_key, mifare_write_auth_keyA_cb, user_data); + + g_print("net_nfc_client_mifare_authenticate_with_keyA() : %d\n", result); } void net_nfc_test_tag_mifare_authenticate_with_keyB(gpointer data, @@ -371,4 +377,6 @@ void net_nfc_test_tag_mifare_authenticate_with_keyB(gpointer data, auth_key, mifare_write_auth_keyB_cb, user_data); + + g_print("net_nfc_client_mifare_authenticate_with_keyB() : %d\n", result); } diff --git a/tests/net_nfc_test_transceive.c b/tests/net_nfc_test_transceive.c index bf328c7..afbfb23 100644 --- a/tests/net_nfc_test_transceive.c +++ b/tests/net_nfc_test_transceive.c @@ -62,8 +62,7 @@ static void call_transceive_data_cb(net_nfc_error_e result, run_next_callback(user_data); } -void net_nfc_test_transceive(gpointer data, - gpointer user_data) +void net_nfc_test_transceive(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; data_s raw_data = {NULL,}; @@ -78,10 +77,10 @@ void net_nfc_test_transceive(gpointer data, (data_h)&raw_data, call_transceive_cb, user_data); + g_print("net_nfc_client_transceive() : %d\n", result); } -void net_nfc_test_transceive_sync(gpointer data, - gpointer user_data) +void net_nfc_test_transceive_sync(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; data_s raw_data = {NULL,}; @@ -94,11 +93,10 @@ void net_nfc_test_transceive_sync(gpointer data, result = net_nfc_client_transceive_sync(handle, (data_h)& raw_data); - g_print("Transceive Sync is completed \n"); + g_print("Transceive Sync is completed(%d)\n", result); } -void net_nfc_test_transceive_data(gpointer data, - gpointer user_data) +void net_nfc_test_transceive_data(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; data_s raw_data = {NULL,}; @@ -113,10 +111,10 @@ void net_nfc_test_transceive_data(gpointer data, (data_h) &raw_data, call_transceive_data_cb, user_data); + g_print("net_nfc_client_transceive_data() : %d\n", result); } -void net_nfc_test_transceive_data_sync(gpointer data, - gpointer user_data) +void net_nfc_test_transceive_data_sync(gpointer data, gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; data_s raw_data = {NULL}; @@ -129,6 +127,7 @@ void net_nfc_test_transceive_data_sync(gpointer data, net_nfc_get_tag_handle(info, &handle); result = net_nfc_client_transceive_data_sync(handle, &raw_data, &response); + g_print("net_nfc_client_transceive_data_sync() : %d\n", result); if (NET_NFC_OK == result) print_received_data(response); -- 2.7.4