-GBS Builds
-==========
+T.O.C.
+======
-COMMON Profile
---------------
+ 1. GBS Builds
+ 1.1. COMMON Profile
+ 1.2. MOBILE Profile
+ 1.3. WEARABLE Profile
+ 2. Building for Ubuntu desktop
+ 2.1. Minimum Requirements
+ 2.2. Building the Repository
+ 3. Troubleshooting
+ 3.1. JPEG Library Linking Errors
-gbs build -A [TARGET_ARCH]
-MOBILE Profile
---------------
-gbs build -A [TARGET_ARCH] --spec dali-adaptor-mobile.spec
+1. GBS Builds
+=============
-WEARABLE Profile
-----------------
+1.1. COMMON Profile
+-------------------
+
+ gbs build -A [TARGET_ARCH]
+
+1.2. MOBILE Profile
+-------------------
+
+ gbs build -A [TARGET_ARCH] --spec dali-adaptor-mobile.spec
+
+1.3. WEARABLE Profile
+---------------------
+
+ gbs build -A [TARGET_ARCH] --spec dali-adaptor-wearable.spec
+
+
+
+2. Building for Ubuntu desktop
+==============================
+
+2.1. Minimum Requirements
+------------------------
+
+ - Ubuntu 14.04
+ - Environment created using dali_env script in dali-core repository
+
+2.2. Building the Repository
+----------------------------
+
+To build the repository enter the 'build/tizen' folder:
+
+ cd dali-adaptor/build/tizen
+
+Then run the following commands:
+
+ autoreconf --install
+ ./configure --prefix=$DESKTOP_PREFIX --enable-profile=UBUNTU --enable-gles=20
+ make install -j8
+
+
+
+3. Troubleshooting
+==================
+
+3.1. JPEG Library Linking Errors
+--------------------------------
+
+If you have linking problems with libjpeg, then you may have to create a symbolic link to the library:
+
+ - Navigate to where the library is (for example /usr/lib/x86_64-linux-gnu).
+ - Create a symbolic link:
+ sudo ln -s libjpeg.so.8 libjpeg.so
+ sudo chmod 777 libjpeg.so
+ (Change the version number of your libjpeg library accordingly)
-gbs build -A [TARGET_ARCH] --spec dali-adaptor-wearable.spec
// tell core it has a context
mCore.ContextCreated();
- DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_VENDOR : %s ***\n", mGLES.GetString(GL_VENDOR));
- DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_RENDERER : %s ***\n", mGLES.GetString(GL_RENDERER));
- DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_VERSION : %s ***\n", mGLES.GetString(GL_VERSION));
- DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_SHADING_LANGUAGE_VERSION : %s***\n", mGLES.GetString(GL_SHADING_LANGUAGE_VERSION));
- DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** Supported Extensions ***\n%s\n\n", mGLES.GetString(GL_EXTENSIONS));
}
void RenderThread::ConsumeEvents()
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "accessibility-manager-impl.h"
-
-// EXTERNAL INCLUDES
-#include <vconf.h>
-
-#include <dali/public-api/dali-core.h>
-#include <dali/integration-api/debug.h>
-#include <dali/integration-api/events/touch-event-integ.h>
-#include <dali/integration-api/events/gesture-requests.h>
-#include "system-settings.h"
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace
-{
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gAccessibilityManagerLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_MANAGER");
-#endif
-
-void AccessibilityOnOffNotification(keynode_t* node, void* data)
-{
- AccessibilityManager* manager = static_cast<AccessibilityManager*>(data);
- int isEnabled = 0;
- vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &isEnabled);
-
- DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled?"ENABLED":"DISABLED");
-
- if(isEnabled == 1)
- {
- manager->EnableAccessibility();
- }
- else
- {
- manager->DisableAccessibility();
- }
-}
-
-BaseHandle Create()
-{
- BaseHandle handle( AccessibilityManager::Get() );
-
- if ( !handle && Adaptor::IsAvailable() )
- {
- Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
- Dali::AccessibilityManager manager = Dali::AccessibilityManager( new AccessibilityManager() );
- adaptorImpl.RegisterSingleton( typeid( manager ), manager );
- handle = manager;
- }
-
- return handle;
-}
-TypeRegistration ACCESSIBILITY_MANAGER_TYPE( typeid(Dali::AccessibilityManager), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
-
-} // unnamed namespace
-
-Dali::AccessibilityManager AccessibilityManager::Get()
-{
- Dali::AccessibilityManager manager;
-
- if ( Adaptor::IsAvailable() )
- {
- // Check whether the singleton is already created
- Dali::BaseHandle handle = Dali::Adaptor::Get().GetSingleton( typeid( Dali::AccessibilityManager ) );
- if(handle)
- {
- // If so, downcast the handle
- manager = Dali::AccessibilityManager( dynamic_cast< AccessibilityManager* >( handle.GetObjectPtr() ) );
- }
- }
-
- return manager;
-}
-
-Vector2 AccessibilityManager::GetReadPosition() const
-{
- return mReadPosition;
-}
-
-void AccessibilityManager::SetActionHandler(AccessibilityActionHandler& handler)
-{
- mActionHandler = &handler;
-}
-
-void AccessibilityManager::SetGestureHandler(AccessibilityGestureHandler& handler)
-{
- if( mAccessibilityGestureDetector )
- {
- mAccessibilityGestureDetector->SetGestureHandler(handler);
- }
-}
-
-bool AccessibilityManager::HandleActionClearFocusEvent()
-{
- bool ret = false;
-
- Dali::AccessibilityManager handle( this );
-
- /*
- * In order to application decide reading action first,
- * emit ActionClearFocus signal in first, ClearAccessibilityFocus for handler in next
- */
- if ( !mIndicatorFocused )
- {
- if( !mActionClearFocusSignalV2.Empty() )
- {
- mActionClearFocusSignalV2.Emit( handle );
- }
- }
-
- if( mActionHandler )
- {
- ret = mActionHandler->ClearAccessibilityFocus();
- }
-
- DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
-
- return ret;
-}
-
-bool AccessibilityManager::HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp)
-{
- bool ret = false;
-
- Dali::AccessibilityManager handle( this );
-
- Dali::TouchEvent touchEvent(timeStamp);
- touchEvent.points.push_back(point);
-
- /*
- * In order to application decide touch action first,
- * emit ActionScroll signal in first, AccessibilityActionScroll for handler in next
- */
- if ( !mIndicatorFocused )
- {
- if( !mActionScrollSignalV2.Empty() )
- {
- mActionScrollSignalV2.Emit( handle, touchEvent );
- }
- }
-
- Integration::TouchEvent event;
- if (mCombiner.GetNextTouchEvent(point, timeStamp, event))
- {
- // Process the touch event in accessibility gesture detector
- if( mAccessibilityGestureDetector )
- {
- mAccessibilityGestureDetector->SendEvent(event);
- ret = true;
- }
- }
-
- return ret;
-}
-
-bool AccessibilityManager::HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp)
-{
- bool ret = false;
-
- Dali::TouchEvent touchEvent(timeStamp);
- touchEvent.points.push_back(point);
-
- if( mActionHandler )
- {
- ret = mActionHandler->AccessibilityActionTouch(touchEvent);
- }
- return ret;
-}
-
-bool AccessibilityManager::HandleActionBackEvent()
-{
- bool ret = false;
-
- Dali::AccessibilityManager handle( this );
-
- /*
- * In order to application decide reading action first,
- * emit ActionBack signal in first, AccessibilityActionBack for handler in next
- */
- if ( !mIndicatorFocused )
- {
- if( !mActionBackSignalV2.Empty() )
- {
- mActionBackSignalV2.Emit( handle );
- }
- }
-
- if( mActionHandler )
- {
- ret = mActionHandler->AccessibilityActionBack();
- }
-
- DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
-
- return ret;
-}
-
-void AccessibilityManager::HandleActionEnableEvent()
-{
- EnableAccessibility();
-}
-
-void AccessibilityManager::HandleActionDisableEvent()
-{
- DisableAccessibility();
-}
-
-void AccessibilityManager::EnableAccessibility()
-{
- if(mIsEnabled == false)
- {
- mIsEnabled = true;
-
- if( mActionHandler )
- {
- mActionHandler->ChangeAccessibilityStatus();
- }
-
- //emit status changed signal
- Dali::AccessibilityManager handle( this );
- mStatusChangedSignalV2.Emit( handle );
- }
-}
-
-void AccessibilityManager::DisableAccessibility()
-{
- if(mIsEnabled == true)
- {
- mIsEnabled = false;
-
- if( mActionHandler )
- {
- mActionHandler->ChangeAccessibilityStatus();
- }
-
- //emit status changed signal
- Dali::AccessibilityManager handle( this );
- mStatusChangedSignalV2.Emit( handle );
-
- // Destroy the TtsPlayer if exists.
- Dali::Adaptor& adaptor = Dali::Adaptor::Get();
- Adaptor::GetImplementation(adaptor).DestroyTtsPlayer(Dali::TtsPlayer::SCREEN_READER);
- }
-}
-
-bool AccessibilityManager::IsEnabled() const
-{
- return mIsEnabled;
-}
-
-void AccessibilityManager::SetIndicator(Indicator* indicator)
-{
- mIndicator = indicator;
-}
-
-AccessibilityManager::AccessibilityManager()
-: mIsEnabled(false),
- mActionHandler(NULL),
- mIndicator(NULL),
- mIndicatorFocused(false)
-{
- int isEnabled = 0;
- vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &isEnabled);
- DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled?"ENABLED":"DISABLED");
-
- if(isEnabled == 1)
- {
- mIsEnabled = true;
- }
- else
- {
- mIsEnabled = false;
- }
-
- vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, this );
-
- mAccessibilityGestureDetector = new AccessibilityGestureDetector();
-}
-
-AccessibilityManager::~AccessibilityManager()
-{
- vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification );
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
$(adaptor_common_dir)/virtual-keyboard.cpp \
$(adaptor_common_dir)/window.cpp
-adaptor_application_src_files = \
- $(adaptor_common_dir)/application.cpp
-
-adaptor_application_internal_src_files = \
- $(adaptor_common_dir)/application-impl.cpp \
- $(adaptor_common_dir)/framework.cpp \
- $(adaptor_common_dir)/command-line-options.cpp \
- $(adaptor_common_dir)/abort-handler.cpp
-
adaptor_common_internal_src_files = \
$(adaptor_common_dir)/accessibility-gesture-detector.cpp \
- $(adaptor_common_dir)/accessibility-manager-impl.cpp \
$(adaptor_common_dir)/adaptor-impl.cpp \
$(adaptor_common_dir)/clipboard-event-notifier-impl.cpp \
$(adaptor_common_dir)/drag-and-drop-detector-impl.cpp \
$(adaptor_common_dir)/shared-file.cpp \
$(adaptor_common_dir)/sound-player-impl.cpp \
$(adaptor_common_dir)/style-monitor-impl.cpp \
- $(adaptor_common_dir)/tilt-sensor-impl.cpp \
$(adaptor_common_dir)/timer-impl.cpp \
$(adaptor_common_dir)/trigger-event.cpp \
$(adaptor_common_dir)/trigger-event-factory.cpp \
- $(adaptor_common_dir)/tts-player-impl.cpp \
$(adaptor_common_dir)/virtual-keyboard-impl.cpp \
- $(adaptor_common_dir)/vsync-monitor.cpp \
\
$(adaptor_common_dir)/events/gesture-manager.cpp \
$(adaptor_common_dir)/events/long-press-gesture-detector.cpp \
$(adaptor_common_dir)/gl/gl-proxy-implementation.cpp \
$(adaptor_common_dir)/gl/gl-extensions.cpp
-adaptor_common_internal_profile_src_files = \
+adaptor_common_internal_default_profile_src_files = \
$(adaptor_common_dir)/color-controller-impl.cpp \
$(adaptor_common_dir)/system-settings.cpp
+adaptor_common_application_src_files = \
+ $(adaptor_common_dir)/application.cpp
+
+adaptor_common_application_internal_src_files = \
+ $(adaptor_common_dir)/application-impl.cpp \
+ $(adaptor_common_dir)/command-line-options.cpp \
+ $(adaptor_common_dir)/abort-handler.cpp
+
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "framework.h"
-
-// EXTERNAL INCLUDES
-#include <app.h>
-#include <bundle.h>
-#include <Ecore.h>
-#include <boost/bind.hpp>
-
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <callback-manager.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace
-{
-
-/// Application Status Enum
-enum
-{
- APP_CREATE,
- APP_TERMINATE,
- APP_PAUSE,
- APP_RESUME,
- APP_RESET,
- APP_LANGUAGE_CHANGE,
-};
-
-} // Unnamed namespace
-
-/**
- * Impl to hide EFL data members
- */
-struct Framework::Impl
-{
- // Constructor
-
- Impl(void* data)
- {
- mEventCallback.create = AppCreate;
- mEventCallback.terminate = AppTerminate;
- mEventCallback.pause = AppPause;
- mEventCallback.resume = AppResume;
- mEventCallback.service = AppService;
- mEventCallback.low_memory = NULL;
- mEventCallback.low_battery = NULL;
- mEventCallback.device_orientation = DeviceRotated;
- mEventCallback.language_changed = AppLanguageChange;
- mEventCallback.region_format_changed = NULL;
-
- mCallbackManager = CallbackManager::New();
- }
-
- ~Impl()
- {
- // we're quiting the main loop so
- // mCallbackManager->RemoveAllCallBacks() does not need to be called
- // to delete our abort handler
- delete mCallbackManager;
- }
-
- // Data
-
- boost::function<void(void)> mAbortCallBack;
- app_event_callback_s mEventCallback;
- CallbackManager *mCallbackManager;
- // Static methods
-
- /**
- * Called by AppCore on application creation.
- */
- static bool AppCreate(void *data)
- {
- return static_cast<Framework*>(data)->SlpAppStatusHandler(APP_CREATE);
- }
-
- /**
- * Called by AppCore when the application should terminate.
- */
- static void AppTerminate(void *data)
- {
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_TERMINATE);
- }
-
- /**
- * Called by AppCore when the application is paused.
- */
- static void AppPause(void *data)
- {
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_PAUSE);
- }
-
- /**
- * Called by AppCore when the application is resumed.
- */
- static void AppResume(void *data)
- {
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_RESUME);
- }
-
- /**
- * 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 AppService(service_h service, void *data)
- {
- Framework* framework = static_cast<Framework*>(data);
-
- if(framework)
- {
- bundle *bundleData = NULL;
- service_to_bundle(service, &bundleData);
-
- 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);
- }
- }
-
- /**
- * Called by AppCore when the language changes on the device.
- */
- static void AppLanguageChange(void* data)
- {
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_LANGUAGE_CHANGE);
- }
-
- static void DeviceRotated(app_device_orientation_e orientation, void *user_data)
- {
- switch(orientation)
- {
- case APP_DEVICE_ORIENTATION_0:
- break;
- case APP_DEVICE_ORIENTATION_90:
- break;
- case APP_DEVICE_ORIENTATION_180:
- break;
- case APP_DEVICE_ORIENTATION_270:
- break;
- }
- }
-
-};
-
-Framework::Framework(Framework::Observer& observer, int *argc, char ***argv, const std::string& name)
-: mObserver(observer),
- mInitialised(false),
- mRunning(false),
- mArgc(argc),
- mArgv(argv),
- mName(name),
- mBundleName(""),
- mBundleId(""),
- mAbortHandler(boost::bind(&Framework::AbortCallback, this)),
- mImpl(NULL)
-{
- InitThreads();
- mImpl = new Impl(this);
-}
-
-Framework::~Framework()
-{
- if (mRunning)
- {
- Quit();
- }
-
- delete mImpl;
-}
-
-void Framework::Run()
-{
- mRunning = true;
-
- app_efl_main(mArgc, mArgv, &mImpl->mEventCallback, this);
-
- mRunning = false;
-}
-
-void Framework::Quit()
-{
- app_efl_exit();
-}
-
-bool Framework::IsMainLoopRunning()
-{
- return mRunning;
-}
-
-void Framework::AddAbortCallback(boost::function<void(void)> callBack)
-{
- mImpl->mAbortCallBack = callBack;
-}
-
-std::string Framework::GetBundleName() const
-{
- return mBundleName;
-}
-
-void Framework::SetBundleName(const std::string& name)
-{
- mBundleName = name;
-}
-
-std::string Framework::GetBundleId() const
-{
- return mBundleId;
-}
-
-void Framework::SetBundleId(const std::string& id)
-{
- mBundleId = id;
-}
-
-void Framework::AbortCallback( )
-{
- // if an abort call back has been installed run it.
- if (mImpl->mAbortCallBack)
- {
- mImpl->mAbortCallBack();
- }
- else
- {
- Quit();
- }
-}
-
-bool Framework::SlpAppStatusHandler(int type)
-{
- switch (type)
- {
- case APP_CREATE:
- {
- mInitialised = true;
-
- // Connect to abnormal exit signals
- mAbortHandler.AbortOnSignal( SIGINT );
- mAbortHandler.AbortOnSignal( SIGQUIT );
- mAbortHandler.AbortOnSignal( SIGKILL );
-
- mObserver.OnInit();
- break;
- }
-
- case APP_RESET:
- mObserver.OnReset();
- break;
-
- case APP_RESUME:
- mObserver.OnResume();
- break;
-
- case APP_TERMINATE:
- mObserver.OnTerminate();
- break;
-
- case APP_PAUSE:
- mObserver.OnPause();
- break;
-
- case APP_LANGUAGE_CHANGE:
- mObserver.OnLanguageChanged();
- break;
-
- default:
- break;
- }
-
- return true;
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
#include <dali/integration-api/bitmap.h>
// INTERNAL HEADERS
+#include <common/gl/gl-implementation.h>
namespace Dali
{
// CLASS HEADER
#include "style-monitor-impl.h"
-// EXTERNAL INCLUDES
-#include <vconf.h>
-
// INTERNAL INCLUDES
#include <dali/public-api/object/type-registry.h>
#include <adaptor-impl.h>
*
*/
-// EXTERNAL INCLUDES
-#include <system_settings.h>
-#include <Elementary.h>
-
// INTERNAL INCLUDES
#include "system-settings.h"
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "tilt-sensor-impl.h"
-
-// EXTERNAL INCLUDES
-#include <cmath>
-#ifdef DALI_PROFILE_LITE
-#include <sensor_internal.h>
-#else
-#include <sensor.h>
-#endif
-
-#include <dali/public-api/object/type-registry.h>
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include <adaptor-impl.h>
-
-#ifdef __arm__
-#define SENSOR_ENABLED
-#endif
-
-namespace // unnamed namespace
-{
-
-const int NUMBER_OF_SAMPLES = 10;
-
-const float MAX_ACCELEROMETER_XY_VALUE = 9.8f;
-
-// Type Registration
-Dali::BaseHandle Create()
-{
- return Dali::Internal::Adaptor::TiltSensor::Get();
-}
-
-Dali::TypeRegistration typeRegistration( typeid(Dali::TiltSensor), typeid(Dali::BaseHandle), Create );
-
-Dali::SignalConnectorType signalConnector1( typeRegistration, Dali::TiltSensor::SIGNAL_TILTED, Dali::Internal::Adaptor::TiltSensor::DoConnectSignal );
-
-} // unnamed namespace
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-Dali::TiltSensor TiltSensor::New()
-{
- Dali::TiltSensor sensor = Dali::TiltSensor(new TiltSensor());
-
- return sensor;
-}
-
-Dali::TiltSensor TiltSensor::Get()
-{
- Dali::TiltSensor sensor;
-
- if ( Adaptor::IsAvailable() )
- {
- // Check whether the keyboard focus manager is already created
- Dali::BaseHandle handle = Dali::Adaptor::Get().GetSingleton( typeid( Dali::TiltSensor ) );
- if(handle)
- {
- // If so, downcast the handle of singleton to keyboard focus manager
- sensor = Dali::TiltSensor( dynamic_cast< TiltSensor* >( handle.GetObjectPtr() ) );
- }
- else
- {
- // Create a singleton instance
- Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
- sensor = TiltSensor::New();
- adaptorImpl.RegisterSingleton( typeid( sensor ), sensor );
- handle = sensor;
- }
- }
-
- return sensor;
-}
-
-TiltSensor::~TiltSensor()
-{
- Disable();
-}
-
-bool TiltSensor::Enable()
-{
- // Make sure sensor API is responding
- bool success = Update();
-
- if ( success )
- {
- if ( !mTimer )
- {
- mTimer = Dali::Timer::New( 1000.0f / mFrequencyHertz );
- mTimer.TickSignal().Connect( mTimerSlot, &TiltSensor::Update );
- }
-
- if ( mTimer &&
- !mTimer.IsRunning() )
- {
- mTimer.Start();
- }
- }
-
- return success;
-}
-
-void TiltSensor::Disable()
-{
- if ( mTimer )
- {
- mTimer.Stop();
- mTimer.Reset();
- }
-}
-
-bool TiltSensor::IsEnabled() const
-{
- return ( mTimer && mTimer.IsRunning() );
-}
-
-float TiltSensor::GetRoll() const
-{
- return mRoll;
-}
-
-float TiltSensor::GetPitch() const
-{
- return mPitch;
-}
-
-Quaternion TiltSensor::GetRotation() const
-{
- return mRotation;
-}
-
-TiltSensor::TiltedSignalV2& TiltSensor::TiltedSignal()
-{
- return mTiltedSignalV2;
-}
-
-void TiltSensor::SetUpdateFrequency( float frequencyHertz )
-{
- DALI_ASSERT_ALWAYS( frequencyHertz > 0.0f && "Frequency must have a positive value" );
-
- if ( fabsf(mFrequencyHertz - frequencyHertz) >= GetRangedEpsilon(mFrequencyHertz, frequencyHertz) )
- {
- mFrequencyHertz = frequencyHertz;
-
- if ( mTimer )
- {
- mTimer.SetInterval( 1000.0f / mFrequencyHertz );
- }
- }
-}
-
-float TiltSensor::GetUpdateFrequency() const
-{
- return mFrequencyHertz;
-}
-
-void TiltSensor::SetRotationThreshold(Radian rotationThreshold)
-{
- mRotationThreshold = rotationThreshold;
-}
-
-Radian TiltSensor::GetRotationThreshold() const
-{
- return mRotationThreshold;
-}
-
-bool TiltSensor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
-{
- bool connected( true );
- TiltSensor* sensor = dynamic_cast<TiltSensor*>( object );
-
- if( sensor &&
- Dali::TiltSensor::SIGNAL_TILTED == signalName )
- {
- sensor->TiltedSignal().Connect( tracker, functor );
- }
- else
- {
- // signalName does not match any signal
- connected = false;
- }
-
- return connected;
-}
-
-TiltSensor::TiltSensor()
-: mFrequencyHertz( Dali::TiltSensor::DEFAULT_UPDATE_FREQUENCY ),
- mTimerSlot( this ),
- mSensorFrameworkHandle( -1 ),
- mRoll( 0.0f ),
- mPitch( 0.0f ),
- mRotation( 0.0f, Vector3::YAXIS ),
- mRotationThreshold( 0.0f )
-{
- mRollValues.resize( NUMBER_OF_SAMPLES, 0.0f );
- mPitchValues.resize( NUMBER_OF_SAMPLES, 0.0f );
-}
-
-bool TiltSensor::Update()
-{
- float newRoll = 0.0f;
- float newPitch = 0.0f;
- Quaternion newRotation;
-#ifdef SENSOR_ENABLED
-
- // Read accelerometer data
-
- mSensorFrameworkHandle = sf_connect( ACCELEROMETER_SENSOR );
- if ( mSensorFrameworkHandle < 0 )
- {
- DALI_LOG_ERROR( "Failed to connect to sensor framework" );
- return false;
- }
-
- if ( sf_start(mSensorFrameworkHandle, 0) < 0 )
- {
- DALI_LOG_ERROR( "Failed to start sensor" );
- sf_disconnect(mSensorFrameworkHandle);
- return false;
- }
-
- sensor_data_t* base_data_values = (sensor_data_t*)malloc(sizeof(sensor_data_t));
-
- int dataErr = sf_get_data(mSensorFrameworkHandle, ACCELEROMETER_BASE_DATA_SET, base_data_values);
- if ( dataErr < 0 )
- {
- DALI_LOG_ERROR( "Failed to retrieve sensor data" );
- free(base_data_values);
- sf_stop(mSensorFrameworkHandle);
- sf_disconnect(mSensorFrameworkHandle);
- return false;
- }
-
- sf_stop(mSensorFrameworkHandle);
- sf_disconnect(mSensorFrameworkHandle);
-
- mRollValues.push_back( base_data_values->values[0] );
- mRollValues.pop_front();
-
- mPitchValues.push_back( base_data_values->values[1] );
- mPitchValues.pop_front();
-
- free(base_data_values);
- base_data_values = NULL;
-
- float averageRoll( 0.0f );
- for ( std::deque<float>::const_iterator iter = mRollValues.begin(); mRollValues.end() != iter; ++iter )
- {
- averageRoll += *iter;
- }
- averageRoll /= mRollValues.size();
-
- float averagePitch( 0.0f );
- for ( std::deque<float>::const_iterator iter = mPitchValues.begin(); mPitchValues.end() != iter; ++iter )
- {
- averagePitch += *iter;
- }
- averagePitch /= mPitchValues.size();
-
- newRoll = Clamp( float(averageRoll / MAX_ACCELEROMETER_XY_VALUE), -1.0f/*min*/, 1.0f/*max*/ );
- newPitch = Clamp( float(averagePitch / MAX_ACCELEROMETER_XY_VALUE), -1.0f/*min*/, 1.0f/*max*/ );
-
- newRotation = Quaternion( newRoll * Math::PI * -0.5f, Vector3::YAXIS ) *
- Quaternion( newPitch * Math::PI * -0.5f, Vector3::XAXIS );
-#endif // SENSOR_ENABLED
-
- Radian angle(Quaternion::AngleBetween(newRotation, mRotation));
- // If the change in value is more than the threshold then emit tilted signal.
- if( angle > mRotationThreshold )
- {
- mRoll = newRoll;
- mPitch = newPitch;
- mRotation = newRotation;
-
- if ( !mTiltedSignalV2.Empty() )
- {
- Dali::TiltSensor handle( this );
- mTiltedSignalV2.Emit( handle );
- }
- }
-
- return true;
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_ADAPTOR_TILT_SENSOR_H__
-#define __DALI_INTERNAL_ADAPTOR_TILT_SENSOR_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <deque>
-#include <dali/public-api/object/base-object.h>
-#include <timer.h>
-
-// INTERNAL INCLUDES
-#include <tilt-sensor.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-/**
- * TiltSensor provides pitch & roll values when the device is tilted.
- */
-class TiltSensor : public Dali::BaseObject
-{
-public:
-
- typedef Dali::TiltSensor::TiltedSignalV2 TiltedSignalV2;
-
- /**
- * Create a TiltSensor.
- * This should only be called once by the Adaptor class.
- * @return A newly allocated tilt-sensor.
- */
- static Dali::TiltSensor New();
-
- /**
- * @copydoc Dali::TiltSensor::Get()
- */
- static Dali::TiltSensor Get();
-
- /**
- * @copydoc Dali::TiltSensor::Enable()
- */
- bool Enable();
-
- /**
- * @copydoc Dali::TiltSensor::Disable()
- */
- void Disable();
-
- /**
- * @copydoc Dali::TiltSensor::IsEnabled()
- */
- bool IsEnabled() const;
-
- /**
- * @copydoc Dali::TiltSensor::GetRoll()
- */
- float GetRoll() const;
-
- /**
- * @copydoc Dali::TiltSensor::GetPitch()
- */
- float GetPitch() const;
-
- /**
- * @copydoc Dali::TiltSensor::GetRotation()
- */
- Quaternion GetRotation() const;
-
- /**
- * @copydoc Dali::TiltSensor::TiltedSignal()
- */
- TiltedSignalV2& TiltedSignal();
-
- /**
- * @copydoc Dali::TiltSensor::SetUpdateFrequency()
- */
- void SetUpdateFrequency( float frequencyHertz );
-
- /**
- * @copydoc Dali::TiltSensor::GetUpdateFrequency()
- */
- float GetUpdateFrequency() const;
-
- /**
- * @copydoc Dali::TiltSensor::SetRotationThreshold()
- */
- void SetRotationThreshold(Radian rotationThreshold);
-
- /**
- * @copydoc Dali::TiltSensor::GetRotationThreshold()
- */
- Radian GetRotationThreshold() const;
-
- /**
- * Connects a callback function with the object's signals.
- * @param[in] object The object providing the signal.
- * @param[in] tracker Used to disconnect the signal.
- * @param[in] signalName The signal to connect to.
- * @param[in] functor A newly allocated FunctorDelegate.
- * @return True if the signal was connected.
- * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
- */
- static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
-
-private:
-
- /**
- * Private constructor; see also TiltSensor::New()
- */
- TiltSensor();
-
- /**
- * Destructor
- */
- virtual ~TiltSensor();
-
- /**
- * Timer callback to update the tilt values
- */
- bool Update();
-
- // Undefined
- TiltSensor(const TiltSensor&);
-
- // Undefined
- TiltSensor& operator=(TiltSensor&);
-
-private:
-
- float mFrequencyHertz;
- Dali::Timer mTimer;
- SlotDelegate< TiltSensor > mTimerSlot;
-
- int mSensorFrameworkHandle;
-
- float mRoll;
- float mPitch;
- Quaternion mRotation;
-
- Radian mRotationThreshold;
-
- std::deque<float> mRollValues;
- std::deque<float> mPitchValues;
-
- TiltedSignalV2 mTiltedSignalV2;
-};
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-// Helpers for public-api forwarding methods
-
-inline Internal::Adaptor::TiltSensor& GetImplementation(Dali::TiltSensor& sensor)
-{
- DALI_ASSERT_ALWAYS( sensor && "TiltSensor handle is empty" );
-
- BaseObject& handle = sensor.GetBaseObject();
-
- return static_cast<Internal::Adaptor::TiltSensor&>(handle);
-}
-
-inline const Internal::Adaptor::TiltSensor& GetImplementation(const Dali::TiltSensor& sensor)
-{
- DALI_ASSERT_ALWAYS( sensor && "TiltSensor handle is empty" );
-
- const BaseObject& handle = sensor.GetBaseObject();
-
- return static_cast<const Internal::Adaptor::TiltSensor&>(handle);
-}
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_ADAPTOR_TILT_SENSOR_H__
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include "tts-player-impl.h"
-
-// EXTERNAL INCLUDES
-#include <tts.h>
-#include <stdio.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/type-registry.h>
-
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace // unnamed namespace
-{
-// Type Registration
-Dali::BaseHandle Create()
-{
- return Dali::TtsPlayer::Get() ;
-}
-
-Dali::TypeRegistration mType( typeid(Dali::TtsPlayer), typeid(Dali::BaseHandle), Create ) ;
-} // unnamed namespace
-
-#if defined(DEBUG_ENABLED)
-Debug::Filter* TtsPlayer::gLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_TTS_PLAYER");
-#endif
-
-Dali::TtsPlayer TtsPlayer::New(Dali::TtsPlayer::Mode mode)
-{
- Dali::TtsPlayer player = Dali::TtsPlayer(new TtsPlayer(mode));
-
- return player;
-}
-
-TtsPlayer::TtsPlayer(Dali::TtsPlayer::Mode mode)
-: mInitialized(false),
- mUnplayedString(""),
- mUtteranceId(0),
- mTtsMode(mode)
-{
- Initialize();
-}
-
-TtsPlayer::~TtsPlayer()
-{
- // If it is playing, stop it
- Stop();
-
- // Unset the callback funtion for TTS state change
- int retVal = tts_unset_state_changed_cb(mTtsHandle);
- if( retVal != TTS_ERROR_NONE )
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
-
- // Destroy the TTS handle and disconnects the daemon
- retVal = tts_destroy(mTtsHandle);
- if( retVal != TTS_ERROR_NONE )
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
-}
-
-void TtsPlayer::Initialize()
-{
- // Create the TTS handle
- int retVal = tts_create(&mTtsHandle);
-
- if( retVal != TTS_ERROR_NONE )
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
- else
- {
- // Set the callback funtion for TTS state change
- retVal = tts_set_state_changed_cb(mTtsHandle, &StateChangedCallback, this);
- if( retVal != TTS_ERROR_NONE )
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
-
- // Check tts mode
- tts_mode_e ttsMode = TTS_MODE_DEFAULT;
- switch (mTtsMode)
- {
- case Dali::TtsPlayer::DEFAULT:
- ttsMode = TTS_MODE_DEFAULT;
- break;
- case Dali::TtsPlayer::NOTIFICATION:
- ttsMode = TTS_MODE_NOTIFICATION;
- break;
- case Dali::TtsPlayer::SCREEN_READER:
- ttsMode = TTS_MODE_SCREEN_READER;
- break;
- default:
- break;
- }
-
- // Set mode
- retVal = tts_set_mode(mTtsHandle, ttsMode);
- if(retVal != TTS_ERROR_NONE)
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
-
- // Connect the TTS daemon asynchronously
- retVal = tts_prepare(mTtsHandle);
- if(retVal != TTS_ERROR_NONE)
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
- }
-}
-
-void TtsPlayer::Play(const std::string& text)
-{
- if(mInitialized)
- {
- Stop();
-
- // Add text to the queue, and use normal speed, default language and default voice set by the user
- int retVal = tts_add_text(mTtsHandle, text.c_str(), NULL, TTS_VOICE_TYPE_AUTO, TTS_SPEED_AUTO, &mUtteranceId);
- if(retVal != TTS_ERROR_NONE)
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
- else
- {
- // Start synthesizing voice from text in the queue and play synthesized audio data
- retVal = tts_play(mTtsHandle);
- if(retVal != TTS_ERROR_NONE)
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
- }
- }
- else
- {
- mUnplayedString = text;
- }
-}
-
-void TtsPlayer::Stop()
-{
- if(mInitialized)
- {
- // Check the current TTS state
- tts_state_e state;
- int retVal = tts_get_state(mTtsHandle, &state);
- if(retVal != TTS_ERROR_NONE)
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
- else if(state == TTS_STATE_PLAYING || state == TTS_STATE_PAUSED)
- {
- // If it is playing or paused, stop playing and clear the queue
- retVal = tts_stop(mTtsHandle);
- if( retVal != TTS_ERROR_NONE )
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
- }
- }
-}
-
-void TtsPlayer::Pause()
-{
- if(mInitialized)
- {
- // Check the current TTS state
- tts_state_e state;
- int retVal = tts_get_state(mTtsHandle, &state);
- if(retVal != TTS_ERROR_NONE)
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
- else if(state == TTS_STATE_PLAYING)
- {
- // If the player is playing, pause it.
- retVal = tts_pause(mTtsHandle);
- if( retVal != TTS_ERROR_NONE )
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
- }
- }
-}
-
-void TtsPlayer::Resume()
-{
- if(mInitialized)
- {
- // Check the current TTS state
- tts_state_e state;
- int retVal = tts_get_state(mTtsHandle, &state);
- if(retVal != TTS_ERROR_NONE)
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
- else if(state == TTS_STATE_PAUSED)
- {
- // If the player is paused, resume it.
- retVal = tts_play(mTtsHandle);
- if( retVal != TTS_ERROR_NONE )
- {
- LogErrorCode(static_cast<tts_error_e>(retVal));
- }
- }
- }
-}
-
-void TtsPlayer::StateChangedCallback(tts_h tts, tts_state_e previous, tts_state_e current, void *userData)
-{
- TtsPlayer* obj = static_cast<TtsPlayer*>(userData);
- if(!obj->mInitialized && current == TTS_STATE_READY)
- {
- obj->mInitialized = true;
-
- // if there is queued text before initialization, play it
- if(obj->mUnplayedString != "")
- {
- obj->Play(obj->mUnplayedString);
- obj->mUnplayedString = "";
- }
- }
-}
-
-void TtsPlayer::LogErrorCode(tts_error_e reason)
-{
- std::string error_string;
-
- switch (reason)
- {
- case TTS_ERROR_NONE:
- {
- break;
- }
- case TTS_ERROR_OUT_OF_MEMORY:
- {
- error_string = "TTS: Out of Memory\n";
- break;
- }
- case TTS_ERROR_IO_ERROR:
- {
- error_string = "TTS: I/O error\n";
- break;
- }
- case TTS_ERROR_INVALID_PARAMETER:
- {
- error_string = "TTS: Invalid parameter\n";
- break;
- }
- case TTS_ERROR_OUT_OF_NETWORK:
- {
- error_string = "TTS: Out of network\n";
- break;
- }
- case TTS_ERROR_INVALID_STATE:
- {
- error_string = "TTS: Invalid state\n";
- break;
- }
- case TTS_ERROR_INVALID_VOICE:
- {
- error_string = "TTS: Invalid voice\n";
- break;
- }
- case TTS_ERROR_ENGINE_NOT_FOUND:
- {
- error_string = "TTS: No available engine\n";
- break;
- }
- case TTS_ERROR_TIMED_OUT:
- {
- error_string = "TTS: No answer from the daemon\n";
- break;
- }
- case TTS_ERROR_OPERATION_FAILED:
- {
- error_string = "TTS: Operation failed\n";
- break;
- }
- default:
- {
- error_string = "Invalid TTS error code\n";
- break;
- }
- }
-
- if(reason != TTS_ERROR_NONE)
- {
- DALI_LOG_WARNING("[%s:%d] tts error : %s\n", __FUNCTION__, __LINE__, error_string.c_str());
- }
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef __DALI_INTERNAL_TTS_PLAYER_H__
-#define __DALI_INTERNAL_TTS_PLAYER_H__
-
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <tts.h>
-#include <string>
-
-#include <dali/integration-api/debug.h>
-#include <dali/public-api/object/base-object.h>
-#include <tts-player.h>
-
-// INTERNAL INCLUDES
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-/**
- * Text-to-speech player
- */
-class TtsPlayer : public Dali::BaseObject
-{
-
-public:
-
- /**
- * Create a TtsPlayer with the given mode.
- * This should only be called once by the Adaptor class for each given mode.
- * @param mode the mode of tts-player
- * @return A newly created TtsPlayer.
- */
- static Dali::TtsPlayer New(Dali::TtsPlayer::Mode mode);
-
- /**
- * @copydoc TtsPlayer::Play()
- */
- void Play(const std::string& text);
-
- /**
- * @copydoc TtsPlayer::Stop()
- */
- void Stop();
-
- /**
- * @copydoc TtsPlayer::Pause()
- */
- void Pause();
-
- /**
- * @copydoc TtsPlayer::Resume()
- */
- void Resume();
-
-private:
-
- /**
- * Private Constructor; see also TtsPlayer::New()
- * @param mode the mode of tts-player
- */
- TtsPlayer(Dali::TtsPlayer::Mode mode);
-
- /**
- * Destructor
- */
- virtual ~TtsPlayer();
-
- /**
- * Initializes the player.
- */
- void Initialize();
-
- /**
- * Logs the error code.
- * @param[in] reason The error code
- */
- void LogErrorCode(tts_error_e reason);
-
- /**
- * Called when the state of TTS is changed.
- *
- * @param[in] tts The handle for TTS
- * @param[in] previous A previous state
- * @param[in] current A current state
- * @param[in] userData The user data passed from the callback registration function.
- */
- static void StateChangedCallback(tts_h tts, tts_state_e previous, tts_state_e current, void *userData);
-
- // Undefined
- TtsPlayer(const TtsPlayer&);
-
- // Undefined
- TtsPlayer& operator=(TtsPlayer&);
-
-private:
-
- bool mInitialized; ///< Whether the TTS player is initialised successfully or not
- std::string mUnplayedString; ///< The text that can not be played because tts engine is not yet initialized
- tts_h mTtsHandle; ///< The handle of TTS
- int mUtteranceId; ///< The utterance ID
-
- Dali::TtsPlayer::Mode mTtsMode; ///< The current mode of tts engine
-
-#if defined(DEBUG_ENABLED)
-public:
- static Debug::Filter* gLogFilter;
-#endif
-};
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-// Helpers for public-api forwarding methods
-
-inline Internal::Adaptor::TtsPlayer& GetImplementation(Dali::TtsPlayer& player)
-{
- DALI_ASSERT_ALWAYS( player && "TtsPlayer handle is empty" );
-
- BaseObject& handle = player.GetBaseObject();
-
- return static_cast<Internal::Adaptor::TtsPlayer&>(handle);
-}
-
-inline const Internal::Adaptor::TtsPlayer& GetImplementation(const Dali::TtsPlayer& player)
-{
- DALI_ASSERT_ALWAYS( player && "TtsPlayer handle is empty" );
-
- const BaseObject& handle = player.GetBaseObject();
-
- return static_cast<const Internal::Adaptor::TtsPlayer&>(handle);
-}
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_TTS_PLAYER_H__
+++ /dev/null
-/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <vconf.h>
-#include <vconf-keys.h>
-
-#include <dali/integration-api/debug.h>
-
-// INTERNAL INCLUDES
-#include "vsync-monitor.h"
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace Adaptor
-{
-
-namespace
-{
-
-#if defined(DEBUG_ENABLED)
-Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_VSYNC_MONITOR");
-#endif
-
-const char * const DRM_DEVICE( "/dev/dri/card0" );
-const int FD_NONE( -1 );
-
-void ScreenStatusChanged(keynode_t* node, void* data)
-{
- VSyncMonitor* vsyncMonitor( static_cast< VSyncMonitor* >( data ) );
-
- int status = 0;
- vconf_get_int( VCONFKEY_PM_STATE, &status );
-
- // status values
- // - VCONFKEY_PM_STATE_NORMAL : turn vsync on
- // - VCONFKEY_PM_STATE_LCDDIM : turn vsync off
- // - VCONFKEY_PM_STATE_LCDOFF : turn vsync off
- // - VCONFKEY_PM_STATE_SLEEP : turn vsync off
- const bool screenOn( VCONFKEY_PM_STATE_NORMAL == status );
-
- vsyncMonitor->SetUseHardware( screenOn );
-
- DALI_LOG_INFO( gLogFilter, Debug::Concise, "%s, Screen %s.\n", __PRETTY_FUNCTION__, screenOn ? "On" : "Off" );
-}
-
-} // unnamed namespace
-
-VSyncMonitor::VSyncMonitor()
-: mFileDescriptor( FD_NONE ),
- mUseHardware( true )
-{
- vconf_notify_key_changed( VCONFKEY_PM_STATE, ScreenStatusChanged, this );
-}
-
-VSyncMonitor::~VSyncMonitor()
-{
- Terminate();
-
- vconf_ignore_key_changed( VCONFKEY_PM_STATE, ScreenStatusChanged );
-}
-
-void VSyncMonitor::SetUseHardware( bool useHardware )
-{
- mUseHardware = useHardware;
-}
-
-void VSyncMonitor::Initialize()
-{
- DALI_ASSERT_DEBUG( mFileDescriptor == FD_NONE && "VSyncMonitor::Initialize() called twice" );
-
- // Read initial 'use hardware' status
- ScreenStatusChanged( NULL, this );
-
- // open /dev node
- mFileDescriptor = open( DRM_DEVICE, O_RDWR );
-
- // setup vblank request - block and wait for next vblank
- mVBlankInfo.request.type = DRM_VBLANK_NEXTONMISS;
- mVBlankInfo.request.sequence = 0;
- mVBlankInfo.request.signal = 0;
-
- // setup vblank reply - block and wait for next vblank
- mVBlankInfo.reply.type = DRM_VBLANK_NEXTONMISS;
- mVBlankInfo.reply.sequence = 0;
- mVBlankInfo.reply.tval_sec = 0;
- mVBlankInfo.reply.tval_usec = 0;
-}
-
-void VSyncMonitor::Terminate()
-{
- if( mFileDescriptor != FD_NONE )
- {
- close( mFileDescriptor );
- mFileDescriptor = FD_NONE;
- }
-}
-
-bool VSyncMonitor::UseHardware()
-{
- return mUseHardware && (FD_NONE != mFileDescriptor );
-}
-
-
-bool VSyncMonitor::DoSync( unsigned int& frameNumber, unsigned int& seconds, unsigned int& microseconds )
-{
- DALI_ASSERT_DEBUG( mFileDescriptor != FD_NONE && "ECoreX::VSyncMonitor is not initialized" );
-
- if( 0 == drmWaitVBlank( mFileDescriptor, &mVBlankInfo ) )
- {
- frameNumber = mVBlankInfo.reply.sequence;
- seconds = mVBlankInfo.reply.tval_sec;
- microseconds = mVBlankInfo.reply.tval_usec;
-
- return true;
- }
-
- return false;
-}
-
-} // namespace Adaptor
-
-} // namespace Internal
-
-} // namespace Dali
# mobile profile internal files
-adaptor_common_internal_src_files += \
- $(adaptor_common_dir)/../mobile/mobile-render-surface-factory.cpp \
- $(adaptor_common_dir)/../mobile/mobile-system-settings.cpp \
- $(adaptor_common_dir)/../mobile/mobile-color-controller-impl.cpp
\ No newline at end of file
+adaptor_common_internal_mobile_profile_src_files = \
+ $(adaptor_mobile_dir)/mobile-render-surface-factory.cpp \
+ $(adaptor_mobile_dir)/mobile-system-settings.cpp \
+ $(adaptor_mobile_dir)/mobile-color-controller-impl.cpp
+
+adaptor_common_application_mobile_profile_src_files = \
+ $(adaptor_mobile_dir)/mobile-render-surface-factory.cpp \
+ $(adaptor_mobile_dir)/mobile-system-settings.cpp \
+ $(adaptor_mobile_dir)/mobile-color-controller-impl.cpp
$(adaptor_public_api_dir)/tilt-sensor.h
public_api_application_header_files = \
- $(adaptor_public_api_dir)/application.h
+ $(adaptor_public_api_dir)/application.h
adaptor_dali_header_file = \
$(adaptor_public_api_dir)/dali.h \
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "accessibility-manager-impl.h"
+
+// EXTERNAL INCLUDES
+#include <vconf.h>
+
+#include <dali/public-api/dali-core.h>
+#include <dali/integration-api/debug.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/gesture-requests.h>
+#include "system-settings.h"
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gAccessibilityManagerLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_MANAGER");
+#endif
+
+void AccessibilityOnOffNotification(keynode_t* node, void* data)
+{
+ AccessibilityManager* manager = static_cast<AccessibilityManager*>(data);
+ int isEnabled = 0;
+ vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &isEnabled);
+
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled?"ENABLED":"DISABLED");
+
+ if(isEnabled == 1)
+ {
+ manager->EnableAccessibility();
+ }
+ else
+ {
+ manager->DisableAccessibility();
+ }
+}
+
+BaseHandle Create()
+{
+ BaseHandle handle( AccessibilityManager::Get() );
+
+ if ( !handle && Adaptor::IsAvailable() )
+ {
+ Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
+ Dali::AccessibilityManager manager = Dali::AccessibilityManager( new AccessibilityManager() );
+ adaptorImpl.RegisterSingleton( typeid( manager ), manager );
+ handle = manager;
+ }
+
+ return handle;
+}
+TypeRegistration ACCESSIBILITY_MANAGER_TYPE( typeid(Dali::AccessibilityManager), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
+
+} // unnamed namespace
+
+Dali::AccessibilityManager AccessibilityManager::Get()
+{
+ Dali::AccessibilityManager manager;
+
+ if ( Adaptor::IsAvailable() )
+ {
+ // Check whether the singleton is already created
+ Dali::BaseHandle handle = Dali::Adaptor::Get().GetSingleton( typeid( Dali::AccessibilityManager ) );
+ if(handle)
+ {
+ // If so, downcast the handle
+ manager = Dali::AccessibilityManager( dynamic_cast< AccessibilityManager* >( handle.GetObjectPtr() ) );
+ }
+ }
+
+ return manager;
+}
+
+Vector2 AccessibilityManager::GetReadPosition() const
+{
+ return mReadPosition;
+}
+
+void AccessibilityManager::SetActionHandler(AccessibilityActionHandler& handler)
+{
+ mActionHandler = &handler;
+}
+
+void AccessibilityManager::SetGestureHandler(AccessibilityGestureHandler& handler)
+{
+ if( mAccessibilityGestureDetector )
+ {
+ mAccessibilityGestureDetector->SetGestureHandler(handler);
+ }
+}
+
+bool AccessibilityManager::HandleActionClearFocusEvent()
+{
+ bool ret = false;
+
+ Dali::AccessibilityManager handle( this );
+
+ /*
+ * In order to application decide reading action first,
+ * emit ActionClearFocus signal in first, ClearAccessibilityFocus for handler in next
+ */
+ if ( !mIndicatorFocused )
+ {
+ if( !mActionClearFocusSignalV2.Empty() )
+ {
+ mActionClearFocusSignalV2.Emit( handle );
+ }
+ }
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->ClearAccessibilityFocus();
+ }
+
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+bool AccessibilityManager::HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp)
+{
+ bool ret = false;
+
+ Dali::AccessibilityManager handle( this );
+
+ Dali::TouchEvent touchEvent(timeStamp);
+ touchEvent.points.push_back(point);
+
+ /*
+ * In order to application decide touch action first,
+ * emit ActionScroll signal in first, AccessibilityActionScroll for handler in next
+ */
+ if ( !mIndicatorFocused )
+ {
+ if( !mActionScrollSignalV2.Empty() )
+ {
+ mActionScrollSignalV2.Emit( handle, touchEvent );
+ }
+ }
+
+ Integration::TouchEvent event;
+ if (mCombiner.GetNextTouchEvent(point, timeStamp, event))
+ {
+ // Process the touch event in accessibility gesture detector
+ if( mAccessibilityGestureDetector )
+ {
+ mAccessibilityGestureDetector->SendEvent(event);
+ ret = true;
+ }
+ }
+
+ return ret;
+}
+
+bool AccessibilityManager::HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp)
+{
+ bool ret = false;
+
+ Dali::TouchEvent touchEvent(timeStamp);
+ touchEvent.points.push_back(point);
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionTouch(touchEvent);
+ }
+ return ret;
+}
+
+bool AccessibilityManager::HandleActionBackEvent()
+{
+ bool ret = false;
+
+ Dali::AccessibilityManager handle( this );
+
+ /*
+ * In order to application decide reading action first,
+ * emit ActionBack signal in first, AccessibilityActionBack for handler in next
+ */
+ if ( !mIndicatorFocused )
+ {
+ if( !mActionBackSignalV2.Empty() )
+ {
+ mActionBackSignalV2.Emit( handle );
+ }
+ }
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionBack();
+ }
+
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+void AccessibilityManager::HandleActionEnableEvent()
+{
+ EnableAccessibility();
+}
+
+void AccessibilityManager::HandleActionDisableEvent()
+{
+ DisableAccessibility();
+}
+
+void AccessibilityManager::EnableAccessibility()
+{
+ if(mIsEnabled == false)
+ {
+ mIsEnabled = true;
+
+ if( mActionHandler )
+ {
+ mActionHandler->ChangeAccessibilityStatus();
+ }
+
+ //emit status changed signal
+ Dali::AccessibilityManager handle( this );
+ mStatusChangedSignalV2.Emit( handle );
+ }
+}
+
+void AccessibilityManager::DisableAccessibility()
+{
+ if(mIsEnabled == true)
+ {
+ mIsEnabled = false;
+
+ if( mActionHandler )
+ {
+ mActionHandler->ChangeAccessibilityStatus();
+ }
+
+ //emit status changed signal
+ Dali::AccessibilityManager handle( this );
+ mStatusChangedSignalV2.Emit( handle );
+
+ // Destroy the TtsPlayer if exists.
+ Dali::Adaptor& adaptor = Dali::Adaptor::Get();
+ Adaptor::GetImplementation(adaptor).DestroyTtsPlayer(Dali::TtsPlayer::SCREEN_READER);
+ }
+}
+
+bool AccessibilityManager::IsEnabled() const
+{
+ return mIsEnabled;
+}
+
+void AccessibilityManager::SetIndicator(Indicator* indicator)
+{
+ mIndicator = indicator;
+}
+
+AccessibilityManager::AccessibilityManager()
+: mIsEnabled(false),
+ mActionHandler(NULL),
+ mIndicator(NULL),
+ mIndicatorFocused(false)
+{
+ int isEnabled = 0;
+ vconf_get_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, &isEnabled);
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled?"ENABLED":"DISABLED");
+
+ if(isEnabled == 1)
+ {
+ mIsEnabled = true;
+ }
+ else
+ {
+ mIsEnabled = false;
+ }
+
+ vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification, this );
+
+ mAccessibilityGestureDetector = new AccessibilityGestureDetector();
+}
+
+AccessibilityManager::~AccessibilityManager()
+{
+ vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, AccessibilityOnOffNotification );
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+# tizen
+
+adaptor_tizen_internal_src_files = \
+ $(adaptor_tizen_dir)/accessibility-manager-impl-tizen.cpp \
+ $(adaptor_tizen_dir)/vsync-monitor-tizen.cpp \
+ $(adaptor_tizen_dir)/tilt-sensor-impl-tizen.cpp \
+ $(adaptor_tizen_dir)/tts-player-impl-tizen.cpp
+
+adaptor_tizen_application_src_files = \
+ $(adaptor_tizen_dir)/framework-tizen.cpp
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "framework.h"
+
+// EXTERNAL INCLUDES
+#include <app.h>
+#include <bundle.h>
+#include <Ecore.h>
+#include <boost/bind.hpp>
+
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <callback-manager.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+
+/// Application Status Enum
+enum
+{
+ APP_CREATE,
+ APP_TERMINATE,
+ APP_PAUSE,
+ APP_RESUME,
+ APP_RESET,
+ APP_LANGUAGE_CHANGE,
+};
+
+} // Unnamed namespace
+
+/**
+ * Impl to hide EFL data members
+ */
+struct Framework::Impl
+{
+ // Constructor
+
+ Impl(void* data)
+ {
+ mEventCallback.create = AppCreate;
+ mEventCallback.terminate = AppTerminate;
+ mEventCallback.pause = AppPause;
+ mEventCallback.resume = AppResume;
+ mEventCallback.service = AppService;
+ mEventCallback.low_memory = NULL;
+ mEventCallback.low_battery = NULL;
+ mEventCallback.device_orientation = DeviceRotated;
+ mEventCallback.language_changed = AppLanguageChange;
+ mEventCallback.region_format_changed = NULL;
+
+ mCallbackManager = CallbackManager::New();
+ }
+
+ ~Impl()
+ {
+ // we're quiting the main loop so
+ // mCallbackManager->RemoveAllCallBacks() does not need to be called
+ // to delete our abort handler
+ delete mCallbackManager;
+ }
+
+ // Data
+
+ boost::function<void(void)> mAbortCallBack;
+ app_event_callback_s mEventCallback;
+ CallbackManager *mCallbackManager;
+ // Static methods
+
+ /**
+ * Called by AppCore on application creation.
+ */
+ static bool AppCreate(void *data)
+ {
+ return static_cast<Framework*>(data)->SlpAppStatusHandler(APP_CREATE);
+ }
+
+ /**
+ * Called by AppCore when the application should terminate.
+ */
+ static void AppTerminate(void *data)
+ {
+ static_cast<Framework*>(data)->SlpAppStatusHandler(APP_TERMINATE);
+ }
+
+ /**
+ * Called by AppCore when the application is paused.
+ */
+ static void AppPause(void *data)
+ {
+ static_cast<Framework*>(data)->SlpAppStatusHandler(APP_PAUSE);
+ }
+
+ /**
+ * Called by AppCore when the application is resumed.
+ */
+ static void AppResume(void *data)
+ {
+ static_cast<Framework*>(data)->SlpAppStatusHandler(APP_RESUME);
+ }
+
+ /**
+ * 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 AppService(service_h service, void *data)
+ {
+ Framework* framework = static_cast<Framework*>(data);
+
+ if(framework)
+ {
+ bundle *bundleData = NULL;
+ service_to_bundle(service, &bundleData);
+
+ 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);
+ }
+ }
+
+ /**
+ * Called by AppCore when the language changes on the device.
+ */
+ static void AppLanguageChange(void* data)
+ {
+ static_cast<Framework*>(data)->SlpAppStatusHandler(APP_LANGUAGE_CHANGE);
+ }
+
+ static void DeviceRotated(app_device_orientation_e orientation, void *user_data)
+ {
+ switch(orientation)
+ {
+ case APP_DEVICE_ORIENTATION_0:
+ break;
+ case APP_DEVICE_ORIENTATION_90:
+ break;
+ case APP_DEVICE_ORIENTATION_180:
+ break;
+ case APP_DEVICE_ORIENTATION_270:
+ break;
+ }
+ }
+
+};
+
+Framework::Framework(Framework::Observer& observer, int *argc, char ***argv, const std::string& name)
+: mObserver(observer),
+ mInitialised(false),
+ mRunning(false),
+ mArgc(argc),
+ mArgv(argv),
+ mName(name),
+ mBundleName(""),
+ mBundleId(""),
+ mAbortHandler(boost::bind(&Framework::AbortCallback, this)),
+ mImpl(NULL)
+{
+ InitThreads();
+ mImpl = new Impl(this);
+}
+
+Framework::~Framework()
+{
+ if (mRunning)
+ {
+ Quit();
+ }
+
+ delete mImpl;
+}
+
+void Framework::Run()
+{
+ mRunning = true;
+
+ app_efl_main(mArgc, mArgv, &mImpl->mEventCallback, this);
+
+ mRunning = false;
+}
+
+void Framework::Quit()
+{
+ app_efl_exit();
+}
+
+bool Framework::IsMainLoopRunning()
+{
+ return mRunning;
+}
+
+void Framework::AddAbortCallback(boost::function<void(void)> callBack)
+{
+ mImpl->mAbortCallBack = callBack;
+}
+
+std::string Framework::GetBundleName() const
+{
+ return mBundleName;
+}
+
+void Framework::SetBundleName(const std::string& name)
+{
+ mBundleName = name;
+}
+
+std::string Framework::GetBundleId() const
+{
+ return mBundleId;
+}
+
+void Framework::SetBundleId(const std::string& id)
+{
+ mBundleId = id;
+}
+
+void Framework::AbortCallback( )
+{
+ // if an abort call back has been installed run it.
+ if (mImpl->mAbortCallBack)
+ {
+ mImpl->mAbortCallBack();
+ }
+ else
+ {
+ Quit();
+ }
+}
+
+bool Framework::SlpAppStatusHandler(int type)
+{
+ switch (type)
+ {
+ case APP_CREATE:
+ {
+ mInitialised = true;
+
+ // Connect to abnormal exit signals
+ mAbortHandler.AbortOnSignal( SIGINT );
+ mAbortHandler.AbortOnSignal( SIGQUIT );
+ mAbortHandler.AbortOnSignal( SIGKILL );
+
+ mObserver.OnInit();
+ break;
+ }
+
+ case APP_RESET:
+ mObserver.OnReset();
+ break;
+
+ case APP_RESUME:
+ mObserver.OnResume();
+ break;
+
+ case APP_TERMINATE:
+ mObserver.OnTerminate();
+ break;
+
+ case APP_PAUSE:
+ mObserver.OnPause();
+ break;
+
+ case APP_LANGUAGE_CHANGE:
+ mObserver.OnLanguageChanged();
+ break;
+
+ default:
+ break;
+ }
+
+ return true;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "tilt-sensor-impl.h"
+
+// EXTERNAL INCLUDES
+#include <cmath>
+#ifdef DALI_PROFILE_LITE
+#include <sensor_internal.h>
+#else
+#include <sensor.h>
+#endif
+
+#include <dali/public-api/object/type-registry.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <adaptor-impl.h>
+
+#ifdef __arm__
+#define SENSOR_ENABLED
+#endif
+
+namespace // unnamed namespace
+{
+
+const int NUMBER_OF_SAMPLES = 10;
+
+const float MAX_ACCELEROMETER_XY_VALUE = 9.8f;
+
+// Type Registration
+Dali::BaseHandle Create()
+{
+ return Dali::Internal::Adaptor::TiltSensor::Get();
+}
+
+Dali::TypeRegistration typeRegistration( typeid(Dali::TiltSensor), typeid(Dali::BaseHandle), Create );
+
+Dali::SignalConnectorType signalConnector1( typeRegistration, Dali::TiltSensor::SIGNAL_TILTED, Dali::Internal::Adaptor::TiltSensor::DoConnectSignal );
+
+} // unnamed namespace
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+Dali::TiltSensor TiltSensor::New()
+{
+ Dali::TiltSensor sensor = Dali::TiltSensor(new TiltSensor());
+
+ return sensor;
+}
+
+Dali::TiltSensor TiltSensor::Get()
+{
+ Dali::TiltSensor sensor;
+
+ if ( Adaptor::IsAvailable() )
+ {
+ // Check whether the keyboard focus manager is already created
+ Dali::BaseHandle handle = Dali::Adaptor::Get().GetSingleton( typeid( Dali::TiltSensor ) );
+ if(handle)
+ {
+ // If so, downcast the handle of singleton to keyboard focus manager
+ sensor = Dali::TiltSensor( dynamic_cast< TiltSensor* >( handle.GetObjectPtr() ) );
+ }
+ else
+ {
+ // Create a singleton instance
+ Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
+ sensor = TiltSensor::New();
+ adaptorImpl.RegisterSingleton( typeid( sensor ), sensor );
+ handle = sensor;
+ }
+ }
+
+ return sensor;
+}
+
+TiltSensor::~TiltSensor()
+{
+ Disable();
+}
+
+bool TiltSensor::Enable()
+{
+ // Make sure sensor API is responding
+ bool success = Update();
+
+ if ( success )
+ {
+ if ( !mTimer )
+ {
+ mTimer = Dali::Timer::New( 1000.0f / mFrequencyHertz );
+ mTimer.TickSignal().Connect( mTimerSlot, &TiltSensor::Update );
+ }
+
+ if ( mTimer &&
+ !mTimer.IsRunning() )
+ {
+ mTimer.Start();
+ }
+ }
+
+ return success;
+}
+
+void TiltSensor::Disable()
+{
+ if ( mTimer )
+ {
+ mTimer.Stop();
+ mTimer.Reset();
+ }
+}
+
+bool TiltSensor::IsEnabled() const
+{
+ return ( mTimer && mTimer.IsRunning() );
+}
+
+float TiltSensor::GetRoll() const
+{
+ return mRoll;
+}
+
+float TiltSensor::GetPitch() const
+{
+ return mPitch;
+}
+
+Quaternion TiltSensor::GetRotation() const
+{
+ return mRotation;
+}
+
+TiltSensor::TiltedSignalV2& TiltSensor::TiltedSignal()
+{
+ return mTiltedSignalV2;
+}
+
+void TiltSensor::SetUpdateFrequency( float frequencyHertz )
+{
+ DALI_ASSERT_ALWAYS( frequencyHertz > 0.0f && "Frequency must have a positive value" );
+
+ if ( fabsf(mFrequencyHertz - frequencyHertz) >= GetRangedEpsilon(mFrequencyHertz, frequencyHertz) )
+ {
+ mFrequencyHertz = frequencyHertz;
+
+ if ( mTimer )
+ {
+ mTimer.SetInterval( 1000.0f / mFrequencyHertz );
+ }
+ }
+}
+
+float TiltSensor::GetUpdateFrequency() const
+{
+ return mFrequencyHertz;
+}
+
+void TiltSensor::SetRotationThreshold(Radian rotationThreshold)
+{
+ mRotationThreshold = rotationThreshold;
+}
+
+Radian TiltSensor::GetRotationThreshold() const
+{
+ return mRotationThreshold;
+}
+
+bool TiltSensor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+ bool connected( true );
+ TiltSensor* sensor = dynamic_cast<TiltSensor*>( object );
+
+ if( sensor &&
+ Dali::TiltSensor::SIGNAL_TILTED == signalName )
+ {
+ sensor->TiltedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
+TiltSensor::TiltSensor()
+: mFrequencyHertz( Dali::TiltSensor::DEFAULT_UPDATE_FREQUENCY ),
+ mTimerSlot( this ),
+ mSensorFrameworkHandle( -1 ),
+ mRoll( 0.0f ),
+ mPitch( 0.0f ),
+ mRotation( 0.0f, Vector3::YAXIS ),
+ mRotationThreshold( 0.0f )
+{
+ mRollValues.resize( NUMBER_OF_SAMPLES, 0.0f );
+ mPitchValues.resize( NUMBER_OF_SAMPLES, 0.0f );
+}
+
+bool TiltSensor::Update()
+{
+ float newRoll = 0.0f;
+ float newPitch = 0.0f;
+ Quaternion newRotation;
+#ifdef SENSOR_ENABLED
+
+ // Read accelerometer data
+
+ mSensorFrameworkHandle = sf_connect( ACCELEROMETER_SENSOR );
+ if ( mSensorFrameworkHandle < 0 )
+ {
+ DALI_LOG_ERROR( "Failed to connect to sensor framework" );
+ return false;
+ }
+
+ if ( sf_start(mSensorFrameworkHandle, 0) < 0 )
+ {
+ DALI_LOG_ERROR( "Failed to start sensor" );
+ sf_disconnect(mSensorFrameworkHandle);
+ return false;
+ }
+
+ sensor_data_t* base_data_values = (sensor_data_t*)malloc(sizeof(sensor_data_t));
+
+ int dataErr = sf_get_data(mSensorFrameworkHandle, ACCELEROMETER_BASE_DATA_SET, base_data_values);
+ if ( dataErr < 0 )
+ {
+ DALI_LOG_ERROR( "Failed to retrieve sensor data" );
+ free(base_data_values);
+ sf_stop(mSensorFrameworkHandle);
+ sf_disconnect(mSensorFrameworkHandle);
+ return false;
+ }
+
+ sf_stop(mSensorFrameworkHandle);
+ sf_disconnect(mSensorFrameworkHandle);
+
+ mRollValues.push_back( base_data_values->values[0] );
+ mRollValues.pop_front();
+
+ mPitchValues.push_back( base_data_values->values[1] );
+ mPitchValues.pop_front();
+
+ free(base_data_values);
+ base_data_values = NULL;
+
+ float averageRoll( 0.0f );
+ for ( std::deque<float>::const_iterator iter = mRollValues.begin(); mRollValues.end() != iter; ++iter )
+ {
+ averageRoll += *iter;
+ }
+ averageRoll /= mRollValues.size();
+
+ float averagePitch( 0.0f );
+ for ( std::deque<float>::const_iterator iter = mPitchValues.begin(); mPitchValues.end() != iter; ++iter )
+ {
+ averagePitch += *iter;
+ }
+ averagePitch /= mPitchValues.size();
+
+ newRoll = Clamp( float(averageRoll / MAX_ACCELEROMETER_XY_VALUE), -1.0f/*min*/, 1.0f/*max*/ );
+ newPitch = Clamp( float(averagePitch / MAX_ACCELEROMETER_XY_VALUE), -1.0f/*min*/, 1.0f/*max*/ );
+
+ newRotation = Quaternion( newRoll * Math::PI * -0.5f, Vector3::YAXIS ) *
+ Quaternion( newPitch * Math::PI * -0.5f, Vector3::XAXIS );
+#endif // SENSOR_ENABLED
+
+ Radian angle(Quaternion::AngleBetween(newRotation, mRotation));
+ // If the change in value is more than the threshold then emit tilted signal.
+ if( angle > mRotationThreshold )
+ {
+ mRoll = newRoll;
+ mPitch = newPitch;
+ mRotation = newRotation;
+
+ if ( !mTiltedSignalV2.Empty() )
+ {
+ Dali::TiltSensor handle( this );
+ mTiltedSignalV2.Emit( handle );
+ }
+ }
+
+ return true;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_INTERNAL_ADAPTOR_TILT_SENSOR_H__
+#define __DALI_INTERNAL_ADAPTOR_TILT_SENSOR_H__
+
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <deque>
+#include <dali/public-api/object/base-object.h>
+#include <timer.h>
+
+// INTERNAL INCLUDES
+#include <tilt-sensor.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * TiltSensor provides pitch & roll values when the device is tilted.
+ */
+class TiltSensor : public Dali::BaseObject
+{
+public:
+
+ typedef Dali::TiltSensor::TiltedSignalV2 TiltedSignalV2;
+
+ /**
+ * Create a TiltSensor.
+ * This should only be called once by the Adaptor class.
+ * @return A newly allocated tilt-sensor.
+ */
+ static Dali::TiltSensor New();
+
+ /**
+ * @copydoc Dali::TiltSensor::Get()
+ */
+ static Dali::TiltSensor Get();
+
+ /**
+ * @copydoc Dali::TiltSensor::Enable()
+ */
+ bool Enable();
+
+ /**
+ * @copydoc Dali::TiltSensor::Disable()
+ */
+ void Disable();
+
+ /**
+ * @copydoc Dali::TiltSensor::IsEnabled()
+ */
+ bool IsEnabled() const;
+
+ /**
+ * @copydoc Dali::TiltSensor::GetRoll()
+ */
+ float GetRoll() const;
+
+ /**
+ * @copydoc Dali::TiltSensor::GetPitch()
+ */
+ float GetPitch() const;
+
+ /**
+ * @copydoc Dali::TiltSensor::GetRotation()
+ */
+ Quaternion GetRotation() const;
+
+ /**
+ * @copydoc Dali::TiltSensor::TiltedSignal()
+ */
+ TiltedSignalV2& TiltedSignal();
+
+ /**
+ * @copydoc Dali::TiltSensor::SetUpdateFrequency()
+ */
+ void SetUpdateFrequency( float frequencyHertz );
+
+ /**
+ * @copydoc Dali::TiltSensor::GetUpdateFrequency()
+ */
+ float GetUpdateFrequency() const;
+
+ /**
+ * @copydoc Dali::TiltSensor::SetRotationThreshold()
+ */
+ void SetRotationThreshold(Radian rotationThreshold);
+
+ /**
+ * @copydoc Dali::TiltSensor::GetRotationThreshold()
+ */
+ Radian GetRotationThreshold() const;
+
+ /**
+ * Connects a callback function with the object's signals.
+ * @param[in] object The object providing the signal.
+ * @param[in] tracker Used to disconnect the signal.
+ * @param[in] signalName The signal to connect to.
+ * @param[in] functor A newly allocated FunctorDelegate.
+ * @return True if the signal was connected.
+ * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
+ */
+ static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+
+private:
+
+ /**
+ * Private constructor; see also TiltSensor::New()
+ */
+ TiltSensor();
+
+ /**
+ * Destructor
+ */
+ virtual ~TiltSensor();
+
+ /**
+ * Timer callback to update the tilt values
+ */
+ bool Update();
+
+ // Undefined
+ TiltSensor(const TiltSensor&);
+
+ // Undefined
+ TiltSensor& operator=(TiltSensor&);
+
+private:
+
+ float mFrequencyHertz;
+ Dali::Timer mTimer;
+ SlotDelegate< TiltSensor > mTimerSlot;
+
+ int mSensorFrameworkHandle;
+
+ float mRoll;
+ float mPitch;
+ Quaternion mRotation;
+
+ Radian mRotationThreshold;
+
+ std::deque<float> mRollValues;
+ std::deque<float> mPitchValues;
+
+ TiltedSignalV2 mTiltedSignalV2;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::Adaptor::TiltSensor& GetImplementation(Dali::TiltSensor& sensor)
+{
+ DALI_ASSERT_ALWAYS( sensor && "TiltSensor handle is empty" );
+
+ BaseObject& handle = sensor.GetBaseObject();
+
+ return static_cast<Internal::Adaptor::TiltSensor&>(handle);
+}
+
+inline const Internal::Adaptor::TiltSensor& GetImplementation(const Dali::TiltSensor& sensor)
+{
+ DALI_ASSERT_ALWAYS( sensor && "TiltSensor handle is empty" );
+
+ const BaseObject& handle = sensor.GetBaseObject();
+
+ return static_cast<const Internal::Adaptor::TiltSensor&>(handle);
+}
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_ADAPTOR_TILT_SENSOR_H__
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "tts-player-impl.h"
+
+// EXTERNAL INCLUDES
+#include <tts.h>
+#include <stdio.h>
+
+// INTERNAL INCLUDES
+#include <dali/public-api/object/type-registry.h>
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace // unnamed namespace
+{
+// Type Registration
+Dali::BaseHandle Create()
+{
+ return Dali::TtsPlayer::Get() ;
+}
+
+Dali::TypeRegistration mType( typeid(Dali::TtsPlayer), typeid(Dali::BaseHandle), Create ) ;
+} // unnamed namespace
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* TtsPlayer::gLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_TTS_PLAYER");
+#endif
+
+Dali::TtsPlayer TtsPlayer::New(Dali::TtsPlayer::Mode mode)
+{
+ Dali::TtsPlayer player = Dali::TtsPlayer(new TtsPlayer(mode));
+
+ return player;
+}
+
+TtsPlayer::TtsPlayer(Dali::TtsPlayer::Mode mode)
+: mInitialized(false),
+ mUnplayedString(""),
+ mUtteranceId(0),
+ mTtsMode(mode)
+{
+ Initialize();
+}
+
+TtsPlayer::~TtsPlayer()
+{
+ // If it is playing, stop it
+ Stop();
+
+ // Unset the callback funtion for TTS state change
+ int retVal = tts_unset_state_changed_cb(mTtsHandle);
+ if( retVal != TTS_ERROR_NONE )
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+
+ // Destroy the TTS handle and disconnects the daemon
+ retVal = tts_destroy(mTtsHandle);
+ if( retVal != TTS_ERROR_NONE )
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+}
+
+void TtsPlayer::Initialize()
+{
+ // Create the TTS handle
+ int retVal = tts_create(&mTtsHandle);
+
+ if( retVal != TTS_ERROR_NONE )
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+ else
+ {
+ // Set the callback funtion for TTS state change
+ retVal = tts_set_state_changed_cb(mTtsHandle, &StateChangedCallback, this);
+ if( retVal != TTS_ERROR_NONE )
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+
+ // Check tts mode
+ tts_mode_e ttsMode = TTS_MODE_DEFAULT;
+ switch (mTtsMode)
+ {
+ case Dali::TtsPlayer::DEFAULT:
+ ttsMode = TTS_MODE_DEFAULT;
+ break;
+ case Dali::TtsPlayer::NOTIFICATION:
+ ttsMode = TTS_MODE_NOTIFICATION;
+ break;
+ case Dali::TtsPlayer::SCREEN_READER:
+ ttsMode = TTS_MODE_SCREEN_READER;
+ break;
+ default:
+ break;
+ }
+
+ // Set mode
+ retVal = tts_set_mode(mTtsHandle, ttsMode);
+ if(retVal != TTS_ERROR_NONE)
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+
+ // Connect the TTS daemon asynchronously
+ retVal = tts_prepare(mTtsHandle);
+ if(retVal != TTS_ERROR_NONE)
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+ }
+}
+
+void TtsPlayer::Play(const std::string& text)
+{
+ if(mInitialized)
+ {
+ Stop();
+
+ // Add text to the queue, and use normal speed, default language and default voice set by the user
+ int retVal = tts_add_text(mTtsHandle, text.c_str(), NULL, TTS_VOICE_TYPE_AUTO, TTS_SPEED_AUTO, &mUtteranceId);
+ if(retVal != TTS_ERROR_NONE)
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+ else
+ {
+ // Start synthesizing voice from text in the queue and play synthesized audio data
+ retVal = tts_play(mTtsHandle);
+ if(retVal != TTS_ERROR_NONE)
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+ }
+ }
+ else
+ {
+ mUnplayedString = text;
+ }
+}
+
+void TtsPlayer::Stop()
+{
+ if(mInitialized)
+ {
+ // Check the current TTS state
+ tts_state_e state;
+ int retVal = tts_get_state(mTtsHandle, &state);
+ if(retVal != TTS_ERROR_NONE)
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+ else if(state == TTS_STATE_PLAYING || state == TTS_STATE_PAUSED)
+ {
+ // If it is playing or paused, stop playing and clear the queue
+ retVal = tts_stop(mTtsHandle);
+ if( retVal != TTS_ERROR_NONE )
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+ }
+ }
+}
+
+void TtsPlayer::Pause()
+{
+ if(mInitialized)
+ {
+ // Check the current TTS state
+ tts_state_e state;
+ int retVal = tts_get_state(mTtsHandle, &state);
+ if(retVal != TTS_ERROR_NONE)
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+ else if(state == TTS_STATE_PLAYING)
+ {
+ // If the player is playing, pause it.
+ retVal = tts_pause(mTtsHandle);
+ if( retVal != TTS_ERROR_NONE )
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+ }
+ }
+}
+
+void TtsPlayer::Resume()
+{
+ if(mInitialized)
+ {
+ // Check the current TTS state
+ tts_state_e state;
+ int retVal = tts_get_state(mTtsHandle, &state);
+ if(retVal != TTS_ERROR_NONE)
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+ else if(state == TTS_STATE_PAUSED)
+ {
+ // If the player is paused, resume it.
+ retVal = tts_play(mTtsHandle);
+ if( retVal != TTS_ERROR_NONE )
+ {
+ LogErrorCode(static_cast<tts_error_e>(retVal));
+ }
+ }
+ }
+}
+
+void TtsPlayer::StateChangedCallback(tts_h tts, tts_state_e previous, tts_state_e current, void *userData)
+{
+ TtsPlayer* obj = static_cast<TtsPlayer*>(userData);
+ if(!obj->mInitialized && current == TTS_STATE_READY)
+ {
+ obj->mInitialized = true;
+
+ // if there is queued text before initialization, play it
+ if(obj->mUnplayedString != "")
+ {
+ obj->Play(obj->mUnplayedString);
+ obj->mUnplayedString = "";
+ }
+ }
+}
+
+void TtsPlayer::LogErrorCode(tts_error_e reason)
+{
+ std::string error_string;
+
+ switch (reason)
+ {
+ case TTS_ERROR_NONE:
+ {
+ break;
+ }
+ case TTS_ERROR_OUT_OF_MEMORY:
+ {
+ error_string = "TTS: Out of Memory\n";
+ break;
+ }
+ case TTS_ERROR_IO_ERROR:
+ {
+ error_string = "TTS: I/O error\n";
+ break;
+ }
+ case TTS_ERROR_INVALID_PARAMETER:
+ {
+ error_string = "TTS: Invalid parameter\n";
+ break;
+ }
+ case TTS_ERROR_OUT_OF_NETWORK:
+ {
+ error_string = "TTS: Out of network\n";
+ break;
+ }
+ case TTS_ERROR_INVALID_STATE:
+ {
+ error_string = "TTS: Invalid state\n";
+ break;
+ }
+ case TTS_ERROR_INVALID_VOICE:
+ {
+ error_string = "TTS: Invalid voice\n";
+ break;
+ }
+ case TTS_ERROR_ENGINE_NOT_FOUND:
+ {
+ error_string = "TTS: No available engine\n";
+ break;
+ }
+ case TTS_ERROR_TIMED_OUT:
+ {
+ error_string = "TTS: No answer from the daemon\n";
+ break;
+ }
+ case TTS_ERROR_OPERATION_FAILED:
+ {
+ error_string = "TTS: Operation failed\n";
+ break;
+ }
+ default:
+ {
+ error_string = "Invalid TTS error code\n";
+ break;
+ }
+ }
+
+ if(reason != TTS_ERROR_NONE)
+ {
+ DALI_LOG_WARNING("[%s:%d] tts error : %s\n", __FUNCTION__, __LINE__, error_string.c_str());
+ }
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_INTERNAL_TTS_PLAYER_H__
+#define __DALI_INTERNAL_TTS_PLAYER_H__
+
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <tts.h>
+#include <string>
+
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/object/base-object.h>
+#include <tts-player.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * Text-to-speech player
+ */
+class TtsPlayer : public Dali::BaseObject
+{
+
+public:
+
+ /**
+ * Create a TtsPlayer with the given mode.
+ * This should only be called once by the Adaptor class for each given mode.
+ * @param mode the mode of tts-player
+ * @return A newly created TtsPlayer.
+ */
+ static Dali::TtsPlayer New(Dali::TtsPlayer::Mode mode);
+
+ /**
+ * @copydoc TtsPlayer::Play()
+ */
+ void Play(const std::string& text);
+
+ /**
+ * @copydoc TtsPlayer::Stop()
+ */
+ void Stop();
+
+ /**
+ * @copydoc TtsPlayer::Pause()
+ */
+ void Pause();
+
+ /**
+ * @copydoc TtsPlayer::Resume()
+ */
+ void Resume();
+
+private:
+
+ /**
+ * Private Constructor; see also TtsPlayer::New()
+ * @param mode the mode of tts-player
+ */
+ TtsPlayer(Dali::TtsPlayer::Mode mode);
+
+ /**
+ * Destructor
+ */
+ virtual ~TtsPlayer();
+
+ /**
+ * Initializes the player.
+ */
+ void Initialize();
+
+ /**
+ * Logs the error code.
+ * @param[in] reason The error code
+ */
+ void LogErrorCode(tts_error_e reason);
+
+ /**
+ * Called when the state of TTS is changed.
+ *
+ * @param[in] tts The handle for TTS
+ * @param[in] previous A previous state
+ * @param[in] current A current state
+ * @param[in] userData The user data passed from the callback registration function.
+ */
+ static void StateChangedCallback(tts_h tts, tts_state_e previous, tts_state_e current, void *userData);
+
+ // Undefined
+ TtsPlayer(const TtsPlayer&);
+
+ // Undefined
+ TtsPlayer& operator=(TtsPlayer&);
+
+private:
+
+ bool mInitialized; ///< Whether the TTS player is initialised successfully or not
+ std::string mUnplayedString; ///< The text that can not be played because tts engine is not yet initialized
+ tts_h mTtsHandle; ///< The handle of TTS
+ int mUtteranceId; ///< The utterance ID
+
+ Dali::TtsPlayer::Mode mTtsMode; ///< The current mode of tts engine
+
+#if defined(DEBUG_ENABLED)
+public:
+ static Debug::Filter* gLogFilter;
+#endif
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::Adaptor::TtsPlayer& GetImplementation(Dali::TtsPlayer& player)
+{
+ DALI_ASSERT_ALWAYS( player && "TtsPlayer handle is empty" );
+
+ BaseObject& handle = player.GetBaseObject();
+
+ return static_cast<Internal::Adaptor::TtsPlayer&>(handle);
+}
+
+inline const Internal::Adaptor::TtsPlayer& GetImplementation(const Dali::TtsPlayer& player)
+{
+ DALI_ASSERT_ALWAYS( player && "TtsPlayer handle is empty" );
+
+ const BaseObject& handle = player.GetBaseObject();
+
+ return static_cast<const Internal::Adaptor::TtsPlayer&>(handle);
+}
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_TTS_PLAYER_H__
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <vconf.h>
+#include <vconf-keys.h>
+
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include "vsync-monitor.h"
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_VSYNC_MONITOR");
+#endif
+
+const char * const DRM_DEVICE( "/dev/dri/card0" );
+const int FD_NONE( -1 );
+
+void ScreenStatusChanged(keynode_t* node, void* data)
+{
+ VSyncMonitor* vsyncMonitor( static_cast< VSyncMonitor* >( data ) );
+
+ int status = 0;
+ vconf_get_int( VCONFKEY_PM_STATE, &status );
+
+ // status values
+ // - VCONFKEY_PM_STATE_NORMAL : turn vsync on
+ // - VCONFKEY_PM_STATE_LCDDIM : turn vsync off
+ // - VCONFKEY_PM_STATE_LCDOFF : turn vsync off
+ // - VCONFKEY_PM_STATE_SLEEP : turn vsync off
+ const bool screenOn( VCONFKEY_PM_STATE_NORMAL == status );
+
+ vsyncMonitor->SetUseHardware( screenOn );
+
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "%s, Screen %s.\n", __PRETTY_FUNCTION__, screenOn ? "On" : "Off" );
+}
+
+} // unnamed namespace
+
+VSyncMonitor::VSyncMonitor()
+: mFileDescriptor( FD_NONE ),
+ mUseHardware( true )
+{
+ vconf_notify_key_changed( VCONFKEY_PM_STATE, ScreenStatusChanged, this );
+}
+
+VSyncMonitor::~VSyncMonitor()
+{
+ Terminate();
+
+ vconf_ignore_key_changed( VCONFKEY_PM_STATE, ScreenStatusChanged );
+}
+
+void VSyncMonitor::SetUseHardware( bool useHardware )
+{
+ mUseHardware = useHardware;
+}
+
+void VSyncMonitor::Initialize()
+{
+ DALI_ASSERT_DEBUG( mFileDescriptor == FD_NONE && "VSyncMonitor::Initialize() called twice" );
+
+ // Read initial 'use hardware' status
+ ScreenStatusChanged( NULL, this );
+
+ // open /dev node
+ mFileDescriptor = open( DRM_DEVICE, O_RDWR );
+
+ // setup vblank request - block and wait for next vblank
+ mVBlankInfo.request.type = DRM_VBLANK_NEXTONMISS;
+ mVBlankInfo.request.sequence = 0;
+ mVBlankInfo.request.signal = 0;
+
+ // setup vblank reply - block and wait for next vblank
+ mVBlankInfo.reply.type = DRM_VBLANK_NEXTONMISS;
+ mVBlankInfo.reply.sequence = 0;
+ mVBlankInfo.reply.tval_sec = 0;
+ mVBlankInfo.reply.tval_usec = 0;
+}
+
+void VSyncMonitor::Terminate()
+{
+ if( mFileDescriptor != FD_NONE )
+ {
+ close( mFileDescriptor );
+ mFileDescriptor = FD_NONE;
+ }
+}
+
+bool VSyncMonitor::UseHardware()
+{
+ return mUseHardware && (FD_NONE != mFileDescriptor );
+}
+
+
+bool VSyncMonitor::DoSync( unsigned int& frameNumber, unsigned int& seconds, unsigned int& microseconds )
+{
+ DALI_ASSERT_DEBUG( mFileDescriptor != FD_NONE && "ECoreX::VSyncMonitor is not initialized" );
+
+ if( 0 == drmWaitVBlank( mFileDescriptor, &mVBlankInfo ) )
+ {
+ frameNumber = mVBlankInfo.reply.sequence;
+ seconds = mVBlankInfo.reply.tval_sec;
+ microseconds = mVBlankInfo.reply.tval_usec;
+
+ return true;
+ }
+
+ return false;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
# tv profile internal files
-adaptor_common_internal_src_files += \
- $(adaptor_common_dir)/../tv/tv-key-impl.cpp \
- $(adaptor_common_dir)/../tv/tv-render-surface-factory.cpp \
- $(adaptor_common_dir)/../tv/tv-system-settings.cpp \
- $(adaptor_common_dir)/../tv/tv-color-controller-impl.cpp
\ No newline at end of file
+adaptor_common_internal_tv_profile_src_files = \
+ $(adaptor_tv_dir)/tv-key-impl.cpp \
+ $(adaptor_tv_dir)/tv-render-surface-factory.cpp \
+ $(adaptor_tv_dir)/tv-system-settings.cpp \
+ $(adaptor_tv_dir)/tv-color-controller-impl.cpp
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "accessibility-manager-impl.h"
+
+// EXTERNAL INCLUDES
+
+#include <dali/public-api/dali-core.h>
+#include <dali/integration-api/debug.h>
+#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/events/gesture-requests.h>
+#include "system-settings.h"
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gAccessibilityManagerLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ACCESSIBILITY_MANAGER");
+#endif
+
+BaseHandle Create()
+{
+ BaseHandle handle( AccessibilityManager::Get() );
+
+ if ( !handle && Adaptor::IsAvailable() )
+ {
+ Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
+ Dali::AccessibilityManager manager = Dali::AccessibilityManager( new AccessibilityManager() );
+ adaptorImpl.RegisterSingleton( typeid( manager ), manager );
+ handle = manager;
+ }
+
+ return handle;
+}
+TypeRegistration ACCESSIBILITY_MANAGER_TYPE( typeid(Dali::AccessibilityManager), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
+
+} // unnamed namespace
+
+Dali::AccessibilityManager AccessibilityManager::Get()
+{
+ Dali::AccessibilityManager manager;
+
+ if ( Adaptor::IsAvailable() )
+ {
+ // Check whether the singleton is already created
+ Dali::BaseHandle handle = Dali::Adaptor::Get().GetSingleton( typeid( Dali::AccessibilityManager ) );
+ if(handle)
+ {
+ // If so, downcast the handle
+ manager = Dali::AccessibilityManager( dynamic_cast< AccessibilityManager* >( handle.GetObjectPtr() ) );
+ }
+ }
+
+ return manager;
+}
+
+Vector2 AccessibilityManager::GetReadPosition() const
+{
+ return mReadPosition;
+}
+
+void AccessibilityManager::SetActionHandler(AccessibilityActionHandler& handler)
+{
+ mActionHandler = &handler;
+}
+
+void AccessibilityManager::SetGestureHandler(AccessibilityGestureHandler& handler)
+{
+ if( mAccessibilityGestureDetector )
+ {
+ mAccessibilityGestureDetector->SetGestureHandler(handler);
+ }
+}
+
+bool AccessibilityManager::HandleActionClearFocusEvent()
+{
+ bool ret = false;
+
+ Dali::AccessibilityManager handle( this );
+
+ /*
+ * In order to application decide reading action first,
+ * emit ActionClearFocus signal in first, ClearAccessibilityFocus for handler in next
+ */
+ if ( !mIndicatorFocused )
+ {
+ if( !mActionClearFocusSignalV2.Empty() )
+ {
+ mActionClearFocusSignalV2.Emit( handle );
+ }
+ }
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->ClearAccessibilityFocus();
+ }
+
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+bool AccessibilityManager::HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp)
+{
+ bool ret = false;
+
+ Dali::AccessibilityManager handle( this );
+
+ Dali::TouchEvent touchEvent(timeStamp);
+ touchEvent.points.push_back(point);
+
+ /*
+ * In order to application decide touch action first,
+ * emit ActionScroll signal in first, AccessibilityActionScroll for handler in next
+ */
+ if ( !mIndicatorFocused )
+ {
+ if( !mActionScrollSignalV2.Empty() )
+ {
+ mActionScrollSignalV2.Emit( handle, touchEvent );
+ }
+ }
+
+ Integration::TouchEvent event;
+ if (mCombiner.GetNextTouchEvent(point, timeStamp, event))
+ {
+ // Process the touch event in accessibility gesture detector
+ if( mAccessibilityGestureDetector )
+ {
+ mAccessibilityGestureDetector->SendEvent(event);
+ ret = true;
+ }
+ }
+
+ return ret;
+}
+
+bool AccessibilityManager::HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp)
+{
+ bool ret = false;
+
+ Dali::TouchEvent touchEvent(timeStamp);
+ touchEvent.points.push_back(point);
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionTouch(touchEvent);
+ }
+ return ret;
+}
+
+bool AccessibilityManager::HandleActionBackEvent()
+{
+ bool ret = false;
+
+ Dali::AccessibilityManager handle( this );
+
+ /*
+ * In order to application decide reading action first,
+ * emit ActionBack signal in first, AccessibilityActionBack for handler in next
+ */
+ if ( !mIndicatorFocused )
+ {
+ if( !mActionBackSignalV2.Empty() )
+ {
+ mActionBackSignalV2.Emit( handle );
+ }
+ }
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionBack();
+ }
+
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+void AccessibilityManager::HandleActionEnableEvent()
+{
+ EnableAccessibility();
+}
+
+void AccessibilityManager::HandleActionDisableEvent()
+{
+ DisableAccessibility();
+}
+
+void AccessibilityManager::EnableAccessibility()
+{
+ if(mIsEnabled == false)
+ {
+ mIsEnabled = true;
+
+ if( mActionHandler )
+ {
+ mActionHandler->ChangeAccessibilityStatus();
+ }
+
+ //emit status changed signal
+ Dali::AccessibilityManager handle( this );
+ mStatusChangedSignalV2.Emit( handle );
+ }
+}
+
+void AccessibilityManager::DisableAccessibility()
+{
+ if(mIsEnabled == true)
+ {
+ mIsEnabled = false;
+
+ if( mActionHandler )
+ {
+ mActionHandler->ChangeAccessibilityStatus();
+ }
+
+ //emit status changed signal
+ Dali::AccessibilityManager handle( this );
+ mStatusChangedSignalV2.Emit( handle );
+
+ // Destroy the TtsPlayer if exists.
+ Dali::Adaptor& adaptor = Dali::Adaptor::Get();
+ Adaptor::GetImplementation(adaptor).DestroyTtsPlayer(Dali::TtsPlayer::SCREEN_READER);
+ }
+}
+
+bool AccessibilityManager::IsEnabled() const
+{
+ return mIsEnabled;
+}
+
+void AccessibilityManager::SetIndicator(Indicator* indicator)
+{
+ mIndicator = indicator;
+}
+
+AccessibilityManager::AccessibilityManager()
+: mIsEnabled(false),
+ mActionHandler(NULL),
+ mIndicator(NULL),
+ mIndicatorFocused(false)
+{
+ int isEnabled = 0;
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, isEnabled?"ENABLED":"DISABLED");
+
+ if(isEnabled == 1)
+ {
+ mIsEnabled = true;
+ }
+ else
+ {
+ mIsEnabled = false;
+ }
+
+ mAccessibilityGestureDetector = new AccessibilityGestureDetector();
+}
+
+AccessibilityManager::~AccessibilityManager()
+{
+}
+
+bool AccessibilityManager::HandleActionNextEvent(bool allowEndFeedback)
+{
+ bool ret = false;
+ Dali::AccessibilityManager handle( this );
+
+ /*
+ * In order to application decide reading action first,
+ * emit ActionNext signal in first, AccessibilityActionNext for handler in next
+ */
+ if( !mIndicatorFocused )
+ {
+ if( !mActionNextSignalV2.Empty() )
+ {
+ mActionNextSignalV2.Emit( handle );
+ }
+ }
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionNext(allowEndFeedback);
+ }
+
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+bool AccessibilityManager::HandleActionPreviousEvent(bool allowEndFeedback)
+{
+ bool ret = false;
+
+ Dali::AccessibilityManager handle( this );
+
+ /*
+ * In order to application decide reading action first,
+ * emit ActionPrevious signal in first, AccessibilityActionPrevious for handler in next
+ */
+ if ( !mIndicatorFocused )
+ {
+ if( !mActionPreviousSignalV2.Empty() )
+ {
+ mActionPreviousSignalV2.Emit( handle );
+ }
+ }
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionPrevious(allowEndFeedback);
+ }
+
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+bool AccessibilityManager::HandleActionActivateEvent()
+{
+ bool ret = false;
+
+ Dali::AccessibilityManager handle( this );
+
+ /*
+ * In order to application decide reading action first,
+ * emit ActionActivate signal in first, AccessibilityActionActivate for handler in next
+ */
+ if ( !mIndicatorFocused )
+ {
+ if( !mActionActivateSignalV2.Empty() )
+ {
+ mActionActivateSignalV2.Emit( handle );
+ }
+ }
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionActivate();
+ }
+
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+bool AccessibilityManager::HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain)
+{
+ bool ret = false;
+
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %d , %d\n", __FUNCTION__, __LINE__, x, y);
+
+ mReadPosition.x = x;
+ mReadPosition.y = y;
+
+ Dali::AccessibilityManager handle( this );
+
+ bool indicatorFocused = false;
+
+ // Check whether the Indicator is focused
+ if( mIndicator && mIndicator->IsConnected() )
+ {
+ // Check the position and size of Indicator actor
+ Dali::Actor indicatorActor = mIndicator->GetActor();
+ Vector3 position = Vector3(0.0f, 0.0f, 0.0f);
+ Vector3 size = indicatorActor.GetCurrentSize();
+
+ if(mReadPosition.x >= position.x &&
+ mReadPosition.x <= position.x + size.width &&
+ mReadPosition.y >= position.y &&
+ mReadPosition.y <= position.y + size.height)
+ {
+ indicatorFocused = true;
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] Indicator area!!!!\n", __FUNCTION__, __LINE__);
+ }
+ }
+
+ if( mIndicator )
+ {
+ if( !mIndicatorFocused && indicatorFocused )
+ {
+ // If Indicator is focused, the focus should be cleared in Dali focus chain.
+ if( mActionHandler )
+ {
+ mActionHandler->ClearAccessibilityFocus();
+ }
+ }
+
+ mIndicatorFocused = indicatorFocused;
+
+ // Send accessibility READ action information to Indicator
+ if( mIndicatorFocused )
+ {
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] Send READ message to indicator!!!!\n", __FUNCTION__, __LINE__);
+ }
+ }
+
+ if(allowReadAgain)
+ {
+ /*
+ * In order to application decide reading action first,
+ * emit ActionRead signal in first, AccessibilityActionRead for handler in next
+ */
+ if( !mIndicatorFocused )
+ {
+ if ( !mActionReadSignalV2.Empty() )
+ {
+ mActionReadSignalV2.Emit( handle );
+ }
+ }
+ }
+ else
+ {
+ /*
+ * In order to application decide reading action first,
+ * emit ActionRead signal in first, AccessibilityActionRead for handler in next
+ */
+ if( !mIndicatorFocused )
+ {
+ if ( !mActionOverSignalV2.Empty() )
+ {
+ mActionOverSignalV2.Emit( handle );
+ }
+ }
+ }
+
+ if( mActionHandler && !mIndicatorFocused)
+ {
+ // If Indicator is not focused, the accessibility actions should be handled by the registered
+ // accessibility action handler (e.g. focus manager)
+ ret = mActionHandler->AccessibilityActionRead(allowReadAgain);
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+ }
+
+ return ret;
+}
+
+bool AccessibilityManager::HandleActionReadNextEvent(bool allowEndFeedback)
+{
+ bool ret = false;
+
+ Dali::AccessibilityManager handle( this );
+
+ /*
+ * In order to application decide reading action first,
+ * emit ActionReadNext signal in first, AccessibilityActionReadNext for handler in next
+ */
+ if ( !mIndicatorFocused )
+ {
+ if( !mActionReadNextSignalV2.Empty() )
+ {
+ mActionReadNextSignalV2.Emit( handle );
+ }
+ }
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionReadNext(allowEndFeedback);
+ }
+
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+bool AccessibilityManager::HandleActionReadPreviousEvent(bool allowEndFeedback)
+{
+ bool ret = false;
+
+ Dali::AccessibilityManager handle( this );
+
+ /*
+ * In order to application decide reading action first,
+ * emit ActionReadPrevious signal in first, AccessibilityActionReadPrevious for handler in next
+ */
+ if ( !mIndicatorFocused )
+ {
+ if( !mActionReadPreviousSignalV2.Empty() )
+ {
+ mActionReadPreviousSignalV2.Emit( handle );
+ }
+ }
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionReadPrevious(allowEndFeedback);
+ }
+
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+bool AccessibilityManager::HandleActionUpEvent()
+{
+ bool ret = false;
+
+ Dali::AccessibilityManager handle( this );
+
+ /*
+ * In order to application decide reading action first,
+ * emit ActionUp signal in first, AccessibilityActionUp for handler in next
+ */
+ if ( !mIndicatorFocused )
+ {
+ if( !mActionUpSignalV2.Empty() )
+ {
+ mActionUpSignalV2.Emit( handle );
+ }
+ }
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionUp();
+ }
+
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+bool AccessibilityManager::HandleActionDownEvent()
+{
+ bool ret = false;
+
+ Dali::AccessibilityManager handle( this );
+
+ /*
+ * In order to application decide reading action first,
+ * emit ActionDown signal in first, AccessibilityActionDown for handler in next
+ */
+ if ( !mIndicatorFocused )
+ {
+ if( !mActionDownSignalV2.Empty() )
+ {
+ mActionDownSignalV2.Emit( handle );
+ }
+ }
+
+ if( mActionHandler )
+ {
+ ret = mActionHandler->AccessibilityActionDown();
+ }
+
+ DALI_LOG_INFO(gAccessibilityManagerLogFilter, Debug::General, "[%s:%d] %s\n", __FUNCTION__, __LINE__, ret?"TRUE":"FALSE");
+
+ return ret;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_INTERNAL_ACCESSIBILITY_MANAGER_H__
+#define __DALI_INTERNAL_ACCESSIBILITY_MANAGER_H__
+
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <string>
+
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/math/vector2.h>
+#include <dali/public-api/events/touch-point.h>
+#include <dali/integration-api/events/touch-event-combiner.h>
+#include <accessibility-manager.h>
+
+// INTERNAL INCLUDES
+#include <accessibility-action-handler.h>
+#include <accessibility-gesture-handler.h>
+#include <indicator-impl.h>
+#include <accessibility-gesture-detector.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * This class detects to accessibility action
+ */
+class AccessibilityManager : public Dali::BaseObject
+{
+public:
+
+ typedef Dali::AccessibilityManager::AccessibilityActionSignalV2 AccessibilityActionSignalV2;
+ typedef Dali::AccessibilityManager::AccessibilityActionScrollSignalV2 AccessibilityActionScrollSignalV2;
+
+ // Creation
+
+ /**
+ * Constructor.
+ */
+ AccessibilityManager();
+
+ /**
+ * Get an instance of the AccessibilityManager.
+ * @return The instance of the AccessibilityManager.
+ */
+ static Dali::AccessibilityManager Get();
+
+ // Public API
+
+ /**
+ * Turn on accessibility action
+ * This method should be called by vconf callback
+ */
+ void EnableAccessibility();
+
+ /**
+ * Turn off accessibility action
+ * This method should be called by vconf callback
+ */
+ void DisableAccessibility();
+
+ /**
+ * @copydoc Dali::AccessibilityManager::IsEnabled()
+ */
+ bool IsEnabled() const;
+
+ /**
+ * @copydoc Dali::AccessibilityManager::GetReadPosition() const
+ */
+ Vector2 GetReadPosition() const;
+
+ /**
+ * @copydoc Dali::AccessibilityManager::SetActionHandler()
+ */
+ void SetActionHandler(AccessibilityActionHandler& handler);
+
+ /**
+ * @copydoc Dali::AccessibilityManager::SetGestureHandler()
+ */
+ void SetGestureHandler(AccessibilityGestureHandler& handler);
+
+ /**
+ * Set the Indicator
+ */
+ void SetIndicator(Indicator* indicator);
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionNextEvent()
+ */
+ bool HandleActionNextEvent(bool allowEndFeedback = true);
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionPreviousEvent()
+ */
+ bool HandleActionPreviousEvent(bool allowEndFeedback = true);
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionActivateEvent()
+ */
+ bool HandleActionActivateEvent();
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionReadEvent()
+ */
+ bool HandleActionReadEvent(unsigned int x, unsigned int y, bool allowReadAgain);
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionReadNextEvent()
+ */
+ bool HandleActionReadNextEvent(bool allowEndFeedback = true);
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionReadPreviousEvent()
+ */
+ bool HandleActionReadPreviousEvent(bool allowEndFeedback = true);
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionUpEvent()
+ */
+ bool HandleActionUpEvent();
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionDownEvent()
+ */
+ bool HandleActionDownEvent();
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionClearFocusEvent()
+ */
+ bool HandleActionClearFocusEvent();
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionScrollEvent()
+ */
+ bool HandleActionScrollEvent(const TouchPoint& point, unsigned long timeStamp);
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionTouchEvent()
+ */
+ bool HandleActionTouchEvent(const TouchPoint& point, unsigned long timeStamp);
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionBackEvent()
+ */
+ bool HandleActionBackEvent();
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionEnableEvent()
+ */
+ void HandleActionEnableEvent();
+
+ /**
+ * @copydoc Dali::AccessibilityManager::HandleActionDisableEvent()
+ */
+ void HandleActionDisableEvent();
+
+public: // Signals
+
+ /**
+ * @copydoc Dali::AccessibilityManager::StatusChangedSignal
+ */
+ AccessibilityActionSignalV2& StatusChangedSignal()
+ {
+ return mStatusChangedSignalV2;
+ }
+
+ /**
+ * @copydoc Dali::AccessibilityManager::ActionNextSignal
+ */
+ AccessibilityActionSignalV2& ActionNextSignal()
+ {
+ return mActionNextSignalV2;
+ }
+
+ /**
+ * @copydoc Dali::AccessibilityManager::ActionPreviousSignal
+ */
+ AccessibilityActionSignalV2& ActionPreviousSignal()
+ {
+ return mActionPreviousSignalV2;
+ }
+
+ /**
+ * @copydoc Dali::AccessibilityManager::ActionActivateSignal
+ */
+ AccessibilityActionSignalV2& ActionActivateSignal()
+ {
+ return mActionActivateSignalV2;
+ }
+
+ /**
+ * @copydoc Dali::AccessibilityManager::ActionOverSignal
+ */
+ AccessibilityActionSignalV2& ActionOverSignal()
+ {
+ return mActionOverSignalV2;
+ }
+
+ /**
+ * @copydoc Dali::AccessibilityManager::ActionReadSignal
+ */
+ AccessibilityActionSignalV2& ActionReadSignal()
+ {
+ return mActionReadSignalV2;
+ }
+
+ /**
+ * @copydoc Dali::AccessibilityManager::ActionReadNextSignal
+ */
+ AccessibilityActionSignalV2& ActionReadNextSignal()
+ {
+ return mActionReadNextSignalV2;
+ }
+
+ /**
+ * @copydoc Dali::AccessibilityManager::ActionReadPreviousSignal
+ */
+ AccessibilityActionSignalV2& ActionReadPreviousSignal()
+ {
+ return mActionReadPreviousSignalV2;
+ }
+
+ /**
+ * @copydoc Dali::AccessibilityManager::ActionUpSignal
+ */
+ AccessibilityActionSignalV2& ActionUpSignal()
+ {
+ return mActionUpSignalV2;
+ }
+
+ /**
+ * @copydoc Dali::AccessibilityManager::ActionDownSignal
+ */
+ AccessibilityActionSignalV2& ActionDownSignal()
+ {
+ return mActionDownSignalV2;
+ }
+
+ /**
+ * @copydoc Dali::AccessibilityManager::ActionClearFocusSignal
+ */
+ AccessibilityActionSignalV2& ActionClearFocusSignal()
+ {
+ return mActionClearFocusSignalV2;
+ }
+
+ /**
+ * @copydoc Dali::AccessibilityManager::ActionBackSignal
+ */
+ AccessibilityActionSignalV2& ActionBackSignal()
+ {
+ return mActionBackSignalV2;
+ }
+
+ /**
+ * @copydoc Dali::AccessibilityManager::ActionScrollSignal
+ */
+ AccessibilityActionScrollSignalV2& ActionScrollSignal()
+ {
+ return mActionScrollSignalV2;
+ }
+
+private:
+
+ // Destruction
+
+ /**
+ * Destructor.
+ */
+ virtual ~AccessibilityManager();
+
+ // Undefined
+ AccessibilityManager( const AccessibilityManager& );
+ AccessibilityManager& operator=( AccessibilityManager& );
+
+private:
+
+ Dali::Integration::TouchEventCombiner mCombiner; ///< Combines multi-touch events.
+
+ bool mIsEnabled; ///< enable/disable the accessibility action
+ Vector2 mReadPosition; ///< ActionRead position
+
+ AccessibilityActionHandler* mActionHandler; ///< The pointer of accessibility action handler
+
+ AccessibilityGestureDetectorPtr mAccessibilityGestureDetector; ///< The accessibility gesture detector
+
+ Indicator* mIndicator; ///< The indicator
+ bool mIndicatorFocused; ///< Whether the Indicator is focused
+
+ AccessibilityActionSignalV2 mStatusChangedSignalV2;
+ AccessibilityActionSignalV2 mActionNextSignalV2;
+ AccessibilityActionSignalV2 mActionPreviousSignalV2;
+ AccessibilityActionSignalV2 mActionActivateSignalV2;
+ AccessibilityActionSignalV2 mActionOverSignalV2;
+ AccessibilityActionSignalV2 mActionReadSignalV2;
+ AccessibilityActionSignalV2 mActionReadNextSignalV2;
+ AccessibilityActionSignalV2 mActionReadPreviousSignalV2;
+ AccessibilityActionSignalV2 mActionUpSignalV2;
+ AccessibilityActionSignalV2 mActionDownSignalV2;
+ AccessibilityActionSignalV2 mActionClearFocusSignalV2;
+ AccessibilityActionSignalV2 mActionBackSignalV2;
+ AccessibilityActionScrollSignalV2 mActionScrollSignalV2;
+
+public:
+
+ // Helpers for public-api forwarding methods
+
+ inline static Internal::Adaptor::AccessibilityManager& GetImplementation(Dali::AccessibilityManager& manager)
+ {
+ DALI_ASSERT_ALWAYS( manager && "AccessibilityManager handle is empty" );
+
+ BaseObject& handle = manager.GetBaseObject();
+
+ return static_cast<Internal::Adaptor::AccessibilityManager&>(handle);
+ }
+
+ inline static const Internal::Adaptor::AccessibilityManager& GetImplementation(const Dali::AccessibilityManager& manager)
+ {
+ DALI_ASSERT_ALWAYS( manager && "AccessibilityManager handle is empty" );
+
+ const BaseObject& handle = manager.GetBaseObject();
+
+ return static_cast<const Internal::Adaptor::AccessibilityManager&>(handle);
+ }
+
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_ACCESSIBILITY_MANAGER_H__
--- /dev/null
+# ubuntu
+
+adaptor_ubuntu_internal_src_files = \
+ $(adaptor_ubuntu_dir)/accessibility-manager-impl-ubuntu.cpp \
+ $(adaptor_ubuntu_dir)/vsync-monitor-ubuntu.cpp \
+ $(adaptor_ubuntu_dir)/tilt-sensor-impl-ubuntu.cpp \
+ $(adaptor_ubuntu_dir)/tts-player-impl-ubuntu.cpp \
+ $(adaptor_ubuntu_dir)/key-impl-ubuntu.cpp
+
+adaptor_ubuntu_application_src_files = \
+ $(adaptor_ubuntu_dir)/framework-ubuntu.cpp
+
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "framework.h"
+
+// EXTERNAL INCLUDES
+#include <Ecore.h>
+#include <Elementary.h>
+#include <boost/bind.hpp>
+#include <X11/Xlib.h>
+
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <callback-manager.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+
+/// Application Status Enum
+enum
+{
+ APP_CREATE,
+ APP_TERMINATE,
+ APP_PAUSE,
+ APP_RESUME,
+ APP_RESET,
+ APP_LANGUAGE_CHANGE,
+};
+
+} // Unnamed namespace
+
+/**
+ * Impl to hide EFL data members
+ */
+struct Framework::Impl
+{
+ // Constructor
+
+ Impl(void* data)
+ {
+ mCallbackManager = CallbackManager::New();
+ }
+
+ ~Impl()
+ {
+ // we're quiting the main loop so
+ // mCallbackManager->RemoveAllCallBacks() does not need to be called
+ // to delete our abort handler
+ delete mCallbackManager;
+ }
+
+ // Data
+
+ boost::function<void(void)> mAbortCallBack;
+ CallbackManager *mCallbackManager;
+ // Static methods
+
+ /**
+ * Called by AppCore on application creation.
+ */
+ static bool AppCreate(void *data)
+ {
+ return static_cast<Framework*>(data)->SlpAppStatusHandler(APP_CREATE);
+ }
+
+ /**
+ * Called by AppCore when the application should terminate.
+ */
+ static void AppTerminate(void *data)
+ {
+ static_cast<Framework*>(data)->SlpAppStatusHandler(APP_TERMINATE);
+ }
+
+ /**
+ * Called by AppCore when the application is paused.
+ */
+ static void AppPause(void *data)
+ {
+ static_cast<Framework*>(data)->SlpAppStatusHandler(APP_PAUSE);
+ }
+
+ /**
+ * Called by AppCore when the application is resumed.
+ */
+ static void AppResume(void *data)
+ {
+ static_cast<Framework*>(data)->SlpAppStatusHandler(APP_RESUME);
+ }
+
+ /**
+ * Called by AppCore when the language changes on the device.
+ */
+ static void AppLanguageChange(void* data)
+ {
+ static_cast<Framework*>(data)->SlpAppStatusHandler(APP_LANGUAGE_CHANGE);
+ }
+
+};
+
+Framework::Framework(Framework::Observer& observer, int *argc, char ***argv, const std::string& name)
+: mObserver(observer),
+ mInitialised(false),
+ mRunning(false),
+ mArgc(argc),
+ mArgv(argv),
+ mName(name),
+ mBundleName(""),
+ mBundleId(""),
+ mAbortHandler(boost::bind(&Framework::AbortCallback, this)),
+ mImpl(NULL)
+{
+ InitThreads();
+ mImpl = new Impl(this);
+}
+
+Framework::~Framework()
+{
+ if (mRunning)
+ {
+ Quit();
+ }
+
+ delete mImpl;
+}
+
+void Framework::Run()
+{
+ mRunning = true;
+
+ elm_init(*mArgc, *mArgv);
+
+ Impl::AppCreate(this);
+
+ elm_run();
+
+ mRunning = false;
+}
+
+void Framework::Quit()
+{
+ Impl::AppTerminate(this);
+
+ elm_exit();
+}
+
+bool Framework::IsMainLoopRunning()
+{
+ return mRunning;
+}
+
+void Framework::AddAbortCallback(boost::function<void(void)> callBack)
+{
+ mImpl->mAbortCallBack = callBack;
+}
+
+std::string Framework::GetBundleName() const
+{
+ return mBundleName;
+}
+
+void Framework::SetBundleName(const std::string& name)
+{
+ mBundleName = name;
+}
+
+std::string Framework::GetBundleId() const
+{
+ return mBundleId;
+}
+
+void Framework::SetBundleId(const std::string& id)
+{
+ mBundleId = id;
+}
+
+void Framework::AbortCallback( )
+{
+ // if an abort call back has been installed run it.
+ if (mImpl->mAbortCallBack)
+ {
+ mImpl->mAbortCallBack();
+ }
+ else
+ {
+ Quit();
+ }
+}
+
+bool Framework::SlpAppStatusHandler(int type)
+{
+ switch (type)
+ {
+ case APP_CREATE:
+ {
+ mInitialised = true;
+
+ // Connect to abnormal exit signals
+ mAbortHandler.AbortOnSignal( SIGINT );
+ mAbortHandler.AbortOnSignal( SIGQUIT );
+ mAbortHandler.AbortOnSignal( SIGKILL );
+
+ mObserver.OnInit();
+ break;
+ }
+
+ case APP_RESET:
+ mObserver.OnReset();
+ break;
+
+ case APP_RESUME:
+ mObserver.OnResume();
+ break;
+
+ case APP_TERMINATE:
+ mObserver.OnTerminate();
+ break;
+
+ case APP_PAUSE:
+ mObserver.OnPause();
+ break;
+
+ case APP_LANGUAGE_CHANGE:
+ mObserver.OnLanguageChanged();
+ break;
+
+ default:
+ break;
+ }
+
+ return true;
+}
+
+void Framework::InitThreads()
+{
+ XInitThreads();
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "key-impl.h"
+
+// EXTERNAL INCLUDES
+#define KEY_VOLUMEUP "XF86AudioRaiseVolume" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Volume Up' key */
+#define KEY_VOLUMEDOWN "XF86AudioLowerVolume" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Volume Down' key */
+
+#define KEY_CAMERA "XF86WebCam" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Half-Press of Camera' key */
+#define KEY_CONFIG "XF86Pictures" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Full-Press of Camera' key */
+
+#define KEY_POWER "XF86PowerOff" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Power' key */
+#define KEY_PAUSE "XF86Standby" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Pause' key */
+#define KEY_CANCEL "Cancel" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Cancel' key */
+
+// Earjack/BT Headset/Multimedia keys
+#define KEY_PLAYCD "XF86AudioPlay" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Play Audio' key */
+#define KEY_STOPCD "XF86AudioStop" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Stop Audio' key */
+#define KEY_PAUSECD "XF86AudioPause" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Pause Audio' key */
+#define KEY_NEXTSONG "XF86AudioNext" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Next Song' key */
+#define KEY_PREVIOUSSONG "XF86AudioPrev" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Previous Song' key */
+#define KEY_REWIND "XF86AudioRewind" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Rewind Song' key */
+#define KEY_FASTFORWARD "XF86AudioForward" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Forward Song' key */
+#define KEY_MEDIA "XF86AudioMedia" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Media' key */
+#define KEY_PLAYPAUSE "XF86AudioPlayPause" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'PlayPause' key */
+#define KEY_MUTE "XF86AudioMute" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Mute' key */
+
+// 3-Touch key
+#define KEY_SEND "XF86Send" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Send' key */
+#define KEY_SELECT "XF86Phone" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Home' key */
+#define KEY_END "XF86Stop" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'End' key */
+
+// Renamed 3-Touch key
+#define KEY_MENU "XF86Send" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Send' key */
+#define KEY_HOME "XF86Phone" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Home' key */
+#define KEY_BACK "XF86Stop" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'End' key */
+
+//Other functions keys
+#define KEY_HOMEPAGE "XF86HomePage" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'HomePage' key */
+#define KEY_WEBPAGE "XF86WWW" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'WWW' key */
+#define KEY_MAIL "XF86Mail" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Mail' key */
+#define KEY_SCREENSAVER "XF86ScreenSaver" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'ScreenSaver' key */
+#define KEY_BRIGHTNESSUP "XF86MonBrightnessUp" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'BrightnessUp' key */
+#define KEY_BRIGHTNESSDOWN "XF86MonBrightnessDown" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'BrightnessDown' key */
+#define KEY_SOFTKBD "XF86MenuKB" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Soft keyboard(toggle)' key */
+#define KEY_QUICKPANEL "XF86Tools" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Quick panel(toggle)' key */
+#define KEY_TASKSWITCH "XF86TaskPane" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Task switcher(toggle)' key */
+#define KEY_APPS "XF86Launch0" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Apptray(toggle)' key */
+#define KEY_SEARCH "XF86Search" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Search(toggle)' key */
+#define KEY_VOICE "XF86Launch2" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Voice(toggle)' key */
+#define KEY_LANGUAGE "Hangul" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Language(toggle)' key */
+
+#include <map>
+#include <string.h>
+#include <iostream>
+
+
+#include <dali/integration-api/debug.h>
+
+
+namespace Dali
+{
+
+const KEY DALI_KEY_INVALID = -1;
+const KEY DALI_KEY_ESCAPE = 9;
+const KEY DALI_KEY_BACK = 166;
+const KEY DALI_KEY_CAMERA = 167;
+const KEY DALI_KEY_CONFIG = 168;
+const KEY DALI_KEY_POWER = 169;
+const KEY DALI_KEY_PAUSE = 170;
+const KEY DALI_KEY_CANCEL = 171;
+const KEY DALI_KEY_PLAY_CD = 172;
+const KEY DALI_KEY_STOP_CD = 173;
+const KEY DALI_KEY_PAUSE_CD = 174;
+const KEY DALI_KEY_NEXT_SONG = 175;
+const KEY DALI_KEY_PREVIOUS_SONG = 176;
+const KEY DALI_KEY_REWIND = 177;
+const KEY DALI_KEY_FASTFORWARD = 178;
+const KEY DALI_KEY_MEDIA = 179;
+const KEY DALI_KEY_PLAY_PAUSE = 180;
+const KEY DALI_KEY_MUTE = 181;
+const KEY DALI_KEY_SEND = 182;
+const KEY DALI_KEY_SELECT = 183;
+const KEY DALI_KEY_END = DALI_KEY_BACK;
+const KEY DALI_KEY_MENU = DALI_KEY_SEND;
+const KEY DALI_KEY_HOME = DALI_KEY_SELECT;
+const KEY DALI_KEY_HOMEPAGE = 187;
+const KEY DALI_KEY_WEBPAGE = 188;
+const KEY DALI_KEY_MAIL = 189;
+const KEY DALI_KEY_SCREENSAVER = 190;
+const KEY DALI_KEY_BRIGHTNESS_UP = 191;
+const KEY DALI_KEY_BRIGHTNESS_DOWN = 192;
+const KEY DALI_KEY_SOFT_KBD = 193;
+const KEY DALI_KEY_QUICK_PANEL = 194;
+const KEY DALI_KEY_TASK_SWITCH = 195;
+const KEY DALI_KEY_APPS = 196;
+const KEY DALI_KEY_SEARCH = 197;
+const KEY DALI_KEY_VOICE = 198;
+const KEY DALI_KEY_LANGUAGE = 199;
+const KEY DALI_KEY_VOLUME_UP = 200;
+const KEY DALI_KEY_VOLUME_DOWN = 201;
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace KeyLookup
+{
+
+namespace
+{
+
+struct KeyLookup
+{
+ const char* keyName; ///< X string representation
+ const int daliKeyCode; ///< Dali Enum Representation
+ const bool deviceButton; ///< Whether the key is from a button on the device
+};
+
+// matches a DALI_KEY enum, to a X key name
+KeyLookup KeyLookupTable[]=
+{
+ // more than one key name can be assigned to a single dali-key code
+ // e.g. Menu and KEY_MENU("FS86KeyMenu") are both assigned to DALI_KEY_MENU
+
+ { "Escape", DALI_KEY_ESCAPE, false }, // item not defined in utilX
+ { "Menu", DALI_KEY_MENU, false }, // item not defined in utilX
+ { KEY_CAMERA, DALI_KEY_CAMERA, false },
+ { KEY_CONFIG, DALI_KEY_CONFIG, false },
+ { KEY_POWER, DALI_KEY_POWER, true },
+ { KEY_PAUSE, DALI_KEY_PAUSE, false },
+ { KEY_CANCEL, DALI_KEY_CANCEL, false },
+ { KEY_PLAYCD, DALI_KEY_PLAY_CD, false },
+ { KEY_STOPCD, DALI_KEY_STOP_CD, false },
+ { KEY_PAUSECD, DALI_KEY_PAUSE_CD, false },
+ { KEY_NEXTSONG, DALI_KEY_NEXT_SONG, false },
+ { KEY_PREVIOUSSONG, DALI_KEY_PREVIOUS_SONG, false },
+ { KEY_REWIND, DALI_KEY_REWIND, false },
+ { KEY_FASTFORWARD, DALI_KEY_FASTFORWARD, false },
+ { KEY_MEDIA, DALI_KEY_MEDIA, false },
+ { KEY_PLAYPAUSE, DALI_KEY_PLAY_PAUSE, false },
+ { KEY_MUTE, DALI_KEY_MUTE, false },
+ { KEY_SEND, DALI_KEY_SEND, true },
+ { KEY_SELECT, DALI_KEY_SELECT, true },
+ { KEY_END, DALI_KEY_END, true },
+ { KEY_MENU, DALI_KEY_MENU, true },
+ { KEY_HOME, DALI_KEY_HOME, true },
+ { KEY_BACK, DALI_KEY_BACK, true },
+ { KEY_HOMEPAGE, DALI_KEY_HOMEPAGE, false },
+ { KEY_WEBPAGE, DALI_KEY_WEBPAGE, false },
+ { KEY_MAIL, DALI_KEY_MAIL, false },
+ { KEY_SCREENSAVER, DALI_KEY_SCREENSAVER, false },
+ { KEY_BRIGHTNESSUP, DALI_KEY_BRIGHTNESS_UP, false },
+ { KEY_BRIGHTNESSDOWN, DALI_KEY_BRIGHTNESS_DOWN, false },
+ { KEY_SOFTKBD, DALI_KEY_SOFT_KBD, false },
+ { KEY_QUICKPANEL, DALI_KEY_QUICK_PANEL, false },
+ { KEY_TASKSWITCH, DALI_KEY_TASK_SWITCH, false },
+ { KEY_APPS, DALI_KEY_APPS, false },
+ { KEY_SEARCH, DALI_KEY_SEARCH, false },
+ { KEY_VOICE, DALI_KEY_VOICE, false },
+ { KEY_LANGUAGE, DALI_KEY_LANGUAGE, false },
+ { KEY_VOLUMEUP, DALI_KEY_VOLUME_UP, true },
+ { KEY_VOLUMEDOWN, DALI_KEY_VOLUME_DOWN, true },
+};
+
+const std::size_t KEY_LOOKUP_COUNT = (sizeof( KeyLookupTable))/ (sizeof(KeyLookup));
+
+class KeyMap
+{
+ public:
+
+ KeyMap():
+ mLookup( cmpString )
+ {
+ // create the lookup
+ for( size_t i = 0; i < KEY_LOOKUP_COUNT ; ++i )
+ {
+ const KeyLookup& keyLookup( KeyLookupTable[i] );
+ mLookup[ keyLookup.keyName ] = DaliKeyType( keyLookup.daliKeyCode, keyLookup.deviceButton );
+ }
+ }
+
+ int GetDaliKeyEnum( const char* keyName ) const
+ {
+ Lookup::const_iterator i = mLookup.find( keyName );
+ if( i == mLookup.end() )
+ {
+ return -1;
+ }
+ else
+ {
+ return (*i).second.first;
+ }
+ }
+
+ bool IsDeviceButton( const char* keyName ) const
+ {
+ Lookup::const_iterator i = mLookup.find( keyName );
+ if ( i != mLookup.end() )
+ {
+ return (*i).second.second;
+ }
+ return false;
+ }
+
+ private:
+
+ /**
+ * compare function, to compare string by pointer
+ */
+ static bool cmpString( const char* a, const char* b)
+ {
+ return strcmp(a, b) < 0;
+ }
+
+ typedef std::pair< int, bool > DaliKeyType;
+ typedef std::map<const char* /* key name */, DaliKeyType /* key code */, bool(*) ( char const* a, char const* b) > Lookup;
+ Lookup mLookup;
+
+};
+const KeyMap globalKeyLookup;
+
+} // un-named name space
+
+bool IsKey( const Dali::KeyEvent& keyEvent, Dali::KEY daliKey)
+{
+ int key = globalKeyLookup.GetDaliKeyEnum( keyEvent.keyPressedName.c_str() );
+ return daliKey == key;
+}
+
+bool IsDeviceButton( const char* keyName )
+{
+ return globalKeyLookup.IsDeviceButton( keyName );
+}
+
+} // namespace KeyLookup
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "tilt-sensor-impl.h"
+
+// EXTERNAL INCLUDES
+#include <cmath>
+
+#include <dali/public-api/object/type-registry.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <adaptor-impl.h>
+
+namespace // unnamed namespace
+{
+
+const int NUMBER_OF_SAMPLES = 10;
+
+const float MAX_ACCELEROMETER_XY_VALUE = 9.8f;
+
+// Type Registration
+Dali::BaseHandle Create()
+{
+ return Dali::Internal::Adaptor::TiltSensor::Get();
+}
+
+Dali::TypeRegistration typeRegistration( typeid(Dali::TiltSensor), typeid(Dali::BaseHandle), Create );
+
+Dali::SignalConnectorType signalConnector1( typeRegistration, Dali::TiltSensor::SIGNAL_TILTED, Dali::Internal::Adaptor::TiltSensor::DoConnectSignal );
+
+} // unnamed namespace
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+Dali::TiltSensor TiltSensor::New()
+{
+ Dali::TiltSensor sensor = Dali::TiltSensor(new TiltSensor());
+
+ return sensor;
+}
+
+Dali::TiltSensor TiltSensor::Get()
+{
+ Dali::TiltSensor sensor;
+
+ if ( Adaptor::IsAvailable() )
+ {
+ // Check whether the keyboard focus manager is already created
+ Dali::BaseHandle handle = Dali::Adaptor::Get().GetSingleton( typeid( Dali::TiltSensor ) );
+ if(handle)
+ {
+ // If so, downcast the handle of singleton to keyboard focus manager
+ sensor = Dali::TiltSensor( dynamic_cast< TiltSensor* >( handle.GetObjectPtr() ) );
+ }
+ else
+ {
+ // Create a singleton instance
+ Adaptor& adaptorImpl( Adaptor::GetImplementation( Adaptor::Get() ) );
+ sensor = TiltSensor::New();
+ adaptorImpl.RegisterSingleton( typeid( sensor ), sensor );
+ handle = sensor;
+ }
+ }
+
+ return sensor;
+}
+
+TiltSensor::~TiltSensor()
+{
+ Disable();
+}
+
+bool TiltSensor::Enable()
+{
+ // Make sure sensor API is responding
+ bool success = Update();
+
+ if ( success )
+ {
+ if ( !mTimer )
+ {
+ mTimer = Dali::Timer::New( 1000.0f / mFrequencyHertz );
+ mTimer.TickSignal().Connect( mTimerSlot, &TiltSensor::Update );
+ }
+
+ if ( mTimer &&
+ !mTimer.IsRunning() )
+ {
+ mTimer.Start();
+ }
+ }
+
+ return success;
+}
+
+void TiltSensor::Disable()
+{
+ if ( mTimer )
+ {
+ mTimer.Stop();
+ mTimer.Reset();
+ }
+}
+
+bool TiltSensor::IsEnabled() const
+{
+ return ( mTimer && mTimer.IsRunning() );
+}
+
+float TiltSensor::GetRoll() const
+{
+ return mRoll;
+}
+
+float TiltSensor::GetPitch() const
+{
+ return mPitch;
+}
+
+Quaternion TiltSensor::GetRotation() const
+{
+ return mRotation;
+}
+
+TiltSensor::TiltedSignalV2& TiltSensor::TiltedSignal()
+{
+ return mTiltedSignalV2;
+}
+
+void TiltSensor::SetUpdateFrequency( float frequencyHertz )
+{
+ DALI_ASSERT_ALWAYS( frequencyHertz > 0.0f && "Frequency must have a positive value" );
+
+ if ( fabsf(mFrequencyHertz - frequencyHertz) >= GetRangedEpsilon(mFrequencyHertz, frequencyHertz) )
+ {
+ mFrequencyHertz = frequencyHertz;
+
+ if ( mTimer )
+ {
+ mTimer.SetInterval( 1000.0f / mFrequencyHertz );
+ }
+ }
+}
+
+float TiltSensor::GetUpdateFrequency() const
+{
+ return mFrequencyHertz;
+}
+
+void TiltSensor::SetRotationThreshold(Radian rotationThreshold)
+{
+ mRotationThreshold = rotationThreshold;
+}
+
+Radian TiltSensor::GetRotationThreshold() const
+{
+ return mRotationThreshold;
+}
+
+bool TiltSensor::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+ bool connected( true );
+ TiltSensor* sensor = dynamic_cast<TiltSensor*>( object );
+
+ if( sensor &&
+ Dali::TiltSensor::SIGNAL_TILTED == signalName )
+ {
+ sensor->TiltedSignal().Connect( tracker, functor );
+ }
+ else
+ {
+ // signalName does not match any signal
+ connected = false;
+ }
+
+ return connected;
+}
+
+TiltSensor::TiltSensor()
+: mFrequencyHertz( Dali::TiltSensor::DEFAULT_UPDATE_FREQUENCY ),
+ mTimerSlot( this ),
+ mSensorFrameworkHandle( -1 ),
+ mRoll( 0.0f ),
+ mPitch( 0.0f ),
+ mRotation( 0.0f, Vector3::YAXIS ),
+ mRotationThreshold( 0.0f )
+{
+ mRollValues.resize( NUMBER_OF_SAMPLES, 0.0f );
+ mPitchValues.resize( NUMBER_OF_SAMPLES, 0.0f );
+}
+
+bool TiltSensor::Update()
+{
+ float newRoll = 0.0f;
+ float newPitch = 0.0f;
+ Quaternion newRotation;
+
+ Radian angle(Quaternion::AngleBetween(newRotation, mRotation));
+ // If the change in value is more than the threshold then emit tilted signal.
+ if( angle > mRotationThreshold )
+ {
+ mRoll = newRoll;
+ mPitch = newPitch;
+ mRotation = newRotation;
+
+ if ( !mTiltedSignalV2.Empty() )
+ {
+ Dali::TiltSensor handle( this );
+ mTiltedSignalV2.Emit( handle );
+ }
+ }
+
+ return true;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_INTERNAL_ADAPTOR_TILT_SENSOR_H__
+#define __DALI_INTERNAL_ADAPTOR_TILT_SENSOR_H__
+
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <deque>
+#include <dali/public-api/object/base-object.h>
+#include <timer.h>
+
+// INTERNAL INCLUDES
+#include <tilt-sensor.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * TiltSensor provides pitch & roll values when the device is tilted.
+ */
+class TiltSensor : public Dali::BaseObject
+{
+public:
+
+ typedef Dali::TiltSensor::TiltedSignalV2 TiltedSignalV2;
+
+ /**
+ * Create a TiltSensor.
+ * This should only be called once by the Adaptor class.
+ * @return A newly allocated tilt-sensor.
+ */
+ static Dali::TiltSensor New();
+
+ /**
+ * @copydoc Dali::TiltSensor::Get()
+ */
+ static Dali::TiltSensor Get();
+
+ /**
+ * @copydoc Dali::TiltSensor::Enable()
+ */
+ bool Enable();
+
+ /**
+ * @copydoc Dali::TiltSensor::Disable()
+ */
+ void Disable();
+
+ /**
+ * @copydoc Dali::TiltSensor::IsEnabled()
+ */
+ bool IsEnabled() const;
+
+ /**
+ * @copydoc Dali::TiltSensor::GetRoll()
+ */
+ float GetRoll() const;
+
+ /**
+ * @copydoc Dali::TiltSensor::GetPitch()
+ */
+ float GetPitch() const;
+
+ /**
+ * @copydoc Dali::TiltSensor::GetRotation()
+ */
+ Quaternion GetRotation() const;
+
+ /**
+ * @copydoc Dali::TiltSensor::TiltedSignal()
+ */
+ TiltedSignalV2& TiltedSignal();
+
+ /**
+ * @copydoc Dali::TiltSensor::SetUpdateFrequency()
+ */
+ void SetUpdateFrequency( float frequencyHertz );
+
+ /**
+ * @copydoc Dali::TiltSensor::GetUpdateFrequency()
+ */
+ float GetUpdateFrequency() const;
+
+ /**
+ * @copydoc Dali::TiltSensor::SetRotationThreshold()
+ */
+ void SetRotationThreshold(Radian rotationThreshold);
+
+ /**
+ * @copydoc Dali::TiltSensor::GetRotationThreshold()
+ */
+ Radian GetRotationThreshold() const;
+
+ /**
+ * Connects a callback function with the object's signals.
+ * @param[in] object The object providing the signal.
+ * @param[in] tracker Used to disconnect the signal.
+ * @param[in] signalName The signal to connect to.
+ * @param[in] functor A newly allocated FunctorDelegate.
+ * @return True if the signal was connected.
+ * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
+ */
+ static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+
+private:
+
+ /**
+ * Private constructor; see also TiltSensor::New()
+ */
+ TiltSensor();
+
+ /**
+ * Destructor
+ */
+ virtual ~TiltSensor();
+
+ /**
+ * Timer callback to update the tilt values
+ */
+ bool Update();
+
+ // Undefined
+ TiltSensor(const TiltSensor&);
+
+ // Undefined
+ TiltSensor& operator=(TiltSensor&);
+
+private:
+
+ float mFrequencyHertz;
+ Dali::Timer mTimer;
+ SlotDelegate< TiltSensor > mTimerSlot;
+
+ int mSensorFrameworkHandle;
+
+ float mRoll;
+ float mPitch;
+ Quaternion mRotation;
+
+ Radian mRotationThreshold;
+
+ std::deque<float> mRollValues;
+ std::deque<float> mPitchValues;
+
+ TiltedSignalV2 mTiltedSignalV2;
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::Adaptor::TiltSensor& GetImplementation(Dali::TiltSensor& sensor)
+{
+ DALI_ASSERT_ALWAYS( sensor && "TiltSensor handle is empty" );
+
+ BaseObject& handle = sensor.GetBaseObject();
+
+ return static_cast<Internal::Adaptor::TiltSensor&>(handle);
+}
+
+inline const Internal::Adaptor::TiltSensor& GetImplementation(const Dali::TiltSensor& sensor)
+{
+ DALI_ASSERT_ALWAYS( sensor && "TiltSensor handle is empty" );
+
+ const BaseObject& handle = sensor.GetBaseObject();
+
+ return static_cast<const Internal::Adaptor::TiltSensor&>(handle);
+}
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_ADAPTOR_TILT_SENSOR_H__
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "tts-player-impl.h"
+
+// INTERNAL INCLUDES
+#include <dali/public-api/object/type-registry.h>
+
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace // unnamed namespace
+{
+// Type Registration
+Dali::BaseHandle Create()
+{
+ return Dali::TtsPlayer::Get() ;
+}
+
+Dali::TypeRegistration mType( typeid(Dali::TtsPlayer), typeid(Dali::BaseHandle), Create ) ;
+} // unnamed namespace
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* TtsPlayer::gLogFilter = Debug::Filter::New(Debug::Concise, false, "LOG_TTS_PLAYER");
+#endif
+
+Dali::TtsPlayer TtsPlayer::New(Dali::TtsPlayer::Mode mode)
+{
+ Dali::TtsPlayer player = Dali::TtsPlayer(new TtsPlayer(mode));
+
+ return player;
+}
+
+TtsPlayer::TtsPlayer(Dali::TtsPlayer::Mode mode)
+{
+ DALI_LOG_ERROR("TTS is not implemented in UBUNTU profile.");
+}
+
+TtsPlayer::~TtsPlayer()
+{
+}
+
+void TtsPlayer::Play(const std::string& text)
+{
+}
+
+void TtsPlayer::Stop()
+{
+}
+
+void TtsPlayer::Pause()
+{
+}
+
+void TtsPlayer::Resume()
+{
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
--- /dev/null
+#ifndef __DALI_INTERNAL_TTS_PLAYER_H__
+#define __DALI_INTERNAL_TTS_PLAYER_H__
+
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+
+#include <string>
+
+#include <dali/integration-api/debug.h>
+#include <dali/public-api/object/base-object.h>
+#include <tts-player.h>
+
+// INTERNAL INCLUDES
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+/**
+ * Text-to-speech player
+ */
+class TtsPlayer : public Dali::BaseObject
+{
+
+public:
+
+ /**
+ * Create a TtsPlayer with the given mode.
+ * This should only be called once by the Adaptor class for each given mode.
+ * @param mode the mode of tts-player
+ * @return A newly created TtsPlayer.
+ */
+ static Dali::TtsPlayer New(Dali::TtsPlayer::Mode mode);
+
+ /**
+ * @copydoc TtsPlayer::Play()
+ */
+ void Play(const std::string& text);
+
+ /**
+ * @copydoc TtsPlayer::Stop()
+ */
+ void Stop();
+
+ /**
+ * @copydoc TtsPlayer::Pause()
+ */
+ void Pause();
+
+ /**
+ * @copydoc TtsPlayer::Resume()
+ */
+ void Resume();
+
+private:
+
+ /**
+ * Private Constructor; see also TtsPlayer::New()
+ * @param mode the mode of tts-player
+ */
+ TtsPlayer(Dali::TtsPlayer::Mode mode);
+
+ /**
+ * Destructor
+ */
+ virtual ~TtsPlayer();
+
+private:
+
+ std::string mUnplayedString; ///< The text that can not be played because tts engine is not yet initialized
+ int mUtteranceId; ///< The utterance ID
+
+ Dali::TtsPlayer::Mode mTtsMode; ///< The current mode of tts engine
+
+#if defined(DEBUG_ENABLED)
+public:
+ static Debug::Filter* gLogFilter;
+#endif
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+// Helpers for public-api forwarding methods
+
+inline Internal::Adaptor::TtsPlayer& GetImplementation(Dali::TtsPlayer& player)
+{
+ DALI_ASSERT_ALWAYS( player && "TtsPlayer handle is empty" );
+
+ BaseObject& handle = player.GetBaseObject();
+
+ return static_cast<Internal::Adaptor::TtsPlayer&>(handle);
+}
+
+inline const Internal::Adaptor::TtsPlayer& GetImplementation(const Dali::TtsPlayer& player)
+{
+ DALI_ASSERT_ALWAYS( player && "TtsPlayer handle is empty" );
+
+ const BaseObject& handle = player.GetBaseObject();
+
+ return static_cast<const Internal::Adaptor::TtsPlayer&>(handle);
+}
+
+} // namespace Dali
+
+#endif // __DALI_INTERNAL_TTS_PLAYER_H__
--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include "vsync-monitor.h"
+
+// EXTERNAL INCLUDES
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include <dali/integration-api/debug.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_VSYNC_MONITOR");
+#endif
+
+const int FD_NONE( -1 );
+
+} // unnamed namespace
+
+VSyncMonitor::VSyncMonitor()
+: mFileDescriptor( FD_NONE ),
+ mUseHardware( false )
+{
+}
+
+VSyncMonitor::~VSyncMonitor()
+{
+ Terminate();
+}
+
+void VSyncMonitor::SetUseHardware( bool useHardware )
+{
+ mUseHardware = useHardware;
+}
+
+void VSyncMonitor::Initialize()
+{
+ DALI_ASSERT_DEBUG( mFileDescriptor == FD_NONE && "VSyncMonitor::Initialize() called twice" );
+
+ // setup vblank request - block and wait for next vblank
+ mVBlankInfo.request.type = DRM_VBLANK_NEXTONMISS;
+ mVBlankInfo.request.sequence = 0;
+ mVBlankInfo.request.signal = 0;
+
+ // setup vblank reply - block and wait for next vblank
+ mVBlankInfo.reply.type = DRM_VBLANK_NEXTONMISS;
+ mVBlankInfo.reply.sequence = 0;
+ mVBlankInfo.reply.tval_sec = 0;
+ mVBlankInfo.reply.tval_usec = 0;
+}
+
+void VSyncMonitor::Terminate()
+{
+ if( mFileDescriptor != FD_NONE )
+ {
+ close( mFileDescriptor );
+ mFileDescriptor = FD_NONE;
+ }
+}
+
+bool VSyncMonitor::UseHardware()
+{
+ return mUseHardware && (FD_NONE != mFileDescriptor );
+}
+
+
+bool VSyncMonitor::DoSync( unsigned int& frameNumber, unsigned int& seconds, unsigned int& microseconds )
+{
+ DALI_ASSERT_DEBUG( mFileDescriptor != FD_NONE && "ECoreX::VSyncMonitor is not initialized" );
+
+ if( 0 == drmWaitVBlank( mFileDescriptor, &mVBlankInfo ) )
+ {
+ frameNumber = mVBlankInfo.reply.sequence;
+ seconds = mVBlankInfo.reply.tval_sec;
+ microseconds = mVBlankInfo.reply.tval_usec;
+
+ return true;
+ }
+
+ return false;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
#include <sys/time.h>
+#ifndef DALI_PROFILE_UBUNTU
#include <vconf.h>
#include <vconf-keys.h>
+#endif // DALI_PROFILE_UBUNTU
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/events/touch-point.h>
return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
}
+#ifndef DALI_PROFILE_UBUNTU
const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
+#endif // DALI_PROFILE_UBUNTU
} // unnamed namespace
mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_DOWN, EcoreEventKeyDown, handler ) );
mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_EVENT_KEY_UP, EcoreEventKeyUp, handler ) );
+#ifndef DALI_PROFILE_UBUNTU
// Register Vconf notify - font name and size
vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontNameChanged, handler );
vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, handler );
+#endif // DALI_PROFILE_UBUNTU
}
}
*/
~Impl()
{
+#ifndef DALI_PROFILE_UBUNTU
vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontNameChanged );
+#endif // DALI_PROFILE_UBUNTU
for( std::vector<Ecore_Event_Handler*>::iterator iter = mEcoreEventHandler.begin(), endIter = mEcoreEventHandler.end(); iter != endIter; ++iter )
{
# wayland
-adaptor_wayland_internal_header_files = \
- $(adaptor_wayland_dir)/clipboard-impl.h \
- $(adaptor_wayland_dir)/imf-manager-impl.h \
- $(adaptor_wayland_dir)/pixmap-image-impl.h \
- $(adaptor_wayland_dir)/pixmap-render-surface.h
-
-adaptor_wayland_application_src_files = \
- $(adaptor_wayland_dir)/framework-wl.cpp
-
-adaptor_wayland_internal_src_files = \
+adaptor_wayland_tizen_internal_src_files = \
$(adaptor_wayland_dir)/accessibility-manager-impl-wl.cpp \
$(adaptor_wayland_dir)/clipboard-impl-wl.cpp \
$(adaptor_wayland_dir)/imf-manager-impl-wl.cpp \
$(adaptor_wayland_dir)/pixmap-image-impl-wl.cpp \
$(adaptor_wayland_dir)/server-connection-wl.cpp \
- $(adaptor_wayland_dir)/system-settings-wl.cpp \
$(adaptor_wayland_dir)/virtual-keyboard-impl-wl.cpp \
$(adaptor_wayland_dir)/window-impl-wl.cpp \
$(adaptor_wayland_dir)/event-handler-wl.cpp \
$(adaptor_wayland_dir)/egl-implementation-wl.cpp \
- $(adaptor_wayland_dir)/ecore-wl-render-surface.cpp \
$(adaptor_wayland_dir)/pixmap-render-surface-wl.cpp \
- $(adaptor_wayland_dir)/window-render-surface-wl.cpp
-
-adaptor_wayland_profile_src_files = \
- $(adaptor_wayland_dir)/key-impl-wl.cpp \
- $(adaptor_wayland_dir)/ecore-wl-render-surface-factory.cpp
+ $(adaptor_wayland_dir)/ecore-wl-render-surface.cpp \
+ $(adaptor_wayland_dir)/window-render-surface-wl.cpp \
+ $(adaptor_wayland_dir)/key-impl-wl.cpp
+
+adaptor_wayland_tizen_common_internal_default_profile_src_files = \
+ $(adaptor_wayland_dir)/ecore-wl-render-surface-factory.cpp \
+ $(adaptor_wayland_dir)/system-settings-wl.cpp
+
+adaptor_wayland_tizen_application_src_files = \
+ $(adaptor_wayland_dir)/framework-wl.cpp
+
*
*/
-// EXTERNAL INCLUDES
-#include <system_settings.h>
-#include <Elementary.h>
-
// INTERNAL INCLUDES
#include "system-settings.h"
// INTERNAL INCLUDES
#include <ecore-x-render-surface.h>
+#include <gl/gl-implementation.h>
namespace Dali
{
DALI_ASSERT_ALWAYS( EGL_NO_CONTEXT != mEglContext && "EGL context not created" );
+ DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_VENDOR : %s ***\n", glGetString(GL_VENDOR));
+ DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_RENDERER : %s ***\n", glGetString(GL_RENDERER));
+ DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_VERSION : %s ***\n", glGetString(GL_VERSION));
+ DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** GL_SHADING_LANGUAGE_VERSION : %s***\n", glGetString(GL_SHADING_LANGUAGE_VERSION));
+ DALI_LOG_INFO(Debug::Filter::gShader, Debug::General, "*** Supported Extensions ***\n%s\n\n", glGetString(GL_EXTENSIONS));
+
return true;
}
#else // DALI_GLES_VERSION >= 30
+ DALI_LOG_WARNING( "Using OpenGL ES 2 \n" );
configAttribs.PushBack( EGL_OPENGL_ES2_BIT );
#endif //DALI_GLES_VERSION >= 30
configAttribs.PushBack( 24 );
configAttribs.PushBack( EGL_STENCIL_SIZE );
configAttribs.PushBack( 8 );
+#ifndef DALI_PROFILE_UBUNTU
configAttribs.PushBack( EGL_SAMPLES );
configAttribs.PushBack( 4 );
configAttribs.PushBack( EGL_SAMPLE_BUFFERS );
configAttribs.PushBack( 1 );
+#endif // DALI_PROFILE_UBUNTU
configAttribs.PushBack( EGL_NONE );
if ( eglChooseConfig( mEglDisplay, &(configAttribs[0]), &mEglConfig, 1, &numConfigs ) != EGL_TRUE )
{
case EGL_BAD_DISPLAY:
{
- DALI_LOG_ERROR("Display is not an EGL display connection");
+ DALI_LOG_ERROR("Display is not an EGL display connection\n");
break;
}
case EGL_BAD_ATTRIBUTE:
{
- DALI_LOG_ERROR("The parameter confirAttribs contains an invalid frame buffer configuration attribute or an attribute value that is unrecognized or out of range");
+ DALI_LOG_ERROR("The parameter configAttribs contains an invalid frame buffer configuration attribute or an attribute value that is unrecognized or out of range\n");
break;
}
case EGL_NOT_INITIALIZED:
{
- DALI_LOG_ERROR("Display has not been initialized");
+ DALI_LOG_ERROR("Display has not been initialized\n");
break;
}
case EGL_BAD_PARAMETER:
{
- DALI_LOG_ERROR("The parameter numConfig is NULL");
+ DALI_LOG_ERROR("The parameter numConfig is NULL\n");
break;
}
default:
{
- DALI_LOG_ERROR("Unknown error");
+ DALI_LOG_ERROR("Unknown error.\n");
}
}
DALI_ASSERT_ALWAYS(false && "eglChooseConfig failed!");
if ( numConfigs != 1 )
{
- DALI_LOG_ERROR("No configurations found.");
+ DALI_LOG_ERROR("No configurations found.\n");
TEST_EGL_ERROR("eglChooseConfig");
}
#include <sys/time.h>
+#ifndef DALI_PROFILE_UBUNTU
#include <vconf.h>
#include <vconf-keys.h>
+#endif // DALI_PROFILE_UBUNTU
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/events/touch-point.h>
namespace
{
+#ifndef DALI_PROFILE_UBUNTU
const char * DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME = "db/setting/accessibility/font_name"; // It will be update at vconf-key.h and replaced.
+#endif // DALI_PROFILE_UBUNTU
// Currently this code is internal to dali/dali/internal/event/text/utf8.h but should be made Public and used from there instead.
size_t Utf8SequenceLength(const unsigned char leadByte)
const unsigned int PRIMARY_TOUCH_BUTTON_ID( 1 );
+#ifndef DALI_PROFILE_UBUNTU
const char * CLIPBOARD_ATOM = "CBHM_MSG";
const char * CLIPBOARD_SET_OWNER_MESSAGE = "SET_OWNER";
+#endif // DALI_PROFILE_UBUNTU
/// The atoms required by Ecore for Drag & Drop behaviour.
Ecore_X_Atom DRAG_AND_DROP_ATOMS[] =
mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_CLEAR, EcoreEventSelectionClear, handler ) );
mEcoreEventHandler.push_back( ecore_event_handler_add( ECORE_X_EVENT_SELECTION_NOTIFY, EcoreEventSelectionNotify, handler ) );
+#ifndef DALI_PROFILE_UBUNTU
// Register Vconf notify - font name, font size and style
vconf_notify_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged, handler );
vconf_notify_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged, handler );
#if defined(DALI_PROFILE_MOBILE) || defined(DALI_PROFILE_LITE)
vconf_notify_key_changed( VCONFKEY_SETAPPL_CHANGE_UI_THEME_INT, VconfNotifyThemeChanged, handler );
#endif
+#endif // DALI_PROFILE_UBUNTU
}
}
*/
~Impl()
{
+#ifndef DALI_PROFILE_UBUNTU
#if defined(DALI_PROFILE_MOBILE) || defined(DALI_PROFILE_LITE)
vconf_ignore_key_changed( VCONFKEY_SETAPPL_CHANGE_UI_THEME_INT, VconfNotifyThemeChanged );
#endif
vconf_ignore_key_changed( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, VconfNotifyFontSizeChanged );
vconf_ignore_key_changed( DALI_VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_NAME, VconfNotifyFontNameChanged );
+#endif // DALI_PROFILE_UBUNTU
for( std::vector<Ecore_Event_Handler*>::iterator iter = mEcoreEventHandler.begin(), endIter = mEcoreEventHandler.end(); iter != endIter; ++iter )
{
*/
static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event )
{
+#ifndef DALI_PROFILE_UBUNTU
Ecore_X_Event_Client_Message* clientMessageEvent( (Ecore_X_Event_Client_Message*)event );
EventHandler* handler( (EventHandler*)data );
handler->SendRotationRequestEvent();
}
+#endif // DALI_PROFILE_UBUNTU
return ECORE_CALLBACK_PASS_ON;
}
return ECORE_CALLBACK_PASS_ON;
}
+
+#ifndef DALI_PROFILE_UBUNTU
/////////////////////////////////////////////////////////////////////////////////////////////////
// Font Callbacks
/////////////////////////////////////////////////////////////////////////////////////////////////
handler->SendEvent( themeChange );
}
+#endif // DALI_PROFILE_UBUNTU
// Data
EventHandler* mHandler;
# x11
-adaptor_x11_internal_header_files = \
- $(adaptor_x11_dir)/clipboard-impl.h \
- $(adaptor_x11_dir)/imf-manager-impl.h \
- $(adaptor_x11_dir)/pixmap-image-impl.h \
- $(adaptor_x11_dir)/pixmap-render-surface.h
-
-adaptor_x11_application_src_files = \
- $(adaptor_x11_dir)/framework-x.cpp
-
-adaptor_x11_internal_src_files = \
- $(adaptor_x11_dir)/accessibility-manager-impl-x.cpp \
+_adaptor_x11_internal_src_files = \
$(adaptor_x11_dir)/clipboard-impl-x.cpp \
$(adaptor_x11_dir)/imf-manager-impl-x.cpp \
$(adaptor_x11_dir)/pixmap-image-impl-x.cpp \
$(adaptor_x11_dir)/window-render-surface-x.cpp \
$(adaptor_x11_dir)/ecore-x-window-interface.cpp
-adaptor_x11_profile_src_files = \
+
+adaptor_x11_ubuntu_internal_src_files = \
+ $(_adaptor_x11_internal_src_files)
+
+adaptor_x11_tizen_internal_src_files = \
+ $(_adaptor_x11_internal_src_files) \
+ $(adaptor_x11_dir)/accessibility-manager-impl-x.cpp \
$(adaptor_x11_dir)/key-impl-x.cpp
-
-adaptor_x11_common_internal_profile_src_files = \
+
+adaptor_x11_tv_internal_src_files = \
+ $(_adaptor_x11_internal_src_files) \
+ $(adaptor_x11_dir)/accessibility-manager-impl-x.cpp
+
+adaptor_x11_internal_default_profile_src_files = \
$(adaptor_x11_dir)/ecore-x-render-surface-factory.cpp \
$(adaptor_x11_dir)/system-settings-x.cpp
+
+adaptor_x11_tizen_application_src_files = \
+ $(adaptor_x11_dir)/framework-x.cpp
+
// iterate through the list of attributes getting the type, start and end position.
for ( l = attrs, (attr = (Ecore_IMF_Preedit_Attr*)eina_list_data_get(l) ); l; l = eina_list_next(l), ( attr = (Ecore_IMF_Preedit_Attr*)eina_list_data_get(l) ))
{
+#ifdef DALI_PROFILE_UBUNTU
+ if ( attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB3 ) // (Ecore_IMF)
+#else // DALI_PROFILE_UBUNTU
if ( attr->preedit_type == ECORE_IMF_PREEDIT_TYPE_SUB4 ) // (Ecore_IMF)
+#endif // DALI_PROFILE_UBUNTU
{
// check first byte so know how many bytes a character is represented by as keyboard returns cursor position in bytes. Which is different for some languages.
*/
// EXTERNAL INCLUDES
+#ifndef DALI_PROFILE_UBUNTU
#include <system_settings.h>
+#endif // DALI_PROFILE_UBUNTU
#include <Elementary.h>
// INTERNAL INCLUDES
int GetElmAccessActionOver()
{
+#ifndef DALI_PROFILE_UBUNTU
// ELM_ACCESS_ACTION_OVER not available in common profile
return ELM_ACCESS_ACTION_LAST;
+#else // DALI_PROFILE_UBUNTU
+ return 0;
+#endif // DALI_PROFILE_UBUNTU
}
} // namespace Adaptor
}
DALI_ASSERT_ALWAYS( mEcoreWindow != 0 && "There is no ecore x window");
+#ifndef DALI_PROFILE_UBUNTU
// set property on window to get deiconify approve client message
unsigned int tmp = 1;
ecore_x_window_prop_card32_set(mEcoreWindow,
ECORE_X_ATOM_E_DEICONIFY_APPROVE,
&tmp, 1);
+#endif // DALI_PROFILE_UBUNTU
}
/**
static Eina_Bool EcoreEventClientMessage( void* data, int type, void* event )
{
Eina_Bool handled( ECORE_CALLBACK_PASS_ON );
+#ifndef DALI_PROFILE_UBUNTU
Ecore_X_Event_Client_Message* clientMessageEvent( (Ecore_X_Event_Client_Message*)event );
EventHandler* handler( (EventHandler*)data );
}
}
}
+#endif // DALI_PROFILE_UBUNTU
return handled;
}
ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
if( x11Window )
{
+#ifndef DALI_PROFILE_UBUNTU
Ecore_X_Window win = x11Window->GetXWindow();
switch(type)
{
default:
break;
}
+#endif // DALI_PROFILE_UBUNTU
}
}
ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
if( x11Window )
{
+#ifndef DALI_PROFILE_UBUNTU
Ecore_X_Window ecoreWindow = x11Window->GetXWindow();
if( ! mWMRotationAppSet )
{
rotations[i] = static_cast<int>(mAvailableOrientations[i]);
}
ecore_x_e_window_rotation_available_rotations_set(ecoreWindow, rotations, mAvailableOrientations.size() );
-
+#endif // DALI_PROFILE_UBUNTU
}
}
ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
if( x11Window )
{
+#ifndef DALI_PROFILE_UBUNTU
Ecore_X_Window ecoreWindow = x11Window->GetXWindow();
if( ! mWMRotationAppSet )
}
ecore_x_e_window_rotation_preferred_rotation_set(ecoreWindow, orientation);
+#endif // DALI_PROFILE_UBUNTU
}
}
ECore::WindowRenderSurface* x11Window = dynamic_cast< ECore::WindowRenderSurface * >( mSurface );
if( x11Window )
{
+#ifndef DALI_PROFILE_UBUNTU
Ecore_X_Window ecoreWindow = x11Window->GetXWindow();
Ecore_X_Window root = ecore_x_window_root_get(ecoreWindow);
ecore_x_window_prop_property_set( ecoreWindow,
ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
ECORE_X_ATOM_CARDINAL, 32, &angles, 2 );
+#endif // DALI_PROFILE_UBUNTU
}
}
// SwapBuffer is desychronized. So make sure to sychronize when window is deiconified.
glAbstraction.Finish();
+#ifndef DALI_PROFILE_UBUNTU
/* client sends immediately reply message using value 1 */
ecore_x_client_message32_send(mX11Window,
ECORE_X_ATOM_E_DEICONIFY_APPROVE,
ECORE_X_EVENT_MASK_WINDOW_CONFIGURE,
mX11Window, 1,
0, 0, 0);
+#endif // DALI_PROFILE_UBUNTU
ecore_x_sync();
../../../adaptors/common
../../../adaptors/base
../../../adaptors/public-api
+ ../../../adaptors/tizen
+ ../../../adaptors/ubuntu
../../../
)
#include <dali/integration-api/core.h>
#include <dali/integration-api/gl-abstraction.h>
+#include <dali/integration-api/gl-defines.h>
#include "test-trace-call-stack.h"
namespace Dali
TestGlAbstraction();
~TestGlAbstraction();
void Initialize();
+
void PreRender();
void PostRender(unsigned int timeDelta);
mActiveTextures[ mActiveTextureUnit ].mBoundTextures.push_back( texture );
}
}
+
+ std::stringstream out;
+ out << target << ", " << texture;
+ mTextureTrace.PushCall("BindTexture", out.str());
}
inline void BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
*(textures+i) = ++mLastAutoTextureIdUsed;
}
}
+
+ std::stringstream out;
+ for(int i=0; i<n; i++)
+ {
+ out << textures[i];
+ if(i<n-1)
+ {
+ out << ", ";
+ }
+ }
+ mTextureTrace.PushCall("GenTexture", out.str());
}
inline void GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, char* name)
}
}
+ inline std::string GetShaderSource(GLuint shader)
+ {
+ return mShaderSources[shader];
+ }
+
inline void StencilFunc(GLenum func, GLint ref, GLuint mask)
{
}
inline void TexParameterf(GLenum target, GLenum pname, GLfloat param)
{
+ std::stringstream out;
+ out << target << ", " << pname << ", " << param;
+ mTexParamaterTrace.PushCall("TexParameterf", out.str());
}
inline void TexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
{
+ std::stringstream out;
+ out << target << ", " << pname << ", " << params[0];
+ mTexParamaterTrace.PushCall("TexParameterfv", out.str());
}
inline void TexParameteri(GLenum target, GLenum pname, GLint param)
{
+ std::stringstream out;
+ out << target << ", " << pname << ", " << param;
+ mTexParamaterTrace.PushCall("TexParameteri", out.str());
}
inline void TexParameteriv(GLenum target, GLenum pname, const GLint* params)
{
+ std::stringstream out;
+ out << target << ", " << pname << ", " << params[0];
+ mTexParamaterTrace.PushCall("TexParameteriv", out.str());
}
inline void TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels)
inline void ResetTextureCallStack() { mTextureTrace.Reset(); }
inline TraceCallStack& GetTextureTrace() { return mTextureTrace; }
+ //Methods for Texture verification
+ inline void EnableTexParameterCallTrace(bool enable) { mTexParamaterTrace.Enable(enable); }
+ inline void ResetTexParameterCallStack() { mTexParamaterTrace.Reset(); }
+ inline TraceCallStack& GetTexParameterTrace() { return mTexParamaterTrace; }
+
//Methods for Draw verification
inline void EnableDrawCallTrace(bool enable) { mDrawTrace.Enable(enable); }
inline void ResetDrawCallStack() { mDrawTrace.Reset(); }
TraceCallStack mCullFaceTrace;
TraceCallStack mShaderTrace;
TraceCallStack mTextureTrace;
+ TraceCallStack mTexParamaterTrace;
TraceCallStack mDrawTrace;
// Shaders & Uniforms
*/
void TestPlatformAbstraction::LoadResource(const Integration::ResourceRequest& request)
{
- mTrace.PushCall("LoadResource", "");
+ std::ostringstream out;
+ out << "Type:";
+ if( request.GetType()->id == Integration::ResourceText )
+ {
+ out << "Text";
+ }
+ else
+ {
+ out << request.GetType()->id;
+ }
+ out << ", Path: " << request.GetPath() << std::endl ;
+
+ mTrace.PushCall("LoadResource", out.str());
if(mRequest != NULL)
{
delete mRequest;
--- /dev/null
+#ifndef _TEST_TOUCH_UTILS_H_
+#define _TEST_TOUCH_UTILS_H_
+
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <dali/public-api/actors/actor.h>
+
+namespace Dali
+{
+
+// Data for touch events
+struct TouchEventData
+{
+ TouchEventData()
+ : functorCalled(false),
+ receivedTouch(),
+ touchActor()
+ {
+ }
+
+ void Reset()
+ {
+ functorCalled = false;
+
+ receivedTouch.points.clear();
+ receivedTouch.time = 0;
+
+ touchActor = NULL;
+ }
+
+ bool functorCalled;
+ TouchEvent receivedTouch;
+ Actor touchActor;
+};
+
+// Functor that sets the data when called
+struct TouchEventDataFunctor
+{
+ TouchEventDataFunctor(TouchEventData& data) : touchEventData(data) { }
+
+ bool operator()(Actor actor, const TouchEvent& touch)
+ {
+ touchEventData.functorCalled = true;
+ touchEventData.touchActor = actor;
+ touchEventData.receivedTouch = touch;
+ return false;
+ }
+
+ // Generate a touch-event
+ Integration::TouchEvent GenerateSingleTouch( TouchPoint::State state, Vector2 screenPosition ) const
+ {
+ Integration::TouchEvent touchEvent;
+ touchEvent.points.push_back( TouchPoint ( 0, state, screenPosition.x, screenPosition.y ) );
+ return touchEvent;
+ }
+
+ TouchEventData& touchEventData;
+};
+
+
+} // namespace Dali
+
+#endif // _TEST_TOUCH_UTILS_H_
*/
void TraceCallStack::Enable(bool enable) { mTraceActive = enable; }
+bool TraceCallStack::IsEnabled() { return mTraceActive; }
+
/**
* Push a call onto the stack if the trace is active
* @param[in] method The name of the method
return found;
}
+int TraceCallStack::CountMethod(std::string method) const
+{
+ int numCalls = 0;
+ for( size_t i=0; i < mCallStack.size(); i++ )
+ {
+ if( 0 == mCallStack[i][0].compare(method) )
+ {
+ numCalls++;
+ }
+ }
+ return numCalls;
+}
+
+
/**
* Search for a method in the stack with the given parameter list
* @param[in] method The name of the method
*/
#include <string>
-#include <dali/public-api/common/vector-wrapper.h>
+#include <vector>
namespace Dali
{
*/
void Enable(bool enable);
+ bool IsEnabled();
+
/**
* Push a call onto the stack if the trace is active
* @param[in] method The name of the method
*/
bool FindMethod(std::string method) const;
+ /**
+ * Count how many times a method was called
+ * @param[in] method The name of the method
+ * @return The number of times it was called
+ */
+ int CountMethod(std::string method) const;
+
/**
* Search for a method in the stack with the given parameter list
* @param[in] method The name of the method
/.cov
/aclocal.m4
/autom4te.cache
+/ar-lib
+/compile
/config.guess
/config.log
/config.status
/install-sh
/libtool
/ltmain.sh
+/m4
/missing
*.pc
/documentation.list
if ! LITE_PROFILE
if ! WEARABLE_PROFILE
+if ! UBUNTU_PROFILE
SUBDIRS += plugins
endif
endif
+endif
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = dali.pc \
+++ /dev/null
-autoreconf --install
-./configure --prefix=$DESKTOP_PREFIX
-make install -j3
# Build the Dali Adaptor common intermediate library
+
+############# INCLUDE FILE LISTS #############
+
# Base Adaptor
base_adaptor_src_dir = ../../../adaptors/base
include ../../../adaptors/base/file.list
adaptor_common_dir = ../../../adaptors/common
include ../../../adaptors/common/file.list
+# Wayland
if WAYLAND
adaptor_wayland_dir = ../../../adaptors/wayland
include ../../../adaptors/wayland/file.list
else
+# X11
adaptor_x11_dir = ../../../adaptors/x11
include ../../../adaptors/x11/file.list
endif
-if COMMON_PROFILE
-adaptor_common_internal_src_files += $(adaptor_common_internal_profile_src_files)
-slp_platform_abstraction_src_files += $(slp_assimp_stubs_src_files)
-if ! WAYLAND
-adaptor_common_internal_src_files += $(adaptor_x11_common_internal_profile_src_files)
+# Ubuntu
+if UBUNTU_PROFILE
+adaptor_ubuntu_dir = ../../../adaptors/ubuntu
+include ../../../adaptors/ubuntu/file.list
+else
+# Tizen
+adaptor_tizen_dir = ../../../adaptors/tizen
+include ../../../adaptors/tizen/file.list
endif
+
+# Mobile
+adaptor_mobile_dir = ../../../adaptors/mobile
+include ../../../adaptors/mobile/file.list
+
+# TV
+if TV_PROFILE
+adaptor_tv_dir = ../../../adaptors/tv
+include ../../../adaptors/tv/file.list
endif
+# Public API
+adaptor_public_api_dir = ../../../adaptors/public-api
+include ../../../adaptors/public-api/file.list
+
+
+
+############# source files #############
+
+adaptor_src_files = $(adaptor_common_src_files)
+
+# COMMON
+if COMMON_PROFILE
+slp_platform_abstraction_src_files += $(slp_assimp_stubs_src_files)
+
+adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
+ $(adaptor_common_internal_default_profile_src_files) \
+ $(adaptor_tizen_internal_src_files)
+
if WAYLAND
-adaptor_common_internal_src_files += $(adaptor_wayland_internal_src_files)
-adaptor_common_internal_profile_src_files += $(adaptor_wayland_profile_src_files)
+adaptor_internal_src_files += $(adaptor_wayland_tizen_internal_src_files) \
+ $(adaptor_wayland_internal_default_profile_src_files)
else
-adaptor_common_internal_src_files += $(adaptor_x11_internal_src_files)
-adaptor_common_internal_profile_src_files += $(adaptor_x11_profile_src_files)
-endif
+adaptor_internal_src_files += $(adaptor_x11_tizen_internal_src_files) \
+ $(adaptor_x11_internal_default_profile_src_files)
+endif # WAYLAND
+endif # COMMON_PROFILE
+
+
+# UBUNTU
+if UBUNTU_PROFILE
+slp_platform_abstraction_src_files += $(slp_assimp_stubs_src_files)
+
+adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
+ $(adaptor_common_internal_default_profile_src_files) \
+ $(adaptor_ubuntu_internal_src_files) \
+ $(adaptor_x11_ubuntu_internal_src_files) \
+ $(adaptor_x11_internal_default_profile_src_files)
+endif # UBUNTU_PROFILE
+
+
+# MOBILE
if MOBILE_PROFILE
-adaptor_common_internal_src_files += $(adaptor_x11_profile_src_files)
slp_platform_abstraction_src_files += $(slp_assimp_src_files)
-include ../../../adaptors/mobile/file.list
+
+adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
+ $(adaptor_common_internal_mobile_profile_src_files) \
+ $(adaptor_tizen_internal_src_files) \
+ $(adaptor_x11_tizen_internal_src_files)
+
endif
+
+# LITE
if LITE_PROFILE
-adaptor_common_internal_src_files += $(adaptor_common_internal_profile_src_files)
slp_platform_abstraction_src_files += $(slp_assimp_stubs_src_files)
-if ! WAYLAND
-adaptor_common_internal_src_files += $(adaptor_x11_common_internal_profile_src_files)
-endif
+
+adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
+ $(adaptor_common_internal_mobile_profile_src_files) \
+ $(adaptor_tizen_internal_src_files) \
+ $(adaptor_x11_tizen_internal_src_files)
endif
+
+# WEARABLE
if WEARABLE_PROFILE
-adaptor_common_internal_src_files += $(adaptor_common_internal_profile_src_files)
slp_platform_abstraction_src_files += $(slp_assimp_stubs_src_files)
-if ! WAYLAND
-adaptor_common_internal_src_files += $(adaptor_x11_common_internal_profile_src_files)
-endif
+
+adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
+ $(adaptor_common_internal_mobile_profile_src_files) \
+ $(adaptor_tizen_internal_src_files) \
+ $(adaptor_x11_tizen_internal_src_files)
endif
+
+# TV
if TV_PROFILE
slp_platform_abstraction_src_files += $(slp_assimp_src_files)
-include ../../../adaptors/tv/file.list
-endif
-# Public API
-adaptor_public_api_dir = ../../../adaptors/public-api
-include ../../../adaptors/public-api/file.list
+adaptor_internal_src_files = $(adaptor_common_internal_src_files) \
+ $(adaptor_common_internal_tv_profile_src_files) \
+ $(adaptor_tizen_internal_src_files) \
+ $(adaptor_x11_tv_internal_src_files)
+endif
# Feedback Plugin
if ! LITE_PROFILE
if ! WEARABLE_PROFILE
plugin_themes_dir = ../../../adaptors/common/feedback
dali_plugin_theme_files = $(plugin_themes_dir)/default-feedback-theme.json
-
dalifeedbackthemedir = ${dataReadOnlyDir}/themes/feedback-themes/
dalifeedbacktheme_DATA = ${dali_plugin_theme_files}
endif
libdali_adaptor_common_la_SOURCES = \
$(base_adaptor_src_files) \
$(slp_platform_abstraction_src_files) \
- $(adaptor_common_src_files) \
- $(adaptor_common_internal_src_files)
+ $(adaptor_src_files) \
+ $(adaptor_internal_src_files)
libdali_adaptor_common_la_DEPENDENCIES =
-I../../../platform-abstractions/ \
-I../../../adaptors/public-api \
-I../../../adaptors/common \
- -I../../../adaptors/
+ -I../../../adaptors/
if WAYLAND
libdali_adaptor_common_la_includes += \
-I../../../adaptors/wayland
-I../../../adaptors/x11
endif
+if UBUNTU_PROFILE
+libdali_adaptor_common_la_includes += \
+ -I../../../adaptors/ubuntu
+else
+libdali_adaptor_common_la_includes += \
+ -I../../../adaptors/tizen
+endif
+
daliDefaultFontCacheDir = ${dataReadOnlyDir}/glyphcache/
daliUserFontCacheDir = ${dataReadWriteDir}/glyphcache/
daliDefaultThemeDir = ${dataReadWriteDir}/theme/
if TURBO_JPEG_IS_ON
libdali_adaptor_common_la_LIBADD += -lturbojpeg
CFLAGS += -D_TURBO_JPEG_LOADER
+if UBUNTU_PROFILE
+libdali_adaptor_common_la_LIBADD += -ljpeg
+CFLAGS += -fPIC
+endif
else
libdali_adaptor_common_la_LIBADD += -ljpeg
endif
AC_INIT([dali], [dali_version])
AM_INIT_AUTOMAKE([-Wall foreign])
+AC_CONFIG_MACRO_DIR([m4])
+
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_PROG_MKDIR_P
FREETYPE_REQUIRED=9.16.3
-PKG_CHECK_MODULES(CAPI_APPFW_APPLICATION, capi-appfw-application)
PKG_CHECK_MODULES(DALICORE, dali-core)
-PKG_CHECK_MODULES(DLOG, dlog)
PKG_CHECK_MODULES(ELEMENTARY, elementary)
PKG_CHECK_MODULES(ECORE, ecore)
PKG_CHECK_MODULES(ECORE_IPC, ecore-ipc)
PKG_CHECK_MODULES(EXIF, libexif)
PKG_CHECK_MODULES(FREETYPE, [freetype2 >= $FREETYPE_REQUIRED])
-PKG_CHECK_MODULES(FEEDBACK, feedback)
PKG_CHECK_MODULES(FONTCONFIG, fontconfig)
-PKG_CHECK_MODULES(MMFSOUND, mm-sound)
PKG_CHECK_MODULES(PNG, libpng)
-PKG_CHECK_MODULES(SENSOR, sensor)
-PKG_CHECK_MODULES(TTS, tts)
-PKG_CHECK_MODULES(VCONF, vconf)
PKG_CHECK_MODULES(XML, libxml-2.0)
-PKG_CHECK_MODULES(LIBDRM, libdrm)
PKG_CHECK_MODULES(LIBEXIF, libexif)
-PKG_CHECK_MODULES(CAPI_SYSTEM_SYSTEM_SETTINGS, capi-system-system-settings)
-PKG_CHECK_MODULES(EFL_ASSIST, efl-assist)
+PKG_CHECK_MODULES(LIBDRM, libdrm)
# Check for availability of BulletPhysics
PKG_CHECK_EXISTS(bullet, [
# Tizen Profile options
AC_ARG_ENABLE([profile],
- [AC_HELP_STRING([--enable-profile=COMMON,MOBILE,LITE,WEARABLE,TV],
+ [AC_HELP_STRING([--enable-profile=COMMON,MOBILE,LITE,WEARABLE,TV,UBUNTU],
[Select the variant of tizen])],
[enable_profile=$enableval],
[enable_profile=COMMON])
AM_CONDITIONAL([LITE_PROFILE], [test x$enable_profile = xLITE])
AM_CONDITIONAL([WEARABLE_PROFILE], [test x$enable_profile = xWEARABLE])
AM_CONDITIONAL([TV_PROFILE], [test x$enable_profile = xTV])
+AM_CONDITIONAL([UBUNTU_PROFILE], [test x$enable_profile = xUBUNTU])
AM_CONDITIONAL([WAYLAND], [test x$enable_wayland = xyes])
if test "x$enable_profile" = "xCOMMON"; then
PKG_CHECK_MODULES(HAPTIC, haptic)
fi
+if test "x$enable_profile" = "xUBUNTU"; then
+PKG_CHECK_MODULES(OPENGLES20, glesv2 egl)
+else
+PKG_CHECK_MODULES(CAPI_APPFW_APPLICATION, capi-appfw-application)
+PKG_CHECK_MODULES(DLOG, dlog)
+PKG_CHECK_MODULES(FEEDBACK, feedback)
+PKG_CHECK_MODULES(MMFSOUND, mm-sound)
+PKG_CHECK_MODULES(SENSOR, sensor)
+PKG_CHECK_MODULES(TTS, tts)
+PKG_CHECK_MODULES(VCONF, vconf)
+PKG_CHECK_MODULES(CAPI_SYSTEM_SYSTEM_SETTINGS, capi-system-system-settings)
+PKG_CHECK_MODULES(EFL_ASSIST, efl-assist)
+fi
+
if test "x$enable_wayland" = "xyes"; then
PKG_CHECK_MODULES(WAYLAND, [ecore-wayland egl wayland-egl wayland-client >= 1.2.0 xkbcommon],
[DALI_HAS_ECOREWL=yes],
include ../../../adaptors/x11/file.list
endif
+if UBUNTU_PROFILE
+adaptor_ubuntu_dir = ../../../adaptors/ubuntu
+include ../../../adaptors/ubuntu/file.list
+else
+adaptor_tizen_dir = ../../../adaptors/tizen
+include ../../../adaptors/tizen/file.list
+endif
+
lib_LTLIBRARIES = libdali-application.la
-libdali_application_la_SOURCES = \
- $(adaptor_application_src_files) \
- $(adaptor_application_internal_src_files)
+libdali_application_la_SOURCES = $(adaptor_common_application_src_files)
+
+libdali_application_la_SOURCES += $(adaptor_common_application_internal_src_files)
+
+if UBUNTU_PROFILE
+libdali_application_la_SOURCES += $(adaptor_ubuntu_application_src_files)
+else
+libdali_application_la_SOURCES += $(adaptor_tizen_application_src_files)
if WAYLAND
-libdali_application_la_SOURCES += $(adaptor_wayland_application_src_files)
+libdali_application_la_SOURCES += $(adaptor_wayland_tizen_application_src_files)
else
-libdali_application_la_SOURCES += $(adaptor_x11_application_src_files)
-endif
+libdali_application_la_SOURCES += $(adaptor_x11_tizen_application_src_files)
+endif # WAYLAND
+
+endif # UBUNTU_PROFILE
libdali_application_la_DEPENDENCIES =
-I../../../adaptors/common \
-I../../../adaptors/
+if UBUNTU_PROFILE
+libdali_application_includes += \
+ -I../../../adaptors/ubuntu
+endif
+
if WAYLAND
libdali_application_includes += \
-I../../../adaptors/wayland
$(TTS_CFLAGS)
libdali_application_la_LIBADD = \
- $(CAPI_APPFW_APPLICATION_LIBS)
+ $(CAPI_APPFW_APPLICATION_LIBS) \
+ $(ELEMENTARY_LIBS)
install-data-local:
$(MKDIR_P) ${DESTDIR}/${daliUserFontCacheDir} ${DESTDIR}/${daliUserShaderCacheDir}
#include <dali/integration-api/debug.h>
#include <dali/integration-api/bitmap.h>
#include <dali/public-api/images/image-attributes.h>
-#include <dlog.h>
namespace Dali
{
#include <dali/integration-api/bitmap.h>
#include <dali/public-api/images/image-attributes.h>
#include <dali/public-api/common/dali-vector.h>
-#include <dlog.h>
namespace Dali
{
#include "slp-logging.h"
// EXTERNAL INCLUDES
+#ifndef DALI_PROFILE_UBUNTU
#include <dlog.h>
+#endif // DALI_PROFILE_UBUNTU
namespace Dali
{
void LogMessage(Dali::Integration::Log::DebugPriority level, std::string& message)
{
const char* DALI_TAG = "DALI";
+
+#ifndef DALI_PROFILE_UBUNTU
switch(level)
{
case Dali::Integration::Log::DebugInfo:
LOG(LOG_DEFAULT, DALI_TAG, "%s", message.c_str());
break;
}
+#else // DALI_PROFILE_UBUNTU
+ const char *format = NULL;
+ switch(level)
+ {
+ case Dali::Integration::Log::DebugInfo:
+ format = "\e[1;34mINFO:\e[21m %s: %s\e[0m";
+ break;
+ case Dali::Integration::Log::DebugWarning:
+ format = "\e[1;33mWARN:\e[21m %s: %s\e[0m";
+ break;
+ case Dali::Integration::Log::DebugError:
+ format = "\e[1;91mERROR:\e[21m %s: %s\e[0m";
+ break;
+ default:
+ format = ":\e[21m %s: %s\e[0m";
+ break;
+ }
+ printf(format, DALI_TAG, message.c_str());
+#endif // DALI_PROFILE_UBUNTU
}
} // namespace SlpPlatform
#include "slp-platform-abstraction.h"
+#ifndef DALI_PROFILE_UBUNTU
#include <vconf.h>
+#endif // DALI_PROFILE_UBUNTU
#include <dirent.h>
#include <dali/integration-api/debug.h>
}
int fontSize(0);
+#ifndef DALI_PROFILE_UBUNTU
vconf_get_int( VCONFKEY_SETAPPL_ACCESSIBILITY_FONT_SIZE, &fontSize );
+#endif // DALI_PROFILE_UBUNTU
mDefaultFontSize = FONT_SIZE_TABLE[fontSize];
}