sensord: clean up sf_common.h/sensor_common.h/sensor_logs.h 45/59345/2
authorkibak.yoon <kibak.yoon@samsung.com>
Sat, 13 Feb 2016 05:42:13 +0000 (14:42 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Sat, 13 Feb 2016 05:43:21 +0000 (14:43 +0900)
- add command_common.h for command macro/struct/enum
- clean up sensor_logs.h also

Change-Id: I4241a7cf7955df79bfb54ea5fb3777da50e76adb
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
41 files changed:
src/client/CMakeLists.txt
src/client/client.cpp
src/client/command_channel.cpp
src/client/command_channel.h
src/client/reg_event_info.h
src/client/sensor_client_info.cpp
src/client/sensor_client_info.h
src/client/sensor_event_listener.cpp
src/client/sensor_event_listener.h
src/client/sensor_handle_info.h
src/server/client_info_manager.cpp
src/server/client_sensor_record.h
src/server/command_worker.cpp
src/server/command_worker.h
src/server/permission_checker.cpp
src/server/physical_sensor.h
src/server/plugins/auto_rotation/auto_rotation_sensor.cpp
src/server/plugins/fusion/fusion_sensor.cpp
src/server/plugins/gravity/gravity_sensor.cpp
src/server/plugins/linear_accel/linear_accel_sensor.cpp
src/server/plugins/orientation/orientation_sensor.cpp
src/server/plugins/rotation_vector/gaming_rv/gaming_rv_sensor.cpp
src/server/plugins/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp
src/server/plugins/rotation_vector/rv/rv_sensor.cpp
src/server/plugins/sensor_module_create.cpp.in
src/server/plugins/tilt/tilt_sensor.cpp
src/server/sensor_event_dispatcher.cpp
src/server/sensor_event_dispatcher.h
src/server/sensor_event_queue.h
src/server/sensor_usage.h
src/server/server.cpp
src/server/worker_thread.cpp
src/shared/command_common.h [moved from src/shared/sf_common.h with 71% similarity]
src/shared/cpacket.cpp
src/shared/poller.cpp
src/shared/sensor_common.h
src/shared/sensor_info.h
src/shared/sensor_internal.h
src/shared/sensor_internal_deprecated.h
src/shared/sensor_logs.cpp
src/shared/sensor_logs.h

index 80a1ddc..f002263 100644 (file)
@@ -1,7 +1,7 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(sensor CXX)
 
-SET(DEPENDENTS "vconf glib-2.0")
+SET(DEPENDENTS "vconf glib-2.0 dlog")
 SET(VERSION ${FULLVER})
 SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(EXEC_PREFIX "${CMAKE_INSTALL_PREFIX}/bin")
index e64482f..3dcf35a 100644 (file)
@@ -17,7 +17,6 @@
  *
  */
 
-#include <sf_common.h>
 #include <sensor_internal_deprecated.h>
 #include <sensor_internal.h>
 #include <sensor_event_listener.h>
@@ -63,7 +62,7 @@ void init_client(void)
 
 static void good_bye(void)
 {
-       _D("Good bye! %s\n", get_client_name());
+       DBG("Good bye! %s\n", get_client_name());
        clean_up();
 }
 
@@ -72,14 +71,14 @@ static int g_power_save_state_cb_cnt = 0;
 static void set_power_save_state_cb(void)
 {
        if (g_power_save_state_cb_cnt < 0)
-               _E("g_power_save_state_cb_cnt(%d) is wrong", g_power_save_state_cb_cnt);
+               ERR("g_power_save_state_cb_cnt(%d) is wrong", g_power_save_state_cb_cnt);
 
        ++g_power_save_state_cb_cnt;
 
        if (g_power_save_state_cb_cnt == 1) {
-               _D("Power save callback is registered");
+               DBG("Power save callback is registered");
                g_power_save_state = get_power_save_state();
-               _D("power_save_state = [%d]", g_power_save_state);
+               DBG("power_save_state = [%d]", g_power_save_state);
                vconf_notify_key_changed(VCONFKEY_PM_STATE, power_save_state_cb, NULL);
        }
 }
@@ -89,10 +88,10 @@ static void unset_power_save_state_cb(void)
        --g_power_save_state_cb_cnt;
 
        if (g_power_save_state_cb_cnt < 0)
-               _E("g_power_save_state_cb_cnt(%d) is wrong", g_power_save_state_cb_cnt);
+               ERR("g_power_save_state_cb_cnt(%d) is wrong", g_power_save_state_cb_cnt);
 
        if (g_power_save_state_cb_cnt == 0) {
-               _D("Power save callback is unregistered");
+               DBG("Power save callback is unregistered");
                vconf_ignore_key_changed(VCONFKEY_PM_STATE, power_save_state_cb);
        }
 }
@@ -106,7 +105,7 @@ static void clean_up(void)
        auto it_handle = handles.begin();
 
        while (it_handle != handles.end()) {
-               sf_disconnect(*it_handle);
+               sensord_disconnect(*it_handle);
                ++it_handle;
        }
 }
@@ -136,12 +135,12 @@ static void power_save_state_cb(keynode_t *node, void *data)
        cur_power_save_state = get_power_save_state();
 
        if (cur_power_save_state == g_power_save_state) {
-               _T("g_power_save_state NOT changed : [%d]", cur_power_save_state);
+               DBG("g_power_save_state NOT changed : [%d]", cur_power_save_state);
                return;
        }
 
        g_power_save_state = cur_power_save_state;
-       _D("power_save_state: %d noti to %s", g_power_save_state, get_client_name());
+       DBG("power_save_state: %d noti to %s", g_power_save_state, get_client_name());
 
        client_info.get_listening_sensors(sensors);
 
@@ -162,7 +161,7 @@ static void restore_session(void)
 {
        AUTOLOCK(lock);
 
-       _I("Trying to restore session for %s", get_client_name());
+       INFO("Trying to restore session for %s", get_client_name());
 
        command_channel *cmd_channel;
        int client_id;
@@ -183,7 +182,7 @@ static void restore_session(void)
                retm_if (!cmd_channel, "Failed to allocate memory");
 
                if (!cmd_channel->create_channel()) {
-                       _E("%s failed to create command channel for %s", get_client_name(), get_sensor_name(*it_sensor));
+                       ERR("%s failed to create command channel for %s", get_client_name(), get_sensor_name(*it_sensor));
                        delete cmd_channel;
                        goto FAILED;
                }
@@ -193,7 +192,7 @@ static void restore_session(void)
                if (first_connection) {
                        first_connection = false;
                        if (!cmd_channel->cmd_get_id(client_id)) {
-                               _E("Failed to get client id");
+                               ERR("Failed to get client id");
                                goto FAILED;
                        }
 
@@ -204,7 +203,7 @@ static void restore_session(void)
                cmd_channel->set_client_id(client_id);
 
                if (!cmd_channel->cmd_hello(*it_sensor)) {
-                       _E("Sending cmd_hello(%s, %d) failed for %s", get_sensor_name(*it_sensor), client_id, get_client_name());
+                       ERR("Sending cmd_hello(%s, %d) failed for %s", get_sensor_name(*it_sensor), client_id, get_client_name());
                        goto FAILED;
                }
 
@@ -215,20 +214,20 @@ static void restore_session(void)
 
                client_info.get_sensor_rep(*it_sensor, cur_rep);
                if (!change_sensor_rep(*it_sensor, prev_rep, cur_rep)) {
-                       _E("Failed to change rep(%s) for %s", get_sensor_name(*it_sensor), get_client_name());
+                       ERR("Failed to change rep(%s) for %s", get_sensor_name(*it_sensor), get_client_name());
                        goto FAILED;
                }
 
                ++it_sensor;
        }
 
-       _I("Succeeded to restore session for %s", get_client_name());
+       INFO("Succeeded to restore session for %s", get_client_name());
 
        return;
 
 FAILED:
        event_listener.clear();
-       _E("Failed to restore session for %s", get_client_name());
+       ERR("Failed to restore session for %s", get_client_name());
 }
 
 static bool get_events_diff(event_type_vector &a_vec, event_type_vector &b_vec, event_type_vector &add_vec, event_type_vector &del_vec)
index 888503d..06cb549 100644 (file)
@@ -20,7 +20,7 @@
 #include <stdlib.h>
 #include <command_channel.h>
 #include <client_common.h>
-#include <sf_common.h>
+#include <command_common.h>
 #include <sensor_info.h>
 #include <sensor_info_manager.h>
 
index 439ace6..f205106 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef _COMMAND_CHANNEL_H_
 #define _COMMAND_CHANNEL_H_
 
-#include <sf_common.h>
+#include <command_common.h>
 #include <sensor_internal.h>
 #include <cpacket.h>
 #include <csocket.h>
index 44d8937..18e1335 100644 (file)
@@ -20,8 +20,8 @@
 #ifndef _REG_EVENT_INFO_H_
 #define _REG_EVENT_INFO_H_
 
-#include <sensor_internal.h>
-#include <sf_common.h>
+#include <glib.h>
+#include <sensor_common.h>
 
 typedef enum {
        SENSOR_EVENT_CB,
index bdae177..1e2c12c 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <sensor_event_listener.h>
 #include <client_common.h>
-#include <sf_common.h>
 #include <sensor_info_manager.h>
 
 #include <thread>
index 9569f61..b408356 100644 (file)
@@ -25,7 +25,6 @@
 #include <unistd.h>
 #include <csocket.h>
 #include <string.h>
-#include <sf_common.h>
 #include <algorithm>
 #include <sstream>
 #include <unordered_map>
index 028b8f2..6d62eb5 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <sensor_event_listener.h>
 #include <client_common.h>
-#include <sf_common.h>
 #include <sensor_info_manager.h>
 
 #include <thread>
@@ -472,12 +471,12 @@ void sensor_event_listener::stop_event_listener(void)
        if (m_thread_state != THREAD_STATE_TERMINATE) {
                m_thread_state = THREAD_STATE_STOP;
 
-               _D("%s is waiting listener thread[state: %d] to be terminated", get_client_name(), m_thread_state);
+               DBG("%s is waiting listener thread[state: %d] to be terminated", get_client_name(), m_thread_state);
                if (m_thread_cond.wait_for(u, std::chrono::seconds(THREAD_TERMINATING_TIMEOUT))
                        == std::cv_status::timeout)
-                       _E("Fail to stop listener thread after waiting %d seconds", THREAD_TERMINATING_TIMEOUT);
+                       ERR("Fail to stop listener thread after waiting %d seconds", THREAD_TERMINATING_TIMEOUT);
                else
-                       _D("Listener thread for %s is terminated", get_client_name());
+                       DBG("Listener thread for %s is terminated", get_client_name());
        }
 }
 
index 317f527..d9fc2f8 100644 (file)
@@ -37,7 +37,6 @@
 #include <cmutex.h>
 #include <poller.h>
 
-#include <sf_common.h>
 #include <sensor_handle_info.h>
 #include <sensor_client_info.h>
 #include <command_channel.h>
index 2af4d95..e70c386 100644 (file)
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <unordered_map>
 #include <glib.h>
+#include <sensor_internal.h>
 
 typedef std::unordered_map<unsigned int,reg_event_info> event_info_map;
 
index 52308ff..037e9a1 100644 (file)
@@ -17,6 +17,7 @@
  *
  */
 
+#include <command_common.h>
 #include <client_info_manager.h>
 #include <sensor_logs.h>
 #include <csocket.h>
index d6968e9..cad13f4 100644 (file)
@@ -21,7 +21,6 @@
 #define _CLIENT_SENSOR_RECORD_H_
 
 #include <sensor_internal.h>
-#include <sf_common.h>
 #include <sensor_usage.h>
 #include <csocket.h>
 #include <unordered_map>
index 7407310..b6491ab 100644 (file)
@@ -17,7 +17,7 @@
  *
  */
 
-#include <command_worker.h>
+#include <command_common.h>
 #include <sensor_loader.h>
 #include <sensor_info.h>
 #include <sensor_types.h>
@@ -25,8 +25,9 @@
 #include <string>
 #include <vector>
 #include <utility>
-#include <permission_checker.h>
 #include <set>
+#include <permission_checker.h>
+#include <command_worker.h>
 
 using std::string;
 using std::vector;
index 8323571..f455cb6 100644 (file)
@@ -20,6 +20,7 @@
 #ifndef _COMMAND_WORKER_H_
 #define _COMMAND_WORKER_H_
 
+#include <command_common.h>
 #include <worker_thread.h>
 #include <client_info_manager.h>
 #include <sensor_event_dispatcher.h>
index aa700b8..5a06dd9 100644 (file)
@@ -21,7 +21,6 @@
 #include <cynara-creds-socket.h>
 #include <cynara-session.h>
 #include <permission_checker.h>
-#include <sf_common.h>
 #include <sensor_logs.h>
 #include <sensor_loader.h>
 #include <sensor_base.h>
index c59ce89..32cfa38 100644 (file)
@@ -21,7 +21,6 @@
 #define _PHYSICAL_SENSOR_H_
 
 #include <sensor_base.h>
-#include <sf_common.h>
 #include <worker_thread.h>
 
 class physical_sensor : public sensor_base {
index d8b1700..fbff5d5 100644 (file)
@@ -27,7 +27,6 @@
 #include <dlfcn.h>
 
 #include <sensor_logs.h>
-#include <sf_common.h>
 
 #include <virtual_sensor.h>
 #include <auto_rotation_sensor.h>
index 49d3f9e..98db53c 100644 (file)
@@ -26,7 +26,6 @@
 #include <sys/types.h>
 #include <dlfcn.h>
 #include <sensor_logs.h>
-#include <sf_common.h>
 #include <fusion_sensor.h>
 #include <sensor_loader.h>
 #include <orientation_filter.h>
index b39218f..390169f 100644 (file)
@@ -26,7 +26,6 @@
 #include <sys/types.h>
 #include <dlfcn.h>
 #include <sensor_logs.h>
-#include <sf_common.h>
 #include <gravity_sensor.h>
 #include <sensor_loader.h>
 #include <virtual_sensor_config.h>
index 3c194f3..93f4086 100644 (file)
@@ -26,7 +26,6 @@
 #include <sys/types.h>
 #include <dlfcn.h>
 #include <sensor_logs.h>
-#include <sf_common.h>
 #include <linear_accel_sensor.h>
 #include <sensor_loader.h>
 #include <virtual_sensor_config.h>
index 2775c4c..911b7f3 100644 (file)
@@ -26,7 +26,6 @@
 #include <sys/types.h>
 #include <dlfcn.h>
 #include <sensor_logs.h>
-#include <sf_common.h>
 #include <orientation_sensor.h>
 #include <sensor_loader.h>
 #include <orientation_filter.h>
index ac19b63..4d022c7 100644 (file)
@@ -26,7 +26,6 @@
 #include <sys/types.h>
 #include <dlfcn.h>
 #include <sensor_logs.h>
-#include <sf_common.h>
 #include <gaming_rv_sensor.h>
 #include <sensor_loader.h>
 #include <orientation_filter.h>
index 43abcf2..6f1e606 100644 (file)
@@ -26,7 +26,6 @@
 #include <sys/types.h>
 #include <dlfcn.h>
 #include <sensor_logs.h>
-#include <sf_common.h>
 #include <geomagnetic_rv_sensor.h>
 #include <sensor_loader.h>
 #include <orientation_filter.h>
index 3a98182..f00ffef 100644 (file)
@@ -26,7 +26,6 @@
 #include <sys/types.h>
 #include <dlfcn.h>
 #include <sensor_logs.h>
-#include <sf_common.h>
 #include <rv_sensor.h>
 #include <sensor_loader.h>
 #include <orientation_filter.h>
index 780461b..576fdf6 100644 (file)
@@ -59,8 +59,6 @@
 #include <rv_raw_sensor.h>
 #endif
 
-#include <sf_common.h>
-
 extern "C" sensor_module* create(void)
 {
        sensor_module *module = new(std::nothrow) sensor_module;
index ef1a088..cab3520 100644 (file)
@@ -26,7 +26,6 @@
 #include <sys/types.h>
 #include <dlfcn.h>
 #include <sensor_logs.h>
-#include <sf_common.h>
 #include <tilt_sensor.h>
 #include <sensor_loader.h>
 #include <orientation_filter.h>
index 1db1c3a..f29a668 100644 (file)
@@ -17,9 +17,9 @@
  *
  */
 
+#include <command_common.h>
 #include <sensor_event_dispatcher.h>
 #include <sensor_logs.h>
-#include <sf_common.h>
 #include <thread>
 
 using std::thread;
@@ -137,7 +137,6 @@ void sensor_event_dispatcher::dispatch_event(void)
 
        while (true) {
                void *seed_event = get_event_queue().pop();
-               unsigned int event_type = *((unsigned int *)(seed_event));
 
                vector<void *> sensor_events;
                sensor_events.push_back(seed_event);
index cd38f97..befa90e 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef _SENSOR_EVENT_DISPATCHER_H_
 #define _SENSOR_EVENT_DISPATCHER_H_
 
-#include <sf_common.h>
 #include <sensor_event_queue.h>
 #include <client_info_manager.h>
 #include <csocket.h>
index 28bf69e..ba9decb 100644 (file)
 #ifndef _SENSOR_EVENT_QUEUE_H_
 #define _SENSOR_EVENT_QUEUE_H_
 
-#include <sf_common.h>
 #include <cstring>
 #include <utility>
 #include <queue>
 #include <mutex>
 #include <condition_variable>
 #include <set>
+#include <sensor_common.h>
 
 extern std::set<unsigned int> priority_list;
 
index 7e6d3ac..59165e4 100644 (file)
@@ -20,7 +20,6 @@
 #ifndef _SENSOR_USAGE_H_
 #define _SENSOR_USAGE_H_
 
-#include <sf_common.h>
 #include <algorithm>
 #include <vector>
 
index 8f572bc..ad28539 100644 (file)
@@ -20,6 +20,7 @@
 #include <systemd/sd-daemon.h>
 #include <server.h>
 #include <sensor_loader.h>
+#include <command_common.h>
 #include <command_worker.h>
 #include <thread>
 #include <sys/epoll.h>
index 2726706..e6e7d4a 100644 (file)
@@ -41,7 +41,7 @@ bool worker_thread::transition_function(trans_func_index index)
 {
        if (m_trans_func[index] != NULL) {
                if(!m_trans_func[index](m_context)) {
-                       _T("Transition[%d] function returning false", index);
+                       ERR("Transition[%d] function returning false", index);
                        return false;
                }
        }
@@ -61,7 +61,7 @@ bool worker_thread::start(void)
        lock l(m_mutex);
 
        if (m_state == WORKER_STATE_WORKING) {
-               _T("Worker thread is already working");
+               INFO("Worker thread is already working");
                return true;
        }
 
@@ -79,7 +79,7 @@ bool worker_thread::start(void)
                return true;
        }
 
-       _T("Failed to start, because current state(%d) is not for START", m_state);
+       ERR("Failed to start, because current state(%d) is not for START", m_state);
 
        return false;
 }
@@ -89,7 +89,7 @@ bool worker_thread::stop(void)
        lock l(m_mutex);
 
        if (m_state == WORKER_STATE_STOPPED) {
-               _T("Worker thread is already stopped");
+               INFO("Worker thread is already stopped");
                return true;
        }
 
@@ -102,7 +102,7 @@ bool worker_thread::stop(void)
                return true;
        }
 
-       _T("Failed to stop, because current state(%d) is not for STOP", m_state);
+       ERR("Failed to stop, because current state(%d) is not for STOP", m_state);
        return false;
 }
 
@@ -111,7 +111,7 @@ bool worker_thread::pause(void)
        lock l(m_mutex);
 
        if (m_state == WORKER_STATE_PAUSED) {
-               _T("Worker thread is already paused");
+               INFO("Worker thread is already paused");
                return true;
        }
 
@@ -120,7 +120,7 @@ bool worker_thread::pause(void)
                return true;
        }
 
-       _T("Failed to pause, because current state(%d) is not for PAUSE", m_state);
+       ERR("Failed to pause, because current state(%d) is not for PAUSE", m_state);
 
        return false;
 
@@ -131,7 +131,7 @@ bool worker_thread::resume(void)
        lock l(m_mutex);
 
        if (m_state == WORKER_STATE_WORKING) {
-               _T("Worker thread is already working");
+               INFO("Worker thread is already working");
                return true;
        }
 
@@ -141,7 +141,7 @@ bool worker_thread::resume(void)
                return true;
        }
 
-       _T("Failed to resume, because current state(%d) is not for RESUME", m_state);
+       ERR("Failed to resume, because current state(%d) is not for RESUME", m_state);
        return false;
 }
 
@@ -153,7 +153,7 @@ bool worker_thread::resume(void)
 
 void worker_thread::main(void)
 {
-       _T("Worker thread(0x%x) is created", std::this_thread::get_id());
+       DBG("Worker thread(0x%x) is created", std::this_thread::get_id());
 
        transition_function(STARTED);
 
@@ -164,7 +164,7 @@ void worker_thread::main(void)
                if (state == WORKER_STATE_WORKING) {
                        if (!transition_function(WORKING)) {
                                m_state = WORKER_STATE_STOPPED;
-                               _T("Worker thread(0x%x) exits from working state", std::this_thread::get_id());
+                               DBG("Worker thread(0x%x) exits from working state", std::this_thread::get_id());
                                m_thread_created = false;
                                transition_function(STOPPED);
                                break;
@@ -177,12 +177,12 @@ void worker_thread::main(void)
                if (m_state == WORKER_STATE_PAUSED) {
                        transition_function(PAUSED);
 
-                       _T("Worker thread(0x%x) is paused", std::this_thread::get_id());
+                       DBG("Worker thread(0x%x) is paused", std::this_thread::get_id());
                        m_cond_working.wait(u);
 
                        if (m_state == WORKER_STATE_WORKING) {
                                transition_function(RESUMED);
-                               _T("Worker thread(0x%x) is resumed", std::this_thread::get_id());
+                               DBG("Worker thread(0x%x) is resumed", std::this_thread::get_id());
                        } else if (m_state == WORKER_STATE_STOPPED) {
                                m_thread_created = false;
                                transition_function(STOPPED);
@@ -194,7 +194,7 @@ void worker_thread::main(void)
                        break;
                }
        }
-       _T("Worker thread(0x%x)'s main is terminated", std::this_thread::get_id());
+       INFO("Worker thread(0x%x)'s main is terminated", std::this_thread::get_id());
 }
 
 void worker_thread::set_started(trans_func_t func)
similarity index 71%
rename from src/shared/sf_common.h
rename to src/shared/command_common.h
index 4df48eb..6fa17b4 100644 (file)
  *
  */
 
-#ifndef _SF_COMMON_H_
-#define _SF_COMMON_H_
+#ifndef _COMMAND_COMMON_H_
+#define _COMMAND_COMMON_H_
 
-#include <unistd.h>
 #include <sensor_common.h>
-#include <string>
-#include <vector>
-#include <sensor_logs.h>
 
 #define COMMAND_CHANNEL_PATH                   "/tmp/sensord_command_socket"
 #define EVENT_CHANNEL_PATH                             "/tmp/sensord_event_socket"
@@ -32,8 +28,6 @@
 #define MAX_HANDLE                     256
 #define MAX_HANDLE_REACHED     -2
 
-#define CLIENT_ID_INVALID   -1
-
 enum packet_type_t {
        CMD_NONE = 0,
        CMD_GET_ID,
@@ -55,24 +49,6 @@ enum packet_type_t {
        CMD_CNT,
 };
 
-enum sensor_state_t {
-       SENSOR_STATE_UNKNOWN = -1,
-       SENSOR_STATE_STOPPED = 0,
-       SENSOR_STATE_STARTED = 1,
-       SENSOR_STATE_PAUSED = 2
-};
-
-enum poll_interval_t {
-       POLL_100HZ_MS   = 10,
-       POLL_50HZ_MS    = 20,
-       POLL_25HZ_MS    = 40,
-       POLL_20HZ_MS    = 50,
-       POLL_10HZ_MS    = 100,
-       POLL_5HZ_MS             = 200,
-       POLL_1HZ_MS             = 1000,
-       POLL_MAX_HZ_MS  = POLL_1HZ_MS,
-};
-
 typedef struct {
        char name[NAME_MAX];
 } cmd_get_id_t;
@@ -160,24 +136,6 @@ typedef struct {
        int client_id;
 } event_channel_ready_t;
 
-typedef struct sensor_event_t {
-       unsigned int event_type;
-       sensor_id_t sensor_id;
-       unsigned int data_length;
-       sensor_data_t *data;
-} sensor_event_t;
-
 typedef void *(*cmd_func_t)(void *data, void *cb_data);
 
-typedef std::vector<unsigned int> event_type_vector;
-
-enum sensor_permission_t {
-       SENSOR_PERMISSION_NONE  = 0,
-       SENSOR_PERMISSION_STANDARD = (1 << 0),
-       SENSOR_PERMISSION_BIO   =  (1 << 1),
-};
-
-#define BIO_SENSOR_PRIVELEGE_NAME "sensord::bio"
-#define BIO_SENSOR_ACCESS_RIGHT "rw"
-
-#endif /* _SF_COMMON_H_ */
+#endif /* _COMMAND_COMMON_H_ */
index 8e680b0..6cb6e8c 100644 (file)
@@ -23,7 +23,7 @@
 #include <new>
 #include <sensor_logs.h>
 #include <cpacket.h>
-#include <sf_common.h>
+#include <command_common.h>
 
 cpacket::cpacket()
 {
index 2fb902b..aaa43fe 100644 (file)
  * limitations under the License.
  *
  */
+#include <errno.h>
+#include <string.h>
 #include <sensor_logs.h>
 #include <poller.h>
-#include <sf_common.h>
 
 #define EPOLL_MAX 32
 
index 2edc306..abbb21c 100644 (file)
 #include <sensor_types.h>
 #include <stdint.h>
 
-#ifndef DEPRECATED
-#define DEPRECATED __attribute__((deprecated))
+#define CLIENT_ID_INVALID   -1
+
+#ifndef NAME_MAX
+#define NAME_MAX 256
 #endif
 
 #ifdef __cplusplus
@@ -46,11 +48,6 @@ typedef int64_t sensor_id_t;
 
 typedef void *sensor_t;
 
-typedef enum {
-       SENSOR_PRIVILEGE_PUBLIC,
-       SENSOR_PRIVILEGE_INTERNAL,
-} sensor_privilege_t;
-
 /*
  *     To prevent naming confliction as using same enums as sensor CAPI use
  */
@@ -66,22 +63,26 @@ enum sensor_option_t {
 typedef enum sensor_option_t sensor_option_e;
 #endif
 
-/*
- *     To prevent naming confliction as using same enums as sensor CAPI use
- */
-#ifndef __SENSOR_H__
 enum sensor_wakeup_t {
        SENSOR_WAKEUP_UNKNOWN = -1,
        SENSOR_WAKEUP_OFF = 0,
        SENSOR_WAKEUP_ON = 1,
 };
 
-typedef enum sensor_wakeup_t sensor_wakeup_e;
-#endif
+enum poll_interval_t {
+       POLL_100HZ_MS   = 10,
+       POLL_50HZ_MS    = 20,
+       POLL_25HZ_MS    = 40,
+       POLL_20HZ_MS    = 50,
+       POLL_10HZ_MS    = 100,
+       POLL_5HZ_MS             = 200,
+       POLL_1HZ_MS             = 1000,
+       POLL_MAX_HZ_MS  = POLL_1HZ_MS,
+};
 
 enum sensor_interval_t {
-       SENSOR_INTERVAL_FASTEST = 0,
-       SENSOR_INTERVAL_NORMAL = 200,
+       SENSOR_INTERVAL_FASTEST = POLL_100HZ_MS,
+       SENSOR_INTERVAL_NORMAL = POLL_5HZ_MS,
 };
 
 typedef enum {
@@ -91,9 +92,39 @@ typedef enum {
        CONDITION_LESS_THAN,
 } condition_op_t;
 
+enum sensor_state_t {
+       SENSOR_STATE_UNKNOWN = -1,
+       SENSOR_STATE_STOPPED = 0,
+       SENSOR_STATE_STARTED = 1,
+       SENSOR_STATE_PAUSED = 2
+};
+
+typedef enum {
+       SENSOR_PRIVILEGE_PUBLIC,
+       SENSOR_PRIVILEGE_INTERNAL,
+} sensor_privilege_t;
+
+enum sensor_permission_t {
+       SENSOR_PERMISSION_NONE = 0,
+       SENSOR_PERMISSION_STANDARD = (1 << 0),
+       SENSOR_PERMISSION_BIO = (1 << 1)
+};
+
+typedef struct sensor_event_t {
+       unsigned int event_type;
+       sensor_id_t sensor_id;
+       unsigned int data_length;
+       sensor_data_t *data;
+} sensor_event_t;
+
 #ifdef __cplusplus
 }
 #endif
 
+#ifdef __cplusplus
+#include <vector>
+
+typedef std::vector<unsigned int> event_type_vector;
+#endif
 
 #endif /* __SENSOR_COMMON_H__ */
index 61a3cfb..536c6f9 100644 (file)
@@ -21,7 +21,6 @@
 #define _SENSOR_INFO_H_
 
 #include <stdint.h>
-#include <sf_common.h>
 #include <sensor_common.h>
 #include <sensor_types.h>
 #include <string>
index 0a3d85a..d5b495f 100644 (file)
 #ifndef __SENSOR_INTERNAL_H__
 #define __SENSOR_INTERNAL_H__
 
-#ifndef DEPRECATED
-#define DEPRECATED __attribute__((deprecated))
-#endif
-
 #ifndef API
 #define API __attribute__((visibility("default")))
 #endif
index 4a6948c..a2c05bd 100644 (file)
@@ -79,13 +79,13 @@ typedef struct {
        float sensor_resolution;
 } sensor_data_properties_t;
 
-int sf_is_sensor_event_available(sensor_type_t sensor_type , unsigned int event_type);
+DEPRECATED int sf_is_sensor_event_available(sensor_type_t sensor_type , unsigned int event_type);
 
-int sf_get_data_properties(unsigned int data_id, sensor_data_properties_t *return_data_properties);
+DEPRECATED int sf_get_data_properties(unsigned int data_id, sensor_data_properties_t *return_data_properties);
 
-int sf_get_properties(sensor_type_t sensor_type, sensor_properties_t *return_properties);
+DEPRECATED int sf_get_properties(sensor_type_t sensor_type, sensor_properties_t *return_properties);
 
-int sf_check_rotation(unsigned long *rotation);
+DEPRECATED int sf_check_rotation(unsigned long *rotation);
 
 /**
  * @fn int sf_connect(sensor_type_t sensor)
@@ -93,7 +93,7 @@ int sf_check_rotation(unsigned long *rotation);
  * @param[in] sensor_type your desired sensor type
  * @return if it succeed, it return handle value( >=0 ) , otherwise negative value return
  */
-int sf_connect(sensor_type_t sensor_type);
+DEPRECATED int sf_connect(sensor_type_t sensor_type);
 
 /**
  * @fn int sf_disconnect(int handle)
@@ -101,7 +101,7 @@ int sf_connect(sensor_type_t sensor_type);
  * @param[in] handle received handle value by sf_connect()
  * @return if it succeed, it return zero value , otherwise negative value return
  */
-int sf_disconnect(int handle);
+DEPRECATED int sf_disconnect(int handle);
 
 /**
  * @fn int sf_start(int handle , int option)
@@ -110,7 +110,7 @@ int sf_disconnect(int handle);
  * @param[in] option With SENSOR_OPTION_DEFAULT, it stops to sense when LCD is off, and with SENSOR_OPTION_ALWAYS_ON, it continues to sense even when LCD is off
  * @return if it succeed, it return zero value , otherwise negative value return
  */
-int sf_start(int handle , int option);
+DEPRECATED int sf_start(int handle , int option);
 
 /**
  * @fn int sf_stop(int handle)
@@ -118,7 +118,7 @@ int sf_start(int handle , int option);
  * @param[in] handle received handle value by sf_connect()
  * @return if it succeed, it return zero value , otherwise negative value return
  */
-int sf_stop(int handle);
+DEPRECATED int sf_stop(int handle);
 
 /**
  * @fn int sf_register_event(int handle , unsigned int event_type , event_conditon_t *event_condition , sensor_callback_func_t cb , void *user_data )
@@ -130,7 +130,7 @@ int sf_stop(int handle);
  * @param[in] user_data        your option data that will be send when your define callback function called. if you don't have any option data, just use a NULL value
  * @return if it succeed, it return zero value , otherwise negative value return
  */
-int sf_register_event(int handle , unsigned int event_type , event_condition_t *event_condition , sensor_callback_func_t cb , void *user_data );
+DEPRECATED int sf_register_event(int handle , unsigned int event_type , event_condition_t *event_condition , sensor_callback_func_t cb , void *user_data );
 
 /**
  * @fn int sf_unregister_event(int handle, unsigned int event_type)
@@ -139,7 +139,7 @@ int sf_register_event(int handle , unsigned int event_type , event_condition_t *
  * @param[in] event_type your desired event_type that you want to unregister event
  * @return if it succeed, it return zero value , otherwise negative value return
  */
-int sf_unregister_event(int handle, unsigned int event_type);
+DEPRECATED int sf_unregister_event(int handle, unsigned int event_type);
 
 /**
  * @fn int sf_get_data(int handle , unsigned int data_id , sensor_data_t* values)
@@ -149,7 +149,7 @@ int sf_unregister_event(int handle, unsigned int event_type);
  * @param[out] values return values
  * @return if it succeed, it return zero value , otherwise negative value return
  */
-int sf_get_data(int handle , unsigned int data_id , sensor_data_t* values);
+DEPRECATED int sf_get_data(int handle , unsigned int data_id , sensor_data_t* values);
 
 /**
  * @fn int sf_change_event_condition(int handle, unsigned int event_type, event_condition_t *event_condition)
@@ -159,7 +159,7 @@ int sf_get_data(int handle , unsigned int data_id , sensor_data_t* values);
  * @param[in] event_condition your desired event condition that you want to change event
  * @return if it succeed, it return zero value , otherwise negative value return
  */
-int sf_change_event_condition(int handle, unsigned int event_type, event_condition_t *event_condition);
+DEPRECATED int sf_change_event_condition(int handle, unsigned int event_type, event_condition_t *event_condition);
 
 /**
  * @fn int sf_change_sensor_option(int handle, int option)
@@ -169,7 +169,7 @@ int sf_change_event_condition(int handle, unsigned int event_type, event_conditi
  * @return if it succeed, it return zero value , otherwise negative value return
  */
 
-int sf_change_sensor_option(int handle, int option);
+DEPRECATED int sf_change_sensor_option(int handle, int option);
 
 /**
  * @fn int sf_send_sensorhub_data(int handle, const char* buffer, int data_len)
@@ -179,7 +179,7 @@ int sf_change_sensor_option(int handle, int option);
  * @param[in] data_len the length of data
  * @return if it succeed, it returns zero, otherwise negative value
  */
-int sf_send_sensorhub_data(int handle, const char* data, int data_len);
+DEPRECATED int sf_send_sensorhub_data(int handle, const char* data, int data_len);
 
 
 #ifdef __cplusplus
index 5426c0f..e98e41b 100644 (file)
@@ -17,7 +17,6 @@
  *
  */
 
-#include <syslog.h>
 #include <fcntl.h>
 #include <stdio.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <string.h>
 #include <dlog.h>
-#include <stdarg.h>
-#include <stddef.h>
+#include <sensor_common.h>
 #include "sensor_logs.h"
 
-#ifndef EXTAPI
-#define EXTAPI __attribute__((visibility("default")))
-#endif
-
-#define SF_SERVER_MSG_LOG_FILE         "/var/log/messages"
-#define FILE_LENGTH 255
-
-static int sf_debug_file_fd;
-static char sf_debug_file_buf[FILE_LENGTH];
-
-EXTAPI void sf_log(int type , int priority , const char *tag , const char *fmt , ...)
-{
-       va_list ap;
-       va_start(ap, fmt);
-
-       switch (type) {
-               case SF_LOG_PRINT_FILE:
-                       sf_debug_file_fd = open(SF_SERVER_MSG_LOG_FILE, O_WRONLY|O_CREAT|O_APPEND, 0644);
-                       if (sf_debug_file_fd != -1) {
-                               vsnprintf(sf_debug_file_buf,255, fmt , ap );
-                               int total_bytes_written = 0;
-                               while (total_bytes_written < (int) strlen(sf_debug_file_buf)){
-                                       int bytes_written = write(sf_debug_file_fd, (sf_debug_file_buf + total_bytes_written), strlen(sf_debug_file_buf) - total_bytes_written);
-                                       if (bytes_written == -1)
-                                               break;
-                                       total_bytes_written = total_bytes_written + bytes_written;
-                               }
-                               close(sf_debug_file_fd);
-                       }
-                       break;
-
-               case SF_LOG_SYSLOG:
-                       int syslog_prio;
-                       switch (priority) {
-                               case SF_LOG_ERR:
-                                       syslog_prio = LOG_ERR|LOG_DAEMON;
-                                       break;
-                               case SF_LOG_WARN:
-                                       syslog_prio = LOG_WARNING|LOG_DAEMON;
-                                       break;
-
-                               case SF_LOG_DBG:
-                                       syslog_prio = LOG_DEBUG|LOG_DAEMON;
-                                       break;
-
-                               case SF_LOG_INFO:
-                                       syslog_prio = LOG_INFO|LOG_DAEMON;
-                                       break;
-
-                               default:
-                                       syslog_prio = priority;
-                                       break;
-                       }
-
-                       vsyslog(syslog_prio, fmt, ap);
-                       break;
-
-               case SF_LOG_DLOG:
-                       if (tag) {
-                               switch (priority) {
-                                       case SF_LOG_ERR:
-                                               SLOG_VA(LOG_ERROR, tag ? tag : "NULL" , fmt ? fmt : "NULL" , ap);
-                                               break;
-
-                                       case SF_LOG_WARN:
-                                               SLOG_VA(LOG_WARN, tag ? tag : "NULL" , fmt ? fmt : "NULL" , ap);
-                                               break;
-
-                                       case SF_LOG_DBG:
-                                               SLOG_VA(LOG_DEBUG, tag ? tag : "NULL", fmt ? fmt : "NULL" , ap);
-                                               break;
-
-                                       case SF_LOG_INFO:
-                                               SLOG_VA(LOG_INFO, tag ? tag : "NULL" , fmt ? fmt : "NULL" , ap);
-                                               break;
-                               }
-                       }
-                       break;
-       }
-
-       va_end(ap);
-}
+#define PATH_MAX 256
 
 #if defined(_DEBUG)
 bool get_proc_name(pid_t pid, char *process_name)
index 70b10fa..aa01eb7 100644 (file)
 #ifndef _SENSOR_LOGS_H_
 #define _SENSOR_LOGS_H_
 
-#ifndef __cplusplus
-#include <stdbool.h>
-#endif /* !__cplusplus */
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
+#include <dlog.h>
 #include <sys/types.h>
-#include <unistd.h>
-
-#if !defined(PATH_MAX)
-#define PATH_MAX 256
-#endif
-
-#if !defined(NAME_MAX)
-#define NAME_MAX 256
-#endif
-
 
 #define EVENT_TYPE_SHIFT 16
 #define SENSOR_TYPE_SHIFT 32
 
-#define USE_DLOG_LOG
-
-enum sf_log_type {
-       SF_LOG_PRINT_FILE               = 1,
-       SF_LOG_SYSLOG                   = 2,
-       SF_LOG_DLOG                     = 3,
-};
-
-enum sf_priority_type {
-       SF_LOG_ERR                      = 1,
-       SF_LOG_DBG                      = 2,
-       SF_LOG_INFO                     = 3,
-       SF_LOG_WARN                     = 4,
-};
-
-void sf_log(int type , int priority , const char *tag , const char *fmt , ...);
-
 #define MICROSECONDS(tv)        ((tv.tv_sec * 1000000ll) + tv.tv_usec)
 
-#ifndef __MODULE__
-#include <string.h>
-#define __MODULE__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
-#endif
-
-//for new log system - dlog
 #ifdef LOG_TAG
        #undef LOG_TAG
 #endif
 #define LOG_TAG        "SENSOR"
 
-#if defined(_DEBUG) || defined(USE_FILE_DEBUG)
-
-#define DbgPrint(fmt, arg...)   do { sf_log(SF_LOG_PRINT_FILE, 0, LOG_TAG , " [SF_MSG_PRT][%s:%d] " fmt"\n",__MODULE__, __LINE__, ##arg); } while(0)
-
-#endif
-
-#if defined(USE_SYSLOG_DEBUG)
-
-#define ERR(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_ERR, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define WARN(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_WARN, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define INFO(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_INFO, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define DBG(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_DBG, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-
-#define _E(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_ERR, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define _W(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_WARN, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define _I(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_INFO, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define _D(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_DBG, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define _T(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_DBG, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-
-
-#elif defined(_DEBUG) || defined(USE_DLOG_DEBUG)
-
-#define ERR(fmt, arg...) do { sf_log(SF_LOG_DLOG, SF_LOG_ERR, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define WARN(fmt, arg...) do { sf_log(SF_LOG_DLOG, SF_LOG_WARN, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define INFO(fmt, arg...) do { sf_log(SF_LOG_DLOG, SF_LOG_INFO, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define DBG(fmt, arg...) do { sf_log(SF_LOG_DLOG, SF_LOG_DBG, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-
-#define _E(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_ERR, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define _W(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_WARN, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define _I(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_INFO, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define _D(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_DBG, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define _T(fmt, arg...) do { sf_log(SF_LOG_SYSLOG, SF_LOG_DBG, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-
-#elif defined(USE_FILE_DEBUG)
-
-#define ERR(fmt, arg...)       do { sf_log(SF_LOG_PRINT_FILE, 0, LOG_TAG, "[SF_MSG_ERR][%s:%d] " fmt"\n",__MODULE__, __LINE__, ##arg); } while(0)
-#define WARN(fmt, arg...)      do { sf_log(SF_LOG_PRINT_FILE, 0, LOG_TAG, "[SF_MSG_WARN][%s:%d] " fmt"\n",__MODULE__, __LINE__, ##arg); } while(0)
-#define DBG(fmt, arg...)       do { sf_log(SF_LOG_PRINT_FILE, 0, LOG_TAG, "[SF_MSG_DBG][%s:%d] " fmt"\n",__MODULE__, __LINE__, ##arg); } while(0)
-#define INFO(fmt, arg...)      do { sf_log(SF_LOG_PRINT_FILE, 0, LOG_TAG, "[SF_MSG_INFO][%s:%d] " fmt"\n",__MODULE__, __LINE__, ##arg); } while(0)
-
-#define _E(fmt, arg...)        do { sf_log(SF_LOG_PRINT_FILE, 0, LOG_TAG ,"[SF_MSG_ERR][%s:%d] " fmt"\n",__MODULE__, __LINE__, ##arg); } while(0)
-#define _W(fmt, arg...)        do { sf_log(SF_LOG_PRINT_FILE, 0, LOG_TAG ,"[SF_MSG_WARN][%s:%d] " fmt"\n",__MODULE__, __LINE__, ##arg); } while(0)
-#define _I(fmt, arg...)        do { sf_log(SF_LOG_PRINT_FILE, 0, LOG_TAG ,"[SF_MSG_INFO][%s:%d] " fmt"\n",__MODULE__, __LINE__, ##arg); } while(0)
-#define _D(fmt, arg...)        do { sf_log(SF_LOG_PRINT_FILE, 0, LOG_TAG ,"[SF_MSG_DBG][%s:%d] " fmt"\n",__MODULE__, __LINE__, ##arg); } while(0)
-#define _T(fmt, arg...)        do { sf_log(SF_LOG_PRINT_FILE, 0, LOG_TAG ,"[SF_MSG_TEMP][%s:%d] " fmt"\n",__MODULE__, __LINE__, ##arg); } while(0)
-
-#elif defined(USE_DLOG_LOG)
-
-#define ERR(fmt, arg...) do { sf_log(SF_LOG_DLOG, SF_LOG_ERR, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define WARN(fmt, arg...) do { sf_log(SF_LOG_DLOG, SF_LOG_WARN, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define INFO(fmt, arg...) do { sf_log(SF_LOG_DLOG, SF_LOG_INFO, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-
-#define DBG(...) do{} while(0)
-#define DbgPrint(...) do{} while(0)
-
-
-#define _E(fmt, arg...) do { sf_log(SF_LOG_DLOG, SF_LOG_ERR, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define _W(fmt, arg...) do { sf_log(SF_LOG_DLOG, SF_LOG_WARN, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define _I(fmt, arg...) do { sf_log(SF_LOG_DLOG, SF_LOG_INFO, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define _D(fmt, arg...) do { sf_log(SF_LOG_DLOG, SF_LOG_DBG, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define _T(...)
-
+#ifdef _DEBUG
+#define DBG SLOGD
 #else
-#define ERR(fmt, arg...) do { sf_log(SF_LOG_DLOG, SF_LOG_ERR, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define WARN(...) do{} while(0)
-#define DbgPrint(...) do{} while(0)
 #define DBG(...) do{} while(0)
-#define INFO(...) do{} while(0)
-
-#define _E(fmt, arg...) do { sf_log(SF_LOG_DLOG, SF_LOG_ERR, LOG_TAG, "%s:%s(%d)> " fmt, __MODULE__, __func__, __LINE__, ##arg); } while(0)
-#define _W(...) do{} while(0)
-#define _I(...) do{} while(0)
-#define _D(...) do{} while(0)
-#define _T(...) do{} while(0)
-
 #endif
 
+#define ERR SLOGE
+#define WARN SLOGW
+#define INFO SLOGI
+#define _E ERR
+#define _W WARN
+#define _I INFO
+#define _D DBG
 
 #if defined(_DEBUG)
 #  define warn_if(expr, fmt, arg...) do { \
@@ -216,6 +111,11 @@ void sf_log(int type , int priority , const char *tag , const char *fmt , ...);
 
 #endif
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 const char* get_client_name(void);
 bool get_proc_name(pid_t pid, char *process_name);