Modify NotificationService Script to support Tizen OS
authorYounghyunJoo <yh_.joo@samsung.com>
Tue, 8 Nov 2016 01:05:37 +0000 (10:05 +0900)
committerUze Choi <uzchoi@samsung.com>
Wed, 16 Nov 2016 03:31:54 +0000 (03:31 +0000)
- Modify Script files to build on Tizen Platform
- Modify Logic for logging to print log through dlog api

Change-Id: I0a624400187d37817627875f983104cb14b7946b
Signed-off-by: YounghyunJoo <yh_.joo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14097
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Phil Coval <philippe.coval@osg.samsung.com>
Reviewed-by: JungYong KIM <jyong2.kim@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/SConscript
service/notification/SConscript
service/notification/src/common/NSConstants.h
tools/tizen/iotivity.spec

index b955025..af0ac4d 100755 (executable)
@@ -44,7 +44,7 @@ if target_os not in ['arduino','darwin', 'ios', 'windows']:
         SConscript('scene-manager/SConscript')
 
     # Build notification-service project
-    if target_os in ['linux','android']:
+    if target_os in ['linux','android','tizen']:
         SConscript('notification/SConscript')
 
     # Build simulator module
index f7f8edf..b1177a2 100755 (executable)
@@ -66,6 +66,9 @@ if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
 
 if target_os == 'linux':
        notification_env.AppendUnique(LIBS = ['pthread'])
+       if not env.get('RELEASE'):
+               notification_env.PrependUnique(LIBS = ['gcov'])
+               notification_env.AppendUnique(CCFLAGS = ['--coverage'])
 
 if target_os == 'android':
        notification_env.AppendUnique(CCFLAGS = ['-frtti', '-fexceptions'])
@@ -74,9 +77,9 @@ if target_os == 'android':
        if not env.get('RELEASE'):
                notification_env.AppendUnique(LIBS = ['log'])
 
-if not env.get('RELEASE'):
-       notification_env.PrependUnique(LIBS = ['gcov'])
-       notification_env.AppendUnique(CCFLAGS = ['--coverage'])
+if target_os == 'tizen':
+       notification_env.AppendUnique(CPPDEFINES = ['__TIZEN__'])
+       # notification_env.ParseConfig('pkg-config --cflags --libs sqlite3')
 
 if 'CLIENT' in notification_env.get('RD_MODE'):
        notification_env.AppendUnique(CPPDEFINES = ['RD_CLIENT'])
index 983f2a3..e83ed34 100644 (file)
 #define __PRINTLOG 0
 #define __NS_FILE__ ( strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__ )
 
-#ifdef TB_LOG
 #include "logger.h"
+
+#ifdef TB_LOG
+#ifdef __TIZEN__
+#include <dlog.h>
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif // LOG_TAG
+#define LOG_TAG "NotificationService"
+#define NS_CONVERT_LEVEL(level) ( \
+        ((level) == 0) ? DLOG_DEBUG : \
+        ((level) == 1) ? DLOG_INFO : \
+        ((level) == 2) ? DLOG_WARN : \
+    ((level) == 3) ? DLOG_ERROR : DLOG_ERROR)
+#define NS_LOG_V(level, format, ...) (dlog_print(NS_CONVERT_LEVEL(level), LOG_TAG, (format), __VA_ARGS__))
+#define NS_LOG(level, msg) (dlog_print(NS_CONVERT_LEVEL(level), LOG_TAG, (msg)))
+#else // __TIZEN__
 #define NS_LOG_V(level, format, ...) (OIC_LOG_V((level), __NS_FILE__, (format), __VA_ARGS__))
 #define NS_LOG(level, msg) (OIC_LOG((level), __NS_FILE__, (msg)))
-#else
+#endif // __TIZEN__
+#else // TB_LOG
 #if (__PRINTLOG == 1)
-#include "logger.h"
 #define NS_CONVERT_LEVEL(level) ( \
         ((level) == 0) ? "DEBUG" : \
         ((level) == 1) ? "INFO" : \
         printf((msg)); \
         printf("\n"); \
     }
-#else
+#else // (__PRINTLOG == 1)
 #define NS_CONVERT_LEVEL(level)
 #define NS_LOG(level, msg)
 #define NS_LOG_V(level, format, ...) NS_LOG((level), ((format), __VA_ARGS__))
-#endif
-#endif
+#endif // (__PRINTLOG == 1)
+#endif // TB_LOG
 
 #define NS_TAG                     "IOT_NOTI"
 
index e070f2f..704ebf2 100644 (file)
@@ -295,6 +295,7 @@ rm -rfv out %{buildroot}/out %{buildroot}/${HOME} ||:
 %{_libdir}/librcs_container.so
 %{_libdir}/librcs_server.so
 %{_libdir}/libESEnrolleeSDK.so
+%{_libdir}/libnotification*.so
 %if 0%{?WITH_PROXY} == 1
 %{_libdir}/libcoap_http_proxy.so
 %endif