#define NAME_MAX 256
#endif
+#define URI_REGEX(CATEGORY) R"~(^http:\/\/[\w-]+(\.[\w-]+)*\/)~" CATEGORY R"~(\/(general|healthinfo)\/[\w-]+(\.[\w-]+)*(\/[\w-]+(\.[\w-]+)*)$)~"
+#define SENSOR_URI_REGEX URI_REGEX("sensor")
+
+#define PREDEFINED_TYPE_URI "http://tizen.org/sensor/"
+
+#define PRIV_DELIMITER ";"
+#define URI_DELIMITER "/"
+
+#define PRIVILEGE_HEALTHINFO_STR "healthinfo"
+#define PRIVILEGE_HEALTHINFO_URI "http://tizen.org/privilege/healthinfo"
+
+#define PRIVILEGE_LOCATION_STR "location"
+#define PRIVILEGE_LOCATION_URI "http://tizen.org/privilege/location"
+
+#define PRIVILEGE_PLATFORM_STR "platform"
+#define PRIVILEGE_PLATFORM_URI "http://tizen.org/privilege/internal/default/platform"
+
+#define URI_PRIV_INDEX 4
+#define URI_SENSOR_TYPE_INDEX 5
+
#define SENSOR_TYPE_SHIFT 32
#define SENSOR_EVENT_SHIFT 16
#define SENSOR_INDEX_MASK 0xFFFFFFFF
BuildRequires: cmake
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(vconf)
+BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(capi-base-common)
PROJECT(capi-system-sensor)
INCLUDE(GNUInstallDirs)
-SET(DEPENDENTS "dlog hal-api-sensor capi-base-common")
+SET(DEPENDENTS "dlog glib-2.0 hal-api-sensor capi-base-common")
IF("${SENSOR_RECORDER}" STREQUAL "on")
SET(DEPENDENTS "${DEPENDENTS} context-sensor-recorder-client")
#ADD_DEFINITIONS("-DTIZEN_DEBUG")
# Compile Source files
-FILE(GLOB SOURCES *.c *.cpp)
+SET(SOURCES
+ fusion-util.c
+ geomagnetic-field.c
+ api-sensor.cpp
+ api-sensor-internal.cpp
+ api-sensor-provider.cpp
+ sensor-listener.cpp
+ sensor-manager-channel-handler.cpp
+ sensor-manager.cpp
+ sensor-provider-channel-handler.cpp
+ sensor-provider.cpp
+ sensor-reader.cpp)
IF("${SENSOR_RECORDER}" STREQUAL "on")
- SET(SOURCES ${SOURCES} sensor_recorder/sensor_recorder.cpp)
+ SET(SOURCES ${SOURCES} api-sensor-recorder.cpp)
ELSE()
- SET(SOURCES ${SOURCES} sensor_recorder/sensor_recorder_dummy.cpp)
+ SET(SOURCES ${SOURCES} api-sensor-recorder-dummy.cpp)
ENDIF()
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCES})
#include <errno.h>
-#include <sensor-internal.h>
#include <sensor.h>
-#include <sensor-types-private.h>
-#include <sensor_types_private.h>
-#include <sensor_utils.h>
-#include <channel_handler.h>
-#include <sensor_manager.h>
-#include <sensor_listener.h>
-#include <sensor_provider_internal.h>
+#include <sensor-internal.h>
+#include <sensor-manager.h>
+#include <sensor-listener.h>
+#include <sensor-provider.h>
+#include <sensor-reader.h>
+#include <sensor-utils.h>
#include <sensor-log-private.h>
+#include <sensor-types-private.h>
+#include <channel-handler.h>
#include <lock.h>
-#include <command_types.h>
-#include "sensor_reader.h"
+#include <command-types.h>
#include <unordered_map>
#include <regex>
*
*/
-#include "sensor_listener.h"
+#include "sensor-listener.h"
-#include <channel_handler.h>
+#include <channel-handler.h>
#include <sensor-log-private.h>
#include <sensor-types-private.h>
-#include <command_types.h>
+#include <command-types.h>
using namespace sensor;
#define __SENSOR_LISTENER_H__
#include <channel.h>
-#include <channel_handler.h>
-#include <event_loop.h>
-#include <sensor_info.h>
+#include <channel-handler.h>
+#include <event-loop.h>
+#include <sensor-info.h>
#include <sensor-types-private.h>
#include <lock.h>
+
#include <map>
#include <atomic>
#include <vector>
*
*/
-#include "sensor_manager_channel_handler.h"
+#include "sensor-manager-channel-handler.h"
#include <sensor-log-private.h>
-#include <command_types.h>
-#include "sensor_manager.h"
+#include <command-types.h>
+#include "sensor-manager.h"
using namespace sensor;
#define __SENSOR_MANAGER_CHANNEL_HANDLER__
#include <sensor-internal.h>
-#include <sensor_manager.h>
-#include <channel_handler.h>
+#include <sensor-manager.h>
+#include <channel-handler.h>
#include <map>
namespace sensor {
*
*/
-#include "sensor_manager.h"
+#include "sensor-manager.h"
#include <sensor-log-private.h>
-#include <sensor_info.h>
-#include <sensor_utils.h>
-#include <command_types.h>
+#include <sensor-info.h>
+#include <sensor-utils.h>
+#include <command-types.h>
#include <message.h>
#include <channel.h>
-#include "sensor_manager_channel_handler.h"
+#include "sensor-manager-channel-handler.h"
using namespace sensor;
#define __SENSOR_MANAGER_H__
#include <channel.h>
-#include <sensor_info.h>
-#include <event_loop.h>
+#include <sensor-info.h>
+#include <event-loop.h>
#include <list>
#include <atomic>
#include "sensor-internal.h"
-#include "sensor_provider_internal.h"
+#include "sensor-provider.h"
namespace sensor {
*
*/
-#include "sensor_provider_channel_handler.h"
+#include "sensor-provider-channel-handler.h"
-#include <command_types.h>
+#include <command-types.h>
#include <sensor-log-private.h>
-#include "sensor_provider_internal.h"
+#include "sensor-provider.h"
using namespace sensor;
#ifndef __SENSOR_PROVIDER_CHANNEL_HANDLER__
#define __SENSOR_PROVIDER_CHANNEL_HANDLER__
-#include <channel_handler.h>
+#include <channel-handler.h>
#include <sensor-internal.h>
-#include "sensor_provider_internal.h"
+#include "sensor-provider.h"
namespace sensor {
*
*/
-#include "sensor_provider_internal.h"
+#include "sensor-provider.h"
#include <message.h>
#include <channel.h>
#include <sensor-log-private.h>
#include <sensor-types-private.h>
-#include <sensor_utils.h>
-#include <command_types.h>
+#include <sensor-utils.h>
+#include <command-types.h>
#include <cfloat>
#include <cmath>
-#include "sensor_provider_channel_handler.h"
+#include "sensor-provider-channel-handler.h"
#define DEFAULT_RESOLUTION 0.1
*
*/
-#ifndef __SENSOR_PROVIDER_INTERNAL_H__
-#define __SENSOR_PROVIDER_INTERNAL_H__
+#ifndef __SENSOR_PROVIDER_H__
+#define __SENSOR_PROVIDER_H__
#include <channel.h>
-#include <channel_handler.h>
-#include <event_loop.h>
+#include <channel-handler.h>
+#include <event-loop.h>
#include <sensor-internal.h>
-#include <sensor_info.h>
+#include <sensor-info.h>
#include <sensor-types-private.h>
#include <map>
#include <atomic>
}
-#endif /* __SENSOR_PROVIDER_INTERNAL_H__ */
+#endif /* __SENSOR_PROVIDER_H__ */
*
*/
-#include "sensor_reader.h"
+#include "sensor-reader.h"
#include <sensor-log-private.h>
#include <sensor-types-private.h>
#define __SENSOR_READER_H__
#include <glib.h>
-#include <event_loop.h>
+#include <event-loop.h>
#include <thread>
#include <atomic>
*
*/
-#include "channel_event_handler.h"
+#include "channel-event-handler.h"
#include "channel.h"
-#include "channel_handler.h"
+#include "channel-handler.h"
#include "sensor-log-private.h"
using namespace ipc;
#include <unordered_map>
-#include "event_handler.h"
-#include "channel_handler.h"
+#include "event-handler.h"
+#include "channel-handler.h"
namespace ipc {
#include <algorithm>
#include "sensor-log-private.h"
-#include "channel_event_handler.h"
-#include "command_types.h"
+#include "channel-event-handler.h"
+#include "command-types.h"
#define SYSTEMD_SOCK_BUF_SIZE (128*1024)
#include "socket.h"
#include "message.h"
-#include "event_loop.h"
-#include "channel_handler.h"
+#include "event-loop.h"
+#include "channel-handler.h"
#include "lock.h"
namespace ipc {
#define __COMMAND_TYPES_H__
#include <sensor-types-private.h>
-#include "sensor_info.h"
+#include <sensor-info.h>
#define SENSOR_CHANNEL_PATH "/run/.sensord.socket"
#define MAX_BUF_SIZE (16*1024)
*
*/
-#include "event_loop.h"
+#include "event-loop.h"
#include <stdio.h>
#include <stdint.h>
#include <vector>
#include <queue>
-#include "channel_event_handler.h"
+#include "channel-event-handler.h"
#include "sensor-log-private.h"
-#include "event_handler.h"
+#include "event-handler.h"
#include "channel.h"
#define BAD_HANDLE 0
#include <atomic>
#include <map>
-#include "event_handler.h"
+#include "event-handler.h"
#include "lock.h"
namespace ipc {
*
*/
-#include "sensor_info.h"
+#include "sensor-info.h"
#include <sensor-types-private.h>
-#include <sensor_types_private.h>
#include <sensor-log-private.h>
+#include <sensor-utils.h>
+
#include <cfloat>
#include <algorithm>
#include <string>
#include <cmath>
-#include "sensor_utils.h"
#define MIN_RANGE -FLT_MAX
#define MAX_RANGE FLT_MAX
*
*/
-#include "sensor_utils.h"
+#include "sensor-utils.h"
#include <glib.h>
#include <unistd.h>
#include <sensor-log-private.h>
#include <sensor-types-private.h>
-#include <sensor_types_private.h>
#ifndef PATH_MAX
#define PATH_MAX 256
#ifndef __SENSOR_UTILS_H__
#define __SENSOR_UTILS_H__
-#include <time.h>
#include <sensor-types-private.h>
+
+#include <time.h>
#include <string>
#include <vector>
+++ /dev/null
-/*
- * sensord
- *
- * Copyright (c) 2017 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 __SENSOR_TYPES_PRIVATE__
-#define __SENSOR_TYPES_PRIVATE__
-
-#define URI_REGEX(CATEGORY) R"~(^http:\/\/[\w-]+(\.[\w-]+)*\/)~" CATEGORY R"~(\/(general|healthinfo)\/[\w-]+(\.[\w-]+)*(\/[\w-]+(\.[\w-]+)*)$)~"
-#define SENSOR_URI_REGEX URI_REGEX("sensor")
-
-#define PREDEFINED_TYPE_URI "http://tizen.org/sensor/"
-
-#define PRIV_DELIMITER ";"
-#define URI_DELIMITER "/"
-
-#define PRIVILEGE_HEALTHINFO_STR "healthinfo"
-#define PRIVILEGE_HEALTHINFO_URI "http://tizen.org/privilege/healthinfo"
-
-#define PRIVILEGE_LOCATION_STR "location"
-#define PRIVILEGE_LOCATION_URI "http://tizen.org/privilege/location"
-
-#define PRIVILEGE_PLATFORM_STR "platform"
-#define PRIVILEGE_PLATFORM_URI "http://tizen.org/privilege/internal/default/platform"
-
-#define URI_PRIV_INDEX 4
-#define URI_SENSOR_TYPE_INDEX 5
-
-#endif /* __SENSOR_TYPES_PRIVATE__ */