sensor-capi: add recorder dummy for some profiles in which don't include contextd 95/78295/3
authorkibak.yoon <kibak.yoon@samsung.com>
Tue, 5 Jul 2016 05:09:40 +0000 (14:09 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Tue, 5 Jul 2016 05:47:35 +0000 (14:47 +0900)
Change-Id: Ief31add9712f04359369ff5f340468011f15b8ac
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
CMakeLists.txt
packaging/capi-system-sensor.spec
src/sensor_recorder_dummy.cpp [new file with mode: 0644]

index 9b6a809..39c50e9 100644 (file)
@@ -2,7 +2,12 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(capi-system-sensor)
 INCLUDE(GNUInstallDirs)
 
-SET(DEPENDENTS "dlog sensor capi-base-common context-common")
+SET(DEPENDENTS "dlog sensor capi-base-common")
+
+IF("${PROFILE}" STREQUAL "mobile" OR "${PROFILE}" STREQUAL "wearable")
+       SET(DEPENDENTS ${DEPENDENTS} "context-common")
+ENDIF()
+
 SET(VERSION ${FULLVER})
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 
@@ -31,8 +36,17 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl, --rpath=${LIB_INSTALL_DIR}")
 # Internal Logging Option
 #ADD_DEFINITIONS("-DTIZEN_DEBUG")
 
-# Complile Source files
-AUX_SOURCE_DIRECTORY(src SOURCES)
+# Compile Source files
+SET(SOURCES src/geomagnetic_field.c
+            src/fusion_util.c
+            src/sensor.cpp)
+
+IF("${PROFILE}" STREQUAL "mobile" OR "${PROFILE}" STREQUAL "wearable")
+       SET(SOURCES ${SOURCES} src/sensor_recorder.cpp)
+ELSE()
+       SET(SOURCES ${SOURCES} src/sensor_recorder_dummy.cpp)
+ENDIF()
+
 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCES})
 
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${${PROJECT_NAME}_LDFLAGS})
index 55fd0c6..f58d90b 100644 (file)
@@ -6,11 +6,15 @@ Group:      System/API
 License:    Apache-2.0 and PD
 Source0:    %{name}-%{version}.tar.gz
 
+%define BUILD_PROFILE %{?profile}%{!?profile:%{?tizen_profile_name}}
+
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(sensor)
 BuildRequires:  pkgconfig(capi-base-common)
+%if "%{?BUILD_PROFILE}" == "mobile" || "%{?BUILD_PROFILE}" == "wearable"
 BuildRequires:  pkgconfig(context-common)
+%endif
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
@@ -31,7 +35,7 @@ A Sensor library in TIZEN C API package (Development).
 
 %build
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DPROFILE=%{BUILD_PROFILE}
 %__make %{?_smp_mflags}
 
 %install
diff --git a/src/sensor_recorder_dummy.cpp b/src/sensor_recorder_dummy.cpp
new file mode 100644 (file)
index 0000000..998a684
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.h>
+
+int sensor_recorder_is_supported(sensor_type_e type, bool *supported)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_start(sensor_type_e type, sensor_recorder_option_h option)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_stop(sensor_type_e type)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_create_option(sensor_recorder_option_h *option)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_destroy_option(sensor_recorder_option_h option)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_option_set_int(sensor_recorder_option_h option, sensor_recorder_option_e attribute, int value)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_create_query(sensor_recorder_query_h *query)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_destroy_query(sensor_recorder_query_h query)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_query_set_int(sensor_recorder_query_h query, sensor_recorder_query_e attribute, int value)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_query_set_time(sensor_recorder_query_h query, sensor_recorder_query_e attribute, time_t t)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_read(sensor_type_e type, sensor_recorder_query_h query, sensor_recorder_data_cb cb, void *user_data)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_read_sync(sensor_type_e type, sensor_recorder_query_h query, sensor_recorder_data_cb cb, void *user_data)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_data_get_time(sensor_recorder_data_h data, time_t *start_time, time_t *end_time)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_data_get_int(sensor_recorder_data_h data, sensor_recorder_data_e key, int *value)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_data_get_double(sensor_recorder_data_h data, sensor_recorder_data_e key, double *value)
+{
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}