Fix doxygen
[platform/core/api/nfc.git] / src / net_nfc_client_test.c
1 /*
2  * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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 #include "net_nfc_debug_internal.h"
18 #include "net_nfc_util_gdbus_internal.h"
19 #include "net_nfc_gdbus.h"
20 #include "net_nfc_client.h"
21 #include "net_nfc_client_util_internal.h"
22 #include "net_nfc_client_manager.h"
23 #include "net_nfc_client_test.h"
24
25 #ifndef NET_NFC_EXPORT_API
26 #define NET_NFC_EXPORT_API __attribute__((visibility("default")))
27 #endif
28
29 /* LCOV_EXCL_START */
30
31 static void test_call_sim_test_callback(GObject *source_object,
32                                         GAsyncResult *res,
33                                         gpointer user_data);
34
35 static void test_call_prbs_test_callback(GObject *source_object,
36                                         GAsyncResult *res,
37                                         gpointer user_data);
38
39 static void test_call_get_firmware_version_callback(GObject *source_object,
40                                                 GAsyncResult *res,
41                                                 gpointer user_data);
42
43 static void test_call_set_ee_data_callback(GObject *source_object,
44                                         GAsyncResult *res,
45                                         gpointer user_data);
46
47 static void test_call_ese_test_callback(GObject *source_object,
48                                         GAsyncResult *res,
49                                         gpointer user_data);
50
51 static NetNfcGDbusTest *test_proxy = NULL;
52
53
54 static void test_call_sim_test_callback(GObject *source_object,
55                                         GAsyncResult *res,
56                                         gpointer user_data)
57 {
58         NetNfcCallback *func_data = (NetNfcCallback *)user_data;
59         net_nfc_error_e out_result;
60         GError *error = NULL;
61
62         g_assert(user_data != NULL);
63
64         if (net_nfc_gdbus_test_call_sim_test_finish(
65                                 NET_NFC_GDBUS_TEST(source_object),
66                                 (gint *)&out_result,
67                                 res,
68                                 &error) == FALSE) {
69                 if (error != NULL) {
70                         DEBUG_ERR_MSG("Can not finish sim_test: %s", error->message);
71                         g_error_free(error);
72                 }
73
74                 out_result = NET_NFC_IPC_FAIL;
75         }
76
77         if (func_data->callback != NULL) {
78                 net_nfc_client_test_sim_test_completed callback =
79                         (net_nfc_client_test_sim_test_completed)func_data->callback;
80
81                 callback(out_result, func_data->user_data);
82         }
83
84         g_free(func_data);
85 }
86
87 static void test_call_prbs_test_callback(GObject *source_object,
88                                         GAsyncResult *res,
89                                         gpointer user_data)
90 {
91         NetNfcCallback *func_data = (NetNfcCallback *)user_data;
92         net_nfc_error_e out_result;
93         GError *error = NULL;
94
95         g_assert(user_data != NULL);
96
97         if (net_nfc_gdbus_test_call_prbs_test_finish(
98                                 NET_NFC_GDBUS_TEST(source_object),
99                                 (gint *)&out_result,
100                                 res,
101                                 &error) == FALSE) {
102                 if (error != NULL) {
103                         DEBUG_ERR_MSG("Can not finish prbs test: %s", error->message);
104                         g_error_free(error);
105                 }
106
107                 out_result = NET_NFC_IPC_FAIL;
108         }
109
110         if (func_data->callback != NULL) {
111                 net_nfc_client_test_prbs_test_completed callback =
112                         (net_nfc_client_test_prbs_test_completed)func_data->callback;
113
114                 callback(out_result, func_data->user_data);
115         }
116
117         g_free(func_data);
118 }
119
120 static void test_call_get_firmware_version_callback(GObject *source_object,
121                                                 GAsyncResult *res,
122                                                 gpointer user_data)
123 {
124         NetNfcCallback *func_data = (NetNfcCallback *)user_data;
125         net_nfc_error_e out_result;
126         gchar *out_version = NULL;
127         GError *error = NULL;
128
129         g_assert(user_data != NULL);
130
131         if (net_nfc_gdbus_test_call_get_firmware_version_finish(
132                                 NET_NFC_GDBUS_TEST(source_object),
133                                 (gint *)&out_result,
134                                 &out_version,
135                                 res,
136                                 &error) == FALSE) {
137                 if (error != NULL) {
138                         DEBUG_ERR_MSG("Can not finish get_firmware_version: %s", error->message);
139                         g_error_free(error);
140                 }
141
142                 out_result = NET_NFC_IPC_FAIL;
143         }
144
145         if (func_data->callback != NULL) {
146                 net_nfc_client_test_get_firmware_version_completed callback =
147                         (net_nfc_client_test_get_firmware_version_completed)func_data->callback;
148
149                 callback(out_result, out_version, func_data->user_data);
150         }
151
152         g_free(out_version);
153         g_free(func_data);
154 }
155
156 static void test_call_set_ee_data_callback(GObject *source_object,
157                                         GAsyncResult *res,
158                                         gpointer user_data)
159 {
160         NetNfcCallback *func_data = (NetNfcCallback *)user_data;
161         net_nfc_error_e out_result;
162         GError *error = NULL;
163
164         g_assert(user_data != NULL);
165
166         if (net_nfc_gdbus_test_call_set_ee_data_finish(
167                                 NET_NFC_GDBUS_TEST(source_object),
168                                 (gint *)&out_result,
169                                 res,
170                                 &error) == FALSE) {
171                 if (error != NULL) {
172                         DEBUG_ERR_MSG("Can not finish set_ee_data: %s", error->message);
173                         g_error_free(error);
174                 }
175
176                 out_result = NET_NFC_IPC_FAIL;
177         }
178
179         if (func_data->callback != NULL) {
180                 net_nfc_client_test_set_ee_data_completed callback =
181                         (net_nfc_client_test_set_ee_data_completed)func_data->callback;
182
183                 callback(out_result, func_data->user_data);
184         }
185
186         g_free(func_data);
187 }
188
189 static void test_call_ese_test_callback(GObject *source_object,
190                                         GAsyncResult *res,
191                                         gpointer user_data)
192 {
193         NetNfcCallback *func_data = (NetNfcCallback *)user_data;
194         net_nfc_error_e out_result;
195         GError *error = NULL;
196
197         g_assert(user_data != NULL);
198
199         if (net_nfc_gdbus_test_call_ese_test_finish(
200                                 NET_NFC_GDBUS_TEST(source_object),
201                                 (gint *)&out_result,
202                                 res,
203                                 &error) == FALSE) {
204                 if (error != NULL) {
205                         DEBUG_ERR_MSG("Can not finish sim_test: %s", error->message);
206                         g_error_free(error);
207                 }
208
209                 out_result = NET_NFC_IPC_FAIL;
210         }
211
212         if (func_data->callback != NULL) {
213                 net_nfc_client_test_ese_test_completed callback =
214                         (net_nfc_client_test_ese_test_completed)func_data->callback;
215
216                 callback(out_result, func_data->user_data);
217         }
218
219         g_free(func_data);
220 }
221
222
223 NET_NFC_EXPORT_API
224 net_nfc_error_e net_nfc_client_test_sim_test(
225                         net_nfc_client_test_sim_test_completed callback,
226                         void *user_data)
227 {
228         NetNfcCallback *func_data;
229
230         if (test_proxy == NULL) {
231                 if (net_nfc_client_test_init() != NET_NFC_OK) {
232                         DEBUG_ERR_MSG("test_proxy fail");
233                         return NET_NFC_NOT_INITIALIZED;
234                 }
235         }
236
237         /* prevent executing daemon when nfc is off */
238         if (net_nfc_client_manager_is_activated() == false)
239                 return NET_NFC_NOT_ACTIVATED;
240
241         func_data = g_try_new0(NetNfcCallback, 1);
242         if (func_data == NULL)
243                 return NET_NFC_ALLOC_FAIL;
244
245         func_data->callback = (gpointer)callback;
246         func_data->user_data = user_data;
247
248         net_nfc_gdbus_test_call_sim_test(test_proxy,
249                                         NULL,
250                                         test_call_sim_test_callback,
251                                         func_data);
252
253         return NET_NFC_OK;
254 }
255
256 NET_NFC_EXPORT_API
257 net_nfc_error_e net_nfc_client_test_sim_test_sync(void)
258 {
259         net_nfc_error_e out_result = NET_NFC_OK;
260         GError *error = NULL;
261
262         if (test_proxy == NULL) {
263                 if (net_nfc_client_test_init() != NET_NFC_OK) {
264                         DEBUG_ERR_MSG("test_proxy fail");
265                         return NET_NFC_NOT_INITIALIZED;
266                 }
267         }
268
269         /* prevent executing daemon when nfc is off */
270         if (net_nfc_client_manager_is_activated() == false)
271                 return NET_NFC_NOT_ACTIVATED;
272
273         if (net_nfc_gdbus_test_call_sim_test_sync(test_proxy,
274                                         (gint *)&out_result,
275                                         NULL,
276                                         &error) == FALSE) {
277                 if (error != NULL) {
278                         DEBUG_ERR_MSG("can not call SimTest: %s", error->message);
279                         g_error_free(error);
280                 }
281
282                 out_result = NET_NFC_IPC_FAIL;
283         }
284
285         return out_result;
286 }
287
288 NET_NFC_EXPORT_API
289 net_nfc_error_e net_nfc_client_test_prbs_test(uint32_t tech,
290                         uint32_t rate,
291                         net_nfc_client_test_prbs_test_completed callback,
292                         void *user_data)
293 {
294         NetNfcCallback *func_data;
295
296         if (test_proxy == NULL) {
297                 if (net_nfc_client_test_init() != NET_NFC_OK) {
298                         DEBUG_ERR_MSG("test_proxy fail");
299                         return NET_NFC_NOT_INITIALIZED;
300                 }
301         }
302
303         /* prevent executing daemon when nfc is off */
304         if (net_nfc_client_manager_is_activated() == false)
305                 return NET_NFC_NOT_ACTIVATED;
306
307         func_data = g_try_new0(NetNfcCallback, 1);
308         if (func_data == NULL)
309                 return NET_NFC_ALLOC_FAIL;
310
311         func_data->callback = (gpointer)callback;
312         func_data->user_data = user_data;
313
314         net_nfc_gdbus_test_call_prbs_test(test_proxy,
315                                         tech,
316                                         rate,
317                                         NULL,
318                                         test_call_prbs_test_callback,
319                                         func_data);
320
321         return NET_NFC_OK;
322 }
323
324 NET_NFC_EXPORT_API
325 net_nfc_error_e net_nfc_client_test_prbs_test_sync(uint32_t tech,
326                                                 uint32_t rate)
327 {
328         net_nfc_error_e out_result = NET_NFC_OK;
329         GError *error = NULL;
330
331         if (test_proxy == NULL) {
332                 if (net_nfc_client_test_init() != NET_NFC_OK) {
333                         DEBUG_ERR_MSG("test_proxy fail");
334                         return NET_NFC_NOT_INITIALIZED;
335                 }
336         }
337
338         /* prevent executing daemon when nfc is off */
339         if (net_nfc_client_manager_is_activated() == false)
340                 return NET_NFC_NOT_ACTIVATED;
341
342         if (net_nfc_gdbus_test_call_prbs_test_sync(test_proxy,
343                                         tech,
344                                         rate,
345                                         (gint *)&out_result,
346                                         NULL,
347                                         &error) == FALSE) {
348                 if (error != NULL) {
349                         DEBUG_ERR_MSG("can not call PrbsTest: %s", error->message);
350                         g_error_free(error);
351                 }
352
353                 out_result = NET_NFC_IPC_FAIL;
354         }
355
356         return out_result;
357 }
358
359 NET_NFC_EXPORT_API
360 net_nfc_error_e net_nfc_client_test_get_firmware_version(
361                 net_nfc_client_test_get_firmware_version_completed callback,
362                 void *user_data)
363 {
364         NetNfcCallback *func_data;
365
366         if (test_proxy == NULL) {
367                 if (net_nfc_client_test_init() != NET_NFC_OK) {
368                         DEBUG_ERR_MSG("test_proxy fail");
369                         return NET_NFC_NOT_INITIALIZED;
370                 }
371         }
372
373         /* prevent executing daemon when nfc is off */
374         if (net_nfc_client_manager_is_activated() == false)
375                 return NET_NFC_NOT_ACTIVATED;
376
377         func_data = g_try_new0(NetNfcCallback, 1);
378         if (func_data == NULL)
379                 return NET_NFC_ALLOC_FAIL;
380
381         func_data->callback = (gpointer)callback;
382         func_data->user_data = user_data;
383
384         net_nfc_gdbus_test_call_get_firmware_version(test_proxy,
385                                 NULL,
386                                 test_call_get_firmware_version_callback,
387                                 func_data);
388
389         return NET_NFC_OK;
390 }
391
392 NET_NFC_EXPORT_API
393 net_nfc_error_e net_nfc_client_test_get_firmware_version_sync(char **version)
394 {
395         net_nfc_error_e out_result = NET_NFC_OK;
396         gchar *out_version = NULL;
397         GError *error = NULL;
398
399         if (version == NULL)
400                 return NET_NFC_NULL_PARAMETER;
401
402         *version = NULL;
403
404         if (test_proxy == NULL) {
405                 if (net_nfc_client_test_init() != NET_NFC_OK) {
406                         DEBUG_ERR_MSG("test_proxy fail");
407                         return NET_NFC_NOT_INITIALIZED;
408                 }
409         }
410
411         /* prevent executing daemon when nfc is off */
412         if (net_nfc_client_manager_is_activated() == false)
413                 return NET_NFC_NOT_ACTIVATED;
414
415         if (net_nfc_gdbus_test_call_get_firmware_version_sync(test_proxy,
416                                         (gint *)&out_result,
417                                         &out_version,
418                                         NULL,
419                                         &error) == TRUE) {
420                 *version = out_version;
421         } else {
422                 if (error != NULL) {
423                         DEBUG_ERR_MSG("can not call Get Firmware version: %s", error->message);
424                         g_error_free(error);
425                 }
426
427                 out_result = NET_NFC_IPC_FAIL;
428         }
429
430         return out_result;
431 }
432
433 NET_NFC_EXPORT_API
434 net_nfc_error_e net_nfc_client_test_set_ee_data(int mode,
435                         int reg_id,
436                         data_h data,
437                         net_nfc_client_test_set_ee_data_completed callback,
438                         void *user_data)
439 {
440         NetNfcCallback *func_data;
441         GVariant *variant;
442
443         if (test_proxy == NULL) {
444                 if (net_nfc_client_test_init() != NET_NFC_OK) {
445                         DEBUG_ERR_MSG("test_proxy fail");
446                         return NET_NFC_NOT_INITIALIZED;
447                 }
448         }
449
450         /* prevent executing daemon when nfc is off */
451         if (net_nfc_client_manager_is_activated() == false)
452                 return NET_NFC_NOT_ACTIVATED;
453
454         func_data = g_try_new0(NetNfcCallback, 1);
455         if (func_data == NULL)
456                 return NET_NFC_ALLOC_FAIL;
457
458         func_data->callback = (gpointer)callback;
459         func_data->user_data = user_data;
460
461         variant = net_nfc_util_gdbus_data_to_variant((data_s *)data);
462
463         net_nfc_gdbus_test_call_set_ee_data(test_proxy,
464                                         mode,
465                                         reg_id,
466                                         variant,
467                                         NULL,
468                                         test_call_set_ee_data_callback,
469                                         func_data);
470
471         return NET_NFC_OK;
472 }
473
474 NET_NFC_EXPORT_API
475 net_nfc_error_e net_nfc_client_test_set_ee_data_sync(int mode,
476                                                 int reg_id,
477                                                 data_h data)
478 {
479         net_nfc_error_e out_result = NET_NFC_OK;
480         GVariant *variant = NULL;
481         GError *error = NULL;
482
483         if (test_proxy == NULL) {
484                 if (net_nfc_client_test_init() != NET_NFC_OK) {
485                         DEBUG_ERR_MSG("test_proxy fail");
486                         return NET_NFC_NOT_INITIALIZED;
487                 }
488         }
489
490         /* prevent executing daemon when nfc is off */
491         if (net_nfc_client_manager_is_activated() == false)
492                 return NET_NFC_NOT_ACTIVATED;
493
494         variant = net_nfc_util_gdbus_data_to_variant((data_s *)data);
495
496         if (net_nfc_gdbus_test_call_set_ee_data_sync(test_proxy,
497                                         mode,
498                                         reg_id,
499                                         variant,
500                                         (gint *)&out_result,
501                                         NULL,
502                                         &error) == FALSE) {
503                 if (error != NULL) {
504                         DEBUG_ERR_MSG("can not call SetEeTest: %s", error->message);
505                         g_error_free(error);
506                 }
507
508                 out_result = NET_NFC_IPC_FAIL;
509         }
510
511         return out_result;
512 }
513
514 NET_NFC_EXPORT_API
515 net_nfc_error_e net_nfc_client_test_test_mode_on_sync(void)
516 {
517     net_nfc_error_e out_result = NET_NFC_OK;
518     GError *error = NULL;
519
520     DEBUG_CLIENT_MSG("NFC Test Mode ON SYNC!!!!");
521
522     if (test_proxy == NULL) {
523         if (net_nfc_client_test_init() != NET_NFC_OK) {
524             DEBUG_ERR_MSG("test_proxy fail");
525             return NET_NFC_NOT_INITIALIZED;
526         }
527     }
528
529     /* prevent executing daemon when nfc is off */
530     if (net_nfc_client_manager_is_activated() == false)
531         return NET_NFC_NOT_ACTIVATED;
532
533     if (net_nfc_gdbus_test_call_test_mode_on_sync(test_proxy,
534                     (gint *)&out_result,
535                     NULL,
536                     &error) == FALSE) {
537         if (error != NULL) {
538             DEBUG_ERR_MSG("can not call Test Mode On: %s", error->message);
539             g_error_free(error);
540         }
541
542         out_result = NET_NFC_IPC_FAIL;
543     }
544
545     return out_result;
546 }
547
548 NET_NFC_EXPORT_API
549 net_nfc_error_e net_nfc_client_test_test_mode_off_sync(void)
550 {
551     net_nfc_error_e out_result = NET_NFC_OK;
552     GError *error = NULL;
553
554     DEBUG_CLIENT_MSG("NFC Test Mode Off SYNC!!!!");
555
556     if (test_proxy == NULL) {
557         if (net_nfc_client_test_init() != NET_NFC_OK) {
558             DEBUG_ERR_MSG("test_proxy fail");
559             return NET_NFC_NOT_INITIALIZED;
560         }
561     }
562
563     /* prevent executing daemon when nfc is off */
564     if (net_nfc_client_manager_is_activated() == false)
565         return NET_NFC_NOT_ACTIVATED;
566
567     if (net_nfc_gdbus_test_call_test_mode_off_sync(test_proxy,
568                     (gint *)&out_result,
569                     NULL,
570                     &error) == FALSE) {
571         if (error != NULL) {
572             DEBUG_ERR_MSG("can not call Test Mode Off: %s", error->message);
573             g_error_free(error);
574         }
575
576         out_result = NET_NFC_IPC_FAIL;
577     }
578
579     return out_result;
580 }
581
582
583 NET_NFC_EXPORT_API
584 net_nfc_error_e net_nfc_client_test_ese_test(
585                         net_nfc_client_test_ese_test_completed callback,
586                         void *user_data)
587 {
588         NetNfcCallback *func_data;
589
590         DEBUG_CLIENT_MSG("NFC ESE Test!!!!");
591
592         if (test_proxy == NULL) {
593                 if (net_nfc_client_test_init() != NET_NFC_OK) {
594                         DEBUG_ERR_MSG("test_proxy fail");
595                         return NET_NFC_NOT_INITIALIZED;
596                 }
597         }
598
599         /* prevent executing daemon when nfc is off */
600         if (net_nfc_client_manager_is_activated() == false)
601                 return NET_NFC_NOT_ACTIVATED;
602
603         func_data = g_try_new0(NetNfcCallback, 1);
604         if (func_data == NULL)
605                 return NET_NFC_ALLOC_FAIL;
606
607         func_data->callback = (gpointer)callback;
608         func_data->user_data = user_data;
609
610         net_nfc_gdbus_test_call_ese_test(test_proxy,
611                                         NULL,
612                                         test_call_ese_test_callback,
613                                         func_data);
614
615         return NET_NFC_OK;
616 }
617
618 NET_NFC_EXPORT_API
619 net_nfc_error_e net_nfc_client_test_ese_test_sync(void)
620 {
621         net_nfc_error_e out_result = NET_NFC_OK;
622         GError *error = NULL;
623
624         DEBUG_CLIENT_MSG("NFC ESE Test SYNC!!!!");
625
626         if (test_proxy == NULL) {
627                 if (net_nfc_client_test_init() != NET_NFC_OK) {
628                         DEBUG_ERR_MSG("test_proxy fail");
629                         return NET_NFC_NOT_INITIALIZED;
630                 }
631         }
632
633         /* prevent executing daemon when nfc is off */
634         if (net_nfc_client_manager_is_activated() == false)
635                 return NET_NFC_NOT_ACTIVATED;
636
637         if (net_nfc_gdbus_test_call_ese_test_sync(test_proxy,
638                                         (gint *)&out_result,
639                                         NULL,
640                                         &error) == FALSE) {
641                 if (error != NULL) {
642                         DEBUG_ERR_MSG("can not call ESE Test: %s", error->message);
643                         g_error_free(error);
644                 }
645
646                 out_result = NET_NFC_IPC_FAIL;
647         }
648
649         return out_result;
650 }
651
652 NET_NFC_EXPORT_API
653 net_nfc_error_e net_nfc_client_test_set_se_tech_type_sync(
654         net_nfc_se_type_e type, int tech)
655 {
656         net_nfc_error_e out_result = NET_NFC_OK;
657         GError *error = NULL;
658
659         if (test_proxy == NULL) {
660                 if (net_nfc_client_test_init() != NET_NFC_OK) {
661                         DEBUG_ERR_MSG("test_proxy fail");
662                         return NET_NFC_NOT_INITIALIZED;
663                 }
664         }
665
666         /* prevent executing daemon when nfc is off */
667         if (net_nfc_client_manager_is_activated() == false)
668                 return NET_NFC_NOT_ACTIVATED;
669
670         if (net_nfc_gdbus_test_call_set_se_tech_type_sync(test_proxy,
671                                         (guint32)type,
672                                         (guint32)tech,
673                                         (gint *)&out_result,
674                                         NULL,
675                                         &error) == FALSE) {
676                 if (error != NULL) {
677                         DEBUG_ERR_MSG("can not call SetSeTechType: %s", error->message);
678                         g_error_free(error);
679                 }
680
681                 out_result = NET_NFC_IPC_FAIL;
682         }
683
684         return out_result;
685 }
686
687 NET_NFC_EXPORT_API
688 net_nfc_error_e net_nfc_client_test_set_listen_tech_mask_sync(uint32_t tech)
689 {
690         net_nfc_error_e result = NET_NFC_OK;
691         GError *error = NULL;
692
693         DEBUG_CLIENT_MSG("net_nfc_client_test_set_listen_tech_mask_sync start");
694
695         if (test_proxy == NULL) {
696                 if (net_nfc_client_test_init() != NET_NFC_OK) {
697                         DEBUG_ERR_MSG("test_proxy fail");
698                         return NET_NFC_NOT_INITIALIZED;
699                 }
700         }
701
702         /* prevent executing daemon when nfc is off */
703         if (net_nfc_client_manager_is_activated() == false)
704                 return NET_NFC_NOT_ACTIVATED;
705
706         if (net_nfc_gdbus_test_call_set_listen_tech_mask_sync(test_proxy,
707                                         tech,
708                                         &result,
709                                         NULL,
710                                         &error) == FALSE) {
711                 if (error != NULL) {
712                         DEBUG_ERR_MSG("can not call listen tech mask: %s", error->message);
713                         g_error_free(error);
714                 }
715
716                 result = NET_NFC_IPC_FAIL;
717         }
718
719         return result;
720 }
721
722
723 net_nfc_error_e net_nfc_client_test_init(void)
724 {
725         GError *error = NULL;
726
727         if (test_proxy) {
728                 DEBUG_CLIENT_MSG("Already initialized");
729
730                 return NET_NFC_OK;
731         }
732
733         test_proxy = net_nfc_gdbus_test_proxy_new_for_bus_sync(
734                                         G_BUS_TYPE_SYSTEM,
735                                         G_DBUS_PROXY_FLAGS_NONE,
736                                         "org.tizen.NetNfcService",
737                                         "/org/tizen/NetNfcService/Test",
738                                         NULL,
739                                         &error);
740         if (test_proxy == NULL) {
741                 if (error != NULL) {
742                         DEBUG_ERR_MSG("Can not create proxy : %s", error->message);
743                         g_error_free(error);
744                 }
745
746                 return NET_NFC_UNKNOWN_ERROR;
747         }
748
749         return NET_NFC_OK;
750 }
751
752 void net_nfc_client_test_deinit(void)
753 {
754         if (test_proxy) {
755                 g_object_unref(test_proxy);
756                 test_proxy = NULL;
757         }
758 }
759
760 /* LCOV_EXCL_STOP */
761