mPlatformAbstraction = new SlpPlatform::SlpPlatformAbstraction;
+ std::string path;
+ GetDataStoragePath( path );
+ mPlatformAbstraction->SetDataStoragePath( path );
+
ResourcePolicy::DataRetention dataRetentionPolicy = ResourcePolicy::DALI_DISCARDS_ALL_DATA;
if( configuration == Dali::Configuration::APPLICATION_DOES_NOT_HANDLE_CONTEXT_LOSS )
{
*/
void ProcessCoreEventsFromIdle();
+ /**
+ * Gets path for data/resource storage.
+ * @param[out] path Path for data/resource storage
+ */
+ void GetDataStoragePath(std::string& path);
+
private:
/**
mResumeSignal(),
mResetSignal(),
mResizeSignal(),
+ mAppControlSignal(),
mLanguageChangedSignal(),
+ mRegionChangedSignal(),
+ mBatteryLowSignal(),
+ mMemoryLowSignal(),
mEventLoop( NULL ),
mFramework( NULL ),
mCommandLineOptions( NULL ),
mWindow.Raise();
}
+void Application::OnAppControl(void *data)
+{
+ Dali::Application application(this);
+ mAppControlSignal.Emit( application , data );
+}
+
void Application::OnLanguageChanged()
{
mAdaptor->NotifyLanguageChanged();
}
+void Application::OnRegionChanged()
+{
+ Dali::Application application(this);
+ mRegionChangedSignal.Emit( application );
+}
+
+void Application::OnBatteryLow()
+{
+ Dali::Application application(this);
+ mBatteryLowSignal.Emit( application );
+}
+
+void Application::OnMemoryLow()
+{
+ Dali::Application application(this);
+ mMemoryLowSignal.Emit( application );
+}
+
void Application::OnResize(Dali::Adaptor& adaptor)
{
Dali::Application application(this);
public:
typedef Dali::Application::AppSignalType AppSignalType;
+ typedef Dali::Application::AppControlSignalType AppControlSignalType;
/**
* Constructor
virtual void OnResume();
/**
+ * Called when the framework received AppControlSignal.
+ * @param[in] The bundle data of AppControl event.
+ */
+ virtual void OnAppControl(void *data);
+
+ /**
* Called when the framework informs the application that it should reset itself.
*/
virtual void OnReset();
*/
virtual void OnLanguageChanged();
+ /**
+ * Called when the framework informs the application that the region of the device has changed.
+ */
+ virtual void OnRegionChanged();
+
+ /**
+ * Called when the framework informs the application that the battery level of the device is low.
+ */
+ virtual void OnBatteryLow();
+
+ /**
+ * Called when the framework informs the application that the memory level of the device is low.
+ */
+ virtual void OnMemoryLow();
+
public:
/**
Dali::Application::AppSignalType& ResetSignal() { return mResetSignal; }
/**
+ * @copydoc Dali::Application::AppControlSignal()
+ */
+ Dali::Application::AppControlSignalType& AppControlSignal() { return mAppControlSignal; }
+
+ /**
* @copydoc Dali::Application::ResizeSignal()
*/
Dali::Application::AppSignalType& ResizeSignal() { return mResizeSignal; }
*/
Dali::Application::AppSignalType& LanguageChangedSignal() { return mLanguageChangedSignal; }
+ /**
+ * @copydoc Dali::Application::RegionChangedSignal()
+ */
+ Dali::Application::AppSignalType& RegionChangedSignal() { return mRegionChangedSignal; }
+
+ /**
+ * @copydoc Dali::Application::BatteryLowSignal()
+ */
+ Dali::Application::AppSignalType& BatteryLowSignal() { return mBatteryLowSignal; }
+
+ /**
+ * @copydoc Dali::Application::MemoryLowSignal()
+ */
+ Dali::Application::AppSignalType& MemoryLowSignal() { return mMemoryLowSignal; }
+
private:
// Undefined
AppSignalType mResumeSignal;
AppSignalType mResetSignal;
AppSignalType mResizeSignal;
+ AppControlSignalType mAppControlSignal;
AppSignalType mLanguageChangedSignal;
+ AppSignalType mRegionChangedSignal;
+ AppSignalType mBatteryLowSignal;
+ AppSignalType mMemoryLowSignal;
+
EventLoop* mEventLoop;
Framework* mFramework;
virtual void OnReset() {}
/**
+ * Invoked when the AppControl message is received.
+ * @param[in] The bundle data of AppControl message.
+ */
+ virtual void OnAppControl(void *) {}
+
+ /**
* Invoked when the language of the device is changed.
*/
virtual void OnLanguageChanged() {}
+
+ /**
+ * Invoked when the region is changed.
+ */
+ virtual void OnRegionChanged() {}
+
+ /**
+ * Invoked when the battery level of the device is low.
+ */
+ virtual void OnBatteryLow() {}
+
+ /**
+ * Invoked when the memory level of the device is low.
+ */
+ virtual void OnMemoryLow() {}
+
};
public:
private:
/**
- * Called by the SLP framework when an application lifecycle event occurs.
+ * Called by the App framework when an application lifecycle event occurs.
* @param[in] type The type of event occurred.
+ * @param[in] bundleData The bundle data of event occurred.
*/
- bool SlpAppStatusHandler(int type);
+ bool AppStatusHandler(int type, void *bundleData);
/**
* Called app_reset callback was called with bundle.
" gl_FragColor = vColor*uColor;\n"
"}\n";
-// Copied from elm_win.h
-
-/**
- * Defines the type modes of indicator that can be shown
- * If the indicator can support several type of indicator,
- * you can use this enum value to deal with different type of indicator
- */
-typedef enum
-{
- ELM_WIN_INDICATOR_TYPE_UNKNOWN, /**< Unknown indicator type mode */
- ELM_WIN_INDICATOR_TYPE_1, /**< Type 0 the the indicator */
- ELM_WIN_INDICATOR_TYPE_2, /**< Type 1 the indicator */
-} Elm_Win_Indicator_Type_Mode;
-
-// Copied from ecore_evas_extn.c
+// Copied from ecore_evas_extn_engine.h
enum // opcodes
{
- OP_RESIZE,
- OP_SHOW,
- OP_HIDE,
- OP_FOCUS,
- OP_UNFOCUS,
- OP_UPDATE,
- OP_UPDATE_DONE,
- OP_LOCK_FILE,
- OP_SHM_REF,
- OP_EV_MOUSE_IN,
- OP_EV_MOUSE_OUT,
- OP_EV_MOUSE_UP,
- OP_EV_MOUSE_DOWN,
- OP_EV_MOUSE_MOVE,
- OP_EV_MOUSE_WHEEL,
- OP_EV_MULTI_UP,
- OP_EV_MULTI_DOWN,
- OP_EV_MULTI_MOVE,
- OP_EV_KEY_UP,
- OP_EV_KEY_DOWN,
- OP_EV_HOLD,
- OP_MSG_PARENT,
- OP_MSG,
- OP_PIXMAP_REF
+ OP_RESIZE,
+ OP_SHOW,
+ OP_HIDE,
+ OP_FOCUS,
+ OP_UNFOCUS,
+ OP_UPDATE,
+ OP_UPDATE_DONE,
+ OP_SHM_REF0,
+ OP_SHM_REF1,
+ OP_SHM_REF2,
+ OP_PROFILE_CHANGE_REQUEST,
+ OP_PROFILE_CHANGE_DONE,
+ OP_EV_MOUSE_IN,
+ OP_EV_MOUSE_OUT,
+ OP_EV_MOUSE_UP,
+ OP_EV_MOUSE_DOWN,
+ OP_EV_MOUSE_MOVE,
+ OP_EV_MOUSE_WHEEL,
+ OP_EV_MULTI_UP,
+ OP_EV_MULTI_DOWN,
+ OP_EV_MULTI_MOVE,
+ OP_EV_KEY_UP,
+ OP_EV_KEY_DOWN,
+ OP_EV_HOLD,
+ OP_MSG_PARENT,
+ OP_MSG
};
// Copied from elm_conform.c
-const int MSG_DOMAIN_CONTROL_INDICATOR(0x10001);
-const int MSG_ID_INDICATOR_REPEAT_EVENT(0x10002);
-const int MSG_ID_INDICATOR_ROTATION(0x10003);
-const int MSG_ID_INDICATOR_OPACITY(0X1004);
-const int MSG_ID_INDICATOR_TYPE(0X1005);
-const int MSG_ID_INDICATOR_START_ANIMATION(0X10006);
+const int MSG_DOMAIN_CONTROL_INDICATOR( 0x10001 );
+const int MSG_ID_INDICATOR_REPEAT_EVENT( 0x10002 );
+const int MSG_ID_INDICATOR_ROTATION( 0x10003 );
+const int MSG_ID_INDICATOR_OPACITY( 0X1004 );
+const int MSG_ID_INDICATOR_TYPE( 0X1005 );
+const int MSG_ID_INDICATOR_START_ANIMATION( 0X10006 );
struct IpcDataUpdate
{
#endif
-Indicator::LockFile::LockFile(const char* filename)
+Indicator::LockFile::LockFile(const std::string filename)
: mFilename(filename),
mErrorThrown(false)
{
- mFileDescriptor = open(filename, O_RDWR);
+ mFileDescriptor = open(filename.c_str(), O_RDWR);
if( mFileDescriptor == -1 )
{
mFileDescriptor = 0;
mState( DISCONNECTED ),
mAdaptor(adaptor),
mServerConnection( NULL ),
- mLock( NULL ),
- mSharedFile( NULL ),
mObserver( observer ),
mOrientation( orientation ),
mRotation( 0 ),
mImageHeight( 0 ),
mVisible( Dali::Window::INVISIBLE ),
mIsShowing( true ),
- mIsAnimationPlaying( false )
+ mIsAnimationPlaying( false ),
+ mCurrentSharedFile( 0 )
{
mIndicatorImageActor = Dali::ImageActor::New();
mIndicatorImageActor.SetBlendFunc( Dali::BlendingFactor::ONE, Dali::BlendingFactor::ONE_MINUS_SRC_ALPHA,
void Indicator::Close()
{
- DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s\n", STATE_DEBUG_STRING(mState) );
+ DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s", STATE_DEBUG_STRING(mState) );
if( mState == CONNECTED )
{
// If we were previously hidden, then we should update the image data before we display the indicator
if ( mVisible == Dali::Window::INVISIBLE )
{
- UpdateImageData();
+ UpdateImageData( mCurrentSharedFile );
}
if ( visibleMode != Dali::Window::INVISIBLE )
{
mState = DISCONNECTED;
- delete mLock;
- mLock = NULL;
-
- delete mSharedFile;
- mSharedFile = NULL;
-
delete mServerConnection;
mServerConnection = NULL;
-}
-
-void Indicator::NewLockFile( Ecore_Ipc_Event_Server_Data *epcEvent )
-{
- DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
-
- delete mLock;
- mLock = NULL;
- if ( (epcEvent->data) &&
- (epcEvent->size > 0) &&
- (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0) )
- {
- const char* lockFile = static_cast< const char* >( epcEvent->data );
- mLock = new Indicator::LockFile( lockFile );
- if( mLock->RetrieveAndClearErrorStatus() )
- {
- DALI_LOG_ERROR( "### Indicator error: Cannot open lock file %s ###\n", lockFile );
- }
- }
+ ClearSharedFileInfo();
}
void Indicator::Resize( int width, int height )
mImageWidth = width;
mImageHeight = height;
- // We don't currently handle the pixel buffer size being changed. Create a new image instead
- if( mSharedFile )
+ mIndicatorImageActor.SetSize( mImageWidth, mImageHeight );
+ mIndicatorActor.SetSize( mImageWidth, mImageHeight );
+ mEventActor.SetSize(mImageWidth, mImageHeight);
+
+ SetBackground();
+ if( mBackgroundActor )
{
- CreateNewImage();
+ mBackgroundActor.SetSize( mImageWidth, mImageHeight );
}
}
}
-void Indicator::LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent )
+void Indicator::SetLockFileInfo( Ecore_Ipc_Event_Server_Data *epcEvent )
{
DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
// epcEvent->ref == w
// epcEvent->ref_to == h
- // epcEvent->response == alpha
- // epcEvent->data = pixmap id
- if( ( epcEvent->data ) &&
- (epcEvent->size >= (int)sizeof(PixmapId)) )
+ // epcEvent->response == buffer num
+ // epcEvent->data = lockfile + nul byte
+
+ if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) && (epcEvent->data) &&
+ (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0) )
{
- if( mSharedFile != NULL )
+ int n = epcEvent->response;
+
+ if( n >= 0 && n < SHARED_FILE_NUMBER )
{
- delete mSharedFile;
- mSharedFile = NULL;
+ mCurrentSharedFile = n;
+
+ mSharedFileInfo[n].mImageWidth = epcEvent->ref;
+ mSharedFileInfo[n].mImageHeight = epcEvent->ref_to;
+
+ mSharedFileInfo[n].mLockFileName.clear();
+
+ mSharedFileInfo[n].mLockFileName = static_cast< char* >( epcEvent->data );
+
+ DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "SetLockFileInfo: buffer num = %d, w = %d, h = %d, lock = %s\n",
+ n, mSharedFileInfo[n].mImageWidth, mSharedFileInfo[n].mImageHeight, mSharedFileInfo[n].mLockFileName.c_str() );
}
+ }
+}
- if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) )
+void Indicator::SetSharedImageInfo( Ecore_Ipc_Event_Server_Data *epcEvent )
+{
+ DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
+
+ // epcEvent->ref == shm id
+ // epcEvent->ref_to == shm num
+ // epcEvent->response == buffer num
+ // epcEvent->data = shm ref string + nul byte
+
+ if ( (epcEvent->data) &&
+ (epcEvent->size > 0) &&
+ (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0) )
+ {
+ int n = epcEvent->response;
+
+ if( n >= 0 && n < SHARED_FILE_NUMBER )
{
- mImageWidth = epcEvent->ref;
- mImageHeight = epcEvent->ref_to;
+ mCurrentSharedFile = n;
- mPixmap = *(static_cast<PixmapId*>(epcEvent->data));
- CreateNewPixmapImage();
+ mSharedFileInfo[n].mSharedFileName.clear();
+
+ mSharedFileInfo[n].mSharedFileName = static_cast< char* >( epcEvent->data );
+
+ mSharedFileInfo[n].mSharedFileID = epcEvent->ref;
+ mSharedFileInfo[n].mSharedFileNumber = epcEvent->ref_to;
+
+ DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "SetSharedImageInfo: buffer num %d, shared file = %s, id = %d, num = %d\n",
+ n, mSharedFileInfo[n].mSharedFileName.c_str(), mSharedFileInfo[n].mSharedFileID, mSharedFileInfo[n].mSharedFileNumber );
+ }
+ }
+}
+
+void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent )
+{
+ DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
+
+ // epcEvent->ref == alpha
+ // epcEvent->ref_to == sys
+ // epcEvent->response == buffer num
+
+ int n = epcEvent->response;
+
+ if( n >= 0 && n < SHARED_FILE_NUMBER )
+ {
+ mCurrentSharedFile = n;
+
+ delete mSharedFileInfo[n].mSharedFile;
+ mSharedFileInfo[n].mSharedFile = NULL;
+
+ delete mSharedFileInfo[n].mLock;
+ mSharedFileInfo[n].mLock = NULL;
+
+ std::stringstream sharedFileID;
+ std::stringstream sharedFileNumber;
+
+ sharedFileID << mSharedFileInfo[n].mSharedFileID;
+ sharedFileNumber << mSharedFileInfo[n].mSharedFileNumber;
+
+ std::string sharedFilename = "/" + mSharedFileInfo[n].mSharedFileName + "-" + sharedFileID.str() + "." + sharedFileNumber.str();
+
+ DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "LoadSharedImage: file name = %s\n", sharedFilename.c_str() );
+
+ mSharedFileInfo[n].mSharedFile = SharedFile::New( sharedFilename.c_str(), mSharedFileInfo[n].mImageWidth * mSharedFileInfo[n].mImageWidth * 4, true );
+ if( mSharedFileInfo[n].mSharedFile != NULL )
+ {
+ mSharedFileInfo[n].mLock = new Indicator::LockFile( mSharedFileInfo[n].mLockFileName );
+ if( mSharedFileInfo[n].mLock->RetrieveAndClearErrorStatus() )
+ {
+ DALI_LOG_ERROR( "### Indicator error: Cannot open lock file %s ###\n", mSharedFileInfo[n].mLockFileName.c_str() );
+ }
+
+ CreateNewImage( n );
if( CheckVisibleState() )
{
}
}
-void Indicator::LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent )
+void Indicator::LoadPixmapImage( Ecore_Ipc_Event_Server_Data *epcEvent )
{
DALI_LOG_TRACE_METHOD( gIndicatorLogFilter );
// epcEvent->ref == w
// epcEvent->ref_to == h
// epcEvent->response == alpha
- // epcEvent->data = shm ref string + nul byte
+ // epcEvent->data = pixmap id
+
if( ( epcEvent->data ) &&
- ( ( unsigned char * ) epcEvent->data)[ epcEvent->size - 1 ] == 0 )
+ (epcEvent->size >= (int)sizeof(PixmapId)) )
{
- if( mSharedFile != NULL )
- {
- delete mSharedFile;
- mSharedFile = NULL;
- }
+ ClearSharedFileInfo();
if( (epcEvent->ref > 0) && (epcEvent->ref_to > 0) )
{
mImageWidth = epcEvent->ref;
mImageHeight = epcEvent->ref_to;
- char* sharedFilename = static_cast<char*>(epcEvent->data);
+ mPixmap = *(static_cast<PixmapId*>(epcEvent->data));
+ CreateNewPixmapImage();
- mSharedFile = SharedFile::New( sharedFilename, mImageWidth * mImageWidth * 4, true );
- if( mSharedFile != NULL )
+ if( CheckVisibleState() )
{
- CreateNewImage();
- mEventActor.SetSize(mImageWidth, mImageHeight);
-
- if( CheckVisibleState() )
- {
- // set default indicator type (enable the quick panel)
- OnIndicatorTypeChanged( INDICATOR_TYPE_1 );
- }
- else
- {
- // set default indicator type (disable the quick panel)
- OnIndicatorTypeChanged( INDICATOR_TYPE_2 );
- }
-
- SetVisible(mVisible, true);
+ // set default indicator type (enable the quick panel)
+ OnIndicatorTypeChanged( INDICATOR_TYPE_1 );
+ }
+ else
+ {
+ // set default indicator type (disable the quick panel)
+ OnIndicatorTypeChanged( INDICATOR_TYPE_2 );
}
+
+ SetVisible(mVisible, true);
}
}
}
-void Indicator::UpdateImageData()
+void Indicator::UpdateImageData( int bufferNumber )
{
- DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s mVisible: %s\n", STATE_DEBUG_STRING(mState), mVisible?"T":"F" );
+ DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "State: %s mVisible: %s", STATE_DEBUG_STRING(mState), mVisible?"T":"F" );
if( mState == CONNECTED && mVisible )
{
if(mPixmap == 0)
{
// in case of shm indicator (not pixmap), not sure we can skip it when mIsShowing is false
- CopyToBuffer();
+ CopyToBuffer( bufferNumber );
}
else
{
}
}
-bool Indicator::CopyToBuffer()
+bool Indicator::CopyToBuffer( int bufferNumber )
{
bool success = false;
- if( mLock )
+ if( mSharedFileInfo[bufferNumber].mLock )
{
- Indicator::ScopedLock scopedLock(mLock);
- if( mLock->RetrieveAndClearErrorStatus() )
+ Indicator::ScopedLock scopedLock(mSharedFileInfo[bufferNumber].mLock);
+ if( mSharedFileInfo[bufferNumber].mLock->RetrieveAndClearErrorStatus() )
{
// Do nothing here.
}
else if( scopedLock.IsLocked() )
{
- unsigned char *src = mSharedFile->GetAddress();
- size_t size = mImageWidth * mImageHeight * 4;
+ unsigned char *src = mSharedFileInfo[bufferNumber].mSharedFile->GetAddress();
+ size_t size = mSharedFileInfo[bufferNumber].mImageWidth * mSharedFileInfo[bufferNumber].mImageHeight * 4;
if( mIndicatorBuffer->UpdatePixels( src, size ) )
{
void Indicator::CreateNewPixmapImage()
{
- DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d\n", mImageWidth, mImageHeight );
+ DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d", mImageWidth, mImageHeight );
Dali::PixmapImagePtr pixmapImage = Dali::PixmapImage::New( mPixmap );
if( pixmapImage )
}
}
-void Indicator::CreateNewImage()
+void Indicator::CreateNewImage( int bufferNumber )
{
- DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d\n", mImageWidth, mImageHeight );
- mIndicatorBuffer = new IndicatorBuffer( mAdaptor, mImageWidth, mImageHeight, Pixel::BGRA8888 );
+ DALI_LOG_TRACE_METHOD_FMT( gIndicatorLogFilter, "W:%d H:%d", mSharedFileInfo[bufferNumber].mImageWidth, mSharedFileInfo[bufferNumber].mImageHeight );
+ mIndicatorBuffer = new IndicatorBuffer( mAdaptor, mSharedFileInfo[bufferNumber].mImageWidth, mSharedFileInfo[bufferNumber].mImageHeight, Pixel::BGRA8888 );
Dali::Image image = Dali::NativeImage::New( mIndicatorBuffer->GetNativeImage() );
- if( CopyToBuffer() ) // Only create images if we have valid image buffer
+ if( CopyToBuffer( bufferNumber ) ) // Only create images if we have valid image buffer
{
mIndicatorImageActor.SetImage( image );
- mIndicatorImageActor.SetSize( mImageWidth, mImageHeight );
- mIndicatorActor.SetSize( mImageWidth, mImageHeight );
- mEventActor.SetSize(mImageWidth, mImageHeight);
-
- SetBackground();
- if( mBackgroundActor )
- {
- mBackgroundActor.SetSize( mImageWidth, mImageHeight );
- }
}
else
{
switch( epcEvent->minor )
{
case OP_UPDATE:
+ {
DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE\n" );
- if(mPixmap != 0 && mIsShowing)
+ if( mPixmap != 0 && mIsShowing )
{
mAdaptor->RequestUpdateOnce();
}
break;
-
+ }
case OP_UPDATE_DONE:
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE_DONE\n" );
- UpdateImageData();
+ {
+ DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_UPDATE_DONE [%d]\n", epcEvent->response );
+ // epcEvent->response == display buffer #
+ UpdateImageData( epcEvent->response );
break;
-
- case OP_LOCK_FILE:
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_LOCK_FILE\n" );
- NewLockFile( epcEvent );
+ }
+ case OP_SHM_REF0:
+ {
+ DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF0\n" );
+ SetSharedImageInfo( epcEvent );
break;
-
- case OP_SHM_REF:
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF\n" );
- LoadSharedImage( epcEvent );
+ }
+ case OP_SHM_REF1:
+ {
+ DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF1\n" );
+ SetLockFileInfo( epcEvent );
break;
-
- case OP_PIXMAP_REF:
- DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_PIXMAP_REF\n" );
- LoadPixmapImage( epcEvent );
+ }
+ case OP_SHM_REF2:
+ {
+ DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_SHM_REF2\n" );
+ LoadSharedImage( epcEvent );
break;
-
+ }
case OP_RESIZE:
+ {
DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_RESIZE\n" );
if( (epcEvent->data) && (epcEvent->size >= (int)sizeof(IpcDataResize)) )
Resize( newSize->w, newSize->h );
}
break;
-
+ }
case OP_MSG_PARENT:
{
int msgDomain = epcEvent->ref;
msgData = epcEvent->data;
msgDataSize = epcEvent->size;
+ DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: OP_MSG_PARENT. msgDomain = %d\n", msgDomain );
+
if( msgDomain == MSG_DOMAIN_CONTROL_INDICATOR )
{
switch( msgId )
case MSG_ID_INDICATOR_START_ANIMATION:
{
+ DALI_LOG_INFO( gIndicatorLogFilter, Debug::General, "Indicator client received: MSG_ID_INDICATOR_START_ANIMATION\n" );
+
if (msgDataSize != (int)sizeof(IpcIndicatorDataAnimation))
{
DALI_LOG_ERROR("Message data is incorrect");
mBackgroundActor.SetShaderEffect(shaderEffect);
}
+void Indicator::ClearSharedFileInfo()
+{
+ for( int i = 0; i < SHARED_FILE_NUMBER; i++ )
+ {
+ delete mSharedFileInfo[i].mLock;
+ mSharedFileInfo[i].mLock = NULL;
+
+ delete mSharedFileInfo[i].mSharedFile;
+ mSharedFileInfo[i].mSharedFile = NULL;
+
+ mSharedFileInfo[i].mLockFileName.clear();
+ mSharedFileInfo[i].mSharedFileName.clear();
+ }
+}
+
/**
* duration can be this
*
/**
* Constructor. open lock file
*/
- LockFile(const char* filename);
+ LockFile(const std::string filename);
/**
* Close lock file
void Disconnect();
/**
- * Close existing lock file and open the new lock file.
+ * Handle Resize event
+ * @param[in] width The new width
+ * @param[in] height The new height
+ */
+ void Resize( int width, int height );
+
+ /**
+ * Set the lock file info.
* @param[in] epcEvent Current ecore event.
*/
- void NewLockFile(Ecore_Ipc_Event_Server_Data *epcEvent);
+ void SetLockFileInfo( Ecore_Ipc_Event_Server_Data *epcEvent );
/**
- * Handle Resize event
- * @param[in] width The new width
- * @param[in] height The new height
+ * Set the shared indicator image info
+ * @param[in] epcEvent The event containing the image data
*/
- void Resize(int width, int height);
+ void SetSharedImageInfo( Ecore_Ipc_Event_Server_Data *epcEvent );
/**
* Load the shared indicator image
* @param[in] epcEvent The event containing the image data
*/
- void LoadSharedImage(Ecore_Ipc_Event_Server_Data *epcEvent);
+ void LoadSharedImage( Ecore_Ipc_Event_Server_Data *epcEvent );
/**
* Load the pixmap indicator image
/**
* Inform dali that the indicator data has been updated.
+ * @param[in] bufferNumber The shared file number
*/
- void UpdateImageData();
+ void UpdateImageData( int bufferNumber );
/**
* Lock the temporary file, Copy the shared image into IndicatorBuffer
* and then unlock the temporary file.
* Caller should ensure we are not writing image to gl texture.
+ * @param[in] bufferNumber The shared file number
*/
- bool CopyToBuffer();
+ bool CopyToBuffer( int bufferNumber );
/**
* Update the background with the correct colors
/**
* Create a new image for the indicator, and set up signal handling for it.
+ * @param[in] bufferNumber The shared file number
*/
- void CreateNewImage();
+ void CreateNewImage( int bufferNumber );
/**
* Create a new pixmap image for the indicator, and set up signal handling for it.
* if it equal to 0, hide the indicator
* if it less than 0, show always
*/
- void ShowIndicator(float duration);
+ void ShowIndicator( float duration );
/**
* Showing timer callback
* Showing animation finished callback
* @param[in] animation
*/
- void OnAnimationFinished(Dali::Animation& animation);
+ void OnAnimationFinished( Dali::Animation& animation );
private: // Implementation of ServerConnection::Observer
/**
* @copydoc Dali::Internal::Adaptor::ServerConnection::Observer::DataReceived()
*/
- virtual void DataReceived(void* event);
+ virtual void DataReceived( void* event );
/**
* @copydoc Dali::Internal::Adaptor::ServerConnection::Observer::DataReceived()
virtual void ConnectionClosed();
private:
+
/**
* Construct the gradient mesh
*/
void ConstructBackgroundMesh();
+ /**
+ * Clear shared file info
+ */
+ void ClearSharedFileInfo();
+
private:
+ struct SharedFileInfo
+ {
+ SharedFileInfo()
+ : mLock( NULL ),
+ mSharedFile( NULL ),
+ mImageWidth( 0 ),
+ mImageHeight( 0 ),
+ mLockFileName(),
+ mSharedFileName(),
+ mSharedFileID( 0 ),
+ mSharedFileNumber( 0 )
+ {
+ }
+
+ LockFile* mLock; ///< File lock for the shared file
+ SharedFile* mSharedFile; ///< Shared file
+
+ int mImageWidth; ///< Shared image width
+ int mImageHeight; ///< Shared image height
+
+ std::string mLockFileName; ///< Lock file name
+ std::string mSharedFileName; ///< Shared file name
+ int mSharedFileID; ///< Shared file ID
+ int mSharedFileNumber; ///< Shared file number
+ };
+
+ static const int SHARED_FILE_NUMBER = 2; ///< Shared file number
+
IndicatorBufferPtr mIndicatorBuffer; ///< class which handles indicator rendering
PixmapId mPixmap; ///< Pixmap including indicator content
Dali::Image mImage; ///< Image created from mIndicatorBuffer
Adaptor* mAdaptor;
ServerConnection* mServerConnection;
- LockFile* mLock; ///< File lock for the shared file
- SharedFile* mSharedFile; ///< Shared file
Indicator::Observer* mObserver; ///< Upload observer
Dali::Window::WindowOrientation mOrientation;
Dali::Animation mIndicatorAnimation; ///< Animation to show/hide indicator image
bool mIsAnimationPlaying; ///< Whether the animation is playing
+
+ int mCurrentSharedFile; ///< Current shared file number
+ SharedFileInfo mSharedFileInfo[SHARED_FILE_NUMBER]; ///< Table to store shared file info
};
} // Adaptor
namespace
{
-// Copied from ecore_evas_extn.c
+// Copied from ecore_evas_extn_engine.h
// procotol version - change this as needed
-const int MAJOR( 0x1011 );
+const int MAJOR( 0x2011 );
}
return Internal::Adaptor::GetImplementation(*this).ResizeSignal();
}
+Application::AppControlSignalType & Application::AppControlSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).AppControlSignal();
+}
+
Application::AppSignalType& Application::LanguageChangedSignal()
{
return Internal::Adaptor::GetImplementation(*this).LanguageChangedSignal();
}
+Application::AppSignalType& Application::RegionChangedSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).RegionChangedSignal();
+}
+
+Application::AppSignalType& Application::BatteryLowSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).BatteryLowSignal();
+}
+
+Application::AppSignalType& Application::MemoryLowSignal()
+{
+ return Internal::Adaptor::GetImplementation(*this).MemoryLowSignal();
+}
+
Application::Application(Internal::Adaptor::Application* application)
: BaseHandle(application)
{
public:
typedef Signal< void (Application&) > AppSignalType;
+ typedef Signal< void (Application&, void *) > AppControlSignalType;
/**
* Decides whether a Dali application window is opaque or transparent.
AppSignalType& ResizeSignal();
/**
+ * This signal is emitted when another application sends a launch request to the application.
+ * When the application is launched, this signal is emitted after the main loop of the application starts up.
+ * The passed parameter describes the launch request and contains the information about why the application is launched.
+ */
+ AppControlSignalType& AppControlSignal();
+
+ /**
* This signal is emitted when the language is changed on the device.
*/
AppSignalType& LanguageChangedSignal();
+ /**
+ * This signal is emitted when the region of the device is changed.
+ */
+ AppSignalType& RegionChangedSignal();
+
+ /**
+ * This signal is emitted when the battery level of the device is low.
+ */
+ AppSignalType& BatteryLowSignal();
+
+ /**
+ * This signal is emitted when the memory level of the device is low.
+ */
+ AppSignalType& MemoryLowSignal();
+
+
public: // Not intended for application developers
/**
* Internal constructor
--- /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 <adaptor-impl.h>
+
+// EXTERNAL INCLUDES
+#ifdef OVER_TIZEN_SDK_2_2
+#include <app.h>
+#endif
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+void Adaptor::GetDataStoragePath( std::string& path)
+{
+ path = "";
+#ifdef OVER_TIZEN_SDK_2_2
+ path = app_get_data_path();
+#endif
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
adaptor_tizen_internal_src_files = \
$(adaptor_tizen_dir)/accessibility-manager-impl-tizen.cpp \
+ $(adaptor_tizen_dir)/adaptor-impl-tizen.cpp \
$(adaptor_tizen_dir)/framework-tizen.cpp \
$(adaptor_tizen_dir)/vsync-monitor-tizen.cpp \
$(adaptor_tizen_dir)/tilt-sensor-impl-tizen.cpp \
APP_PAUSE,
APP_RESUME,
APP_RESET,
+ APP_CONTROL,
APP_LANGUAGE_CHANGE,
+ APP_DEVICE_ROTATED,
+ APP_REGION_CHANGED,
+ APP_BATTERY_LOW,
+ APP_MEMORY_LOW
};
} // Unnamed namespace
mEventCallback.terminate = AppTerminate;
mEventCallback.pause = AppPause;
mEventCallback.resume = AppResume;
-#if defined(TIZEN_SDK_2_3)
- mEventCallback.app_control = AppControl;
-#else
+#ifndef OVER_TIZEN_SDK_2_2
mEventCallback.service = AppService;
-#endif
+
mEventCallback.low_memory = NULL;
mEventCallback.low_battery = NULL;
- mEventCallback.device_orientation = DeviceRotated;
- mEventCallback.language_changed = AppLanguageChange;
+ mEventCallback.device_orientation = AppDeviceRotated;
+ mEventCallback.language_changed = AppLanguageChanged;
mEventCallback.region_format_changed = NULL;
+#else
+ mEventCallback.app_control = AppControl;
+
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_BATTERY], APP_EVENT_LOW_BATTERY, AppBatteryLow, data);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LOW_MEMORY], APP_EVENT_LOW_MEMORY, AppMemoryLow, data);
+ ui_app_add_event_handler(&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED], APP_EVENT_DEVICE_ORIENTATION_CHANGED, AppDeviceRotated, data);
+ ui_app_add_event_handler(&handlers[APP_EVENT_LANGUAGE_CHANGED], APP_EVENT_LANGUAGE_CHANGED, AppLanguageChanged, data);
+ ui_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED], APP_EVENT_REGION_FORMAT_CHANGED, AppRegionChanged, data);
+
+#endif
+
mCallbackManager = CallbackManager::New();
}
// Data
CallbackBase* mAbortCallBack;
- app_event_callback_s mEventCallback;
CallbackManager *mCallbackManager;
- // Static methods
+
+#ifndef OVER_TIZEN_SDK_2_2
+ app_event_callback_s mEventCallback;
+#else
+ ui_app_lifecycle_callback_s mEventCallback;
+ app_event_handler_h handlers[5];
+#endif
/**
* Called by AppCore on application creation.
*/
static bool AppCreate(void *data)
{
- return static_cast<Framework*>(data)->SlpAppStatusHandler(APP_CREATE);
+ return static_cast<Framework*>(data)->AppStatusHandler(APP_CREATE, NULL);
}
/**
*/
static void AppTerminate(void *data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_TERMINATE);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_TERMINATE, NULL);
}
/**
*/
static void AppPause(void *data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_PAUSE);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_PAUSE, NULL);
}
/**
*/
static void AppResume(void *data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_RESUME);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_RESUME, NULL);
}
+ static void ProcessBundle(Framework* framework, bundle *bundleData)
+ {
+ if(bundleData == NULL)
+ {
+ return;
+ }
+
+ // get bundle name
+ char* bundleName = const_cast<char*>(bundle_get_val(bundleData, "name"));
+ if(bundleName != NULL)
+ {
+ framework->SetBundleName(bundleName);
+ }
+
+ // get bundle id
+ char* bundleId = const_cast<char*>(bundle_get_val(bundleData, "id"));
+ if(bundleId != NULL)
+ {
+ framework->SetBundleId(bundleId);
+ }
+ }
+
+#ifndef OVER_TIZEN_SDK_2_2
/**
* Called by AppCore when the application is launched from another module (e.g. homescreen).
* @param[in] b the bundle data which the launcher module sent
*/
-
-#if defined(TIZEN_SDK_2_3)
- static void AppControl(app_control_h app_control, void *data)
-#else
static void AppService(service_h service, void *data)
-#endif
{
Framework* framework = static_cast<Framework*>(data);
- if(framework)
+ if(framework == NULL)
{
- bundle *bundleData = NULL;
-#if defined(TIZEN_SDK_2_3)
- app_control_to_bundle(app_control, &bundleData);
-#else
- service_to_bundle(service, &bundleData);
-#endif
-
- if(bundleData)
- {
- // get bundle name
- char* bundleName = const_cast<char*>(bundle_get_val(bundleData, "name"));
- if(bundleName != NULL)
- {
- framework->SetBundleName(bundleName);
- }
-
- // get bundle id
- char* bundleId = const_cast<char*>(bundle_get_val(bundleData, "id"));
- if(bundleId != NULL)
- {
- framework->SetBundleId(bundleId);
- }
- }
- framework->SlpAppStatusHandler(APP_RESET);
+ return;
}
+ bundle *bundleData = NULL;
+
+ service_to_bundle(service, &bundleData);
+ ProcessBundle(framework, bundleData);
+
+ framework->AppStatusHandler(APP_RESET, NULL);
}
- /**
- * Called by AppCore when the language changes on the device.
- */
- static void AppLanguageChange(void* data)
+ static void AppLanguageChanged(void* user_data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_LANGUAGE_CHANGE);
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_LANGUAGE_CHANGE, NULL);
}
- static void DeviceRotated(app_device_orientation_e orientation, void *user_data)
+ static void AppDeviceRotated(app_device_orientation_e orientation, void *user_data)
{
- switch(orientation)
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_DEVICE_ROTATED, NULL);
+ }
+
+#else
+
+ /**
+ * Called by AppCore when the application is launched from another module (e.g. homescreen).
+ * @param[in] b the bundle data which the launcher module sent
+ */
+ static void AppControl(app_control_h app_control, void *data)
+ {
+ Framework* framework = static_cast<Framework*>(data);
+ if(framework == NULL)
{
- case APP_DEVICE_ORIENTATION_0:
- break;
- case APP_DEVICE_ORIENTATION_90:
- break;
- case APP_DEVICE_ORIENTATION_180:
- break;
- case APP_DEVICE_ORIENTATION_270:
- break;
+ return;
}
+ bundle *bundleData = NULL;
+
+ app_control_to_bundle(app_control, &bundleData);
+ ProcessBundle(framework, bundleData);
+
+ framework->AppStatusHandler(APP_RESET, NULL);
+ framework->AppStatusHandler(APP_CONTROL, app_control);
+ }
+
+ static void AppLanguageChanged(app_event_info_h event_info, void *user_data)
+ {
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_LANGUAGE_CHANGE, NULL);
+ }
+
+ static void AppDeviceRotated(app_event_info_h event_info, void *user_data)
+ {
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_DEVICE_ROTATED, NULL);
+ }
+
+ static void AppRegionChanged(app_event_info_h event_info, void *user_data)
+ {
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_REGION_CHANGED, NULL);
+ }
+
+ static void AppBatteryLow(app_event_info_h event_info, void *user_data)
+ {
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_BATTERY_LOW, NULL);
}
+ static void AppMemoryLow(app_event_info_h event_info, void *user_data)
+ {
+ static_cast<Framework*>(user_data)->AppStatusHandler(APP_MEMORY_LOW, NULL);
+ }
+
+#endif
+
};
Framework::Framework(Framework::Observer& observer, int *argc, char ***argv, const std::string& name)
{
mRunning = true;
+#ifndef OVER_TIZEN_SDK_2_2
app_efl_main(mArgc, mArgv, &mImpl->mEventCallback, this);
+#else
+ int ret = ui_app_main(*mArgc, *mArgv, &mImpl->mEventCallback, this);
+ if (ret != APP_ERROR_NONE)
+ {
+ DALI_LOG_ERROR("Framework::Run(), ui_app_main() is failed. err = %d", ret);
+ }
+#endif
+
mRunning = false;
}
}
}
-bool Framework::SlpAppStatusHandler(int type)
+bool Framework::AppStatusHandler(int type, void *bundleData)
{
switch (type)
{
}
case APP_RESET:
+ {
mObserver.OnReset();
break;
+ }
case APP_RESUME:
+ {
mObserver.OnResume();
break;
+ }
case APP_TERMINATE:
- mObserver.OnTerminate();
+ {
+ mObserver.OnTerminate();
break;
+ }
case APP_PAUSE:
+ {
mObserver.OnPause();
break;
+ }
+
+ case APP_CONTROL:
+ {
+ mObserver.OnAppControl(bundleData);
+ break;
+ }
case APP_LANGUAGE_CHANGE:
+ {
mObserver.OnLanguageChanged();
break;
+ }
+
+ case APP_REGION_CHANGED:
+ {
+ mObserver.OnRegionChanged();
+ break;
+ }
+
+ case APP_BATTERY_LOW:
+ {
+ mObserver.OnBatteryLow();
+ break;
+ }
+
+ case APP_MEMORY_LOW:
+ {
+ mObserver.OnMemoryLow();
+ break;
+ }
default:
break;
--- /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 <adaptor-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+void Adaptor::GetDataStoragePath( std::string& path)
+{
+ path = DALI_SHADERBIN_DIR;
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
adaptor_ubuntu_internal_src_files = \
$(adaptor_ubuntu_dir)/accessibility-manager-impl-ubuntu.cpp \
+ $(adaptor_ubuntu_dir)/adaptor-impl-ubuntu.cpp \
$(adaptor_ubuntu_dir)/framework-ubuntu.cpp \
$(adaptor_ubuntu_dir)/vsync-monitor-ubuntu.cpp \
$(adaptor_ubuntu_dir)/tilt-sensor-impl-ubuntu.cpp \
*/
static bool AppCreate(void *data)
{
- return static_cast<Framework*>(data)->SlpAppStatusHandler(APP_CREATE);
+ return static_cast<Framework*>(data)->AppStatusHandler(APP_CREATE, NULL);
}
/**
*/
static void AppTerminate(void *data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_TERMINATE);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_TERMINATE, NULL);
}
/**
*/
static void AppPause(void *data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_PAUSE);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_PAUSE, NULL);
}
/**
*/
static void AppResume(void *data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_RESUME);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_RESUME, NULL);
}
/**
*/
static void AppLanguageChange(void* data)
{
- static_cast<Framework*>(data)->SlpAppStatusHandler(APP_LANGUAGE_CHANGE);
+ static_cast<Framework*>(data)->AppStatusHandler(APP_LANGUAGE_CHANGE, NULL);
}
};
}
}
-bool Framework::SlpAppStatusHandler(int type)
+bool Framework::AppStatusHandler(int type, void *bundleData)
{
switch (type)
{
}
/**
+ * @copydoc PlatformAbstraction::LoadShaderBinFile()
+ */
+bool TestPlatformAbstraction::LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
+{
+ mTrace.PushCall("LoadShaderBinFile", "");
+ if( mLoadFileResult.loadResult )
+ {
+ buffer = mLoadFileResult.buffer;
+ }
+
+ return mLoadFileResult.loadResult;
+}
+
+/**
* @copydoc PlatformAbstraction::SaveFile()
*/
bool TestPlatformAbstraction::SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const
case LoadResourceFunc: return mTrace.FindMethod("LoadResource");
case SaveResourceFunc: return mTrace.FindMethod("SaveResource");
case LoadFileFunc: return mTrace.FindMethod("LoadFile");
+ case LoadShaderBinFileFunc: return mTrace.FindMethod("LoadShaderBinFile");
case SaveFileFunc: return mTrace.FindMethod("SaveFile");
case CancelLoadFunc: return mTrace.FindMethod("CancelLoad");
case GetResourcesFunc: return mTrace.FindMethod("GetResources");
virtual bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
/**
+ * @copydoc PlatformAbstraction::LoadShaderBinFile()
+ */
+ virtual bool LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer
+) const;
+
+ /**
* @copydoc PlatformAbstraction::SaveFile()
*/
virtual bool SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const;
SaveResourceFunc,
SaveFileFunc,
LoadFileFunc,
+ LoadShaderBinFileFunc,
CancelLoadFunc,
GetResourcesFunc,
IsLoadingFunc,
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) \
$(static_libraries_libunibreak_src_files)
-endif
+if WAYLAND
+adaptor_internal_src_files += $(adaptor_wayland_tizen_internal_src_files)
+else
+adaptor_internal_src_files += $(adaptor_x11_tizen_internal_src_files)
+endif # WAYLAND
+endif # MOBILE_PROFILE
# LITE
if LITE_PROFILE
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) \
$(static_libraries_libunibreak_src_files)
-endif
+if WAYLAND
+adaptor_internal_src_files += $(adaptor_wayland_tizen_internal_src_files)
+else
+adaptor_internal_src_files += $(adaptor_x11_tizen_internal_src_files)
+endif # WAYLAND
+
+endif # WEARABLE
# TV
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) \
$(static_libraries_libunibreak_src_files)
+if WAYLAND
+adaptor_internal_src_files += $(adaptor_wayland_tizen_internal_src_files)
+else
+adaptor_internal_src_files += $(adaptor_x11_tv_internal_src_files)
+endif # WAYLAND
+
endif
# Feedback Plugin
-I../../../platform-abstractions/slp/resource-loader \
-I../../../platform-abstractions/portable \
-I../../../platform-abstractions/ \
- -I../../../adaptors/ \
-I../../../adaptors/public-api \
-I../../../adaptors/public-api/adaptor-framework \
-I../../../adaptors/common \
+ -I../../../adaptors/ \
-I../../../text \
-I../../../text/dali/internal/libunibreak
daliDefaultFontCacheDir = ${dataReadOnlyDir}/glyphcache/
daliUserFontCacheDir = ${dataReadWriteDir}/glyphcache/
daliDefaultThemeDir = ${dataReadWriteDir}/theme/
-daliUserShaderCacheDir = ${dataReadWriteDir}/core/shaderbin/
+daliShaderbinCacheDir = ${dataReadOnlyDir}/core/shaderbin/
libdali_adaptor_la_CXXFLAGS = \
-DDALI_DATA_RW_DIR="\"${daliReadWriteDir}\"" \
-DDALI_DATA_RO_DIR="\"${daliReadOnlyDir}\"" \
-DDALI_DEFAULT_FONT_CACHE_DIR="\"${daliDefaultFontCacheDir}\"" \
-DDALI_USER_FONT_CACHE_DIR="\"${daliUserFontCacheDir}\"" \
+ -DDALI_SHADERBIN_DIR="\"${daliShaderbinCacheDir}\"" \
-DDALI_DEFAULT_THEME_DIR="\"${daliDefaultThemeDir}\"" \
-DFONT_PRELOADED_PATH="\"${fontPreloadedPath}\"" \
-DFONT_DOWNLOADED_PATH="\"${fontDownloadedPath}\"" \
tizenadaptordaliheader_HEADERS = $(adaptor_dali_header_file)
install-data-local:
- $(MKDIR_P) ${DESTDIR}/${daliUserFontCacheDir} ${DESTDIR}/${daliUserShaderCacheDir}
+ $(MKDIR_P) ${DESTDIR}/${daliUserFontCacheDir} ${DESTDIR}/${daliShaderbinCacheDir}
# Install resource log analyzer script
bin_SCRIPTS = ../../../adaptors/scripts/dalireslog.sh
[enable_debug=$enableval],
[enable_debug=no])
+AC_ARG_ENABLE(shaderbincache,
+ [AC_HELP_STRING([--enable-shaderbincache],
+ [enables shader binary cache])],
+ [enable_shaderbincache=$enableval],
+ [enable_shaderbincache=DISABLE])
+
if test "x$enable_debug" = "xyes"; then
DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -DDEBUG_ENABLED"
fi
DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -fvisibility=hidden -DHIDE_DALI_INTERNALS"
fi
+if test "x$enable_shaderbincache" = "xENABLE"; then
+ DALI_ADAPTOR_CFLAGS="$DALI_ADAPTOR_CFLAGS -DSHADERBIN_CACHE_ENABLED"
+fi
+
AC_ARG_ENABLE([assimp],
[AC_HELP_STRING([--enable-assimp],
[Enable assimp plugin, overriding platform defaults])],
%define dali_feedback_plugin 1
%define dali_bullet_plugin 1
%define dali_assimp_plugin 1
+%define over_tizen_2_2 1
+
+%if 0%{?over_tizen_2_2}
+%define shaderbincache_flag ENABLE
+%endif
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
%define dali_data_rw_dir /opt/usr/share/dali/
%define dali_data_ro_dir /usr/share/dali/
%define user_font_cache_dir %{dali_data_rw_dir}/glyphcache/
-%define user_shader_cache_dir %{dali_data_rw_dir}/core/shaderbin/
+%define user_shader_cache_dir %{dali_data_ro_dir}/core/shaderbin/
%define font_preloaded_path /usr/share/fonts/
%define font_downloaded_path /opt/share/fonts/
%define font_application_path /usr/share/app_fonts/
CXXFLAGS+=" -D_ARCH_ARM_ -lgcc"
%endif
-%if 0%{?TIZEN_SDK_2_3}
-CXXFLAGS+=" -DTIZEN_SDK_2_3"
+%if 0%{?over_tizen_2_2}
+CFLAGS+=" -DOVER_TIZEN_SDK_2_2"
+CXXFLAGS+=" -DOVER_TIZEN_SDK_2_2"
%endif
libtoolize --force
FONT_APPLICATION_PATH="%{font_application_path}" ; export FONT_APPLICATION_PATH
FONT_CONFIGURATION_FILE="%{font_configuration_file}" ; export FONT_CONFIGURATION_FILE
-%configure --with-jpeg-turbo --enable-gles=20 --enable-profile=%{dali_profile} \
+%configure --with-jpeg-turbo --enable-gles=20 --enable-shaderbincache=%{shaderbincache_flag} --enable-profile=%{dali_profile} \
%if 0%{?dali_feedback_plugin}
--enable-feedback \
%endif
%pre
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%post
/sbin/ldconfig
chown 5000:5000 %{user_font_cache_dir}
-chown 5000:5000 %{user_shader_cache_dir}
exit 0
%if 0%{?dali_feedback_plugin}
##############################
%preun
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%define dali_data_rw_dir /usr/share/dali/
%define dali_data_ro_dir /usr/share/dali/
%define user_font_cache_dir %{dali_data_rw_dir}/glyphcache/
-%define user_shader_cache_dir %{dali_data_rw_dir}/core/shaderbin/
+%define user_shader_cache_dir %{dali_data_ro_dir}/core/shaderbin/
%define font_preloaded_path /usr/share/fonts/
%define font_downloaded_path /opt/share/fonts/
%define font_application_path /usr/share/app_fonts/
%pre
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%post
/sbin/ldconfig
chown 5000:5000 %{user_font_cache_dir}
-chown 5000:5000 %{user_shader_cache_dir}
exit 0
%if 0%{?dali_feedback_plugin}
##############################
%preun
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%define dali_data_rw_dir /opt/usr/share/dali/
%define dali_data_ro_dir /usr/share/dali/
%define user_font_cache_dir %{dali_data_rw_dir}/glyphcache/
-%define user_shader_cache_dir %{dali_data_rw_dir}/core/shaderbin/
+%define user_shader_cache_dir %{dali_data_ro_dir}/core/shaderbin/
%define font_preloaded_path /usr/share/fonts/
%define font_downloaded_path /opt/share/fonts/
%define font_application_path /usr/share/app_fonts/
%pre
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%post
/sbin/ldconfig
chown 5000:5000 %{user_font_cache_dir}
-chown 5000:5000 %{user_shader_cache_dir}
exit 0
%if 0%{?dali_feedback_plugin}
##############################
%preun
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%define dali_feedback_plugin 0
%define dali_bullet_plugin 0
%define dali_assimp_plugin 0
+%define over_tizen_2_2 0
+%define shaderbincache_flag DISABLE
%endif
%if "%{profile}" == "tv"
%define dali_feedback_plugin 0
%define dali_bullet_plugin 0
%define dali_assimp_plugin 0
+%define over_tizen_2_2 1
+%define shaderbincache_flag ENABLE
%endif
%if "%{profile}" == "wearable"
%define dali_feedback_plugin 0
%define dali_bullet_plugin 0
%define dali_assimp_plugin 0
+%define over_tizen_2_2 0
+%define shaderbincache_flag DISABLE
%endif
%if "%{profile}" == "common"
%define dali_feedback_plugin 0
%define dali_bullet_plugin 0
%define dali_assimp_plugin 0
+%define over_tizen_2_2 0
+%define shaderbincache_flag DISABLE
%endif
Requires(post): /sbin/ldconfig
%define dali_data_rw_dir /usr/share/dali/
%define dali_data_ro_dir /usr/share/dali/
%define user_font_cache_dir %{dali_data_rw_dir}/glyphcache/
-%define user_shader_cache_dir %{dali_data_rw_dir}/core/shaderbin/
+%define user_shader_cache_dir %{dali_data_ro_dir}/core/shaderbin/
%define font_preloaded_path /usr/share/fonts/
%define font_downloaded_path /opt/share/fonts/
%define font_application_path /usr/share/app_fonts/
configure_flags="--enable-wayland"
%endif
+%if 0%{?over_tizen_2_2}
+CFLAGS+=" -DOVER_TIZEN_SDK_2_2"
+CXXFLAGS+=" -DOVER_TIZEN_SDK_2_2"
+%endif
+
libtoolize --force
cd %{_builddir}/%{name}-%{version}/build/tizen && autoreconf --install
cd %{_builddir}/%{name}-%{version}/build/tizen && CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}" FONT_PRELOADED_PATH="%{font_preloaded_path}" FONT_DOWNLOADED_PATH="%{font_downloaded_path}" FONT_APPLICATION_PATH="%{font_application_path}" FONT_CONFIGURATION_FILE="%{font_configuration_file}"
-%configure --prefix=$PREFIX --with-jpeg-turbo --enable-gles=20 --enable-profile=%{dali_profile} \
+%configure --prefix=$PREFIX --with-jpeg-turbo --enable-gles=20 --enable-shaderbincache=%{shaderbincache_flag} --enable-profile=%{dali_profile} \
%if 0%{?dali_feedback_plugin}
--enable-feedback \
%endif
%pre
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
%post
/sbin/ldconfig
chown 5000:5000 %{user_font_cache_dir}
-chown 5000:5000 %{user_shader_cache_dir}
exit 0
%if 0%{?dali_feedback_plugin}
##############################
%preun
rm -f %{user_font_cache_dir}/*
-rm -f %{user_shader_cache_dir}/*
exit 0
##############################
SlpPlatformAbstraction::SlpPlatformAbstraction()
: mResourceLoader(new ResourceLoader),
- mDynamicsFactory(NULL)
+ mDynamicsFactory(NULL),
+ mDataStoragePath( "" )
{
}
{
if (mResourceLoader)
{
- mResourceLoader->SaveResource(request);
+ if( request.GetType()->id == Integration::ResourceShader )
+ {
+#ifdef SHADERBIN_CACHE_ENABLED
+ std::string path = mDataStoragePath;
+ path += request.GetPath();
+
+ Integration::ResourceRequest newRequest( request.GetId(), *request.GetType(), path, request.GetResource() );
+ mResourceLoader->SaveResource(newRequest);
+#endif
+ }
+ else
+ {
+ mResourceLoader->SaveResource(request);
+ }
}
}
return mDynamicsFactory;
}
+bool SlpPlatformAbstraction::LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
+{
+ bool result = false;
+
+#ifdef SHADERBIN_CACHE_ENABLED
+ std::string path;
+
+ if( mResourceLoader )
+ {
+ path = DALI_SHADERBIN_DIR;
+ path += filename;
+ result = mResourceLoader->LoadFile( path, buffer );
+ }
+
+ if( mResourceLoader && result == false )
+ {
+ path = mDataStoragePath;
+ path += filename;
+ result = mResourceLoader->LoadFile( path, buffer );
+ }
+#endif
+
+ return result;
+}
+
+void SlpPlatformAbstraction::SetDataStoragePath( const std::string& path )
+{
+ mDataStoragePath = path;
+}
+
} // namespace SlpPlatform
} // namespace Dali
*/
virtual Integration::DynamicsFactory* GetDynamicsFactory();
+ /**
+ * @copydoc PlatformAbstraction::LoadShaderBinFile()
+ */
+ virtual bool LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
+
+ /**
+ * Sets path for data/resource storage.
+ * @param[in] path data/resource storage path
+ */
+ void SetDataStoragePath( const std::string& path );
+
private:
ResourceLoader* mResourceLoader;
DynamicsFactory* mDynamicsFactory;
+ std::string mDataStoragePath;
};
} // namespace SlpPlatform