Add deprecation warnings for the deprecated sensor type enums 08/86208/2
authorMu-Woong Lee <muwoong.lee@samsung.com>
Wed, 31 Aug 2016 05:28:48 +0000 (14:28 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Wed, 31 Aug 2016 05:35:37 +0000 (14:35 +0900)
Change-Id: I3406a62598dc9016084ecdfa53ae2af90b7aad07
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
include/sensor_log.h
src/sensor.cpp

index 5779dfd..9c9e3ac 100644 (file)
@@ -39,10 +39,10 @@ extern "C"
 #define _E_MSG(err) SLOGE(_MSG_##err "(0x%08x)", (err))
 
 #ifdef _DEBUG
-       #define _E(fmt, args...) SLOGE(fmt, ##args)
-       #define _W(fmt, args...) SLOGW(fmt, ##args)
-       #define _I(fmt, args...) SLOGI(fmt, ##args)
-       #define _D(fmt, args...) SLOGD(fmt, ##args)
+       #define _E(fmt, args...) dlog_print(DLOG_ERROR, LOG_TAG, fmt, ##args)
+       #define _W(fmt, args...) dlog_print(DLOG_WARN, LOG_TAG, fmt, ##args)
+       #define _I(fmt, args...) dlog_print(DLOG_INFO, LOG_TAG, fmt, ##args)
+       #define _D(fmt, args...) dlog_print(DLOG_DEBUG, LOG_TAG, fmt, ##args)
 #else
        #define _E(...)
        #define _W(...)
index d0bdc06..82e35f5 100644 (file)
 
 #define CONVERT_OPTION_PAUSE_POLICY(option) ((option) ^ 0b11)
 
+#define WARN_DEPRECATED_SENSOR(X) \
+       do { \
+               if ((X) == SENSOR_LAST || (X) == SENSOR_CUSTOM) { \
+                       _W("DEPRECATION WARNING: This sensor type is deprecated and will be removed from next release."); \
+               } \
+       } while (0)
+
 static int sensor_connect(sensor_h sensor, sensor_listener_h listener)
 {
        int id = SENSOR_UNDEFINED_ID;
@@ -90,6 +97,8 @@ int sensor_is_supported(sensor_type_e type, bool *supported)
        int result;
        sensor_t sensor;
 
+       WARN_DEPRECATED_SENSOR(type);
+
        if (type < SENSOR_ALL)
                return SENSOR_ERROR_INVALID_PARAMETER;
 
@@ -124,6 +133,8 @@ int sensor_get_default_sensor(sensor_type_e type, sensor_h *sensor)
        sensor_t _sensor;
        sensor_privilege_t privilege;
 
+       WARN_DEPRECATED_SENSOR(type);
+
        _D("called sensor_get_default_sensor : type[%d], sensor[0x%x]", type, sensor);
 
        if (type < SENSOR_ALL)
@@ -158,6 +169,8 @@ int sensor_get_sensor_list(sensor_type_e type, sensor_h **list, int *sensor_coun
        sensor_h *_list;
        int count;
 
+       WARN_DEPRECATED_SENSOR(type);
+
        _D("called sensor_get_list : type[%d]", type);
 
        if (type < SENSOR_ALL)