sensord: remove sensor_common.h 34/123034/3
authorkibak.yoon <kibak.yoon@samsung.com>
Tue, 4 Apr 2017 08:06:05 +0000 (17:06 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Tue, 4 Apr 2017 08:46:51 +0000 (17:46 +0900)
- sensor_common.h is not really meaningful.
- move definitions from sensor_common.h to sensor_types.h.

Change-Id: I458bd6f9400ccef31063c524e9a74555f234f84d
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
include/sensor_common.h [deleted file]
include/sensor_internal.h
include/sensor_internal_deprecated.h
include/sensor_types.h
src/client-dummy/client_dummy.cpp
src/client-dummy/external_client_dummy.cpp
src/shared/command_common.h
src/shared/sensor_info.h
src/shared/sensor_log.cpp

diff --git a/include/sensor_common.h b/include/sensor_common.h
deleted file mode 100644 (file)
index d308549..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * sensord
- *
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#ifndef __SENSOR_COMMON_H__
-#define __SENSOR_COMMON_H__
-
-#include <stddef.h>
-#include <stdint.h>
-#include <sensor_hal_types.h>
-#include <sensor_types.h>
-
-#define OP_ERROR -1
-#define OP_SUCCESS 0
-
-#define CLIENT_ID_INVALID -1
-#define SENSOR_ID_INVALID -1
-
-#define SENSOR_TYPE_SHIFT 32
-#define SENSOR_EVENT_SHIFT 16
-#define SENSOR_INDEX_MASK 0xFFFFFFFF
-
-#define CONVERT_ID_TYPE(id) ((id) >> SENSOR_TYPE_SHIFT)
-#define CONVERT_TYPE_EVENT(type) ((type) << SENSOR_EVENT_SHIFT | 0x1)
-
-#ifndef NAME_MAX
-#define NAME_MAX 256
-#endif
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-/*
-typedef union {
-       struct {
-               sensor_type_t type;
-               int32_t id;
-       } __attribute__((packed));
-       int64_t id;
-} sensor_id_t;
-*/
-typedef int64_t sensor_id_t;
-
-typedef void *sensor_t;
-
-/*
- *     To prevent naming confliction as using same enums as sensor CAPI use
- */
-#ifndef __SENSOR_H__
-enum sensor_option_t {
-       SENSOR_OPTION_DEFAULT = 0,
-       SENSOR_OPTION_ON_IN_SCREEN_OFF = 1,
-       SENSOR_OPTION_ON_IN_POWERSAVE_MODE = 2,
-       SENSOR_OPTION_ALWAYS_ON = SENSOR_OPTION_ON_IN_SCREEN_OFF | SENSOR_OPTION_ON_IN_POWERSAVE_MODE,
-       SENSOR_OPTION_END
-};
-
-typedef enum sensor_option_t sensor_option_e;
-#endif
-
-enum sensord_attribute_e {
-       SENSORD_ATTRIBUTE_AXIS_ORIENTATION = 1,
-       SENSORD_ATTRIBUTE_PAUSE_POLICY,
-};
-
-enum sensord_axis_e {
-       SENSORD_AXIS_DEVICE_ORIENTED = 1,
-       SENSORD_AXIS_DISPLAY_ORIENTED,
-};
-
-enum sensord_pause_e {
-       SENSORD_PAUSE_NONE = 0,
-       SENSORD_PAUSE_ON_DISPLAY_OFF = 1,
-       SENSORD_PAUSE_ON_POWERSAVE_MODE = 2,
-       SENSORD_PAUSE_ALL = 3,
-       SENSORD_PAUSE_END,
-};
-
-enum poll_interval_t {
-       POLL_100HZ_MS   = 10,
-       POLL_50HZ_MS    = 20,
-       POLL_25HZ_MS    = 40,
-       POLL_20HZ_MS    = 50,
-       POLL_10HZ_MS    = 100,
-       POLL_5HZ_MS             = 200,
-       POLL_1HZ_MS             = 1000,
-       POLL_MAX_HZ_MS  = 255000,
-};
-
-enum sensor_interval_t {
-       SENSOR_INTERVAL_FASTEST = POLL_100HZ_MS,
-       SENSOR_INTERVAL_NORMAL = POLL_5HZ_MS,
-};
-
-typedef enum {
-       CONDITION_NO_OP,
-       CONDITION_EQUAL,
-       CONDITION_GREAT_THAN,
-       CONDITION_LESS_THAN,
-} condition_op_t;
-
-enum sensor_state_t {
-       SENSOR_STATE_UNKNOWN = -1,
-       SENSOR_STATE_STOPPED = 0,
-       SENSOR_STATE_STARTED = 1,
-       SENSOR_STATE_PAUSED = 2
-};
-
-typedef enum {
-       SENSOR_PRIVILEGE_PUBLIC,
-       SENSOR_PRIVILEGE_INTERNAL,
-} sensor_privilege_t;
-
-enum sensor_permission_t {
-       SENSOR_PERMISSION_NONE = 0,
-       SENSOR_PERMISSION_STANDARD = (1 << 0),
-       SENSOR_PERMISSION_BIO = (1 << 1)
-};
-
-enum client_type_t {
-       CLIENT_TYPE_SENSOR_CLIENT       = 1,
-       CLIENT_TYPE_EXTERNAL_SOURCE,
-};
-
-typedef struct sensor_event_t {
-       unsigned int event_type;
-       sensor_id_t sensor_id;
-       unsigned int data_length;
-       sensor_data_t *data;
-} sensor_event_t;
-
-#ifdef __cplusplus
-}
-#endif
-
-#ifdef __cplusplus
-#include <vector>
-
-typedef std::vector<unsigned int> event_type_vector;
-#endif /* __cplusplus */
-
-#endif /* __SENSOR_COMMON_H__ */
index b7e9469..506c869 100644 (file)
@@ -28,7 +28,6 @@
 #include <sys/types.h>
 
 /*header for common sensor type*/
-#include <sensor_common.h>
 #include <sensor_types.h>
 #include <sensor_deprecated.h>
 #include <sensor_internal_deprecated.h>
index 851ccbc..2288686 100644 (file)
 #endif
 
 #include <stdbool.h>
-
 #include <sys/types.h>
 
 /*header for common sensor type*/
-#include <sensor_common.h>
 #include <sensor_types.h>
 #include <sensor_deprecated.h>
 
@@ -39,7 +37,7 @@ extern "C"
 #endif
 
 typedef struct {
-       condition_op_t cond_op;
+       int cond_op; /* TODO: change it from int to condition_op_t */
        float cond_value1;
 } event_condition_t;
 
index 5b752af..c244943 100644 (file)
 #ifndef __SENSOR_TYPES_H__
 #define __SENSOR_TYPES_H__
 
+/* TODO: It is for compatibility with capi-system-sensor */
+#define __SENSOR_COMMON_H__
+
+#include <stddef.h>
+#include <stdint.h>
+#include <sensor_hal_types.h>
+
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
+#ifndef OP_SUCCESS
+#define OP_SUCCESS 0
+#endif
+#ifndef OP_ERROR
+#define OP_ERROR   -1
+#endif
+#ifndef OP_DEFAULT
+#define OP_DEFAULT 1
+#endif
+#ifndef OP_CONTINUE
+#define OP_CONTINUE 2
+#endif
+#ifndef NAME_MAX
+#define NAME_MAX 256
+#endif
+
+#define SENSOR_TYPE_SHIFT 32
+#define SENSOR_EVENT_SHIFT 16
+#define SENSOR_INDEX_MASK 0xFFFFFFFF
+
+#define CONVERT_ID_TYPE(id) ((id) >> SENSOR_TYPE_SHIFT)
+#define CONVERT_TYPE_EVENT(type) ((type) << SENSOR_EVENT_SHIFT | 0x1)
+
+#define MICROSECONDS(tv)        ((tv.tv_sec * 1000000ll) + tv.tv_usec)
+
+typedef int64_t sensor_id_t;
+typedef void *sensor_t;
+
 typedef enum sensor_type_t {
        UNKNOWN_SENSOR = -2,
        ALL_SENSOR = -1,
@@ -124,6 +159,77 @@ typedef enum sensor_type_t {
        CUSTOM_SENSOR = 0X9000,
 } sensor_type_t;
 
+
+typedef enum sensor_permission_t {
+       SENSOR_PERMISSION_NONE = 0,
+       SENSOR_PERMISSION_STANDARD = 1,
+       SENSOR_PERMISSION_HEALTH_INFO = 2,
+} sensor_permission_t;
+
+typedef enum sensor_privilege_t {
+       SENSOR_PRIVILEGE_PUBLIC = 1,
+} sensor_privilege_t;
+
+typedef struct sensor_event_t {
+       unsigned int event_type;
+       sensor_id_t sensor_id;
+       unsigned int data_length;
+       sensor_data_t *data;
+} sensor_event_t;
+
+/*
+ *     To prevent naming confliction as using same enums as sensor CAPI use
+ */
+#ifndef __SENSOR_H__
+enum sensor_option_t {
+       SENSOR_OPTION_DEFAULT = 0,
+       SENSOR_OPTION_ON_IN_SCREEN_OFF = 1,
+       SENSOR_OPTION_ON_IN_POWERSAVE_MODE = 2,
+       SENSOR_OPTION_ALWAYS_ON = SENSOR_OPTION_ON_IN_SCREEN_OFF | SENSOR_OPTION_ON_IN_POWERSAVE_MODE,
+       SENSOR_OPTION_END
+};
+
+typedef enum sensor_option_t sensor_option_e;
+#endif
+
+enum sensord_attribute_e {
+       SENSORD_ATTRIBUTE_AXIS_ORIENTATION = 1,
+       SENSORD_ATTRIBUTE_PAUSE_POLICY,
+       SENSORD_ATTRIBUTE_INTERVAL = 0x10,
+       SENSORD_ATTRIBUTE_MAX_BATCH_LATENCY,
+       SENSORD_ATTRIBUTE_PASSIVE_MODE,
+       SENSORD_ATTRIBUTE_FLUSH,
+};
+
+enum sensord_axis_e {
+       SENSORD_AXIS_DEVICE_ORIENTED = 1,
+       SENSORD_AXIS_DISPLAY_ORIENTED,
+};
+
+enum sensord_pause_e {
+       SENSORD_PAUSE_NONE = 0,
+       SENSORD_PAUSE_ON_DISPLAY_OFF = 1,
+       SENSORD_PAUSE_ON_POWERSAVE_MODE = 2,
+       SENSORD_PAUSE_ALL = 3,
+       SENSORD_PAUSE_END,
+};
+
+enum poll_interval_t {
+       POLL_100HZ_MS   = 10,
+       POLL_50HZ_MS    = 20,
+       POLL_25HZ_MS    = 40,
+       POLL_20HZ_MS    = 50,
+       POLL_10HZ_MS    = 100,
+       POLL_5HZ_MS             = 200,
+       POLL_1HZ_MS             = 1000,
+       POLL_MAX_HZ_MS  = 255000,
+};
+
+enum sensor_interval_t {
+       SENSOR_INTERVAL_FASTEST = POLL_100HZ_MS,
+       SENSOR_INTERVAL_NORMAL = POLL_5HZ_MS,
+};
+
 enum proxi_change_state {
        PROXIMITY_STATE_NEAR = 0,
        PROXIMITY_STATE_FAR = 1,
index 574079a..0baf94e 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #include <errno.h>
-#include <sensor_common.h>
+#include <sensor_types.h>
 
 #include <sensor_internal.h>
 #include <sensor_internal_deprecated.h>
index 8eb9221..5648bad 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #include <errno.h>
-#include <sensor_common.h>
+#include <sensor_types.h>
 
 #include <sensor_internal.h>
 #include <sensor_internal_deprecated.h>
index 679bf08..ccbba3c 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef _COMMAND_COMMON_H_
 #define _COMMAND_COMMON_H_
 
-#include <sensor_common.h>
+#include <sensor_types.h>
 #include <string>
 #include <vector>
 
index e2e9e57..8a50d64 100644 (file)
@@ -21,7 +21,6 @@
 #define _SENSOR_INFO_H_
 
 #include <stdint.h>
-#include <sensor_common.h>
 #include <sensor_types.h>
 #include <string>
 #include <vector>
index 0026801..f657883 100644 (file)
@@ -26,7 +26,6 @@
 #include <sensor_log.h>
 #include <dlog.h>
 #include <stddef.h>
-#include <sensor_common.h>
 #include <sensor_types.h>
 
 #define PATH_MAX 256