Deprecate some enum values about location status
[platform/core/api/runtime-info.git] / src / runtime_info_location.c
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20
21 #include <vconf.h>
22 #include <dlog.h>
23
24 #include <runtime_info.h>
25 #include <runtime_info_private.h>
26
27 #include <system_info.h>
28
29 #ifdef LOG_TAG
30 #undef LOG_TAG
31 #endif
32
33 #define LOG_TAG "CAPI_SYSTEM_RUNTIME_INFO"
34
35 static const char *VCONF_LOCATION_SERVICE_ENABLED = VCONFKEY_LOCATION_ENABLED;
36 static const char *VCONF_LOCATION_NETWORK_ENABLED = VCONFKEY_LOCATION_NETWORK_ENABLED;
37
38 int runtime_info_location_service_get_value(runtime_info_value_h value)
39 {
40         int vconf_value;
41         int ret;
42
43         LOGW("DEPRECATION WARNING: RUNTIME_INFO_KEY_LOCATION_SERVICE_ENABLED is deprecated and will be removed from next release.");
44
45         ret = runtime_info_vconf_get_value_int(VCONF_LOCATION_SERVICE_ENABLED, &vconf_value);
46         if (ret == RUNTIME_INFO_ERROR_NONE)
47                 value->b = vconf_value;
48
49         return ret;
50 }
51
52 int runtime_info_location_service_set_event_cb()
53 {
54         LOGW("DEPRECATION WARNING: RUNTIME_INFO_KEY_LOCATION_SERVICE_ENABLED is deprecated and will be removed from next release.");
55
56         return runtime_info_vconf_set_event_cb(VCONF_LOCATION_SERVICE_ENABLED, RUNTIME_INFO_KEY_LOCATION_SERVICE_ENABLED, 0);
57 }
58
59 void runtime_info_location_service_unset_event_cb()
60 {
61         LOGW("DEPRECATION WARNING: RUNTIME_INFO_KEY_LOCATION_SERVICE_ENABLED is deprecated and will be removed from next release.");
62
63         runtime_info_vconf_unset_event_cb(VCONF_LOCATION_SERVICE_ENABLED, 0);
64 }
65
66 int runtime_info_location_network_get_value(runtime_info_value_h value)
67 {
68         int vconf_value;
69         int ret;
70         bool supported;
71
72         LOGW("DEPRECATION WARNING: RUNTIME_INFO_KEY_LOCATION_NETWORK_POSITION_ENABLED is deprecated and will be removed from next release.");
73
74         ret = system_info_get_platform_bool("http://tizen.org/feature/location.wps", &supported);
75         if (ret != SYSTEM_INFO_ERROR_NONE)
76                 return RUNTIME_INFO_ERROR_IO_ERROR;
77
78         if (!supported)
79                 return RUNTIME_INFO_ERROR_NOT_SUPPORTED;
80
81         ret = runtime_info_vconf_get_value_int(VCONF_LOCATION_NETWORK_ENABLED, &vconf_value);
82         if (ret == RUNTIME_INFO_ERROR_NONE)
83                 value->b = vconf_value;
84
85         return ret;
86 }
87
88 int runtime_info_location_network_set_event_cb()
89 {
90         LOGW("DEPRECATION WARNING: RUNTIME_INFO_KEY_LOCATION_NETWORK_POSITION_ENABLED is deprecated and will be removed from next release.");
91
92         return runtime_info_vconf_set_event_cb(VCONF_LOCATION_NETWORK_ENABLED, RUNTIME_INFO_KEY_LOCATION_NETWORK_POSITION_ENABLED, 0);
93 }
94
95 void runtime_info_location_network_unset_event_cb()
96 {
97         LOGW("DEPRECATION WARNING: RUNTIME_INFO_KEY_LOCATION_NETWORK_POSITION_ENABLED is deprecated and will be removed from next release.");
98
99         runtime_info_vconf_unset_event_cb(VCONF_LOCATION_NETWORK_ENABLED, 0);
100 }