return false;
}
- sensor_properties_t properties;
+ sensor_properties_s properties;
if (m_sensor_hal->get_properties(properties) == false) {
ERR("sensor->get_properties() is failed!\n");
return stop_poll();
}
-bool accel_sensor::get_properties(sensor_properties_t &properties)
+bool accel_sensor::get_properties(sensor_properties_s &properties)
{
return m_sensor_hal->get_properties(properties);
}
static bool working(void *inst);
virtual bool set_interval(unsigned long interval);
- virtual bool get_properties(sensor_properties_t &properties);
+ virtual bool get_properties(sensor_properties_s &properties);
virtual int get_sensor_data(unsigned int type, sensor_data_t &data);
private:
sensor_hal *m_sensor_hal;
return 0;
}
-bool accel_sensor_hal::get_properties(sensor_properties_t &properties)
+bool accel_sensor_hal::get_properties(sensor_properties_s &properties)
{
properties.name = m_chip_name;
properties.vendor = m_vendor;
bool set_interval(unsigned long val);
bool is_data_ready(bool wait);
virtual int get_sensor_data(sensor_data_t &data);
- bool get_properties(sensor_properties_t &properties);
+ bool get_properties(sensor_properties_s &properties);
// bool check_hw_node(void);
private:
return false;
}
- sensor_properties_t properties;
+ sensor_properties_s properties;
if (m_sensor_hal->get_properties(properties) == false) {
ERR("sensor->get_properties() is failed!\n");
return stop_poll();
}
-bool geo_sensor::get_properties(sensor_properties_t &properties)
+bool geo_sensor::get_properties(sensor_properties_s &properties)
{
return m_sensor_hal->get_properties(properties);
}
static bool working(void *inst);
virtual bool set_interval(unsigned long interval);
- virtual bool get_properties(sensor_properties_t &properties);
+ virtual bool get_properties(sensor_properties_s &properties);
int get_sensor_data(unsigned int type, sensor_data_t &data);
private:
sensor_hal *m_sensor_hal;
return 0;
}
-bool geo_sensor_hal::get_properties(sensor_properties_t &properties)
+bool geo_sensor_hal::get_properties(sensor_properties_s &properties)
{
properties.name = m_chip_name;
properties.vendor = m_vendor;
bool set_interval(unsigned long val);
bool is_data_ready(bool wait);
virtual int get_sensor_data(sensor_data_t &data);
- bool get_properties(sensor_properties_t &properties);
+ bool get_properties(sensor_properties_s &properties);
private:
string m_model_id;
string m_vendor;
return 0;
}
-bool gravity_sensor::get_properties(sensor_properties_t &properties)
+bool gravity_sensor::get_properties(sensor_properties_s &properties)
{
properties.min_range = -GRAVITY;
properties.max_range = GRAVITY;
bool delete_interval(int client_id);
int get_sensor_data(const unsigned int event_type, sensor_data_t &data);
- bool get_properties(sensor_properties_t &properties);
+ bool get_properties(sensor_properties_s &properties);
private:
sensor_base *m_orientation_sensor;
cmutex m_value_mutex;
return false;
}
- sensor_properties_t properties;
+ sensor_properties_s properties;
if (m_sensor_hal->get_properties(properties) == false) {
ERR("sensor->get_properties() is failed!\n");
return stop_poll();
}
-bool gyro_sensor::get_properties(sensor_properties_t &properties)
+bool gyro_sensor::get_properties(sensor_properties_s &properties)
{
return m_sensor_hal->get_properties(properties);
}
static bool working(void *inst);
virtual bool set_interval(unsigned long interval);
- virtual bool get_properties(sensor_properties_t &properties);
+ virtual bool get_properties(sensor_properties_s &properties);
int get_sensor_data(unsigned int type, sensor_data_t &data);
private:
sensor_hal *m_sensor_hal;
return 0;
}
-bool gyro_sensor_hal::get_properties(sensor_properties_t &properties)
+bool gyro_sensor_hal::get_properties(sensor_properties_s &properties)
{
properties.name = m_chip_name;
properties.vendor = m_vendor;
bool set_interval(unsigned long ms_interval);
bool is_data_ready(bool wait);
virtual int get_sensor_data(sensor_data_t &data);
- virtual bool get_properties(sensor_properties_t &properties);
+ virtual bool get_properties(sensor_properties_s &properties);
private:
int m_x;
install(FILES sensor_rv.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
install(FILES sensor_temperature.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
install(FILES sensor_motion.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
+install(FILES sensor_deprecated.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
install(FILES ${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
return 0;
}
+int sf_is_sensor_event_available(sensor_type_t sensor_type, unsigned int event_type)
+{
+ return 0;
+}
+
+int sf_get_data_properties(unsigned int data_id, sensor_data_properties_t *return_data_properties)
+{
+ return 0;
+}
+
+int sf_get_properties(sensor_type_t sensor_type, sensor_properties_t *return_properties)
+{
+ return 0;
+}
+
static bool get_sensor_list(void)
{
static cmutex l;
--- /dev/null
+/*
+ * libsensord
+ *
+ * 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_DEPRECATED_H__
+#define __SENSOR_DEPRECATED_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#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
+
+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,
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__SENSOR_DEPRECATED_H__
+
#include <sensor_temperature.h>
#include <sensor_rv.h>
#include <sensor_motion.h>
+#include <sensor_deprecated.h>
+
+#define MAX_KEY_LEN 30
typedef struct {
condition_op_t cond_op;
int z;
} sensor_panning_data_t;
-#define ACCELEROMETER_EVENT_ROTATION_CHECK ((ACCELEROMETER_SENSOR << 16) | 0x0001)
-
-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,
-};
+typedef struct {
+ int sensor_unit_idx;
+ float sensor_min_range;
+ float sensor_max_range;
+ float sensor_resolution;
+ char sensor_name[MAX_KEY_LEN];
+ char sensor_vendor[MAX_KEY_LEN];
+} sensor_properties_t;
+
+typedef struct {
+ int sensor_unit_idx;
+ float sensor_min_range;
+ float sensor_max_range;
+ float sensor_resolution;
+} sensor_data_properties_t;
+
+int sf_is_sensor_event_available(sensor_type_t sensor_type , unsigned int event_type);
+
+int sf_get_data_properties(unsigned int data_id, sensor_data_properties_t *return_data_properties);
+
+int sf_get_properties(sensor_type_t sensor_type, sensor_properties_t *return_properties);
int sf_check_rotation(unsigned long *rotation);
{
#endif
-#define MOTION_SENSOR 0xFF
-
enum motion_event_type {
MOTION_ENGINE_EVENT_SNAP = (MOTION_SENSOR << 16) | 0x0001,
MOTION_ENGINE_EVENT_SHAKE = (MOTION_SENSOR << 16) | 0x0002,
return stop_poll();
}
-bool light_sensor::get_properties(const unsigned int type, sensor_properties_t &properties)
+bool light_sensor::get_properties(const unsigned int type, sensor_properties_s &properties)
{
m_sensor_hal->get_properties(properties);
virtual bool on_stop(void);
virtual bool set_interval(unsigned long interval);
- virtual bool get_properties(const unsigned int type, sensor_properties_t &properties);
+ virtual bool get_properties(const unsigned int type, sensor_properties_s &properties);
int get_sensor_data(const unsigned int type, sensor_data_t &data);
private:
}
-bool light_sensor_hal::get_properties(sensor_properties_t &properties)
+bool light_sensor_hal::get_properties(sensor_properties_s &properties)
{
properties.name = m_chip_name;
properties.vendor = m_vendor;
bool set_interval(unsigned long val);
bool is_data_ready(bool wait);
virtual int get_sensor_data(sensor_data_t &data);
- bool get_properties(sensor_properties_t &properties);
+ bool get_properties(sensor_properties_s &properties);
private:
string m_model_id;
string m_vendor;
return 0;
}
-bool linear_accel_sensor::get_properties(sensor_properties_t &properties)
+bool linear_accel_sensor::get_properties(sensor_properties_s &properties)
{
m_accel_sensor->get_properties(properties);
properties.name = "Linear Acceleration Sensor";
bool delete_interval(int client_id);
int get_sensor_data(const unsigned int event_type, sensor_data_t &data);
- bool get_properties(sensor_properties_t &properties);
+ bool get_properties(sensor_properties_s &properties);
private:
sensor_base *m_accel_sensor;
sensor_base *m_gravity_sensor;
return 0;
}
-bool orientation_sensor::get_properties(sensor_properties_t &properties)
+bool orientation_sensor::get_properties(sensor_properties_s &properties)
{
if(m_raw_data_unit == "DEGREES") {
properties.min_range = -180;
bool add_interval(int client_id, unsigned int interval);
bool delete_interval(int client_id);
- bool get_properties(sensor_properties_t &properties);
+ bool get_properties(sensor_properties_s &properties);
sensor_type_t get_type(void);
int get_sensor_data(const unsigned int data_id, sensor_data_t &data);
return false;
}
- sensor_properties_t properties;
+ sensor_properties_s properties;
if (!m_sensor_hal->get_properties(properties)) {
ERR("sensor->get_properties() is failed!\n");
return stop_poll();
}
-bool pressure_sensor::get_properties(sensor_properties_t &properties)
+bool pressure_sensor::get_properties(sensor_properties_s &properties)
{
return m_sensor_hal->get_properties(properties);
}
static bool working(void *inst);
bool set_interval(unsigned long interval);
- virtual bool get_properties(sensor_properties_t &properties);
+ virtual bool get_properties(sensor_properties_s &properties);
int get_sensor_data(unsigned int type, sensor_data_t &data);
private:
}
-bool pressure_sensor_hal::get_properties(sensor_properties_t &properties)
+bool pressure_sensor_hal::get_properties(sensor_properties_s &properties)
{
properties.name = m_chip_name;
properties.vendor = m_vendor;
bool set_interval(unsigned long val);
bool is_data_ready(bool wait);
virtual int get_sensor_data(sensor_data_t &data);
- virtual bool get_properties(sensor_properties_t &properties);
+ virtual bool get_properties(sensor_properties_s &properties);
private:
string m_model_id;
return stop_poll();
}
-bool proxi_sensor::get_properties(sensor_properties_t &properties)
+bool proxi_sensor::get_properties(sensor_properties_s &properties)
{
m_sensor_hal->get_properties(properties);
static bool working(void *inst);
- virtual bool get_properties(sensor_properties_t &properties);
+ virtual bool get_properties(sensor_properties_s &properties);
int get_sensor_data(unsigned int type, sensor_data_t &data);
private:
sensor_hal *m_sensor_hal;
return 0;
}
-bool proxi_sensor_hal::get_properties(sensor_properties_t &properties)
+bool proxi_sensor_hal::get_properties(sensor_properties_s &properties)
{
properties.name = m_chip_name;
properties.vendor = m_vendor;
bool disable(void);
bool is_data_ready(bool wait);
virtual int get_sensor_data(sensor_data_t &data);
- virtual bool get_properties(sensor_properties_t &properties);
+ virtual bool get_properties(sensor_properties_s &properties);
private:
string m_model_id;
string m_vendor;
return 0;
}
-bool rv_sensor::get_properties(sensor_properties_t &properties)
+bool rv_sensor::get_properties(sensor_properties_s &properties)
{
properties.vendor = m_vendor;
properties.name = SENSOR_NAME;
bool add_interval(int client_id, unsigned int interval);
bool delete_interval(int client_id);
- bool get_properties(sensor_properties_t &properties);
+ bool get_properties(sensor_properties_s &properties);
sensor_type_t get_type(void);
int get_sensor_data(const unsigned int data_id, sensor_data_t &data);
void sensor_base::get_sensor_info(sensor_info &info)
{
- sensor_properties_t properties;
+ sensor_properties_s properties;
get_properties(properties);
info.set_type(get_type());
return;
}
-bool sensor_base::get_properties(sensor_properties_t &properties)
+bool sensor_base::get_properties(sensor_properties_s &properties)
{
return true;
}
void get_sensor_info(sensor_info &info);
- virtual bool get_properties(sensor_properties_t &properties);
+ virtual bool get_properties(sensor_properties_s &properties);
bool is_supported(unsigned int event_type);
virtual long set_command(unsigned int cmd, long value);
LINEAR_ACCEL_SENSOR,
ORIENTATION_SENSOR,
TEMPERATURE_SENSOR,
- ROTATION_VECTOR_SENSOR
+ ROTATION_VECTOR_SENSOR,
+ MOTION_SENSOR
} sensor_type_t;
typedef unsigned int sensor_id_t;
int data_accuracy; //deprecated
};
- unsigned long long timestamp;
+ union {
+ unsigned long long timestamp;
+ unsigned long long time_stamp; //deprecated
+ };
/*
* Use "value_count" instead of "values_num"
virtual bool disable(void) = 0;
virtual bool set_interval(unsigned long val);
virtual bool is_data_ready(bool wait) = 0;
- virtual bool get_properties(sensor_properties_t &properties) = 0;
+ virtual bool get_properties(sensor_properties_s &properties) = 0;
virtual int get_sensor_data(sensor_data_t &data);
virtual int get_sensor_data(sensorhub_data_t &data);
virtual long set_command(unsigned int cmd, long val);
int min_interval;
int fifo_count;
int max_batch_count;
-} sensor_properties_t;
+} sensor_properties_s;
/*
return false;
}
- sensor_properties_t properties;
+ sensor_properties_s properties;
if (!m_sensor_hal->get_properties(properties))
{
return stop_poll();
}
-bool temperature_sensor::get_properties(sensor_properties_t &properties)
+bool temperature_sensor::get_properties(sensor_properties_s &properties)
{
return m_sensor_hal->get_properties(properties);
}
static bool working(void *inst);
bool set_interval(unsigned long interval);
- virtual bool get_properties(sensor_properties_t &properties);
+ virtual bool get_properties(sensor_properties_s &properties);
int get_sensor_data(unsigned int type, sensor_data_t &data);
private:
}
-bool temperature_sensor_hal::get_properties(sensor_properties_t &properties)
+bool temperature_sensor_hal::get_properties(sensor_properties_s &properties)
{
properties.name = m_chip_name;
properties.vendor = m_vendor;
bool set_interval(unsigned long val);
bool is_data_ready(bool wait);
virtual int get_sensor_data(sensor_data_t &data);
- bool get_properties(sensor_properties_t &properties);
+ bool get_properties(sensor_properties_s &properties);
private:
float m_temperature;
int m_node_handle;