sensor: enable pedometer sensor 47/104447/2
authorkibak.yoon <kibak.yoon@samsung.com>
Tue, 13 Dec 2016 09:35:45 +0000 (18:35 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Tue, 13 Dec 2016 09:40:36 +0000 (18:40 +0900)
- pedometer sensor needs healthinfo privilege

Change-Id: I9ac4e2079fd0a6e640c92b63ce13f3c3f1c81ed0
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
src/sensor/CMakeLists.txt
src/sensor/sensorhub/pedometer_sensor.cpp [new file with mode: 0644]
src/sensor/sensorhub/pedometer_sensor.h [new file with mode: 0644]
src/server/sensor_loader.cpp

index 3ec60fd6bc860188aa611f96d887514a166ab653..272b547065fe1b1eb93af14d360a0e99241c40d3 100644 (file)
@@ -10,6 +10,7 @@ SET(LINEAR_ACCEL "ON")
 SET(RV "ON")
 SET(ORIENTATION "ON")
 SET(FACE_DOWN "ON")
+SET(SENSORHUB "ON")
 
 INCLUDE_DIRECTORIES(
        ${CMAKE_SOURCE_DIR}/src/shared
@@ -63,6 +64,11 @@ IF("${FACE_DOWN}" STREQUAL "ON")
        SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/gesture)
        SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_FACE_DOWN")
 ENDIF()
+IF("${SENSORHUB}" STREQUAL "ON")
+       FILE(GLOB_RECURSE SENSOR_SRCS ${SENSOR_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/sensorhub/*.cpp)
+       SET(SENSOR_HEADERS ${SENSOR_HEADERS} ${CMAKE_CURRENT_SOURCE_DIR}/sensorhub)
+       SET(SENSOR_DEFINITIONS ${SENSOR_DEFINITIONS} "-DENABLE_SENSORHUB")
+ENDIF()
 
 MESSAGE("${SENSOR_SRCS}")
 SET(SENSOR_SRCS ${SENSOR_SRCS} PARENT_SCOPE)
diff --git a/src/sensor/sensorhub/pedometer_sensor.cpp b/src/sensor/sensorhub/pedometer_sensor.cpp
new file mode 100644 (file)
index 0000000..b9d5c23
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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_common.h>
+#include <sensor_log.h>
+#include "pedometer_sensor.h"
+
+pedometer_sensor::pedometer_sensor()
+{
+       set_permission(SENSOR_PERMISSION_BIO);
+
+       _I("pedometer_sensor is created : %#x", this);
+}
+
+pedometer_sensor::~pedometer_sensor()
+{
+       _I("pedometer_sensor is destroyed : %#x", this);
+}
diff --git a/src/sensor/sensorhub/pedometer_sensor.h b/src/sensor/sensorhub/pedometer_sensor.h
new file mode 100644 (file)
index 0000000..5ae94c2
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * 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 _PEDOMETER_SENSOR_H_
+#define _PEDOMETER_SENSOR_H_
+
+#include <physical_sensor.h>
+
+class pedometer_sensor : public physical_sensor {
+public:
+       pedometer_sensor();
+       virtual ~pedometer_sensor();
+};
+
+#endif /* _PEDOMETER_SENSOR_H_ */
+
index c25d07a488cb015cb0f808ccfd16aeb12885e9ca..614e05726a832ec918c79eec537ea7ae70886b97 100644 (file)
@@ -53,6 +53,9 @@
 #ifdef ENABLE_FACE_DOWN
 #include <face_down_sensor.h>
 #endif
+#ifdef ENABLE_SENSORHUB
+#include <pedometer_sensor.h>
+#endif
 
 using std::vector;
 using std::string;
@@ -169,6 +172,9 @@ void sensor_loader::create_sensors(void)
        create_physical_sensors<hrm_sensor>(HRM_LED_GREEN_SENSOR);
        create_physical_sensors<hrm_sensor>(HRM_LED_IR_SENSOR);
        create_physical_sensors<hrm_sensor>(HRM_LED_RED_SENSOR);
+#ifdef ENABLE_SENSORHUB
+       create_physical_sensors<pedometer_sensor>(HUMAN_PEDOMETER_SENSOR);
+#endif
 
        create_physical_sensors<physical_sensor>(UNKNOWN_SENSOR);