[3.0] Move ELDbus init & shutdown to Tizen Framework
[platform/core/uifw/dali-adaptor.git] / adaptors / tizen / framework-tizen.cpp
index 55edd29..7f425ed 100644 (file)
 #include <system_info.h>
 #include <app_control_internal.h>
 #include <bundle_internal.h>
+
+// CONDITIONAL INCLUDES
 #ifdef APPCORE_WATCH_AVAILABLE
 #include <appcore-watch/watch_app.h>
 #endif
+#ifdef DALI_ELDBUS_AVAILABLE
+#include <Eldbus.h>
+#endif // DALI_ELDBUS_AVAILABLE
 
 #include <dali/integration-api/debug.h>
 
 // INTERNAL INCLUDES
 #include <callback-manager.h>
-#include <watch-application-impl.h>
-#include <watch-time.h>
 
 namespace Dali
 {
@@ -46,6 +49,13 @@ namespace Internal
 namespace Adaptor
 {
 
+#if defined(DEBUG_ENABLED)
+namespace
+{
+Integration::Log::Filter* gDBusLogging = Integration::Log::Filter::New( Debug::NoLogging, false, "LOG_ADAPTOR_EVENTS_DBUS" );
+} // anonymous namespace
+#endif
+
 /**
  * Impl to hide EFL data members
  */
@@ -327,8 +337,12 @@ Framework::Framework( Framework::Observer& observer, int *argc, char ***argv, Ty
   if( featureFlag == false )
   {
     set_last_result( TIZEN_ERROR_NOT_SUPPORTED );
-    throw Dali::DaliException( "", "OpenGL ES 2.0 is not supported." );
   }
+#ifdef DALI_ELDBUS_AVAILABLE
+  // Initialize ElDBus.
+  DALI_LOG_INFO( gDBusLogging, Debug::General, "Starting DBus Initialization\n" );
+  eldbus_init();
+#endif
   InitThreads();
 
   mImpl = new Impl(this, type);
@@ -341,6 +355,12 @@ Framework::~Framework()
     Quit();
   }
 
+#ifdef DALI_ELDBUS_AVAILABLE
+  // Shutdown ELDBus.
+  DALI_LOG_INFO( gDBusLogging, Debug::General, "Shutting down DBus\n" );
+  eldbus_shutdown();
+#endif
+
   delete mImpl;
 }
 
@@ -359,7 +379,7 @@ void Framework::Run()
   ret = mImpl->AppMain();
   if (ret != APP_ERROR_NONE)
   {
-    DALI_LOG_ERROR("Framework::Run(), ui_app_main() is failed. err = %d", ret);
+    DALI_LOG_ERROR("Framework::Run(), ui_app_main() is failed. err = %d\n", ret);
   }
   mRunning = false;
 }