Adding HRM LED RED sensor plugin for Note 4 77/45077/9
authorRamasamy <ram.kannan@samsung.com>
Fri, 31 Jul 2015 08:28:15 +0000 (17:28 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Mon, 7 Sep 2015 05:03:30 +0000 (22:03 -0700)
- Adding HRM LED RED sensor plugin.
- Adding build files for new plugin.
- Adding API for new sensor.
- Adding configuration for new sensor.

Change-Id: I81231b8fdc831660f28c91ee1ba0850a19955c15

14 files changed:
packaging/sensord.spec
sensor_plugins.xml.in
sensors.xml.in
src/CMakeLists.txt
src/bio_led_red/CMakeLists.txt [new file with mode: 0644]
src/bio_led_red/bio_led_red_sensor.cpp [new file with mode: 0755]
src/bio_led_red/bio_led_red_sensor.h [new file with mode: 0755]
src/bio_led_red/bio_led_red_sensor_hal.cpp [new file with mode: 0755]
src/bio_led_red/bio_led_red_sensor_hal.h [new file with mode: 0755]
src/libsensord/CMakeLists.txt
src/libsensord/client_common.cpp
src/libsensord/sensor_bio_led_red.h [new file with mode: 0644]
src/libsensord/sensor_internal.h
src/libsensord/sensor_internal_deprecated.h

index aa45fd0..040aeb0 100755 (executable)
@@ -34,6 +34,7 @@ BuildRequires:  pkgconfig(capi-system-info)
 %define gaming_rv_state ON
 %define tilt_state ON
 %define uncal_gyro_state ON
+%define bio_led_red_state ON
 %define build_test_suite OFF
 
 %description
@@ -87,7 +88,7 @@ cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DACCEL=%{accel_state} \
        -DGEOMAGNETIC_RV=%{geomagnetic_rv_state} -DGAMING_RV=%{gaming_rv_state} \
        -DUNCAL_GYRO=%{uncal_gyro_state} -DAUTO_ROTATION=%{auto_rotation_state} \
        -DTILT=%{tilt_state} -DULTRAVIOLET=%{ultraviolet_state} \
-       -DTEST_SUITE=%{build_test_suite} \
+       -DBIO_LED_RED=%{bio_led_red_state} -DTEST_SUITE=%{build_test_suite} \
        -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir}
 
 %build
index ba602e6..88eb161 100755 (executable)
@@ -8,6 +8,7 @@
                <MODULE path = "/usr/lib/sensord/libpressure_sensor_hal.so"/>
                <MODULE path = "/usr/lib/sensord/libtemperature_sensor_hal.so"/>
                <MODULE path = "/usr/lib/sensord/libultraviolet_sensor_hal.so"/>
+               <MODULE path = "/usr/lib/sensord/libbio_led_red_sensor_hal.so"/>
        </HAL>
 
        <SENSOR>
@@ -29,5 +30,6 @@
                <MODULE path = "/usr/lib/sensord/libtilt_sensor.so"/>
                <MODULE path = "/usr/lib/sensord/libuncal_gyro_sensor.so"/>
                <MODULE path = "/usr/lib/sensord/libultraviolet_sensor.so"/>
+               <MODULE path = "/usr/lib/sensord/libbio_led_red_sensor.so"/>
        </SENSOR>
 </PLUGIN>
index 58f7fb4..34894f3 100755 (executable)
                        <MAX_RANGE value="15"/>
                </MODEL>
        </ULTRAVIOLET>
+
+       <BIO_LED_RED>
+               <MODEL id="MAX86902">
+                       <NAME value="MAX86902" />
+                       <VENDOR value="MAXIM"/>
+               </MODEL>
+       </BIO_LED_RED>
 </SENSOR>
index 39dc767..91a8b40 100755 (executable)
@@ -34,6 +34,9 @@ ENDIF()
 IF("${ULTRAVIOLET}" STREQUAL "ON")
 add_subdirectory(ultraviolet)
 ENDIF()
+IF("${BIO_LED_RED}" STREQUAL "ON")
+add_subdirectory(bio_led_red)
+ENDIF()
 IF("${ORIENTATION}" STREQUAL "ON")
 set(SENSOR_FUSION_ENABLE "1")
 set(ORIENTATION_ENABLE "1")
diff --git a/src/bio_led_red/CMakeLists.txt b/src/bio_led_red/CMakeLists.txt
new file mode 100644 (file)
index 0000000..04c58e8
--- /dev/null
@@ -0,0 +1,30 @@
+cmake_minimum_required(VERSION 2.6)
+project(bio_led_red CXX)
+
+SET(SENSOR_NAME bio_led_red_sensor)
+SET(SENSOR_HAL_NAME bio_led_red_sensor_hal)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(${CMAKE_SOURCE_DIR}/src/libsensord)
+
+FOREACH(flag ${bio_led_red_pkgs_LDFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+FOREACH(flag ${bio_led_red_pkgs_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+add_library(${SENSOR_NAME} SHARED
+               bio_led_red_sensor.cpp
+               )
+
+add_library(${SENSOR_HAL_NAME} SHARED
+               bio_led_red_sensor_hal.cpp
+               )
+
+target_link_libraries(${SENSOR_NAME} ${bio_led_red_pkgs_LDFLAGS} "-lm")
+target_link_libraries(${SENSOR_HAL_NAME} ${bio_led_red_pkgs_LDFLAGS})
+
+install(TARGETS ${SENSOR_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}/sensord)
+install(TARGETS ${SENSOR_HAL_NAME} DESTINATION ${CMAKE_INSTALL_LIBDIR}/sensord)
diff --git a/src/bio_led_red/bio_led_red_sensor.cpp b/src/bio_led_red/bio_led_red_sensor.cpp
new file mode 100755 (executable)
index 0000000..17d228f
--- /dev/null
@@ -0,0 +1,160 @@
+/*
+ * 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.
+ *
+ */
+
+#include <common.h>
+#include <sf_common.h>
+
+#include <bio_led_red_sensor.h>
+#include <sensor_plugin_loader.h>
+#include <algorithm>
+
+using std::bind1st;
+using std::mem_fun;
+
+#define SENSOR_NAME "BIO_LED_RED_SENSOR"
+
+bio_led_red_sensor::bio_led_red_sensor()
+: m_sensor_hal(NULL)
+{
+       m_name = string(SENSOR_NAME);
+
+       register_supported_event(BIO_LED_RED_RAW_DATA_EVENT);
+
+       physical_sensor::set_poller(bio_led_red_sensor::working, this);
+}
+
+bio_led_red_sensor::~bio_led_red_sensor()
+{
+       INFO("bio_led_red_sensor is destroyed!");
+}
+
+bool bio_led_red_sensor::init()
+{
+       m_sensor_hal = sensor_plugin_loader::get_instance().get_sensor_hal(BIO_LED_RED_SENSOR);
+
+       if (!m_sensor_hal) {
+               ERR("cannot load sensor_hal[%s]", sensor_base::get_name());
+               return false;
+       }
+
+       INFO("%s is created!", sensor_base::get_name());
+
+       return true;
+}
+
+sensor_type_t bio_led_red_sensor::get_type(void)
+{
+       return BIO_LED_RED_SENSOR;
+}
+
+bool bio_led_red_sensor::working(void *inst)
+{
+       bio_led_red_sensor *sensor = (bio_led_red_sensor*)inst;
+       return sensor->process_event();
+}
+
+bool bio_led_red_sensor::process_event(void)
+{
+       sensor_event_t event;
+
+       if (!m_sensor_hal->is_data_ready(true))
+               return true;
+
+       m_sensor_hal->get_sensor_data(event.data);
+
+       AUTOLOCK(m_client_info_mutex);
+
+       if (get_client_cnt(BIO_LED_RED_RAW_DATA_EVENT)) {
+               event.sensor_id = get_id();
+               event.event_type = BIO_LED_RED_RAW_DATA_EVENT;
+               raw_to_base(event.data);
+               push(event);
+       }
+
+       return true;
+}
+
+bool bio_led_red_sensor::on_start(void)
+{
+       if (!m_sensor_hal->enable()) {
+               ERR("m_sensor_hal start fail\n");
+               return false;
+       }
+
+       return start_poll();
+}
+
+bool bio_led_red_sensor::on_stop(void)
+{
+       if (!m_sensor_hal->disable()) {
+               ERR("m_sensor_hal stop fail\n");
+               return false;
+       }
+
+       return stop_poll();
+}
+
+bool bio_led_red_sensor::get_properties(sensor_properties_s &properties)
+{
+       return m_sensor_hal->get_properties(properties);
+}
+
+int bio_led_red_sensor::get_sensor_data(unsigned int type, sensor_data_t &data)
+{
+       int ret;
+
+       ret = m_sensor_hal->get_sensor_data(data);
+
+       if (ret < 0)
+               return -1;
+
+       return -1;
+}
+
+bool bio_led_red_sensor::set_interval(unsigned long interval)
+{
+       AUTOLOCK(m_mutex);
+
+       INFO("Polling interval is set to %dms", interval);
+
+       return m_sensor_hal->set_interval(interval);
+}
+
+void bio_led_red_sensor::raw_to_base(sensor_data_t &data)
+{
+
+}
+
+extern "C" sensor_module* create(void)
+{
+       bio_led_red_sensor *sensor;
+
+       try {
+               sensor = new(std::nothrow) bio_led_red_sensor;
+       } catch (int err) {
+               ERR("Failed to create module, err: %d, cause: %s", err, strerror(err));
+               return NULL;
+       }
+
+       sensor_module *module = new(std::nothrow) sensor_module;
+       retvm_if(!module || !sensor, NULL, "Failed to allocate memory");
+
+       module->sensors.push_back(sensor);
+       return module;
+}
diff --git a/src/bio_led_red/bio_led_red_sensor.h b/src/bio_led_red/bio_led_red_sensor.h
new file mode 100755 (executable)
index 0000000..f14b4af
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * 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 _HRM_RED_SENSOR_H_
+#define _HRM_RED_SENSOR_H_
+
+#include <sensor_common.h>
+
+#include <physical_sensor.h>
+#include <sensor_hal.h>
+
+class bio_led_red_sensor : public physical_sensor {
+public:
+       bio_led_red_sensor();
+       virtual ~bio_led_red_sensor();
+
+       bool init();
+       virtual sensor_type_t get_type(void);
+
+       static bool working(void *inst);
+       virtual bool set_interval(unsigned long interval);
+       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;
+
+       virtual bool on_start(void);
+       virtual bool on_stop(void);
+       bool process_event(void);
+       void raw_to_base(sensor_data_t &data);
+};
+
+#endif
+
diff --git a/src/bio_led_red/bio_led_red_sensor_hal.cpp b/src/bio_led_red/bio_led_red_sensor_hal.cpp
new file mode 100755 (executable)
index 0000000..38ee2bb
--- /dev/null
@@ -0,0 +1,264 @@
+/*
+ * bio_led_red_sensor_hal
+ *
+ * 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.
+ *
+ */
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <linux/input.h>
+#include <csensor_config.h>
+#include <bio_led_red_sensor_hal.h>
+#include <sys/ioctl.h>
+#include <fstream>
+
+using std::ifstream;
+
+#define SENSOR_TYPE_BIO_LED_RED        "BIO_LED_RED"
+#define ELEMENT_NAME                   "NAME"
+#define ELEMENT_VENDOR                 "VENDOR"
+#define ATTR_VALUE                             "value"
+#define PATH_LED_RED_ENABLE            "/sys/class/sensors/hrm_sensor/led_current1";
+#define LED_RED_ENABLE_VALUE   255
+
+#define BIAS   1
+
+bio_led_red_sensor_hal::bio_led_red_sensor_hal()
+: m_polling_interval(POLL_1HZ_MS)
+, m_bio_led_red(0)
+, m_fired_time(0)
+, m_node_handle(-1)
+{
+       const string sensorhub_interval_node_name = "hrm_poll_delay";
+       csensor_config &config = csensor_config::get_instance();
+
+       node_info_query query;
+       node_info info;
+
+       if (!find_model_id(SENSOR_TYPE_BIO_LED_RED, m_model_id)) {
+               ERR("Failed to find model id");
+               throw ENXIO;
+
+       }
+
+       query.sensorhub_controlled = m_sensorhub_controlled = is_sensorhub_controlled(sensorhub_interval_node_name);
+       query.sensor_type = SENSOR_TYPE_BIO_LED_RED;
+       query.key = "hrm_sensor";
+       query.iio_enable_node_name = "hrm_raw_enable";
+       query.sensorhub_interval_node_name = sensorhub_interval_node_name;
+
+       if (!get_node_info(query, info)) {
+               ERR("Failed to get node info");
+               throw ENXIO;
+       }
+
+       show_node_info(info);
+
+       m_data_node = info.data_node_path;
+       m_enable_node = info.enable_node_path;
+       m_interval_node = info.interval_node_path;
+
+       if (!config.get(SENSOR_TYPE_BIO_LED_RED, m_model_id, ELEMENT_VENDOR, m_vendor)) {
+               ERR("[VENDOR] is empty\n");
+               throw ENXIO;
+       }
+
+       INFO("m_vendor = %s", m_vendor.c_str());
+
+       if (!config.get(SENSOR_TYPE_BIO_LED_RED, m_model_id, ELEMENT_NAME, m_chip_name)) {
+               ERR("[NAME] is empty\n");
+               throw ENXIO;
+       }
+
+       INFO("m_chip_name = %s\n",m_chip_name.c_str());
+
+       if ((m_node_handle = open(m_data_node.c_str(),O_RDWR)) < 0) {
+               ERR("Failed to open handle(%d)", m_node_handle);
+               throw ENXIO;
+       }
+
+       int clockId = CLOCK_MONOTONIC;
+       if (ioctl(m_node_handle, EVIOCSCLOCKID, &clockId) != 0)
+               ERR("Fail to set monotonic timestamp for %s", m_data_node.c_str());
+
+       INFO("bio_led_red_sensor_hal is created!\n");
+
+}
+
+bio_led_red_sensor_hal::~bio_led_red_sensor_hal()
+{
+       close(m_node_handle);
+       m_node_handle = -1;
+
+       INFO("bio_led_red_sensor_hal is destroyed!\n");
+}
+
+string bio_led_red_sensor_hal::get_model_id(void)
+{
+       return m_model_id;
+}
+
+
+sensor_type_t bio_led_red_sensor_hal::get_type(void)
+{
+       return BIO_LED_RED_SENSOR;
+}
+
+bool bio_led_red_sensor_hal::enable(void)
+{
+       AUTOLOCK(m_mutex);
+       const string led_red_enable_path = PATH_LED_RED_ENABLE;
+
+       set_enable_node(m_enable_node, m_sensorhub_controlled, true, SENSORHUB_BIO_HRM_RAW_ENABLE_BIT);
+
+       if (!set_node_value(led_red_enable_path, LED_RED_ENABLE_VALUE)) {
+               ERR("Failed to set led red enable node: %s", led_red_enable_path.c_str());
+               return false;
+       }
+
+       set_interval(m_polling_interval);
+
+       m_fired_time = 0;
+       INFO("bio_led_red sensor starting");
+       return true;
+}
+
+bool bio_led_red_sensor_hal::disable(void)
+{
+       AUTOLOCK(m_mutex);
+
+       set_enable_node(m_enable_node, m_sensorhub_controlled, false, SENSORHUB_BIO_HRM_RAW_ENABLE_BIT);
+
+       INFO("bio_led_red sensor real stopping");
+       return true;
+}
+
+bool bio_led_red_sensor_hal::set_interval(unsigned long val)
+{
+       unsigned long long polling_interval_ns;
+
+       AUTOLOCK(m_mutex);
+
+       polling_interval_ns = ((unsigned long long)(val) * 1000llu * 1000llu);
+
+       if (!set_node_value(m_interval_node, polling_interval_ns)) {
+               ERR("Failed to set polling resource: %s\n", m_interval_node.c_str());
+               return false;
+       }
+
+       INFO("Interval is changed from %dms to %dms]", m_polling_interval, val);
+       m_polling_interval = val;
+       return true;
+
+}
+
+
+bool bio_led_red_sensor_hal::update_value(bool wait)
+{
+       int bio_led_red_raw = -1;
+       bool bio_led_red = false;
+       int read_input_cnt = 0;
+       const int INPUT_MAX_BEFORE_SYN = 10;
+       unsigned long long fired_time = 0;
+       bool syn = false;
+
+       struct input_event bio_led_red_event;
+       DBG("bio_led_red event detection!");
+
+       while ((syn == false) && (read_input_cnt < INPUT_MAX_BEFORE_SYN)) {
+               int len = read(m_node_handle, &bio_led_red_event, sizeof(bio_led_red_event));
+               if (len != sizeof(bio_led_red_event)) {
+                       ERR("bio_led_red file read fail, read_len = %d\n",len);
+                       return false;
+               }
+
+               ++read_input_cnt;
+
+               if (bio_led_red_event.type == EV_REL && bio_led_red_event.code == REL_X) {
+                       bio_led_red_raw = (int)bio_led_red_event.value;
+                       bio_led_red = true;
+               } else if (bio_led_red_event.type == EV_REL) {
+                       ERR("bio_led_red event[type = %d, code = %d] is skipped.", bio_led_red_event.type, bio_led_red_event.code);
+               } else if (bio_led_red_event.type == EV_SYN) {
+                       syn = true;
+                       fired_time = sensor_hal::get_timestamp(&bio_led_red_event.time);
+               } else {
+                       ERR("bio_led_red event[type = %d, code = %d] is unknown.", bio_led_red_event.type, bio_led_red_event.code);
+                       return false;
+               }
+       }
+
+       AUTOLOCK(m_value_mutex);
+
+       if (bio_led_red)
+               m_bio_led_red = bio_led_red_raw - BIAS;
+
+       m_fired_time = fired_time;
+
+       DBG("m_bio_led_red = %d, time = %lluus", m_bio_led_red, m_fired_time);
+
+       return true;
+}
+
+bool bio_led_red_sensor_hal::is_data_ready(bool wait)
+{
+       bool ret;
+       ret = update_value(wait);
+       return ret;
+}
+
+int bio_led_red_sensor_hal::get_sensor_data(sensor_data_t &data)
+{
+       AUTOLOCK(m_value_mutex);
+       data.accuracy = SENSOR_ACCURACY_GOOD;
+       data.timestamp = m_fired_time;
+       data.value_count = 1;
+       data.values[0] = (float) m_bio_led_red;
+
+       return 0;
+}
+
+bool bio_led_red_sensor_hal::get_properties(sensor_properties_s &properties)
+{
+       properties.name = m_chip_name;
+       properties.vendor = m_vendor;
+       properties.min_range = 0.0f;
+       properties.max_range = 1.0f;
+       properties.min_interval = 1;
+       properties.resolution = 1.0f;
+       properties.fifo_count = 0;
+       properties.max_batch_count = 0;
+
+       return true;
+}
+
+extern "C" sensor_module* create(void)
+{
+       bio_led_red_sensor_hal *sensor;
+
+       try {
+               sensor = new(std::nothrow) bio_led_red_sensor_hal;
+       } catch (int err) {
+               ERR("Failed to create module, err: %d, cause: %s", err, strerror(err));
+               return NULL;
+       }
+
+       sensor_module *module = new(std::nothrow) sensor_module;
+       retvm_if(!module || !sensor, NULL, "Failed to allocate memory");
+
+       module->sensors.push_back(sensor);
+       return module;
+}
diff --git a/src/bio_led_red/bio_led_red_sensor_hal.h b/src/bio_led_red/bio_led_red_sensor_hal.h
new file mode 100755 (executable)
index 0000000..d94c470
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * hrm_red_sensor_hal
+ *
+ * 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 _BIO_LED_RED_SENSOR_HAL_H_
+#define _BIO_LED_RED_SENSOR_HAL_H_
+
+#include <sensor_hal.h>
+#include <string>
+
+using std::string;
+
+class bio_led_red_sensor_hal : public sensor_hal
+{
+public:
+       bio_led_red_sensor_hal();
+       virtual ~bio_led_red_sensor_hal();
+       string get_model_id(void);
+       sensor_type_t get_type(void);
+       bool enable(void);
+       bool disable(void);
+       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_s &properties);
+
+private:
+       string m_model_id;
+       string m_vendor;
+       string m_chip_name;
+
+       unsigned long m_polling_interval;
+
+       int m_bio_led_red;
+
+       unsigned long long m_fired_time;
+       int m_node_handle;
+
+       string m_enable_node;
+       string m_data_node;
+       string m_interval_node;
+
+       bool m_sensorhub_controlled;
+
+       cmutex m_value_mutex;
+
+       bool update_value(bool wait);
+};
+#endif /*_BIO_LED_RED_SENSOR_HAL_CLASS_H_*/
+
index db78c9a..00e3a1b 100755 (executable)
@@ -62,6 +62,7 @@ install(FILES sensor_temperature.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/senso
 install(FILES sensor_motion.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
 install(FILES sensor_fusion.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
 install(FILES sensor_ultraviolet.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
+install(FILES sensor_bio_led_red.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
 install(FILES sensor_deprecated.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
 install(FILES sensor_uncal_gyro.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
 install(FILES ${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
index 5783414..40f99b1 100755 (executable)
@@ -47,6 +47,7 @@ log_element g_log_elements[] = {
        FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, TILT_SENSOR, 0, 1),
        FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, UNCAL_GYROSCOPE_SENSOR, 0, 1),
        FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, ULTRAVIOLET_SENSOR, 0, 1),
+       FILL_LOG_ELEMENT(LOG_ID_SENSOR_TYPE, BIO_LED_RED_SENSOR, 0, 1),
 
        FILL_LOG_ELEMENT(LOG_ID_EVENT, GEOMAGNETIC_CALIBRATION_NEEDED_EVENT, 0, 1),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, PROXIMITY_CHANGE_STATE_EVENT, 0,1),
@@ -73,6 +74,7 @@ log_element g_log_elements[] = {
        FILL_LOG_ELEMENT(LOG_ID_EVENT, TILT_RAW_DATA_EVENT, 0, 10),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, UNCAL_GYRO_RAW_DATA_EVENT, 0, 10),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, ULTRAVIOLET_RAW_DATA_EVENT, 0, 10),
+       FILL_LOG_ELEMENT(LOG_ID_EVENT, BIO_LED_RED_RAW_DATA_EVENT, 0, 10),
 };
 
 typedef unordered_map<unsigned int, log_attr* > log_map;
diff --git a/src/libsensord/sensor_bio_led_red.h b/src/libsensord/sensor_bio_led_red.h
new file mode 100644 (file)
index 0000000..4720f2c
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * libsensord
+ *
+ * Copyright (c) 2015 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_BIO_LED_RED_H__
+#define __SENSOR_BIO_LED_RED_H__
+
+//! Pre-defined events for the bio led red sensor
+//! Sensor Plugin developer can add more event to their own headers
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * @defgroup SENSOR_BIO_LED_RED HRM LED RED Sensor
+ * @ingroup SENSOR_FRAMEWORK
+ *
+ * These APIs are used to control the HRM LED RED sensor.
+ * @{
+ */
+
+enum bio_led_green_event_type {
+       BIO_LED_RED_RAW_DATA_EVENT      = (BIO_LED_RED_SENSOR << 16) | 0x0001,
+};
+
+/**
+ * @}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+//! End of a file
index 7711d01..49c74dc 100755 (executable)
@@ -58,6 +58,7 @@ extern "C"
 #include <sensor_tilt.h>
 #include <sensor_uncal_gyro.h>
 #include <sensor_ultraviolet.h>
+#include <sensor_bio_led_red.h>
 
 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);
index 35f60e7..b42c045 100755 (executable)
@@ -58,6 +58,7 @@ extern "C"
 #include <sensor_tilt.h>
 #include <sensor_ultraviolet.h>
 #include <sensor_uncal_gyro.h>
+#include <sensor_bio_led_red.h>
 
 #define MAX_KEY_LEN 30