BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(libsystemd-daemon)
BuildRequires: pkgconfig(capi-system-info)
-BuildRequires: pkgconfig(sensor-hal)
BuildRequires: pkgconfig(cynara-creds-socket)
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(cynara-session)
include_directories(${CMAKE_SOURCE_DIR}/src/shared)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
-IF("${ACCEL}" STREQUAL "ON")
-add_subdirectory(plugins/accel)
-ENDIF()
-IF("${GYRO}" STREQUAL "ON")
-add_subdirectory(plugins/gyro)
-ENDIF()
-IF("${PROXI}" STREQUAL "ON")
-add_subdirectory(plugins/proxi)
-ENDIF()
-IF("${LIGHT}" STREQUAL "ON")
-add_subdirectory(plugins/light)
-ENDIF()
-IF("${GEO}" STREQUAL "ON")
-add_subdirectory(plugins/geo)
-ENDIF()
-IF("${AUTO_ROTATION}" STREQUAL "ON")
-add_subdirectory(plugins/auto_rotation)
-ENDIF()
-IF("${PRESSURE}" STREQUAL "ON")
-add_subdirectory(plugins/pressure)
-ENDIF()
-IF("${TEMPERATURE}" STREQUAL "ON")
-add_subdirectory(plugins/temperature)
-ENDIF()
-IF("${HUMIDITY}" STREQUAL "ON")
-add_subdirectory(humidity)
-ENDIF()
-IF("${ULTRAVIOLET}" STREQUAL "ON")
-add_subdirectory(plugins/ultraviolet)
-ENDIF()
-IF("${BIO_LED_RED}" STREQUAL "ON")
-add_subdirectory(plugins/bio_led_red)
-ENDIF()
-IF("${ORIENTATION}" STREQUAL "ON")
-set(SENSOR_FUSION_ENABLE "1")
-set(ORIENTATION_ENABLE "1")
-ENDIF()
-IF("${GEOMAGNETIC_RV}" STREQUAL "ON")
-set(SENSOR_FUSION_ENABLE "1")
-ENDIF()
-IF("${GAMING_RV}" STREQUAL "ON")
-set(SENSOR_FUSION_ENABLE "1")
-ENDIF()
-IF("${TILT}" STREQUAL "ON")
-set(SENSOR_FUSION_ENABLE "1")
-set(TILT_ENABLE "1")
-ENDIF()
-IF("${UNCAL_GYRO}" STREQUAL "ON")
-set(SENSOR_FUSION_ENABLE "1")
-set(UNCAL_GYRO_ENABLE "1")
-ENDIF()
-IF("${GRAVITY}" STREQUAL "ON")
-set(SENSOR_FUSION_ENABLE "1")
-set(ORIENTATION_ENABLE "1")
-set(GRAVITY_ENABLE "1")
-ENDIF()
-IF("${LINEAR_ACCEL}" STREQUAL "ON")
-set(SENSOR_FUSION_ENABLE "1")
-set(ORIENTATION_ENABLE "1")
-set(GRAVITY_ENABLE "1")
-set(LINEAR_ACCELERATION_ENABLE "1")
-ENDIF()
-IF("${SENSOR_FUSION_ENABLE}" STREQUAL "1")
-add_subdirectory(plugins/sensor_fusion)
-add_subdirectory(plugins/fusion)
-ENDIF()
-IF("${ORIENTATION_ENABLE}" STREQUAL "1")
-add_subdirectory(plugins/orientation)
-ENDIF()
-IF("${GRAVITY_ENABLE}" STREQUAL "1")
-add_subdirectory(plugins/gravity)
-ENDIF()
-IF("${LINEAR_ACCELERATION_ENABLE}" STREQUAL "1")
-add_subdirectory(plugins/linear_accel)
-ENDIF()
-IF("${TILT_ENABLE}" STREQUAL "1")
-add_subdirectory(plugins/tilt)
-ENDIF()
-IF("${UNCAL_GYRO_ENABLE}" STREQUAL "1")
-add_subdirectory(plugins/uncal_gyro)
-ENDIF()
-
-add_subdirectory(plugins/rotation_vector)
add_subdirectory(server)
add_subdirectory(client)
add_subdirectory(shared)
poller.cpp
)
-target_link_libraries(${PROJECT_NAME} ${lib_pkgs_LDFLAGS} "sensord-share" "sensor-hal")
+target_link_libraries(${PROJECT_NAME} ${lib_pkgs_LDFLAGS} "sensord-share")
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
#include <client_common.h>
#include <vconf.h>
#include <cmutex.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sensor_info.h>
#include <sensor_info_manager.h>
#include <vector>
#include <sensor_internal.h>
#include <csensor_handle_info.h>
#include <creg_event_info.h>
-#include <common.h>
+#include <sensor_logs.h>
#define BASE_GATHERING_INTERVAL 100
#include <creg_event_info.h>
#include <command_channel.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <string.h>
#include <unordered_map>
* limitations under the License.
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <poller.h>
#include <sf_common.h>
project(sensord CXX)
INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(server_pkgs REQUIRED glib-2.0 gio-2.0 dlog libsystemd-daemon cynara-client cynara-creds-socket cynara-session)
-
+PKG_CHECK_MODULES(server_pkgs REQUIRED glib-2.0 gio-2.0 dlog libsystemd-daemon libxml-2.0 cynara-client cynara-creds-socket cynara-session)
FOREACH(flag ${server_pkgs_LDFLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
ENDFOREACH(flag)
command_worker.cpp
permission_checker.cpp
main.cpp
+
+)
+
+add_library(sensord-server SHARED
+ worker_thread.cpp
+ cvirtual_sensor_config.cpp
+ csensor_event_queue.cpp
+ csensor_event_dispatcher.cpp
+ csensor_usage.cpp
+ cplugin_info_list.cpp
+ sensor_plugin_loader.cpp
+ sensor_base.cpp
+ physical_sensor.cpp
+ virtual_sensor.cpp
+ cclient_info_manager.cpp
+ cclient_sensor_record.cpp
+ cconfig.cpp
)
+target_link_libraries(sensord-server ${shared_pkgs_LDFLAGS} "-lrt -ldl -pthread" "sensord-share")
+configure_file(sensord-server.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/sensord-server.pc @ONLY)
+install(TARGETS sensord-server DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(FILES sensord-server.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
add_executable(${PROJECT_NAME} ${SERVER_SRCS})
-target_link_libraries(${PROJECT_NAME} ${server_pkgs_LDFLAGS} "sensord-server" "sensor-hal")
+target_link_libraries(${PROJECT_NAME} ${server_pkgs_LDFLAGS} "sensord-server")
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
+
+
+
+IF("${ACCEL}" STREQUAL "ON")
+add_subdirectory(plugins/accel)
+ENDIF()
+IF("${GYRO}" STREQUAL "ON")
+add_subdirectory(plugins/gyro)
+ENDIF()
+IF("${PROXI}" STREQUAL "ON")
+add_subdirectory(plugins/proxi)
+ENDIF()
+IF("${LIGHT}" STREQUAL "ON")
+add_subdirectory(plugins/light)
+ENDIF()
+IF("${GEO}" STREQUAL "ON")
+add_subdirectory(plugins/geo)
+ENDIF()
+IF("${AUTO_ROTATION}" STREQUAL "ON")
+add_subdirectory(plugins/auto_rotation)
+ENDIF()
+IF("${PRESSURE}" STREQUAL "ON")
+add_subdirectory(plugins/pressure)
+ENDIF()
+IF("${TEMPERATURE}" STREQUAL "ON")
+add_subdirectory(plugins/temperature)
+ENDIF()
+IF("${HUMIDITY}" STREQUAL "ON")
+add_subdirectory(humidity)
+ENDIF()
+IF("${ULTRAVIOLET}" STREQUAL "ON")
+add_subdirectory(plugins/ultraviolet)
+ENDIF()
+IF("${BIO_LED_RED}" STREQUAL "ON")
+add_subdirectory(plugins/bio_led_red)
+ENDIF()
+IF("${ORIENTATION}" STREQUAL "ON")
+set(SENSOR_FUSION_ENABLE "1")
+set(ORIENTATION_ENABLE "1")
+ENDIF()
+IF("${GEOMAGNETIC_RV}" STREQUAL "ON")
+set(SENSOR_FUSION_ENABLE "1")
+ENDIF()
+IF("${GAMING_RV}" STREQUAL "ON")
+set(SENSOR_FUSION_ENABLE "1")
+ENDIF()
+IF("${TILT}" STREQUAL "ON")
+set(SENSOR_FUSION_ENABLE "1")
+set(TILT_ENABLE "1")
+ENDIF()
+IF("${UNCAL_GYRO}" STREQUAL "ON")
+set(SENSOR_FUSION_ENABLE "1")
+set(UNCAL_GYRO_ENABLE "1")
+ENDIF()
+IF("${GRAVITY}" STREQUAL "ON")
+set(SENSOR_FUSION_ENABLE "1")
+set(ORIENTATION_ENABLE "1")
+set(GRAVITY_ENABLE "1")
+ENDIF()
+IF("${LINEAR_ACCEL}" STREQUAL "ON")
+set(SENSOR_FUSION_ENABLE "1")
+set(ORIENTATION_ENABLE "1")
+set(GRAVITY_ENABLE "1")
+set(LINEAR_ACCELERATION_ENABLE "1")
+ENDIF()
+IF("${SENSOR_FUSION_ENABLE}" STREQUAL "1")
+add_subdirectory(sensor_fusion)
+add_subdirectory(plugins/fusion)
+ENDIF()
+IF("${ORIENTATION_ENABLE}" STREQUAL "1")
+add_subdirectory(plugins/orientation)
+ENDIF()
+IF("${GRAVITY_ENABLE}" STREQUAL "1")
+add_subdirectory(plugins/gravity)
+ENDIF()
+IF("${LINEAR_ACCELERATION_ENABLE}" STREQUAL "1")
+add_subdirectory(plugins/linear_accel)
+ENDIF()
+IF("${TILT_ENABLE}" STREQUAL "1")
+add_subdirectory(plugins/tilt)
+ENDIF()
+IF("${UNCAL_GYRO_ENABLE}" STREQUAL "1")
+add_subdirectory(plugins/uncal_gyro)
+ENDIF()
+
+add_subdirectory(plugins/rotation_vector)
*/
#include <cclient_info_manager.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <csocket.h>
using std::pair;
#include <cclient_sensor_record.h>
#include <unordered_map>
-#include <common.h>
+#include <sensor_logs.h>
#include <cmutex.h>
#include <vector>
*/
#include <cclient_sensor_record.h>
-#include <common.h>
+#include <sensor_logs.h>
using std::pair;
using std::string;
#include <string>
#include <unordered_map>
-#include <common.h>
+#include <sensor_logs.h>
class cconfig
{
#include <command_worker.h>
#include <sensor_plugin_loader.h>
#include <sensor_info.h>
-#include <sensor_accel.h>
-#include <sensor_gyro.h>
-#include <sensor_geomag.h>
-#include <sensor_orientation.h>
-#include <sensor_linear_accel.h>
-#include <sensor_gravity.h>
+#include <sensor_types.h>
#include <thread>
#include <string>
#include <vector>
#include <csensor_event_dispatcher.h>
#include <sensor_plugin_loader.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <thread>
#include <vector>
*/
#include <csensor_event_queue.h>
-#include "common.h"
+#include "sensor_logs.h"
csensor_event_queue& csensor_event_queue::get_instance()
{
#include <sensor_internal.h>
#include <csensor_usage.h>
-#include <common.h>
+#include <sensor_logs.h>
csensor_usage::csensor_usage()
: m_interval(POLL_MAX_HZ_MS)
*/
#include <cvirtual_sensor_config.h>
-#include "common.h"
+#include "sensor_logs.h"
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <string>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <dbus_util.h>
#include <gio/gio.h>
*/
#include <signal.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <server.h>
#include <dbus_util.h>
#include <sensor_plugin_loader.h>
#include <cynara-session.h>
#include <permission_checker.h>
#include <sf_common.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sensor_plugin_loader.h>
#include <sensor_base.h>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <accel_sensor.h>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <auto_rotation_alg.h>
auto_rotation_alg::auto_rotation_alg()
*/
#include <sensor_common.h>
-#include <common.h>
-#include <sensor_auto_rotation.h>
+#include <sensor_logs.h>
+#include <sensor_types.h>
#include <auto_rotation_alg_emul.h>
#include <stdlib.h>
#include <math.h>
#include <sys/types.h>
#include <dlfcn.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <virtual_sensor.h>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <bio_led_red_sensor.h>
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/src/client)
-include_directories(${CMAKE_SOURCE_DIR}/src/plugins/sensor_fusion)
+include_directories(${CMAKE_SOURCE_DIR}/src/server/sensor_fusion)
FOREACH(flag ${fusion_pkgs_LDFLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
#include <time.h>
#include <sys/types.h>
#include <dlfcn.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <fusion_sensor.h>
#include <sensor_plugin_loader.h>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <geo_sensor.h>
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/src/client)
-include_directories(${CMAKE_SOURCE_DIR}/src/plugins/sensor_fusion)
+include_directories(${CMAKE_SOURCE_DIR}/src/server/sensor_fusion)
FOREACH(flag ${gravity_pkgs_LDFLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
#include <time.h>
#include <sys/types.h>
#include <dlfcn.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <gravity_sensor.h>
#include <sensor_plugin_loader.h>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <gyro_sensor.h>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <light_sensor.h>
#include <sensor_plugin_loader.h>
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/src/client)
-include_directories(${CMAKE_SOURCE_DIR}/src/plugins/sensor_fusion)
+include_directories(${CMAKE_SOURCE_DIR}/src/server/sensor_fusion)
FOREACH(flag ${linear_accel_pkgs_LDFLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
#include <time.h>
#include <sys/types.h>
#include <dlfcn.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <linear_accel_sensor.h>
#include <sensor_plugin_loader.h>
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/src/client)
-include_directories(${CMAKE_SOURCE_DIR}/src/plugins/sensor_fusion)
+include_directories(${CMAKE_SOURCE_DIR}/src/server/sensor_fusion)
FOREACH(flag ${orientation_pkgs_LDFLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
#include <time.h>
#include <sys/types.h>
#include <dlfcn.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <orientation_sensor.h>
#include <sensor_plugin_loader.h>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <pressure_sensor.h>
#include <sensor_plugin_loader.h>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <proxi_sensor.h>
#include <sensor_plugin_loader.h>
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/src/client)
-include_directories(${CMAKE_SOURCE_DIR}/src/plugins/sensor_fusion)
+include_directories(${CMAKE_SOURCE_DIR}/src/server/sensor_fusion)
FOREACH(flag ${gaming_rv_pkgs_LDFLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
#include <time.h>
#include <sys/types.h>
#include <dlfcn.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <gaming_rv_sensor.h>
#include <sensor_plugin_loader.h>
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/src/client)
-include_directories(${CMAKE_SOURCE_DIR}/src/plugins/sensor_fusion)
+include_directories(${CMAKE_SOURCE_DIR}/src/server/sensor_fusion)
FOREACH(flag ${geomagnetic_rv_pkgs_LDFLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
#include <time.h>
#include <sys/types.h>
#include <dlfcn.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <geomagnetic_rv_sensor.h>
#include <sensor_plugin_loader.h>
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/src/client)
-include_directories(${CMAKE_SOURCE_DIR}/src/plugins/sensor_fusion)
+include_directories(${CMAKE_SOURCE_DIR}/src/server/sensor_fusion)
FOREACH(flag ${rv_pkgs_LDFLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
#include <time.h>
#include <sys/types.h>
#include <dlfcn.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <rv_sensor.h>
#include <sensor_plugin_loader.h>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <rv_raw_sensor.h>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <temperature_sensor.h>
#include <sensor_plugin_loader.h>
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/src/client)
-include_directories(${CMAKE_SOURCE_DIR}/src/plugins/sensor_fusion)
+include_directories(${CMAKE_SOURCE_DIR}/src/server/sensor_fusion)
FOREACH(flag ${tilt_pkgs_LDFLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
#include <time.h>
#include <sys/types.h>
#include <dlfcn.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <tilt_sensor.h>
#include <sensor_plugin_loader.h>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <ultraviolet_sensor.h>
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/src/client)
-include_directories(${CMAKE_SOURCE_DIR}/src/plugins/sensor_fusion)
+include_directories(${CMAKE_SOURCE_DIR}/src/server/sensor_fusion)
FOREACH(flag ${gravity_pkgs_LDFLAGS})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
#include <time.h>
#include <sys/types.h>
#include <dlfcn.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sf_common.h>
#include <uncal_gyro_sensor.h>
#include <sensor_plugin_loader.h>
#include <cplugin_info_list.h>
#include <cmutex.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <sensor_common.h>
#include <worker_thread.h>
#include <sensor_info.h>
#include <sensor_base.h>
#include <dlfcn.h>
#include <dirent.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <unordered_set>
#include <algorithm>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#include <worker_thread.h>
#include <thread>
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_SOURCE_DIR}/src/client)
-add_library(sensord-server SHARED
- worker_thread.cpp
- cvirtual_sensor_config.cpp
- csensor_event_queue.cpp
- csensor_event_dispatcher.cpp
- csensor_usage.cpp
- cclient_info_manager.cpp
- cclient_sensor_record.cpp
- cplugin_info_list.cpp
- sensor_plugin_loader.cpp
- sensor_base.cpp
- physical_sensor.cpp
- virtual_sensor.cpp
- iio_common.cpp
-)
add_library(sensord-share SHARED
+ cbase_lock.cpp
+ cmutex.cpp
cpacket.cpp
csocket.cpp
+ sensor_logs.cpp
sensor_info.cpp
)
-target_link_libraries(sensord-server ${shared_pkgs_LDFLAGS} "-lrt -ldl -pthread" "sensord-share")
+
target_link_libraries(sensord-share ${shared_pkgs_LDFLAGS} "-lrt -ldl -pthread")
-configure_file(sensord-server.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/sensord-server.pc @ONLY)
+
configure_file(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc @ONLY)
-install(TARGETS sensord-server DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
install(TARGETS sensord-share DESTINATION ${CMAKE_INSTALL_LIBDIR})
-install(FILES sensord-server.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+
install(FILES ${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(FILES
- worker_thread.h
- cvirtual_sensor_config.h
- csensor_event_queue.h
- cplugin_info_list.h
- sensor_plugin_loader.h
- sensor_base.h
- physical_sensor.h
- virtual_sensor.h
cpacket.h
csocket.h
cbase_lock.h
sensor_info.h
- iio_common.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
)
-install(FILES sensor_accel.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_geomag.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_light.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_proxi.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_gyro.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_pressure.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_context.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_auto_rotation.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_gravity.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_linear_accel.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_orientation.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_tilt.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_rv.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_geomagnetic_rv.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_gaming_rv.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-install(FILES sensor_temperature.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
-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 sensor_types.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
install(FILES sensor_internal_deprecated.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
install(FILES sensor_internal.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/sensor/)
#include <pthread.h>
#include <cbase_lock.h>
#include <stdio.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <errno.h>
#include <sys/time.h>
*/
#include <cmutex.h>
-#include "common.h"
+#include "sensor_logs.h"
cmutex::cmutex()
{
#include <errno.h>
#include <string.h>
#include <new>
-#include <common.h>
+#include <sensor_logs.h>
#include <cpacket.h>
#include <sf_common.h>
--- /dev/null
+/*
+ * libsensord-share
+ *
+ * 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 <csensor_config.h>
+#include "sensor_logs.h"
+#include <libxml/xmlmemory.h>
+#include <libxml/parser.h>
+#include <sstream>
+#include <iostream>
+#include <fstream>
+#include <string>
+
+using std::ifstream;
+using std::string;
+using std::istringstream;
+
+#define ROOT_ELEMENT "SENSOR"
+#define TEXT_ELEMENT "text"
+#define MODEL_ID_ATTR "id"
+#define DEFAULT_ATTR "value"
+
+csensor_config::csensor_config()
+{
+}
+
+csensor_config& csensor_config::get_instance(void)
+{
+ static bool load_done = false;
+ static csensor_config inst;
+
+ if (!load_done) {
+ inst.load_config(SENSOR_CONFIG_FILE_PATH);
+ inst.get_device_id();
+ if (!inst.m_device_id.empty())
+ INFO("Device ID = %s", inst.m_device_id.c_str());
+ else
+ ERR("Failed to get Device ID");
+ load_done = true;
+ }
+
+ return inst;
+}
+
+bool csensor_config::load_config(const string& config_path)
+{
+ xmlDocPtr doc;
+ xmlNodePtr cur;
+
+ DBG("csensor_config::load_config(\"%s\") is called!\n",config_path.c_str());
+
+ doc = xmlParseFile(config_path.c_str());
+
+ if (doc == NULL) {
+ ERR("There is no %s\n",config_path.c_str());
+ return false;
+ }
+
+ cur = xmlDocGetRootElement(doc);
+ if(cur == NULL) {
+ ERR("There is no root element in %s\n",config_path.c_str());
+ xmlFreeDoc(doc);
+ return false;
+ }
+
+ if(xmlStrcmp(cur->name, (const xmlChar *)ROOT_ELEMENT)) {
+ ERR("Wrong type document: there is no [%s] root element in %s\n",ROOT_ELEMENT,config_path.c_str());
+ xmlFreeDoc(doc);
+ return false;
+ }
+
+ xmlNodePtr model_list_node_ptr;
+ xmlNodePtr model_node_ptr;
+ xmlNodePtr element_node_ptr;
+ xmlAttrPtr attr_ptr;
+ char* prop = NULL;
+
+ model_list_node_ptr = cur->xmlChildrenNode;
+
+ while (model_list_node_ptr != NULL) {
+ //skip garbage element, [text]
+ if (!xmlStrcmp(model_list_node_ptr->name,(const xmlChar *)TEXT_ELEMENT)) {
+ model_list_node_ptr = model_list_node_ptr->next;
+ continue;
+ }
+
+ //insert Model_list to config map
+ m_sensor_config[(const char*)model_list_node_ptr->name];
+ DBG("<%s>\n",(const char*)model_list_node_ptr->name);
+
+ model_node_ptr = model_list_node_ptr->xmlChildrenNode;
+ while (model_node_ptr != NULL){
+ //skip garbage element, [text]
+ if (!xmlStrcmp(model_node_ptr->name,(const xmlChar *)TEXT_ELEMENT)) {
+ model_node_ptr = model_node_ptr->next;
+ continue;
+ }
+
+
+ string model_id;
+ prop = (char*)xmlGetProp(model_node_ptr,(const xmlChar*)MODEL_ID_ATTR);
+ model_id = prop;
+ free(prop);
+
+ //insert Model to Model_list
+ m_sensor_config[(const char*)model_list_node_ptr->name][model_id];
+ DBG("<%s id=\"%s\">\n",(const char*)model_list_node_ptr->name,model_id.c_str());
+
+ element_node_ptr = model_node_ptr->xmlChildrenNode;
+ while (element_node_ptr != NULL) {
+ //skip garbage element, [text]
+ if (!xmlStrcmp(element_node_ptr->name,(const xmlChar *)TEXT_ELEMENT)) {
+ element_node_ptr = element_node_ptr->next;
+ continue;
+ }
+
+ //insert Element to Model
+ m_sensor_config[(const char*)model_list_node_ptr->name][model_id][(const char*)element_node_ptr->name];
+ DBG("<%s id=\"%s\"><%s>\n",(const char*)model_list_node_ptr->name,model_id.c_str(),(const char*)element_node_ptr->name);
+
+ attr_ptr = element_node_ptr->properties;
+ while (attr_ptr != NULL) {
+
+ string key,value;
+ key = (char*)attr_ptr->name;
+ prop = (char*)xmlGetProp(element_node_ptr,attr_ptr->name);
+ value = prop;
+ free(prop);
+
+ //insert attribute to Element
+ m_sensor_config[(const char*)model_list_node_ptr->name][model_id][(const char*)element_node_ptr->name][key]=value;
+ DBG("<%s id=\"%s\"><%s \"%s\"=\"%s\">\n",(const char*)model_list_node_ptr->name,model_id.c_str(),(const char*)element_node_ptr->name,key.c_str(),value.c_str());
+ attr_ptr = attr_ptr->next;
+ }
+
+
+ element_node_ptr = element_node_ptr->next;
+ }
+
+ DBG("\n");
+ model_node_ptr = model_node_ptr->next;
+ }
+
+ DBG("\n");
+ model_list_node_ptr = model_list_node_ptr->next;
+ }
+
+ xmlFreeDoc(doc);
+ return true;
+}
+
+
+bool csensor_config::get(const string& sensor_type,const string& model_id, const string& element, const string& attr, string& value)
+{
+ auto it_model_list = m_sensor_config.find(sensor_type);
+
+ if (it_model_list == m_sensor_config.end()) {
+ ERR("There is no <%s> element\n",sensor_type.c_str());
+ return false;
+ }
+
+ auto it_model = it_model_list->second.find(model_id);
+
+ if (it_model == it_model_list->second.end()) {
+ ERR("There is no <%s id=\"%s\"> element\n",sensor_type.c_str(),model_id.c_str());
+ return false;
+ }
+
+ auto it_element = it_model->second.find(element);
+
+ if (it_element == it_model->second.end()) {
+ DBG("There is no <%s id=\"%s\"><%s> element\n",sensor_type.c_str(),model_id.c_str(),element.c_str());
+ return false;
+ }
+
+ auto it_attr = it_element->second.find(attr);
+
+ if (it_attr == it_element->second.end()) {
+ DBG("There is no <%s id=\"%s\"><%s \"%s\">\n",sensor_type.c_str(),model_id.c_str(),element.c_str(),attr.c_str());
+ return false;
+ }
+
+ value = it_attr->second;
+
+ return true;
+}
+
+bool csensor_config::get(const string& sensor_type, const string& model_id, const string& element, const string& attr, double& value)
+{
+ string str_value;
+
+ if (get(sensor_type,model_id,element,attr,str_value) == false)
+ return false;
+
+ istringstream convert(str_value);
+
+ if ( !(convert >> value))
+ value = 0;
+
+ return true;
+}
+
+bool csensor_config::get(const string& sensor_type, const string& model_id, const string& element, const string& attr, long& value)
+{
+ string str_value;
+
+ if (get(sensor_type,model_id,element,attr,str_value) == false)
+ return false;
+
+ istringstream convert(str_value);
+
+ if ( !(convert >> value))
+ value = 0;
+
+ return true;
+}
+
+bool csensor_config::get(const string& sensor_type, const string& model_id, const string& element, string& value)
+{
+ if (get(sensor_type, model_id, element, m_device_id, value))
+ return true;
+
+ if (get(sensor_type, model_id, element, DEFAULT_ATTR, value))
+ return true;
+
+ return false;
+}
+
+bool csensor_config::get(const string& sensor_type, const string& model_id, const string& element, double& value)
+{
+ if (get(sensor_type, model_id, element, m_device_id, value))
+ return true;
+
+ if (get(sensor_type, model_id, element, DEFAULT_ATTR, value))
+ return true;
+
+ return false;
+}
+
+bool csensor_config::get(const string& sensor_type, const string& model_id, const string& element, long& value)
+{
+ if (get(sensor_type, model_id, element, m_device_id, value))
+ return true;
+
+ if (get(sensor_type, model_id, element, DEFAULT_ATTR, value))
+ return true;
+
+ return false;
+}
+
+bool csensor_config::is_supported(const string& sensor_type,const string& model_id)
+{
+ auto it_model_list = m_sensor_config.find(sensor_type);
+
+ if (it_model_list == m_sensor_config.end())
+ return false;
+
+ auto it_model = it_model_list->second.find(model_id);
+
+ if (it_model == it_model_list->second.end())
+ return false;
+
+ return true;
+}
--- /dev/null
+/*
+ * libsensord-share
+ *
+ * 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.
+ *
+ */
+
+#if !defined(_CSENSOR_CONFIG_CLASS_H_)
+#define _CSENSOR_CONFIG_CLASS_H_
+
+#include <cconfig.h>
+
+#define SENSOR_CONFIG_FILE_PATH "/usr/etc/sensors.xml"
+
+typedef std::unordered_map<std::string,std::string> Element;
+/*
+* an Element is a group of attributes
+* <Element value1 = "10.0", value2 = "20.0"/>
+*
+* "value" -> "LSM330DLC"
+*
+*/
+
+typedef std::unordered_map<std::string,Element> Model;
+/*
+* a Model is a group of elements to consist of specific vendor's one sensor configuration
+* <NAME value = "LSM330DLC" />
+* <VENDOR value = "ST Microelectronics"/>
+* <RAW_DATA_UNIT value = "1" />
+* <RESOLUTION value = "12" />
+*
+* <NAME> -> <value = "LSM330DLC"/>
+*
+*/
+
+typedef std::unordered_map<std::string,Model> Model_list;
+/*
+* a Model_list is a group of Model
+* <MODEL id = "lsm330dlc_accel">
+* </MODEL>
+* <MODEL id = "mpu6500">
+* </MODEL>
+*
+* "lsm330dlc_accel" -> <Model>
+*
+*/
+
+typedef std::unordered_map<std::string,Model_list> Sensor_config;
+/*
+* a SensorConfig represents sensors.xml
+* <ACCEL/>
+* <GYRO/>
+* <PROXIMITY/>
+*
+* "ACCEL" -> Model_list
+*
+*/
+
+class csensor_config : public cconfig
+{
+private:
+ csensor_config();
+ csensor_config(csensor_config const&) {};
+ csensor_config& operator=(csensor_config const&);
+
+ bool load_config(const std::string& config_path);
+
+ Sensor_config m_sensor_config;
+public:
+ static csensor_config& get_instance(void);
+
+ bool get(const std::string& sensor_type, const std::string& model_id, const std::string& element, const std::string& attr, std::string& value);
+ bool get(const std::string& sensor_type, const std::string& model_id, const std::string& element, const std::string& attr, double& value);
+ bool get(const std::string& sensor_type, const std::string& model_id, const std::string& element, const std::string& attr, long& value);
+
+ bool get(const std::string& sensor_type, const std::string& model_id, const std::string& element, std::string& value);
+ bool get(const std::string& sensor_type, const std::string& model_id, const std::string& element, double& value);
+ bool get(const std::string& sensor_type, const std::string& model_id, const std::string& element, long& value);
+
+ bool is_supported(const std::string &sensor_type, const std::string &model_id);
+};
+
+#endif
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
-#include "common.h"
+#include "sensor_logs.h"
class csocket {
public:
*/
#include <sensor_info.h>
-#include <common.h>
+#include <sensor_logs.h>
#include <algorithm>
#include <vector>
#include <string>
#include <sys/stat.h>
#include <unistd.h>
#include <string.h>
-#include "common.h"
+#include "sensor_logs.h"
#include <dlog.h>
#include <stdarg.h>
#include <stddef.h>
*
*/
-#include <common.h>
+#include <sensor_logs.h>
#if !defined(_SF_COMMON_H_)
#define _SF_COMMON_H_