Remove unnecessary setting
[platform/core/connectivity/nfc-manager-neard.git] / tests / net_nfc_test_client.c
1 /*
2  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *                               http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #include <glib-object.h>
19
20 #include "net_nfc_test_client.h"
21 #include "net_nfc_client_context.h"
22 #include "net_nfc_test_client.h"
23 #include "net_nfc_typedef_internal.h"
24
25
26 static void run_next_callback(gpointer user_data);
27
28 static void run_next_callback(gpointer user_data)
29 {
30         if (user_data)
31         {
32                 GCallback callback;
33
34                 callback = (GCallback)(user_data);
35                 callback();
36         }
37 }
38
39 void net_nfc_test_initialize(gpointer data, gpointer user_data)
40 {
41         net_nfc_error_e result = NET_NFC_OK;
42
43         result = net_nfc_client_initialize();
44
45         if(result != NET_NFC_OK)
46         {
47                 g_print("Client Initialization failed & Result is %d\n", result);
48                 return;
49         }
50
51         g_print("Client Initialization Completed & Result is %d\n", result);
52
53         run_next_callback(user_data);
54 }
55
56 void net_nfc_test_deinitialize(gpointer data, gpointer user_data)
57 {
58         net_nfc_error_e result = NET_NFC_OK;
59
60         result = net_nfc_client_deinitialize();
61
62         g_print("Client Deinitialization Completed & Result is %d\n", result);
63 }
64
65 void net_nfc_test_is_nfc_supported(gpointer data, gpointer user_data)
66 {
67         int feature = 0;
68         net_nfc_error_e result = NET_NFC_OK;
69
70         result = net_nfc_client_is_nfc_supported(&feature);
71
72         if((result != NET_NFC_OK) || (feature != 1))
73         {
74                 g_print("Client is_nfc_supported failed & result is %d\n", result);
75                 g_print("Client is_nfc_supported failed & feature value is %d\n", feature);
76                 return;
77         }
78
79         g_print("Client is_nfc_supported completed & feature value is %d\n", feature);
80         g_print("Client is_nfc_supported completed & result is %d\n", result);
81
82         run_next_callback(user_data);
83 }
84
85 void net_nfc_test_get_nfc_state(gpointer data, gpointer user_data)
86 {
87         int state = 0;
88         net_nfc_error_e result = NET_NFC_OK;
89
90         result = net_nfc_client_get_nfc_state(&state);
91
92         if((result != NET_NFC_OK) || (state != 1))
93         {
94                 g_print("Client get_nfc_state failed & result is %d\n", result);
95                 g_print("Client get_nfc_state failed & state value is %d\n", state);
96                 return;
97         }
98
99         g_print("Client get_nfc_state completed & state value is %d\n", state);
100         g_print("Client get_nfc_state completed & result is %d\n", result);
101
102         run_next_callback(user_data);
103 }