summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2015-11-05 16:00:40 -0200
committerFelipe Magno de Almeida <felipe@expertisesolutions.com.br>2015-11-05 16:00:40 -0200
commitf60f3595144090a6b5615db52ac5712692bafabb (patch)
tree743b043676b5611b4bfa918453a804c9e6815d59
parent6726a527fbcb9436e311c47ed92beb2c775bc07d (diff)
ecordova: dlsym for sensordevs/felipealmeida/ecordova
-rw-r--r--src/modules/ecordova/tizen/ecordova_contacts_service.h34
-rw-r--r--src/modules/ecordova/tizen/ecordova_device.c5
-rw-r--r--src/modules/ecordova/tizen/ecordova_devicemotion.c3
-rw-r--r--src/modules/ecordova/tizen/ecordova_devicemotion_private.h3
-rw-r--r--src/modules/ecordova/tizen/ecordova_deviceorientation.c2
-rw-r--r--src/modules/ecordova/tizen/ecordova_deviceorientation_private.h3
-rw-r--r--src/modules/ecordova/tizen/ecordova_sensor.c57
-rw-r--r--src/modules/ecordova/tizen/ecordova_sensor.h69
-rw-r--r--src/modules/ecordova/tizen/ecordova_tizen.c34
-rw-r--r--src/modules/ecordova/tizen/ecordova_tizen.h55
-rw-r--r--src/tests/ecordova/ecordova_devicemotion_test.c7
-rw-r--r--src/tests/ecordova/ecordova_deviceorientation_test.c2
12 files changed, 217 insertions, 57 deletions
diff --git a/src/modules/ecordova/tizen/ecordova_contacts_service.h b/src/modules/ecordova/tizen/ecordova_contacts_service.h
index 524615836e..e4274698b0 100644
--- a/src/modules/ecordova/tizen/ecordova_contacts_service.h
+++ b/src/modules/ecordova/tizen/ecordova_contacts_service.h
@@ -5,7 +5,7 @@
5#include <errno.h> 5#include <errno.h>
6#include <stdlib.h> 6#include <stdlib.h>
7 7
8#define CONTACTS_API 8#include "ecordova_tizen.h"
9 9
10struct __contacts_record_h; 10struct __contacts_record_h;
11typedef struct __contacts_record_h* contacts_record_h; 11typedef struct __contacts_record_h* contacts_record_h;
@@ -42,7 +42,7 @@ typedef struct __contacts_query_h* contacts_query_h;
42#define _CONTACTS_PROPERTY_PROJECTION_LLI(property_id_name) unsigned int property_id_name; 42#define _CONTACTS_PROPERTY_PROJECTION_LLI(property_id_name) unsigned int property_id_name;
43#define _CONTACTS_END_VIEW(name) \ 43#define _CONTACTS_END_VIEW(name) \
44 } name##_property_ids; \ 44 } name##_property_ids; \
45 extern CONTACTS_API const name##_property_ids* name; 45 extern const name##_property_ids* name;
46#define _CONTACTS_END_READ_ONLY_VIEW(name) _CONTACTS_END_VIEW(name) 46#define _CONTACTS_END_READ_ONLY_VIEW(name) _CONTACTS_END_VIEW(name)
47 47
48_CONTACTS_BEGIN_VIEW() 48_CONTACTS_BEGIN_VIEW()
@@ -339,36 +339,6 @@ extern int (*contacts_query_destroy)(contacts_query_h query);
339 339
340typedef struct _Ecordova_Contact_Data Ecordova_Contact_Data; 340typedef struct _Ecordova_Contact_Data Ecordova_Contact_Data;
341 341
342/* Check if slp error or not */
343#define TIZEN_ERROR_MIN_PLATFORM_ERROR (-1073741824LL) /* = -2147483648 / 2 */
344/* Tizen Contacts Error */
345#define TIZEN_ERROR_CONTACTS -0x02010000
346
347/**
348 * @brief Enumeration for tizen errors.
349 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
350 *
351*/
352typedef enum
353{
354 TIZEN_ERROR_NONE = 0, /**< Successful */
355 TIZEN_ERROR_OUT_OF_MEMORY = -ENOMEM, /**< Out of memory */
356 TIZEN_ERROR_INVALID_PARAMETER = -EINVAL, /**< Invalid function parameter */
357 TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE = -ENOSPC, /**< No space left on device */
358 TIZEN_ERROR_PERMISSION_DENIED = -EACCES, /**< Permission denied */
359 TIZEN_ERROR_NO_DATA = -ENODATA, /**< No data available */
360
361 TIZEN_ERROR_UNKNOWN = TIZEN_ERROR_MIN_PLATFORM_ERROR, /**< Unknown error */
362
363 /* This is a place to add new errors here.
364 * Do not assign integer values explicitly. Values are auto-assigned.
365 */
366 TIZEN_ERROR_TIMED_OUT, /**< Time out */
367 TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
368 TIZEN_ERROR_USER_NOT_CONSENTED, /**< Not Consented */
369 TIZEN_ERROR_END_OF_COLLECTION,
370} tizen_error_e;
371
372typedef enum 342typedef enum
373{ 343{
374 /* GENERAL */ 344 /* GENERAL */
diff --git a/src/modules/ecordova/tizen/ecordova_device.c b/src/modules/ecordova/tizen/ecordova_device.c
index f60a9aa5ac..90a2f5ec16 100644
--- a/src/modules/ecordova/tizen/ecordova_device.c
+++ b/src/modules/ecordova/tizen/ecordova_device.c
@@ -3,9 +3,7 @@
3#endif 3#endif
4 4
5#include "ecordova_device_private.h" 5#include "ecordova_device_private.h"
6 6#include "ecordova_tizen.h"
7#ifdef HAVE_TIZEN_INFO
8#include <system/system_info.h>
9 7
10#define MY_CLASS ECORDOVA_DEVICE_CLASS 8#define MY_CLASS ECORDOVA_DEVICE_CLASS
11#define MY_CLASS_NAME "Ecordova_Device" 9#define MY_CLASS_NAME "Ecordova_Device"
@@ -99,4 +97,3 @@ _ecordova_device_version_get(Eo *obj EINA_UNUSED, Ecordova_Device_Data *pd)
99} 97}
100 98
101#include "ecordova_device.eo.c" 99#include "ecordova_device.eo.c"
102#endif
diff --git a/src/modules/ecordova/tizen/ecordova_devicemotion.c b/src/modules/ecordova/tizen/ecordova_devicemotion.c
index a5344c04b6..99e4afa461 100644
--- a/src/modules/ecordova/tizen/ecordova_devicemotion.c
+++ b/src/modules/ecordova/tizen/ecordova_devicemotion.c
@@ -2,7 +2,6 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#ifdef HAVE_TIZEN_SENSOR
6#include "ecordova_devicemotion_private.h" 5#include "ecordova_devicemotion_private.h"
7 6
8#define MY_CLASS ECORDOVA_DEVICEMOTION_CLASS 7#define MY_CLASS ECORDOVA_DEVICEMOTION_CLASS
@@ -168,4 +167,4 @@ _hash_data_free(sensor_listener_h listener)
168} 167}
169 168
170#include "ecordova_devicemotion.eo.c" 169#include "ecordova_devicemotion.eo.c"
171#endif 170
diff --git a/src/modules/ecordova/tizen/ecordova_devicemotion_private.h b/src/modules/ecordova/tizen/ecordova_devicemotion_private.h
index fb75f4d810..36d4574191 100644
--- a/src/modules/ecordova/tizen/ecordova_devicemotion_private.h
+++ b/src/modules/ecordova/tizen/ecordova_devicemotion_private.h
@@ -2,8 +2,7 @@
2#define _ECORDOVA_DEVICEMOTION_PRIVATE_H 2#define _ECORDOVA_DEVICEMOTION_PRIVATE_H
3 3
4#include "ecordova_private.h" 4#include "ecordova_private.h"
5 5#include "ecordova_sensor.h"
6#include <sensor.h>
7 6
8typedef struct _Ecordova_DeviceMotion_Data Ecordova_DeviceMotion_Data; 7typedef struct _Ecordova_DeviceMotion_Data Ecordova_DeviceMotion_Data;
9 8
diff --git a/src/modules/ecordova/tizen/ecordova_deviceorientation.c b/src/modules/ecordova/tizen/ecordova_deviceorientation.c
index b3592f2589..8ba7f51acd 100644
--- a/src/modules/ecordova/tizen/ecordova_deviceorientation.c
+++ b/src/modules/ecordova/tizen/ecordova_deviceorientation.c
@@ -2,7 +2,6 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#ifdef HAVE_TIZEN_SENSOR
6#include "ecordova_deviceorientation_private.h" 5#include "ecordova_deviceorientation_private.h"
7 6
8#define MY_CLASS ECORDOVA_DEVICEORIENTATION_CLASS 7#define MY_CLASS ECORDOVA_DEVICEORIENTATION_CLASS
@@ -172,4 +171,3 @@ _hash_data_free(sensor_listener_h listener)
172} 171}
173 172
174#include "ecordova_deviceorientation.eo.c" 173#include "ecordova_deviceorientation.eo.c"
175#endif
diff --git a/src/modules/ecordova/tizen/ecordova_deviceorientation_private.h b/src/modules/ecordova/tizen/ecordova_deviceorientation_private.h
index a2f1c6dfea..055f538459 100644
--- a/src/modules/ecordova/tizen/ecordova_deviceorientation_private.h
+++ b/src/modules/ecordova/tizen/ecordova_deviceorientation_private.h
@@ -2,8 +2,7 @@
2#define _ECORDOVA_DEVICEORIENTATION_PRIVATE_H 2#define _ECORDOVA_DEVICEORIENTATION_PRIVATE_H
3 3
4#include "ecordova_private.h" 4#include "ecordova_private.h"
5 5#include "ecordova_sensor.h"
6#include <sensor.h>
7 6
8typedef struct _Ecordova_DeviceOrientation_Data Ecordova_DeviceOrientation_Data; 7typedef struct _Ecordova_DeviceOrientation_Data Ecordova_DeviceOrientation_Data;
9 8
diff --git a/src/modules/ecordova/tizen/ecordova_sensor.c b/src/modules/ecordova/tizen/ecordova_sensor.c
new file mode 100644
index 0000000000..acc38f65f6
--- /dev/null
+++ b/src/modules/ecordova/tizen/ecordova_sensor.c
@@ -0,0 +1,57 @@
1
2#include "ecordova_sensor.h"
3
4int (*sensor_listener_start)(sensor_listener_h listener) = 0;
5int (*sensor_listener_read_data)(sensor_listener_h listener, sensor_event_s *event) = 0;
6int (*sensor_destroy_listener)(sensor_listener_h listener) = 0;
7int (*sensor_listener_set_event_cb)(sensor_listener_h listener, unsigned int interval_ms, sensor_event_cb callback, void *data) = 0;
8int (*sensor_get_default_sensor)(sensor_type_e type, sensor_h *sensor) = 0;
9int (*sensor_create_listener)(sensor_h sensor, sensor_listener_h *listener) = 0;
10
11static void* system_sensor_lib = 0;
12
13void ecordova_sensor_shutdown()
14{
15 if(sensor_lib)
16 dlclose(sensor_lib);
17 sensor_listener_start = NULL;
18 sensor_listener_read_data = NULL;
19 sensor_destroy_listener = NULL;
20 sensor_listener_set_event_cb = NULL;
21 sensor_get_default_sensor = NULL;
22 sensor_create_listener = NULL;
23}
24
25void ecordova_sensor_init()
26{
27 if(!sensor_lib)
28 {
29 sensor_lib = dlopen("capi-system-sensor.so", RTLD_NOW);
30 if(!sensor_lib)
31 goto on_error;
32 sensor_listener_start = dlsym(sensor_lib, "sensor_listener_start");
33 if(!sensor_listener_start)
34 goto on_error;
35 sensor_listener_read_data = dlsym(sensor_lib, "sensor_listener_read_data");
36 if(!sensor_listener_read_data)
37 goto on_error;
38 sensor_destroy_listener = dlsym(sensor_lib, "sensor_destroy_listener");
39 if(!sensor_destroy_listener)
40 goto on_error;
41 sensor_listener_set_event_cb = dlsym(sensor_lib, "sensor_listener_set_event_cb");
42 if(!sensor_listener_set_event_cb)
43 goto on_error;
44 sensor_get_default_sensor = dlsym(sensor_lib, "sensor_get_default_sensor");
45 if(!sensor_get_default_sensor)
46 goto on_error;
47 sensor_create_listener = dlsym(sensor_lib, "sensor_create_listener");
48 if(!sensor_create_listener)
49 goto on_error;
50 }
51
52 return;
53on_error:
54 ecordova_sensor_shutdown();
55}
56
57
diff --git a/src/modules/ecordova/tizen/ecordova_sensor.h b/src/modules/ecordova/tizen/ecordova_sensor.h
new file mode 100644
index 0000000000..1d39a05c37
--- /dev/null
+++ b/src/modules/ecordova/tizen/ecordova_sensor.h
@@ -0,0 +1,69 @@
1#ifndef ECORDOVA_SENSOR_H
2#define ECORDOVA_SENSOR_H
3
4#include "ecordova_tizen.h"
5
6#define MAX_VALUE_SIZE 16
7
8typedef void* sensor_h;
9typedef void* sensor_listener_h;
10
11typedef struct
12{
13 int accuracy; /**< Accuracy */
14 unsigned long long timestamp; /**< Timestamp */
15 int value_count; /**< Count of values */
16 float values[MAX_VALUE_SIZE]; /**< Sensor values */
17} sensor_event_s;
18
19typedef enum
20{
21 SENSOR_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
22 SENSOR_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
23 SENSOR_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
24 SENSOR_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Unsupported sensor in the current device */
25 SENSOR_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
26 SENSOR_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
27 SENSOR_ERROR_NOT_NEED_CALIBRATION = TIZEN_ERROR_SENSOR | 0x03, /**< Sensor doesn't need calibration */
28 SENSOR_ERROR_OPERATION_FAILED = TIZEN_ERROR_SENSOR | 0x06, /**< Operation failed */
29} sensor_error_e;
30
31typedef enum
32{
33 SENSOR_ALL = -1, /**< All sensors */
34 SENSOR_ACCELEROMETER, /**< Accelerometer */
35 SENSOR_GRAVITY, /**< Gravity sensor */
36 SENSOR_LINEAR_ACCELERATION, /**< Linear acceleration sensor */
37 SENSOR_MAGNETIC, /**< Magnetic sensor */
38 SENSOR_ROTATION_VECTOR, /**< Rotation Vector sensor */
39 SENSOR_ORIENTATION, /**< Orientation sensor */
40 SENSOR_GYROSCOPE, /**< Gyroscope sensor */
41 SENSOR_LIGHT, /**< Light sensor */
42 SENSOR_PROXIMITY, /**< Proximity sensor */
43 SENSOR_PRESSURE, /**< Pressure sensor */
44 SENSOR_ULTRAVIOLET, /**< Ultraviolet sensor */
45 SENSOR_TEMPERATURE, /**< Temperature sensor */
46 SENSOR_HUMIDITY, /**< Humidity sensor */
47 SENSOR_HRM, /**< Heart Rate Monitor sensor @if MOBILE (Since Tizen 2.3.1) @endif */
48 SENSOR_HRM_LED_GREEN, /**< HRM (LED Green) sensor @if MOBILE (Since Tizen 2.3.1) @endif */
49 SENSOR_HRM_LED_IR, /**< HRM (LED IR) sensor @if MOBILE (Since Tizen 2.3.1) @endif */
50 SENSOR_HRM_LED_RED, /**< HRM (LED RED) sensor @if MOBILE (Since Tizen 2.3.1) @endif */
51 SENSOR_GYROSCOPE_UNCALIBRATED, /**< Uncalibrated Gyroscope sensor (Since Tizen 2.4) */
52 SENSOR_GEOMAGNETIC_UNCALIBRATED, /**< Uncalibrated Geomagnetic sensor (Since Tizen 2.4) */
53 SENSOR_GYROSCOPE_ROTATION_VECTOR, /**< Gyroscope-based rotation vector sensor (Since Tizen 2.4) */
54 SENSOR_GEOMAGNETIC_ROTATION_VECTOR, /**< Geomagnetic-based rotation vector sensor (Since Tizen 2.4) */
55 SENSOR_LAST, /**< End of sensor enum values */
56 SENSOR_CUSTOM = 10000 /**< Custom sensor */
57} sensor_type_e;
58
59typedef void (*sensor_event_cb)(sensor_h sensor, sensor_event_s *event, void *data);
60
61extern int (*sensor_listener_start)(sensor_listener_h listener);
62extern int (*sensor_listener_read_data)(sensor_listener_h listener, sensor_event_s *event);
63extern int (*sensor_destroy_listener)(sensor_listener_h listener);
64extern int (*sensor_listener_set_event_cb)(sensor_listener_h listener, unsigned int interval_ms, sensor_event_cb callback, void *data);
65extern int (*sensor_get_default_sensor)(sensor_type_e type, sensor_h *sensor);
66extern int (*sensor_create_listener)(sensor_h sensor, sensor_listener_h *listener);
67
68
69#endif
diff --git a/src/modules/ecordova/tizen/ecordova_tizen.c b/src/modules/ecordova/tizen/ecordova_tizen.c
index f496580119..e3de602f2a 100644
--- a/src/modules/ecordova/tizen/ecordova_tizen.c
+++ b/src/modules/ecordova/tizen/ecordova_tizen.c
@@ -3,17 +3,17 @@
3#endif 3#endif
4 4
5#include <Ecore.h> 5#include <Ecore.h>
6#include <dlfcn.h>
6 7
7int _ecordova_log_dom; 8int _ecordova_log_dom;
8 9
9#define CRI(...) EINA_LOG_DOM_CRIT(_ecordova_log_dom, __VA_ARGS__) 10int (*system_info_get_platform_string)(const char *key, char **value);
10#define ERR(...) EINA_LOG_DOM_ERR(_ecordova_log_dom, __VA_ARGS__) 11static void* system_info_lib = 0;
11#define WRN(...) EINA_LOG_DOM_WARN(_ecordova_log_dom, __VA_ARGS__)
12#define INF(...) EINA_LOG_DOM_INFO(_ecordova_log_dom, __VA_ARGS__)
13#define DBG(...) EINA_LOG_DOM_DBG(_ecordova_log_dom, __VA_ARGS__)
14 12
15void ecordova_contacts_service_init(); 13void ecordova_contacts_service_init();
16void ecordova_contacts_service_shutdown(); 14void ecordova_contacts_service_shutdown();
15void ecordova_sensor_init();
16void ecordova_sensor_shutdown();
17 17
18static Eina_Bool 18static Eina_Bool
19_ecordova_tizen_init(void) 19_ecordova_tizen_init(void)
@@ -26,6 +26,19 @@ _ecordova_tizen_init(void)
26 } 26 }
27 27
28 ecordova_contacts_service_init(); 28 ecordova_contacts_service_init();
29
30 if(!system_info_lib)
31 {
32 system_info_lib = dlopen("capi-system-info", RTLD_NOW);
33 if(system_info_lib)
34 {
35 system_info_get_platform_string = dlsym(system_info_lib, "system_info_get_platform_string");
36 if(!system_info_get_platform_string)
37 dlclose(system_info_lib);
38 }
39 }
40
41 ecordova_sensor_init();
29 42
30 return EINA_TRUE; 43 return EINA_TRUE;
31} 44}
@@ -33,9 +46,16 @@ _ecordova_tizen_init(void)
33static void 46static void
34_ecordova_tizen_shutdown(void) 47_ecordova_tizen_shutdown(void)
35{ 48{
36 ecordova_contacts_service_shutdown(); 49 ecordova_sensor_shutdown();
50
51 if(system_info_lib)
52 dlclose(system_info_lib);
53
54 system_info_get_platform_string = 0;
55
56 ecordova_contacts_service_shutdown();
37 57
38 eina_log_domain_unregister(_ecordova_log_dom); 58 eina_log_domain_unregister(_ecordova_log_dom);
39 _ecordova_log_dom = -1; 59 _ecordova_log_dom = -1;
40} 60}
41 61
diff --git a/src/modules/ecordova/tizen/ecordova_tizen.h b/src/modules/ecordova/tizen/ecordova_tizen.h
new file mode 100644
index 0000000000..f2fa676a77
--- /dev/null
+++ b/src/modules/ecordova/tizen/ecordova_tizen.h
@@ -0,0 +1,55 @@
1#ifndef ECORDOVA_TIZEN_H
2#define ECORDOVA_TIZEN_H
3
4extern int _ecordova_log_dom;
5
6#define CRI(...) EINA_LOG_DOM_CRIT(_ecordova_log_dom, __VA_ARGS__)
7#define ERR(...) EINA_LOG_DOM_ERR(_ecordova_log_dom, __VA_ARGS__)
8#define WRN(...) EINA_LOG_DOM_WARN(_ecordova_log_dom, __VA_ARGS__)
9#define INF(...) EINA_LOG_DOM_INFO(_ecordova_log_dom, __VA_ARGS__)
10#define DBG(...) EINA_LOG_DOM_DBG(_ecordova_log_dom, __VA_ARGS__)
11
12extern int (*system_info_get_platform_string)(const char *key, char **value);
13
14/* Check if slp error or not */
15#define TIZEN_ERROR_MIN_PLATFORM_ERROR (-1073741824LL) /* = -2147483648 / 2 */
16/* Tizen Contacts Error */
17#define TIZEN_ERROR_CONTACTS -0x02010000
18/* Tizen Sensor Error */
19#define TIZEN_ERROR_SENSOR -0x02440000
20
21/**
22 * @brief Enumeration for tizen errors.
23 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
24 *
25*/
26typedef enum
27{
28 TIZEN_ERROR_NONE = 0, /**< Successful */
29 TIZEN_ERROR_OUT_OF_MEMORY = -ENOMEM, /**< Out of memory */
30 TIZEN_ERROR_INVALID_PARAMETER = -EINVAL, /**< Invalid function parameter */
31 TIZEN_ERROR_FILE_NO_SPACE_ON_DEVICE = -ENOSPC, /**< No space left on device */
32 TIZEN_ERROR_PERMISSION_DENIED = -EACCES, /**< Permission denied */
33 TIZEN_ERROR_NO_DATA = -ENODATA, /**< No data available */
34 TIZEN_ERROR_IO_ERROR = -EIO, /**< I/O error */
35
36 TIZEN_ERROR_UNKNOWN = TIZEN_ERROR_MIN_PLATFORM_ERROR, /**< Unknown error */
37
38 /* This is a place to add new errors here.
39 * Do not assign integer values explicitly. Values are auto-assigned.
40 */
41 TIZEN_ERROR_TIMED_OUT, /**< Time out */
42 TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported */
43 TIZEN_ERROR_USER_NOT_CONSENTED, /**< Not Consented */
44 TIZEN_ERROR_END_OF_COLLECTION,
45} tizen_error_e;
46
47typedef enum {
48 SYSTEM_INFO_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
49 SYSTEM_INFO_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
50 SYSTEM_INFO_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
51 SYSTEM_INFO_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< An input/output error occurred when reading value from system */
52 SYSTEM_INFO_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< No permission to use the API */
53} system_info_error_e;
54
55#endif
diff --git a/src/tests/ecordova/ecordova_devicemotion_test.c b/src/tests/ecordova/ecordova_devicemotion_test.c
index c0a2179480..a63ab12848 100644
--- a/src/tests/ecordova/ecordova_devicemotion_test.c
+++ b/src/tests/ecordova/ecordova_devicemotion_test.c
@@ -8,7 +8,6 @@
8 8
9#include <check.h> 9#include <check.h>
10 10
11#ifdef HAVE_TIZEN_CONFIGURATION_MANAGER
12static void 11static void
13_setup(void) 12_setup(void)
14{ 13{
@@ -23,6 +22,7 @@ _teardown(void)
23 ck_assert_int_eq(ret, 0); 22 ck_assert_int_eq(ret, 0);
24} 23}
25 24
25#ifdef HAVE_TIZEN_SENSOR
26static Ecordova_Device * 26static Ecordova_Device *
27_devicemotion_new(void) 27_devicemotion_new(void)
28{ 28{
@@ -92,20 +92,17 @@ ecordova_devicemotion_test(TCase *tc)
92#else 92#else
93START_TEST(devicemotion_fail_load) 93START_TEST(devicemotion_fail_load)
94{ 94{
95 ecordova_init();
96
97 Ecordova_Device *devicemotion 95 Ecordova_Device *devicemotion
98 = eo_add(ECORDOVA_DEVICEMOTION_CLASS, NULL); 96 = eo_add(ECORDOVA_DEVICEMOTION_CLASS, NULL);
99 97
100 ck_assert_ptr_eq(devicemotion, NULL); 98 ck_assert_ptr_eq(devicemotion, NULL);
101
102 ecordova_shutdown();
103} 99}
104END_TEST 100END_TEST
105 101
106void 102void
107ecordova_devicemotion_test(TCase *tc) 103ecordova_devicemotion_test(TCase *tc)
108{ 104{
105 tcase_add_checked_fixture(tc, _setup, _teardown);
109 tcase_add_test(tc, devicemotion_fail_load); 106 tcase_add_test(tc, devicemotion_fail_load);
110} 107}
111#endif 108#endif
diff --git a/src/tests/ecordova/ecordova_deviceorientation_test.c b/src/tests/ecordova/ecordova_deviceorientation_test.c
index 4e3d4059e0..1c41b708ce 100644
--- a/src/tests/ecordova/ecordova_deviceorientation_test.c
+++ b/src/tests/ecordova/ecordova_deviceorientation_test.c
@@ -22,7 +22,7 @@ _teardown(void)
22 ck_assert_int_eq(ret, 0); 22 ck_assert_int_eq(ret, 0);
23} 23}
24 24
25#ifdef HAVE_TIZEN_CONFIGURATION_MANAGER 25#ifdef HAVE_TIZEN_SENSOR
26static Ecordova_Device * 26static Ecordova_Device *
27_deviceorientation_new(void) 27_deviceorientation_new(void)
28{ 28{