Re-enable dummy sensor recorder API build to support Tizen:TV OBS project 62/124762/1
authorMu-Woong Lee <muwoong.lee@samsung.com>
Wed, 12 Apr 2017 09:39:12 +0000 (18:39 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Wed, 12 Apr 2017 09:39:12 +0000 (18:39 +0900)
Change-Id: I302211f6076eae3e44d6e9476ae41b94af31ac86
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
CMakeLists.txt
packaging/capi-system-sensor.spec
src/sensor_recorder_dummy.cpp [new file with mode: 0644]

index d149868..ad7458c 100644 (file)
@@ -3,7 +3,10 @@ PROJECT(capi-system-sensor)
 INCLUDE(GNUInstallDirs)
 
 SET(DEPENDENTS "dlog sensor capi-base-common")
-SET(DEPENDENTS "${DEPENDENTS} context-sensor-recorder-client")
+
+IF("${SENSOR_RECORDER}" STREQUAL "on")
+       SET(DEPENDENTS "${DEPENDENTS} context-sensor-recorder-client")
+ENDIF()
 
 SET(VERSION ${FULLVER})
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
@@ -35,10 +38,15 @@ SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl, --rpath=${LIB_INSTALL_DIR}")
 
 # Compile Source files
 SET(SOURCES src/sensor.cpp
-                       src/sensor_recorder.cpp
                        src/geomagnetic_field.c
                        src/fusion_util.c)
 
+IF("${SENSOR_RECORDER}" STREQUAL "on")
+       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 f02b6a6..f3bd520 100644 (file)
@@ -10,7 +10,10 @@ BuildRequires:  cmake
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(sensor)
 BuildRequires:  pkgconfig(capi-base-common)
+# This is to support Tizen:TV project. This does not deteriorate 4.0 Configurability
+%if "%{?profile}" != "tv"
 BuildRequires:  pkgconfig(context-sensor-recorder-client)
+%endif
 
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
@@ -38,7 +41,12 @@ A Sensor library in TIZEN C API package (Development).
 
 %build
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
+# This is to support Tizen:TV project. This does not deteriorate 4.0 Configurability
+%if "%{?profile}" != "tv"
+%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DSENSOR_RECORDER=on
+%else
+%cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DSENSOR_RECORDER=off
+%endif
 %__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..669afae
--- /dev/null
@@ -0,0 +1,167 @@
+/*
+ * 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 <stdlib.h>
+#include <sensor.h>
+#include <sensor_log.h>
+
+int sensor_recorder_is_supported(sensor_type_e type, bool *supported)
+{
+       if (type <= SENSOR_ALL)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+       if (!supported)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       *supported = false;
+
+       return SENSOR_ERROR_NONE;
+}
+
+int sensor_recorder_start(sensor_type_e type, sensor_recorder_option_h option)
+{
+       if (type <= SENSOR_ALL)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_stop(sensor_type_e type)
+{
+       if (type <= SENSOR_ALL)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       return SENSOR_ERROR_NOT_SUPPORTED;
+}
+
+int sensor_recorder_create_option(sensor_recorder_option_h *option)
+{
+       if (!option)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       *option = (sensor_recorder_option_h)malloc(sizeof(sensor_recorder_option_h));
+       if (!*option)
+               return SENSOR_ERROR_OUT_OF_MEMORY;
+
+       return SENSOR_ERROR_NONE;
+}
+
+int sensor_recorder_destroy_option(sensor_recorder_option_h option)
+{
+       if (!option)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       return SENSOR_ERROR_NONE;
+}
+
+int sensor_recorder_option_set_int(sensor_recorder_option_h option, sensor_recorder_option_e attribute, int value)
+{
+       if (!option)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+       if (attribute < 0)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       return SENSOR_ERROR_NONE;
+}
+
+int sensor_recorder_create_query(sensor_recorder_query_h *query)
+{
+       if (!query)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       *query = (sensor_recorder_query_h)malloc(sizeof(sensor_recorder_query_h));
+       if (!*query)
+               return SENSOR_ERROR_OUT_OF_MEMORY;
+
+       return SENSOR_ERROR_NONE;
+}
+
+int sensor_recorder_destroy_query(sensor_recorder_query_h query)
+{
+       if (!query)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       return SENSOR_ERROR_NONE;
+}
+
+int sensor_recorder_query_set_int(sensor_recorder_query_h query, sensor_recorder_query_e attribute, int value)
+{
+       if (!query)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+       if (attribute < 0)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       return SENSOR_ERROR_NONE;
+}
+
+int sensor_recorder_query_set_time(sensor_recorder_query_h query, sensor_recorder_query_e attribute, time_t t)
+{
+       if (!query)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+       if (attribute < 0)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+       if (t < 0)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       return SENSOR_ERROR_NONE;
+}
+
+int sensor_recorder_read(sensor_type_e type, sensor_recorder_query_h query, sensor_recorder_data_cb cb, void *user_data)
+{
+       if (type <= SENSOR_ALL)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+       if (!query || !cb)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       return SENSOR_ERROR_NONE;
+}
+
+int sensor_recorder_read_sync(sensor_type_e type, sensor_recorder_query_h query, sensor_recorder_data_cb cb, void *user_data)
+{
+       if (type <= SENSOR_ALL)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+       if (!query || !cb)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       return SENSOR_ERROR_NONE;
+}
+
+int sensor_recorder_data_get_time(sensor_recorder_data_h data, time_t *start_time, time_t *end_time)
+{
+       if (!data || !start_time || !end_time)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       return SENSOR_ERROR_NONE;
+}
+
+int sensor_recorder_data_get_int(sensor_recorder_data_h data, sensor_recorder_data_e key, int *value)
+{
+       if (!data || !value)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+       if (key < 0)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       return SENSOR_ERROR_NONE;
+}
+
+int sensor_recorder_data_get_double(sensor_recorder_data_h data, sensor_recorder_data_e key, double *value)
+{
+       if (!data || !value)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+       if (key < 0)
+               return SENSOR_ERROR_INVALID_PARAMETER;
+
+       return SENSOR_ERROR_NONE;
+}