f2d6251b86e290b818f1b7a9534be33cf2208a2b
[platform/framework/native/tizen-config-fw.git] / plugin_model / config_table.c
1 /*
2  * config-table.c
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: MyoungJun Park <email at samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <dlfcn.h>
24 #include "config_table.h"
25 #include "config_manager.h"
26 #include "plugin1.h"
27 char *get_complex_string_plugin_path()
28 {
29     return "/usr/lib/libplugin1.so";
30 }
31
32 char *get_complex_string_get(char *key)
33 {
34     PluginTizenConfig *(*fn) (int *);
35
36     fn = config_manager(get_complex_string_plugin_path(),
37         "get_plugin_complex_object");
38     char *val = config_manager_get(fn, key);
39
40     config_manager_close();
41     return val;
42 }
43
44 char *get_simple_text_plugin_path()
45 {
46     return "/usr/lib/libplugin1.so";
47 }
48
49 char *get_simple_text_get(char *key)
50 {
51     PluginTizenConfig *(*fn) (int *);
52
53     fn = config_manager(get_simple_text_plugin_path(),
54         "get_plugin_simple_object");
55     char *val = config_manager_get(fn, key);
56
57     config_manager_close();
58     return val;
59 }
60
61 char *get_language_list_version_plugin_path()
62 {
63     return "/usr/lib/libhelloworld_plugin.so";
64 }
65
66 int get_language_list_version_get_list(char *key, void (*tcf_iterator) (int,
67         void *, void *), void *data)
68 {
69     PluginTizenConfig *(*fn) (int *);
70
71     fn = config_manager(get_language_list_version_plugin_path(),
72         "get_plugin_langlist_object");
73     int val = config_manager_get_list(fn, key, tcf_iterator, data);
74
75     config_manager_close();
76     return val;
77 }
78
79 char *get_list_version_plugin_path()
80 {
81     return "/usr/lib/libhelloworld_plugin.so";
82 }
83
84 int get_list_version_get_list(char *key, void (*tcf_iterator) (int, void *,
85         void *), void *data)
86 {
87     PluginTizenConfig *(*fn) (int *);
88
89     fn = config_manager(get_list_version_plugin_path(),
90         "get_plugin_hellolist_object");
91     int val = config_manager_get_list(fn, key, tcf_iterator, data);
92
93     config_manager_close();
94     return val;
95 }
96
97 char *get_float_version_plugin_path()
98 {
99     return "/usr/lib/libhelloworld_plugin.so";
100 }
101
102 float get_float_version_get(char *key)
103 {
104     PluginTizenConfig *(*fn) (int *);
105
106     fn = config_manager(get_float_version_plugin_path(),
107         "get_plugin_hellofloat_object");
108     float val = config_manager_get_float(fn, key);
109
110     config_manager_close();
111     return val;
112 }
113
114 int get_float_version_set(char *key, float value)
115 {
116     PluginTizenConfig *(*fn) (int *);
117
118     fn = config_manager(get_float_version_plugin_path(),
119         "get_plugin_hellofloat_object");
120     config_manager_set_float(fn, key, value);
121     config_manager_close();
122     return 0;
123 }
124
125 char *get_bool_version_plugin_path()
126 {
127     return "/usr/lib/libhelloworld_plugin.so";
128 }
129
130 bool get_bool_version_get(char *key)
131 {
132     PluginTizenConfig *(*fn) (int *);
133
134     fn = config_manager(get_bool_version_plugin_path(),
135         "get_plugin_hellobool_object");
136     bool val = config_manager_get_bool(fn, key);
137
138     config_manager_close();
139     return val;
140 }
141
142 int get_bool_version_set(char *key, bool value)
143 {
144     PluginTizenConfig *(*fn) (int *);
145
146     fn = config_manager(get_bool_version_plugin_path(),
147         "get_plugin_hellobool_object");
148     config_manager_set_bool(fn, key, value);
149     config_manager_close();
150     return 0;
151 }
152
153 char *get_int_version_plugin_path()
154 {
155     return "/usr/lib/libhelloworld_plugin.so";
156 }
157
158 int get_int_version_get(char *key)
159 {
160     PluginTizenConfig *(*fn) (int *);
161
162     fn = config_manager(get_int_version_plugin_path(),
163         "get_plugin_helloint_object");
164     int val = config_manager_get_int(fn, key);
165
166     config_manager_close();
167     return val;
168 }
169
170 int get_int_version_set(char *key, int value)
171 {
172     PluginTizenConfig *(*fn) (int *);
173
174     fn = config_manager(get_int_version_plugin_path(),
175         "get_plugin_helloint_object");
176     config_manager_set_int(fn, key, value);
177     config_manager_close();
178     return 0;
179 }
180
181 char *get_sw_version_plugin_path()
182 {
183     return "/usr/lib/libplugin2.so";
184 }
185
186 char *get_sw_version_get(char *key)
187 {
188     PluginTizenConfig *(*fn) (int *);
189
190     fn = config_manager(get_sw_version_plugin_path(), "get_plugin_ini_object");
191     char *val = config_manager_get(fn, key);
192
193     config_manager_close();
194     return val;
195 }
196
197 char *get_info_from_xml_plugin_path()
198 {
199     return "/usr/lib/libplugin2.so";
200 }
201
202 char *get_info_from_xml_get(char *key)
203 {
204     PluginTizenConfig *(*fn) (int *);
205
206     fn = config_manager(get_info_from_xml_plugin_path(),
207         "get_plugin_xml_object");
208     char *val = config_manager_get(fn, key);
209
210     config_manager_close();
211     return val;
212 }
213
214 int get_info_from_xml_set(char *key, char *value)
215 {
216     PluginTizenConfig *(*fn) (int *);
217
218     fn = config_manager(get_info_from_xml_plugin_path(),
219         "get_plugin_xml_object");
220     config_manager_set(fn, key, value);
221     config_manager_close();
222     return 0;
223 }
224
225 char *get_info_from_dbus_plugin_path()
226 {
227     return "/usr/lib/libplugin2.so";
228 }
229
230 char *get_info_from_dbus_get(char *key)
231 {
232     PluginTizenConfig *(*fn) (int *);
233
234     fn = config_manager(get_info_from_dbus_plugin_path(),
235         "get_plugin_dbus_object");
236     char *val = config_manager_get(fn, key);
237
238     config_manager_close();
239     return val;
240 }
241
242 int get_info_from_dbus_set(char *key, char *value)
243 {
244     PluginTizenConfig *(*fn) (int *);
245
246     fn = config_manager(get_info_from_dbus_plugin_path(),
247         "get_plugin_dbus_object");
248     config_manager_set(fn, key, value);
249     config_manager_close();
250     return 0;
251 }