[Fix 64bit Build Error] Correctly type casting unsigned int to pointer using GLIB...
[platform/core/api/nfc.git] / src / net_nfc_client_context.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 "vconf.h"
18
19 #include "net_nfc_typedef.h"
20 #include "net_nfc_client.h"
21
22 #ifndef NET_NFC_EXPORT_API
23 #define NET_NFC_EXPORT_API __attribute__((visibility("default")))
24 #endif
25
26
27 NET_NFC_EXPORT_API
28 net_nfc_error_e net_nfc_client_initialize()
29 {
30         net_nfc_error_e result = NET_NFC_OK;
31
32         net_nfc_client_gdbus_init();
33
34         return result;
35 }
36
37
38 NET_NFC_EXPORT_API
39 net_nfc_error_e net_nfc_client_deinitialize()
40 {
41         net_nfc_error_e result = NET_NFC_OK;
42
43         net_nfc_client_gdbus_deinit();
44
45         return result;
46 }
47
48
49 NET_NFC_EXPORT_API
50 net_nfc_error_e net_nfc_client_is_nfc_supported(int *state)
51 {
52         net_nfc_error_e ret;
53
54         if (state != NULL)
55         {
56                 if (vconf_get_bool(VCONFKEY_NFC_FEATURE, state) == 0)
57                 {
58                         ret = NET_NFC_OK;
59                 }
60                 else
61                 {
62                         ret = NET_NFC_INVALID_STATE;
63                 }
64         }
65         else
66         {
67                 ret = NET_NFC_NULL_PARAMETER;
68         }
69
70         return ret;
71 }
72
73
74 NET_NFC_EXPORT_API
75 net_nfc_error_e net_nfc_client_get_nfc_state(int *state)
76 {
77         net_nfc_error_e ret;
78
79         if (state != NULL)
80         {
81                 if (vconf_get_bool(VCONFKEY_NFC_STATE, state) == 0)
82                 {
83                         ret = NET_NFC_OK;
84                 }
85                 else
86                 {
87                         ret = NET_NFC_INVALID_STATE;
88                 }
89         }
90         else
91         {
92                 ret = NET_NFC_NULL_PARAMETER;
93         }
94
95         return ret;
96 }