Cleanup of unused pkg config files
[platform/core/system/sensord.git] / src / server / plugins / sensor_module_create.cpp
1 #define ACCEL strcmp("@ACCEL@", "ON")
2 #define AUTO_ROTATION strcmp("@AUTO_ROTATION@", "ON")
3 #define GYRO strcmp("@GYRO@", "ON")
4 #define PROXI strcmp("@PROXI@", "ON")
5 #define LIGHT strcmp("@LIGHT@", "ON")
6 #define GEO strcmp("@GEO@", "ON")
7 #define PRESSURE strcmp("@PRESSURE@", "ON")
8 #define TEMPERATURE strcmp("@TEMPERATURE@", "ON")
9 #define ULTRAVIOLET strcmp("@ULTRAVIOLET@", "ON")
10 #define ORIENTATION strcmp("@ORIENTATION@", "ON")
11 #define GRAVITY strcmp("@GRAVITY@", "ON")
12 #define LINEAR_ACCEL strcmp("@LINEAR_ACCEL@", "ON")
13 #define GEOMAGNETIC_RV strcmp("@GEOMAGNETIC_RV@", "ON")
14 #define GAMING_RV strcmp("@GAMING_RV@", "ON")
15 #define RV strcmp("@RV@", "ON")
16 #define TILT strcmp("@TILT@", "ON")
17 #define UNCAL_GYRO strcmp("@UNCAL_GYRO@", "ON")
18 #define BIO_LED_RED strcmp("@BIO_LED_RED@", "ON")
19 #define RV_RAW strcmp("@RV_RAW@", "ON")
20
21 #if $ACCEL == 1
22 #include <accel_sensor.h>
23 #endif
24 #if $GYRO == 1
25 #include <gyro_sensor.h>
26 #endif
27 #if $PROXI == 1
28 #include <proxi_sensor.h>
29 #endif
30 #if $LIGHT == 1
31 #include <light_sensor.h>
32 #endif
33 #if $GEO == 1
34 #include <geo_sensor.h>
35 #endif
36 #if $AUTO_ROTATION == 1
37 #include <auto_rotation_sensor.h>
38 #endif
39 #if $PRESSURE == 1
40 #include <pressure_sensor.h>
41 #endif
42 #if $TEMPERATURE == 1
43 #include <temperature_sensor.h>
44 #endif
45 #if $HUMIDITY == 1
46 #include <humidity_sensor.h>
47 #endif
48 #if $ULTRAVIOLET == 1
49 #include <ultraviolet_sensor.h>
50 #endif
51 #if $BIO_LED_RED == 1
52 #include <bio_led_red_sensor.h>
53 #endif
54 #if $ORIENTATION == 1
55 #include <orientation_sensor.h>
56 #endif
57 #if $GEOMAGNETIC_RV == 1
58 #include <geomagnetic_rv_sensor.h>
59 #endif
60 #if $GAMING_RV == 1
61 #include <gaming_rv_sensor.h>
62 #endif
63 #if $TILT == 1
64 #include <tilt_sensor.h>
65 #endif
66 #if $UNCAL_GYRO == 1
67 #include <uncal_gyro_sensor.h>
68 #endif
69 #if $GRAVITY == 1
70 #include <gravity_sensor.h>
71 #endif
72 #if $LINEAR_ACCEL == 1
73 #include <linear_accel_sensor.h>
74 #endif
75 #if $RV == 1
76 #include <rv_sensor.h>
77 #endif
78 #if $RV_RAW == 1
79 #include <rv_raw_sensor.h>
80 #endif
81
82 #include <sf_common.h>
83
84 extern "C" sensor_module* create(void)
85 {
86         sensor_module *module = new(std::nothrow) sensor_module;
87         retvm_if(!module, NULL, "Failed to allocate memory");
88
89 #if $ACCEL == 1
90         accel_sensor *accel_sensor = NULL;
91         try {
92                 accel_sensor = new(std::nothrow) accel_sensor;
93         } catch (int err) {
94                 ERR("Failed to create accel_sensor module, err: %d, cause: %s", err, strerror(err));
95         }
96         if (!accel_sensor)
97                 module->sensors.push_back(accel_sensor);
98 #endif
99 #if $AUTO_ROTATION == 1
100         auto_rotation_sensor *auto_rotation_sensor = NULL;
101         try {
102                 auto_rotation_sensor = new(std::nothrow) auto_rotation_sensor;
103         } catch (int err) {
104                 ERR("Failed to create auto_rotation_sensor module, err: %d, cause: %s", err, strerror(err));
105         }
106         if (!auto_rotation_sensor)
107                 module->sensors.push_back(auto_rotation_sensor);
108 #endif
109 #if $GYRO == 1
110         gyro_sensor *gyro_sensor = NULL;
111         try {
112                 gyro_sensor = new(std::nothrow) gyro_sensor;
113         } catch (int err) {
114                 ERR("Failed to create gyro_sensor module, err: %d, cause: %s", err, strerror(err));
115         }
116         if (!gyro_sensor)
117                 module->sensors.push_back(gyro_sensor);
118 #endif
119 #if $PROXI == 1
120         proxi_sensor *proxi_sensor = NULL;
121         try {
122                 proxi_sensor = new(std::nothrow) proxi_sensor;
123         } catch (int err) {
124                 ERR("Failed to create proxi_sensor module, err: %d, cause: %s", err, strerror(err));
125         }
126         if (!proxi_sensor)
127                 module->sensors.push_back(proxi_sensor);
128 #endif
129 #if $LIGHT == 1
130         light_sensor *light_sensor = NULL;
131         try {
132                 light_sensor = new(std::nothrow) light_sensor;
133         } catch (int err) {
134                 ERR("Failed to create light_sensor module, err: %d, cause: %s", err, strerror(err));
135         }
136         if (!light_sensor)
137                 module->sensors.push_back(light_sensor);
138 #endif
139 #if $GEO == 1
140         geo_sensor *geo_sensor = NULL;
141         try {
142                 geo_sensor = new(std::nothrow) geo_sensor;
143         } catch (int err) {
144                 ERR("Failed to create geo_sensor module, err: %d, cause: %s", err, strerror(err));
145         }
146         if (!geo_sensor)
147                 module->sensors.push_back(geo_sensor);
148 #endif
149 #if $PRESSURE == 1
150         pressure_sensor *pressure_sensor = NULL;
151         try {
152                 pressure_sensor = new(std::nothrow) pressure_sensor;
153         } catch (int err) {
154                 ERR("Failed to create pressure_sensor module, err: %d, cause: %s", err, strerror(err));
155         }
156         if (!pressure_sensor)
157                 module->sensors.push_back(pressure_sensor);
158 #endif
159 #if $TEMPERATURE == 1
160
161         temperature_sensor *temperature_sensor = NULL;
162         try {
163                 temperature_sensor = new(std::nothrow) temperature_sensor;
164         } catch (int err) {
165                 ERR("Failed to create temperature_sensor module, err: %d, cause: %s", err, strerror(err));
166         }
167         if (!temperature_sensor)
168                 module->sensors.push_back(temperature_sensor);
169
170 #endif
171 #if $ULTRAVIOLET == 1
172         ultraviolet_sensor *ultraviolet_sensor = NULL;
173         try {
174                 ultraviolet_sensor = new(std::nothrow) ultraviolet_sensor;
175         } catch (int err) {
176                 ERR("Failed to create ultraviolet_sensor module, err: %d, cause: %s", err, strerror(err));
177         }
178         if (!ultraviolet_sensor)
179                 module->sensors.push_back(ultraviolet_sensor);
180 #endif
181 #if $ORIENTATION == 1
182         orientation_sensor *orientation_sensor = NULL;
183         try {
184                 orientation_sensor = new(std::nothrow) orientation_sensor;
185         } catch (int err) {
186                 ERR("Failed to create orientation_sensor module, err: %d, cause: %s", err, strerror(err));
187         }
188         if (!orientation_sensor)
189                 module->sensors.push_back(orientation_sensor);
190 #endif
191 #if $GRAVITY == 1
192         gravity_sensor *gravity_sensor = NULL;
193         try {
194                 gravity_sensor = new(std::nothrow) gravity_sensor;
195         } catch (int err) {
196                 ERR("Failed to create gravity_sensor module, err: %d, cause: %s", err, strerror(err));
197         }
198         if (!gravity_sensor)
199                 module->sensors.push_back(gravity_sensor);
200 #endif
201 #if $LINEAR_ACCEL == 1
202         linear_accel_sensor *linear_accel_sensor = NULL;
203         try {
204                 linear_accel_sensor = new(std::nothrow) linear_accel_sensor;
205         } catch (int err) {
206                 ERR("Failed to create linear_accel_sensor module, err: %d, cause: %s", err, strerror(err));
207         }
208         if (!linear_accel_sensor)
209                 module->sensors.push_back(linear_accel_sensor);
210 #endif
211 #if $GEOMAGNETIC_RV == 1
212         geomagnetic_rv_sensor *geomagnetic_rv_sensor = NULL;
213         try {
214                 geomagnetic_rv_sensor = new(std::nothrow) geomagnetic_rv_sensor;
215         } catch (int err) {
216                 ERR("Failed to create geomagnetic_rv_sensor module, err: %d, cause: %s", err, strerror(err));
217         }
218         if (!geomagnetic_rv_sensor)
219                 module->sensors.push_back(geomagnetic_rv_sensor);
220 #endif
221 #if $GAMING_RV == 1
222         gaming_rv_sensor *gaming_rv_sensor = NULL;
223         try {
224                 gaming_rv_sensor = new(std::nothrow) gaming_rv_sensor;
225         } catch (int err) {
226                 ERR("Failed to create gaming_rv_sensor module, err: %d, cause: %s", err, strerror(err));
227         }
228         if (!gaming_rv_sensor)
229                 module->sensors.push_back(gaming_rv_sensor);
230 #endif
231 #if $RV == 1
232         rv_sensor *rv_sensor = NULL;
233         try {
234                 rv_sensor = new(std::nothrow) rv_sensor;
235         } catch (int err) {
236                 ERR("Failed to create rv_sensor module, err: %d, cause: %s", err, strerror(err));
237         }
238         if (!rv_sensor)
239                 module->sensors.push_back(rv_sensor);
240 #endif
241 #if $TILT == 1
242         tilt_sensor *tilt_sensor = NULL;
243         try {
244                 tilt_sensor = new(std::nothrow) tilt_sensor;
245         } catch (int err) {
246                 ERR("Failed to create tilt_sensor module, err: %d, cause: %s", err, strerror(err));
247         }
248         if (!tilt_sensor)
249                 module->sensors.push_back(tilt_sensor);
250 #endif
251 #if $UNCAL_GYRO == 1
252         uncal_gyro_sensor *uncal_gyro_sensor = NULL;
253         try {
254                 uncal_gyro_sensor = new(std::nothrow) uncal_gyro_sensor;
255         } catch (int err) {
256                 ERR("Failed to create uncal_gyro_sensor module, err: %d, cause: %s", err, strerror(err));
257         }
258         if (!uncal_gyro_sensor)
259                 module->sensors.push_back(uncal_gyro_sensor);
260 #endif
261 #if $BIO_LED_RED == 1
262         bio_led_red_sensor *bio_led_red_sensor = NULL;
263         try {
264                 bio_led_red_sensor = new(std::nothrow) bio_led_red_sensor;
265         } catch (int err) {
266                 ERR("Failed to create bio_led_red_sensor module, err: %d, cause: %s", err, strerror(err));
267         }
268         if (!bio_led_red_sensor)
269                 module->sensors.push_back(bio_led_red_sensor);
270 #endif
271 #if $RV_RAW == 1
272         rv_raw_sensor *rv_raw_sensor = NULL;
273         try {
274                 rv_raw_sensor = new(std::nothrow) rv_raw_sensor;
275         } catch (int err) {
276                 ERR("Failed to create rv_raw_sensor module, err: %d, cause: %s", err, strerror(err));
277         }
278         if (!rv_raw_sensor)
279                 module->sensors.push_back(rv_raw_sensor);
280
281 #endif
282
283         return module;
284 }