sensord: add dummy api library for tv profile 39/107939/3
authorkibak.yoon <kibak.yoon@samsung.com>
Mon, 2 Jan 2017 05:39:03 +0000 (14:39 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Mon, 2 Jan 2017 05:57:50 +0000 (14:57 +0900)
Change-Id: I610a6a2e43e475b20e96432d47b68aebe7785655
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
packaging/sensord.spec
src/client/CMakeLists.txt
src/client/client_dummy.cpp [new file with mode: 0644]
src/client/external_client_dummy.cpp [new file with mode: 0644]

index 957ebcbff66ce925668d7ee09b68c8f03e5a4ae0..cfd30afb83456c1b33d58654150899a3da5caeed 100644 (file)
@@ -20,6 +20,8 @@ BuildRequires:  pkgconfig(cynara-client)
 BuildRequires:  pkgconfig(cynara-session)
 Requires:   libsensord = %{version}-%{release}
 
+%define BUILD_PROFILE %{?profile}%{!?profile:%{?tizen_profile_name}}
+
 %description
 Sensor daemon
 
@@ -56,9 +58,8 @@ Sensor functional testing
 %prep
 %setup -q
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-
 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DLIBDIR=%{_libdir} \
-        -DMAJORVER=${MAJORVER} -DFULLVER=%{version}
+        -DMAJORVER=${MAJORVER} -DFULLVER=%{version} -DPROFILE=%{BUILD_PROFILE}
 
 %build
 make %{?jobs:-j%jobs}
@@ -69,6 +70,7 @@ rm -rf %{buildroot}
 
 mkdir -p %{buildroot}%{_unitdir}
 
+%if "%{?BUILD_PROFILE}" != "tv"
 install -m 0644 %SOURCE1 %{buildroot}%{_unitdir}
 install -m 0644 %SOURCE2 %{buildroot}%{_unitdir}
 install -m 0644 %SOURCE3 %{buildroot}%{_unitdir}
@@ -76,6 +78,7 @@ install -m 0644 %SOURCE3 %{buildroot}%{_unitdir}
 %install_service multi-user.target.wants sensord.service
 %install_service sockets.target.wants sensord_event.socket
 %install_service sockets.target.wants sensord_command.socket
+%endif
 
 %post
 systemctl daemon-reload
@@ -93,13 +96,16 @@ ln -sf %{_libdir}/libsensor.so.%{version} %{_libdir}/libsensor.so.1
 %files
 %manifest packaging/sensord.manifest
 %{_bindir}/sensord
+%license LICENSE.APLv2
+
+%if "%{?BUILD_PROFILE}" != "tv"
 %{_unitdir}/sensord.service
 %{_unitdir}/sensord_command.socket
 %{_unitdir}/sensord_event.socket
 %{_unitdir}/multi-user.target.wants/sensord.service
 %{_unitdir}/sockets.target.wants/sensord_command.socket
 %{_unitdir}/sockets.target.wants/sensord_event.socket
-%license LICENSE.APLv2
+%endif
 
 %files -n libsensord
 %defattr(-,root,root,-)
index f14b841b673b11cf37f35c821d8bd5d6875c6669..33ed7faf4372b0cc2ccd82fca0e447367e2dd45a 100644 (file)
@@ -34,6 +34,17 @@ INCLUDE_DIRECTORIES(
 )
 
 FILE(GLOB_RECURSE SRCS *.cpp)
+
+IF("${PROFILE}" STREQUAL "tv")
+       LIST(REMOVE_ITEM SRCS
+               "${CMAKE_CURRENT_SOURCE_DIR}/client.cpp"
+               "${CMAKE_CURRENT_SOURCE_DIR}/external_client.cpp")
+ELSE()
+       LIST(REMOVE_ITEM SRCS
+               "${CMAKE_CURRENT_SOURCE_DIR}/client_dummy.cpp"
+               "${CMAKE_CURRENT_SOURCE_DIR}/external_client_dummy.cpp")
+ENDIF()
+
 ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
 
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PKGS_LDFLAGS} "sensord-shared")
diff --git a/src/client/client_dummy.cpp b/src/client/client_dummy.cpp
new file mode 100644 (file)
index 0000000..c7732a6
--- /dev/null
@@ -0,0 +1,204 @@
+/*
+ * sensord
+ *
+ * Copyright (c) 2013 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 <errno.h>
+#include <sensor_common.h>
+
+#include "sensor_internal.h"
+#include "sensor_internal_deprecated.h"
+
+API int sensord_get_sensors(sensor_type_t type, sensor_t **list, int *sensor_count)
+{
+       return -ENODATA;
+}
+
+API int sensord_get_default_sensor(sensor_type_t type, sensor_t *sensor)
+{
+       return -ENODATA;
+}
+
+API bool sensord_get_sensor_list(sensor_type_t type, sensor_t **list, int *sensor_count)
+{
+       return false;
+}
+
+API sensor_t sensord_get_sensor(sensor_type_t type)
+{
+       return NULL;
+}
+
+API bool sensord_get_type(sensor_t sensor, sensor_type_t *type)
+{
+       return false;
+}
+
+API const char* sensord_get_name(sensor_t sensor)
+{
+       return NULL;
+}
+
+API const char* sensord_get_vendor(sensor_t sensor)
+{
+       return NULL;
+}
+
+API bool sensord_get_privilege(sensor_t sensor, sensor_privilege_t *privilege)
+{
+       return false;
+}
+
+API bool sensord_get_min_range(sensor_t sensor, float *min_range)
+{
+       return false;
+}
+
+API bool sensord_get_max_range(sensor_t sensor, float *max_range)
+{
+       return false;
+}
+
+API bool sensord_get_resolution(sensor_t sensor, float *resolution)
+{
+       return false;
+}
+
+API bool sensord_get_min_interval(sensor_t sensor, int *min_interval)
+{
+       return false;
+}
+
+API bool sensord_get_fifo_count(sensor_t sensor, int *fifo_count)
+{
+       return false;
+}
+
+API bool sensord_get_max_batch_count(sensor_t sensor, int *max_batch_count)
+{
+       return false;
+}
+
+API bool sensord_get_supported_event_types(sensor_t sensor, unsigned int **event_types, int *count)
+{
+       return false;
+}
+
+API bool sensord_is_supported_event_type(sensor_t sensor, unsigned int event_type, bool *supported)
+{
+       return false;
+}
+
+API bool sensord_is_wakeup_supported(sensor_t sensor)
+{
+       return false;
+}
+
+API int sensord_connect(sensor_t sensor)
+{
+       return OP_ERROR;
+}
+
+API bool sensord_disconnect(int handle)
+{
+       return false;
+}
+
+API bool sensord_register_event(int handle, unsigned int event_type, unsigned int interval, unsigned int max_batch_latency, sensor_cb_t cb, void *user_data)
+{
+       return false;
+}
+
+API bool sensord_unregister_event(int handle, unsigned int event_type)
+{
+       return false;
+}
+
+API bool sensord_register_accuracy_cb(int handle, sensor_accuracy_changed_cb_t cb, void *user_data)
+{
+       return false;
+}
+
+API bool sensord_unregister_accuracy_cb(int handle)
+{
+       return false;
+}
+
+API bool sensord_start(int handle, int option)
+{
+       return false;
+}
+
+API bool sensord_stop(int handle)
+{
+       return false;
+}
+
+API bool sensord_change_event_interval(int handle, unsigned int event_type, unsigned int interval)
+{
+       return false;
+}
+
+API bool sensord_change_event_max_batch_latency(int handle, unsigned int event_type, unsigned int max_batch_latency)
+{
+       return false;
+}
+
+API bool sensord_set_option(int handle, int option)
+{
+       return false;
+}
+
+API int sensord_set_attribute_int(int handle, int attribute, int value)
+{
+       return OP_ERROR;
+}
+
+API int sensord_set_attribute_str(int handle, int attribute, const char *value, int len)
+{
+       return OP_ERROR;
+}
+
+API bool sensord_send_sensorhub_data(int handle, const char *data, int data_len)
+{
+       return false;
+}
+
+API bool sensord_send_command(int handle, const char *command, int command_len)
+{
+       return false;
+}
+
+API bool sensord_get_data(int handle, unsigned int data_id, sensor_data_t* sensor_data)
+{
+       return false;
+}
+
+API bool sensord_flush(int handle)
+{
+       return false;
+}
+
+API bool sensord_register_hub_event(int handle, unsigned int event_type, unsigned int interval, unsigned int max_batch_latency, sensorhub_cb_t cb, void *user_data)
+{
+       return false;
+}
+
+API bool sensord_set_passive_mode(int handle, bool passive)
+{
+       return false;
+}
diff --git a/src/client/external_client_dummy.cpp b/src/client/external_client_dummy.cpp
new file mode 100644 (file)
index 0000000..8f359d0
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * sensord
+ *
+ * Copyright (c) 2013 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 <errno.h>
+#include <sensor_common.h>
+
+#include "sensor_internal.h"
+#include "sensor_internal_deprecated.h"
+
+API int sensord_external_connect(const char *key, sensor_external_command_cb_t cb, void *user_data)
+{
+       return OP_ERROR;
+}
+
+API bool sensord_external_disconnect(int handle)
+{
+       return false;
+}
+
+API bool sensord_external_post(int handle, unsigned long long timestamp, const float* data, int data_cnt)
+{
+       return false;
+}