From 92caeeed507baa47afb7ad0cdb138b2db7edcce6 Mon Sep 17 00:00:00 2001 From: YounghyunJoo Date: Tue, 8 Nov 2016 10:05:37 +0900 Subject: [PATCH] Modify NotificationService Script to support Tizen OS - 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/14097 Tested-by: jenkins-iotivity Reviewed-by: Phil Coval Reviewed-by: JungYong KIM Reviewed-by: Uze Choi Tested-by: Uze Choi --- service/SConscript | 2 +- service/notification/SConscript | 9 ++++++--- service/notification/src/common/NSConstants.h | 27 +++++++++++++++++++++------ tools/tizen/iotivity.spec | 1 + 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/service/SConscript b/service/SConscript index b955025..af0ac4d 100755 --- a/service/SConscript +++ b/service/SConscript @@ -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 diff --git a/service/notification/SConscript b/service/notification/SConscript index f7f8edf..b1177a2 100755 --- a/service/notification/SConscript +++ b/service/notification/SConscript @@ -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']) diff --git a/service/notification/src/common/NSConstants.h b/service/notification/src/common/NSConstants.h index 983f2a3..e83ed34 100644 --- a/service/notification/src/common/NSConstants.h +++ b/service/notification/src/common/NSConstants.h @@ -24,13 +24,28 @@ #define __PRINTLOG 0 #define __NS_FILE__ ( strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__ ) -#ifdef TB_LOG #include "logger.h" + +#ifdef TB_LOG +#ifdef __TIZEN__ +#include +#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" : \ @@ -48,12 +63,12 @@ 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" diff --git a/tools/tizen/iotivity.spec b/tools/tizen/iotivity.spec index e070f2f..704ebf2 100644 --- a/tools/tizen/iotivity.spec +++ b/tools/tizen/iotivity.spec @@ -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 -- 2.7.4