Instead of the four packages, sensord, libsensord, libsensord-devel, and sensor-hal-devel,
the following packages are produced:
- sensord : dummy internal API library, which completely disable all sensor listener features
- sensord-genuine : working internal API library and the sensor service daemon
- sensord-devel : internal API headers and the pc file
- sensor-hal-devel : API headers for Sensor HAL
Change-Id: Ie3529d6e5eba0554fd86b4d7f95ea9726db00aa4
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
PROJECT(sensord-main CXX)
INCLUDE(GNUInstallDirs)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
+
# Common Options
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -O2 -omit-frame-pointer -std=gnu++0x")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -ffunction-sections")
#add_definitions(-Wall -g -D_DEBUG)
# Sub-directory
+ADD_SUBDIRECTORY(src/shared)
ADD_SUBDIRECTORY(src/server)
ADD_SUBDIRECTORY(src/client)
-ADD_SUBDIRECTORY(src/shared)
-ADD_SUBDIRECTORY(src/hal)
+ADD_SUBDIRECTORY(src/client-dummy)
ADD_SUBDIRECTORY(src/sensorctl)
+
+INSTALL(
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor
+ FILES_MATCHING PATTERN "*.h"
+)
--- /dev/null
+/*
+ * sensord
+ *
+ * Copyright (c) 2016 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 _ENUM_FACTORY_H_
+#define _ENUM_FACTORY_H_
+
+#define ENUM_SENSOR(name) name,
+#define ENUM_SENSOR_VALUE(name, assign) name = (assign),
+
+#define ENUM_CASE(name) case (name): return #name;
+#define ENUM_CASE_VALUE(name, assign) ENUM_CASE(name)
+
+#define DECLARE_SENSOR_ENUM(ENUM_TYPE, ENUM_DEF) \
+ typedef enum ENUM_TYPE { \
+ ENUM_DEF(ENUM_SENSOR, ENUM_SENSOR_VALUE) \
+ } ENUM_TYPE;
+
+#define DECLARE_SENSOR_ENUM_UTIL_NS(ENUM_TYPE) \
+ namespace util_##ENUM_TYPE { \
+ const char *get_string(ENUM_TYPE type); \
+ };
+
+#define DECLARE_SENSOR_ENUM_UTIL(ENUM_TYPE, ENUM_DEF) \
+ const char *util_##ENUM_TYPE::get_string(ENUM_TYPE type) { \
+ switch (type) { \
+ ENUM_DEF(ENUM_CASE, ENUM_CASE_VALUE) \
+ } \
+ return "UNKNOWN"; \
+ }
+
+#endif /* _ENUM_FACTORY_H_ */
--- /dev/null
+/*
+ * 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__ */
--- /dev/null
+/*
+ * sensord
+ *
+ * Copyright (c) 2016 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_DEPRECATED_H__
+#define __SENSOR_DEPRECATED_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+// Sensor Event Types
+enum event_types_t {
+ ACCELEROMETER_RAW_DATA_EVENT = (ACCELEROMETER_SENSOR << 16) | 0x0001,
+ ACCELEROMETER_UNPROCESSED_DATA_EVENT = (ACCELEROMETER_SENSOR << 16) | 0x0002,
+
+ GYROSCOPE_RAW_DATA_EVENT = (GYROSCOPE_SENSOR << 16) | 0x0001,
+ GYROSCOPE_UNPROCESSED_DATA_EVENT = (GYROSCOPE_SENSOR << 16) | 0x0002,
+
+ GEOMAGNETIC_RAW_DATA_EVENT = (GEOMAGNETIC_SENSOR << 16) | 0x0001,
+ GEOMAGNETIC_UNPROCESSED_DATA_EVENT = (GEOMAGNETIC_SENSOR << 16) | 0x0002,
+
+ PROXIMITY_CHANGE_STATE_EVENT = (PROXIMITY_SENSOR << 16) | 0x0001,
+ PROXIMITY_STATE_EVENT = (PROXIMITY_SENSOR << 16) | 0x0002,
+ PROXIMITY_DISTANCE_DATA_EVENT = (PROXIMITY_SENSOR << 16) | 0x0003,
+
+ PRESSURE_RAW_DATA_EVENT = (PRESSURE_SENSOR << 16) | 0x0001,
+
+ TEMPERATURE_RAW_DATA_EVENT = (TEMPERATURE_SENSOR << 16) | 0x0001,
+
+ LIGHT_LUX_DATA_EVENT = (LIGHT_SENSOR << 16) | 0x0001,
+ LIGHT_LEVEL_DATA_EVENT = (LIGHT_SENSOR << 16) | 0x0002,
+ LIGHT_CHANGE_LEVEL_EVENT = (LIGHT_SENSOR << 16) | 0x0003,
+
+ ROTATION_VECTOR_RAW_DATA_EVENT = (ROTATION_VECTOR_SENSOR << 16) | 0x0001,
+
+ FACE_DOWN_RAW_DATA_EVENT = (GESTURE_FACE_DOWN_SENSOR << 16) | 0x0001,
+
+ RV_RAW_RAW_DATA_EVENT = (RV_RAW_SENSOR << 16) | 0x0001,
+
+ ULTRAVIOLET_RAW_DATA_EVENT = (ULTRAVIOLET_SENSOR << 16) | 0x0001,
+
+ AUTO_ROTATION_CHANGE_STATE_EVENT = (AUTO_ROTATION_SENSOR << 16) | 0x0001,
+
+ BIO_LED_RED_RAW_DATA_EVENT = (BIO_LED_RED_SENSOR << 16) | 0x0001,
+
+ GAMING_RV_RAW_DATA_EVENT = (GYROSCOPE_RV_SENSOR << 16) | 0x0001,
+
+ GEOMAGNETIC_RV_RAW_DATA_EVENT = (GEOMAGNETIC_RV_SENSOR << 16) | 0x0001,
+
+ GRAVITY_RAW_DATA_EVENT = (GRAVITY_SENSOR << 16) | 0x0001,
+
+ LINEAR_ACCEL_RAW_DATA_EVENT = (LINEAR_ACCEL_SENSOR << 16) | 0x0001,
+
+ MOTION_ENGINE_EVENT_SNAP = (MOTION_SENSOR << 16) | 0x0001,
+ MOTION_ENGINE_EVENT_SHAKE = (MOTION_SENSOR << 16) | 0x0002,
+ MOTION_ENGINE_EVENT_DOUBLETAP = (MOTION_SENSOR << 16) | 0x0004,
+ MOTION_ENGINE_EVENT_PANNING = (MOTION_SENSOR << 16) | 0x0008,
+ MOTION_ENGINE_EVENT_TOP_TO_BOTTOM = (MOTION_SENSOR << 16) | 0x0010,
+ MOTION_ENGINE_EVENT_DIRECT_CALL = (MOTION_SENSOR << 16) | 0x0020,
+ MOTION_ENGINE_EVENT_TILT_TO_UNLOCK = (MOTION_SENSOR << 16) | 0x0040,
+ MOTION_ENGINE_EVENT_LOCK_EXECUTE_CAMERA = (MOTION_SENSOR << 16) | 0x0080,
+ MOTION_ENGINE_EVENT_SMART_ALERT = (MOTION_SENSOR << 16) | 0x0100,
+ MOTION_ENGINE_EVENT_TILT = (MOTION_SENSOR << 16) | 0x0200,
+ MOTION_ENGINE_EVENT_PANNING_BROWSE = (MOTION_SENSOR << 16) | 0x0400,
+ MOTION_ENGINE_EVENT_NO_MOVE = (MOTION_SENSOR << 16) | 0x0800,
+ MOTION_ENGINE_EVENT_SHAKE_ALWAYS_ON = (MOTION_SENSOR << 16) | 0x1000,
+ MOTION_ENGINE_EVENT_SMART_RELAY = (MOTION_SENSOR << 16) | 0x2000,
+
+ ORIENTATION_RAW_DATA_EVENT = (ORIENTATION_SENSOR << 16) | 0x0001,
+
+ TILT_RAW_DATA_EVENT = (TILT_SENSOR << 16) | 0x0001,
+
+ GYROSCOPE_UNCAL_RAW_DATA_EVENT = (GYROSCOPE_UNCAL_SENSOR << 16) | 0x0001,
+
+ FUSION_EVENT = (FUSION_SENSOR << 16) | 0x0001,
+ FUSION_GYROSCOPE_UNCAL_EVENT = (FUSION_SENSOR << 16) | 0x0002,
+ FUSION_CALIBRATION_NEEDED_EVENT = (FUSION_SENSOR << 16) | 0x0003,
+ FUSION_ORIENTATION_ENABLED = (FUSION_SENSOR << 16) | 0x0004,
+ FUSION_ROTATION_VECTOR_ENABLED = (FUSION_SENSOR << 16) | 0x0005,
+ FUSION_GAMING_ROTATION_VECTOR_ENABLED = (FUSION_SENSOR << 16) | 0x0006,
+ FUSION_GEOMAGNETIC_ROTATION_VECTOR_ENABLED = (FUSION_SENSOR << 16) | 0x0007,
+ FUSION_TILT_ENABLED = (FUSION_SENSOR << 16) | 0x0008,
+ FUSION_GYROSCOPE_UNCAL_ENABLED = (FUSION_SENSOR << 16) | 0x0009,
+};
+
+#define CALIBRATION_EVENT(sensor_type) (((sensor_type) << 16) | 0x2)
+
+#define ACCELEROMETER_EVENT_ROTATION_CHECK ((ACCELEROMETER_SENSOR << 16) | 0x0100)
+
+#define ACCELEROMETER_ORIENTATION_DATA_SET (ACCELEROMETER_SENSOR << 16) | 0x0002
+#define ACCELEROMETER_LINEAR_ACCELERATION_DATA_SET (ACCELEROMETER_SENSOR << 16) | 0x0004
+#define ACCELEROMETER_GRAVITY_DATA_SET (ACCELEROMETER_SENSOR << 16) | 0x0008
+
+#define ACCELEROMETER_EVENT_GRAVITY_DATA_REPORT_ON_TIME (ACCELEROMETER_SENSOR << 16) | 0x0080
+#define ACCELEROMETER_EVENT_LINEAR_ACCELERATION_DATA_REPORT_ON_TIME (ACCELEROMETER_SENSOR << 16) | 0x0040
+#define ACCELEROMETER_EVENT_ORIENTATION_DATA_REPORT_ON_TIME (ACCELEROMETER_SENSOR << 16) | 0x0020
+#define GEOMAGNETIC_EVENT_ATTITUDE_DATA_REPORT_ON_TIME (GEOMAGNETIC_SENSOR << 16) | 0x0004
+#define ACCELEROMETER_EVENT_CALIBRATION_NEEDED 0x01
+#define ACCELEROMETER_EVENT_SET_WAKEUP 0x02
+
+#define TEMPERATURE_BASE_DATA_SET TEMPERATURE_RAW_DATA_EVENT
+#define TEMPERATURE_EVENT_RAW_DATA_REPORT_ON_TIME TEMPERATURE_RAW_DATA_EVENT
+
+#define ACCELEROMETER_BASE_DATA_SET ACCELEROMETER_RAW_DATA_EVENT
+#define ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME ACCELEROMETER_RAW_DATA_EVENT
+#define ACCELEROMETER_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME ACCELEROMETER_UNPROCESSED_DATA_EVENT
+
+#define GYRO_BASE_DATA_SET GYROSCOPE_RAW_DATA_EVENT
+#define GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME GYROSCOPE_RAW_DATA_EVENT
+#define GYROSCOPE_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME GYROSCOPE_UNPROCESSED_DATA_EVENT
+
+#define PROXIMITY_BASE_DATA_SET PROXIMITY_CHANGE_STATE_EVENT
+#define PROXIMITY_DISTANCE_BASE_DATA_SET PROXIMITY_STATE_EVENT
+#define PROXIMITY_EVENT_CHANGE_STATE PROXIMITY_CHANGE_STATE_EVENT
+#define PROXIMITY_EVENT_STATE_REPORT_ON_TIME PROXIMITY_STATE_EVENT
+#define PROXIMITY_EVENT_DISTANCE_DATA_REPORT_ON_TIME PROXIMITY_DISTANCE_DATA_EVENT
+
+#define PRESSURE_BASE_DATA_SET PRESSURE_RAW_DATA_EVENT
+#define PRESSURE_EVENT_RAW_DATA_REPORT_ON_TIME PRESSURE_RAW_DATA_EVENT
+
+#define GEOMAGNETIC_BASE_DATA_SET GEOMAGNETIC_RAW_DATA_EVENT
+#define GEOMAGNETIC_RAW_DATA_SET GEOMAGNETIC_RAW_DATA_EVENT
+#define GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME GEOMAGNETIC_RAW_DATA_EVENT
+#define GEOMAGNETIC_EVENT_CALIBRATION_NEEDED GEOMAGNETIC_CALIBRATION_NEEDED_EVENT
+#define GEOMAGNETIC_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME GEOMAGNETIC_UNPROCESSED_DATA_EVENT
+
+#define AUTO_ROTATION_BASE_DATA_SET AUTO_ROTATION_CHANGE_STATE_EVENT
+#define AUTO_ROTATION_EVENT_CHANGE_STATE AUTO_ROTATION_CHANGE_STATE_EVENT
+
+#define LIGHT_LUX_DATA_SET LIGHT_LUX_DATA_EVENT
+#define LIGHT_BASE_DATA_SET LIGHT_LEVEL_DATA_EVENT
+#define LIGHT_EVENT_LUX_DATA_REPORT_ON_TIME LIGHT_LUX_DATA_EVENT
+#define LIGHT_EVENT_LEVEL_DATA_REPORT_ON_TIME LIGHT_LEVEL_DATA_EVENT
+#define LIGHT_EVENT_CHANGE_LEVEL LIGHT_CHANGE_LEVEL_EVENT
+
+#define GRAVITY_BASE_DATA_SET GRAVITY_RAW_DATA_EVENT
+#define GRAVITY_EVENT_RAW_DATA_REPORT_ON_TIME GRAVITY_RAW_DATA_EVENT
+
+#define ORIENTATION_BASE_DATA_SET ORIENTATION_RAW_DATA_EVENT
+#define ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME ORIENTATION_RAW_DATA_EVENT
+#define ORIENTATION_EVENT_CALIBRATION_NEEDED ORIENTATION_CALIBRATION_NEEDED_EVENT
+
+#define LINEAR_ACCEL_BASE_DATA_SET LINEAR_ACCEL_RAW_DATA_EVENT
+#define LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME LINEAR_ACCEL_RAW_DATA_EVENT
+
+#define CONTEXT_BASE_DATA_SET CONTEXT_REPORT_EVENT
+#define CONTEXT_EVENT_REPORT CONTEXT_REPORT_EVENT
+
+#define FACE_DOWN_BASE_DATA_SET FACE_DOWN_RAW_DATA_EVENT
+#define FACE_DOWN_EVENT_RAW_DATA_REPORT_ON_TIME FACE_DOWN_RAW_DATA_EVENT
+
+enum accelerometer_rotate_state {
+ ROTATION_UNKNOWN = 0,
+ ROTATION_LANDSCAPE_LEFT = 1,
+ ROTATION_PORTRAIT_TOP = 2,
+ ROTATION_PORTRAIT_BTM = 3,
+ ROTATION_LANDSCAPE_RIGHT = 4,
+ ROTATION_EVENT_0 = 2,
+ ROTATION_EVENT_90 = 1,
+ ROTATION_EVENT_180 = 3,
+ ROTATION_EVENT_270 = 4,
+};
+
+enum motion_snap_event {
+ MOTION_ENGIEN_SNAP_NONE = 0,
+ MOTION_ENGIEN_NEGATIVE_SNAP_X = 1,
+ MOTION_ENGIEN_POSITIVE_SNAP_X = 2,
+ MOTION_ENGIEN_NEGATIVE_SNAP_Y = 3,
+ MOTION_ENGIEN_POSITIVE_SNAP_Y = 4,
+ MOTION_ENGIEN_NEGATIVE_SNAP_Z = 5,
+ MOTION_ENGIEN_POSITIVE_SNAP_Z = 6,
+ MOTION_ENGIEN_SNAP_LEFT = MOTION_ENGIEN_NEGATIVE_SNAP_X,
+ MOTION_ENGIEN_SNAP_RIGHT = MOTION_ENGIEN_POSITIVE_SNAP_X,
+ MOTION_ENGINE_SNAP_NONE = 0,
+ MOTION_ENGINE_NEGATIVE_SNAP_X = 1,
+ MOTION_ENGINE_POSITIVE_SNAP_X = 2,
+ MOTION_ENGINE_NEGATIVE_SNAP_Y = 3,
+ MOTION_ENGINE_POSITIVE_SNAP_Y = 4,
+ MOTION_ENGINE_NEGATIVE_SNAP_Z = 5,
+ MOTION_ENGINE_POSITIVE_SNAP_Z = 6,
+ MOTION_ENGINE_SNAP_LEFT = MOTION_ENGINE_NEGATIVE_SNAP_X,
+ MOTION_ENGINE_SNAP_RIGHT = MOTION_ENGINE_POSITIVE_SNAP_X,
+};
+
+enum motion_shake_event {
+ MOTION_ENGIEN_SHAKE_NONE = 0,
+ MOTION_ENGIEN_SHAKE_DETECTION = 1,
+ MOTION_ENGIEN_SHAKE_CONTINUING = 2,
+ MOTION_ENGIEN_SHAKE_FINISH = 3,
+ MOTION_ENGINE_SHAKE_BREAK = 4,
+ MOTION_ENGINE_SHAKE_NONE = 0,
+ MOTION_ENGINE_SHAKE_DETECTION = 1,
+ MOTION_ENGINE_SHAKE_CONTINUING = 2,
+ MOTION_ENGINE_SHAKE_FINISH = 3,
+};
+
+enum motion_doubletap_event {
+ MOTION_ENGIEN_DOUBLTAP_NONE = 0,
+ MOTION_ENGIEN_DOUBLTAP_DETECTION = 1,
+ MOTION_ENGINE_DOUBLTAP_NONE = 0,
+ MOTION_ENGINE_DOUBLTAP_DETECTION = 1,
+};
+
+enum motion_top_to_bottom_event {
+ MOTION_ENGIEN_TOP_TO_BOTTOM_NONE = 0,
+ MOTION_ENGIEN_TOP_TO_BOTTOM_WAIT = 1,
+ MOTION_ENGIEN_TOP_TO_BOTTOM_DETECTION = 2,
+ MOTION_ENGINE_TOP_TO_BOTTOM_NONE = 0,
+ MOTION_ENGINE_TOP_TO_BOTTOM_WAIT = 1,
+ MOTION_ENGINE_TOP_TO_BOTTOM_DETECTION = 2,
+};
+
+enum motion_direct_call_event_t {
+ MOTION_ENGINE_DIRECT_CALL_NONE,
+ MOTION_ENGINE_DIRECT_CALL_DETECTION,
+};
+
+enum motion_smart_relay_event_t {
+ MOTION_ENGINE_SMART_RELAY_NONE,
+ MOTION_ENGINE_SMART_RELAY_DETECTION,
+};
+
+enum motion_tilt_to_unlock_event_t {
+ MOTION_ENGINE_TILT_TO_UNLOCK_NONE,
+ MOTION_ENGINE_TILT_TO_UNLOCK_DETECTION,
+};
+
+enum motion_lock_execute_camera_event_t {
+ MOTION_ENGINE_LOCK_EXECUTE_CAMERA_NONE,
+ MOTION_ENGINE_LOCK_EXECUTE_CAMERA_L_DETECTION,
+ MOTION_ENGINE_LOCK_EXECUTE_CAMERA_R_DETECTION,
+};
+
+enum motion_smart_alert_t {
+ MOTION_ENGINE_SMART_ALERT_NONE,
+ MOTION_ENGINE_SMART_ALERT_DETECTION,
+};
+
+enum motion_no_move_t {
+ MOTION_ENGINE_NO_MOVE_NONE,
+ MOTION_ENGINE_NO_MOVE_DETECTION,
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__SENSOR_DEPRECATED_H__
--- /dev/null
+/*
+ * Copyright (c) 2016 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_HAL_H_
+#define _SENSOR_HAL_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "sensor_hal_types.h"
+
+/*
+ * Create devices
+ */
+typedef void *sensor_device_t;
+typedef int (*create_t)(sensor_device_t **devices);
+
+/*
+ * Sensor device interface
+ * 1 device must be abstracted from 1 device event node
+ */
+class sensor_device {
+public:
+ virtual ~sensor_device() {}
+
+ uint32_t get_hal_version(void)
+ {
+ return SENSOR_HAL_VERSION(1, 0);
+ }
+
+ virtual int get_poll_fd(void) = 0;
+ virtual int get_sensors(const sensor_info_t **sensors) = 0;
+
+ virtual bool enable(uint32_t id) = 0;
+ virtual bool disable(uint32_t id) = 0;
+
+ virtual int read_fd(uint32_t **ids) = 0;
+ virtual int get_data(uint32_t id, sensor_data_t **data, int *length) = 0;
+
+ virtual bool set_interval(uint32_t id, unsigned long val)
+ {
+ return true;
+ }
+ virtual bool set_batch_latency(uint32_t id, unsigned long val)
+ {
+ return true;
+ }
+ virtual bool set_attribute_int(uint32_t id, int32_t attribute, int32_t value)
+ {
+ return true;
+ }
+ virtual bool set_attribute_str(uint32_t id, int32_t attribute, char *value, int len)
+ {
+ return true;
+ }
+ virtual bool flush(uint32_t id)
+ {
+ return true;
+ }
+};
+
+#endif /* _SENSOR_HAL_H_ */
--- /dev/null
+/*
+ * Copyright (c) 2016 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_HAL_TYPES_H_
+#define _SENSOR_HAL_TYPES_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#define SENSOR_HAL_VERSION(maj, min) \
+ ((((maj) & 0xFFFF) << 24) | ((min) & 0xFFFF))
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */
+
+/*
+ * Sensor Types
+ * These types are used to controll the sensors
+ *
+ * - base unit
+ * acceleration values : meter per second^2 (m/s^2)
+ * magnetic values : micro-Tesla (uT)
+ * orientation values : degrees
+ * gyroscope values : degree/s
+ * temperature values : degrees centigrade
+ * proximity valeus : distance
+ * light values : lux
+ * pressure values : hectopascal (hPa)
+ * humidity : relative humidity (%)
+ */
+typedef enum {
+ SENSOR_DEVICE_UNKNOWN = -2,
+ SENSOR_DEVICE_ALL = -1,
+ SENSOR_DEVICE_ACCELEROMETER,
+ SENSOR_DEVICE_GRAVITY,
+ SENSOR_DEVICE_LINEAR_ACCELERATION,
+ SENSOR_DEVICE_GEOMAGNETIC,
+ SENSOR_DEVICE_ROTATION_VECTOR,
+ SENSOR_DEVICE_ORIENTATION,
+ SENSOR_DEVICE_GYROSCOPE,
+ SENSOR_DEVICE_LIGHT,
+ SENSOR_DEVICE_PROXIMITY,
+ SENSOR_DEVICE_PRESSURE,
+ SENSOR_DEVICE_ULTRAVIOLET,
+ SENSOR_DEVICE_TEMPERATURE,
+ SENSOR_DEVICE_HUMIDITY,
+ SENSOR_DEVICE_HRM,
+ SENSOR_DEVICE_HRM_LED_GREEN,
+ SENSOR_DEVICE_HRM_LED_IR,
+ SENSOR_DEVICE_HRM_LED_RED,
+ SENSOR_DEVICE_GYROSCOPE_UNCAL,
+ SENSOR_DEVICE_GEOMAGNETIC_UNCAL,
+ SENSOR_DEVICE_GYROSCOPE_RV,
+ SENSOR_DEVICE_GEOMAGNETIC_RV,
+
+ SENSOR_DEVICE_HUMAN_PEDOMETER = 0x300,
+ SENSOR_DEVICE_HUMAN_SLEEP_MONITOR,
+ SENSOR_DEVICE_HUMAN_SLEEP_DETECTOR,
+ SENSOR_DEVICE_HUMAN_STRESS_MONITOR,
+
+ SENSOR_DEVICE_EXERCISE_WALKING = 0x400,
+ SENSOR_DEVICE_EXERCISE_RUNNING,
+ SENSOR_DEVICE_EXERCISE_HIKING,
+ SENSOR_DEVICE_EXERCISE_CYCLING,
+ SENSOR_DEVICE_EXERCISE_ELLIPTICAL,
+ SENSOR_DEVICE_EXERCISE_INDOOR_CYCLING,
+ SENSOR_DEVICE_EXERCISE_ROWING,
+ SENSOR_DEVICE_EXERCISE_STEPPER,
+
+ SENSOR_DEVICE_FUSION = 0x900,
+ SENSOR_DEVICE_AUTO_ROTATION,
+ SENSOR_DEVICE_AUTO_BRIGHTNESS,
+
+ SENSOR_DEVICE_GESTURE_MOVEMENT = 0x1200,
+ SENSOR_DEVICE_GESTURE_WRIST_UP,
+ SENSOR_DEVICE_GESTURE_WRIST_DOWN,
+ SENSOR_DEVICE_GESTURE_MOVEMENT_STATE,
+
+ SENSOR_DEVICE_ACTIVITY_TRACKER = 0x1A00,
+ SENSOR_DEVICE_ACTIVITY_LEVEL_MONITOR,
+ SENSOR_DEVICE_GPS_BATCH,
+
+ SENSOR_DEVICE_HRM_CTRL = 0x1A80,
+
+ SENSOR_DEVICE_WEAR_STATUS = 0x2000,
+ SENSOR_DEVICE_WEAR_ON_MONITOR,
+ SENSOR_DEVICE_NO_MOVE_DETECTOR,
+ SENSOR_DEVICE_RESTING_HR,
+ SENSOR_DEVICE_STEP_LEVEL_MONITOR,
+ SENSOR_DEVICE_EXERCISE_STANDALONE,
+ SENSOR_DEVICE_EXERCISE_HR,
+ SENSOR_DEVICE_WORKOUT,
+ SENSOR_DEVICE_CYCLE_MONITOR,
+ SENSOR_DEVICE_STAIR_TRACKER,
+ SENSOR_DEVICE_PRESSURE_INDICATOR,
+ SENSOR_DEVICE_PRESSURE_ALERT,
+ SENSOR_DEVICE_HR_CALORIE,
+
+ SENSOR_DEVICE_CONTEXT = 0x7000,
+ SENSOR_DEVICE_MOTION,
+ SENSOR_DEVICE_PIR,
+ SENSOR_DEVICE_PIR_LONG,
+ SENSOR_DEVICE_DUST,
+ SENSOR_DEVICE_THERMOMETER,
+ SENSOR_DEVICE_PEDOMETER,
+ SENSOR_DEVICE_FLAT,
+ SENSOR_DEVICE_HRM_RAW,
+ SENSOR_DEVICE_TILT,
+ SENSOR_DEVICE_ROTATION_VECTOR_RAW,
+ SENSOR_DEVICE_GSR,
+ SENSOR_DEVICE_SIMSENSE,
+ SENSOR_DEVICE_PPG,
+
+} sensor_device_type;
+
+/*
+ * A platform sensor handler is generated based on this handle
+ * This id can be assigned from HAL developer. so it has to be unique in 1 sensor_device.
+ */
+typedef struct sensor_info_t {
+ uint32_t id;
+ const char *name;
+ sensor_device_type type;
+ unsigned int event_type; // for Internal API
+ const char *model_name;
+ const char *vendor;
+ float min_range;
+ float max_range;
+ float resolution;
+ int min_interval;
+ int max_batch_count;
+ bool wakeup_supported;
+} sensor_info_t;
+
+enum sensor_accuracy_t {
+ SENSOR_ACCURACY_UNDEFINED = -1,
+ SENSOR_ACCURACY_BAD = 0,
+ SENSOR_ACCURACY_NORMAL = 1,
+ SENSOR_ACCURACY_GOOD = 2,
+ SENSOR_ACCURACY_VERYGOOD = 3
+};
+
+#define SENSOR_DATA_VALUE_SIZE 16
+
+/* sensor_data_t */
+typedef struct sensor_data_t {
+ int accuracy;
+ unsigned long long timestamp;
+ int value_count;
+ float values[SENSOR_DATA_VALUE_SIZE];
+} sensor_data_t;
+
+#define SENSORHUB_DATA_VALUE_SIZE 4096
+
+/* sensorhub_data_t */
+typedef struct sensorhub_data_t {
+ int accuracy;
+ unsigned long long timestamp;
+
+ /*
+ * Use "value_count" instead of "hub_data_size"
+ * which is going to be removed soon
+ */
+ union {
+ int value_count;
+ int hub_data_size; /* deprecated */
+ };
+
+ /*
+ * Use "values" instead of "hub_data"
+ * which is going to be removed soon
+ */
+ union {
+ char values[SENSORHUB_DATA_VALUE_SIZE];
+ char hub_data[SENSORHUB_DATA_VALUE_SIZE]; /* deprecated */
+ };
+} sensorhub_data_t;
+
+#define SENSOR_PEDOMETER_DATA_DIFFS_SIZE 20
+
+typedef struct {
+ int accuracy;
+ unsigned long long timestamp;
+ int value_count; /* value_count == 8 */
+ float values[SENSOR_DATA_VALUE_SIZE];
+ /* values = {step count, walk step count, run step count,
+ moving distance, calorie burned, last speed,
+ last stepping frequency (steps per sec),
+ last step status (walking, running, ...)} */
+ /* Additional data attributes (not in sensor_data_t)*/
+ int diffs_count;
+ struct differences {
+ int timestamp;
+ int steps;
+ int walk_steps;
+ int run_steps;
+ int walk_up_steps;
+ int walk_down_steps;
+ int run_up_steps;
+ int run_down_steps;
+ float distance;
+ float calories;
+ float speed;
+ } diffs[SENSOR_PEDOMETER_DATA_DIFFS_SIZE];
+} sensor_pedometer_data_t;
+
+#define CONVERT_TYPE_ATTR(type, index) ((type) << 8 | 0x80 | (index))
+
+enum sensor_attribute {
+ SENSOR_ATTR_ACTIVITY = CONVERT_TYPE_ATTR(SENSOR_DEVICE_ACTIVITY_TRACKER, 0x1),
+
+ SENSOR_ATTR_PEDOMETER_HEIGHT = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HUMAN_PEDOMETER, 0x1),
+ SENSOR_ATTR_PEDOMETER_WEIGHT = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HUMAN_PEDOMETER, 0x2),
+ SENSOR_ATTR_PEDOMETER_GENDER = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HUMAN_PEDOMETER, 0x3),
+
+ SENSOR_ATTR_STRESS_MONITOR_AGE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HUMAN_STRESS_MONITOR, 0x1),
+
+ SENSOR_ATTR_EXERCISE_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_STANDALONE, 0x1),
+ SENSOR_ATTR_EXERCISE_GPS = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_STANDALONE, 0x2),
+ SENSOR_ATTR_EXERCISE_BATCH_INTERVAL = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_STANDALONE, 0x3),
+ SENSOR_ATTR_EXERCISE_PSERVICE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_STANDALONE, 0x4),
+
+ SENSOR_ATTR_CYCLE_DURATION = CONVERT_TYPE_ATTR(SENSOR_DEVICE_CYCLE_MONITOR, 0x1),
+ SENSOR_ATTR_CYCLE_HOLDING_POSITION = CONVERT_TYPE_ATTR(SENSOR_DEVICE_CYCLE_MONITOR, 0x2),
+ SENSOR_ATTR_CYCLE_VELOCITY = CONVERT_TYPE_ATTR(SENSOR_DEVICE_CYCLE_MONITOR, 0x3),
+
+ SENSOR_ATTR_WORKOUT_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_WORKOUT, 0x1),
+ SENSOR_ATTR_WORKOUT_DURATION = CONVERT_TYPE_ATTR(SENSOR_DEVICE_WORKOUT, 0x2),
+
+ SENSOR_ATTR_RESTING_HR_OPR_MODE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x1),
+ SENSOR_ATTR_RESTING_HR_MAX_RHR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x2),
+ SENSOR_ATTR_RESTING_HR_MIN_RHR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x3),
+ SENSOR_ATTR_RESTING_HR_AVG_RHR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x4),
+ SENSOR_ATTR_RESTING_HR_HOUR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x5),
+ SENSOR_ATTR_RESTING_HR_MIN = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x6),
+ SENSOR_ATTR_RESTING_HR_SEC = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x7),
+ SENSOR_ATTR_RESTING_HR_PROPERTY_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x10),
+ SENSOR_ATTR_RESTING_HR_PROPERTY_HR_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x11),
+ SENSOR_ATTR_RESTING_HR_PROPERTY_HR_VALUE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x12),
+ SENSOR_ATTR_RESTING_HR_PROPERTY_DURATION = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x13),
+ SENSOR_ATTR_RESTING_HR_PROPERTY_ACT_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x14),
+ SENSOR_ATTR_RESTING_HR_PROPERTY_ACT_DUR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x15),
+ SENSOR_ATTR_RESTING_HR_PROPERTY_CONT_DUR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x16),
+ SENSOR_ATTR_RESTING_HR_DATA_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x20),
+ SENSOR_ATTR_RESTING_HR_DATA_FLUSH = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x21),
+
+ SENSOR_ATTR_EXERCISE_HR_OPR_MODE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_HR, 0x1),
+ SENSOR_ATTR_EXERCISE_HR_ACTIVITY_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_HR, 0x2),
+ SENSOR_ATTR_EXERCISE_HR_BATCH_DUR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_HR, 0x3),
+ SENSOR_ATTR_EXERCISE_HR_FLUSH = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_HR, 0x4),
+
+ SENSOR_ATTR_PRESSURE_INDICATOR_START = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_INDICATOR, 0x1),
+ SENSOR_ATTR_PRESSURE_INDICATOR_STOP = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_INDICATOR, 0x2),
+ SENSOR_ATTR_PRESSURE_INDICATOR_FLUSH = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_INDICATOR, 0x3),
+ SENSOR_ATTR_PRESSURE_INDICATOR_RESTORE_TIME = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_INDICATOR, 0x4),
+ SENSOR_ATTR_PRESSURE_INDICATOR_RESTORE_VALUE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_INDICATOR, 0x5),
+ SENSOR_ATTR_PRESSURE_INDICATOR_CURRENT_TIME = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_INDICATOR, 0x6),
+
+ SENSOR_ATTR_PRESSURE_ALERT_START = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_ALERT, 0x1),
+ SENSOR_ATTR_PRESSURE_ALERT_STOP = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_ALERT, 0x2),
+
+ SENSOR_ATTR_HR_CALORIE_AGE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x1),
+ SENSOR_ATTR_HR_CALORIE_HEIGHT = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x2),
+ SENSOR_ATTR_HR_CALORIE_WEIGHT = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x3),
+ SENSOR_ATTR_HR_CALORIE_GENDER = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x4),
+ SENSOR_ATTR_HR_CALORIE_INST = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x10),
+ SENSOR_ATTR_HR_CALORIE_EXERCISE_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x11),
+ SENSOR_ATTR_HR_CALORIE_TARGET_CAL = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x12),
+ SENSOR_ATTR_HR_CALORIE_MAX_HEARTRATE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x13),
+ SENSOR_ATTR_HR_CALORIE_FLUSH = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x20),
+};
+
+enum sensor_activity {
+ SENSOR_ACTIVITY_UNKNOWN = 1,
+ SENSOR_ACTIVITY_STILL = 2,
+ SENSOR_ACTIVITY_WALKING = 4,
+ SENSOR_ACTIVITY_RUNNING = 8,
+ SENSOR_ACTIVITY_IN_VEHICLE = 16,
+ SENSOR_ACTIVITY_ON_BICYCLE = 32,
+};
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _SENSOR_HAL_TYPES_H_ */
--- /dev/null
+/*
+ * 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_INTERNAL_H__
+#define __SENSOR_INTERNAL_H__
+
+#ifndef API
+#define API __attribute__((visibility("default")))
+#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>
+#include <sensor_internal_deprecated.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef void (*sensor_cb_t)(sensor_t sensor, unsigned int event_type, sensor_data_t *data, void *user_data);
+typedef void (*sensorhub_cb_t)(sensor_t sensor, unsigned int event_type, sensorhub_data_t *data, void *user_data);
+typedef void (*sensor_accuracy_changed_cb_t) (sensor_t sensor, unsigned long long timestamp, int accuracy, void *user_data);
+
+/**
+ * @brief Get the list of available sensors of a certain type, use ALL_SENSOR to get all the sensors.
+ *
+ * @param[in] type the type of sensors requested.
+ * @param[out] list the list of sensors matching the asked type, the caller should explicitly free this list.
+ * @param[out] sensor count the count of sensors contained in the list.
+ * @return true on success, otherwise false.
+ */
+bool sensord_get_sensor_list(sensor_type_t type, sensor_t **list, int *sensor_count);
+
+/**
+ * @brief Get the default sensor for a given type.
+ *
+ * @param[in] type the type of a sensor requested.
+ * @return the default sensor matching the asked type on success, otherwise NULL.
+ */
+sensor_t sensord_get_sensor(sensor_type_t type);
+
+/**
+ * @brief Get the list of available sensors of a certain type, use ALL_SENSOR to get all the sensors.
+ *
+ * @param[in] type the type of sensors requested.
+ * @param[out] list the list of sensors matching the asked type, the caller should explicitly free this list.
+ * @param[out] sensor count the count of sensors contained in the list.
+ * @return 0 on success, otherwise a negative error value
+ * @retval 0 Successful
+ * @retval -EPERM Operation not permitted
+ * @retval -EACCES Permission denied
+ * @retval -ENODATA NO sensor available
+ */
+int sensord_get_sensors(sensor_type_t type, sensor_t **list, int *sensor_count);
+
+/**
+ * @brief Get the default sensor for a given type.
+ *
+ * @param[in] type the type of a sensor requested.
+ * @param[out] a sensor matching the asked type.
+ * @return 0 on success, otherwise a negative error value
+ * @retval 0 Successful
+ * @retval -EPERM Operation not permitted
+ * @retval -EACCES Permission denied
+ */
+int sensord_get_default_sensor(sensor_type_t type, sensor_t *sensor);
+
+/**
+ * @brief Get the type of this sensor.
+ *
+ * @param[in] sensor a sensor to get type.
+ * @param[out] type the type of this sensor.
+ * @return return true on success, otherwise false.
+ */
+bool sensord_get_type(sensor_t sensor, sensor_type_t *type);
+
+/**
+ * @brief Get the name string of this sensor.
+ *
+ * @param[in] sensor a sensor to get name.
+ * @return the name string of this sensor on success, otherwise NULL.
+ */
+const char* sensord_get_name(sensor_t sensor);
+
+/**
+ * @brief Get the vendor string of this sensor.
+ *
+ * @param[in] sensor a sensor to get vendor.
+ * @return the vendor string of this sensor on success, otherwise NULL.
+ */
+const char* sensord_get_vendor(sensor_t sensor);
+
+/**
+ * @brief Get the privilege of this sensor.
+ *
+ * @param[in] sensor a sensor to get privilege.
+ * @param[out] privilege the privilege of this sensor.
+ * @return true on success, otherwise false.
+ */
+bool sensord_get_privilege(sensor_t sensor, sensor_privilege_t *privilege);
+
+/**
+ * @brief Get the minimum range of this sensor in the sensor's unit.
+ *
+ * @param[in] sensor a sensor to get minimum range.
+ * @param[out] min_range the minimum range of this sensor in the sensor's unit.
+ * @return true on success, otherwise false.
+ */
+bool sensord_get_min_range(sensor_t sensor, float *min_range);
+
+/**
+ * @brief Get the maximum range of this sensor in the sensor's unit.
+ *
+ * @param[in] sensor a sensor to get maximum range.
+ * @param[out] max_range the maximum range of this sensor in the sensor's unit.
+ * @return true on success, otherwise false.
+ */
+bool sensord_get_max_range(sensor_t sensor, float *max_range);
+
+/**
+ * @brief Get the resolution of this sensor in the sensor's unit.
+ *
+ * @param[in] sensor a sensor to get resolution.
+ * @param[out] resolution the resolution of this sensor in the sensor's unit.
+ * @return true on success, otherwise false.
+ */
+bool sensord_get_resolution(sensor_t sensor, float *resolution);
+
+/**
+ * @brief Get the minimum interval allowed between two events in microsecond or zero if this sensor only returns a value when the data it's measuring changes.
+ *
+ * @param[in] sensor a sensor to get minimum interval.
+ * @param[out] min_interval the minimum interval of this sensor.
+ * @return true on success, otherwise false.
+ */
+bool sensord_get_min_interval(sensor_t sensor, int *min_interval);
+
+/**
+ * @brief Get the number of events reserved for this sensor in the batch mode FIFO.
+ *
+ * @param[in] sensor a sensor to get the number of fifo count
+ * @param[out] fifo_count the number of events reserved for this sensor in the batch mode FIFO
+ * @return true on success, otherwise false
+ */
+bool sensord_get_fifo_count(sensor_t sensor, int *fifo_count);
+
+/**
+ * @brief Get the maximum number of events of this sensor that could be batched. If this value is zero it indicates that batch mode is not supported for this sensor.
+ *
+ * @param[in] sensor a sensor to the maximum number of events that could be batched.
+ * @param[out] max_batch_count the maximum number of events of this sensor that could be batched.
+ * @return true on success, otherwise false.
+ */
+bool sensord_get_max_batch_count(sensor_t sensor, int *max_batch_count);
+
+/**
+ * @brief Get the supported event types of this sensor.
+ *
+ * @param[in] sensor a sensor to get the supported event types.
+ * @param[out] event_types the array containing supported event types of this sensor, the caller should explicitly free this array.
+ * @param[out] count the count of the supported event types of this sensor.
+ * @return true on success, otherwise false.
+ */
+bool sensord_get_supported_event_types(sensor_t sensor, unsigned int **event_types, int *count);
+
+/**
+ * @brief Check a given event type is supporeted by this sensor.
+ *
+ * @param[in] sensor a sensor to check a given event type is supporeted.
+ * @param[out] event_type an event type to be checked whether supported or not.
+ * @param[out] supported whether a given event is supported or not in this sensor.
+ * @return true on success, otherwise false.
+ */
+bool sensord_is_supported_event_type(sensor_t sensor, unsigned int event_type, bool *supported);
+
+/**
+ * @brief Check a wakeup supported or not by this sensor.
+ *
+ * @param[in] sensor a sensor to check a given event type is supporeted.
+ * @return true on success, otherwise false.
+ */
+bool sensord_is_wakeup_supported(sensor_t sensor);
+
+/**
+ * @brief Connect a given sensor and get a handle of a given sensor.
+ *
+ * @param[in] sensor a sensor to connect
+ * @return a handle of a given sensor on success, otherwise negative value
+ */
+int sensord_connect(sensor_t sensor);
+
+/**
+ * @brief Disconnect a given sensor.
+ *
+ * @param[in] handle a handle to disconnect.
+ * @return true on success, otherwise false.
+ */
+bool sensord_disconnect(int handle);
+
+/**
+ * @brief Register a callback with a connected sensor for a given event_type. This callback will be called when a given event occurs in a connected sensor.
+ *
+ * @param[in] handle a handle represensting a connected sensor.
+ * @param[in] event_type an event type to register
+ * @param[in] interval The desired interval between two consecutive events in microseconds. This is only a hint to the system so events may be received faster or slower than the specified interval.
+ * It can be one of SENSOR_INTERVAL_NORMAL, SENSOR_INTERVAL_FASTEST or the interval in microseconds.
+ * @param[in] max_batch_latency An event in the batch can be delayed by at most max_batch_latency microseconds. If this is set to zero, batch mode is disabled.
+ * @param[in] cb a callback which is called when a given event occurs
+ * @param[in] user_data the callback is called with user_data
+ * @return true on success, otherwise false.
+ */
+bool sensord_register_event(int handle, unsigned int event_type, unsigned int interval, unsigned int max_batch_latency, sensor_cb_t cb, void *user_data);
+
+/**
+ * @brief Register a callback with a connected context sensor for a given event_type. This callback will be called when a given event occurs in a connected context sensor.
+ *
+ * @param[in] handle a handle represensting a connected context sensor.
+ * @param[in] event_type an event type to register
+ * @param[in] interval The desired interval between two consecutive events in microseconds. This is only a hint to the system so events may be received faster or slower than the specified interval.
+ * It can be one of SENSOR_INTERVAL_NORMAL, SENSOR_INTERVAL_FASTEST or the interval in microseconds.
+ * @param[in] max_batch_latency An event in the batch can be delayed by at most max_batch_latency microseconds. If this is set to zero, batch mode is disabled.
+ * @param[in] cb a callback which is called when a given event occurs
+ * @param[in] user_data the callback is called with user_data
+ * @return true on success, otherwise false.
+ */
+bool sensord_register_hub_event(int handle, unsigned int event_type, unsigned int interval, unsigned int max_batch_latency, sensorhub_cb_t cb, void *user_data);
+
+/**
+ * @brief Unregister a event with a connected sensor. After unregistering, that event will not be sent.
+ *
+ * @param[in] handle a handle represensting a connected sensor.
+ * @param[in] event_type an event type to unregister.
+ * @return true on success, otherwise false.
+ */
+bool sensord_unregister_event(int handle, unsigned int event_type);
+
+/**
+ * @brief Register a callback with a connected sensor. This callback will be called when the accuracy of a sensor has changed.
+ *
+ * @param[in] handle a handle represensting a connected sensor.
+ * @param[in] cb a callback which is called when he accuracy of a sensor has changed.
+ * @param[in] user_data the callback is called with user_data
+ * @return true on success, otherwise false.
+ */
+bool sensord_register_accuracy_cb(int handle, sensor_accuracy_changed_cb_t cb, void *user_data);
+
+/**
+ * @brief Unregister a callback with a connected sensor. After unregistering, sensor_accuray_change_cb will not be called.
+ *
+ * @param[in] handle a handle represensting a connected sensor.
+ * @return true on success, otherwise false.
+ */
+bool sensord_unregister_accuracy_cb(int handle);
+
+/**
+ * @brief Start listening events with a connected sensor.
+ *
+ * @param[in] handle a handle represensting a connected sensor.
+ * @param[in] option either one of SENSOR_OPTION_DEFAULT and SENSOR_OPTION_ALWAYS_ON.
+ * with SENSOR_OPTION_DEFAULT, it stops to listening events when LCD is off or in power save mode.
+ * with SENSOR_OPTION_ALWAYS_ON, it continues to listening events even when LCD is off or in power save mode.
+ * @return true on success, otherwise false.
+ */
+bool sensord_start(int handle, int option);
+
+/**
+ * @brief Stop listening events with a connected sensor.
+ *
+ * @param[in] handle a handle represensting a connected sensor.
+ * @return true on success, otherwise false.
+ */
+bool sensord_stop(int handle);
+
+/**
+ * @brief Change the interval of a specifed event type in a connected sensor.
+ *
+ * @param[in] handle a handle represensting a connected sensor.
+ * @param[in] event_type an event type to change interval.
+ * @param[in] interval The desired interval between two consecutive events in microseconds. This is only a hint to the system so events may be received faster or slower than the specified interval.
+ * It can be one of SENSOR_INTERVAL_NORMAL, SENSOR_INTERVAL_FASTEST or the interval in microseconds.
+ * @return true on success, otherwise false.
+ */
+bool sensord_change_event_interval(int handle, unsigned int event_type, unsigned int interval);
+
+/**
+ * @brief Change the max batch latency of a specifed event type in a connected sensor.
+ *
+ * @param[in] handle a handle represensting a connected sensor.
+ * @param[in] event_type an event type to change max batch latency
+ * @param[in] max_batch_latency an event in the batch can be delayed by at most max_batch_latency microseconds. If this is set to zero, batch mode is disabled.
+ * @return true on success, otherwise false.
+ */
+bool sensord_change_event_max_batch_latency(int handle, unsigned int event_type, unsigned int max_batch_latency);
+
+/**
+ * @brief Change the option of a connected sensor.
+ *
+ * @param[in] handle a handle represensting a connected sensor.
+ * @param[in] option either one of SENSOR_OPTION_DEFAULT and SENSOR_OPTION_ALWAYS_ON.
+ * with SENSOR_OPTION_DEFAULT, it stops to listening events when LCD is off or in power save mode.
+ * with SENSOR_OPTION_ALWAYS_ON, it continues to listening events even when LCD is off or in power save mode.
+ * @return true on success, otherwise false.
+ */
+bool sensord_set_option(int handle, int option);
+
+/*
+ * @brief Set the attribute to a connected sensor
+ *
+ * @param[in] handle a handle represensting a connected sensor.
+ * @param[in] attribute an attribute to change
+ * @param[in] value an attribute value
+ * @return 0 on success, otherwise a negative error value
+ * @retval 0 Successful
+ * @retval -EINVAL Invalid parameter
+ * @retval -EPERM Operation not permitted
+ */
+int sensord_set_attribute_int(int handle, int attribute, int value);
+
+/**
+ * @brief Set the attribute to a connected sensor
+ *
+ * @param[in] handle a handle represensting a connected sensor.
+ * @param[in] attribute an attribute to change
+ * @param[in] value an attribute value
+ * @param[in] value_len the length of value
+ * @return 0 on success, otherwise a negative error value
+ * @retval 0 Successful
+ * @retval -EINVAL Invalid parameter
+ * @retval -EPERM Operation not permitted
+ */
+int sensord_set_attribute_str(int handle, int attribute, const char *value, int len);
+
+/**
+ * @brief Send data to sensorhub
+ *
+ * @param[in] handle a handle represensting a connected context sensor.
+ * @param[in] data it holds data to send to sensorhub
+ * @param[in] data_len the length of data
+ * @return true on success, otherwise false.
+ */
+bool sensord_send_sensorhub_data(int handle, const char *data, int data_len);
+bool sensord_send_command(int handle, const char *command, int command_len);
+
+/**
+ * @brief get sensor data from a connected sensor
+ *
+ * @param[in] handle a handle represensting a connected context sensor.
+ * @param[in] data_id it specifies data to get
+ * @param[out] sensor_data data from connected sensor
+ * @return true on success, otherwise false.
+ */
+bool sensord_get_data(int handle, unsigned int data_id, sensor_data_t* sensor_data);
+
+/**
+ * @brief flush sensor data from a connected sensor
+ *
+ * @param[in] handle a handle represensting a connected context sensor.
+ * @return true on success, otherwise false.
+ */
+bool sensord_flush(int handle);
+
+typedef void (*sensor_external_command_cb_t)(int handle, const char* data, int data_cnt, void *user_data);
+
+int sensord_external_connect(const char *key, sensor_external_command_cb_t cb, void *user_data);
+bool sensord_external_disconnect(int handle);
+bool sensord_external_post(int handle, unsigned long long timestamp, const float* data, int data_cnt);
+
+bool sensord_set_passive_mode(int handle, bool passive);
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/*
+ * 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_INTERNAL_DEPRECATED__
+#define __SENSOR_INTERNAL_DEPRECATED__
+
+#ifndef DEPRECATED
+#define DEPRECATED __attribute__((deprecated))
+#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>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct {
+ condition_op_t cond_op;
+ float cond_value1;
+} event_condition_t;
+
+typedef struct {
+ size_t event_data_size;
+ void *event_data;
+} sensor_event_data_t;
+
+typedef void (*sensor_callback_func_t)(unsigned int, sensor_event_data_t *, void *);
+typedef sensor_callback_func_t sensor_legacy_cb_t;
+
+typedef struct {
+ int x;
+ int y;
+ int z;
+} sensor_panning_data_t;
+
+/**
+ * @fn int sf_connect(sensor_type_t sensor)
+ * @brief This API connects a sensor type to respective sensor. The application calls with the type of the sensor (ex. ACCELEROMETER_SENSOR) and on basis of that server takes decision of which plug-in to be connected. Once sensor connected application can proceed for data processing. This API returns a positive handle which should be used by application to communicate on sensor type.
+ * @param[in] sensor_type your desired sensor type
+ * @return if it succeed, it return handle value( >=0 ), otherwise negative value return
+ */
+DEPRECATED int sf_connect(sensor_type_t sensor_type);
+
+/**
+ * @fn int sf_disconnect(int handle)
+ * @brief This API disconnects an attached sensor from an application. Application must use the handle retuned after attaching the sensor. After detaching, the corresponding handle will be released.
+ * @param[in] handle received handle value by sf_connect()
+ * @return if it succeed, it return zero value, otherwise negative value return
+ */
+DEPRECATED int sf_disconnect(int handle);
+
+/**
+ * @fn int sf_start(int handle, int option)
+ * @brief This API sends a start command to sensor server. This intimates server that the client side is ready to handle data and start processing. The parameter option should be '0' for current usages.
+ * @param[in] handle received handle value by sf_connect()
+ * @param[in] option With SENSOR_OPTION_DEFAULT, it stops to sense when LCD is off, and with SENSOR_OPTION_ALWAYS_ON, it continues to sense even when LCD is off
+ * @return if it succeed, it return zero value, otherwise negative value return
+ */
+DEPRECATED int sf_start(int handle, int option);
+
+/**
+ * @fn int sf_stop(int handle)
+ * @brief This API sends a stop command to the Sensor server indicating that the data processing is stopped from application side for this time.
+ * @param[in] handle received handle value by sf_connect()
+ * @return if it succeed, it return zero value, otherwise negative value return
+ */
+DEPRECATED int sf_stop(int handle);
+
+/**
+ * @fn int sf_register_event(int handle, unsigned int event_type, event_conditon_t *event_condition, sensor_callback_func_t cb, void *user_data)
+ * @brief This API registers a user defined callback function with a connected sensor for a particular event. This callback function will be called when there is a change in the state of respective sensor. user_data will be the parameter used during the callback call. Callback interval can be adjusted using even_contion_t argument.
+ * @param[in] handle received handle value by sf_connect()
+ * @param[in] event_type your desired event_type to register it
+ * @param[in] event_condition input event_condition for special event. if you want to register without event_condition, just use a NULL value
+ * @param[in] cb your define callback function
+ * @param[in] user_data your option data that will be send when your define callback function called. if you don't have any option data, just use a NULL value
+ * @return if it succeed, it return zero value, otherwise negative value return
+ */
+DEPRECATED int sf_register_event(int handle, unsigned int event_type, event_condition_t *event_condition, sensor_callback_func_t cb, void *user_data);
+
+/**
+ * @fn int sf_unregister_event(int handle, unsigned int event_type)
+ * @brief This API de-registers a user defined callback function with a sensor registered with the specified handle. After unsubscribe, no event will be sent to the application.
+ * @param[in] handle received handle value by sf_connect()
+ * @param[in] event_type your desired event_type that you want to unregister event
+ * @return if it succeed, it return zero value, otherwise negative value return
+ */
+DEPRECATED int sf_unregister_event(int handle, unsigned int event_type);
+
+/**
+ * @fn int sf_get_data(int handle, unsigned int data_id, sensor_data_t* values)
+ * @brief This API gets raw data from a sensor with connecting the sensor-server. The type of sensor is supplied and return data is stored in the output parameter values [].
+ * @param[in] handle received handle value by sf_connect()
+ * @param[in] data_id predefined data_ID as every sensor in own header - sensor_xxx.h, enum xxx_data_id {}
+ * @param[out] values return values
+ * @return if it succeed, it return zero value, otherwise negative value return
+ */
+DEPRECATED int sf_get_data(int handle, unsigned int data_id, sensor_data_t* values);
+
+/**
+ * @fn int sf_change_event_condition(int handle, unsigned int event_type, event_condition_t *event_condition)
+ * @brief This API change a user defined callback function condition with a sensor registered with the specified handle.
+ * @param[in] handle received handle value by sf_connect()
+ * @param[in] event_type your desired event_type that you want to unregister event
+ * @param[in] event_condition your desired event condition that you want to change event
+ * @return if it succeed, it return zero value, otherwise negative value return
+ */
+DEPRECATED int sf_change_event_condition(int handle, unsigned int event_type, event_condition_t *event_condition);
+
+/**
+ * @fn int sf_change_sensor_option(int handle, int option)
+ * @brief This API change sensor option .
+ * @param[in] handle received handle value by sf_connect()
+ * @param[in] option your desired option that you want to turn on sensor during LCD OFF
+ * @return if it succeed, it return zero value, otherwise negative value return
+ */
+
+DEPRECATED int sf_change_sensor_option(int handle, int option);
+
+/**
+ * @fn int sf_send_sensorhub_data(int handle, const char* buffer, int data_len)
+ * @brief This API sends data to sensorhub.
+ * @param[in] handle received handle by sf_connect()
+ * @param[in] data it holds data to send to sensorhub
+ * @param[in] data_len the length of data
+ * @return if it succeed, it returns zero, otherwise negative value
+ */
+DEPRECATED int sf_send_sensorhub_data(int handle, const char* data, int data_len);
+
+DEPRECATED int sf_check_rotation(unsigned long *rotation);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+/*
+ * sensord
+ *
+ * Copyright (c) 2016 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_TYPES_H_
+#define _SENSOR_TYPES_H_
+
+#include <enum_factory.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define SENSOR_TYPE(DEF_SENSOR, DEF_SENSOR_VALUE) \
+ DEF_SENSOR_VALUE(UNKNOWN_SENSOR, -2) \
+ DEF_SENSOR_VALUE(ALL_SENSOR, -1) \
+ DEF_SENSOR_VALUE(ACCELEROMETER_SENSOR, 0) \
+ DEF_SENSOR(GRAVITY_SENSOR) \
+ DEF_SENSOR(LINEAR_ACCEL_SENSOR) \
+ DEF_SENSOR(GEOMAGNETIC_SENSOR) \
+ DEF_SENSOR(ROTATION_VECTOR_SENSOR) \
+ DEF_SENSOR(ORIENTATION_SENSOR) \
+ DEF_SENSOR(GYROSCOPE_SENSOR) \
+ DEF_SENSOR(LIGHT_SENSOR) \
+ DEF_SENSOR(PROXIMITY_SENSOR) \
+ DEF_SENSOR(PRESSURE_SENSOR) \
+ DEF_SENSOR(ULTRAVIOLET_SENSOR) \
+ DEF_SENSOR(TEMPERATURE_SENSOR) \
+ DEF_SENSOR(HUMIDITY_SENSOR) \
+ DEF_SENSOR(HRM_SENSOR) \
+ DEF_SENSOR(HRM_LED_GREEN_SENSOR) \
+ DEF_SENSOR(HRM_LED_IR_SENSOR) \
+ DEF_SENSOR(HRM_LED_RED_SENSOR) \
+ DEF_SENSOR(GYROSCOPE_UNCAL_SENSOR) \
+ DEF_SENSOR(GEOMAGNETIC_UNCAL_SENSOR) \
+ DEF_SENSOR(GYROSCOPE_RV_SENSOR) \
+ DEF_SENSOR(GEOMAGNETIC_RV_SENSOR) \
+ \
+ DEF_SENSOR_VALUE(HUMAN_PEDOMETER_SENSOR, 0x300) \
+ DEF_SENSOR(HUMAN_SLEEP_MONITOR_SENSOR) \
+ DEF_SENSOR(HUMAN_SLEEP_DETECTOR_SENSOR) \
+ DEF_SENSOR(HUMAN_STRESS_MONITOR_SENSOR) \
+ \
+ DEF_SENSOR_VALUE(EXERCISE_WALKING_SENSOR, 0x400) \
+ DEF_SENSOR(EXERCISE_RUNNING_SENSOR) \
+ DEF_SENSOR(EXERCISE_HIKING_SENSOR) \
+ DEF_SENSOR(EXERCISE_CYCLING_SENSOR) \
+ DEF_SENSOR(EXERCISE_ELLIPTICAL_SENSOR) \
+ DEF_SENSOR(EXERCISE_INDOOR_CYCLING_SENSOR) \
+ DEF_SENSOR(EXERCISE_ROWING_SENSOR) \
+ DEF_SENSOR(EXERCISE_STEPPER_SENSOR) \
+ \
+ DEF_SENSOR_VALUE(EXTERNAL_EXERCISE_SENSOR, 0x800) \
+ \
+ DEF_SENSOR_VALUE(FUSION_SENSOR, 0x900) \
+ DEF_SENSOR(AUTO_ROTATION_SENSOR) \
+ DEF_SENSOR(AUTO_BRIGHTNESS_SENSOR) \
+ \
+ DEF_SENSOR_VALUE(GESTURE_MOVEMENT_SENSOR, 0x1200) \
+ DEF_SENSOR(GESTURE_WRIST_UP_SENSOR) \
+ DEF_SENSOR(GESTURE_WRIST_DOWN_SENSOR) \
+ DEF_SENSOR(GESTURE_MOVEMENT_STATE_SENSOR) \
+ DEF_SENSOR(GESTURE_FACE_DOWN_SENSOR) \
+ \
+ DEF_SENSOR_VALUE(ACTIVITY_TRACKER_SENSOR, 0x1A00) \
+ DEF_SENSOR(ACTIVITY_LEVEL_MONITOR_SENSOR) \
+ DEF_SENSOR(GPS_BATCH_SENSOR) \
+ \
+ DEF_SENSOR_VALUE(HRM_CTRL_SENSOR, 0x1A80) \
+ \
+ DEF_SENSOR_VALUE(WEAR_STATUS_SENSOR, 0x2000) \
+ DEF_SENSOR(WEAR_ON_MONITOR_SENSOR) \
+ DEF_SENSOR(NO_MOVE_DETECTOR_SENSOR) \
+ DEF_SENSOR(RESTING_HR_SENSOR) \
+ DEF_SENSOR(STEP_LEVEL_MONITOR_SENSOR) \
+ DEF_SENSOR(EXERCISE_STANDALONE_SENSOR) \
+ DEF_SENSOR(EXERCISE_HR_SENSOR) \
+ DEF_SENSOR(WORKOUT_SENSOR) \
+ DEF_SENSOR(CYCLE_MONITOR_SENSOR) \
+ DEF_SENSOR(STAIR_TRACKER_SENSOR) \
+ DEF_SENSOR(PRESSURE_INDICATOR_SENSOR) \
+ DEF_SENSOR(PRESSURE_ALERT_SENSOR) \
+ DEF_SENSOR(HR_CALORIE_SENSOR) \
+ \
+ DEF_SENSOR_VALUE(CONTEXT_SENSOR, 0x7000) \
+ DEF_SENSOR(MOTION_SENSOR) \
+ DEF_SENSOR(PIR_SENSOR) \
+ DEF_SENSOR(PIR_LONG_SENSOR) \
+ DEF_SENSOR(DUST_SENSOR) \
+ DEF_SENSOR(THERMOMETER_SENSOR) \
+ DEF_SENSOR(PEDOMETER_SENSOR) \
+ DEF_SENSOR(FLAT_SENSOR) \
+ DEF_SENSOR(HRM_RAW_SENSOR) \
+ DEF_SENSOR(TILT_SENSOR) \
+ DEF_SENSOR(RV_RAW_SENSOR) \
+ DEF_SENSOR(GSR_SENSOR) \
+ DEF_SENSOR(SIMSENSE_SENSOR) \
+ DEF_SENSOR(PPG_SENSOR) \
+
+#define BIO_HRM_SENSOR HRM_SENSOR
+#define BIO_LED_GREEN_SENSOR HRM_LED_GREEN_SENSOR
+#define BIO_LED_IR_SENSOR HRM_LED_IR_SENSOR
+#define BIO_LED_RED_SENSOR HRM_LED_RED_SENSOR
+#define BIO_SENSOR HRM_RAW_SENSOR
+#define SLEEP_DETECTOR_SENSOR HUMAN_SLEEP_DETECTOR_SENSOR
+#define STRESS_MONITOR_SENSOR HUMAN_STRESS_MONITOR_SENSOR
+#define AUTOSESSION_EXERCISE_SENSOR WORKOUT_SENSOR
+#define EXERCISE_COACH_SENSOR EXERCISE_STANDALONE_SENSOR
+#define EXERCISE_SENSOR EXTERNAL_EXERCISE_SENSOR
+
+DECLARE_SENSOR_ENUM(sensor_type_t, SENSOR_TYPE)
+
+enum proxi_change_state {
+ PROXIMITY_STATE_NEAR = 0,
+ PROXIMITY_STATE_FAR = 1,
+};
+
+enum auto_rotation_state {
+ AUTO_ROTATION_DEGREE_UNKNOWN = 0,
+ AUTO_ROTATION_DEGREE_0,
+ AUTO_ROTATION_DEGREE_90,
+ AUTO_ROTATION_DEGREE_180,
+ AUTO_ROTATION_DEGREE_270,
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifdef __cplusplus
+DECLARE_SENSOR_ENUM_UTIL_NS(sensor_type_t)
+#endif
+
+#include <sensor_deprecated.h>
+
+#endif /* _SENSOR_TYPES_H_ */
Name: sensord
Summary: Sensor daemon
-Version: 2.0.9
-Release: 0
+Version: 2.0.10
+Release: 1
Group: System/Sensor Framework
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(cynara-creds-socket)
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(cynara-session)
-Requires: libsensord = %{version}-%{release}
-%define BUILD_PROFILE %{?profile}%{!?profile:%{?tizen_profile_name}}
+Provides: %{name}-profile_tv = %{version}-%{release}
+# For backward compatibility
+Provides: libsensord = %{version}-%{release}
%description
Sensor daemon
-%package -n libsensord
-Summary: Sensord library
-Group: System/Libraries
+%package genuine
+Summary: Genuine Sensor Framework service daemon and shared library
Requires: %{name} = %{version}-%{release}
-
-%description -n libsensord
-Sensord library
-
-%package -n libsensord-devel
-Summary: Sensord shared library
+Provides: %{name}-profile_mobile = %{version}-%{release}
+Provides: %{name}-profile_wearable = %{version}-%{release}
+Provides: %{name}-profile_ivi = %{version}-%{release}
+Provides: %{name}-profile_common = %{version}-%{release}
+
+%description genuine
+Binary replacement for sensord.
+This genuine sensord package contains actually working shared library
+of the sensor internal APIs and the sensor service daemon.
+If you want to keep using %{name} after uninstalling this, you need to reinstall %{name}.
+
+%package devel
+Summary: Internal Sensor API (Development)
Group: System/Development
-Requires: libsensord = %{version}-%{release}
+Requires: %{name} = %{version}-%{release}
-%description -n libsensord-devel
-Sensord shared library
+%description devel
+Internal Sensor API (Development)
%package -n sensor-hal-devel
Summary: Sensord HAL interface
%description -n sensor-test
Sensor functional testing
+# This dummy package will be removed later.
+%package -n libsensord-devel
+Summary: Dummy package for backward compatibility
+Requires: sensord-devel
+
+%description -n libsensord-devel
+Some packages require libsensord-devel directly, and it causes local gbs build failures
+with the old build snapshots. This is a temporal solution to handle such cases.
+
%prep
%setup -q
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIBDIR=%{_libdir} \
- -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DPROFILE=%{BUILD_PROFILE}
+ -DMAJORVER=${MAJORVER} -DFULLVER=%{version}
%build
make %{?jobs:-j%jobs}
mkdir -p %{buildroot}%{_unitdir}
-%if "%{?BUILD_PROFILE}" != "tv"
install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}
install -m 0644 %SOURCE2 %{buildroot}%{_unitdir}
install -m 0644 %SOURCE3 %{buildroot}%{_unitdir}
%install_service multi-user.target.wants sensord.service
%install_service sockets.target.wants sensord_event.socket
%install_service sockets.target.wants sensord_command.socket
-%endif
+
+ln -s libsensor.so.2 %{buildroot}%{_libdir}/libsensor.so.1
%post
-systemctl daemon-reload
+/sbin/ldconfig
-%postun
-systemctl daemon-reload
+%files
+%manifest packaging/sensord.manifest
+%{_libdir}/libsensor.so.*
+%license LICENSE.APLv2
-%post -n libsensord
-ln -sf %{_libdir}/libsensor.so.%{version} %{_libdir}/libsensor.so.1
+%post genuine
+pushd %{_libdir}
+ln -sf libsensor-genuine.so.%{version} libsensor.so.%{version}
+chsmack -a "_" libsensor.so.%{version}
+popd
/sbin/ldconfig
-%postun -n libsensord
-/sbin/ldconfig
+%preun genuine
+echo "You need to reinstall %{name}, if you need to keep using the APIs after uinstalling this."
-%files
+%files genuine
%manifest packaging/sensord.manifest
+%{_libdir}/libsensord-shared.so
+%{_libdir}/libsensor-genuine.so.*
%{_bindir}/sensord
-%license LICENSE.APLv2
-
-%if "%{?BUILD_PROFILE}" != "tv"
%{_unitdir}/sensord.service
%{_unitdir}/sensord_command.socket
%{_unitdir}/sensord_event.socket
%{_unitdir}/multi-user.target.wants/sensord.service
%{_unitdir}/sockets.target.wants/sensord_command.socket
%{_unitdir}/sockets.target.wants/sensord_event.socket
-%endif
-
-%files -n libsensord
-%defattr(-,root,root,-)
-%manifest packaging/libsensord.manifest
-%{_libdir}/libsensor.so.*
-%{_libdir}/libsensord-shared.so
-%license LICENSE.APLv2
-%files -n libsensord-devel
-%defattr(-,root,root,-)
+%files devel
+%manifest packaging/sensord.manifest
+%exclude %{_includedir}/sensor/sensor_hal.h
%{_includedir}/sensor/*.h
%{_libdir}/libsensor.so
%{_libdir}/pkgconfig/sensor.pc
-%license LICENSE.APLv2
%files -n sensor-hal-devel
-%defattr(-,root,root,-)
-%{_includedir}/sensor/sensor_hal.h
-%{_includedir}/sensor/sensor_hal_types.h
-%license LICENSE.APLv2
+%manifest packaging/sensord.manifest
+%{_includedir}/sensor/sensor_hal*.h
%files -n sensor-test
-%defattr(-,root,root,-)
%{_bindir}/sensorctl
+
+%files -n libsensord-devel
%license LICENSE.APLv2
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(sensor CXX)
+
+SET(DEPENDENTS "glib-2.0 dlog")
+SET(VERSION ${FULLVER})
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(PC_NAME ${PROJECT_NAME})
+SET(PC_DESCRIPTION "Sensor Client library")
+SET(PC_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/sensor")
+SET(PC_REQUIRES "${DEPENDENTS}")
+SET(PC_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
+SET(PC_LDFLAGS "-l${PROJECT_NAME}")
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(DUMMY_PKGS REQUIRED ${DEPENDENTS})
+
+FOREACH(flag ${DUMMY_PKGS_CFLAGS})
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -g -fPIC")
+
+INCLUDE_DIRECTORIES(
+ ${CMAKE_SOURCE_DIR}/src/shared
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+FILE(GLOB_RECURSE SRCS *.cpp)
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${DUMMY_PKGS_LDFLAGS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc @ONLY)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries)
+INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
--- /dev/null
+/*
+ * sensord
+ *
+ * Copyright (c) 2016 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.
+ *
+ */
+
+#include <sensor_internal_deprecated.h>
+
+#ifndef API
+#define API __attribute__((visibility("default")))
+#endif
+
+API int sf_connect(sensor_type_t sensor_type)
+{
+ return OP_ERROR;
+}
+
+API int sf_disconnect(int handle)
+{
+ return OP_ERROR;
+}
+
+API int sf_start(int handle, int option)
+{
+ return OP_ERROR;
+}
+
+API int sf_stop(int handle)
+{
+ return OP_ERROR;
+}
+
+API int sf_register_event(int handle, unsigned int event_type, event_condition_t *event_condition, sensor_callback_func_t cb, void *user_data)
+{
+ return OP_ERROR;
+}
+
+API int sf_unregister_event(int handle, unsigned int event_type)
+{
+ return OP_ERROR;
+}
+
+API int sf_change_event_condition(int handle, unsigned int event_type, event_condition_t *event_condition)
+{
+ return OP_ERROR;
+}
+
+API int sf_change_sensor_option(int handle, int option)
+{
+ return OP_ERROR;
+}
+
+API int sf_send_sensorhub_data(int handle, const char* data, int data_len)
+{
+ return OP_ERROR;
+}
+
+API int sf_get_data(int handle, unsigned int data_id, sensor_data_t* sensor_data)
+{
+ return OP_ERROR;
+}
+
+API int sf_check_rotation(unsigned long *rotation)
+{
+ return OP_ERROR;
+}
+
+API int sf_is_sensor_event_available(sensor_type_t sensor_type, unsigned int event_type)
+{
+ return OP_ERROR;
+}
--- /dev/null
+/*
+ * sensord
+ *
+ * Copyright (c) 2013 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.
+ *
+ */
+
+#include <errno.h>
+#include <sensor_common.h>
+
+#include <sensor_internal.h>
+#include <sensor_internal_deprecated.h>
+
+API int sensord_get_sensors(sensor_type_t type, sensor_t **list, int *sensor_count)
+{
+ return -ENODATA;
+}
+
+API int sensord_get_default_sensor(sensor_type_t type, sensor_t *sensor)
+{
+ return -ENODATA;
+}
+
+API bool sensord_get_sensor_list(sensor_type_t type, sensor_t **list, int *sensor_count)
+{
+ return false;
+}
+
+API sensor_t sensord_get_sensor(sensor_type_t type)
+{
+ return NULL;
+}
+
+API bool sensord_get_type(sensor_t sensor, sensor_type_t *type)
+{
+ return false;
+}
+
+API const char* sensord_get_name(sensor_t sensor)
+{
+ return NULL;
+}
+
+API const char* sensord_get_vendor(sensor_t sensor)
+{
+ return NULL;
+}
+
+API bool sensord_get_privilege(sensor_t sensor, sensor_privilege_t *privilege)
+{
+ return false;
+}
+
+API bool sensord_get_min_range(sensor_t sensor, float *min_range)
+{
+ return false;
+}
+
+API bool sensord_get_max_range(sensor_t sensor, float *max_range)
+{
+ return false;
+}
+
+API bool sensord_get_resolution(sensor_t sensor, float *resolution)
+{
+ return false;
+}
+
+API bool sensord_get_min_interval(sensor_t sensor, int *min_interval)
+{
+ return false;
+}
+
+API bool sensord_get_fifo_count(sensor_t sensor, int *fifo_count)
+{
+ return false;
+}
+
+API bool sensord_get_max_batch_count(sensor_t sensor, int *max_batch_count)
+{
+ return false;
+}
+
+API bool sensord_get_supported_event_types(sensor_t sensor, unsigned int **event_types, int *count)
+{
+ return false;
+}
+
+API bool sensord_is_supported_event_type(sensor_t sensor, unsigned int event_type, bool *supported)
+{
+ return false;
+}
+
+API bool sensord_is_wakeup_supported(sensor_t sensor)
+{
+ return false;
+}
+
+API int sensord_connect(sensor_t sensor)
+{
+ return OP_ERROR;
+}
+
+API bool sensord_disconnect(int handle)
+{
+ return false;
+}
+
+API bool sensord_register_event(int handle, unsigned int event_type, unsigned int interval, unsigned int max_batch_latency, sensor_cb_t cb, void *user_data)
+{
+ return false;
+}
+
+API bool sensord_unregister_event(int handle, unsigned int event_type)
+{
+ return false;
+}
+
+API bool sensord_register_accuracy_cb(int handle, sensor_accuracy_changed_cb_t cb, void *user_data)
+{
+ return false;
+}
+
+API bool sensord_unregister_accuracy_cb(int handle)
+{
+ return false;
+}
+
+API bool sensord_start(int handle, int option)
+{
+ return false;
+}
+
+API bool sensord_stop(int handle)
+{
+ return false;
+}
+
+API bool sensord_change_event_interval(int handle, unsigned int event_type, unsigned int interval)
+{
+ return false;
+}
+
+API bool sensord_change_event_max_batch_latency(int handle, unsigned int event_type, unsigned int max_batch_latency)
+{
+ return false;
+}
+
+API bool sensord_set_option(int handle, int option)
+{
+ return false;
+}
+
+API int sensord_set_attribute_int(int handle, int attribute, int value)
+{
+ return OP_ERROR;
+}
+
+API int sensord_set_attribute_str(int handle, int attribute, const char *value, int len)
+{
+ return OP_ERROR;
+}
+
+API bool sensord_send_sensorhub_data(int handle, const char *data, int data_len)
+{
+ return false;
+}
+
+API bool sensord_send_command(int handle, const char *command, int command_len)
+{
+ return false;
+}
+
+API bool sensord_get_data(int handle, unsigned int data_id, sensor_data_t* sensor_data)
+{
+ return false;
+}
+
+API bool sensord_flush(int handle)
+{
+ return false;
+}
+
+API bool sensord_register_hub_event(int handle, unsigned int event_type, unsigned int interval, unsigned int max_batch_latency, sensorhub_cb_t cb, void *user_data)
+{
+ return false;
+}
+
+API bool sensord_set_passive_mode(int handle, bool passive)
+{
+ return false;
+}
--- /dev/null
+/*
+ * sensord
+ *
+ * Copyright (c) 2013 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.
+ *
+ */
+
+#include <errno.h>
+#include <sensor_common.h>
+
+#include <sensor_internal.h>
+#include <sensor_internal_deprecated.h>
+
+API int sensord_external_connect(const char *key, sensor_external_command_cb_t cb, void *user_data)
+{
+ return OP_ERROR;
+}
+
+API bool sensord_external_disconnect(int handle)
+{
+ return false;
+}
+
+API bool sensord_external_post(int handle, unsigned long long timestamp, const float* data, int data_cnt)
+{
+ return false;
+}
--- /dev/null
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@PC_LIBDIR@
+includedir=@PC_INCLUDEDIR@
+
+Name: @PC_NAME@
+Description: @PC_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRES@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir} @PC_CFLAGS@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(sensor CXX)
+PROJECT(sensor-genuine CXX)
SET(DEPENDENTS "vconf glib-2.0 gio-2.0 dlog")
-SET(VERSION ${FULLVER})
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}/bin")
-
-SET(PC_NAME ${PROJECT_NAME})
-SET(PC_DESCRIPTION "Sensor Client library")
-SET(PC_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/sensor")
-SET(PC_REQUIRES "${DEPENDENTS}")
-SET(PC_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
-SET(PC_LDFLAGS "-l${PROJECT_NAME}")
INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(PKGS REQUIRED ${DEPENDENTS})
+PKG_CHECK_MODULES(CLIENT_PKGS REQUIRED ${DEPENDENTS})
-FOREACH(flag ${PKGS_CFLAGS})
+FOREACH(flag ${CLIENT_PKGS_CFLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
ENDFOREACH(flag)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden -g -fPIC")
-SET (INSTALL_HEADERS
- sensor_internal.h
- sensor_internal_deprecated.h
-)
-
INCLUDE_DIRECTORIES(
- ${CMAKE_SOURCE_DIR}/src/hal
${CMAKE_SOURCE_DIR}/src/shared
${CMAKE_CURRENT_SOURCE_DIR}
)
FILE(GLOB_RECURSE SRCS *.cpp)
-IF("${PROFILE}" STREQUAL "tv")
- LIST(REMOVE_ITEM SRCS
- "${CMAKE_CURRENT_SOURCE_DIR}/client.cpp"
- "${CMAKE_CURRENT_SOURCE_DIR}/external_client.cpp")
-ELSE()
- LIST(REMOVE_ITEM SRCS
- "${CMAKE_CURRENT_SOURCE_DIR}/client_dummy.cpp"
- "${CMAKE_CURRENT_SOURCE_DIR}/external_client_dummy.cpp")
-ENDIF()
-
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS} "sensord-shared")
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${CLIENT_PKGS_LDFLAGS} "sensord-shared")
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc @ONLY)
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT RuntimeLibraries)
-FOREACH(HEADER IN ITEMS ${INSTALL_HEADERS})
- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor)
-ENDFOREACH()
-INSTALL(FILES ${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-
+INSTALL(TARGETS ${PROJECT_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} NAMELINK_SKIP)
+++ /dev/null
-/*
- * sensord
- *
- * Copyright (c) 2013 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.
- *
- */
-
-#include <errno.h>
-#include <sensor_common.h>
-
-#include "sensor_internal.h"
-#include "sensor_internal_deprecated.h"
-
-API int sensord_get_sensors(sensor_type_t type, sensor_t **list, int *sensor_count)
-{
- return -ENODATA;
-}
-
-API int sensord_get_default_sensor(sensor_type_t type, sensor_t *sensor)
-{
- return -ENODATA;
-}
-
-API bool sensord_get_sensor_list(sensor_type_t type, sensor_t **list, int *sensor_count)
-{
- return false;
-}
-
-API sensor_t sensord_get_sensor(sensor_type_t type)
-{
- return NULL;
-}
-
-API bool sensord_get_type(sensor_t sensor, sensor_type_t *type)
-{
- return false;
-}
-
-API const char* sensord_get_name(sensor_t sensor)
-{
- return NULL;
-}
-
-API const char* sensord_get_vendor(sensor_t sensor)
-{
- return NULL;
-}
-
-API bool sensord_get_privilege(sensor_t sensor, sensor_privilege_t *privilege)
-{
- return false;
-}
-
-API bool sensord_get_min_range(sensor_t sensor, float *min_range)
-{
- return false;
-}
-
-API bool sensord_get_max_range(sensor_t sensor, float *max_range)
-{
- return false;
-}
-
-API bool sensord_get_resolution(sensor_t sensor, float *resolution)
-{
- return false;
-}
-
-API bool sensord_get_min_interval(sensor_t sensor, int *min_interval)
-{
- return false;
-}
-
-API bool sensord_get_fifo_count(sensor_t sensor, int *fifo_count)
-{
- return false;
-}
-
-API bool sensord_get_max_batch_count(sensor_t sensor, int *max_batch_count)
-{
- return false;
-}
-
-API bool sensord_get_supported_event_types(sensor_t sensor, unsigned int **event_types, int *count)
-{
- return false;
-}
-
-API bool sensord_is_supported_event_type(sensor_t sensor, unsigned int event_type, bool *supported)
-{
- return false;
-}
-
-API bool sensord_is_wakeup_supported(sensor_t sensor)
-{
- return false;
-}
-
-API int sensord_connect(sensor_t sensor)
-{
- return OP_ERROR;
-}
-
-API bool sensord_disconnect(int handle)
-{
- return false;
-}
-
-API bool sensord_register_event(int handle, unsigned int event_type, unsigned int interval, unsigned int max_batch_latency, sensor_cb_t cb, void *user_data)
-{
- return false;
-}
-
-API bool sensord_unregister_event(int handle, unsigned int event_type)
-{
- return false;
-}
-
-API bool sensord_register_accuracy_cb(int handle, sensor_accuracy_changed_cb_t cb, void *user_data)
-{
- return false;
-}
-
-API bool sensord_unregister_accuracy_cb(int handle)
-{
- return false;
-}
-
-API bool sensord_start(int handle, int option)
-{
- return false;
-}
-
-API bool sensord_stop(int handle)
-{
- return false;
-}
-
-API bool sensord_change_event_interval(int handle, unsigned int event_type, unsigned int interval)
-{
- return false;
-}
-
-API bool sensord_change_event_max_batch_latency(int handle, unsigned int event_type, unsigned int max_batch_latency)
-{
- return false;
-}
-
-API bool sensord_set_option(int handle, int option)
-{
- return false;
-}
-
-API int sensord_set_attribute_int(int handle, int attribute, int value)
-{
- return OP_ERROR;
-}
-
-API int sensord_set_attribute_str(int handle, int attribute, const char *value, int len)
-{
- return OP_ERROR;
-}
-
-API bool sensord_send_sensorhub_data(int handle, const char *data, int data_len)
-{
- return false;
-}
-
-API bool sensord_send_command(int handle, const char *command, int command_len)
-{
- return false;
-}
-
-API bool sensord_get_data(int handle, unsigned int data_id, sensor_data_t* sensor_data)
-{
- return false;
-}
-
-API bool sensord_flush(int handle)
-{
- return false;
-}
-
-API bool sensord_register_hub_event(int handle, unsigned int event_type, unsigned int interval, unsigned int max_batch_latency, sensorhub_cb_t cb, void *user_data)
-{
- return false;
-}
-
-API bool sensord_set_passive_mode(int handle, bool passive)
-{
- return false;
-}
+++ /dev/null
-/*
- * sensord
- *
- * Copyright (c) 2013 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.
- *
- */
-
-#include <errno.h>
-#include <sensor_common.h>
-
-#include "sensor_internal.h"
-#include "sensor_internal_deprecated.h"
-
-API int sensord_external_connect(const char *key, sensor_external_command_cb_t cb, void *user_data)
-{
- return OP_ERROR;
-}
-
-API bool sensord_external_disconnect(int handle)
-{
- return false;
-}
-
-API bool sensord_external_post(int handle, unsigned long long timestamp, const float* data, int data_cnt)
-{
- return false;
-}
+++ /dev/null
-# Package Information for pkg-config
-
-prefix=@PREFIX@
-exec_prefix=@EXEC_PREFIX@
-libdir=@PC_LIBDIR@
-includedir=@PC_INCLUDEDIR@
-
-Name: @PC_NAME@
-Description: @PC_DESCRIPTION@
-Version: @VERSION@
-Requires: @PC_REQUIRES@
-Libs: -L${libdir} @PC_LDFLAGS@
-Cflags: -I${includedir} @PC_CFLAGS@
+++ /dev/null
-/*
- * 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_INTERNAL_H__
-#define __SENSOR_INTERNAL_H__
-
-#ifndef API
-#define API __attribute__((visibility("default")))
-#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>
-#include <sensor_internal_deprecated.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-typedef void (*sensor_cb_t)(sensor_t sensor, unsigned int event_type, sensor_data_t *data, void *user_data);
-typedef void (*sensorhub_cb_t)(sensor_t sensor, unsigned int event_type, sensorhub_data_t *data, void *user_data);
-typedef void (*sensor_accuracy_changed_cb_t) (sensor_t sensor, unsigned long long timestamp, int accuracy, void *user_data);
-
-/**
- * @brief Get the list of available sensors of a certain type, use ALL_SENSOR to get all the sensors.
- *
- * @param[in] type the type of sensors requested.
- * @param[out] list the list of sensors matching the asked type, the caller should explicitly free this list.
- * @param[out] sensor count the count of sensors contained in the list.
- * @return true on success, otherwise false.
- */
-bool sensord_get_sensor_list(sensor_type_t type, sensor_t **list, int *sensor_count);
-
-/**
- * @brief Get the default sensor for a given type.
- *
- * @param[in] type the type of a sensor requested.
- * @return the default sensor matching the asked type on success, otherwise NULL.
- */
-sensor_t sensord_get_sensor(sensor_type_t type);
-
-/**
- * @brief Get the list of available sensors of a certain type, use ALL_SENSOR to get all the sensors.
- *
- * @param[in] type the type of sensors requested.
- * @param[out] list the list of sensors matching the asked type, the caller should explicitly free this list.
- * @param[out] sensor count the count of sensors contained in the list.
- * @return 0 on success, otherwise a negative error value
- * @retval 0 Successful
- * @retval -EPERM Operation not permitted
- * @retval -EACCES Permission denied
- * @retval -ENODATA NO sensor available
- */
-int sensord_get_sensors(sensor_type_t type, sensor_t **list, int *sensor_count);
-
-/**
- * @brief Get the default sensor for a given type.
- *
- * @param[in] type the type of a sensor requested.
- * @param[out] a sensor matching the asked type.
- * @return 0 on success, otherwise a negative error value
- * @retval 0 Successful
- * @retval -EPERM Operation not permitted
- * @retval -EACCES Permission denied
- */
-int sensord_get_default_sensor(sensor_type_t type, sensor_t *sensor);
-
-/**
- * @brief Get the type of this sensor.
- *
- * @param[in] sensor a sensor to get type.
- * @param[out] type the type of this sensor.
- * @return return true on success, otherwise false.
- */
-bool sensord_get_type(sensor_t sensor, sensor_type_t *type);
-
-/**
- * @brief Get the name string of this sensor.
- *
- * @param[in] sensor a sensor to get name.
- * @return the name string of this sensor on success, otherwise NULL.
- */
-const char* sensord_get_name(sensor_t sensor);
-
-/**
- * @brief Get the vendor string of this sensor.
- *
- * @param[in] sensor a sensor to get vendor.
- * @return the vendor string of this sensor on success, otherwise NULL.
- */
-const char* sensord_get_vendor(sensor_t sensor);
-
-/**
- * @brief Get the privilege of this sensor.
- *
- * @param[in] sensor a sensor to get privilege.
- * @param[out] privilege the privilege of this sensor.
- * @return true on success, otherwise false.
- */
-bool sensord_get_privilege(sensor_t sensor, sensor_privilege_t *privilege);
-
-/**
- * @brief Get the minimum range of this sensor in the sensor's unit.
- *
- * @param[in] sensor a sensor to get minimum range.
- * @param[out] min_range the minimum range of this sensor in the sensor's unit.
- * @return true on success, otherwise false.
- */
-bool sensord_get_min_range(sensor_t sensor, float *min_range);
-
-/**
- * @brief Get the maximum range of this sensor in the sensor's unit.
- *
- * @param[in] sensor a sensor to get maximum range.
- * @param[out] max_range the maximum range of this sensor in the sensor's unit.
- * @return true on success, otherwise false.
- */
-bool sensord_get_max_range(sensor_t sensor, float *max_range);
-
-/**
- * @brief Get the resolution of this sensor in the sensor's unit.
- *
- * @param[in] sensor a sensor to get resolution.
- * @param[out] resolution the resolution of this sensor in the sensor's unit.
- * @return true on success, otherwise false.
- */
-bool sensord_get_resolution(sensor_t sensor, float *resolution);
-
-/**
- * @brief Get the minimum interval allowed between two events in microsecond or zero if this sensor only returns a value when the data it's measuring changes.
- *
- * @param[in] sensor a sensor to get minimum interval.
- * @param[out] min_interval the minimum interval of this sensor.
- * @return true on success, otherwise false.
- */
-bool sensord_get_min_interval(sensor_t sensor, int *min_interval);
-
-/**
- * @brief Get the number of events reserved for this sensor in the batch mode FIFO.
- *
- * @param[in] sensor a sensor to get the number of fifo count
- * @param[out] fifo_count the number of events reserved for this sensor in the batch mode FIFO
- * @return true on success, otherwise false
- */
-bool sensord_get_fifo_count(sensor_t sensor, int *fifo_count);
-
-/**
- * @brief Get the maximum number of events of this sensor that could be batched. If this value is zero it indicates that batch mode is not supported for this sensor.
- *
- * @param[in] sensor a sensor to the maximum number of events that could be batched.
- * @param[out] max_batch_count the maximum number of events of this sensor that could be batched.
- * @return true on success, otherwise false.
- */
-bool sensord_get_max_batch_count(sensor_t sensor, int *max_batch_count);
-
-/**
- * @brief Get the supported event types of this sensor.
- *
- * @param[in] sensor a sensor to get the supported event types.
- * @param[out] event_types the array containing supported event types of this sensor, the caller should explicitly free this array.
- * @param[out] count the count of the supported event types of this sensor.
- * @return true on success, otherwise false.
- */
-bool sensord_get_supported_event_types(sensor_t sensor, unsigned int **event_types, int *count);
-
-/**
- * @brief Check a given event type is supporeted by this sensor.
- *
- * @param[in] sensor a sensor to check a given event type is supporeted.
- * @param[out] event_type an event type to be checked whether supported or not.
- * @param[out] supported whether a given event is supported or not in this sensor.
- * @return true on success, otherwise false.
- */
-bool sensord_is_supported_event_type(sensor_t sensor, unsigned int event_type, bool *supported);
-
-/**
- * @brief Check a wakeup supported or not by this sensor.
- *
- * @param[in] sensor a sensor to check a given event type is supporeted.
- * @return true on success, otherwise false.
- */
-bool sensord_is_wakeup_supported(sensor_t sensor);
-
-/**
- * @brief Connect a given sensor and get a handle of a given sensor.
- *
- * @param[in] sensor a sensor to connect
- * @return a handle of a given sensor on success, otherwise negative value
- */
-int sensord_connect(sensor_t sensor);
-
-/**
- * @brief Disconnect a given sensor.
- *
- * @param[in] handle a handle to disconnect.
- * @return true on success, otherwise false.
- */
-bool sensord_disconnect(int handle);
-
-/**
- * @brief Register a callback with a connected sensor for a given event_type. This callback will be called when a given event occurs in a connected sensor.
- *
- * @param[in] handle a handle represensting a connected sensor.
- * @param[in] event_type an event type to register
- * @param[in] interval The desired interval between two consecutive events in microseconds. This is only a hint to the system so events may be received faster or slower than the specified interval.
- * It can be one of SENSOR_INTERVAL_NORMAL, SENSOR_INTERVAL_FASTEST or the interval in microseconds.
- * @param[in] max_batch_latency An event in the batch can be delayed by at most max_batch_latency microseconds. If this is set to zero, batch mode is disabled.
- * @param[in] cb a callback which is called when a given event occurs
- * @param[in] user_data the callback is called with user_data
- * @return true on success, otherwise false.
- */
-bool sensord_register_event(int handle, unsigned int event_type, unsigned int interval, unsigned int max_batch_latency, sensor_cb_t cb, void *user_data);
-
-/**
- * @brief Register a callback with a connected context sensor for a given event_type. This callback will be called when a given event occurs in a connected context sensor.
- *
- * @param[in] handle a handle represensting a connected context sensor.
- * @param[in] event_type an event type to register
- * @param[in] interval The desired interval between two consecutive events in microseconds. This is only a hint to the system so events may be received faster or slower than the specified interval.
- * It can be one of SENSOR_INTERVAL_NORMAL, SENSOR_INTERVAL_FASTEST or the interval in microseconds.
- * @param[in] max_batch_latency An event in the batch can be delayed by at most max_batch_latency microseconds. If this is set to zero, batch mode is disabled.
- * @param[in] cb a callback which is called when a given event occurs
- * @param[in] user_data the callback is called with user_data
- * @return true on success, otherwise false.
- */
-bool sensord_register_hub_event(int handle, unsigned int event_type, unsigned int interval, unsigned int max_batch_latency, sensorhub_cb_t cb, void *user_data);
-
-/**
- * @brief Unregister a event with a connected sensor. After unregistering, that event will not be sent.
- *
- * @param[in] handle a handle represensting a connected sensor.
- * @param[in] event_type an event type to unregister.
- * @return true on success, otherwise false.
- */
-bool sensord_unregister_event(int handle, unsigned int event_type);
-
-/**
- * @brief Register a callback with a connected sensor. This callback will be called when the accuracy of a sensor has changed.
- *
- * @param[in] handle a handle represensting a connected sensor.
- * @param[in] cb a callback which is called when he accuracy of a sensor has changed.
- * @param[in] user_data the callback is called with user_data
- * @return true on success, otherwise false.
- */
-bool sensord_register_accuracy_cb(int handle, sensor_accuracy_changed_cb_t cb, void *user_data);
-
-/**
- * @brief Unregister a callback with a connected sensor. After unregistering, sensor_accuray_change_cb will not be called.
- *
- * @param[in] handle a handle represensting a connected sensor.
- * @return true on success, otherwise false.
- */
-bool sensord_unregister_accuracy_cb(int handle);
-
-/**
- * @brief Start listening events with a connected sensor.
- *
- * @param[in] handle a handle represensting a connected sensor.
- * @param[in] option either one of SENSOR_OPTION_DEFAULT and SENSOR_OPTION_ALWAYS_ON.
- * with SENSOR_OPTION_DEFAULT, it stops to listening events when LCD is off or in power save mode.
- * with SENSOR_OPTION_ALWAYS_ON, it continues to listening events even when LCD is off or in power save mode.
- * @return true on success, otherwise false.
- */
-bool sensord_start(int handle, int option);
-
-/**
- * @brief Stop listening events with a connected sensor.
- *
- * @param[in] handle a handle represensting a connected sensor.
- * @return true on success, otherwise false.
- */
-bool sensord_stop(int handle);
-
-/**
- * @brief Change the interval of a specifed event type in a connected sensor.
- *
- * @param[in] handle a handle represensting a connected sensor.
- * @param[in] event_type an event type to change interval.
- * @param[in] interval The desired interval between two consecutive events in microseconds. This is only a hint to the system so events may be received faster or slower than the specified interval.
- * It can be one of SENSOR_INTERVAL_NORMAL, SENSOR_INTERVAL_FASTEST or the interval in microseconds.
- * @return true on success, otherwise false.
- */
-bool sensord_change_event_interval(int handle, unsigned int event_type, unsigned int interval);
-
-/**
- * @brief Change the max batch latency of a specifed event type in a connected sensor.
- *
- * @param[in] handle a handle represensting a connected sensor.
- * @param[in] event_type an event type to change max batch latency
- * @param[in] max_batch_latency an event in the batch can be delayed by at most max_batch_latency microseconds. If this is set to zero, batch mode is disabled.
- * @return true on success, otherwise false.
- */
-bool sensord_change_event_max_batch_latency(int handle, unsigned int event_type, unsigned int max_batch_latency);
-
-/**
- * @brief Change the option of a connected sensor.
- *
- * @param[in] handle a handle represensting a connected sensor.
- * @param[in] option either one of SENSOR_OPTION_DEFAULT and SENSOR_OPTION_ALWAYS_ON.
- * with SENSOR_OPTION_DEFAULT, it stops to listening events when LCD is off or in power save mode.
- * with SENSOR_OPTION_ALWAYS_ON, it continues to listening events even when LCD is off or in power save mode.
- * @return true on success, otherwise false.
- */
-bool sensord_set_option(int handle, int option);
-
-/*
- * @brief Set the attribute to a connected sensor
- *
- * @param[in] handle a handle represensting a connected sensor.
- * @param[in] attribute an attribute to change
- * @param[in] value an attribute value
- * @return 0 on success, otherwise a negative error value
- * @retval 0 Successful
- * @retval -EINVAL Invalid parameter
- * @retval -EPERM Operation not permitted
- */
-int sensord_set_attribute_int(int handle, int attribute, int value);
-
-/**
- * @brief Set the attribute to a connected sensor
- *
- * @param[in] handle a handle represensting a connected sensor.
- * @param[in] attribute an attribute to change
- * @param[in] value an attribute value
- * @param[in] value_len the length of value
- * @return 0 on success, otherwise a negative error value
- * @retval 0 Successful
- * @retval -EINVAL Invalid parameter
- * @retval -EPERM Operation not permitted
- */
-int sensord_set_attribute_str(int handle, int attribute, const char *value, int len);
-
-/**
- * @brief Send data to sensorhub
- *
- * @param[in] handle a handle represensting a connected context sensor.
- * @param[in] data it holds data to send to sensorhub
- * @param[in] data_len the length of data
- * @return true on success, otherwise false.
- */
-bool sensord_send_sensorhub_data(int handle, const char *data, int data_len);
-bool sensord_send_command(int handle, const char *command, int command_len);
-
-/**
- * @brief get sensor data from a connected sensor
- *
- * @param[in] handle a handle represensting a connected context sensor.
- * @param[in] data_id it specifies data to get
- * @param[out] sensor_data data from connected sensor
- * @return true on success, otherwise false.
- */
-bool sensord_get_data(int handle, unsigned int data_id, sensor_data_t* sensor_data);
-
-/**
- * @brief flush sensor data from a connected sensor
- *
- * @param[in] handle a handle represensting a connected context sensor.
- * @return true on success, otherwise false.
- */
-bool sensord_flush(int handle);
-
-typedef void (*sensor_external_command_cb_t)(int handle, const char* data, int data_cnt, void *user_data);
-
-int sensord_external_connect(const char *key, sensor_external_command_cb_t cb, void *user_data);
-bool sensord_external_disconnect(int handle);
-bool sensord_external_post(int handle, unsigned long long timestamp, const float* data, int data_cnt);
-
-bool sensord_set_passive_mode(int handle, bool passive);
-/**
- * @}
- */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-/*
- * 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_INTERNAL_DEPRECATED__
-#define __SENSOR_INTERNAL_DEPRECATED__
-
-#ifndef DEPRECATED
-#define DEPRECATED __attribute__((deprecated))
-#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>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-typedef struct {
- condition_op_t cond_op;
- float cond_value1;
-} event_condition_t;
-
-typedef struct {
- size_t event_data_size;
- void *event_data;
-} sensor_event_data_t;
-
-typedef void (*sensor_callback_func_t)(unsigned int, sensor_event_data_t *, void *);
-typedef sensor_callback_func_t sensor_legacy_cb_t;
-
-typedef struct {
- int x;
- int y;
- int z;
-} sensor_panning_data_t;
-
-/**
- * @fn int sf_connect(sensor_type_t sensor)
- * @brief This API connects a sensor type to respective sensor. The application calls with the type of the sensor (ex. ACCELEROMETER_SENSOR) and on basis of that server takes decision of which plug-in to be connected. Once sensor connected application can proceed for data processing. This API returns a positive handle which should be used by application to communicate on sensor type.
- * @param[in] sensor_type your desired sensor type
- * @return if it succeed, it return handle value( >=0 ), otherwise negative value return
- */
-DEPRECATED int sf_connect(sensor_type_t sensor_type);
-
-/**
- * @fn int sf_disconnect(int handle)
- * @brief This API disconnects an attached sensor from an application. Application must use the handle retuned after attaching the sensor. After detaching, the corresponding handle will be released.
- * @param[in] handle received handle value by sf_connect()
- * @return if it succeed, it return zero value, otherwise negative value return
- */
-DEPRECATED int sf_disconnect(int handle);
-
-/**
- * @fn int sf_start(int handle, int option)
- * @brief This API sends a start command to sensor server. This intimates server that the client side is ready to handle data and start processing. The parameter option should be '0' for current usages.
- * @param[in] handle received handle value by sf_connect()
- * @param[in] option With SENSOR_OPTION_DEFAULT, it stops to sense when LCD is off, and with SENSOR_OPTION_ALWAYS_ON, it continues to sense even when LCD is off
- * @return if it succeed, it return zero value, otherwise negative value return
- */
-DEPRECATED int sf_start(int handle, int option);
-
-/**
- * @fn int sf_stop(int handle)
- * @brief This API sends a stop command to the Sensor server indicating that the data processing is stopped from application side for this time.
- * @param[in] handle received handle value by sf_connect()
- * @return if it succeed, it return zero value, otherwise negative value return
- */
-DEPRECATED int sf_stop(int handle);
-
-/**
- * @fn int sf_register_event(int handle, unsigned int event_type, event_conditon_t *event_condition, sensor_callback_func_t cb, void *user_data)
- * @brief This API registers a user defined callback function with a connected sensor for a particular event. This callback function will be called when there is a change in the state of respective sensor. user_data will be the parameter used during the callback call. Callback interval can be adjusted using even_contion_t argument.
- * @param[in] handle received handle value by sf_connect()
- * @param[in] event_type your desired event_type to register it
- * @param[in] event_condition input event_condition for special event. if you want to register without event_condition, just use a NULL value
- * @param[in] cb your define callback function
- * @param[in] user_data your option data that will be send when your define callback function called. if you don't have any option data, just use a NULL value
- * @return if it succeed, it return zero value, otherwise negative value return
- */
-DEPRECATED int sf_register_event(int handle, unsigned int event_type, event_condition_t *event_condition, sensor_callback_func_t cb, void *user_data);
-
-/**
- * @fn int sf_unregister_event(int handle, unsigned int event_type)
- * @brief This API de-registers a user defined callback function with a sensor registered with the specified handle. After unsubscribe, no event will be sent to the application.
- * @param[in] handle received handle value by sf_connect()
- * @param[in] event_type your desired event_type that you want to unregister event
- * @return if it succeed, it return zero value, otherwise negative value return
- */
-DEPRECATED int sf_unregister_event(int handle, unsigned int event_type);
-
-/**
- * @fn int sf_get_data(int handle, unsigned int data_id, sensor_data_t* values)
- * @brief This API gets raw data from a sensor with connecting the sensor-server. The type of sensor is supplied and return data is stored in the output parameter values [].
- * @param[in] handle received handle value by sf_connect()
- * @param[in] data_id predefined data_ID as every sensor in own header - sensor_xxx.h, enum xxx_data_id {}
- * @param[out] values return values
- * @return if it succeed, it return zero value, otherwise negative value return
- */
-DEPRECATED int sf_get_data(int handle, unsigned int data_id, sensor_data_t* values);
-
-/**
- * @fn int sf_change_event_condition(int handle, unsigned int event_type, event_condition_t *event_condition)
- * @brief This API change a user defined callback function condition with a sensor registered with the specified handle.
- * @param[in] handle received handle value by sf_connect()
- * @param[in] event_type your desired event_type that you want to unregister event
- * @param[in] event_condition your desired event condition that you want to change event
- * @return if it succeed, it return zero value, otherwise negative value return
- */
-DEPRECATED int sf_change_event_condition(int handle, unsigned int event_type, event_condition_t *event_condition);
-
-/**
- * @fn int sf_change_sensor_option(int handle, int option)
- * @brief This API change sensor option .
- * @param[in] handle received handle value by sf_connect()
- * @param[in] option your desired option that you want to turn on sensor during LCD OFF
- * @return if it succeed, it return zero value, otherwise negative value return
- */
-
-DEPRECATED int sf_change_sensor_option(int handle, int option);
-
-/**
- * @fn int sf_send_sensorhub_data(int handle, const char* buffer, int data_len)
- * @brief This API sends data to sensorhub.
- * @param[in] handle received handle by sf_connect()
- * @param[in] data it holds data to send to sensorhub
- * @param[in] data_len the length of data
- * @return if it succeed, it returns zero, otherwise negative value
- */
-DEPRECATED int sf_send_sensorhub_data(int handle, const char* data, int data_len);
-
-DEPRECATED int sf_check_rotation(unsigned long *rotation);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+++ /dev/null
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(sensor-hal CXX)
-
-INSTALL(FILES sensor_hal.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-INSTALL(FILES sensor_hal_types.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
+++ /dev/null
-/*
- * Copyright (c) 2016 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_HAL_H_
-#define _SENSOR_HAL_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "sensor_hal_types.h"
-
-/*
- * Create devices
- */
-typedef void *sensor_device_t;
-typedef int (*create_t)(sensor_device_t **devices);
-
-/*
- * Sensor device interface
- * 1 device must be abstracted from 1 device event node
- */
-class sensor_device {
-public:
- virtual ~sensor_device() {}
-
- uint32_t get_hal_version(void)
- {
- return SENSOR_HAL_VERSION(1, 0);
- }
-
- virtual int get_poll_fd(void) = 0;
- virtual int get_sensors(const sensor_info_t **sensors) = 0;
-
- virtual bool enable(uint32_t id) = 0;
- virtual bool disable(uint32_t id) = 0;
-
- virtual int read_fd(uint32_t **ids) = 0;
- virtual int get_data(uint32_t id, sensor_data_t **data, int *length) = 0;
-
- virtual bool set_interval(uint32_t id, unsigned long val)
- {
- return true;
- }
- virtual bool set_batch_latency(uint32_t id, unsigned long val)
- {
- return true;
- }
- virtual bool set_attribute_int(uint32_t id, int32_t attribute, int32_t value)
- {
- return true;
- }
- virtual bool set_attribute_str(uint32_t id, int32_t attribute, char *value, int len)
- {
- return true;
- }
- virtual bool flush(uint32_t id)
- {
- return true;
- }
-};
-
-#endif /* _SENSOR_HAL_H_ */
+++ /dev/null
-/*
- * Copyright (c) 2016 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_HAL_TYPES_H_
-#define _SENSOR_HAL_TYPES_H_
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#define SENSOR_HAL_VERSION(maj, min) \
- ((((maj) & 0xFFFF) << 24) | ((min) & 0xFFFF))
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
-
-/*
- * Sensor Types
- * These types are used to controll the sensors
- *
- * - base unit
- * acceleration values : meter per second^2 (m/s^2)
- * magnetic values : micro-Tesla (uT)
- * orientation values : degrees
- * gyroscope values : degree/s
- * temperature values : degrees centigrade
- * proximity valeus : distance
- * light values : lux
- * pressure values : hectopascal (hPa)
- * humidity : relative humidity (%)
- */
-typedef enum {
- SENSOR_DEVICE_UNKNOWN = -2,
- SENSOR_DEVICE_ALL = -1,
- SENSOR_DEVICE_ACCELEROMETER,
- SENSOR_DEVICE_GRAVITY,
- SENSOR_DEVICE_LINEAR_ACCELERATION,
- SENSOR_DEVICE_GEOMAGNETIC,
- SENSOR_DEVICE_ROTATION_VECTOR,
- SENSOR_DEVICE_ORIENTATION,
- SENSOR_DEVICE_GYROSCOPE,
- SENSOR_DEVICE_LIGHT,
- SENSOR_DEVICE_PROXIMITY,
- SENSOR_DEVICE_PRESSURE,
- SENSOR_DEVICE_ULTRAVIOLET,
- SENSOR_DEVICE_TEMPERATURE,
- SENSOR_DEVICE_HUMIDITY,
- SENSOR_DEVICE_HRM,
- SENSOR_DEVICE_HRM_LED_GREEN,
- SENSOR_DEVICE_HRM_LED_IR,
- SENSOR_DEVICE_HRM_LED_RED,
- SENSOR_DEVICE_GYROSCOPE_UNCAL,
- SENSOR_DEVICE_GEOMAGNETIC_UNCAL,
- SENSOR_DEVICE_GYROSCOPE_RV,
- SENSOR_DEVICE_GEOMAGNETIC_RV,
-
- SENSOR_DEVICE_HUMAN_PEDOMETER = 0x300,
- SENSOR_DEVICE_HUMAN_SLEEP_MONITOR,
- SENSOR_DEVICE_HUMAN_SLEEP_DETECTOR,
- SENSOR_DEVICE_HUMAN_STRESS_MONITOR,
-
- SENSOR_DEVICE_EXERCISE_WALKING = 0x400,
- SENSOR_DEVICE_EXERCISE_RUNNING,
- SENSOR_DEVICE_EXERCISE_HIKING,
- SENSOR_DEVICE_EXERCISE_CYCLING,
- SENSOR_DEVICE_EXERCISE_ELLIPTICAL,
- SENSOR_DEVICE_EXERCISE_INDOOR_CYCLING,
- SENSOR_DEVICE_EXERCISE_ROWING,
- SENSOR_DEVICE_EXERCISE_STEPPER,
-
- SENSOR_DEVICE_FUSION = 0x900,
- SENSOR_DEVICE_AUTO_ROTATION,
- SENSOR_DEVICE_AUTO_BRIGHTNESS,
-
- SENSOR_DEVICE_GESTURE_MOVEMENT = 0x1200,
- SENSOR_DEVICE_GESTURE_WRIST_UP,
- SENSOR_DEVICE_GESTURE_WRIST_DOWN,
- SENSOR_DEVICE_GESTURE_MOVEMENT_STATE,
-
- SENSOR_DEVICE_ACTIVITY_TRACKER = 0x1A00,
- SENSOR_DEVICE_ACTIVITY_LEVEL_MONITOR,
- SENSOR_DEVICE_GPS_BATCH,
-
- SENSOR_DEVICE_HRM_CTRL = 0x1A80,
-
- SENSOR_DEVICE_WEAR_STATUS = 0x2000,
- SENSOR_DEVICE_WEAR_ON_MONITOR,
- SENSOR_DEVICE_NO_MOVE_DETECTOR,
- SENSOR_DEVICE_RESTING_HR,
- SENSOR_DEVICE_STEP_LEVEL_MONITOR,
- SENSOR_DEVICE_EXERCISE_STANDALONE,
- SENSOR_DEVICE_EXERCISE_HR,
- SENSOR_DEVICE_WORKOUT,
- SENSOR_DEVICE_CYCLE_MONITOR,
- SENSOR_DEVICE_STAIR_TRACKER,
- SENSOR_DEVICE_PRESSURE_INDICATOR,
- SENSOR_DEVICE_PRESSURE_ALERT,
- SENSOR_DEVICE_HR_CALORIE,
-
- SENSOR_DEVICE_CONTEXT = 0x7000,
- SENSOR_DEVICE_MOTION,
- SENSOR_DEVICE_PIR,
- SENSOR_DEVICE_PIR_LONG,
- SENSOR_DEVICE_DUST,
- SENSOR_DEVICE_THERMOMETER,
- SENSOR_DEVICE_PEDOMETER,
- SENSOR_DEVICE_FLAT,
- SENSOR_DEVICE_HRM_RAW,
- SENSOR_DEVICE_TILT,
- SENSOR_DEVICE_ROTATION_VECTOR_RAW,
- SENSOR_DEVICE_GSR,
- SENSOR_DEVICE_SIMSENSE,
- SENSOR_DEVICE_PPG,
-
-} sensor_device_type;
-
-/*
- * A platform sensor handler is generated based on this handle
- * This id can be assigned from HAL developer. so it has to be unique in 1 sensor_device.
- */
-typedef struct sensor_info_t {
- uint32_t id;
- const char *name;
- sensor_device_type type;
- unsigned int event_type; // for Internal API
- const char *model_name;
- const char *vendor;
- float min_range;
- float max_range;
- float resolution;
- int min_interval;
- int max_batch_count;
- bool wakeup_supported;
-} sensor_info_t;
-
-enum sensor_accuracy_t {
- SENSOR_ACCURACY_UNDEFINED = -1,
- SENSOR_ACCURACY_BAD = 0,
- SENSOR_ACCURACY_NORMAL = 1,
- SENSOR_ACCURACY_GOOD = 2,
- SENSOR_ACCURACY_VERYGOOD = 3
-};
-
-#define SENSOR_DATA_VALUE_SIZE 16
-
-/* sensor_data_t */
-typedef struct sensor_data_t {
- int accuracy;
- unsigned long long timestamp;
- int value_count;
- float values[SENSOR_DATA_VALUE_SIZE];
-} sensor_data_t;
-
-#define SENSORHUB_DATA_VALUE_SIZE 4096
-
-/* sensorhub_data_t */
-typedef struct sensorhub_data_t {
- int accuracy;
- unsigned long long timestamp;
-
- /*
- * Use "value_count" instead of "hub_data_size"
- * which is going to be removed soon
- */
- union {
- int value_count;
- int hub_data_size; /* deprecated */
- };
-
- /*
- * Use "values" instead of "hub_data"
- * which is going to be removed soon
- */
- union {
- char values[SENSORHUB_DATA_VALUE_SIZE];
- char hub_data[SENSORHUB_DATA_VALUE_SIZE]; /* deprecated */
- };
-} sensorhub_data_t;
-
-#define SENSOR_PEDOMETER_DATA_DIFFS_SIZE 20
-
-typedef struct {
- int accuracy;
- unsigned long long timestamp;
- int value_count; /* value_count == 8 */
- float values[SENSOR_DATA_VALUE_SIZE];
- /* values = {step count, walk step count, run step count,
- moving distance, calorie burned, last speed,
- last stepping frequency (steps per sec),
- last step status (walking, running, ...)} */
- /* Additional data attributes (not in sensor_data_t)*/
- int diffs_count;
- struct differences {
- int timestamp;
- int steps;
- int walk_steps;
- int run_steps;
- int walk_up_steps;
- int walk_down_steps;
- int run_up_steps;
- int run_down_steps;
- float distance;
- float calories;
- float speed;
- } diffs[SENSOR_PEDOMETER_DATA_DIFFS_SIZE];
-} sensor_pedometer_data_t;
-
-#define CONVERT_TYPE_ATTR(type, index) ((type) << 8 | 0x80 | (index))
-
-enum sensor_attribute {
- SENSOR_ATTR_ACTIVITY = CONVERT_TYPE_ATTR(SENSOR_DEVICE_ACTIVITY_TRACKER, 0x1),
-
- SENSOR_ATTR_PEDOMETER_HEIGHT = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HUMAN_PEDOMETER, 0x1),
- SENSOR_ATTR_PEDOMETER_WEIGHT = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HUMAN_PEDOMETER, 0x2),
- SENSOR_ATTR_PEDOMETER_GENDER = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HUMAN_PEDOMETER, 0x3),
-
- SENSOR_ATTR_STRESS_MONITOR_AGE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HUMAN_STRESS_MONITOR, 0x1),
-
- SENSOR_ATTR_EXERCISE_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_STANDALONE, 0x1),
- SENSOR_ATTR_EXERCISE_GPS = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_STANDALONE, 0x2),
- SENSOR_ATTR_EXERCISE_BATCH_INTERVAL = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_STANDALONE, 0x3),
- SENSOR_ATTR_EXERCISE_PSERVICE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_STANDALONE, 0x4),
-
- SENSOR_ATTR_CYCLE_DURATION = CONVERT_TYPE_ATTR(SENSOR_DEVICE_CYCLE_MONITOR, 0x1),
- SENSOR_ATTR_CYCLE_HOLDING_POSITION = CONVERT_TYPE_ATTR(SENSOR_DEVICE_CYCLE_MONITOR, 0x2),
- SENSOR_ATTR_CYCLE_VELOCITY = CONVERT_TYPE_ATTR(SENSOR_DEVICE_CYCLE_MONITOR, 0x3),
-
- SENSOR_ATTR_WORKOUT_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_WORKOUT, 0x1),
- SENSOR_ATTR_WORKOUT_DURATION = CONVERT_TYPE_ATTR(SENSOR_DEVICE_WORKOUT, 0x2),
-
- SENSOR_ATTR_RESTING_HR_OPR_MODE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x1),
- SENSOR_ATTR_RESTING_HR_MAX_RHR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x2),
- SENSOR_ATTR_RESTING_HR_MIN_RHR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x3),
- SENSOR_ATTR_RESTING_HR_AVG_RHR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x4),
- SENSOR_ATTR_RESTING_HR_HOUR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x5),
- SENSOR_ATTR_RESTING_HR_MIN = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x6),
- SENSOR_ATTR_RESTING_HR_SEC = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x7),
- SENSOR_ATTR_RESTING_HR_PROPERTY_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x10),
- SENSOR_ATTR_RESTING_HR_PROPERTY_HR_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x11),
- SENSOR_ATTR_RESTING_HR_PROPERTY_HR_VALUE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x12),
- SENSOR_ATTR_RESTING_HR_PROPERTY_DURATION = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x13),
- SENSOR_ATTR_RESTING_HR_PROPERTY_ACT_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x14),
- SENSOR_ATTR_RESTING_HR_PROPERTY_ACT_DUR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x15),
- SENSOR_ATTR_RESTING_HR_PROPERTY_CONT_DUR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x16),
- SENSOR_ATTR_RESTING_HR_DATA_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x20),
- SENSOR_ATTR_RESTING_HR_DATA_FLUSH = CONVERT_TYPE_ATTR(SENSOR_DEVICE_RESTING_HR, 0x21),
-
- SENSOR_ATTR_EXERCISE_HR_OPR_MODE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_HR, 0x1),
- SENSOR_ATTR_EXERCISE_HR_ACTIVITY_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_HR, 0x2),
- SENSOR_ATTR_EXERCISE_HR_BATCH_DUR = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_HR, 0x3),
- SENSOR_ATTR_EXERCISE_HR_FLUSH = CONVERT_TYPE_ATTR(SENSOR_DEVICE_EXERCISE_HR, 0x4),
-
- SENSOR_ATTR_PRESSURE_INDICATOR_START = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_INDICATOR, 0x1),
- SENSOR_ATTR_PRESSURE_INDICATOR_STOP = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_INDICATOR, 0x2),
- SENSOR_ATTR_PRESSURE_INDICATOR_FLUSH = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_INDICATOR, 0x3),
- SENSOR_ATTR_PRESSURE_INDICATOR_RESTORE_TIME = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_INDICATOR, 0x4),
- SENSOR_ATTR_PRESSURE_INDICATOR_RESTORE_VALUE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_INDICATOR, 0x5),
- SENSOR_ATTR_PRESSURE_INDICATOR_CURRENT_TIME = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_INDICATOR, 0x6),
-
- SENSOR_ATTR_PRESSURE_ALERT_START = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_ALERT, 0x1),
- SENSOR_ATTR_PRESSURE_ALERT_STOP = CONVERT_TYPE_ATTR(SENSOR_DEVICE_PRESSURE_ALERT, 0x2),
-
- SENSOR_ATTR_HR_CALORIE_AGE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x1),
- SENSOR_ATTR_HR_CALORIE_HEIGHT = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x2),
- SENSOR_ATTR_HR_CALORIE_WEIGHT = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x3),
- SENSOR_ATTR_HR_CALORIE_GENDER = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x4),
- SENSOR_ATTR_HR_CALORIE_INST = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x10),
- SENSOR_ATTR_HR_CALORIE_EXERCISE_TYPE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x11),
- SENSOR_ATTR_HR_CALORIE_TARGET_CAL = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x12),
- SENSOR_ATTR_HR_CALORIE_MAX_HEARTRATE = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x13),
- SENSOR_ATTR_HR_CALORIE_FLUSH = CONVERT_TYPE_ATTR(SENSOR_DEVICE_HR_CALORIE, 0x20),
-};
-
-enum sensor_activity {
- SENSOR_ACTIVITY_UNKNOWN = 1,
- SENSOR_ACTIVITY_STILL = 2,
- SENSOR_ACTIVITY_WALKING = 4,
- SENSOR_ACTIVITY_RUNNING = 8,
- SENSOR_ACTIVITY_IN_VEHICLE = 16,
- SENSOR_ACTIVITY_ON_BICYCLE = 32,
-};
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _SENSOR_HAL_TYPES_H_ */
ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS} sensor)
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
ENDFOREACH(flag)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
-SET (INSTALL_HEADERS
- sensor_types.h
- sensor_common.h
- sensor_deprecated.h
- enum_factory.h
-)
-
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/hal
${CMAKE_CURRENT_SOURCE_DIR}
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${SHARED_PKGS_LDFLAGS})
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
-
-FOREACH(HEADER IN ITEMS ${INSTALL_HEADERS})
- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${HEADER} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor)
-ENDFOREACH()
+++ /dev/null
-/*
- * sensord
- *
- * Copyright (c) 2016 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 _ENUM_FACTORY_H_
-#define _ENUM_FACTORY_H_
-
-#define ENUM_SENSOR(name) name,
-#define ENUM_SENSOR_VALUE(name, assign) name = (assign),
-
-#define ENUM_CASE(name) case (name): return #name;
-#define ENUM_CASE_VALUE(name, assign) ENUM_CASE(name)
-
-#define DECLARE_SENSOR_ENUM(ENUM_TYPE, ENUM_DEF) \
- typedef enum ENUM_TYPE { \
- ENUM_DEF(ENUM_SENSOR, ENUM_SENSOR_VALUE) \
- } ENUM_TYPE;
-
-#define DECLARE_SENSOR_ENUM_UTIL_NS(ENUM_TYPE) \
- namespace util_##ENUM_TYPE { \
- const char *get_string(ENUM_TYPE type); \
- };
-
-#define DECLARE_SENSOR_ENUM_UTIL(ENUM_TYPE, ENUM_DEF) \
- const char *util_##ENUM_TYPE::get_string(ENUM_TYPE type) { \
- switch (type) { \
- ENUM_DEF(ENUM_CASE, ENUM_CASE_VALUE) \
- } \
- return "UNKNOWN"; \
- }
-
-#endif /* _ENUM_FACTORY_H_ */
+++ /dev/null
-/*
- * 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__ */
+++ /dev/null
-/*
- * sensord
- *
- * Copyright (c) 2016 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_DEPRECATED_H__
-#define __SENSOR_DEPRECATED_H__
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-// Sensor Event Types
-enum event_types_t {
- ACCELEROMETER_RAW_DATA_EVENT = (ACCELEROMETER_SENSOR << 16) | 0x0001,
- ACCELEROMETER_UNPROCESSED_DATA_EVENT = (ACCELEROMETER_SENSOR << 16) | 0x0002,
-
- GYROSCOPE_RAW_DATA_EVENT = (GYROSCOPE_SENSOR << 16) | 0x0001,
- GYROSCOPE_UNPROCESSED_DATA_EVENT = (GYROSCOPE_SENSOR << 16) | 0x0002,
-
- GEOMAGNETIC_RAW_DATA_EVENT = (GEOMAGNETIC_SENSOR << 16) | 0x0001,
- GEOMAGNETIC_UNPROCESSED_DATA_EVENT = (GEOMAGNETIC_SENSOR << 16) | 0x0002,
-
- PROXIMITY_CHANGE_STATE_EVENT = (PROXIMITY_SENSOR << 16) | 0x0001,
- PROXIMITY_STATE_EVENT = (PROXIMITY_SENSOR << 16) | 0x0002,
- PROXIMITY_DISTANCE_DATA_EVENT = (PROXIMITY_SENSOR << 16) | 0x0003,
-
- PRESSURE_RAW_DATA_EVENT = (PRESSURE_SENSOR << 16) | 0x0001,
-
- TEMPERATURE_RAW_DATA_EVENT = (TEMPERATURE_SENSOR << 16) | 0x0001,
-
- LIGHT_LUX_DATA_EVENT = (LIGHT_SENSOR << 16) | 0x0001,
- LIGHT_LEVEL_DATA_EVENT = (LIGHT_SENSOR << 16) | 0x0002,
- LIGHT_CHANGE_LEVEL_EVENT = (LIGHT_SENSOR << 16) | 0x0003,
-
- ROTATION_VECTOR_RAW_DATA_EVENT = (ROTATION_VECTOR_SENSOR << 16) | 0x0001,
-
- FACE_DOWN_RAW_DATA_EVENT = (GESTURE_FACE_DOWN_SENSOR << 16) | 0x0001,
-
- RV_RAW_RAW_DATA_EVENT = (RV_RAW_SENSOR << 16) | 0x0001,
-
- ULTRAVIOLET_RAW_DATA_EVENT = (ULTRAVIOLET_SENSOR << 16) | 0x0001,
-
- AUTO_ROTATION_CHANGE_STATE_EVENT = (AUTO_ROTATION_SENSOR << 16) | 0x0001,
-
- BIO_LED_RED_RAW_DATA_EVENT = (BIO_LED_RED_SENSOR << 16) | 0x0001,
-
- GAMING_RV_RAW_DATA_EVENT = (GYROSCOPE_RV_SENSOR << 16) | 0x0001,
-
- GEOMAGNETIC_RV_RAW_DATA_EVENT = (GEOMAGNETIC_RV_SENSOR << 16) | 0x0001,
-
- GRAVITY_RAW_DATA_EVENT = (GRAVITY_SENSOR << 16) | 0x0001,
-
- LINEAR_ACCEL_RAW_DATA_EVENT = (LINEAR_ACCEL_SENSOR << 16) | 0x0001,
-
- MOTION_ENGINE_EVENT_SNAP = (MOTION_SENSOR << 16) | 0x0001,
- MOTION_ENGINE_EVENT_SHAKE = (MOTION_SENSOR << 16) | 0x0002,
- MOTION_ENGINE_EVENT_DOUBLETAP = (MOTION_SENSOR << 16) | 0x0004,
- MOTION_ENGINE_EVENT_PANNING = (MOTION_SENSOR << 16) | 0x0008,
- MOTION_ENGINE_EVENT_TOP_TO_BOTTOM = (MOTION_SENSOR << 16) | 0x0010,
- MOTION_ENGINE_EVENT_DIRECT_CALL = (MOTION_SENSOR << 16) | 0x0020,
- MOTION_ENGINE_EVENT_TILT_TO_UNLOCK = (MOTION_SENSOR << 16) | 0x0040,
- MOTION_ENGINE_EVENT_LOCK_EXECUTE_CAMERA = (MOTION_SENSOR << 16) | 0x0080,
- MOTION_ENGINE_EVENT_SMART_ALERT = (MOTION_SENSOR << 16) | 0x0100,
- MOTION_ENGINE_EVENT_TILT = (MOTION_SENSOR << 16) | 0x0200,
- MOTION_ENGINE_EVENT_PANNING_BROWSE = (MOTION_SENSOR << 16) | 0x0400,
- MOTION_ENGINE_EVENT_NO_MOVE = (MOTION_SENSOR << 16) | 0x0800,
- MOTION_ENGINE_EVENT_SHAKE_ALWAYS_ON = (MOTION_SENSOR << 16) | 0x1000,
- MOTION_ENGINE_EVENT_SMART_RELAY = (MOTION_SENSOR << 16) | 0x2000,
-
- ORIENTATION_RAW_DATA_EVENT = (ORIENTATION_SENSOR << 16) | 0x0001,
-
- TILT_RAW_DATA_EVENT = (TILT_SENSOR << 16) | 0x0001,
-
- GYROSCOPE_UNCAL_RAW_DATA_EVENT = (GYROSCOPE_UNCAL_SENSOR << 16) | 0x0001,
-
- FUSION_EVENT = (FUSION_SENSOR << 16) | 0x0001,
- FUSION_GYROSCOPE_UNCAL_EVENT = (FUSION_SENSOR << 16) | 0x0002,
- FUSION_CALIBRATION_NEEDED_EVENT = (FUSION_SENSOR << 16) | 0x0003,
- FUSION_ORIENTATION_ENABLED = (FUSION_SENSOR << 16) | 0x0004,
- FUSION_ROTATION_VECTOR_ENABLED = (FUSION_SENSOR << 16) | 0x0005,
- FUSION_GAMING_ROTATION_VECTOR_ENABLED = (FUSION_SENSOR << 16) | 0x0006,
- FUSION_GEOMAGNETIC_ROTATION_VECTOR_ENABLED = (FUSION_SENSOR << 16) | 0x0007,
- FUSION_TILT_ENABLED = (FUSION_SENSOR << 16) | 0x0008,
- FUSION_GYROSCOPE_UNCAL_ENABLED = (FUSION_SENSOR << 16) | 0x0009,
-};
-
-#define CALIBRATION_EVENT(sensor_type) (((sensor_type) << 16) | 0x2)
-
-#define ACCELEROMETER_EVENT_ROTATION_CHECK ((ACCELEROMETER_SENSOR << 16) | 0x0100)
-
-#define ACCELEROMETER_ORIENTATION_DATA_SET (ACCELEROMETER_SENSOR << 16) | 0x0002
-#define ACCELEROMETER_LINEAR_ACCELERATION_DATA_SET (ACCELEROMETER_SENSOR << 16) | 0x0004
-#define ACCELEROMETER_GRAVITY_DATA_SET (ACCELEROMETER_SENSOR << 16) | 0x0008
-
-#define ACCELEROMETER_EVENT_GRAVITY_DATA_REPORT_ON_TIME (ACCELEROMETER_SENSOR << 16) | 0x0080
-#define ACCELEROMETER_EVENT_LINEAR_ACCELERATION_DATA_REPORT_ON_TIME (ACCELEROMETER_SENSOR << 16) | 0x0040
-#define ACCELEROMETER_EVENT_ORIENTATION_DATA_REPORT_ON_TIME (ACCELEROMETER_SENSOR << 16) | 0x0020
-#define GEOMAGNETIC_EVENT_ATTITUDE_DATA_REPORT_ON_TIME (GEOMAGNETIC_SENSOR << 16) | 0x0004
-#define ACCELEROMETER_EVENT_CALIBRATION_NEEDED 0x01
-#define ACCELEROMETER_EVENT_SET_WAKEUP 0x02
-
-#define TEMPERATURE_BASE_DATA_SET TEMPERATURE_RAW_DATA_EVENT
-#define TEMPERATURE_EVENT_RAW_DATA_REPORT_ON_TIME TEMPERATURE_RAW_DATA_EVENT
-
-#define ACCELEROMETER_BASE_DATA_SET ACCELEROMETER_RAW_DATA_EVENT
-#define ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME ACCELEROMETER_RAW_DATA_EVENT
-#define ACCELEROMETER_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME ACCELEROMETER_UNPROCESSED_DATA_EVENT
-
-#define GYRO_BASE_DATA_SET GYROSCOPE_RAW_DATA_EVENT
-#define GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME GYROSCOPE_RAW_DATA_EVENT
-#define GYROSCOPE_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME GYROSCOPE_UNPROCESSED_DATA_EVENT
-
-#define PROXIMITY_BASE_DATA_SET PROXIMITY_CHANGE_STATE_EVENT
-#define PROXIMITY_DISTANCE_BASE_DATA_SET PROXIMITY_STATE_EVENT
-#define PROXIMITY_EVENT_CHANGE_STATE PROXIMITY_CHANGE_STATE_EVENT
-#define PROXIMITY_EVENT_STATE_REPORT_ON_TIME PROXIMITY_STATE_EVENT
-#define PROXIMITY_EVENT_DISTANCE_DATA_REPORT_ON_TIME PROXIMITY_DISTANCE_DATA_EVENT
-
-#define PRESSURE_BASE_DATA_SET PRESSURE_RAW_DATA_EVENT
-#define PRESSURE_EVENT_RAW_DATA_REPORT_ON_TIME PRESSURE_RAW_DATA_EVENT
-
-#define GEOMAGNETIC_BASE_DATA_SET GEOMAGNETIC_RAW_DATA_EVENT
-#define GEOMAGNETIC_RAW_DATA_SET GEOMAGNETIC_RAW_DATA_EVENT
-#define GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME GEOMAGNETIC_RAW_DATA_EVENT
-#define GEOMAGNETIC_EVENT_CALIBRATION_NEEDED GEOMAGNETIC_CALIBRATION_NEEDED_EVENT
-#define GEOMAGNETIC_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME GEOMAGNETIC_UNPROCESSED_DATA_EVENT
-
-#define AUTO_ROTATION_BASE_DATA_SET AUTO_ROTATION_CHANGE_STATE_EVENT
-#define AUTO_ROTATION_EVENT_CHANGE_STATE AUTO_ROTATION_CHANGE_STATE_EVENT
-
-#define LIGHT_LUX_DATA_SET LIGHT_LUX_DATA_EVENT
-#define LIGHT_BASE_DATA_SET LIGHT_LEVEL_DATA_EVENT
-#define LIGHT_EVENT_LUX_DATA_REPORT_ON_TIME LIGHT_LUX_DATA_EVENT
-#define LIGHT_EVENT_LEVEL_DATA_REPORT_ON_TIME LIGHT_LEVEL_DATA_EVENT
-#define LIGHT_EVENT_CHANGE_LEVEL LIGHT_CHANGE_LEVEL_EVENT
-
-#define GRAVITY_BASE_DATA_SET GRAVITY_RAW_DATA_EVENT
-#define GRAVITY_EVENT_RAW_DATA_REPORT_ON_TIME GRAVITY_RAW_DATA_EVENT
-
-#define ORIENTATION_BASE_DATA_SET ORIENTATION_RAW_DATA_EVENT
-#define ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME ORIENTATION_RAW_DATA_EVENT
-#define ORIENTATION_EVENT_CALIBRATION_NEEDED ORIENTATION_CALIBRATION_NEEDED_EVENT
-
-#define LINEAR_ACCEL_BASE_DATA_SET LINEAR_ACCEL_RAW_DATA_EVENT
-#define LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME LINEAR_ACCEL_RAW_DATA_EVENT
-
-#define CONTEXT_BASE_DATA_SET CONTEXT_REPORT_EVENT
-#define CONTEXT_EVENT_REPORT CONTEXT_REPORT_EVENT
-
-#define FACE_DOWN_BASE_DATA_SET FACE_DOWN_RAW_DATA_EVENT
-#define FACE_DOWN_EVENT_RAW_DATA_REPORT_ON_TIME FACE_DOWN_RAW_DATA_EVENT
-
-enum accelerometer_rotate_state {
- ROTATION_UNKNOWN = 0,
- ROTATION_LANDSCAPE_LEFT = 1,
- ROTATION_PORTRAIT_TOP = 2,
- ROTATION_PORTRAIT_BTM = 3,
- ROTATION_LANDSCAPE_RIGHT = 4,
- ROTATION_EVENT_0 = 2,
- ROTATION_EVENT_90 = 1,
- ROTATION_EVENT_180 = 3,
- ROTATION_EVENT_270 = 4,
-};
-
-enum motion_snap_event {
- MOTION_ENGIEN_SNAP_NONE = 0,
- MOTION_ENGIEN_NEGATIVE_SNAP_X = 1,
- MOTION_ENGIEN_POSITIVE_SNAP_X = 2,
- MOTION_ENGIEN_NEGATIVE_SNAP_Y = 3,
- MOTION_ENGIEN_POSITIVE_SNAP_Y = 4,
- MOTION_ENGIEN_NEGATIVE_SNAP_Z = 5,
- MOTION_ENGIEN_POSITIVE_SNAP_Z = 6,
- MOTION_ENGIEN_SNAP_LEFT = MOTION_ENGIEN_NEGATIVE_SNAP_X,
- MOTION_ENGIEN_SNAP_RIGHT = MOTION_ENGIEN_POSITIVE_SNAP_X,
- MOTION_ENGINE_SNAP_NONE = 0,
- MOTION_ENGINE_NEGATIVE_SNAP_X = 1,
- MOTION_ENGINE_POSITIVE_SNAP_X = 2,
- MOTION_ENGINE_NEGATIVE_SNAP_Y = 3,
- MOTION_ENGINE_POSITIVE_SNAP_Y = 4,
- MOTION_ENGINE_NEGATIVE_SNAP_Z = 5,
- MOTION_ENGINE_POSITIVE_SNAP_Z = 6,
- MOTION_ENGINE_SNAP_LEFT = MOTION_ENGINE_NEGATIVE_SNAP_X,
- MOTION_ENGINE_SNAP_RIGHT = MOTION_ENGINE_POSITIVE_SNAP_X,
-};
-
-enum motion_shake_event {
- MOTION_ENGIEN_SHAKE_NONE = 0,
- MOTION_ENGIEN_SHAKE_DETECTION = 1,
- MOTION_ENGIEN_SHAKE_CONTINUING = 2,
- MOTION_ENGIEN_SHAKE_FINISH = 3,
- MOTION_ENGINE_SHAKE_BREAK = 4,
- MOTION_ENGINE_SHAKE_NONE = 0,
- MOTION_ENGINE_SHAKE_DETECTION = 1,
- MOTION_ENGINE_SHAKE_CONTINUING = 2,
- MOTION_ENGINE_SHAKE_FINISH = 3,
-};
-
-enum motion_doubletap_event {
- MOTION_ENGIEN_DOUBLTAP_NONE = 0,
- MOTION_ENGIEN_DOUBLTAP_DETECTION = 1,
- MOTION_ENGINE_DOUBLTAP_NONE = 0,
- MOTION_ENGINE_DOUBLTAP_DETECTION = 1,
-};
-
-enum motion_top_to_bottom_event {
- MOTION_ENGIEN_TOP_TO_BOTTOM_NONE = 0,
- MOTION_ENGIEN_TOP_TO_BOTTOM_WAIT = 1,
- MOTION_ENGIEN_TOP_TO_BOTTOM_DETECTION = 2,
- MOTION_ENGINE_TOP_TO_BOTTOM_NONE = 0,
- MOTION_ENGINE_TOP_TO_BOTTOM_WAIT = 1,
- MOTION_ENGINE_TOP_TO_BOTTOM_DETECTION = 2,
-};
-
-enum motion_direct_call_event_t {
- MOTION_ENGINE_DIRECT_CALL_NONE,
- MOTION_ENGINE_DIRECT_CALL_DETECTION,
-};
-
-enum motion_smart_relay_event_t {
- MOTION_ENGINE_SMART_RELAY_NONE,
- MOTION_ENGINE_SMART_RELAY_DETECTION,
-};
-
-enum motion_tilt_to_unlock_event_t {
- MOTION_ENGINE_TILT_TO_UNLOCK_NONE,
- MOTION_ENGINE_TILT_TO_UNLOCK_DETECTION,
-};
-
-enum motion_lock_execute_camera_event_t {
- MOTION_ENGINE_LOCK_EXECUTE_CAMERA_NONE,
- MOTION_ENGINE_LOCK_EXECUTE_CAMERA_L_DETECTION,
- MOTION_ENGINE_LOCK_EXECUTE_CAMERA_R_DETECTION,
-};
-
-enum motion_smart_alert_t {
- MOTION_ENGINE_SMART_ALERT_NONE,
- MOTION_ENGINE_SMART_ALERT_DETECTION,
-};
-
-enum motion_no_move_t {
- MOTION_ENGINE_NO_MOVE_NONE,
- MOTION_ENGINE_NO_MOVE_DETECTION,
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__SENSOR_DEPRECATED_H__
*
*/
-#include "sensor_types.h"
+#include <sensor_types.h>
DECLARE_SENSOR_ENUM_UTIL(sensor_type_t, SENSOR_TYPE)
+++ /dev/null
-/*
- * sensord
- *
- * Copyright (c) 2016 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_TYPES_H_
-#define _SENSOR_TYPES_H_
-
-#include "enum_factory.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-#define SENSOR_TYPE(DEF_SENSOR, DEF_SENSOR_VALUE) \
- DEF_SENSOR_VALUE(UNKNOWN_SENSOR, -2) \
- DEF_SENSOR_VALUE(ALL_SENSOR, -1) \
- DEF_SENSOR_VALUE(ACCELEROMETER_SENSOR, 0) \
- DEF_SENSOR(GRAVITY_SENSOR) \
- DEF_SENSOR(LINEAR_ACCEL_SENSOR) \
- DEF_SENSOR(GEOMAGNETIC_SENSOR) \
- DEF_SENSOR(ROTATION_VECTOR_SENSOR) \
- DEF_SENSOR(ORIENTATION_SENSOR) \
- DEF_SENSOR(GYROSCOPE_SENSOR) \
- DEF_SENSOR(LIGHT_SENSOR) \
- DEF_SENSOR(PROXIMITY_SENSOR) \
- DEF_SENSOR(PRESSURE_SENSOR) \
- DEF_SENSOR(ULTRAVIOLET_SENSOR) \
- DEF_SENSOR(TEMPERATURE_SENSOR) \
- DEF_SENSOR(HUMIDITY_SENSOR) \
- DEF_SENSOR(HRM_SENSOR) \
- DEF_SENSOR(HRM_LED_GREEN_SENSOR) \
- DEF_SENSOR(HRM_LED_IR_SENSOR) \
- DEF_SENSOR(HRM_LED_RED_SENSOR) \
- DEF_SENSOR(GYROSCOPE_UNCAL_SENSOR) \
- DEF_SENSOR(GEOMAGNETIC_UNCAL_SENSOR) \
- DEF_SENSOR(GYROSCOPE_RV_SENSOR) \
- DEF_SENSOR(GEOMAGNETIC_RV_SENSOR) \
- \
- DEF_SENSOR_VALUE(HUMAN_PEDOMETER_SENSOR, 0x300) \
- DEF_SENSOR(HUMAN_SLEEP_MONITOR_SENSOR) \
- DEF_SENSOR(HUMAN_SLEEP_DETECTOR_SENSOR) \
- DEF_SENSOR(HUMAN_STRESS_MONITOR_SENSOR) \
- \
- DEF_SENSOR_VALUE(EXERCISE_WALKING_SENSOR, 0x400) \
- DEF_SENSOR(EXERCISE_RUNNING_SENSOR) \
- DEF_SENSOR(EXERCISE_HIKING_SENSOR) \
- DEF_SENSOR(EXERCISE_CYCLING_SENSOR) \
- DEF_SENSOR(EXERCISE_ELLIPTICAL_SENSOR) \
- DEF_SENSOR(EXERCISE_INDOOR_CYCLING_SENSOR) \
- DEF_SENSOR(EXERCISE_ROWING_SENSOR) \
- DEF_SENSOR(EXERCISE_STEPPER_SENSOR) \
- \
- DEF_SENSOR_VALUE(EXTERNAL_EXERCISE_SENSOR, 0x800) \
- \
- DEF_SENSOR_VALUE(FUSION_SENSOR, 0x900) \
- DEF_SENSOR(AUTO_ROTATION_SENSOR) \
- DEF_SENSOR(AUTO_BRIGHTNESS_SENSOR) \
- \
- DEF_SENSOR_VALUE(GESTURE_MOVEMENT_SENSOR, 0x1200) \
- DEF_SENSOR(GESTURE_WRIST_UP_SENSOR) \
- DEF_SENSOR(GESTURE_WRIST_DOWN_SENSOR) \
- DEF_SENSOR(GESTURE_MOVEMENT_STATE_SENSOR) \
- DEF_SENSOR(GESTURE_FACE_DOWN_SENSOR) \
- \
- DEF_SENSOR_VALUE(ACTIVITY_TRACKER_SENSOR, 0x1A00) \
- DEF_SENSOR(ACTIVITY_LEVEL_MONITOR_SENSOR) \
- DEF_SENSOR(GPS_BATCH_SENSOR) \
- \
- DEF_SENSOR_VALUE(HRM_CTRL_SENSOR, 0x1A80) \
- \
- DEF_SENSOR_VALUE(WEAR_STATUS_SENSOR, 0x2000) \
- DEF_SENSOR(WEAR_ON_MONITOR_SENSOR) \
- DEF_SENSOR(NO_MOVE_DETECTOR_SENSOR) \
- DEF_SENSOR(RESTING_HR_SENSOR) \
- DEF_SENSOR(STEP_LEVEL_MONITOR_SENSOR) \
- DEF_SENSOR(EXERCISE_STANDALONE_SENSOR) \
- DEF_SENSOR(EXERCISE_HR_SENSOR) \
- DEF_SENSOR(WORKOUT_SENSOR) \
- DEF_SENSOR(CYCLE_MONITOR_SENSOR) \
- DEF_SENSOR(STAIR_TRACKER_SENSOR) \
- DEF_SENSOR(PRESSURE_INDICATOR_SENSOR) \
- DEF_SENSOR(PRESSURE_ALERT_SENSOR) \
- DEF_SENSOR(HR_CALORIE_SENSOR) \
- \
- DEF_SENSOR_VALUE(CONTEXT_SENSOR, 0x7000) \
- DEF_SENSOR(MOTION_SENSOR) \
- DEF_SENSOR(PIR_SENSOR) \
- DEF_SENSOR(PIR_LONG_SENSOR) \
- DEF_SENSOR(DUST_SENSOR) \
- DEF_SENSOR(THERMOMETER_SENSOR) \
- DEF_SENSOR(PEDOMETER_SENSOR) \
- DEF_SENSOR(FLAT_SENSOR) \
- DEF_SENSOR(HRM_RAW_SENSOR) \
- DEF_SENSOR(TILT_SENSOR) \
- DEF_SENSOR(RV_RAW_SENSOR) \
- DEF_SENSOR(GSR_SENSOR) \
- DEF_SENSOR(SIMSENSE_SENSOR) \
- DEF_SENSOR(PPG_SENSOR) \
-
-#define BIO_HRM_SENSOR HRM_SENSOR
-#define BIO_LED_GREEN_SENSOR HRM_LED_GREEN_SENSOR
-#define BIO_LED_IR_SENSOR HRM_LED_IR_SENSOR
-#define BIO_LED_RED_SENSOR HRM_LED_RED_SENSOR
-#define BIO_SENSOR HRM_RAW_SENSOR
-#define SLEEP_DETECTOR_SENSOR HUMAN_SLEEP_DETECTOR_SENSOR
-#define STRESS_MONITOR_SENSOR HUMAN_STRESS_MONITOR_SENSOR
-#define AUTOSESSION_EXERCISE_SENSOR WORKOUT_SENSOR
-#define EXERCISE_COACH_SENSOR EXERCISE_STANDALONE_SENSOR
-#define EXERCISE_SENSOR EXTERNAL_EXERCISE_SENSOR
-
-DECLARE_SENSOR_ENUM(sensor_type_t, SENSOR_TYPE)
-
-enum proxi_change_state {
- PROXIMITY_STATE_NEAR = 0,
- PROXIMITY_STATE_FAR = 1,
-};
-
-enum auto_rotation_state {
- AUTO_ROTATION_DEGREE_UNKNOWN = 0,
- AUTO_ROTATION_DEGREE_0,
- AUTO_ROTATION_DEGREE_90,
- AUTO_ROTATION_DEGREE_180,
- AUTO_ROTATION_DEGREE_270,
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#ifdef __cplusplus
-DECLARE_SENSOR_ENUM_UTIL_NS(sensor_type_t)
-#endif
-
-#include <sensor_deprecated.h>
-
-#endif /* _SENSOR_TYPES_H_ */