mResumeSignal(),
mResetSignal(),
mResizeSignal(),
+ mAppControlSignal(),
mLanguageChangedSignal(),
+ mRegionChangedSignal(),
+ mBatteryLowSignal(),
+ mMemoryLowSignal(),
mEventLoop( NULL ),
mFramework( NULL ),
mCommandLineOptions( NULL ),
mWindow.Raise();
}
+void Application::OnAppControl(void *data)
+{
+ Dali::Application application(this);
+ mAppControlSignal.Emit( application , data );
+}
+
void Application::OnLanguageChanged()
{
mAdaptor->NotifyLanguageChanged();
}
+void Application::OnRegionChanged()
+{
+ Dali::Application application(this);
+ mRegionChangedSignal.Emit( application );
+}
+
+void Application::OnBatteryLow()
+{
+ Dali::Application application(this);
+ mBatteryLowSignal.Emit( application );
+}
+
+void Application::OnMemoryLow()
+{
+ Dali::Application application(this);
+ mMemoryLowSignal.Emit( application );
+}
+
void Application::OnResize(Dali::Adaptor& adaptor)
{
Dali::Application application(this);
public:
typedef Dali::Application::AppSignalType AppSignalType;
+ typedef Dali::Application::AppControlSignalType AppControlSignalType;
/**
* Constructor
virtual void OnResume();
/**
+ * Called when the framework received AppControlSignal.
+ * @param[in] The bundle data of AppControl event.
+ */
+ virtual void OnAppControl(void *data);
+
+ /**
* Called when the framework informs the application that it should reset itself.
*/
virtual void OnReset();
*/
virtual void OnLanguageChanged();
+ /**
+ * Called when the framework informs the application that the region of the device has changed.
+ */
+ virtual void OnRegionChanged();
+
+ /**
+ * Called when the framework informs the application that the battery level of the device is low.
+ */
+ virtual void OnBatteryLow();
+
+ /**
+ * Called when the framework informs the application that the memory level of the device is low.
+ */
+ virtual void OnMemoryLow();
+
public:
/**
Dali::Application::AppSignalType& ResetSignal() { return mResetSignal; }
/**
+ * @copydoc Dali::Application::AppControlSignal()
+ */
+ Dali::Application::AppControlSignalType& AppControlSignal() { return mAppControlSignal; }
+
+ /**
* @copydoc Dali::Application::ResizeSignal()
*/
Dali::Application::AppSignalType& ResizeSignal() { return mResizeSignal; }
*/
Dali::Application::AppSignalType& LanguageChangedSignal() { return mLanguageChangedSignal; }
+ /**
+ * @copydoc Dali::Application::RegionChangedSignal()
+ */
+ Dali::Application::AppSignalType& RegionChangedSignal() { return mRegionChangedSignal; }
+
+ /**
+ * @copydoc Dali::Application::BatteryLowSignal()
+ */
+ Dali::Application::AppSignalType& BatteryLowSignal() { return mBatteryLowSignal; }
+
+ /**
+ * @copydoc Dali::Application::MemoryLowSignal()
+ */
+ Dali::Application::AppSignalType& MemoryLowSignal() { return mMemoryLowSignal; }
+
private:
// Undefined
AppSignalType mResumeSignal;
AppSignalType mResetSignal;
AppSignalType mResizeSignal;
+ AppControlSignalType mAppControlSignal;
AppSignalType mLanguageChangedSignal;
+ AppSignalType mRegionChangedSignal;
+ AppSignalType mBatteryLowSignal;
+ AppSignalType mMemoryLowSignal;
+
EventLoop* mEventLoop;
Framework* mFramework;
virtual void OnReset() {}
/**
+ * Invoked when the AppControl message is received.
+ * @param[in] The bundle data of AppControl message.
+ */
+ virtual void OnAppControl(void *) {}
+
+ /**
* Invoked when the language of the device is changed.
*/
virtual void OnLanguageChanged() {}
+
+ /**
+ * Invoked when the region is changed.
+ */
+ virtual void OnRegionChanged() {}
+
+ /**
+ * Invoked when the battery level of the device is low.
+ */
+ virtual void OnBatteryLow() {}
+
+ /**
+ * Invoked when the memory level of the device is low.
+ */
+ virtual void OnMemoryLow() {}
+
};
public:
private:
/**
- * Called by the SLP framework when an application lifecycle event occurs.
+ * Called by the App framework when an application lifecycle event occurs.
* @param[in] type The type of event occurred.
+ * @param[in] bundleData The bundle data of event occurred.
*/
- bool SlpAppStatusHandler(int type);
+ bool AppStatusHandler(int type, void *bundleData);
/**
* Called app_reset callback was called with bundle.
return Internal::Adaptor::GetImplementation(*this).ResizeSignal();
}
+Application::AppControlSignalType & Application::AppControlSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).AppControlSignal();
+}
+
Application::AppSignalType& Application::LanguageChangedSignal()
{
return Internal::Adaptor::GetImplementation(*this).LanguageChangedSignal();
}
+Application::AppSignalType& Application::RegionChangedSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).RegionChangedSignal();
+}
+
+Application::AppSignalType& Application::BatteryLowSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).BatteryLowSignal();
+}
+
+Application::AppSignalType& Application::MemoryLowSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).MemoryLowSignal();
+}
+
Application::Application(Internal::Adaptor::Application* application)
: BaseHandle(application)
{
public:
typedef Signal< void (Application&) > AppSignalType;
+ typedef Signal< void (Application&, void *) > AppControlSignalType;
/**
* Decides whether a Dali application window is opaque or transparent.
AppSignalType& ResizeSignal();
/**
+ * This signal is emitted when another application sends a launch request to the application.
+ * When the application is launched, this signal is emitted after the main loop of the application starts up.
+ * The passed parameter describes the launch request and contains the information about why the application is launched.
+ */
+ AppControlSignalType& AppControlSignal();
+
+ /**
* This signal is emitted when the language is changed on the device.
*/
AppSignalType& LanguageChangedSignal();
+ /**
+ * This signal is emitted when the region of the device is changed.
+ */
+ AppSignalType& RegionChangedSignal();
+
+ /**
+ * This signal is emitted when the battery level of the device is low.
+ */
+ AppSignalType& BatteryLowSignal();
+
+ /**
+ * This signal is emitted when the memory level of the device is low.
+ */
+ AppSignalType& MemoryLowSignal();
+
+
public: // Not intended for application developers
/**
* Internal constructor
APP_PAUSE,
APP_RESUME,
APP_RESET,
+ APP_CONTROL,
APP_LANGUAGE_CHANGE,
+ APP_DEVICE_ROTATED,
+ APP_REGION_CHANGED,
+ APP_BATTERY_LOW,
+ APP_MEMORY_LOW
};
} // Unnamed namespace
mEventCallback.terminate = AppTerminate;
mEventCallback.pause = AppPause;
mEventCallback.resume = AppResume;
-#if defined(TIZEN_SDK_2_3)
- mEventCallback.app_control = AppControl;
-#else
+#ifndef OVER_TIZEN_SDK_2_2
mEventCallback.service = AppService;
-#endif
+
mEventCallback.low_memory = NULL;
mEventCallback.low_battery = NULL;
- mEventCallback.device_orientation = DeviceRotated;
- mEventCallback.language_changed = AppLanguageChange;
+ mEventCallback.device_orientation = AppDeviceRotated;
+ mEventCallback.language_changed = AppLanguageChanged;
mEventCallback.region_format_changed = NULL;
+#else
+ mEventCallback.app_control = AppControl;
+
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, AppBatteryLow, data);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, AppMemoryLow, data);
+ ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, AppDeviceRotated, data);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, AppLanguageChanged, data);
+ ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, AppRegionChanged, data);
+
+#endif
+
mCallbackManager = CallbackManager::New();
}
// Data
CallbackBase* mAbortCallBack;
- app_event_callback_s mEventCallback;
CallbackManager *mCallbackManager;
- // Static methods
+
+#ifndef OVER_TIZEN_SDK_2_2
+ app_event_callback_s mEventCallback;
+#else
+ ui_app_lifecycle_callback_s mEventCallback;
+ app_event_handler_h handlers[5];
+#endif
/**
* Called by AppCore on application creation.
*/
static bool AppCreate(void *data)
{
- return static_cast<Framework*>(data)->SlpAppStatusHandler(APP_CREATE);
+ return static_cast<Framework*>(data)->AppStatusHandler(APP_CREATE, NULL);
}
/**
*/
static void AppTerminate(void *data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_TERMINATE);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_TERMINATE, NULL);
}
/**
*/
static void AppPause(void *data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_PAUSE);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_PAUSE, NULL);
}
/**
*/
static void AppResume(void *data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_RESUME);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_RESUME, NULL);
}
+ static void ProcessBundle(Framework* framework, bundle *bundleData)
+ {
+ if(bundleData == NULL)
+ {
+ return;
+ }
+
+ // get bundle name
+ char* bundleName = const_cast<char*>(bundle_get_val(bundleData, "name"));
+ if(bundleName != NULL)
+ {
+ framework->SetBundleName(bundleName);
+ }
+
+ // get bundle id
+ char* bundleId = const_cast<char*>(bundle_get_val(bundleData, "id"));
+ if(bundleId != NULL)
+ {
+ framework->SetBundleId(bundleId);
+ }
+ }
+
+#ifndef OVER_TIZEN_SDK_2_2
/**
* Called by AppCore when the application is launched from another module (e.g. homescreen).
* @param[in] b the bundle data which the launcher module sent
*/
-
-#if defined(TIZEN_SDK_2_3)
- static void AppControl(app_control_h app_control, void *data)
-#else
static void AppService(service_h service, void *data)
-#endif
{
Framework* framework = static_cast<Framework*>(data);
- if(framework)
+ if(framework == NULL)
{
- bundle *bundleData = NULL;
-#if defined(TIZEN_SDK_2_3)
- app_control_to_bundle(app_control, &bundleData);
-#else
- service_to_bundle(service, &bundleData);
-#endif
-
- if(bundleData)
- {
- // get bundle name
- char* bundleName = const_cast<char*>(bundle_get_val(bundleData, "name"));
- if(bundleName != NULL)
- {
- framework->SetBundleName(bundleName);
- }
-
- // get bundle id
- char* bundleId = const_cast<char*>(bundle_get_val(bundleData, "id"));
- if(bundleId != NULL)
- {
- framework->SetBundleId(bundleId);
- }
- }
- framework->SlpAppStatusHandler(APP_RESET);
+ return;
}
+ bundle *bundleData = NULL;
+
+ service_to_bundle(service, &bundleData);
+ ProcessBundle(framework, bundleData);
+
+ framework->AppStatusHandler(APP_RESET, NULL);
}
- /**
- * Called by AppCore when the language changes on the device.
- */
- static void AppLanguageChange(void* data)
+ static void AppLanguageChanged(void* user_data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_LANGUAGE_CHANGE);
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_LANGUAGE_CHANGE, NULL);
}
- static void DeviceRotated(app_device_orientation_e orientation, void *user_data)
+ static void AppDeviceRotated(app_device_orientation_e orientation, void *user_data)
{
- switch(orientation)
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_DEVICE_ROTATED, NULL);
+ }
+
+#else
+
+ /**
+ * Called by AppCore when the application is launched from another module (e.g. homescreen).
+ * @param[in] b the bundle data which the launcher module sent
+ */
+ static void AppControl(app_control_h app_control, void *data)
+ {
+ Framework* framework = static_cast<Framework*>(data);
+ if(framework == NULL)
{
- case APP_DEVICE_ORIENTATION_0:
- break;
- case APP_DEVICE_ORIENTATION_90:
- break;
- case APP_DEVICE_ORIENTATION_180:
- break;
- case APP_DEVICE_ORIENTATION_270:
- break;
+ return;
}
+ bundle *bundleData = NULL;
+
+ app_control_to_bundle(app_control, &bundleData);
+ ProcessBundle(framework, bundleData);
+
+ framework->AppStatusHandler(APP_RESET, NULL);
+ framework->AppStatusHandler(APP_CONTROL, app_control);
+ }
+
+ static void AppLanguageChanged(app_event_info_h event_info, void *user_data)
+ {
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_LANGUAGE_CHANGE, NULL);
+ }
+
+ static void AppDeviceRotated(app_event_info_h event_info, void *user_data)
+ {
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_DEVICE_ROTATED, NULL);
+ }
+
+ static void AppRegionChanged(app_event_info_h event_info, void *user_data)
+ {
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_REGION_CHANGED, NULL);
+ }
+
+ static void AppBatteryLow(app_event_info_h event_info, void *user_data)
+ {
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_BATTERY_LOW, NULL);
}
+ static void AppMemoryLow(app_event_info_h event_info, void *user_data)
+ {
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_MEMORY_LOW, NULL);
+ }
+
+#endif
+
};
Framework::Framework(Framework::Observer& observer, int *argc, char ***argv, const std::string& name)
{
mRunning = true;
+#ifndef OVER_TIZEN_SDK_2_2
app_efl_main(mArgc, mArgv, &mImpl->mEventCallback, this);
+#else
+ int ret = ui_app_main(*mArgc, *mArgv, &mImpl->mEventCallback, this);
+ if (ret != APP_ERROR_NONE)
+ {
+ DALI_LOG_ERROR("Framework::Run(), ui_app_main() is failed. err = %d", ret);
+ }
+#endif
+
mRunning = false;
}
}
}
-bool Framework::SlpAppStatusHandler(int type)
+bool Framework::AppStatusHandler(int type, void *bundleData)
{
switch (type)
{
}
case APP_RESET:
+ {
mObserver.OnReset();
break;
+ }
case APP_RESUME:
+ {
mObserver.OnResume();
break;
+ }
case APP_TERMINATE:
- mObserver.OnTerminate();
+ {
+ mObserver.OnTerminate();
break;
+ }
case APP_PAUSE:
+ {
mObserver.OnPause();
break;
+ }
+
+ case APP_CONTROL:
+ {
+ mObserver.OnAppControl(bundleData);
+ break;
+ }
case APP_LANGUAGE_CHANGE:
+ {
mObserver.OnLanguageChanged();
break;
+ }
+
+ case APP_REGION_CHANGED:
+ {
+ mObserver.OnRegionChanged();
+ break;
+ }
+
+ case APP_BATTERY_LOW:
+ {
+ mObserver.OnBatteryLow();
+ break;
+ }
+
+ case APP_MEMORY_LOW:
+ {
+ mObserver.OnMemoryLow();
+ break;
+ }
default:
break;
*/
static bool AppCreate(void *data)
{
- return static_cast<Framework*>(data)->SlpAppStatusHandler(APP_CREATE);
+ return static_cast<Framework*>(data)->AppStatusHandler(APP_CREATE, NULL);
}
/**
*/
static void AppTerminate(void *data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_TERMINATE);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_TERMINATE, NULL);
}
/**
*/
static void AppPause(void *data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_PAUSE);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_PAUSE, NULL);
}
/**
*/
static void AppResume(void *data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_RESUME);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_RESUME, NULL);
}
/**
*/
static void AppLanguageChange(void* data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_LANGUAGE_CHANGE);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_LANGUAGE_CHANGE, NULL);
}
};
}
}
-bool Framework::SlpAppStatusHandler(int type)
+bool Framework::AppStatusHandler(int type, void *bundleData)
{
switch (type)
{
%define dali_feedback_plugin 0
%define dali_bullet_plugin 0
%define dali_assimp_plugin 0
-%endif
+%define over_tizen_2_2 0
-%if "%{profile}" == "tv"
+%else if "%{profile}" == "tv"
%define dali_profile TV
%define dali_feedback_plugin 0
%define dali_bullet_plugin 0
%define dali_assimp_plugin 0
-%endif
+%define over_tizen_2_2 1
-%if "%{profile}" == "wearable"
+%else if "%{profile}" == "wearable"
%define dali_profile WEARABLE
%define dali_feedback_plugin 0
%define dali_bullet_plugin 0
%define dali_assimp_plugin 0
-%endif
+%define over_tizen_2_2 0
-%if "%{profile}" == "common"
+%else
+## profile == common
%define dali_profile COMMON
%define dali_feedback_plugin 0
%define dali_bullet_plugin 0
%define dali_assimp_plugin 0
+%define over_tizen_2_2 0
+
%endif
Requires(post): /sbin/ldconfig
configure_flags="--enable-wayland"
%endif
+%if 0%{?over_tizen_2_2}
+CFLAGS+=" -DOVER_TIZEN_SDK_2_2"
+CXXFLAGS+=" -DOVER_TIZEN_SDK_2_2"
+%endif
+
libtoolize --force
cd %{_builddir}/%{name}-%{version}/build/tizen && autoreconf --install
cd %{_builddir}/%{name}-%{version}/build/tizen && CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}" FONT_PRELOADED_PATH="%{font_preloaded_path}" FONT_DOWNLOADED_PATH="%{font_downloaded_path}" FONT_APPLICATION_PATH="%{font_application_path}" FONT_CONFIGURATION_FILE="%{font_configuration_file}"