From: Abhijit R D Date: Fri, 23 Aug 2013 10:44:26 +0000 (+0530) Subject: Test case modification X-Git-Tag: accepted/tizen/generic/20140317.083658~74 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3bc6ff7ba044a9f95bf3f47c55873f11f0d79ac1;p=platform%2Fcore%2Fconnectivity%2Fnfc-manager-neard.git Test case modification Added system handler test case Modified the testcases for Handover/Client Added missing testcases for llcp Change-Id: I1edfc6ebff5fcbf4f650158149b298855ddbd873 --- diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 36e1055..cf3eb6f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -36,6 +36,7 @@ ADD_EXECUTABLE(${NFC_CLIENT_TEST} 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 ) diff --git a/tests/include/net_nfc_test_client.h b/tests/include/net_nfc_test_client.h index d0b99f5..62902e4 100644 --- a/tests/include/net_nfc_test_client.h +++ b/tests/include/net_nfc_test_client.h @@ -21,13 +21,17 @@ #include -void net_nfc_test_initialize(); +void net_nfc_test_initialize(gpointer data, + gpointer user_data); -void net_nfc_test_deinitialize(); +void net_nfc_test_deinitialize(gpointer data, + gpointer user_data); -void net_nfc_test_is_nfc_supported(); +void net_nfc_test_is_nfc_supported(gpointer data, + gpointer user_data); -void net_nfc_test_get_nfc_state(); +void net_nfc_test_get_nfc_state(gpointer data, + gpointer user_data); -#endif +#endif//__NET_NFC_TEST_CLIENT_H__ diff --git a/tests/include/net_nfc_test_exchanger.h b/tests/include/net_nfc_test_exchanger.h index f3b5a92..08a6bf9 100644 --- a/tests/include/net_nfc_test_exchanger.h +++ b/tests/include/net_nfc_test_exchanger.h @@ -23,7 +23,7 @@ #include "net_nfc_typedef.h" -void net_nfc_test_create_exchanger_data(gpointer data, +void net_nfc_test_handle_exchanger_data(gpointer data, gpointer user_data); void net_nfc_test_send_exchanger_data(gpointer data, @@ -38,4 +38,4 @@ void net_nfc_test_exchanger_get_alternative_carrier_type(gpointer data, void net_nfc_test_exchanger_get_alternative_carrier_data(gpointer data, gpointer user_data); -#endif +#endif//__NET_NFC_TEST_EXCHANGER_H__ diff --git a/tests/include/net_nfc_test_handover.h b/tests/include/net_nfc_test_handover.h index 3b1fbd9..1307350 100644 --- a/tests/include/net_nfc_test_handover.h +++ b/tests/include/net_nfc_test_handover.h @@ -26,12 +26,17 @@ void net_nfc_test_p2p_connection_handover(gpointer data, void net_nfc_test_p2p_connection_handover_sync(gpointer data, gpointer user_data); +/* void net_nfc_test_handover_get_alternative_carrier_data(gpointer data, gpointer user_data); +*/ + +void net_nfc_test_handover_handle_alternative_carrier_data(gpointer data, + gpointer user_datarrierData); void net_nfc_test_handover_get_alternative_carrier_type(gpointer data, gpointer user_data); -#endif +#endif//__NET_NFC_TEST_HANDOVER_H__ diff --git a/tests/include/net_nfc_test_llcp.h b/tests/include/net_nfc_test_llcp.h index aec3bc4..1491955 100644 --- a/tests/include/net_nfc_test_llcp.h +++ b/tests/include/net_nfc_test_llcp.h @@ -122,6 +122,14 @@ void net_nfc_test_llcp_receive_from(gpointer 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); @@ -141,7 +149,6 @@ void net_nfc_test_llcp_send(gpointer 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); @@ -157,5 +164,5 @@ void net_nfc_test_llcp_disconnect_server(gpointer func_data, void net_nfc_test_llcp_disconnect_sync(gpointer func_data, gpointer user_data); -#endif +#endif//__NET_NFC_TEST_LLCP_H__ diff --git a/tests/include/net_nfc_test_sys_handler.h b/tests/include/net_nfc_test_sys_handler.h new file mode 100755 index 0000000..e22adc3 --- /dev/null +++ b/tests/include/net_nfc_test_sys_handler.h @@ -0,0 +1,28 @@ +/* +* 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 + +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__ diff --git a/tests/main.c b/tests/main.c index 740fb5b..a095382 100644 --- a/tests/main.c +++ b/tests/main.c @@ -35,6 +35,7 @@ #include "net_nfc_test_tag_felica.h" #include "net_nfc_test_exchanger.h" #include "net_nfc_test_se.h" +#include "net_nfc_test_sys_handler.h" typedef struct _TestData TestData; @@ -286,10 +287,10 @@ static TestData test_data[] = { { "Handover", - "GetCarrierData", - net_nfc_test_handover_get_alternative_carrier_data, - net_nfc_test_handover_get_alternative_carrier_data, - "Get Handover Carrier Data" + "HandleCarrierData", + net_nfc_test_handover_handle_alternative_carrier_data, + net_nfc_test_handover_handle_alternative_carrier_data, + "Create/Free Handover Carrier Data" }, @@ -460,10 +461,10 @@ static TestData test_data[] = { { "Exchanger", - "CreateData", - net_nfc_test_create_exchanger_data, - net_nfc_test_create_exchanger_data, - "Create exchanger data" + "HandleData", + net_nfc_test_handle_exchanger_data, + net_nfc_test_handle_exchanger_data, + "Create/Free exchanger data" }, { @@ -497,6 +498,23 @@ static TestData test_data[] = { net_nfc_test_exchanger_get_alternative_carrier_type, "Get Alternative carrier type" }, + + { + "llcp", + "CreateSocket", + net_nfc_test_llcp_create_socket, + net_nfc_test_llcp_create_socket, + "Create a LLCP socket" + }, + + { + "llcp", + "CloseSocket", + net_nfc_test_llcp_close_socket, + net_nfc_test_llcp_close_socket_sync, + "Close the socket" + }, + { "llcp", "SetDefaultConfig", @@ -884,6 +902,22 @@ static TestData test_data[] = { "Unset transaction callback" }, + { + "SystemHandler", + "SetLaunchPopState", + net_nfc_test_sys_handler_set_launch_popup_state, + net_nfc_test_sys_handler_set_launch_popup_state, + "Set launch popup state" + }, + + { + "SystemHandler", + "GetLaunchPopState", + net_nfc_test_sys_handler_get_launch_popup_state, + net_nfc_test_sys_handler_get_launch_popup_state, + "Get launch popup state" + }, + { NULL } }; diff --git a/tests/net_nfc_test_client.c b/tests/net_nfc_test_client.c index 4955d33..9487baa 100644 --- a/tests/net_nfc_test_client.c +++ b/tests/net_nfc_test_client.c @@ -21,40 +21,85 @@ #include "net_nfc_typedef_internal.h" -void net_nfc_test_initialize() +static void run_next_callback(gpointer user_data); + +static void run_next_callback(gpointer user_data) +{ + if (user_data) + { + GCallback callback; + + callback = (GCallback)(user_data); + callback(); + } +} + +void net_nfc_test_initialize(gpointer data, + gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; result = net_nfc_client_initialize(); - g_print("Client Initialization Completed & Return value is %d\n", result); + if(result != NET_NFC_OK) + { + g_print("Client Initialization failed & Result is %d\n", result); + return; + } + + g_print("Client Initialization Completed & Result is %d\n", result); + + run_next_callback(user_data); } -void net_nfc_test_deinitialize() +void net_nfc_test_deinitialize(gpointer data, + gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; result = net_nfc_client_deinitialize(); - g_print("Client Deinitialization Completed & Return value is %d\n", result); + g_print("Client Deinitialization Completed & Result is %d\n", result); } -void net_nfc_test_is_nfc_supported() +void net_nfc_test_is_nfc_supported(gpointer data, + gpointer user_data) { - int state = 0; + int feature = 0; net_nfc_error_e result = NET_NFC_OK; - result = net_nfc_client_is_nfc_supported(&state); + result = net_nfc_client_is_nfc_supported(&feature); + + if((result != NET_NFC_OK) || (feature != 1)) + { + g_print("Client is_nfc_supported failed & result is %d\n", result); + g_print("Client is_nfc_supported failed & feature value is %d\n", feature); + return; + } - g_print("Client is_nfc_supported completed & state value is %d\n", state); + g_print("Client is_nfc_supported completed & feature value is %d\n", feature); + g_print("Client is_nfc_supported completed & result is %d\n", result); + + run_next_callback(user_data); } -void net_nfc_test_get_nfc_state() +void net_nfc_test_get_nfc_state(gpointer data, + gpointer user_data) { int state = 0; net_nfc_error_e result = NET_NFC_OK; result = net_nfc_client_get_nfc_state(&state); + if((result != NET_NFC_OK) || (state != 1)) + { + g_print("Client get_nfc_state failed & result is %d\n", result); + g_print("Client get_nfc_state failed & state value is %d\n", state); + return; + } + g_print("Client get_nfc_state completed & state value is %d\n", state); + g_print("Client get_nfc_state completed & result is %d\n", result); + + run_next_callback(user_data); } diff --git a/tests/net_nfc_test_exchanger.c b/tests/net_nfc_test_exchanger.c index 41bb843..5c89a1b 100644 --- a/tests/net_nfc_test_exchanger.c +++ b/tests/net_nfc_test_exchanger.c @@ -20,6 +20,10 @@ #include "net_nfc_test_exchanger.h" #include "net_nfc_ndef_message.h" #include "net_nfc_test_util.h" +#include "net_nfc_ndef_record.h" +#include "net_nfc_typedef_internal.h" + + static void run_next_callback(gpointer user_data); @@ -42,10 +46,14 @@ static net_nfc_exchanger_data_h _net_nfc_test_create_exchgr_data() net_nfc_error_e result = NET_NFC_OK; ndef_message_h msg = NULL; data_h rawdata = NULL; + ndef_record_h record = NULL; net_nfc_exchanger_data_h exch_data = NULL; - net_nfc_create_ndef_message(&msg); + net_nfc_create_ndef_message (&msg); + net_nfc_create_uri_type_record (&record ,"http://www.samsung.com" ,NET_NFC_SCHEMA_FULL_URI); + net_nfc_append_record_to_ndef_message (msg ,record); net_nfc_create_rawdata_from_ndef_message(msg, &rawdata); + if((result = net_nfc_client_create_exchanger_data(&exch_data, rawdata)) != NET_NFC_OK) { net_nfc_free_data(rawdata); @@ -56,28 +64,40 @@ static net_nfc_exchanger_data_h _net_nfc_test_create_exchgr_data() return exch_data; } -void net_nfc_test_create_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; data_h rawdata = NULL; + ndef_record_h record = NULL; net_nfc_exchanger_data_h exch_data = NULL; - net_nfc_create_ndef_message(&msg); + net_nfc_create_ndef_message (&msg); + net_nfc_create_uri_type_record (&record ,"http://www.samsung.com" ,NET_NFC_SCHEMA_FULL_URI); + net_nfc_append_record_to_ndef_message (msg ,record); net_nfc_create_rawdata_from_ndef_message(msg, &rawdata); + if((result = net_nfc_client_create_exchanger_data(&exch_data, rawdata)) != NET_NFC_OK) { net_nfc_free_data(rawdata); - g_printerr(" Exchanger data creation failed \n"); + g_printerr(" Exchanger data creation failed : %d\n", result); return; } + if((result = net_nfc_client_free_exchanger_data(exch_data)) != NET_NFC_OK) + { + g_printerr(" Exchanger data free failed : %d\n", result); + return; + } + net_nfc_free_data(rawdata); + + g_print("Exchanger data created and freed successfully\n"); return; } void net_nfc_test_send_exchanger_data(gpointer data, - gpointer user_data) + gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; net_nfc_target_handle_h handle = NULL; @@ -94,7 +114,7 @@ void net_nfc_test_send_exchanger_data(gpointer data, } void net_nfc_test_exchanger_request_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; @@ -108,25 +128,33 @@ void net_nfc_test_exchanger_request_connection_handover(gpointer data, } void net_nfc_test_exchanger_get_alternative_carrier_type(gpointer data, - gpointer user_data) + gpointer user_data) { net_nfc_error_e result = NET_NFC_OK; - net_nfc_connection_handover_info_h info = NULL; + /*Handover info needs to check-.As of now passing NULL*/ + net_nfc_connection_handover_info_s info; + info.type = NET_NFC_CONN_HANDOVER_CARRIER_WIFI_BSS; + net_nfc_conn_handover_carrier_type_e type = NET_NFC_CONN_HANDOVER_CARRIER_UNKNOWN; - result = net_nfc_client_exchanger_get_alternative_carrier_type(info, &type); + result = net_nfc_client_exchanger_get_alternative_carrier_type(&info, &type); g_print(" Exchanger alternative carrier type and result : %d \n %d",type, result); } 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; - net_nfc_connection_handover_info_h info = NULL; + net_nfc_error_e result = NET_NFC_OK; + /*Handover info needs to check-.As of now passing NULL*/ + net_nfc_connection_handover_info_s info; + uint8_t *carrier_data = "Wifi"; data_h data_info = NULL; - result = net_nfc_client_exchanger_get_alternative_carrier_data(info, &data_info); - g_print(" Exchanger alternative carrier result : %d \n",result); + data_info = calloc(1,sizeof(data_h)); + result = net_nfc_set_data(data,carrier_data,4); + + result = net_nfc_client_exchanger_get_alternative_carrier_data(&info, &data_info); + g_print(" Exchanger alternative carrier result : %d \n",result); print_received_data(data_info); } diff --git a/tests/net_nfc_test_handover.c b/tests/net_nfc_test_handover.c index 1136ce1..ce6ffdd 100644 --- a/tests/net_nfc_test_handover.c +++ b/tests/net_nfc_test_handover.c @@ -21,7 +21,7 @@ #include "net_nfc_typedef_internal.h" #include "net_nfc_typedef.h" #include "net_nfc_test_p2p.h" - +#include "net_nfc_util_internal.h" static void run_next_callback(gpointer user_data); @@ -31,6 +31,8 @@ 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 void run_next_callback(gpointer user_data) { @@ -50,6 +52,17 @@ static void p2p_connection_handover_cb(net_nfc_error_e result, g_print("Connection handover completed\n"); print_received_data(data); + + global_info->type = type; + + if(data->length > 0) + { + g_print("Callback has valid data \n"); + global_info->data.buffer = data->buffer; + global_info->data.length = data->length; + print_received_data(&global_info->data); + } + run_next_callback(user_data); } @@ -91,32 +104,34 @@ void net_nfc_test_p2p_connection_handover_sync(gpointer 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) { net_nfc_error_e result = NET_NFC_OK; net_nfc_conn_handover_carrier_type_e type; - net_nfc_connection_handover_info_h info = NULL; - result = net_nfc_client_handover_get_alternative_carrier_type( - (net_nfc_connection_handover_info_h) & info, &type); + result = net_nfc_client_handover_get_alternative_carrier_type(global_info, &type); g_print("Handover alternative carrier type -> %d", type); } -void net_nfc_test_handover_get_alternative_carrier_data(gpointer data, - gpointer user_data) - +void net_nfc_test_handover_handle_alternative_carrier_data(gpointer data, + gpointer user_datarrierData) { net_nfc_error_e result = NET_NFC_OK; data_h out_data = NULL; - net_nfc_connection_handover_info_h info = NULL; + net_nfc_connection_handover_info_h hand_info = NULL; - result = net_nfc_client_handover_get_alternative_carrier_data( - (net_nfc_connection_handover_info_h)&info, &out_data); + result = net_nfc_client_handover_get_alternative_carrier_data(global_info, &out_data); g_print(" Get alternative carrier data %d", result); print_received_data(out_data); - g_print("Handover get data carrier data completed\n"); + hand_info = global_info; + + result = net_nfc_client_handover_free_alternative_carrier_data(hand_info); + g_print("Free alternative carrier data %d", result); + } diff --git a/tests/net_nfc_test_llcp.c b/tests/net_nfc_test_llcp.c index e77eeb2..ce9ff00 100644 --- a/tests/net_nfc_test_llcp.c +++ b/tests/net_nfc_test_llcp.c @@ -24,6 +24,8 @@ static net_nfc_llcp_socket_t server_test_socket; static net_nfc_llcp_socket_t client_test_socket; +net_nfc_llcp_socket_option_h test_option = NULL; + static net_nfc_llcp_config_info_h llcp_config = NULL; static net_nfc_llcp_config_info_h llcp_config_sync = NULL; @@ -160,6 +162,16 @@ static void llcp_disconnect_socket_cb(net_nfc_error_e result, } +static void llcp_close_completed_cb(net_nfc_error_e result, + net_nfc_llcp_socket_t client_socket, + void *user_data) +{ + + g_print("llcp_close_completed_cb Completed %d\n", client_socket); + g_print("llcp_close_completed_cb Completed %d\n", result); + +} + /*********************************** Function Calls *************************************/ @@ -526,10 +538,10 @@ void net_nfc_test_llcp_free_config(gpointer data, void net_nfc_test_llcp_create_custom_socket_option(gpointer data, gpointer user_data) { - net_nfc_llcp_socket_option_h option; + net_nfc_error_e result; - result = net_nfc_client_llcp_create_socket_option(&option, + result = net_nfc_client_llcp_create_socket_option(&test_option, 128, 1, NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED); @@ -550,10 +562,10 @@ void net_nfc_test_llcp_create_custom_socket_option(gpointer data, void net_nfc_test_llcp_create_default_socket_option(gpointer data, gpointer user_data) { - net_nfc_llcp_socket_option_h option; + net_nfc_error_e result; - result = net_nfc_client_llcp_create_socket_option_default(&option); + result = net_nfc_client_llcp_create_socket_option_default(&test_option); if(result != NET_NFC_OK) { @@ -571,9 +583,9 @@ void net_nfc_test_llcp_get_local_socket_option(gpointer data, gpointer user_data) { net_nfc_error_e result; - net_nfc_llcp_socket_option_h option; + net_nfc_llcp_socket_option_h option_local; - result = net_nfc_client_llcp_get_local_socket_option(client_test_socket,&option); + result = net_nfc_client_llcp_get_local_socket_option(client_test_socket,&option_local); if(result != NET_NFC_OK) { @@ -582,9 +594,9 @@ if(result != NET_NFC_OK) return; } -g_print(" net_nfc_test_llcp_get_local_socket_option: %d\n", option->miu); -g_print("net_nfc_test_llcp_get_local_socket_option: %d\n", option->rw); -g_print(" net_nfc_test_llcp_get_local_socket_option: %d\n", option->type); +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); @@ -594,11 +606,10 @@ run_next_callback(user_data); void net_nfc_test_llcp_get_socket_option_miu(gpointer data, gpointer user_data) { - net_nfc_llcp_socket_option_s option; net_nfc_error_e result; uint16_t miu; - result = net_nfc_client_llcp_get_socket_option_miu(&option,&miu); + result = net_nfc_client_llcp_get_socket_option_miu(test_option,&miu); if(result != NET_NFC_OK) { @@ -616,11 +627,10 @@ void net_nfc_test_llcp_get_socket_option_miu(gpointer data, void net_nfc_test_llcp_set_socket_option_miu(gpointer data, gpointer user_data) { - net_nfc_llcp_socket_option_s option; net_nfc_error_e result; uint16_t miu = 128; - result = net_nfc_client_llcp_set_socket_option_miu(&option,miu); + result = net_nfc_client_llcp_set_socket_option_miu(test_option,miu); if(result != NET_NFC_OK) { @@ -636,11 +646,11 @@ void net_nfc_test_llcp_set_socket_option_miu(gpointer data, void net_nfc_test_llcp_get_socket_option_rw(gpointer data, gpointer user_data) { - net_nfc_llcp_socket_option_s option; + net_nfc_error_e result; uint8_t rw; - result = net_nfc_client_llcp_get_socket_option_rw(&option,&rw); + result = net_nfc_client_llcp_get_socket_option_rw(test_option,&rw); if(result != NET_NFC_OK) { @@ -657,11 +667,11 @@ void net_nfc_test_llcp_get_socket_option_rw(gpointer data, void net_nfc_test_llcp_set_socket_option_rw(gpointer data, gpointer user_data) { - net_nfc_llcp_socket_option_s option; + net_nfc_error_e result; uint8_t rw = 1; - result = net_nfc_client_llcp_set_socket_option_rw(&option,rw); + result = net_nfc_client_llcp_set_socket_option_rw(test_option,rw); if(result != NET_NFC_OK) { @@ -677,11 +687,10 @@ void net_nfc_test_llcp_set_socket_option_rw(gpointer data, void net_nfc_test_llcp_get_socket_option_type(gpointer data, gpointer user_data) { - net_nfc_llcp_socket_option_s option; net_nfc_error_e result; net_nfc_socket_type_e type; - result = net_nfc_client_llcp_get_socket_option_type(&option,&type); + result = net_nfc_client_llcp_get_socket_option_type(test_option,&type); if(result != NET_NFC_OK) { @@ -698,11 +707,11 @@ void net_nfc_test_llcp_get_socket_option_type(gpointer data, void net_nfc_test_llcp_set_socket_option_type(gpointer data, gpointer user_data) { - net_nfc_llcp_socket_option_s option; + net_nfc_error_e result; net_nfc_socket_type_e type = NET_NFC_LLCP_SOCKET_TYPE_CONNECTIONORIENTED; - result = net_nfc_client_llcp_set_socket_option_type(&option,type); + result = net_nfc_client_llcp_set_socket_option_type(test_option,type); if(result != NET_NFC_OK) { @@ -718,10 +727,9 @@ void net_nfc_test_llcp_set_socket_option_type(gpointer data, void net_nfc_test_llcp_free_socket_option(gpointer data, gpointer user_data) { - net_nfc_llcp_socket_option_s option; net_nfc_error_e result; - result = net_nfc_client_llcp_free_socket_option(&option); + result = net_nfc_client_llcp_free_socket_option(test_option); if(result != NET_NFC_OK) { @@ -868,6 +876,44 @@ void net_nfc_test_llcp_receive_from_sync(gpointer data, } +void net_nfc_test_llcp_create_socket(gpointer data, + gpointer user_data) +{ + + net_nfc_client_llcp_create_socket(&client_test_socket, NULL); + + g_print(" net_nfc_test_llcp_create_socket finished\n"); + +} + + +void net_nfc_test_llcp_close_socket(gpointer data, + gpointer user_data) +{ + net_nfc_error_e result; + + result = net_nfc_client_llcp_close(client_test_socket, + 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) +{ + net_nfc_llcp_socket_t out_socket; + net_nfc_error_e result; + + result = net_nfc_client_llcp_close_sync(client_test_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) diff --git a/tests/net_nfc_test_sys_handler.c b/tests/net_nfc_test_sys_handler.c new file mode 100755 index 0000000..c473415 --- /dev/null +++ b/tests/net_nfc_test_sys_handler.c @@ -0,0 +1,81 @@ +/* +* 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 + +#include "net_nfc_test_sys_handler.h" +#include "net_nfc_typedef_internal.h" +#include "net_nfc_client_system_handler.h" +#include "net_nfc_target_info.h" + + +/*************************** utility Calls ******************************/ + +static void run_next_callback(gpointer user_data); + +static void run_next_callback(gpointer user_data) +{ + if (user_data) + { + GCallback callback; + + callback = (GCallback)(user_data); + callback(); + } +} + +/********************** Function Calls ******************************/ + +void net_nfc_test_sys_handler_set_launch_popup_state(gpointer data, + gpointer user_data) +{ + net_nfc_error_e result; + int enable = 1; + + result = net_nfc_client_sys_handler_set_launch_popup_state(enable); + + if(result != NET_NFC_OK) + { + g_print("System handler set launch popup state failed: %d\n", result); + } + else + { + g_print("System handler set launch popup state success: %d\n", result); + } + + run_next_callback(user_data); +} + +void net_nfc_test_sys_handler_get_launch_popup_state(gpointer data, + gpointer user_data) +{ + net_nfc_error_e result; + int state = 0; + + result = net_nfc_client_sys_handler_get_launch_popup_state(&state); + + if(result != NET_NFC_OK) + { + g_print("System handler get launch popup state failed: %d\n", result); + } + else + { + g_print("System handler get launch popup state success: %d\n", result); + g_print("System handler get launch popup state value: %d\n", state); + } + + run_next_callback(user_data); +}