# HG changeset patch # User hgs # Date 1286366888 -10800 # Node ID 79f826a55db2810807edb9fe97aac72dc23b7f48 # Parent fe894bb075c2a7a8488f8142e521ee0848fced2a 201039 diff -r fe894bb075c2 -r 79f826a55db2 clfwrapper/group/contentlistingframework.mmp --- a/clfwrapper/group/contentlistingframework.mmp Mon Sep 27 15:53:05 2010 +0300 +++ b/clfwrapper/group/contentlistingframework.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -18,7 +18,7 @@ #include #include -#include <../commoninc/clfuid.hrh> +#include <../CommonInc/CLFUID.hrh> VERSION 10.0 TARGET ContentListingFramework.dll diff -r fe894bb075c2 -r 79f826a55db2 clfwrapper/group/mediacollectionmanager.mmp --- a/clfwrapper/group/mediacollectionmanager.mmp Mon Sep 27 15:53:05 2010 +0300 +++ b/clfwrapper/group/mediacollectionmanager.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -18,7 +18,7 @@ #include #include -#include <../commoninc/clfuid.hrh> +#include <../CommonInc/CLFUID.hrh> VERSION 10.0 TARGET MediaCollectionManager.dll diff -r fe894bb075c2 -r 79f826a55db2 harvester/blacklistclient/bwincw/blacklistclientwinscw.def --- a/harvester/blacklistclient/bwincw/blacklistclientwinscw.def Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/blacklistclient/bwincw/blacklistclientwinscw.def Wed Oct 06 15:08:08 2010 +0300 @@ -7,4 +7,5 @@ ?IsBlacklistedL@RBlacklistClient@@QAEHABVTDesC16@@KVTTime@@@Z @ 6 NONAME ; int RBlacklistClient::IsBlacklistedL(class TDesC16 const &, unsigned long, class TTime) ?LoadBlacklistL@RBlacklistClient@@QAEXXZ @ 7 NONAME ; void RBlacklistClient::LoadBlacklistL(void) ?RemoveL@RBlacklistClient@@QBEXABVTDesC16@@K@Z @ 8 NONAME ; void RBlacklistClient::RemoveL(class TDesC16 const &, unsigned long) const + ?Close@RBlacklistClient@@QAEXXZ @ 9 NONAME ; void RBlacklistClient::Close(void) diff -r fe894bb075c2 -r 79f826a55db2 harvester/blacklistclient/eabi/blacklistclientarm.def --- a/harvester/blacklistclient/eabi/blacklistclientarm.def Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/blacklistclient/eabi/blacklistclientarm.def Wed Oct 06 15:08:08 2010 +0300 @@ -11,4 +11,5 @@ _ZNK16RBlacklistClient7RemoveLERK7TDesC16m @ 10 NONAME _ZTI14CBlacklistItem @ 11 NONAME ABSENT; ## _ZTV14CBlacklistItem @ 12 NONAME ABSENT; ## + _ZN16RBlacklistClient5CloseEv @ 13 NONAME diff -r fe894bb075c2 -r 79f826a55db2 harvester/blacklistclient/inc/blacklistclient.h --- a/harvester/blacklistclient/inc/blacklistclient.h Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/blacklistclient/inc/blacklistclient.h Wed Oct 06 15:08:08 2010 +0300 @@ -65,7 +65,7 @@ /*! @function AddL - @discussion Add object to blacklist. + @discussion Prepare adding object to blacklist. @param aUri - object uri. @param aMediaId - drive id where object is located (E,C ...). @param aLastModifiedTime - time when object is modified. @@ -89,6 +89,8 @@ @discussion Closes server database. */ IMPORT_C void CloseDBL(); + + IMPORT_C void Close(); private: // private functions diff -r fe894bb075c2 -r 79f826a55db2 harvester/blacklistclient/src/blacklistclient.cpp --- a/harvester/blacklistclient/src/blacklistclient.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/blacklistclient/src/blacklistclient.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -387,7 +387,7 @@ WRITELOG( "RBlacklistClient::GetListIndex - begin" ); OstTrace0( TRACE_NORMAL, RBLACKLISTCLIENT_GETLISTINDEX, "RBlacklistClient::GetListIndex - begin" ); - for ( TInt i( 0 ); i < iBlacklistMemoryTable.Count(); ++i ) + for( TInt i = iBlacklistMemoryTable.Count() - 1; i >=0; i-- ) { if ( iBlacklistMemoryTable[i]->Compare( aUri, aMediaId ) ) { @@ -424,7 +424,6 @@ WRITELOG( "RBlacklistClient::AddL - end" ); OstTrace0( TRACE_NORMAL, DUP1_RBLACKLISTCLIENT_ADDL, "RBlacklistClient::AddL - end" ); - } @@ -448,7 +447,6 @@ WRITELOG( "RBlacklistClient::RemoveL - end" ); OstTrace0( TRACE_NORMAL, DUP1_RBLACKLISTCLIENT_REMOVEL, "RBlacklistClient::RemoveL - end" ); - } // --------------------------------------------------------------------------- @@ -474,5 +472,18 @@ } +// ---------------------------------------------------------------------------------------- +// Close +// ---------------------------------------------------------------------------------------- +// +EXPORT_C void RBlacklistClient::Close() + { + WRITELOG( "RBlacklistClient::Close" ); + + iFs.Close(); + iBlacklistChunk.Close(); + + RSessionBase::Close(); + } // End of File diff -r fe894bb075c2 -r 79f826a55db2 harvester/blacklistserver/src/blacklistserver.cpp --- a/harvester/blacklistserver/src/blacklistserver.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/blacklistserver/src/blacklistserver.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -539,7 +539,7 @@ WRITELOG( "CBlacklistServer::GetMemoryTableIndex - begin" ); OstTrace0( TRACE_NORMAL, CBLACKLISTSERVER_GETMEMORYTABLEINDEX, "CBlacklistServer::GetMemoryTableIndex - begin" ); - for ( TInt i( 0 ); i < iBlacklistMemoryTable.Count(); ++i ) + for( TInt i = iBlacklistMemoryTable.Count() - 1; i >=0; i-- ) { if ( iBlacklistMemoryTable[i]->Compare( aUri, aMediaId ) ) { @@ -805,7 +805,7 @@ WRITELOG( "CBlacklistServer::WriteAllDataToDBL - begin" ); OstTrace0( TRACE_NORMAL, CBLACKLISTSERVER_WRITEALLDATATODBL, "CBlacklistServer::WriteAllDataToDBL - begin" ); - for ( TInt i( 0 ); i < iBlacklistMemoryTable.Count(); ++i ) + for( TInt i = iBlacklistMemoryTable.Count() - 1; i >=0; i-- ) { AddToDBL( *iBlacklistMemoryTable[i]->Uri(), iBlacklistMemoryTable[i]->MediaId(), iBlacklistMemoryTable[i]->Modified() ); } @@ -836,7 +836,11 @@ const TInt addedCount( iBufferedAddedItems.Count() ); for ( TInt i( 0 ); i < addedCount; ++i ) { - iSqLiteConnection->ExecuteL( KMdsBlacklistUpdate, *iBufferedAddedItems[i] ); + TRAPD( err, iSqLiteConnection->ExecuteL( KMdsBlacklistInsert, *iBufferedAddedItems[i] ) ); + if ( err == KSqlErrConstraint ) // is the file already blacklisted... + { + iSqLiteConnection->ExecuteL( KMdsBlacklistUpdate, *iBufferedAddedItems[i] ); + } iBufferedAddedItems[i]->Column( 0 ).Free(); } diff -r fe894bb075c2 -r 79f826a55db2 harvester/common/bwincw/harvestercommonwinscw.def --- a/harvester/common/bwincw/harvestercommonwinscw.def Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/common/bwincw/harvestercommonwinscw.def Wed Oct 06 15:08:08 2010 +0300 @@ -67,4 +67,5 @@ ?SendHarvestingStatusEventL@CHarvesterPluginFactory@@QAEXH@Z @ 66 NONAME ; void CHarvesterPluginFactory::SendHarvestingStatusEventL(int) ?PauseHarvester@CHarvesterPluginFactory@@QAEXH@Z @ 67 NONAME ; void CHarvesterPluginFactory::PauseHarvester(int) ?GetObjectDefL@CHarvesterPluginFactory@@QAEXPAVCHarvesterData@@AAVTDes16@@@Z @ 68 NONAME ; void CHarvesterPluginFactory::GetObjectDefL(class CHarvesterData *, class TDes16 &) + ?GetAlwaysScanOnBootPathsL@CHarvesterCenRepUtil@@SAXAAV?$RPointerArray@UTScanItem@@@@@Z @ 69 NONAME ; void CHarvesterCenRepUtil::GetAlwaysScanOnBootPathsL(class RPointerArray &) diff -r fe894bb075c2 -r 79f826a55db2 harvester/common/data/200009FE.txt Binary file harvester/common/data/200009FE.txt has changed diff -r fe894bb075c2 -r 79f826a55db2 harvester/common/eabi/harvestercommonarm.def --- a/harvester/common/eabi/harvestercommonarm.def Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/common/eabi/harvestercommonarm.def Wed Oct 06 15:08:08 2010 +0300 @@ -87,4 +87,5 @@ _ZN18CHarvesterExifUtilD2Ev @ 86 NONAME _ZN23CHarvesterPluginFactory14PauseHarvesterEi @ 87 NONAME _ZN23CHarvesterPluginFactory13GetObjectDefLEP14CHarvesterDataR6TDes16 @ 88 NONAME + _ZN20CHarvesterCenRepUtil25GetAlwaysScanOnBootPathsLER13RPointerArrayI9TScanItemE @ 89 NONAME diff -r fe894bb075c2 -r 79f826a55db2 harvester/common/group/bld.inf --- a/harvester/common/group/bld.inf Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/common/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -21,7 +21,7 @@ PRJ_EXPORTS ../data/200009FE.txt /epoc32/data/z/private/10202BE9/200009FE.txt -../data/200009FE.txt /epoc32/WINSCW/C/private/10202BE9/200009FE.txt +../data/200009FE.txt /epoc32/winscw/c/private/10202BE9/200009FE.txt PRJ_MMPFILES harvesterdata.mmp diff -r fe894bb075c2 -r 79f826a55db2 harvester/common/inc/harvestercenreputil.h --- a/harvester/common/inc/harvestercenreputil.h Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/common/inc/harvestercenreputil.h Wed Oct 06 15:08:08 2010 +0300 @@ -97,6 +97,13 @@ * @param aEnabled is rom scan enabled */ IMPORT_C static void IsThumbnailDaemonEnabledL( TBool& aEnabled ); + + /** + * Check paths for preinstalled content + * + * @param aEnabled is rom scan enabled + */ + IMPORT_C static void GetAlwaysScanOnBootPathsL( RPointerArray& aPaths ); private: CHarvesterCenRepUtil(); diff -r fe894bb075c2 -r 79f826a55db2 harvester/common/src/harvestercenreputil.cpp --- a/harvester/common/src/harvestercenreputil.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/common/src/harvestercenreputil.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -27,6 +27,7 @@ const TUint32 KBootIgnorePartialKey = 0x00030000; const TUint32 KPartialRestorePartialKey = 0x00040000; const TUint32 KPartialRestoreIgnorePartialKey = 0x00050000; +const TUint32 KAlwaysScanPartialKey = 0x00060000; const TUint32 KRomScanEnabledKey = 0x00090000; @@ -179,6 +180,12 @@ CleanupStack::PopAndDestroy( rep ); } +EXPORT_C void CHarvesterCenRepUtil::GetAlwaysScanOnBootPathsL( + RPointerArray& aPaths ) + { + GetItemsL( KAlwaysScanPartialKey, aPaths ); + } + void CHarvesterCenRepUtil::GetPathsL( TUint32 aPartialKey, RPointerArray& aPaths ) { CRepository* repo = CRepository::NewLC( KHarvesterRepoUid ); @@ -227,10 +234,6 @@ } TUint32 preinstalled = MdeConstants::MediaObject::ENotPreinstalled; - if( path[ path.Length() - 1 ] != TChar('\\') ) - { - User::LeaveIfError( repo->GetMeta( scanPathKeys[i], preinstalled ) ); - } TScanItem* item = new (ELeave) TScanItem(); CleanupStack::PushL( item ); item->iPath = path.AllocL(); diff -r fe894bb075c2 -r 79f826a55db2 harvester/conf/harvester.confml Binary file harvester/conf/harvester.confml has changed diff -r fe894bb075c2 -r 79f826a55db2 harvester/conf/harvester_200009FE.crml Binary file harvester/conf/harvester_200009FE.crml has changed diff -r fe894bb075c2 -r 79f826a55db2 harvester/harvesterplugins/AudioPlugin/data/2001116A.rss --- a/harvester/harvesterplugins/AudioPlugin/data/2001116A.rss Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/harvesterplugins/AudioPlugin/data/2001116A.rss Wed Oct 06 15:08:08 2010 +0300 @@ -42,7 +42,7 @@ version_no = 1; display_name = "Harvester audio plugin"; default_data = "Audio"; - opaque_data = "mp3 aac amr awb mid midi mxmf rng spmid wav au wma nrt mka"; + opaque_data = "mp3 aac amr awb mid midi mxmf rng spmid wav au wma nrt mka m4a"; rom_only = 0; } }; diff -r fe894bb075c2 -r 79f826a55db2 harvester/harvesterplugins/AudioPlugin/group/harvesteraudioplugin.mmp --- a/harvester/harvesterplugins/AudioPlugin/group/harvesteraudioplugin.mmp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/harvesterplugins/AudioPlugin/group/harvesteraudioplugin.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -58,8 +58,6 @@ LIBRARY metadatautility.lib LIBRARY thumbnailmanager.lib LIBRARY centralrepository.lib -LIBRARY caf.lib -LIBRARY cafutils.lib LIBRARY platformenv.lib PAGED diff -r fe894bb075c2 -r 79f826a55db2 harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h --- a/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h Wed Oct 06 15:08:08 2010 +0300 @@ -56,12 +56,16 @@ CMdEPropertyDef* iDatePropertyDef; CMdEPropertyDef* iDrmPropertyDef; CMdEPropertyDef* iDefaultFolderPropertyDef; + CMdEPropertyDef* iTrackPropertyDef; + CMdEPropertyDef* iBitratePropertyDef; // Audio property definitions CMdEPropertyDef* iAlbumPropertyDef; CMdEPropertyDef* iComposerPropertyDef; CMdEPropertyDef* iOriginalArtistPropertyDef; - CMdEPropertyDef* iTrackPropertyDef; + CMdEPropertyDef* iSampleRatePropertyDef; + CMdEPropertyDef* iAlbumArtistPropertyDef; + private: CHarvesterAudioPluginPropertyDefs(); diff -r fe894bb075c2 -r 79f826a55db2 harvester/harvesterplugins/AudioPlugin/inc/harvesteraudiopluginutils.h --- a/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudiopluginutils.h Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudiopluginutils.h Wed Oct 06 15:08:08 2010 +0300 @@ -53,7 +53,11 @@ EAudioMDFieldDuration, EAudioMDFieldCopyright, EAudioMDFieldDate, - EAudioMDFieldJpeg + EAudioMDFieldJpeg, + EAudioMDFieldProtected, + EAudioMDFieldSampleRate, + EAudioMDFieldBitRate, + EAudioMDFieldAlbumArtist }; public: diff -r fe894bb075c2 -r 79f826a55db2 harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp --- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -22,7 +22,6 @@ #include #include #include -#include #include #include "harvestercommon.h" @@ -36,6 +35,7 @@ const TInt KMimeLength( 10 ); const TUid KHarvesterRepoUid = { 0x200009FE }; const TUint32 KEnableAlbumArtHarvest = 0x00090001; +const TInt KKiloBytes = 1024; CHarvesterAudioPluginPropertyDefs::CHarvesterAudioPluginPropertyDefs() : CBase(), iCreationDatePropertyDef( NULL ) @@ -79,12 +79,15 @@ iThumbnailPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KThumbnailPresentProperty ); iDatePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KReleaseDateProperty ); iDrmPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KDRMProperty ); + iBitratePropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::MediaObject::KBitrateProperty ); // Audio property definitions CMdEObjectDef& audioDef = nsDef.GetObjectDefL( MdeConstants::Audio::KAudioObject ); iAlbumPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KAlbumProperty ); iComposerPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KComposerProperty ); iOriginalArtistPropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KOriginalArtistProperty ); + iSampleRatePropertyDef = &audioDef.GetPropertyDefL( MdeConstants::Audio::KSamplingFrequencyProperty ); + iAlbumArtistPropertyDef = &mediaDef.GetPropertyDefL( MdeConstants::Audio::KAlbumArtistProperty ); } using namespace MdeConstants; @@ -342,7 +345,7 @@ // --------------------------------------------------------------------------- // void CHarvesterAudioPlugin::GetMusicPropertiesL( CHarvesterData* aHD, - TBool aIsAdd, TPtrC aMimeType ) + TBool aIsAdd, TPtrC /*aMimeType*/ ) { #ifdef _DEBUG TTime dStart, dStop; @@ -353,32 +356,6 @@ CMdEObject& mdeObject = aHD->MdeObject(); const TDesC& uri = mdeObject.Uri(); - - InitPropDefsL( mdeObject.Def() ); - - TBool possiblyProtectedContent( EFalse ); - if( aMimeType.Length() > 0 ) - { - if( aMimeType == KMimeTypeWma ) - { - possiblyProtectedContent = ETrue; - } - } - - if( possiblyProtectedContent ) - { - ContentAccess::CContent* content = ContentAccess::CContent::NewLC( uri ); - ContentAccess::CData* data = content->OpenContentLC( ContentAccess::EPeek ); - - TBool protectedContent( EFalse ); - TInt err = data->GetAttribute( ContentAccess::EIsProtected, protectedContent ); - if( err == KErrNone && protectedContent ) - { - CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, - *iPropDefs->iDrmPropertyDef, &protectedContent, aIsAdd ); - } - CleanupStack::PopAndDestroy( 2 ); // content, data - } TBool parsed( EFalse ); TRAPD( parseError, parsed = iAudioParser->ParseL( uri ) ); @@ -389,18 +366,24 @@ return; } + InitPropDefsL( mdeObject.Def() ); + // We do not want to get all long text fields at this time - TPtrC song = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldSong ); - TPtrC artist = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldArtist ); - TPtrC album = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldAlbum ); - TPtrC genre = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldGenre ); - TPtrC composer = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldComposer ); - TPtrC rating = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldRating ); - TPtrC orgArtist = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldOriginalArtist ); - TPtrC track = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldTrack ); - TPtrC duration = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldDuration ); - TPtrC copyright = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldCopyright ); - TPtrC date = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldDate ); + TPtrC song = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldSong ); + TPtrC artist = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldArtist ); + TPtrC album = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldAlbum ); + TPtrC genre = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldGenre ); + TPtrC composer = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldComposer ); + TPtrC rating = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldRating ); + TPtrC orgArtist = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldOriginalArtist ); + TPtrC track = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldTrack ); + TPtrC duration = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldDuration ); + TPtrC copyright = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldCopyright ); + TPtrC date = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldDate ); + TPtrC prot = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldProtected ); + TPtrC samplerate = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldSampleRate ); + TPtrC bitrate = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldBitRate ); + TPtrC albumartist = iAudioParser->MetaDataFieldL( CAudioMDParser::EAudioMDFieldAlbumArtist ); TPtrC8 jpeg = iAudioParser->MetaDataField8L( CAudioMDParser::EAudioMDFieldJpeg ); @@ -517,6 +500,49 @@ *iPropDefs->iDatePropertyDef, &releaseDate, aIsAdd ); } + TLex lex; + + if ( prot.Length() > 0 ) + { + lex.Assign( prot ); + TInt protValue( 0 ); + if( KErrNone == lex.Val( protValue ) && protValue == 1 ) + { + CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, + *iPropDefs->iDrmPropertyDef, &protValue, aIsAdd ); + } + } + + if ( samplerate.Length() ) + { + lex.Assign( samplerate ); + TReal32 value( 0 ); + if( KErrNone == lex.Val( value ) && value != 0 ) + { + CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, + *iPropDefs->iSampleRatePropertyDef, &value, aIsAdd ); + } + } + + if ( bitrate.Length() > 0 ) + { + lex.Assign( bitrate ); + TInt value( 0 ); + if( KErrNone == lex.Val( value ) && value != 0 ) + { + value /= KKiloBytes; + CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, + *iPropDefs->iBitratePropertyDef, &value, aIsAdd ); + } + } + + if ( albumartist.Length() > 0 + && albumartist.Length() < iPropDefs->iDatePropertyDef->MaxTextLengthL() ) + { + CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, + *iPropDefs->iAlbumArtistPropertyDef, &albumartist, aIsAdd ); + } + if( iHarvestAlbumArt && iTNM && jpeg.Length() > 0 ) { HBufC8* jpegBuf = jpeg.AllocLC(); diff -r fe894bb075c2 -r 79f826a55db2 harvester/harvesterplugins/AudioPlugin/src/harvesteraudiopluginutils.cpp --- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudiopluginutils.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudiopluginutils.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -35,6 +35,7 @@ _LIT( KMimeTypeWav, "audio/wav" ); _LIT( KMimeTypeAu, "audio/au" ); _LIT( KMimeTypeAudioMatroska, "audio/x-matroska"); +_LIT( KMimeTypeAudioMp4, "audio/mp4" ); _LIT( KExtensionMp3, "mp3" ); _LIT( KExtensionAac, "aac" ); @@ -49,6 +50,7 @@ _LIT( KExtensionAu, "au" ); _LIT( KExtensionNrt, "nrt" ); _LIT( KExtensionMka, "mka" ); +_LIT( KExtensionM4a, "m4a" ); // ----------------------------------------------------------------------------- // CAudioMDParser::NewL @@ -113,6 +115,10 @@ iWantedMetadataFields.AppendL( EMetaDataDuration ); iWantedMetadataFields.AppendL( EMetaDataCopyright ); iWantedMetadataFields.AppendL( EMetaDataDate ); + iWantedMetadataFields.AppendL( EMetaDataProtected ); + iWantedMetadataFields.AppendL( EMetaDataSampleRate ); + iWantedMetadataFields.AppendL( EMetaDataBitRate ); + iWantedMetadataFields.AppendL( EMetaDataAlbumArtist ); if( aAlbumArt ) { @@ -137,7 +143,6 @@ User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping( KExtensionWma(), KMimeTypeWma(), EMetaDataUtilityHandling ), cmp ) ); - User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping( KExtensionMid(), KMimeTypeMidi(), EFileSystemHandling ), cmp ) ); @@ -165,7 +170,9 @@ User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping( KExtensionMka(), KMimeTypeAudioMatroska(), EMetaDataUtilityHandling ), cmp ) ); - + User::LeaveIfError( iMimeTypeMappings.InsertInOrder( TMimeTypeMapping( + KExtensionM4a(), KMimeTypeAudioMp4(), + EMetaDataUtilityHandling ), cmp ) ); } @@ -320,7 +327,26 @@ id = EMetaDataJpeg; break; } - + case EAudioMDFieldProtected: + { + id = EMetaDataProtected; + break; + } + case EAudioMDFieldSampleRate: + { + id = EMetaDataSampleRate; + break; + } + case EAudioMDFieldBitRate: + { + id = EMetaDataBitRate; + break; + } + case EAudioMDFieldAlbumArtist: + { + id = EMetaDataAlbumArtist; + break; + } default: { #ifdef _DEBUG diff -r fe894bb075c2 -r 79f826a55db2 harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp --- a/harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/harvesterplugins/RTPPlugin/src/harvesterrtpplugin.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -116,6 +116,8 @@ CHarvesterRtpPlugin::~CHarvesterRtpPlugin() { WRITELOG( "CHarvesterRtpPlugin::~CHarvesterRtpPlugin()" ); + delete iPropDefs; + iPropDefs = NULL; } // --------------------------------------------------------------------------- diff -r fe894bb075c2 -r 79f826a55db2 harvester/harvesterplugins/VideoPlugin/data/200009f9.rss --- a/harvester/harvesterplugins/VideoPlugin/data/200009f9.rss Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/harvesterplugins/VideoPlugin/data/200009f9.rss Wed Oct 06 15:08:08 2010 +0300 @@ -42,7 +42,7 @@ version_no = 1; display_name = "Harvester video plugin"; default_data = "Video Audio"; - opaque_data = "mp4 mpg4 mpeg4 m4v m4a 3gp 3gpp rm rv rmvb 3g2 avi mkv ra wmv divx asf"; + opaque_data = "mp4 mpg4 mpeg4 m4v 3gp 3gpp rm rv rmvb 3g2 avi mkv ra wmv divx asf"; rom_only = 0; } }; diff -r fe894bb075c2 -r 79f826a55db2 harvester/monitorplugins/fileplugin/group/bld.inf --- a/harvester/monitorplugins/fileplugin/group/bld.inf Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -21,7 +21,7 @@ PRJ_EXPORTS ../data/20007182.txt /epoc32/data/z/private/10202BE9/20007182.txt -../data/20007182.txt /epoc32/WINSCW/C/private/10202BE9/20007182.txt +../data/20007182.txt /epoc32/winscw/c/private/10202BE9/20007182.txt PRJ_MMPFILES filemonitorplugin.mmp diff -r fe894bb075c2 -r 79f826a55db2 harvester/monitorplugins/fileplugin/src/FolderRenamer.cpp --- a/harvester/monitorplugins/fileplugin/src/FolderRenamer.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/src/FolderRenamer.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -206,7 +206,13 @@ } CRenameItem *renameItem = CRenameItem::NewL(aOldName,aNewName); - iRenamedFolders.AppendL(renameItem); + if( iRenamedFolders.Append( renameItem ) != KErrNone ) + { + delete renameItem; + renameItem = NULL; + return; + } + iIsRunning = ETrue; //First item --> Kickstart diff -r fe894bb075c2 -r 79f826a55db2 harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp --- a/harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/src/fileeventhandlerao.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -847,7 +847,7 @@ // void CFileEventHandlerAO::FormatL( TUint32 aOldMediaId, TBool aSubClose ) { - WRITELOG2( "CFileEventHandlerAO::FormatL - old media ID %d subclose %d", + WRITELOG2( "CFileEventHandlerAO::FormatL - old media ID %u subclose %d", aOldMediaId, aSubClose ); if ( aOldMediaId ) diff -r fe894bb075c2 -r 79f826a55db2 harvester/monitorplugins/fileplugin/src/filemonitorao.cpp --- a/harvester/monitorplugins/fileplugin/src/filemonitorao.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/src/filemonitorao.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -207,6 +207,7 @@ status.iFileName.Zero(); status.iNewFileName.Zero(); status.iProcessId = TUid::Null(); + status.iDriveMediaId = 0; } // --------------------------------------------------------------------------- diff -r fe894bb075c2 -r 79f826a55db2 harvester/monitorplugins/inc/mdsfspqueue.inl --- a/harvester/monitorplugins/inc/mdsfspqueue.inl Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/monitorplugins/inc/mdsfspqueue.inl Wed Oct 06 15:08:08 2010 +0300 @@ -52,6 +52,7 @@ aStatus.iNewFileName.Copy( *iNewFileName ); aStatus.iFileEventType = iFileEventType; aStatus.iProcessId = iProcessId; + aStatus.iDriveMediaId = iDriveMediaId; } //----------------------------------------------------------------------------- @@ -79,6 +80,7 @@ iFileName = aStatus.iFileName.AllocL(); iNewFileName = aStatus.iNewFileName.AllocL(); + iDriveMediaId = aStatus.iDriveMediaId; } //----------------------------------------------------------------------------- diff -r fe894bb075c2 -r 79f826a55db2 harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp --- a/harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -307,10 +307,7 @@ case EFsFileCreate: { #ifdef _DEBUG - if (function == EFsFileCreate) - { - WRITELOG( "CMdsFileServerPlugin::DoRequestL() - EFsFileCreate" ); - } + WRITELOG( "CMdsFileServerPlugin::DoRequestL() - EFsFileCreate" ); #endif HBufC* createdFileName = iFileName.Alloc(); @@ -497,7 +494,7 @@ { return KErrNone; } - drvNumber = iFormatOldMediaId; + drvNumber = iFormatDriveNumber; volInfo.iUniqueID = iFormatOldMediaId; iFormatOldMediaId = 0; iFormatDriveNumber = -1; @@ -546,7 +543,7 @@ queueItem->iFileEventType = fileEventType; queueItem->iProcessId = processId; - iQueue.AppendL( queueItem ); // owenership is transferred + iQueue.AppendL( queueItem ); // ownership is transferred CleanupStack::Pop( queueItem ); err = KErrNone; iPendingEvents++; diff -r fe894bb075c2 -r 79f826a55db2 harvester/monitorplugins/mmcplugin/group/bld.inf --- a/harvester/monitorplugins/mmcplugin/group/bld.inf Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/monitorplugins/mmcplugin/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -20,7 +20,7 @@ PRJ_EXPORTS ../data/20007183.txt /epoc32/data/z/private/10202BE9/20007183.txt -../data/20007183.txt /epoc32/WINSCW/C/private/10202BE9/20007183.txt +../data/20007183.txt /epoc32/winscw/c/private/10202BE9/20007183.txt PRJ_MMPFILES mmcmonitorplugin.mmp diff -r fe894bb075c2 -r 79f826a55db2 harvester/monitorplugins/mmcplugin/src/mmcmonitorao.cpp --- a/harvester/monitorplugins/mmcplugin/src/mmcmonitorao.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/monitorplugins/mmcplugin/src/mmcmonitorao.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -332,12 +332,13 @@ if ( !(iPreviousDriveList[i] == 0 && iDriveList[i] == 0 && iMediaIdList[i] == 0) ) { TInt32 drive; + TUint32 mediaId; drive = iPreviousDriveList[i]; WRITELOG1( "CMMCMonitorAO::PrintAllLists() - Previous drive element: %d", drive ); drive = iDriveList[i]; WRITELOG1( "CMMCMonitorAO::PrintAllLists() - Current drive element : %d", drive ); - drive = iMediaIdList[i]; - WRITELOG1( "CMMCMonitorAO::PrintAllLists() - Current MediaId : %d", drive ); + mediaId = iMediaIdList[i]; + WRITELOG1( "CMMCMonitorAO::PrintAllLists() - Current MediaId : %u", mediaId ); } } } diff -r fe894bb075c2 -r 79f826a55db2 harvester/server/inc/harvesterserver.h --- a/harvester/server/inc/harvesterserver.h Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/server/inc/harvesterserver.h Wed Oct 06 15:08:08 2010 +0300 @@ -33,6 +33,7 @@ _LIT( KDefaultPanicName, "Harvester Server Panic" ); _LIT( KHarvesterServerName, "HarvesterServer" ); +_LIT( KHarvesterServerNameIAD, "__HarvesterServer" ); class CHarvesterServer : public CPolicyServer, public MHarvesterStatusObserver, diff -r fe894bb075c2 -r 79f826a55db2 harvester/server/src/harvesterao.cpp --- a/harvester/server/src/harvesterao.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/server/src/harvesterao.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -506,7 +506,7 @@ // void CHarvesterAO::HandleUnmount( TUint32 aMediaId ) { - WRITELOG1( "CHarvesterAO::HandleUnmount(%d)", aMediaId ); + WRITELOG1( "CHarvesterAO::HandleUnmount(%u)", aMediaId ); OstTrace1( TRACE_NORMAL, CHARVESTERAO_HANDLEUNMOUNT, "CHarvesterAO::HandleUnmount;aMediaId=%d", aMediaId ); iUnmountDetected = ETrue; @@ -3126,30 +3126,50 @@ partialRestore = ETrue; #endif - if ( !partialRestore ) - { - return; - } - if( !iMdeSessionInitialized ) { return; } - iMdEHarvesterSession->ChangeCDriveMediaId(); + if( partialRestore ) + { + iMdEHarvesterSession->ChangeCDriveMediaId(); - WRITELOG("CHarvesterAO::BootPartialRestoreScanL() - partial restore"); - OstTrace0( TRACE_NORMAL, CHARVESTERAO_BOOTPARTIALRESTORESCANL, "CHarvesterAO::BootPartialRestoreScanL - partial restore" ); + WRITELOG("CHarvesterAO::BootPartialRestoreScanL() - partial restore"); + } + else + { + WRITELOG("CHarvesterAO::BootPartialRestoreScanL() - preinstalled content bootup scan"); + } + OstTrace0( TRACE_NORMAL, CHARVESTERAO_BOOTPARTIALRESTORESCANL, "CHarvesterAO::BootPartialRestoreScanL - prepare bootup scan" ); RPointerArray scanItems; TCleanupItem cleanupItem( MdsUtils::CleanupPtrArray, &scanItems ); CleanupStack::PushL( cleanupItem ); - CHarvesterCenRepUtil::GetPartialRestorePathsL( scanItems ); + if( partialRestore ) + { + CHarvesterCenRepUtil::GetPartialRestorePathsL( scanItems ); + } + + RPointerArray preinstalledItems; + TCleanupItem cleanupItem2( MdsUtils::CleanupPtrArray, &preinstalledItems ); + CleanupStack::PushL( cleanupItem2 ); + + // Scan for preinstalled content anyways + CHarvesterCenRepUtil::GetAlwaysScanOnBootPathsL( preinstalledItems ); + + for( TInt i = preinstalledItems.Count() - 1; i >=0; i-- ) + { + TScanItem* preinstalledLocation = preinstalledItems[i]; + preinstalledLocation->iPreinstalled = MdeConstants::MediaObject::EPreinstalled; + scanItems.Append( preinstalledLocation ); + } + preinstalledItems.Reset(); RPointerArray ignorePaths; - TCleanupItem cleanupItem2( MdsUtils::CleanupPtrArray, &ignorePaths ); - CleanupStack::PushL( cleanupItem2 ); + TCleanupItem cleanupItem3( MdsUtils::CleanupPtrArray, &ignorePaths ); + CleanupStack::PushL( cleanupItem3 ); CHarvesterCenRepUtil::GetIgnoredPartialRestorePathsL( ignorePaths ); @@ -3161,6 +3181,7 @@ iRestoreWatcher->UnregisterL(); CleanupStack::PopAndDestroy( &ignorePaths ); + CleanupStack::PopAndDestroy( &preinstalledItems ); CleanupStack::PopAndDestroy( &scanItems ); } @@ -3270,7 +3291,7 @@ TScanItem* item = new (ELeave) TScanItem(); CleanupStack::PushL( item ); item->iPath = name->AllocL(); - item->iPreinstalled = MdeConstants::MediaObject::ENotPreinstalled; + item->iPreinstalled = preinstalled; CleanupStack::Pop( item ); aScanItems.AppendL( item ); // ownership is transferred } diff -r fe894bb075c2 -r 79f826a55db2 harvester/server/src/harvesterserver.cpp --- a/harvester/server/src/harvesterserver.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/server/src/harvesterserver.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -323,6 +323,8 @@ WRITELOG( "CHarvesterServer::ShutdownNotification" ); OstTrace0( TRACE_NORMAL, CHARVESTERSERVER_SHUTDOWNNOTIFICATION, "CHarvesterServer::ShutdownNotification" ); + User::RenameThread( KHarvesterServerNameIAD ); + CActiveScheduler::Stop(); } diff -r fe894bb075c2 -r 79f826a55db2 harvester/server/src/harvestershutdownobserver.cpp --- a/harvester/server/src/harvestershutdownobserver.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/server/src/harvestershutdownobserver.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -25,7 +25,7 @@ // CHarvesterShutdownObserver::NewL() // --------------------------------------------------------------------------- // -CHarvesterShutdownObserver* CHarvesterShutdownObserver::NewL( MHarvesterShutdownObserver& aObserver/*, const TUid& aKeyCategory */) +EXPORT_C CHarvesterShutdownObserver* CHarvesterShutdownObserver::NewL( MHarvesterShutdownObserver& aObserver/*, const TUid& aKeyCategory */) { CHarvesterShutdownObserver* self = new( ELeave )CHarvesterShutdownObserver( aObserver/*, aKeyCategory */); CleanupStack::PushL( self ); diff -r fe894bb075c2 -r 79f826a55db2 harvester/server/src/mdeobjecthandler.cpp --- a/harvester/server/src/mdeobjecthandler.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/harvester/server/src/mdeobjecthandler.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -230,7 +230,15 @@ } #endif WRITELOG( "CMdeObjectHandler::GetMetadataObjectL() - file handle is open! Returning." ); - return NULL; + if( error == KErrInUse || error == KErrLocked ) + { + // If file is locked, push it to reharvesting queue + User::Leave( error ); + } + else + { + return NULL; + } } tempFile.Close(); } diff -r fe894bb075c2 -r 79f826a55db2 iadstoprestart/inc/iadstop.h --- a/iadstoprestart/inc/iadstop.h Mon Sep 27 15:53:05 2010 +0300 +++ b/iadstoprestart/inc/iadstop.h Wed Oct 06 15:08:08 2010 +0300 @@ -21,18 +21,11 @@ #include #include -_LIT( KHarvesterServerName, "HarvesterServer" ); -_LIT( KHarvesterServerProcess, "*HarvesterServer*"); -_LIT( KHarvesterServerExe, "harvesterserver.exe" ); +_LIT( KHarvesterServerProcess, "HarvesterServer*"); -_LIT( KMdsServerName, "!MdSServer" ); -_LIT( KMdSServerProcess, "*!mdsserver*"); +_LIT( KMdSServerProcess, "!MdSServer*"); -_LIT( KTAGDaemonName, "ThumbAGDaemon" ); -_LIT( KTAGDaemonProcess, "*ThumbAGDaemon*" ); -_LIT( KTAGDaemonExe, "thumbagdaemon.exe" ); - -_LIT( KListenerProcess, "*iadlistener*"); +_LIT( KTAGDaemonProcess, "ThumbAGDaemon*" ); _LIT( KWatchdogProcess, "*mdswatchdog*"); diff -r fe894bb075c2 -r 79f826a55db2 inc/mdscommoninternal.h --- a/inc/mdscommoninternal.h Mon Sep 27 15:53:05 2010 +0300 +++ b/inc/mdscommoninternal.h Wed Oct 06 15:08:08 2010 +0300 @@ -25,7 +25,6 @@ // X:[].db _LIT( KMdsSqlDbDefaultName, "C:[200009f3]metadata.sq" ); _LIT( KMdsSqlDbDefaultPath, "C:\\private\\10281E17\\[200009f3]metadata.sq" ); -_LIT( KMdsSqlDbBackupPath, "C:\\private\\200009F5\\[200009f3]metadata.sq" ); // default import metadata file _LIT( KMdsDefaultImportFile, "C:\\private\\200009f3\\defaultimportfile.mde" ); @@ -56,6 +55,7 @@ const TInt KTriggerDbMaintenanceTreasholdValue( 3000 ); _LIT( KMdSServerName,"!MdSServer" ); // Server name +_LIT( KMdSServerNameIAD,"!__MdSServer" ); // Server name after shutdown _LIT( KMdSServerProcessString,"!MdSServer*" ); _LIT( KSchemaChunkName, "MdSSchema" ); diff -r fe894bb075c2 -r 79f826a55db2 locationmanager/data/bld.inf --- a/locationmanager/data/bld.inf Mon Sep 27 15:53:05 2010 +0300 +++ b/locationmanager/data/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -21,7 +21,7 @@ PRJ_EXPORTS 200071BE.txt /epoc32/data/z/private/10202BE9/200071BE.txt -200071BE.txt /epoc32/WINSCW/C/private/10202BE9/200071BE.txt +200071BE.txt /epoc32/winscw/c/private/10202BE9/200071BE.txt ../sis/locationmanager_stub.sis /epoc32/data/z/system/install/locationmanager_stub.sis PRJ_MMPFILES diff -r fe894bb075c2 -r 79f826a55db2 locationmanager/geoconverter/group/bld.inf --- a/locationmanager/geoconverter/group/bld.inf Mon Sep 27 15:53:05 2010 +0300 +++ b/locationmanager/geoconverter/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -15,6 +15,11 @@ * */ + +#include "../../inc/locplatsupport.mmh" + +#ifdef _LOC_GEOTAGGING_CELLID + PRJ_PLATFORMS DEFAULT @@ -27,3 +32,4 @@ PRJ_TESTEXPORTS +#endif \ No newline at end of file diff -r fe894bb075c2 -r 79f826a55db2 locationmanager/geotagger/eabi/geotaggerarm.def --- a/locationmanager/geotagger/eabi/geotaggerarm.def Mon Sep 27 15:53:05 2010 +0300 +++ b/locationmanager/geotagger/eabi/geotaggerarm.def Wed Oct 06 15:08:08 2010 +0300 @@ -3,4 +3,7 @@ _ZN18CInternalGeoTagger4NewLEP11CMdESessionP18MGeoTaggerObserver @ 2 NONAME _ZTI18CInternalGeoTagger @ 3 NONAME _ZTV18CInternalGeoTagger @ 4 NONAME + _ZN18CInternalGeoTaggerD0Ev @ 5 NONAME + _ZN18CInternalGeoTaggerD1Ev @ 6 NONAME + _ZN18CInternalGeoTaggerD2Ev @ 7 NONAME diff -r fe894bb075c2 -r 79f826a55db2 locationmanager/geotagger/src/cinternalgeotagger.cpp --- a/locationmanager/geotagger/src/cinternalgeotagger.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/locationmanager/geotagger/src/cinternalgeotagger.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -128,7 +128,7 @@ // CInternalGeoTagger::~CInternalGeoTagger // -------------------------------------------------------------------------- // -CInternalGeoTagger::~CInternalGeoTagger() +EXPORT_C CInternalGeoTagger::~CInternalGeoTagger() { LOG("CInternalGeoTagger::~CInternalGeoTagger ,begin"); #ifdef LOC_GEOTAGGING_CELLID diff -r fe894bb075c2 -r 79f826a55db2 locationmanager/locationtrail/group/locationtrail.mmp --- a/locationmanager/locationtrail/group/locationtrail.mmp Mon Sep 27 15:53:05 2010 +0300 +++ b/locationmanager/locationtrail/group/locationtrail.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -74,9 +74,9 @@ LIBRARY centralrepository.lib LIBRARY ecom.lib LIBRARY commsdat.lib +LIBRARY profileeng.lib LIBRARY geotagger.lib -LIBRARY libc.lib #ifdef _LOC_REVERSEGEOCODE LIBRARY tagcreator.lib diff -r fe894bb075c2 -r 79f826a55db2 locationmanager/locationtrail/inc/clocationrecord.h --- a/locationmanager/locationtrail/inc/clocationrecord.h Mon Sep 27 15:53:05 2010 +0300 +++ b/locationmanager/locationtrail/inc/clocationrecord.h Wed Oct 06 15:08:08 2010 +0300 @@ -52,6 +52,9 @@ #include #endif +#include +#include + typedef RLocationTrail::TTrailState TLocTrailState; class CTelephony; @@ -125,6 +128,7 @@ #ifdef LOC_REVERSEGEOCODE TItemId iCountryTagId; TItemId iCityTagId; + TUint iReverseGeocodeSuccess; #endif }; class MLocationAddObserver @@ -147,7 +151,8 @@ class CLocationRecord : public CBase, public MNetworkInfoObserver, public MPositionInfoObserver, - public MMdEQueryObserver + public MMdEQueryObserver, + public MProfileChangeObserver #ifdef LOC_GEOTAGGING_CELLID ,public MGeoConverterObserver #endif @@ -507,6 +512,14 @@ * Callback method on geotagging complete */ void GeoTaggingCompleted(); + + /** + * MProfileChangeObserver pure virtual function + * @param aProfileEvent Profile event + * @param aProfileId Active profile id + */ + void HandleActiveProfileEventL(TProfileEvent aProfileEvent,TInt aProfileId ); + #ifdef LOC_REVERSEGEOCODE /** @@ -752,7 +765,17 @@ CReverseGeoCoderPlugin* iRevGeocoderPlugin; #endif - + + /** + *to listen profile change. + */ + CProfileChangeNotifyHandler* iProfileHandler; + + /* + *To check for offline profile + */ + TBool iOfflineCheck; + }; #endif // C_CLOCATIONRECORD_H diff -r fe894bb075c2 -r 79f826a55db2 locationmanager/locationtrail/src/clocationrecord.cpp --- a/locationmanager/locationtrail/src/clocationrecord.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/locationmanager/locationtrail/src/clocationrecord.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -21,6 +21,7 @@ #include #include #include +#include //profile enum #ifdef LOC_GEOTAGGING_CELLID #include #endif //LOC_GEOTAGGING_CELLID @@ -104,6 +105,8 @@ ,iLastReverseGeocodeFails(EFalse) ,iRevGeocoderPlugin( NULL ) #endif + ,iProfileHandler(NULL) + ,iOfflineCheck(ETrue) { iMaxTrailSize = KMaxTrailLength / KUpdateInterval; } @@ -129,6 +132,7 @@ iPositionInfo = CPositionInfo::NewL( this ); iRemapper = CLocationRemappingAO::NewL(); iNetworkInfoTimer = CPeriodic::NewL( CActive::EPriorityStandard ); + iProfileHandler = CProfileChangeNotifyHandler::NewL(this); #ifdef LOC_REVERSEGEOCODE iTagCreator = CTagCreator::NewL(); @@ -170,11 +174,13 @@ #ifdef LOC_REVERSEGEOCODE iLastMediaItem.iCityTagId= 0; iLastMediaItem.iCountryTagId = 0; + iLastMediaItem.iReverseGeocodeSuccess = 0; iLastLocationItem.iFlag = 0; iLastLocationItem.iCityTagId= 0; iLastLocationItem.iCountryTagId = 0; iLastLocationItem.iLocationId = 0; + iLastLocationItem.iReverseGeocodeSuccess = 0; #endif LOG( "CLocationRecord::ConstructL(), end" ); } @@ -248,11 +254,24 @@ delete iTagQuery; iTagQuery = NULL; } - delete iTagCreator; - // set the pointer to NULL, ECOM will destroy object. - delete iRevGeocoderPlugin; - iRevGeocoderPlugin = NULL; + if(iTagCreator) + { + delete iTagCreator; + iTagCreator = NULL; + } + + if(iRevGeocoderPlugin) + { + // set the pointer to NULL, ECOM will destroy object. + delete iRevGeocoderPlugin; + iRevGeocoderPlugin = NULL; + } #endif + if(iProfileHandler) + { + delete iProfileHandler; + iProfileHandler = NULL; + } LOG( "CLocationRecord::~CLocationRecord(), end" ); } @@ -300,8 +319,9 @@ StartTimerL(); } - iTrailStarted = ETrue; - SetCurrentState( RLocationTrail::ETrailStarting ); + iTrailStarted = ETrue; + iState = RLocationTrail::ETrailStopped; + SetCurrentState( RLocationTrail::ETrailStarting ); LOG( "CLocationRecord::StartL(), end" ); } @@ -699,7 +719,7 @@ const TInt aError ) { LOG("CLocationRecord::NetworkInfo, begin"); - if ( aError == KErrNone ) + if ( aError == KErrNone && iOfflineCheck) { LOG("CLocationRecord::NetworkInfo - KErrNone"); iNetwork = aNetworkInfo; @@ -946,10 +966,18 @@ iMediaItems.Append( newItem ); TItemId lastLocationId = 0; - if ( (iLastMediaItem.iFlag & KSnapMediaFile) > 0) + +#ifdef LOC_REVERSEGEOCODE + if ( ( iLastMediaItem.iReverseGeocodeSuccess == 1 ) && (iLastMediaItem.iFlag & KSnapMediaFile) > 0 ) { lastLocationId = iLastMediaItem.iLocationId; } +#else + if ( (iLastMediaItem.iFlag & KSnapMediaFile) > 0 ) + { + lastLocationId = iLastMediaItem.iLocationId; + } +#endif CTelephony::TNetworkInfoV1* net = &locationData.iNetworkInfo; // capture only network data @@ -1013,8 +1041,8 @@ } // check match for last created locationobject #ifdef LOC_REVERSEGEOCODE - else if ( (iLastMediaItem.iFlag & KSnapMediaFile) > 0 && - iLastMediaItem.iCountryTagId > 0) + else if ( (iLastMediaItem.iFlag & KSnapMediaFile) > 0 && + iLastMediaItem.iCountryTagId > 0 && ( iLastMediaItem.iReverseGeocodeSuccess == 1 ) ) #else else if ( (iLastMediaItem.iFlag & KSnapMediaFile) > 0) #endif //LOC_REVERSEGEOCODE @@ -1034,7 +1062,7 @@ CreateRelationL( aObjectId, lastLocationId ); // attach same tags associated to last location #ifdef LOC_REVERSEGEOCODE - if ( iLastMediaItem.iCountryTagId ) //found from DB last time + if ( iLastMediaItem.iCountryTagId && ( iLastMediaItem.iReverseGeocodeSuccess == 1 ) ) //found from DB last time { iTagCreator->AttachTagsL( aObjectId, iLastMediaItem.iCountryTagId, iLastMediaItem.iCityTagId ); @@ -1096,7 +1124,7 @@ #ifdef LOC_REVERSEGEOCODE // attach same tags associated to last location - if ( iLastMediaItem.iCountryTagId ) + if ( iLastMediaItem.iCountryTagId && ( iLastMediaItem.iReverseGeocodeSuccess == 1 ) ) { iTagCreator->AttachTagsL( aObjectId, iLastMediaItem.iCountryTagId, iLastMediaItem.iCityTagId ); @@ -2584,16 +2612,19 @@ { iLocationItems[0]->iCountryTagId = countryTagId; iLocationItems[0]->iCityTagId = cityTagId; + iLocationItems[0]->iReverseGeocodeSuccess = 1 ; + iLastLocationItem = (*iLocationItems[0]); TRAP_IGNORE( iTagCreator->AttachTagsL( iLocationItems[0]->iObjectId, countryTagId, cityTagId ) ); if ( (iLastMediaItem.iFlag & KSnapMediaFile) > 0 - && iLastMediaItem.iLocationId == iLastLocationItem.iLocationId ) + && iLastMediaItem.iLocationId == iLastLocationItem.iLocationId && (iLastLocationItem.iReverseGeocodeSuccess == 1)) { LOG("Updating country/city\n"); iLastMediaItem.iCountryTagId = countryTagId; iLastMediaItem.iCityTagId = cityTagId; + iLastMediaItem.iReverseGeocodeSuccess = 1; } } @@ -2861,9 +2892,35 @@ iTagQuery->FindL(); // results to a call to HandleQueryCompleted() LOG( "CLocationRecord::GetTagsL(), end" ); } + +#endif //LOC_REVERSEGEOCODE -#endif //LOC_REVERSEGEOCODE +// -------------------------------------------------------------------------- +// CLocationRecord::HandleActiveProfileEventL() +// -------------------------------------------------------------------------- +// +void CLocationRecord::HandleActiveProfileEventL( TProfileEvent aProfileEvent,TInt aProfileId ) + { + LOG( "CLocationRecord::HandleActiveProfileEventL(), begin" ); + ARG_USED(aProfileEvent); + iOfflineCheck = ETrue; + + + if ( EProfileOffLineId == aProfileId ) + { + LOG( "HandleActiveProfileEventL() if condition to stop trail, begin" ); + iNetwork.iAreaKnown = EFalse; + iNetwork.iAccess = CTelephony::ENetworkAccessUnknown; + iNetwork.iCellId = 0; + iNetwork.iLocationAreaCode = 0; + iNetwork.iCountryCode.Zero(); + iNetwork.iNetworkId.Zero(); + iOfflineCheck = EFalse; + LOG( "HandleActiveProfileEventL() if condition to stop trail, end" ); + } + LOG( "CLocationRecord::HandleActiveProfileEventL(), end" ); + } // End of file diff -r fe894bb075c2 -r 79f826a55db2 locationmanager/tagcreator/group/bld.inf --- a/locationmanager/tagcreator/group/bld.inf Mon Sep 27 15:53:05 2010 +0300 +++ b/locationmanager/tagcreator/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -15,6 +15,11 @@ * */ + +#include "../../inc/locplatsupport.mmh" + +#ifdef _LOC_REVERSEGEOCODE + PRJ_PLATFORMS DEFAULT @@ -27,3 +32,5 @@ PRJ_TESTEXPORTS + +#endif diff -r fe894bb075c2 -r 79f826a55db2 locationmanager/tagcreator/src/ctagcreator.cpp --- a/locationmanager/tagcreator/src/ctagcreator.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/locationmanager/tagcreator/src/ctagcreator.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -30,6 +30,7 @@ _LIT ( KCountry, "country:"); // country:finland _LIT ( KCity, "city:"); // city:helsinki|country:finland _LIT ( KSeparator, "|" ); // Separator for city tag. Separate city and country. +_LIT ( KUnMappedLocation, " " ); //a blank title for geocoordinates that could not be mapped to a valid location // -------------------------------------------------------------------------- // CTagCreator::NewL @@ -90,25 +91,35 @@ TItemId& aCountryTagId ) { LOG( "CTagCreator::CreateTagForCountryL - begin" ); - - // Crete new string for uri, -> country:India. - TUint totalLength = ( aCountry.Length() + KCountry().Length() ); - HBufC* buf = HBufC::NewLC( totalLength ); - TPtr uriPtr = buf->Des(); - _LIT(KCountryUriFormat, "%S%S"); - uriPtr.Format(KCountryUriFormat, &(KCountry()), &aCountry); - - // Check if there is allready tag for current country. - aCountryTagId = TagExistsL( uriPtr ); - - if( !aCountryTagId ) - { - // No tag, create tag for country. - aCountryTagId = CreateTagL( aCountry, uriPtr, MdeConstants::Tag::ESystemDefineCountryTags); - } - - CleanupStack::PopAndDestroy( buf ); - + + // Crete new string for uri, -> country:India. + TUint totalLength = ( aCountry.Length() + KCountry().Length() ); + HBufC* buf = HBufC::NewLC( totalLength ); + TPtr uriPtr = buf->Des(); + _LIT(KCountryUriFormat, "%S%S"); + uriPtr.Format(KCountryUriFormat, &(KCountry()), &aCountry); + + // Check if there is allready tag for current country. + aCountryTagId = TagExistsL( uriPtr ); + + if( !aCountryTagId ) + { + // No tag, create tag for country. + if(aCountry.Length()> 0) + { + //Valid country name + aCountryTagId = CreateTagL( aCountry, uriPtr, MdeConstants::Tag::ESystemDefineCountryTags); + } + else + { + //No valid country name. So create a tag of type EUnMappedLocationTags + aCountryTagId = CreateTagL( aCountry, uriPtr, MdeConstants::Tag::EUnMappedLocationTags); + } + } + + CleanupStack::PopAndDestroy( buf ); + + LOG( "CTagCreator::CreateTagForCountryL - end" ); } @@ -119,31 +130,39 @@ void CTagCreator::CreateTagForCityL( const TPtrC& aCountry, const TPtrC& aCity, TItemId& aCityTagId ) { LOG( "CTagCreator::CreateTagForCityL - begin" ); - - // Crete new string for uri, -> city:bangalore|country:india - TUint totalLength = ( aCity.Length() + KCity.iTypeLength + - aCountry.Length() + KCountry.iTypeLength + KSeparator.iTypeLength ); - - HBufC* buf = HBufC::NewLC( totalLength ); - TPtr uriPtr = buf->Des(); - _LIT(KCityCountryUriFormat, "%S%S%S%S%S"); - uriPtr.Format(KCityCountryUriFormat, - &(KCity()), - &aCity, - &(KSeparator()), - &(KCountry()), - &aCountry); + // Crete new string for uri, -> city:bangalore|country:india + TUint totalLength = ( aCity.Length() + KCity.iTypeLength + + aCountry.Length() + KCountry.iTypeLength + KSeparator.iTypeLength ); + + HBufC* buf = HBufC::NewLC( totalLength ); + TPtr uriPtr = buf->Des(); + _LIT(KCityCountryUriFormat, "%S%S%S%S%S"); + uriPtr.Format(KCityCountryUriFormat, + &(KCity()), + &aCity, + &(KSeparator()), + &(KCountry()), + &aCountry); + + // Check if there is allready tag for current city. + aCityTagId = TagExistsL( uriPtr ); - // Check if there is allready tag for current city. - aCityTagId = TagExistsL( uriPtr ); - - if( !aCityTagId ) - { - // No tag, create tag for city. - aCityTagId = CreateTagL( aCity, uriPtr, MdeConstants::Tag::ESystemDefineCityTags); - } - - CleanupStack::PopAndDestroy( buf ); + if( !aCityTagId ) + { + // No tag, create tag for city. + if(aCity.Length() > 0) + { + //Valid city name + aCityTagId = CreateTagL( aCity, uriPtr, MdeConstants::Tag::ESystemDefineCityTags); + } + else + { + //No valid city name. So create a tag of type EUnMappedLocationTags + aCityTagId = CreateTagL( aCity, uriPtr, MdeConstants::Tag::EUnMappedLocationTags); + } + } + + CleanupStack::PopAndDestroy( buf ); LOG( "CTagCreator::CreateTagForCityL - end" ); } @@ -198,6 +217,10 @@ { tagObject->AddTextPropertyL( titleDef, aTitle ); // Add title } + else + { + tagObject->AddTextPropertyL( titleDef,KUnMappedLocation); // Add empty title + } // Finally add to database. TItemId itemId = iMdeSession->AddObjectL( *tagObject ); @@ -293,15 +316,10 @@ const TPtrC& aCity, TItemId& aCityTagId) { LOG( "CGeoTagger::CreateLocationTagsL" ); - if( aCountry.Length() > 0 ) - { - CreateTagForCountryL( aCountry, aCountryTagId ); - } - - if( aCity.Length() > 0 ) - { - CreateTagForCityL( aCountry, aCity, aCityTagId ); - } + + CreateTagForCountryL( aCountry, aCountryTagId ); + CreateTagForCityL( aCountry, aCity, aCityTagId ); + } // End of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/content_listing_framework_collection_manager_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/content_listing_framework_collection_manager_api.metaxml Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,18 @@ + + + Content Listing Framework Collection Manager API + An interface for managing media collections + c++ + clfwrapper + + + + + + + + + no + no + + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: Content Listing Framework Collection Manager API +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/mediacollectionmanager.h MW_LAYER_PLATFORM_EXPORT_PATH(mediacollectionmanager.h) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/inc/mediacollectionmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/inc/mediacollectionmanager.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,340 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Description : +* +*/ + + +#ifndef MMEDIACOLLECTIONMANAGER_H +#define MMEDIACOLLECTIONMANAGER_H + + +#include + +/// Propertie flags for media collections +enum TMediaCollectionProperties + { + /// Collection items are in Phone memory + EMCPhoneMemoryCollection = 0x00000001, + /// Collection items are in MMC + EMCMmcCollection = 0x00000002 + }; + +class MMediaCollectionManager; +class MMediaCollectionInfoExt; +class MMediaCollectionManagerExt; +class MMediaCollectionObserverExt; + +/** + * Factory for Media Collection Manager + * + * @lib MediaCollectionManager.lib + * @since S60 3.2 + */ +class MediaCollectionManagerFactory + { +public: // New functions + + /** + * Create new instance of Media Collection Manager + * @return New instance of Media Collection Manager. + * Ownership is transferred to the client application. + */ + IMPORT_C static MMediaCollectionManager* CreateCollectionManagerL(); + +private: + // Prohibit C++ default constructor. + MediaCollectionManagerFactory(); + // Prohibit Destructor. + ~MediaCollectionManagerFactory(); + }; + +/** + * Media Collection Info interface, + * use MMediaCollectionManager to get collections + * + * @lib N/A + * @since S60 3.2 + */ +class MMediaCollectionInfo + { +public: + virtual ~MMediaCollectionInfo() {} + +public: + /** + * Returns the name of the collection + * @since S60 3.2 + * @return Name of the collection + */ + virtual const TDesC& Name() const = 0; + + /** + * Returns the id of the album + * @since S60 3.2 + * @return The id of the album + */ + virtual TInt Id() const = 0; + + /** + * Returns list of media types that are defined for the collection. + * See media types from CLFContentListing.hrh TCLFMediaType + * @since S60 3.2 + * @return List of media types that are defined for the collection. + */ + virtual const RArray& CollectionItemTypes() const = 0; + + /** + * Returns collection propertie flags + * Properties are defined in TMediaCollectionProperties + * Should not be used in 5.0 or later! + * @since S60 3.2, depricated in 5.0 + * @return Properties flags + */ + virtual TInt32 Properties() const = 0; + +private: // Extension interface + + /** + * This member is internal and not intended for use. + */ + virtual MMediaCollectionInfoExt* Extension() + { return NULL; } + virtual const MMediaCollectionInfoExt* Extension() const + { return NULL; } + }; + + +/** + * Observer interface to get notification about changes in + * Media Collection Manager + * + * @lib N/A + * @since S60 3.2 + */ +class MMediaCollectionObserver + { +public: + /** + * Collection manager uses this method to notify about + * created/deleted/modified collections. + * @since 3.2 + * @param aCollectionIdArray + */ + virtual void CollectionChangedL( + const TArray& aCollectionIdArray ) = 0; + + /** + * Collection manager uses this method to notify about + * possible errors. + * @since 3.2 + * @param aError Collection manager error status + * KErrCorrupt if collection manager is corrupted and + * possible some data is lost + */ + virtual void CollectionManagerErrorL( + TInt aError ) = 0; + +protected: + + /** + * Destructor. + */ + virtual ~MMediaCollectionObserver() {} + +private: // Extension interface + + /** + * This member is internal and not intended for use. + */ + virtual MMediaCollectionObserverExt* Extension() + { return NULL; } + virtual const MMediaCollectionObserverExt* Extension() const + { return NULL; } + }; + +/** + * Media Collection Manager + * + * Use this class to get Media Collections, create new collections, + * delete collections, rename collections, add files to collections, + * remove files from collections. + * + * @lib N/A + * @since S60 3.2 + */ +class MMediaCollectionManager + { +public: + virtual ~MMediaCollectionManager() {} + +public: // New functions + + /** + * Return collection info by index. + * @since 3.2 + * @param aCollectionInfoArray Collection infos are added to this array + */ + virtual void GetCollectionInfosL( + RPointerArray& + aCollectionInfoArray ) const = 0; + + /** + * Return collection info by ID. + * @since 3.2 + * @param aId Collection ID + * @return Pointer to a MMediaCollectionInfo object + * Ownership is transferred to client + */ + virtual MMediaCollectionInfo* CollectionInfoByIdLC( + TInt aId ) const = 0; + + /** + * Create new collection. + * @since 3.2 + * @param aName Name of the collection + * @param aCollectionItemTypes List of media types that are + * in the collection. + * Use media types from CLFContentListing.hrh TCLFMediaType. + * NOTE! that collection manager doesn't check is added item defined + * mediatype. This is only for client(s) for grouping different + * type folders. + * @param aStorage In 3.2 See TMediaCollectionProperties + * NOTE! If given propertie set is not supported then + * function leaves with KErrNotSupported + NOTE! In 5.0 Drive number where the collection is to be created! + * @return ID of the creaded collection + */ + virtual TInt CreateCollectionL( + const TDesC& aName, + const TArray& aCollectionItemTypes, + TInt32 aStorage) = 0; + + /** + * Delete collection. + * NOTE! this doesn't delete items that are in collection. + * @since 3.2 + * @param aId ID of the collection + */ + virtual void DeleteCollectionL( + TInt aId ) = 0; + + /** + * Rename collection. + * @since 3.2 + * @param aId ID of the collection. + * If collection doesn't found then + * function leaves with KErrNotFound + * @param aNewName new name of the collection + */ + virtual void RenameCollectionL( + TInt aId, + const TDesC& aNewName ) = 0; + + /** + * Add item(s) to collection. + * @since 3.2 + * @param aId Collection ID + * If collection doesn't found then + * function leaves with KErrNotFound + * @param aItemArray + * @param aRemoveFromOtherCollections Is item removed from other + * available collections. + */ + virtual void AddToCollectionL( + TInt aId, + const MDesCArray& aItemArray, + TBool aRemoveFromOtherCollections = ETrue ) = 0; + + /** + * Remove item(s) from collection. + * @since 3.2 + * @param aId Collection ID + * If collection doesn't found then + * function leaves with KErrNotFound + * @param aItemArray + */ + virtual void RemoveFromCollectionL( + TInt aId, + const MDesCArray& aItemArray ) = 0; + + /** + * Remove item(s) from all collections. + * @since 3.2 + * @param aItemArray + */ + virtual void RemoveFromAllCollectionsL( + const MDesCArray& aItemArray ) = 0; + + + /** + * Get collection items. + * @since 3.2 + * @param aId Collection ID + * If collection doesn't found then + * function leaves with KErrNotFound + * @param aItemArray Item are added to the array + */ + virtual void GetCollectionItemArrayL( + TInt aId, + CDesCArray& aItemArray ) const = 0; + + /** + * Find collections IDs by item. + * @since 3.2 + * @param aItem + * @param aIdArray Possible collection IDs are added to the array + */ + virtual void GetCollectionIdByItemL( + const TDesC& aItem, + RArray& aIdArray ) const = 0; + + /** + * Add collection observer. + * @since 3.2 + * @param aObserver + */ + virtual void AddCollectionObserverL( + MMediaCollectionObserver& aObserver ) = 0; + + /** + * Remove collection observer. + * @since 3.2 + * @param aObserver + */ + virtual void RemoveCollectionObserverL( + MMediaCollectionObserver& aObserver ) = 0; + + /** + * Get the drivenumber of the drive where collection is located by collection id + * @since 5.0 + * @param aId id of the collection + * @return DriveNumber of the drive where collection is located + */ + virtual TInt32 GetDriveByIdL( TInt aId ) = 0; + +private: // Extension interface + + /** + * This member is internal and not intended for use. + */ + virtual MMediaCollectionManagerExt* Extension() + { return NULL; } + virtual const MMediaCollectionManagerExt* Extension() const + { return NULL; } + + }; + +#endif // MMEDIACOLLECTIONMANAGER_H diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/tsrc/Bmarm/CollectionMangerTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/tsrc/Bmarm/CollectionMangerTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,2 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) \ No newline at end of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/tsrc/Bwins/CollectionManagerTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/tsrc/Bwins/CollectionManagerTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,2 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/tsrc/conf/CollectionManagerTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/tsrc/conf/CollectionManagerTest.cfg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,146 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: CLF Collection Manager API tests +# + +// --------------------------------------------------------------------------- +// CLF Collection Manager API test cases +// --------------------------------------------------------------------------- + +// These should be run in sequential mode if several cases are run at the same +// time! Be adviced, this API is no longer used or supported, it is present only +// because of it's association to Content Listing Framework. + +[StifSettings] +TestThreadStackSize= 32768 +TestThreadMinHeap= 4096 +TestThreadMaxHeap= 16777216 +[EndStifSettings] + +[Test] +title Create Collection Manager +create CollectionManagerTest test +test CreateCollectionManager +test EndTestSession +delete test +[Endtest] + +[Test] +title Get Collection Infos +create CollectionManagerTest test +test CreateCollectionManager +test GetCollectionInfos +test EndTestSession +delete test +[Endtest] + +[Test] +title Get Collection Info By ID +create CollectionManagerTest test +test CreateCollectionManager +test CollectionInfoById +test EndTestSession +delete test +[Endtest] + +[Test] +title Create Collection +create CollectionManagerTest test +test CreateCollectionManager +test CreateCollection +test EndTestSession +delete test +[Endtest] + +[Test] +title Delete Collection +create CollectionManagerTest test +test CreateCollectionManager +test DeleteCollection +test EndTestSession +delete test +[Endtest] + +[Test] +title Rename Collection +create CollectionManagerTest test +test CreateCollectionManager +test RenameCollection +test EndTestSession +delete test +[Endtest] + +[Test] +title Add to Collection +create CollectionManagerTest test +test CreateCollectionManager +test AddToCollection +test EndTestSession +delete test +[Endtest] + +[Test] +title Remove from Collection +create CollectionManagerTest test +test CreateCollectionManager +test RemoveFromCollectionL +test EndTestSession +delete test +[Endtest] + +[Test] +title Get collection info array +create CollectionManagerTest test +test CreateCollectionManager +test GetCollectionItemArray +test EndTestSession +delete test +[Endtest] + +[Test] +title Get collection ID by Item +create CollectionManagerTest test +test CreateCollectionManager +test GetCollectionIdByItem +test EndTestSession +delete test +[Endtest] + +[Test] +title Add collection observer +create CollectionManagerTest test +test CreateCollectionManager +test AddCollectionObserver +test EndTestSession +delete test +[Endtest] + +[Test] +title Remove collection observer +create CollectionManagerTest test +test CreateCollectionManager +test RemoveCollectionObserver +test EndTestSession +delete test +[Endtest] + +[Test] +title Get drive by ID test +create CollectionManagerTest test +test CreateCollectionManager +test GetDriveById +test EndTestSession +delete test +[Endtest] + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/tsrc/eabi/CollectionManagerTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/tsrc/eabi/CollectionManagerTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/tsrc/group/CollectionManagerTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/tsrc/group/CollectionManagerTest.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + +#include +#include + +TARGET CollectionManagerTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + +DEFFILE CollectionManagerTest.def + +SOURCEPATH ../src +SOURCE CollectionManagerTest.cpp +SOURCE CollectionManagerTestBlocks.cpp + +SYSTEMINCLUDE /epoc32/include/ecom +USERINCLUDE ../inc ../../../../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY mediacollectionmanager.lib +LIBRARY efsrv.lib +LIBRARY bafl.lib + + + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/tsrc/group/CollectionManagerTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/tsrc/group/CollectionManagerTest.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,34 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +; Installation file for API test + +; Languages +&EN + +; Header +#{"CollectionManagerTest"},(0x101FB3E3),1,0,1,TYPE=SA + +; Localised Vendor name +%{"Nokia-EN"} + +; Unique Vendor name +:"Nokia" + +; Files +"\epoc32\release\armv5\urel\CollectionManagerTest.dll" -"C:\sys\bin\CollectionManagerTest.dll" +"..\init\CollectionManagerTest.ini" -"C:\testframework\CollectionManagerTest.ini" +"..\conf\CollectionManagerTest.cfg" -"C:\testframework\CollectionManagerTest.cfg" + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/tsrc/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +CollectionManagerTest.mmp + +PRJ_TESTEXPORTS +../conf/CollectionManagerTest.cfg /epoc32/winscw/c/TestFramework/CollectionManagerTest.cfg +../init/CollectionManagerTest.ini /epoc32/winscw/c/TestFramework/CollectionManagerTest.ini + +// End of File + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/tsrc/inc/CollectionManagerTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/tsrc/inc/CollectionManagerTest.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,107 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef CONTEXTENGINEPLUGINTEST_H +#define CONTEXTENGINEPLUGINTEST_H + +// INCLUDES +#include +#include +#include +#include + +// Logging path +_LIT( KCollectionManagerTestLogPath, "\\logs\\testframework\\CollectionManagerTest\\" ); +// Log file +_LIT( KCollectionManagerTestLogFile, "CollectionManagerTest.txt" ); +_LIT( KCollectionManagerTestLogFileWithTitle, "CollectionManagerTest_[%S].txt" ); + +// FORWARD DECLARATIONS +class CCollectionManagerTest; + +// CLASS DECLARATION +NONSHARABLE_CLASS(CCollectionManagerTest) : public CScriptBase, + public MMediaCollectionObserver + + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CCollectionManagerTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CCollectionManagerTest(); + + public: // Functions from base classes + + virtual TInt RunMethodL( CStifItemParser& aItem ); + + void CollectionChangedL( const TArray& aCollectionIdArray ); + void CollectionManagerErrorL( TInt aError ); + + private: + + /** + * C++ default constructor. + */ + CCollectionManagerTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + // engine + virtual TInt CreateCollectionManagerL( CStifItemParser& aItem ); + virtual TInt GetCollectionInfosL( CStifItemParser& aItem ); + virtual TInt CollectionInfoByIdL( CStifItemParser& aItem ); + virtual TInt CreateCollectionL( CStifItemParser& aItem ); + virtual TInt DeleteCollectionL( CStifItemParser& aItem ); + virtual TInt RenameCollectionL( CStifItemParser& aItem ); + virtual TInt AddToCollectionL( CStifItemParser& aItem ); + virtual TInt RemoveFromCollectionL( CStifItemParser& aItem ); + virtual TInt RemoveFromAllCollectionsL( CStifItemParser& aItem ); + virtual TInt GetCollectionItemArrayL( CStifItemParser& aItem ); + virtual TInt GetCollectionIdByItemL( CStifItemParser& aItem ); + virtual TInt AddCollectionObserverL( CStifItemParser& aItem ); + virtual TInt RemoveCollectionObserverL( CStifItemParser& aItem ); + virtual TInt GetDriveByIdL( CStifItemParser& aItem ); + virtual TInt EndTestSessionL( CStifItemParser& aItem ); + + private: // Data + + MMediaCollectionManager* iCollectionManager; + + }; + +#endif // CONTEXTENGINEPLUGINTEST_H + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/tsrc/init/CollectionManagerTest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/tsrc/init/CollectionManagerTest.ini Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,80 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= ContextEnginePluginTestLog + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 600000 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testframework\CollectionManagerTest.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +HardwareBasePath= C:\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/tsrc/src/CollectionManagerTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/tsrc/src/CollectionManagerTest.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include +#include "CollectionManagerTest.h" +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::CCollectionManagerTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CCollectionManagerTest::CCollectionManagerTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CCollectionManagerTest::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KCollectionManagerTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KCollectionManagerTestLogFile); + } + + iLog = CStifLogger::NewL( KCollectionManagerTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CCollectionManagerTest* CCollectionManagerTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CCollectionManagerTest* self = new (ELeave) CCollectionManagerTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + + } + +// Destructor +CCollectionManagerTest::~CCollectionManagerTest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CCollectionManagerTest::NewL( aTestModuleIf ); + + } + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_collection_manager_api/tsrc/src/CollectionManagerTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_collection_manager_api/tsrc/src/CollectionManagerTestBlocks.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,710 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include +#include +#include "CollectionManagerTest.h" + +#include "mdsutils.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CCollectionManagerTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + // engine + ENTRY( "CreateCollectionManager", CCollectionManagerTest::CreateCollectionManagerL ), + ENTRY( "GetCollectionInfos", CCollectionManagerTest::GetCollectionInfosL ), + ENTRY( "CollectionInfoById", CCollectionManagerTest::CollectionInfoByIdL ), + ENTRY( "CreateCollection", CCollectionManagerTest::CreateCollectionL ), + ENTRY( "DeleteCollection", CCollectionManagerTest::DeleteCollectionL ), + ENTRY( "RenameCollection", CCollectionManagerTest::RenameCollectionL ), + ENTRY( "AddToCollection", CCollectionManagerTest::AddToCollectionL ), + ENTRY( "RemoveFromCollectionL", CCollectionManagerTest::RemoveFromCollectionL ), + ENTRY( "GetCollectionItemArray", CCollectionManagerTest::GetCollectionItemArrayL ), + ENTRY( "GetCollectionIdByItem", CCollectionManagerTest::GetCollectionIdByItemL ), + ENTRY( "AddCollectionObserver", CCollectionManagerTest::AddCollectionObserverL ), + ENTRY( "RemoveCollectionObserver", CCollectionManagerTest::RemoveCollectionObserverL ), + ENTRY( "GetDriveById", CCollectionManagerTest::GetDriveByIdL ), + ENTRY( "EndTestSession", CCollectionManagerTest::EndTestSessionL ) + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::CollectionChangedL +// ----------------------------------------------------------------------------- +// +void CCollectionManagerTest::CollectionChangedL( const TArray& /*aCollectionIdArray*/ ) + { + // This is not going to be called + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::CollectionManagerErrorL +// ----------------------------------------------------------------------------- +// +void CCollectionManagerTest::CollectionManagerErrorL( TInt /*aError*/ ) + { + // This is not going to be called + } + + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::CreateCollectionManagerLL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::CreateCollectionManagerL( CStifItemParser& /* aItem */ ) + { + iCollectionManager = MediaCollectionManagerFactory::CreateCollectionManagerL( ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::GetCollectionInfosL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::GetCollectionInfosL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter GetCollectionInfosL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt error( KErrNone ); + + if( iCollectionManager ) + { + RPointerArray collectionInfoArray; + TRAP( error, iCollectionManager->GetCollectionInfosL( collectionInfoArray ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + return error; + } + error = KErrNone; + const TInt infoArrayCount( collectionInfoArray.Count() ); + if( infoArrayCount > 0 ) + { + error = KErrUnknown; + } + } + else + { + error = KErrUnknown; + } + + _LIT( KMsg2, "Exit GetCollectionInfosL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return error; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::CollectionInfoByIdL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::CollectionInfoByIdL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter CollectionInfoByIdL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt collectionID( KErrNotFound ); + TInt error( KErrNone ); + MMediaCollectionInfo* mci = NULL; + if( !iCollectionManager ) + { + return KErrUnknown; + } + + TRAP( error, mci = iCollectionManager->CollectionInfoByIdLC( collectionID ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + return error; + } + + if( mci ) + { + return KErrCorrupt; + } + + TRAP( error, mci = iCollectionManager->CollectionInfoByIdLC( 0 ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + return error; + } + + if( mci ) + { + return KErrCorrupt; + } + + _LIT( KMsg2, "Exit CollectionInfoByIdL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::CreateCollectionL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::CreateCollectionL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter CreateCollectionL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iCollectionManager ) + { + return KErrUnknown; + } + + _LIT( KTestAlbumName, "TestAlbum" ); + HBufC* collectionName = KTestAlbumName().AllocL(); + RArray types; + types.AppendL( 1 ); + TInt32 properties = EMCPhoneMemoryCollection; + + TInt collectionId( KErrNotFound ); + TInt error( KErrNone ); + TRAP( error, collectionId = iCollectionManager->CreateCollectionL( *collectionName, types.Array(), properties ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + delete collectionName; + collectionName = NULL; + return error; + } + + properties = EMCMmcCollection; + TRAP( error, collectionId = iCollectionManager->CreateCollectionL( *collectionName, types.Array(), properties ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + delete collectionName; + collectionName = NULL; + return error; + } + + MMediaCollectionInfo* mci = NULL; + TRAP( error, iCollectionManager->CollectionInfoByIdLC( collectionId ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + delete collectionName; + collectionName = NULL; + return error; + } + + if( mci ) + { + delete collectionName; + collectionName = NULL; + return KErrCorrupt; + } + + delete collectionName; + collectionName = NULL; + + _LIT( KMsg2, "Exit CreateCollectionL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::DeleteCollectionL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::DeleteCollectionL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter DeleteCollectionL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iCollectionManager ) + { + return KErrUnknown; + } + + TInt collectionId( KErrNotFound ); + TInt error( KErrNone ); + TRAP( error, iCollectionManager->DeleteCollectionL( collectionId ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + return error; + } + + collectionId = 0; + TRAP( error, iCollectionManager->DeleteCollectionL( collectionId ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + return error; + } + + _LIT( KMsg2, "Exit DeleteCollectionL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::RenameCollectionL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::RenameCollectionL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter RenameCollectionL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iCollectionManager ) + { + return KErrUnknown; + } + + TInt collectionId( KErrNotFound ); + TInt error( KErrNone ); + + _LIT( KTestAlbumName, "NewTestAlbum" ); + HBufC* collectionNewName = KTestAlbumName().AllocL(); + + TRAP( error, iCollectionManager->RenameCollectionL( collectionId, *collectionNewName ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + delete collectionNewName; + collectionNewName = NULL; + return error; + } + + MMediaCollectionInfo* mci = NULL; + + TRAP( error, mci= iCollectionManager->CollectionInfoByIdLC( collectionId ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + delete collectionNewName; + collectionNewName = NULL; + return error; + } + + if( mci ) + { + delete collectionNewName; + collectionNewName = NULL; + return KErrCorrupt; + } + + delete collectionNewName; + collectionNewName = NULL; + + _LIT( KMsg2, "Exit RenameCollectionL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::AddToCollectionL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::AddToCollectionL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter AddToCollectionL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iCollectionManager ) + { + return KErrUnknown; + } + + const TInt itemCount( 500 ); + CDesCArray* newItemArray = new (ELeave) CDesCArrayFlat( itemCount ); + + for( TInt i = 0 ; i < itemCount ; ++i ) + { + TBuf<40> b; + b.Num( i ); + b.Append( _L("TestItem") ); + newItemArray->AppendL( b ); + } + + TInt collectionId( KErrNotFound ); + TInt error( KErrNone ); + TRAP( error, iCollectionManager->AddToCollectionL( collectionId, *newItemArray, ETrue ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + delete newItemArray; + newItemArray = NULL; + return error; + } + + TRAP( error, iCollectionManager->AddToCollectionL( collectionId, *newItemArray, EFalse ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + delete newItemArray; + newItemArray = NULL; + return error; + } + + delete newItemArray; + newItemArray = NULL; + + _LIT( KMsg2, "Exit AddToCollectionL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::RemoveFromCollectionL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::RemoveFromCollectionL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter RemoveFromCollectionL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iCollectionManager ) + { + return KErrUnknown; + } + + const TInt itemCount( 500 ); + CDesCArray* removeItemArray = new (ELeave) CDesCArrayFlat( itemCount ); + + for( TInt i = 0 ; i < itemCount ; ++i ) + { + TBuf<40> b; + b.Num( i ); + b.Append( _L("TestItem") ); + removeItemArray->AppendL( b ); + } + + TInt collectionId( KErrNotFound ); + TInt error( KErrNone ); + TRAP( error, iCollectionManager->RemoveFromCollectionL( collectionId, *removeItemArray ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + delete removeItemArray; + removeItemArray = NULL; + return error; + } + + delete removeItemArray; + removeItemArray = NULL; + + _LIT( KMsg2, "Exit RemoveFromCollectionL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::RemoveFromAllCollectionsL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::RemoveFromAllCollectionsL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter RemoveFromAllCollectionsL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iCollectionManager ) + { + return KErrUnknown; + } + + const TInt itemCount( 500 ); + CDesCArray* removeItemArray = new (ELeave) CDesCArrayFlat( itemCount ); + CleanupStack::PushL( removeItemArray ); + + for( TInt i = 0 ; i < itemCount ; ++i ) + { + TBuf<40> b; + b.Num( i ); + b.Append( _L("TestItem") ); + removeItemArray->AppendL( b ); + } + + TInt error( KErrNone ); + TRAP( error, iCollectionManager->RemoveFromAllCollectionsL( *removeItemArray ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + CleanupStack::PopAndDestroy( removeItemArray ); + removeItemArray = NULL; + return error; + } + + CleanupStack::PopAndDestroy( removeItemArray ); + removeItemArray = NULL; + + _LIT( KMsg2, "Exit RemoveFromAllCollectionsL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::GetCollectionItemArrayL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::GetCollectionItemArrayL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter GetCollectionItemArrayL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iCollectionManager ) + { + return KErrUnknown; + } + + CDesCArraySeg* collectionItemArray = new (ELeave) CDesCArraySeg( 4 ); + CleanupStack::PushL( collectionItemArray ); + + TInt collectionId( KErrNotFound ); + TInt error( KErrNone ); + TRAP( error, iCollectionManager->GetCollectionItemArrayL( collectionId, *collectionItemArray ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + CleanupStack::PopAndDestroy(collectionItemArray); + return error; + } + + if( collectionItemArray->Count() > 0 ) + { + CleanupStack::PopAndDestroy(collectionItemArray); + return KErrUnknown; + } + + CleanupStack::PopAndDestroy(collectionItemArray); + + _LIT( KMsg2, "Exit GetCollectionItemArrayL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::GetCollectionIdByItemL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::GetCollectionIdByItemL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter GetCollectionIdByItemL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iCollectionManager ) + { + return KErrUnknown; + } + + _LIT( KTestItemName, "GetCollectionIdByItemTestItem"); + HBufC* getCollectionIdByItemTestItemName = KTestItemName().AllocL(); + + RArray idArray; + CleanupClosePushL( idArray ); + TInt error( KErrNone ); + TRAP( error, iCollectionManager->GetCollectionIdByItemL( *getCollectionIdByItemTestItemName, idArray ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + CleanupStack::PopAndDestroy(&idArray); + delete getCollectionIdByItemTestItemName; + getCollectionIdByItemTestItemName = NULL; + return error; + } + + const TInt idArrayCount( idArray.Count() ); + if( idArrayCount > 0 ) + { + CleanupStack::PopAndDestroy(&idArray); + delete getCollectionIdByItemTestItemName; + getCollectionIdByItemTestItemName = NULL; + return KErrUnknown; + } + + CleanupStack::PopAndDestroy(&idArray); + + delete getCollectionIdByItemTestItemName; + getCollectionIdByItemTestItemName = NULL; + + _LIT( KMsg2, "Enter GetCollectionIdByItemL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::AddCollectionObserverL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::AddCollectionObserverL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter AddCollectionObserverL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iCollectionManager ) + { + return KErrUnknown; + } + + TInt err( KErrNone ); + TRAP( err, iCollectionManager->AddCollectionObserverL( *this ) ); + if( err != KErrNotSupported && err != KErrNone ) + { + return err; + } + + _LIT( KMsg2, "Exit AddCollectionObserverL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::RemoveCollectionObserverL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::RemoveCollectionObserverL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter RemoveCollectionObserverL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iCollectionManager ) + { + return KErrUnknown; + } + + TInt err( KErrNone ); + TRAP( err, iCollectionManager->AddCollectionObserverL( *this ) ); + if( err != KErrNotSupported && err != KErrNone ) + { + return err; + } + + TRAP( err, iCollectionManager->RemoveCollectionObserverL( *this ) ); + if( err != KErrNotSupported && err != KErrNone ) + { + return err; + } + + _LIT( KMsg2, "Exit RemoveCollectionObserverL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::GetDriveByIdL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::GetDriveByIdL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter GetDriveByIdL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iCollectionManager ) + { + return KErrUnknown; + } + + TInt collectionId( KErrNotFound ); + + TInt32 drive( 100 ); + TInt error( KErrNone ); + + TRAP( error, drive = iCollectionManager->GetDriveByIdL( collectionId ) ); + if( error != KErrNotSupported && error != KErrNone ) + { + return error; + } + + if( drive != 100 ) + { + return KErrUnknown; + } + + _LIT( KMsg2, "Exit GetDriveByIdL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CCollectionManagerTest::EndTestSessionL +// ----------------------------------------------------------------------------- +// +TInt CCollectionManagerTest::EndTestSessionL( CStifItemParser& /* aItem */ ) + { + delete iCollectionManager; + iCollectionManager = NULL; + + return KErrNone; + } + +// [End of File] - Do not remove diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_extended_api/content_listing_framework_extended_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_extended_api/content_listing_framework_extended_api.metaxml Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,18 @@ + + + Content Listing Framework Extended API + An extended interface for Content Listing Framework + c++ + clfwrapper + + + + + + + + + no + no + + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_extended_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_extended_api/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: File that exports the files belonging to +: Content Listing Framework Extended API +* +*/ + +#include + +PRJ_PLATFORMS +DEFAULT + +PRJ_EXPORTS + +../inc/CLFContentListingExtended.hrh MW_LAYER_PLATFORM_EXPORT_PATH(CLFContentListingExtended.hrh) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/content_listing_framework_extended_api/inc/CLFContentListingExtended.hrh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/content_listing_framework_extended_api/inc/CLFContentListingExtended.hrh Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,69 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: S60 internal CLF field IDs +* +*/ + + +#ifndef CLFCONTENTLISTINGEXTENDED_HRH +#define CLFCONTENTLISTINGEXTENDED_HRH + +#include + +// DATA TYPES + +/** +* Content Listing Framework list model media types. +* Last default media type is 0x7FFFFFFF, +* Custom media type range 0x80000000 0xFFFFFFFF +*/ +enum TCLFMediaTypeExtended + { + /// Gallery collections + ECLFMediaTypeCollection = 0x7 + }; + +/** +* S60 internal Content Listing Framework item field IDs. +* Last default field ID is 0x7FFFFFFF, +* Custom field ID range 0x80000000 - 0xFFFFFFFF +*/ +enum TCLFExtendedFieldId + { + /// Media gallery collection name: + /// descriptor + ECLFFieldIdCollectionName = 0x00002000, + /// Media gallery collection ID: + /// integer + ECLFFieldIdCollectionId = 0x00002001, + /// Media gallery collection type: + /// integer + ECLFFieldIdCollectionType = 0x00002002, + /// Media gallery collection memory: + /// integer + ECLFFieldIdCollectionMemory = 0x00002003, + /// Media gallery collection properties: + /// integer + ECLFFieldIdCollectionProperties = 0x00002004, + /// Media gallery collection files: + /// descriptor + ECLFFieldIdCollectionFiles = 0x00002005, + /// Media gallery item count of the collection: + /// integer + ECLFFieldIdCollectionItemCount = 0x00002006 + }; + +#endif + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/context_engine_plugin_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/context_engine_plugin_api.metaxml Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,15 @@ + + +context engine plugin api +Context engine plugin api +c++ +contextengine + + + + + +no +no + + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + + +#include + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS +../inc/contextplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(contextplugin.h) +../inc/contextengine.h MW_LAYER_PLATFORM_EXPORT_PATH(contextengine.h) + +PRJ_MMPFILES + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/inc/contextengine.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/inc/contextengine.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,224 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An engine to collect context related metadata. +* +*/ + +// Statically linked dll + +#ifndef CCONTEXTENGINE_H +#define CCONTEXTENGINE_H + +#include +#include + +//forward declarations + +class CMdEObject; +class CContextEngineAO; +class CContextSnapshotItem; +class CMdESession; +class CHarvesterData; + +/** +* An interface for observer that wants to be informed about +* context engine initialization completion and +* snapshot completion. +*/ +class MContextInitializationObserver + { + public: + /** + * Pure virtual method. Intended to inform about + * context engine initialization completion. + * + * @param aErrorCode Error code for error occurred during initialization + */ + virtual void ContextInitializationStatus( TInt aErrorCode ) = 0; + }; + +/** +* An interface for observers that want to be informed about context snapshot completion. +*/ +class MContextSnapshotObserver + { + public: + /** + * Pure virtual method. Intended to inform about context snapshot taking completion. + * + * @param aErrorCode Error code for error occurred while taking the snapshot. + */ + virtual void ContextSnapshotStatus( CHarvesterData* aHD ) = 0; + }; + +/** +* An engine to collect context metadata with available context plugins. +* CContextEngineAO is used to do the actual work. +* This class is implemented as a Singleton. +*/ +NONSHARABLE_CLASS( CContextEngine ) : public CBase, public MContextSnapshotObserver + { + public: + + /** + * Destroys the implementation. This is virtual method + * and this class is not intended for derivation, so not exported. + */ + virtual ~CContextEngine(); + + /** + * Gets an instance to CContextEngine singleton. + * A new object is created if needed. + * If an observer object to notify is given, context plugins are initialized + * asyncronously and observer is notified when ready. + * + * @param aObserver an interface class for callback or NULL + * @return A pointer to the context engine implementation + */ + IMPORT_C static CContextEngine* GetInstanceL( MContextInitializationObserver* aObserver = NULL ); + + /** + * Release an instance of this singleton. + */ + IMPORT_C void ReleaseInstance(); + + /** + * Ignores the reference count and destroys this singleton. + * THINK BEFORE USING! Should be used only instead of reference counting + * if clients are not calling ReleaseInstance() (which they should). + */ + IMPORT_C void Destroy(); + + /** + * Set a pointer to MdESession. The pointer is given forward to context plugins. + * Session must be set in order to successfully harvest context data. + * + * @param aSession Session pointer to set. + */ + IMPORT_C void SetMdeSession( CMdESession* aSession ); + + /** + * Context snapshot. This takes the snapshot using plug-ins. + * + * @param aObserver an interface class for callback. + * @param aMetadataObject MdE object the snapshot is taken to. + */ + IMPORT_C void ContextSnapshot( MContextSnapshotObserver& aObserver, + CHarvesterData& aHD ); + + /** + * Context snapshot. This takes the snapshot using plug-ins. + * + * @param aObserver an interface class for callback. + * @param aMetadataObjectArray An array of MdE objects the snapshot is taken to. + */ + IMPORT_C void ContextSnapshot( MContextSnapshotObserver& aObserver, + RPointerArray& aMetadataObjectArray ); + + /** + * Method used to clarify amount of plug-ins. + * + * @return Amount of plug-ins. Intended for test purposes only. + */ + IMPORT_C TInt PluginCount(); + + /** + * From MContextEngineObserver. + * Method is called by CContextEngineAO when a context snapshot is finished + * or an error has occured. + * + * @param aErrorCode Error code for error occurred during snapshot. + */ + void ContextSnapshotStatus( CHarvesterData* aHD ); + + private: + + /** + * C++ constructor - not exported; + * implicitly called from GetInstance() + * + */ + CContextEngine(); + + /** + * 2nd phase construction, called by GetInstance() + * + * @param aObserver object/callback to notify when initialization is ready. + */ + void ConstructL( MContextInitializationObserver* aObserver ); + + /** + * Add a new observer and metadata items to a queue. + * These observers need to be informed when a snapshot is ready + * and items need a context snapshot. + * + * @param aItem An item to add. + */ + void QueueSnapshotItem( CContextSnapshotItem* aItem ); + + private: // data + + /** + * This active object is used to handle queued snapshot requests. + */ + CContextEngineAO* iContextEngineAO; + + /** + * Array of observers and related metadata objects that need + * a context snapshot. + * Related observer is informed about snapshot completion. + */ + RPointerArray iSnapshotQueue; + + /** + * In case array of objects for snapshot were passed, + * variable to store the amount of items to be processed. + */ + TInt iArrayCount; + + /** + * In case array of objects for snapshot were passed, + * variable to store the amount of items that have been processed. + */ + TInt iProcessedArrayCount; + }; + + +/** +* A helper class to store this singleton's static data. +*/ +NONSHARABLE_CLASS( CContextEngineStaticData ): public CBase + { + friend class CContextEngine; + + public: + + CContextEngineStaticData( CContextEngine* aContextEngine ) : iContextEngine(aContextEngine) + { + iRefCount = 1; + } + + virtual ~CContextEngineStaticData() + { + delete iContextEngine; + } + + protected: + + CContextEngine* iContextEngine; + TInt iRefCount; + }; + + +#endif // CCONTEXTENGINE_H diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/inc/contextplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/inc/contextplugin.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,128 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definition of the Context plug-in ECom interface. +* +*/ + +#ifndef CCONTEXTPLUGIN_H +#define CCONTEXTPLUGIN_H + +#include +#include + +// forward declarations +class CMdEObject; +class CMdESession; +class CHarvesterData; + +/** Uid for this interface */ +const TUid KCContextPluginInterfaceUid = { 0x200009F7 }; + +class MContextPluginObserver + { +public: + /** + * A pure virtual method intended to inform about completion of context + * plug-in initialization. Symbian error codes are used. + * + * @param aErrorCode Error code for error occurred during initialization. + */ + virtual void PluginInitializationStatus( TInt aErrorCode ) = 0; + + /** + * A pure virtual method intended to inform about context snapshot taking completion. + * Symbian error codes are used. + * + * @param aErrorCode Error code for error occurred while taking the snapshot. + */ + virtual void PluginSnapshotStatus( CHarvesterData* aHD ) = 0; + }; + + +/** +* This class implements the context plugin interface. +*/ +class CContextPlugin : public CBase + { +public: + + /** + * Creates an implementation of a desired implementation defined by the parameter. + * + * @param aUid + * @return A pointer to the created plug-in. + */ + IMPORT_C static CContextPlugin* NewL( const TUid& aUid ); + + /** + * Destroys the implementation. This is virtual method + * and this class is not intended for derivation, so not exported. + */ + IMPORT_C virtual ~CContextPlugin(); + + /** + * Lists all available implementations which implement this interface. + * + * @param[out] aImplInfoArray A list of existing implementations of the interface. + */ + IMPORT_C static void ListImplementationsL( RImplInfoPtrArray& aImplInfoArray ); + + /** + * A pure virtual interface method to initialize the plug-in. + * + * @param aObserver An interface class to inform about initialization completion. + */ + virtual void Init( MContextPluginObserver& aObserver ) = 0; + + /** + * Set a pointer to MdESession. + * Session is used to store harvested context data. + * + * @param aSession Session pointer to set. + */ + virtual void SetMdeSession( CMdESession& aSession ) = 0; + + /** + * This pure virtual method takes the context snapshot for one metadata object + * and writes the information to the object received as parameter. + * The observer will be informed about the status of the operation. + * + * @param aObserver An interface class to inform about finishing context snapshot. + * @param aMetadataObject An object to take the snapshot for. + */ + virtual void ContextSnapshot( MContextPluginObserver& aObserver, CHarvesterData& aHD ) = 0; + + /** + * This pure virtual method takes the context snapshot for several + * metadata object and writes the information to the all the objects received as parameter. + * The observer will be informed about the status of the operation. + * + * @param aObserver An interface class to inform about finishing context snapshot. + * @param aMetadataObjectArray Array of objects to take the snapshot for. + */ + virtual void ContextSnapshot( MContextPluginObserver& aObserver, + RPointerArray& aHDArray ) = 0; + +private: // data + + /** + * Instance identifier key. When instance of an implementation is created + * by ECOM framework, the framework will assign UID for it. + * The UID is used in destructor to notify framework that this instance is + * being destroyed and resources can be released. + */ + TUid iDtor_ID_Key; + }; + +#endif // CCONTEXTPLUGIN_H diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/Bmarm/ContextEnginePluginTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/tsrc/Bmarm/ContextEnginePluginTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/Bwins/ContextEnginePluginTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/tsrc/Bwins/ContextEnginePluginTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/conf/ContextEnginePluginTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/tsrc/conf/ContextEnginePluginTest.cfg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,207 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Context Engine Plugin API tests +# + +// --------------------------------------------------------------------------- +// Context Engine Plugin API test cases +// --------------------------------------------------------------------------- + +// These should be run in sequential mode if several cases are run at the same +// time! + +[StifSettings] +TestThreadStackSize= 32768 +TestThreadMinHeap= 4096 +TestThreadMaxHeap= 16777216 +[EndStifSettings] + +[Test] +title Get ContextEngine instance with observer +create ContextEnginePluginTest test +request Session +test BeginTestSession +wait Session +request Init +test CreateContextEngineWithObserver +wait Init +test EndTestSession +delete test +[Endtest] + +[Test] +title Get ContextEngine instance without observer +create ContextEnginePluginTest test +request Session +test BeginTestSession +wait Session +test CreateContextEngineWithoutObserver +test EndTestSession +delete test +[Endtest] + +[Test] +title Release ContextEngine instance +create ContextEnginePluginTest test +request Session +test BeginTestSession +wait Session +test CreateContextEngineWithoutObserver +test ReleaseContextEngineInstance +test EndTestSession +delete test +[Endtest] + +[Test] +title Set MdE session test +create ContextEnginePluginTest test +request Session +test BeginTestSession +wait Session +request Init +test SetMdESessionTest +wait Init +test EndTestSession +delete test +[Endtest] + +[Test] +title Context Engine Snapshots +create ContextEnginePluginTest test +request Session +test BeginTestSession +wait Session +test CreateObjects 3 e:\testing\data\Jpg.jpg e:\testing\data\Animated.gif e:\testing\data\H263.3gp +request Init +test CreateContextEngineWithObserver +wait Init +request Snapshot +test ContextSnapshots engine +wait Snapshot +wait Snapshot +wait Snapshot +wait Snapshot +wait Snapshot +wait Snapshot +wait Snapshot +wait Snapshot +wait Snapshot +test DeleteObjects +test EndTestSession +delete test +[Endtest] + +[Test] +title Context Engine Multiple Snapshots +create ContextEnginePluginTest test +request Session +test BeginTestSession +wait Session +test CreateObjects 3 e:\testing\data\Jpg.jpg e:\testing\data\Animated.gif e:\testing\data\H263.3gp +request Init +test CreateContextEngineWithObserver +wait Init +request Snapshot +test MultipleSnapshots engine +wait Snapshot +wait Snapshot +test DeleteObjects +test EndTestSession +delete test +[Endtest] + +[Test] +title Context Engine Plugin Count +create ContextEnginePluginTest test +request Session +test BeginTestSession +wait Session +request Init +test CreateContextEngineWithObserver +wait Init +test PluginCount +test EndTestSession +delete test +[Endtest] + +[Test] +title Context Engine Static Data +create ContextEnginePluginTest test +request Session +test BeginTestSession +wait Session +test CreateContextEngineWithoutObserver +test ContextEngineStaticData +test EndTestSession +delete test +[Endtest] + +[Test] +title Context Plugin Startup/Shutdown +create ContextEnginePluginTest test +request Session +test BeginTestSession +wait Session +request Init +test LoadPlugin +wait Init +test EndTestSession +delete test +[Endtest] + +[Test] +title Context Plugin Snapshots +create ContextEnginePluginTest test +request Session +test BeginTestSession +wait Session +test CreateObjects 3 e:\testing\data\Jpg.jpg e:\testing\data\Animated.gif e:\testing\data\H263.3gp +request Init +test LoadPlugin +wait Init +test ContextSnapshots plugin +test DeleteObjects +test EndTestSession +delete test +[Endtest] + +[Test] +title Context Plugin Array Snapshots +create ContextEnginePluginTest test +request Session +test BeginTestSession +wait Session +test CreateObjects 3 e:\testing\data\Jpg.jpg e:\testing\data\Animated.gif e:\testing\data\H263.3gp +request Init +test LoadPlugin +wait Init +test MultipleSnapshots plugin +test DeleteObjects +test EndTestSession +delete test +[Endtest] + +[Test] +title Context Engine Destroy +create ContextEnginePluginTest test +request Session +test BeginTestSession +wait Session +request Init +test CreateContextEngineWithObserver +wait Init +test Destroy +test EndTestSession +delete test +[Endtest] \ No newline at end of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/data/mmc/ContextEnginePluginTest/Animated.gif Binary file mds_plat/context_engine_plugin_api/tsrc/data/mmc/ContextEnginePluginTest/Animated.gif has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/data/mmc/ContextEnginePluginTest/H263.3gp Binary file mds_plat/context_engine_plugin_api/tsrc/data/mmc/ContextEnginePluginTest/H263.3gp has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/data/mmc/ContextEnginePluginTest/Jpg.jpg Binary file mds_plat/context_engine_plugin_api/tsrc/data/mmc/ContextEnginePluginTest/Jpg.jpg has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/data/mmc/ContextEnginePluginTest/Thumbs.db Binary file mds_plat/context_engine_plugin_api/tsrc/data/mmc/ContextEnginePluginTest/Thumbs.db has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/eabi/ContextEnginePluginTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/tsrc/eabi/ContextEnginePluginTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/group/ContextEnginePluginTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/tsrc/group/ContextEnginePluginTest.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + +#include +#include + +TARGET ContextEnginePluginTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + +DEFFILE ContextEnginePluginTest.DEF + +SOURCEPATH ../src +SOURCE ContextEnginePluginTest.cpp +SOURCE ContextEnginePluginTestBlocks.cpp + +SYSTEMINCLUDE /epoc32/include/ecom +USERINCLUDE ../inc ../../../../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY contextengine.lib +LIBRARY contextplugininterface.lib +LIBRARY mdeclient.lib +LIBRARY ecom.lib +LIBRARY harvesterdata.lib + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/group/ContextEnginePluginTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/tsrc/group/ContextEnginePluginTest.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,38 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +; Installation file for API test + +; Languages +&EN + +; Header +#{"ContextEnginePluginTest"},(0x101FB3E3),1,0,1,TYPE=SA + +; Localised Vendor name +%{"Nokia-EN"} + +; Unique Vendor name +:"Nokia" + +; Files +"\epoc32\release\armv5\urel\ContextEnginePluginTest.dll" -"C:\sys\bin\ContextEnginePluginTest.dll" +"..\init\ContextEnginePluginTest.ini" -"C:\testframework\ContextEnginePluginTest.ini" +"..\conf\ContextEnginePluginTest.cfg" -"C:\testframework\ContextEnginePluginTest.cfg" + +"..\data\mmc\ContextEnginePluginTest\Jpg.jpg" -"E:\testing\data\Jpg.jpg" +"..\data\mmc\ContextEnginePluginTest\Animated.gif" -"E:\testing\data\Animated.gif" +"..\data\mmc\ContextEnginePluginTest\H263.3gp" -"E:\testing\data\H263.3gp" + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/tsrc/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +ContextEnginePluginTest.mmp + +PRJ_TESTEXPORTS +../conf/ContextEnginePluginTest.cfg /epoc32/winscw/c/TestFramework/ContextEnginePluginTest.cfg +../init/ContextEnginePluginTest.ini /epoc32/winscw/c/TestFramework/ContextEnginePluginTest.ini +../data/mmc/ContextEnginePluginTest/Jpg.jpg /epoc32/winscw/c/Data/Jpg.jpg +../data/mmc/ContextEnginePluginTest/Jpg.jpg /epoc32/winscw/c/Data/Animated.gif +../data/mmc/ContextEnginePluginTest/H263.3gp /epoc32/winscw/c/Data/H263.3gp + +// End of File + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/inc/ContextEnginePluginTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/tsrc/inc/ContextEnginePluginTest.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef CONTEXTENGINEPLUGINTEST_H +#define CONTEXTENGINEPLUGINTEST_H + +// INCLUDES +#include +#include +#include + +#include +#include +#include + +// Logging path +_LIT( KContextEnginePluginTestLogPath, "\\logs\\testframework\\ContextEnginePluginTest\\" ); +// Log file +_LIT( KContextEnginePluginTestLogFile, "ContextEnginePluginTest.txt" ); +_LIT( KContextEnginePluginTestLogFileWithTitle, "ContextEnginePluginTest_[%S].txt" ); + +// FORWARD DECLARATIONS +class CContextEnginePluginTest; + +// CLASS DECLARATION +NONSHARABLE_CLASS(CContextEnginePluginTest) : public CScriptBase, + public MMdESessionObserver, + public MContextInitializationObserver, + public MContextSnapshotObserver, + public MContextPluginObserver + + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CContextEnginePluginTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CContextEnginePluginTest(); + + public: // Functions from base classes + + virtual TInt RunMethodL( CStifItemParser& aItem ); + + private: // Functions from base classes + + void HandleSessionOpened(CMdESession& aSession, TInt aError); + void HandleSessionError(CMdESession& aSession, TInt aError); + void ContextInitializationStatus( TInt aError ); + void ContextSnapshotStatus( CHarvesterData* aHD ); + void PluginInitializationStatus( TInt aError ); + void PluginSnapshotStatus( CHarvesterData* aHD ); + + private: + + /** + * C++ default constructor. + */ + CContextEnginePluginTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + */ + void Delete(); + + void ActiveWait( TInt aTimeout ); + + /** + * Test methods are listed below. + */ + + // engine + virtual TInt BeginTestSessionL( CStifItemParser& aItem ); + virtual TInt EndTestSession( CStifItemParser& aItem ); + virtual TInt CreateObjectsL( CStifItemParser& aItem ); + virtual TInt DeleteObjectsL( CStifItemParser& aItem ); + virtual TInt CreateContextEngine1L( CStifItemParser& aItem ); + virtual TInt CreateContextEngine2L( CStifItemParser& aItem ); + virtual TInt ReleaseInstanceL( CStifItemParser& aItem ); + virtual TInt SetMdeSessionL( CStifItemParser& aItem ); + virtual TInt ContextSnapshotsL( CStifItemParser& aItem ); + virtual TInt MultipleSnapshotsL( CStifItemParser& aItem ); + virtual TInt PluginCount( CStifItemParser& aItem ); + virtual TInt Destroy( CStifItemParser& aItem ); + virtual TInt ContextEngineStaticData( CStifItemParser& aItem ); + + // plugin + virtual TInt LoadPluginL( CStifItemParser& aItem ); + + private: // Data + + CMdESession* iMdEClient; + CContextEngine* iContextEngine; + CHarvesterData* iHD; + + RPointerArray iObjectArray; + RArray iIds; + + CContextPlugin* iPlugin; + CContextPlugin* iLocationPlugin; + CContextPlugin* iCalendarPlugin; + + TInt iErrorCode; + + TInt iInitCount; + TInt iSnapshotCount; + TInt iInitTarget; + TInt iSnapshotTarget; + + TBool iPluginSet; + + }; + +#endif // CONTEXTENGINEPLUGINTEST_H + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/init/ContextEnginePluginTest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/tsrc/init/ContextEnginePluginTest.ini Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,81 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= ContextEnginePluginTestLog + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 600000 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testframework\ContextEnginePluginTest.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +HardwareBasePath= C:\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/src/ContextEnginePluginTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/tsrc/src/ContextEnginePluginTest.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,130 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include +#include "ContextEnginePluginTest.h" +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::CContextEnginePluginTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CContextEnginePluginTest::CContextEnginePluginTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CContextEnginePluginTest::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KContextEnginePluginTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KContextEnginePluginTestLogFile); + } + + iLog = CStifLogger::NewL( KContextEnginePluginTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CContextEnginePluginTest* CContextEnginePluginTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CContextEnginePluginTest* self = new (ELeave) CContextEnginePluginTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + + } + +// Destructor +CContextEnginePluginTest::~CContextEnginePluginTest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CContextEnginePluginTest::NewL( aTestModuleIf ); + + } + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/context_engine_plugin_api/tsrc/src/ContextEnginePluginTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/context_engine_plugin_api/tsrc/src/ContextEnginePluginTestBlocks.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,981 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include +#include "ContextEnginePluginTest.h" + +#include +#include "mdsutils.h" +#include "mdeconstants.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CContextEnginePluginTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + // engine + ENTRY( "BeginTestSession", CContextEnginePluginTest::BeginTestSessionL ), + ENTRY( "EndTestSession", CContextEnginePluginTest::EndTestSession ), + ENTRY( "CreateObjects", CContextEnginePluginTest::CreateObjectsL ), + ENTRY( "DeleteObjects", CContextEnginePluginTest::DeleteObjectsL ), + ENTRY( "CreateContextEngineWithObserver", CContextEnginePluginTest::CreateContextEngine1L ), + ENTRY( "CreateContextEngineWithoutObserver", CContextEnginePluginTest::CreateContextEngine2L ), + ENTRY( "ReleaseContextEngineInstance", CContextEnginePluginTest::ReleaseInstanceL ), + ENTRY( "SetMdESessionTest", CContextEnginePluginTest::SetMdeSessionL ), + ENTRY( "PluginCount", CContextEnginePluginTest::PluginCount ), + ENTRY( "Destroy", CContextEnginePluginTest::Destroy ), + ENTRY( "ContextEngineStaticData", CContextEnginePluginTest::ContextEngineStaticData ), + + ENTRY( "ContextSnapshots", CContextEnginePluginTest::ContextSnapshotsL ), + ENTRY( "MultipleSnapshots", CContextEnginePluginTest::MultipleSnapshotsL ), + + // plugin + ENTRY( "LoadPlugin", CContextEnginePluginTest::LoadPluginL ), + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::HandleSessionOpened +// ----------------------------------------------------------------------------- +// +void CContextEnginePluginTest::HandleSessionOpened( CMdESession& /*aClient*/, TInt aError ) + { + _LIT( KMsg, "CallBck HandleSessionOpened - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print( msg ); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::HandleSessionError +// ----------------------------------------------------------------------------- +// +void CContextEnginePluginTest::HandleSessionError( CMdESession& /*aClient*/, TInt aError ) + { + _LIT( KMsg, "CallBck HandleSessionError - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print( msg ); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::ContextInitializationStatus +// ----------------------------------------------------------------------------- +// +void CContextEnginePluginTest::ContextInitializationStatus( TInt aError ) + { + _LIT( KMsg, "CallBck ContextInitializationStatus - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print( msg ); + + iInitCount++; + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Init") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::ContextSnapshotStatus +// ----------------------------------------------------------------------------- +// +void CContextEnginePluginTest::ContextSnapshotStatus( CHarvesterData* aHD ) + { + _LIT( KMsg1, "Enter ContextSnapshotStatus" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + _LIT( KMsg, "CallBck ContextSnapshotStatus - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aHD->ErrorCode()); + iLog->Log( msg ); + RDebug::Print( msg ); + + if( !aHD ) + { + iErrorCode = KErrUnknown; + } + + if( aHD && iErrorCode == KErrNone ) + { + iErrorCode = aHD->ErrorCode(); + } + + iSnapshotCount++; + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Snapshot") ); + TestModuleIf().Event( event ); + + _LIT( KMsg2, "Exit ContextSnapshotStatus" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::PluginInitializationStatus +// ----------------------------------------------------------------------------- +// +void CContextEnginePluginTest::PluginInitializationStatus( TInt aError ) + { + _LIT( KMsg, "CallBck PluginInitializationStatus - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print( msg ); + + iInitCount++; + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Init") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::PluginSnapshotStatus +// ----------------------------------------------------------------------------- +// +void CContextEnginePluginTest::PluginSnapshotStatus( CHarvesterData* aHD ) + { + _LIT( KMsg1, "Enter PluginSnapshotStatus" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + _LIT( KMsg, "CallBck PluginSnapshotStatus - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aHD->ErrorCode()); + iLog->Log( msg ); + RDebug::Print( msg ); + + if( !aHD ) + { + iErrorCode = KErrUnknown; + } + + if( aHD && iErrorCode == KErrNone ) + { + iErrorCode = aHD->ErrorCode(); + } + + iSnapshotCount++; + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Snapshot") ); + TestModuleIf().Event( event ); + + _LIT( KMsg2, "Exit PluginSnapshotStatus" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::ActiveWait +// ----------------------------------------------------------------------------- +// +void CContextEnginePluginTest::ActiveWait( TInt aTimeout ) + { + _LIT( KMsg1, "Enter ActiveWait" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TTimeIntervalMicroSeconds32 timeout( aTimeout ); + RTimer timer; + TRequestStatus status; + + timer.CreateLocal(); + timer.After(status,timeout); + + User::WaitForAnyRequest(); + + timer.Close(); + + _LIT( KMsg2, "Exit ActiveWait" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::BeginTestSessionL +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::BeginTestSessionL( CStifItemParser& /* aItem */ ) + { + iMdEClient = NULL; + TRAPD( error, iMdEClient = CMdESession::NewL( *this ) ); + iErrorCode = KErrNone; + + _LIT( KMsg, "Exit BeginTestSession - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, error); + iLog->Log( msg ); + RDebug::Print( msg ); + + iInitCount = 0; + iSnapshotCount = 0; + iInitTarget = 0; + iSnapshotTarget = 0; + + iPluginSet = EFalse; + + User::LeaveIfError( error ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::EndTestSession +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::EndTestSession( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter EndTestSession" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iIds.Close(); + iObjectArray.Close(); + + if ( iContextEngine ) + { + iContextEngine->ReleaseInstance(); + iContextEngine = NULL; + } + + if ( iPlugin ) + { + delete iPlugin; + iPlugin = NULL; + } + + if ( iLocationPlugin && !iPluginSet ) + { + delete iLocationPlugin; + iLocationPlugin = NULL; + } + + if ( iCalendarPlugin ) + { + delete iCalendarPlugin; + iCalendarPlugin = NULL; + } + + if ( iMdEClient ) + { + delete iMdEClient; + iMdEClient = NULL; + } + + iHD = NULL; + + REComSession::FinalClose(); + + if( iInitCount != iInitTarget ) + { + return KErrUnknown; + } + + if( iSnapshotCount != iSnapshotTarget ) + { + return KErrUnknown; + } + + _LIT( KMsg2, "Exit EndTestSession" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return iErrorCode; + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::CreateObjects +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::CreateObjectsL( CStifItemParser& aItem ) + { + CMdENamespaceDef& defaultNamespace = iMdEClient->GetDefaultNamespaceDefL(); + CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); + + // Mandatory parameters for any object. + CMdEPropertyDef& creationDef = imageDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty ); + CMdEPropertyDef& modifiedDef = imageDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty ); + CMdEPropertyDef& sizeDef = imageDef.GetPropertyDefL( MdeConstants::Object::KSizeProperty ); + CMdEPropertyDef& itemTypeDef = imageDef.GetPropertyDefL( MdeConstants::Object::KItemTypeProperty ); + + CMdEPropertyDef& descriptionPropertyDef = imageDef.GetPropertyDefL( MdeConstants::MediaObject::KDescriptionProperty ); + CMdEPropertyDef& widthDef = imageDef.GetPropertyDefL( MdeConstants::MediaObject::KWidthProperty ); + CMdEPropertyDef& heightDef = imageDef.GetPropertyDefL( MdeConstants::MediaObject::KHeightProperty ); + CMdEPropertyDef& makeDef = imageDef.GetPropertyDefL( MdeConstants::Image::KMakeProperty ); + CMdEPropertyDef& modelDef = imageDef.GetPropertyDefL( MdeConstants::Image::KModelProperty ); + + CMdEObject* object = NULL; + TItemId objectId(0); + TTime currTime; + TPtrC inputFile; + TInt count(0); + TBuf <100> msg; + + iIds.Reset(); + + User::LeaveIfError( aItem.GetNextInt( count )); + + for ( TInt i = 0; i < count; ++i ) + { + User::LeaveIfError( aItem.GetNextString( inputFile )); + + // create object + iMdEClient->RemoveObjectL(inputFile); + object = iMdEClient->NewObjectLC(imageDef, inputFile); + + currTime.HomeTime(); + object->AddTimePropertyL(creationDef, currTime); + object->AddTimePropertyL(modifiedDef, currTime); + object->AddUint32PropertyL( sizeDef, 0 ); + object->AddTextPropertyL( itemTypeDef, MdeConstants::Image::KImageObject ); + + objectId = iMdEClient->AddObjectL(*object); + iIds.Append(objectId); + + CleanupStack::PopAndDestroy(object); + object = NULL; + + // open object for modification + TRAPD( openError, object = iMdEClient->OpenObjectL(objectId) ); + + if ( !object || openError != KErrNone ) + { + _LIT( KOpenErr, " ModifyObjects - Open error : %d" ); + msg.Format(KOpenErr, openError); + iLog->Log( msg ); + RDebug::Print(msg); + + User::LeaveIfError(openError); + } + + CleanupStack::PushL( object ); + + // add properties + CMdEProperty* property = NULL; + + // Description + _LIT( KDesc, "Description" ); + object->Property( descriptionPropertyDef, property ); + + if ( property ) + { + property->SetTextValueL( KDesc ); + } + else + { + object->AddTextPropertyL( descriptionPropertyDef, KDesc ); + } + + property = NULL; + + // Width + object->Property( widthDef, property ); + + if ( property ) + { + property->SetUint16ValueL( 100 ); + } + else + { + object->AddUint16PropertyL( widthDef, 100 ); + } + + property = NULL; + + // Height + object->Property( heightDef, property ); + + if ( property ) + { + property->SetUint16ValueL( 100 ); + } + else + { + object->AddUint16PropertyL( heightDef, 100 ); + } + + property = NULL; + + // Maker + object->Property( makeDef, property ); + + _LIT( KOnkia, "Maker" ); + if ( property ) + { + property->SetTextValueL( KOnkia ); + } + else + { + object->AddTextPropertyL( makeDef, KOnkia ); + } + + property = NULL; + + // Model + object->Property( modelDef, property ); + _LIT( KModel, "Model" ); + if ( property ) + { + property->SetTextValueL( KModel ); + } + else + { + object->AddTextPropertyL( modelDef, KModel ); + } + + // Commit object + TRAPD( commitError, iMdEClient->CommitObjectL(*object) ); + if ( commitError != KErrNone ) + { + _LIT( KCommErr, " CreateObjects - Commit error : %d" ); + msg.Format(KCommErr, commitError); + iLog->Log( msg ); + RDebug::Print(msg); + + User::LeaveIfError(commitError); + } + + CleanupStack::PopAndDestroy(object); + object = NULL; + } + + _LIT( KMsg, "Exit EndCreateObjects" ); + iLog->Log( KMsg ); + RDebug::Print( KMsg ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::DeleteObjects +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::DeleteObjectsL( CStifItemParser& /* aItem */ ) + { + ActiveWait( 2000000 ); + + _LIT( KMsg1, "Enter EndDeleteObjects" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt count(0); + count = iIds.Count(); + + for ( TInt i = 0; i < count; ++i ) + { + TInt id = iIds[i]; + iMdEClient->RemoveObjectL( id ); + } + + iIds.Reset(); + + _LIT( KMsg2, "Exit EndDeleteObjects" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::CreateContextEngine1L +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::CreateContextEngine1L( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter CreateContextEngine" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iInitTarget = 1; + + iContextEngine = NULL; + iContextEngine = CContextEngine::GetInstanceL( this ); + + if( !iContextEngine ) + { + User::Leave( KErrUnknown ); + } + + _LIT( KMsg2, "Exit CreateContextEngine" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::CreateContextEngine2L +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::CreateContextEngine2L( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter CreateContextEngine" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iContextEngine = NULL; + iContextEngine = CContextEngine::GetInstanceL(); + + // 4 seconds + TTimeIntervalMicroSeconds32 timeout(4000000); + RTimer timer; + TRequestStatus status; + + timer.CreateLocal(); + timer.After( status,timeout ); + + User::WaitForAnyRequest(); + + timer.Close(); + + if( !iContextEngine ) + { + User::Leave( KErrUnknown ); + } + + _LIT( KMsg2, "Exit CreateContextEngine" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::CreateContextEngine2L +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::ReleaseInstanceL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter ReleaseInstanceL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iContextEngine ) + { + User::Leave( KErrUnknown ); + } + + iContextEngine->ReleaseInstance(); + + iContextEngine = NULL; + + _LIT( KMsg2, "Exit ReleaseInstanceL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::CreateContextEngine2L +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::SetMdeSessionL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter SetMdeSessionL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iInitTarget = 1; + + iContextEngine = NULL; + iContextEngine = CContextEngine::GetInstanceL( this ); + + if( !iContextEngine ) + { + User::Leave( KErrUnknown ); + } + + iContextEngine->SetMdeSession( iMdEClient ); + + if( !iContextEngine || !iMdEClient ) + { + User::Leave( KErrUnknown ); + } + + iContextEngine->SetMdeSession( NULL ); + + if( !iContextEngine ) + { + User::Leave( KErrUnknown ); + } + + _LIT( KMsg2, "Exit SetMdeSessionL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::ContextSnapshots +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::ContextSnapshotsL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "Enter ContextSnapshots" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iSnapshotTarget = 9; + + const TInt KLoopCount = 3; + TInt count = iIds.Count(); + + CMdEObject* mdeObject; + iObjectArray.Reset(); + + // choose if plugin tested, otherwise engine + TPtrC testPlugin; + TBool plugin = EFalse; + User::LeaveIfError( aItem.GetNextString( testPlugin )); + _LIT( pluginString, "plugin" ); + if( testPlugin == pluginString ) + { + plugin = ETrue; + } + + // get object + mdeObject = iMdEClient->GetObjectL( iIds[0] ); + + HBufC* uriBuf = mdeObject->Uri().AllocLC(); + iHD = CHarvesterData::NewL( uriBuf ); + iHD->SetMdeObject( mdeObject ); + CleanupStack::Pop( uriBuf ); + + // snapshots + for ( TInt i = 0; i < KLoopCount; i++ ) + { + if (plugin) + { + iPlugin->ContextSnapshot( *this, *iHD ); + } + else + { + iContextEngine->ContextSnapshot( *this, *iHD ); + } + } + mdeObject = NULL; + + mdeObject = iMdEClient->GetObjectL( iIds[1] ); + uriBuf = mdeObject->Uri().AllocLC(); + iHD = CHarvesterData::NewL( uriBuf ); + iHD->SetMdeObject( mdeObject ); + CleanupStack::Pop( uriBuf ); + + // snapshots + for ( TInt i = 0; i < KLoopCount; i++ ) + { + if (plugin) + { + iPlugin->ContextSnapshot( *this, *iHD ); + } + else + { + iContextEngine->ContextSnapshot( *this, *iHD ); + } + } + mdeObject = NULL; + + mdeObject = iMdEClient->GetObjectL( iIds[2] ); + uriBuf = mdeObject->Uri().AllocLC(); + iHD = CHarvesterData::NewL( uriBuf ); + iHD->SetMdeObject( mdeObject ); + CleanupStack::Pop( uriBuf ); + + // snapshots + for ( TInt i = 0; i < KLoopCount; i++ ) + { + if (plugin) + { + iPlugin->ContextSnapshot( *this, *iHD ); + } + else + { + iContextEngine->ContextSnapshot( *this, *iHD ); + } + } + + _LIT( KMsg2, "Exit ContextSnapshots" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::MultipleSnapshots +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::MultipleSnapshotsL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "Enter MultipleSnapshots" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iSnapshotTarget = 3; + + TInt count = iIds.Count(); + + CMdEObject* mdeObject; + iObjectArray.Reset(); + + // choose if plugin tested, otherwise engine + TPtrC testPlugin; + TBool plugin = EFalse; + User::LeaveIfError( aItem.GetNextString( testPlugin )); + _LIT( pluginString, "plugin" ); + if( testPlugin == pluginString ) + { + plugin = ETrue; + } + + // multiple objects + for ( TInt i = 0; i < count; ++i ) + { + iHD = NULL; + mdeObject = NULL; + + mdeObject = iMdEClient->GetObjectL( iIds[i] ); + HBufC* uriBuf = mdeObject->Uri().AllocLC(); + iHD = CHarvesterData::NewL( uriBuf ); + iHD->SetMdeObject( mdeObject ); + CleanupStack::Pop( uriBuf ); + + iObjectArray.Append( iHD ); + } + + // snapshots + if( plugin ) + { + iPlugin->ContextSnapshot( *this, iObjectArray ); + } + else + { + iContextEngine->ContextSnapshot( *this, iObjectArray ); + } + + _LIT( KMsg2, "Exit MultipleSnapshots" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::PluginCount +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::PluginCount( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter PluginCount" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt count(0); + count = iContextEngine->PluginCount(); + + if( count != 2 ) + { + return KErrNotFound; + } + + _LIT( KMsg, "Exit PluginCount : %d" ); + TBuf <100> msg; + msg.Format(KMsg, count); + iLog->Log( msg ); + RDebug::Print(msg); + + _LIT( KMsg2, "Enter PluginCount" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::Destroy +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::Destroy( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter Destroy" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iContextEngine->Destroy(); + + _LIT( KMsg2, "Exit Destroy" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::ContextEngineStaticData +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::ContextEngineStaticData( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter ContextEngineStaticData" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + const TInt KContextEngineTLSKey = 0x200009f6; + + CContextEngineStaticData* data = static_cast( + UserSvr::DllTls(KContextEngineTLSKey) ); + + if( !data ) + { + return KErrUnknown; + } + + _LIT( KMsg2, "Exit ContextEngineStaticData" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CContextEnginePluginTest::LoadPluginL +// ----------------------------------------------------------------------------- +// +TInt CContextEnginePluginTest::LoadPluginL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter LoadPlugins" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iInitTarget = 2; + + TUid calendarContextUID = { 0x102823CB }; // calendar context plugin uid + TUid locationContextUID = { 0x200071D0 }; // location context plugin uid + + RImplInfoPtrArray infoArray; + + TCleanupItem cleanupItem( MdsUtils::CleanupEComArray, &infoArray ); + CleanupStack::PushL( cleanupItem ); + + CContextPlugin::ListImplementationsL( infoArray ); + TInt count( 0 ); + count = infoArray.Count(); + + TBool locationPluginFound( EFalse ); + TBool calendarPluginFound( EFalse ); + for ( TInt i=0; i < count; i++ ) + { + TUid uid = infoArray[i]->ImplementationUid(); + + // context plugin found + if( uid == locationContextUID ) + { + iLocationPlugin = CContextPlugin::NewL( uid ); + iLocationPlugin->SetMdeSession(*iMdEClient); + iLocationPlugin->Init(*this); + locationPluginFound = ETrue; + iPlugin = iLocationPlugin; + iPluginSet = ETrue; + } + else if( uid == calendarContextUID ) + { + iCalendarPlugin = CContextPlugin::NewL( uid ); + iCalendarPlugin->SetMdeSession(*iMdEClient); + iCalendarPlugin->Init(*this); + calendarPluginFound = ETrue; + } + } + + CleanupStack::PopAndDestroy( &infoArray ); // infoArray, results in a call to CleanupEComArray + + if( !locationPluginFound ) + { + _LIT( KLocation, "Location context plugin not found" ); + iLog->Log( KLocation ); + RDebug::Print( KLocation ); + return KErrNotFound; + } + + if( !calendarPluginFound ) + { + _LIT( KCalendar, "Calendar context plugin not found" ); + iLog->Log( KCalendar ); + RDebug::Print( KCalendar ); + return KErrNotFound; + } + + _LIT( KMsg2, "Exit LoadPlugins" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// [End of File] - Do not remove diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + + +#include "../context_engine_plugin_api/group/bld.inf" +#include "../harvester_framework_api/group/bld.inf" +#include "../location_manager_api/group/bld.inf" +#include "../metadata_engine_api/group/bld.inf" +#ifdef RD_MDS_2_5 +#include "../content_listing_framework_collection_manager_api/group/bld.inf" +#include "../content_listing_framework_extended_api/group/bld.inf" +#endif + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + + +#include + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS +../inc/composerplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(composerplugin.h) +../inc/harvesterclient.h MW_LAYER_PLATFORM_EXPORT_PATH(harvesterclient.h) +../inc/harvesterclientdata.h MW_LAYER_PLATFORM_EXPORT_PATH(harvesterclientdata.h) +../inc/placeholderdata.h MW_LAYER_PLATFORM_EXPORT_PATH(placeholderdata.h) +../inc/harvesterdata.h MW_LAYER_PLATFORM_EXPORT_PATH(harvesterdata.h) +../inc/harvesterplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(harvesterplugin.h) +../inc/monitorplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(monitorplugin.h) +../inc/harvestereventenum.h MW_LAYER_PLATFORM_EXPORT_PATH(harvestereventenum.h) +../inc/harvesterpauseps.h MW_LAYER_PLATFORM_EXPORT_PATH(harvesterpauseps.h) + +PRJ_MMPFILES + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/harvester_framework_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/harvester_framework_api.metaxml Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,17 @@ + + +harvester_framework_api +harvester framework api +c++ +harvester + + + + + + + +no +no + + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/inc/composerplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/inc/composerplugin.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Composer Plug-in ECom interface +* +*/ + +#ifndef __CCOMPOSERPLUGIN_H__ +#define __CCOMPOSERPLUGIN_H__ + +#include +#include +#include + +#include + +/** @var Uid for this interface */ +const TUid KCComposerPluginInterfaceUid = { 0x2000717E }; + + /** + * Composer Plug-in ECom interface definition. Composer plug-in implementation + * needs to inherit this class and implement the pure virtual methods which exist + * in this interface. + * + * Example: + * + * class CMyVideoComposerPlugin: public CComposerPlugin + * { + * protected: + * void SetObservers(); + * void RemoveObservers(); + * + * // Because CComposerPlugin inherits MMdEObjectObserver + * void HandleObjectNotification(CMdESession& aSession, + * TObserverNotificationType aType, + * const RArray& aObjectIdArray); + * + * private: + * // Active object which does the actual binary writing + * // so that this interface and its observers remain responsive + * CMyVideoComposerAO* iVideoComposerAO; + * } + * + * void SetObservers() + * { + * // We want to listen to changes in Video metadata objects + * // and setup an observer for this + * CMdENamespaceDef& defaultNamespace = iSession->GetDefaultNamespaceDefL(); + * CMdEObjectDef& videoDef = + * defaultNamespace.GetObjectDefL( MdeConstants::Video::KVideoObject ); + * CMdELogicCondition* condition = CMdELogicCondition::NewL( ELogicConditionOperatorAnd ); + * condition->AddObjectConditionL( videoDef ); + * + * // iSession is reference to CMdESession which is always set in CComposerPlugin::SetSession() + * iSession->AddObjectObserverL( *this, condition, ENotifyModify, &defaultNamespace ); + * } + * + * void RemoveObservers() + * { + * iSession->RemoveObjectObserverL( *this ) + * } + * + * void CComposerImagePlugin::HandleObjectNotification(CMdESession& aSession, + * TObserverNotificationType aType, const RArray& aObjectIdArray) + * { + * // We give ID-array of changed Video objects to our active object + * // which adds then to a its internal queue and processes them one-by-one + * // with different RunL-calls so that we don't stuck the thread by composing + * // for example 1000 binary files in a row. + * iVideoComposerAO->AddToQueue( aObjectIdArray ); + * } + */ +class CComposerPlugin : public CBase, public MMdEObjectObserver + { + public: + + /** + * Construction. + * + * @param aUid Implementation UID which plug-in to invoke. + */ + IMPORT_C static CComposerPlugin* NewL( const TUid& aUid ); + + /** + * Lists all available implementations which satisfy this given interface. + * + * @param aImplInfoArray Reference to a list which will be populated with + * plug-in implementation details. + */ + IMPORT_C static void ListImplementationsL(RImplInfoPtrArray& aImplInfoArray); + + /** + * Destructor. + */ + IMPORT_C virtual ~CComposerPlugin(); + + /** + * Sets Mde session to be used. + * + * @param aSession Open MdE session to utilize in the Composer plug-in + */ + IMPORT_C void SetSession( CMdESession& aSession ); + + /** + * Unsets Mde session. + */ + IMPORT_C void RemoveSession(); + + /** + * Checks if composing is completed. + * + * @return Whether composing is on-going + */ + virtual TBool IsComposingComplete() = 0; + + protected: + + /** + * Sets observers to be notified. Called by the interface itself when + * SetSession method is called from Harvester server side. + */ + virtual void SetObservers() = 0; + + /** + * Unsets observers. Called by the interface itself when + * RemoveSession method is called from Harvester server side. + */ + virtual void RemoveObservers() = 0; + + protected: + + /* Pointer to Mde session used by the plugin */ + CMdESession* iSession; + + private: + + /* Identification on cleanup */ + TUid iDtor_ID_Key; + }; + +#endif // __CCOMPOSERPLUGIN_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/inc/harvesterclient.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/inc/harvesterclient.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,385 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Harvester client header +* +*/ + + +#ifndef __HARVESTER_CLIENT_H__ +#define __HARVESTER_CLIENT_H__ + +#include + +#include +#include +#include + +// forward declarations +class CHarvesterClientAO; +class CHarvesterSessionAsyncHandler; +class CHarvesterEventObserverAO; +class MHarvesterEventObserver; +class CHarvesterRequestActive; +class CHarvesterRequestQueue; +class MHarvesterSessionObserver; +class CHarvesterSessionWatcher; + +// default event interval for MHarvesterEventObserver +const TInt KHarvesterEventInterval = 20; + +/** + * Observer interface to inform when fast harvesting is completed + * with the HarvestingComplete callback. + * + * Example of MHarvestObserver and RHarvesterClient::HarvestFile usage: + * + * Client application (like Camera) which wants to observe the completion of + * harvesting requests (issued with RHarvesterClient::Harvestile method) needs + * implement the interface MHarvestObserver::HarvestingComplete. Callback + * HarvestingComplete provides the name of the harvested file (aURI) and also possible + * error code (aError). + * + * class CHarvestingObserver : public MHarvestObserver + * { + * void HarvestingComplete( TDesC& aURI, TInt aError ); // from MHarvestObserver + * void IssueHarvestingRequests(); + * + * RHarvesterClient iHClient; + * } + * + * void CHarvestObserver::ConstructL() + * { + * // connecting to Harvester server + * iHClient.Connect(); + * } + * + * void CHarvestObserver::IssueHarvestingRequests() + * { + * // new harvesting request data + * _LIT( KNewFile, "C:\\Data\\ThisIsANewFile1.jpg" ); + * RArray defaultPhotoAlbums; + * defaultPhotoAlbums.Append( 123 ); + * defaultPhotoAlbums.Append( 456 ); + * defaultPhotoAlbums.Append( 789 ); + * + * // setting this class as the observer for the fast harvesting calls + * iHClient.SetObserver(this); + * + * // issué new harvesting request and requesting location data to be harvested + * iHClient.HarvestFile( KNewFile, defaultPhotoAlbums, ETrue ); + * } + * + * void CHarvestObserver::HarvestingComplete( TDesC& aURI, TInt aError ) + * { + * _LIT( KExpectedFile, "C:\\Data\\ThisIsANewFile1.jpg" ); + * + * // Checking if an error occurred and if this was the expected file + * if ((aError == KErrNone) && (aURI.CompareC(KExpectedFile) == 0)) + * { + * // do something + * } + * } + * + */ +class MHarvestObserver + { +public: + /** + * Callback to inform when fast harvesting of a file is complete. + * + * @param aURI URI of the harvested file. + * @param aError Error code of the fast harvesting. KErrNone is + * expected if fast harvesting succeeded. Otherwise some + * system wide error code. + * + */ + virtual void HarvestingComplete( TDesC& aURI, TInt aError ) = 0; + }; + +/** + * Observer interface to inform about events that happen inside the observer framework + * + * Example of MHarvesterEventObserver, RHarvesterClient::AddHarvesterEventObserver and + * RHarvesterClient::RemoveHarvesterEventObserver usage: + * + * void CHarvestObserver::ConstructL() + * { + * // iHClient is instance of RHarvesterClient + * iHClient.Connect(); + * + * // Listen to placeholder changes to "full" metadata objects - request notification + * // after 100 items have changed. + * TInt err = iHClient.AddHarvesterEventObserver( *this, EHEObserverTypePlaceholder, 100 ); + * if (err == KErrNone) + * { + * // do something now that event observer is setup + * } + * } + * + * void CHarvestObserver::HarvestingUpdated( HarvesterEventObserverType aHEObserverType, + * HarvesterEventState aHarvesterEventState, TInt aItemsLeft ) + * { + * // Check the observer notification type + * if (aHEObserverType == EHEObserverTypePlaceholder) + * { + * // Checking if there are more than 1000 items left to process + * if (aItemsLeft > 1000) + * { + * // do something since there are some many items still placeholders + * } + * if (aItemsLeft == 0) + * { + // all placeholders changed to "full" objects - do something... + * } + * } + * } + * + * CHarvestObserver::~CHarvestObserver() + * { + * // Removing the observer in destructor + * iHClient.RemoveHarvesterEventObserver( *this ); + * } + */ + + +class MHarvesterEventObserver + { +public: + /** + * Callback interface which informs about harvesting changes based on the observers + * that the end user has setup/registered. + * + * @param aHEObserverType Defines the observer type to which this events is related + * @param aHarvesterEventState Event that occurred + * @param aItemsLeft Number of items left regarding the harvesting procedure (defined + * by aHEObserverType) + * @see RHarvesterClient::AddHarvesterEventObserver + * @see RHarvesterClient::RemoveHarvesterEventObserver + */ + virtual void HarvestingUpdated( + HarvesterEventObserverType aHEObserverType, + HarvesterEventState aHarvesterEventState, + TInt aItemsLeft ) = 0; + }; + +class MHarvesterSessionObserver + { +public: + + /** + * Called to notify the observer that harvester server has been terminated, + * thus harvester server sessions created are now invalid and new connection + * needs to be established + * NOTE! Cliens still have to call Close() on the session to release client side + * resources. + */ + virtual void HarvesterServerTerminated() = 0; + }; + +/** + * Harvester client session class which provides also means to: + * - Pause/resume the Harvesting framework + * - Fast harvest files and observe when they have been harvested + * - Setup observers to observe the harvesting progress + */ +NONSHARABLE_CLASS( RHarvesterClient ) : public RSessionBase + { + friend class CHarvesterSessionAsyncHandler; + friend class CHarvesterEventObserverAO; + + public: + + /** + * Constructor + */ + IMPORT_C RHarvesterClient(); + + /** + * Public method to connect Harvester server. + * + * @return Symbian OS error code. + */ + IMPORT_C TInt Connect(); + + /** + * Public method to pause the operation + * of the Harvester framework. + * + * @return Symbian OS error code. + */ + IMPORT_C TInt Pause(); + + /** + * Public method to resume the operation + * of the Harvester framework. + * + * @return Symbian OS error code. + */ + IMPORT_C TInt Resume(); + + /** + * Public method to close session to Harvester server. + */ + IMPORT_C void Close(); + + /** + * Public method to set observer for fast harvesting. + * Only one observer is currently supported. + * + * @param aObserver Pointer to the observer + */ + IMPORT_C void SetObserver( MHarvestObserver* aObserver); + + /** + * Public method to remove observer for fast harvesting. + * + * @param aObserver Pointer to the observer + */ + IMPORT_C void RemoveObserver( MHarvestObserver* aObserver); + + /** + * Public method for doing fast harvesting. These files + * are handled first before the ones that are in the harvesting + * queue inside the Harvesting framework. + * + * @param aURI Uri of the file to be harvested + * @param aAlbumIds Array of album id's that the harvested file + * will be included in + * @param aAddLocation Should location information be added to item + */ + IMPORT_C void HarvestFile( const TDesC& aURI, RArray &aAlbumIds, TBool aAddLocation ); + + /** + * Method for adding observer for harvester framework events + * + * @param aHarvesterEventObserver class to implement MHarvesterEventObserver interface + * @param aHEObserverType Harvester event observer type (EPlaceholderState, + * EMMCState, EOverallState) + * @param aEventInterval Interval of harvester events as item amount + * + * @return Symbian OS wide error code. + */ + IMPORT_C TInt AddHarvesterEventObserver( + MHarvesterEventObserver& aHarvesterEventObserver, + TInt aHEObserverType, + TInt aEventInterval = KHarvesterEventInterval ); + + /** + * Method for removing observer for harvester framework events. Please note that + * removing any of the event observers will remove all observers which are registered + * by the given parameter aHarvesterEventObserver (= observer class). + * + * @param aHarvesterEventObserver class to implement MHarvesterEventObserver interface + * + * @return Symbian OS wide error code. + */ + IMPORT_C TInt RemoveHarvesterEventObserver( MHarvesterEventObserver& aHarvesterEventObserver ); + + /** + * Public method for doing fast harvesting. These files + * are handled first before the ones that are in the harvesting + * queue. + * + * @param aURI Uri of the file to be harvested + * @param aAlbumIds Array of album id's that the harvested file will be included in + * @param aAddLocation Should location information be added to image + * @param aUid Uid of the originating application for the object + */ + IMPORT_C void HarvestFileWithUID( const TDesC& aURI, + RArray &aAlbumIds, + TBool aAddLocation, + TUid aUid ); + + /** + * Public method to set observer for notifications about harvester server termination. + * Only one observer at a time is currently supported. + * + * @param aObserver Pointer to the observer + */ + IMPORT_C void AddSessionObserverL( MHarvesterSessionObserver& aObserver ); + + /** + * Public method to remove harvester session observer + */ + IMPORT_C void RemoveSessionObserver(); + + /** + * Requests a harvest complete event from harvester server. + * On return, aURI is the URI of the harvested file. + * + * @param aURI Harvested image uri what server + * @param aStatus Reference to a request indicator + */ + void RegisterHarvestComplete( TDes& aURI, TRequestStatus& aStatus ); + + /** + * Cancels the harvest complete notification request. + */ + void UnregisterHarvestComplete( ); + + /** + * Private method for doing fast harvesting. These files + * are handled first before the ones that are in the harvesting + * queue. + * + * @param aService Service request which to execute on server side + * @param aArgs Parameters for harvesting + * @param aStatus Status of the asunchronous call + */ + void HarvestFile( TInt& aService, TIpcArgs& aArgs, TRequestStatus& aStatus ); + + /** + * Restricted method for doing fast harvesting. These files + * are handled first before the ones that are in the harvesting + * queue. This version forces the file to be harvested immidiately. + * + * @param aService Service request which to execute on server side + * @param aArgs Parameters for harvesting + */ + void ForceHarvestFile( TInt& aService, TIpcArgs& aArgs ); + + private: + + /** + * Observer of the class + */ + MHarvestObserver* iObserver; + + /** + * Private method for version. + */ + TVersion Version() const; + + /** + * Harvester client active object. + */ + CHarvesterClientAO* iHarvesterClientAO; + + /** + * Pointer to Harvester event observer active object. + */ + CHarvesterEventObserverAO* iHEO; + + /** + * Request queue processor. + */ + CHarvesterRequestQueue* iRequestQueue; + + /** + * Harvester session observer AO. + */ + CHarvesterSessionWatcher* iSessionWatcher; + }; + +#endif // __HARVESTER_CLIENT_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/inc/harvesterclientdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/inc/harvesterclientdata.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Data transfer object for harvest client data + * +*/ + + +#ifndef HARVESTERCLIENTDATA_H +#define HARVESTERCLIENTDATA_H + +// INCLUDES +#include +#include + +#include + +// FORWARD DECLARATIONS + +// ENUMERATIONS + + +/** + * CHarvestClientData + */ +NONSHARABLE_CLASS( CHarvestClientData ) : public CBase + { + public: + /** + * New. + * @return Pointer to newly created object. + */ + IMPORT_C static CHarvestClientData* New(); + + /** + * NewL. + * Leaving version of New(). + * + * @return Pointer to newly created object. + */ + IMPORT_C static CHarvestClientData* NewL(); + + /** + * Destructor. + */ + ~CHarvestClientData(); + + /** + * Set album ids. + * + * @param aAlbumIds Array of album ids to set. + */ + IMPORT_C void SetAlbumIds( const RArray& aAlbumIds ); + + private: + /** + * Constructor. + */ + CHarvestClientData(); + + public: // data + RArray iAlbumIds; + }; + +#endif // HARVESTERCLIENTDATA_H + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/inc/harvesterdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/inc/harvesterdata.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,382 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Data transfer object for harvest data + * +*/ + + +#ifndef HARVESTERDATA_H +#define HARVESTERDATA_H + +// INCLUDES +#include +#include +#include +#include +#include + +#include +#include + +#include "mdeconstants.h" + +// FORWARD DECLARATIONS +class CContextEngine; +class CHarvesterBlacklist; +class CMdEObject; +class CHarvesterPluginInfo; +class CHarvesterData; + +// ENUMERATIONS +enum THarvesterEventType + { + EHarvesterAdd, // New item to harvest + EHarvesterEdit, // Re-harvest existing item + EHarvesterDelete, // Delete item + EHarvesterUnknown // Unknown command + }; + +enum THarvesterObjectType + { + ENormal, // Normal harvesting + EPlaceholder, // Placeholder harvesting + EFastHarvest // Fast harvesting - Harvester client request + }; + +/** + * Observer interface for notifications of harvesting completion from Harvesting + * plug-ins to Harvester server side + */ +class MHarvesterPluginObserver + { + public: + /** + * Called when harvesting of a file/item is completed + * + * @param aHarvesterData Pointer to harvesting related data/harvesting request data + */ + virtual void HarvestingCompleted( CHarvesterData* aHarvesterData ) = 0; + }; + +/** + * Observer interface for adding new harvesting requests to Harvester server queue from + * Monitor plug-ins + */ +class MMonitorPluginObserver + { + public: + /** + * Method which is called by the monitor plug-in when event is monitored/ + * new harvesting request inserted to Harvester server queue. + * + * @param aHarvesterData harvester data type + */ + virtual void MonitorEvent( CHarvesterData* aHarvesterData ) = 0; + + /** + * Method which is called by the monitor plug-in when event is monitored/ + * new harvesting request inserted to Harvester server queue. + * + * @param aHarvesterDataArray Pointer to an array of harvesting related + * data/harvesting request data + */ + virtual void MonitorEvent( RPointerArray& aHarvesterDataArray ) = 0; + }; + +/** + * Class that encapsulates harvesting related data/harvesting request data. These instances + * are moved around the MdS Harvesting framework and this class encapsulates all information + * needed when harvesting a file/item. + * + */ +NONSHARABLE_CLASS( CHarvesterData ) : public CBase + { + public: + + /** + * Destructor. + */ + ~CHarvesterData(); + + /** + * Two-phased constructor. + * + * @param aUri URI of the file, usually filename. With messages can be messageID. + */ + IMPORT_C static CHarvesterData* NewL(const HBufC* aUri); + + /** + * Two-phased constructor. + * + * @param aUri URI of the file, usually filename. With messages can be messageID. + */ + IMPORT_C static CHarvesterData* NewLC(const HBufC* aUri); + + /** + * Method returns the URI. + * + * @return URI. + */ + IMPORT_C const TDesC& Uri(); + + /** + * Method returns error code of harvesting. + * + * @return harvesting error code. + */ + IMPORT_C TInt ErrorCode(); + + /** + * Method sets the error code for harvesting. + * + * @param aErrorCode Error code for harvesting + */ + IMPORT_C void SetErrorCode(TInt aErrorCode); + + /** + * Method sets harvesting type. + * + * @param aEventType Harvesting type + */ + IMPORT_C void SetEventType(THarvesterEventType aEventType); + + /** + * Method returns harvesting type. + * + * @return Harvesting type + */ + IMPORT_C THarvesterEventType EventType(); + + /** + * Method sets observer for this harvesting request (Harvester server) + * + * @param aObserver Pointer to the harvesting observer in the harvesting FW + */ + IMPORT_C void SetPluginObserver(MHarvesterPluginObserver& aObserver); + + /** + * Method returns pointer to the harvesting observer (Harvester server). + * + * @return Pointer to harvesting observer + */ + IMPORT_C MHarvesterPluginObserver* PluginObserver(); + + /** + * Method sets the origin information for the file/item. + * + * @param aOrigin Origin of the file/item. + */ + IMPORT_C void SetOrigin(TOrigin aOrigin); + + /** + * Method returns origin of the file/item. + * + * @return Origin of the file/item. + */ + IMPORT_C TOrigin Origin(); + + /** + * Method sets flag whether Context snapshot (with Context Engine) + * is required during harvesting. + * + * @param aTakeSnapshot Whether Context snapshot is required or not. + */ + IMPORT_C void SetTakeSnapshot(TBool aTakeSnapshot); + + /** + * Method returns whether Context snapshot is required or not. + * + * @return Whether Context snapshot is required or not. + */ + IMPORT_C TBool TakeSnapshot(); + + /** + * Method sets (object) type of the harvesting procedure. + * + * @param aObjectType Type of the harvesting procedure. + */ + IMPORT_C void SetObjectType(THarvesterObjectType aObjectType); + + /** + * Method retursn the (object) type of the harvesting procedure. + * + * @return Type of the harvesting procedure. + */ + IMPORT_C THarvesterObjectType ObjectType(); + + /** + * Method sets the custom harvesting data from client. + * + * @param aClientData Custom harvesting data from client. + */ + IMPORT_C void SetClientData(CBase* aClientData); + + /** + * Method returns the custom harvesting data (received from client) + * + * @return Custom harvesting data (received from client) + */ + IMPORT_C CBase* ClientData(); + + /** + * Method sets metadata object which will be used to store the metadata + * in the harvesting plug-in. + * + * @param aMdeObject Pointer to the metadata object that will be used + * to store the metadata from the file/item. + */ + IMPORT_C void SetMdeObject( CMdEObject* aMdeObject ); + + /** + * Method returns the metadata objects which is used to store the metadata + * from the file/item that is harvested. + * + * @return Metadata object that is used to store the metadata. + */ + IMPORT_C CMdEObject& MdeObject(); + + /** + * Method sets location metadadata (GPS). + * + * @param aLD Pointer to the location metadata structure. + */ + IMPORT_C void SetLocationData( TLocationData* aLD ); + + /** + * Method returns the location metadata structure. + * + * @return Location metadata structure. + */ + IMPORT_C TLocationData* LocationData(); + + /** + * Method sets the client application UID. + * + * @param aClientId Client application UID. + */ + IMPORT_C void SetClientId(TUid aClientId); + + /** + * Method returns the client application UID. + * + * @return Client application UID. + */ + IMPORT_C TUid ClientId(); + + /** + * Method returns whether location data should be added to + * MdE DB or not. + * + * @return Flag which defines whether location data needs to + * be added or not. + */ + IMPORT_C TBool AddLocation(); + + /** + * Method sets a flag which defines whether location data + * should be added to MdE DB or not. + * + * @param aAdd Client application UID. + */ + IMPORT_C void SetAddLocation( TBool aAdd ); + + /** + * Method sets harvesting plug-in information which + * is needed to carry out the harvesting procedure + * + * @param aPluginInfo Pointer to harvester plug-in info structure. + */ + IMPORT_C void SetHarvesterPluginInfo( CHarvesterPluginInfo* aPluginInfo ); + + /** + * Method returns harvester plug-in info structure. + * + * @return Harvester plug-in info structure. + */ + IMPORT_C CHarvesterPluginInfo* HarvesterPluginInfo(); + + /** + * Method returns whether item in harvesting is a binary file. + * + * @return Whether item in harvesting is a binary file. + */ + IMPORT_C TBool IsBinary(); + + /** + * Method sets a flag determinning + * + * @param aPluginInfo Pointer to harvester plug-in info structure. + */ + IMPORT_C void SetBinary( TBool aValue ); + + + private: + + /** + * Constructor for performing 1st stage construction + * + * @param aUri URI of the item ie. filename. + */ + CHarvesterData(const HBufC* aUri); + + /** + * Default constructor for performing 2nd stage construction + */ + void ConstructL(); + + /* URI descriptor */ + const HBufC* iUri; + + /* Harvesting error code */ + TInt iErrorCode; + + /* Harvesting event type */ + THarvesterEventType iEventType; + + /* Harvesting observer ie. Harvester server */ + MHarvesterPluginObserver* iObserver; + + /* Origin of the file/item */ + TOrigin iOrigin; + + /* Whether Context snapshot is needed */ + TBool iTakeSnapshot; + + /* Object type for harvesting */ + THarvesterObjectType iObjectType; + + /* Custom client data */ + CBase* iClientData; + + /* Pointer to metadata object */ + CMdEObject* iMdeObject; + + /* Harvesting plug-in info */ + CHarvesterPluginInfo* iPluginInfo; + + /* GPS and other location related data */ + TLocationData* iLocationData; + + /* Whether location data needs to be added to DB */ + TBool iAddLocation; + + /* Whether item to harvest is a binary file */ + TBool iIsBinary; + + /* Executable UID which created the binary file */ + TUid iClientId; + }; + +#endif // HARVESTERDATA_H + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/inc/harvestereventenum.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/inc/harvestereventenum.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef HARVESTEREVENTENUM_H_ +#define HARVESTEREVENTENUM_H_ + +enum HarvesterEventObserverType + { + EHEObserverTypePlaceholder = 1, // Observing placeholder changes to normal object + EHEObserverTypeMMC = 2, // Observing MMC handling start and stop + EHEObserverTypeOverall = 4 // Observing overall status of the harvesting + }; + +enum HarvesterEventState + { + EHEStateStarted, // Harvesting starting + EHEStateHarvesting, // Harvesting on-going + EHEStateFinished, // Harvesting finished + EHEStateUninitialized, // Harvesting not initialized + EHEStatePaused, // Harvesting paused + EHEStateResumed // Harvesting resumed + }; + +#endif /*HARVESTEREVENTENUM_H_*/ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/inc/harvesterpauseps.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/inc/harvesterpauseps.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,33 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: P&S key for harvester server pause +* +*/ + +#ifndef HARVESTERPAUSEPS_H_ +#define HARVESTERPAUSEPS_H_ + +const TUid KPsHarvesterPauseCategory = { 0x200009F5 }; + +// observed by harvester server +const TUint KPsHarvesterPauseKey = 0x00000001; + +enum TPsHarvesterPauseState + { + EPsHarvesterPauseResume = 0, // Resume harvesting + EPsHarvesterPausePause // Pause harvesting + }; + +#endif /*HARVESTERPAUSEPS_H_*/ + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/inc/harvesterplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/inc/harvesterplugin.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,277 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definition of the Harvester plug-in ECom interface.* +*/ + +#ifndef __CHARVESTERPLUGIN_H__ +#define __CHARVESTERPLUGIN_H__ + +#include +#include + +// forward declarations +class CMdESession; +class CHarvesterBlacklist; +class CHarvesterData; +class CMdEPropertyDef; +class CHarvesterPluginFactory; + +// Uid for this interface +const TUid KCHarvesterPluginInterfaceUid = { 0x200009F8 }; + +struct THarvestResult + { + HBufC16* iUri; // URI of the file/item + TInt iErrorCode; // Harvesting error code + }; + +/** + * Harvester Plug-in ECom interface definition. Harvester plug-in implementation + * needs to inherit this class and implement the pure virtual method (HarvestL) which exist + * in this interface. + * + * Example: + * + * class CMyHarvesterPlugin: public CHarvesterPlugin + * { + * public: + * + * // This method should also be overwritten in the plug-in + * void GetObjectType( const TDesC& aUri, TDes& aObjectType ); + * + * void HarvestL( CHarvesterData* aHD ); + * } + * + * void GetObjectType( const TDesC& aUri, TDes& aObjectType ) + * { + * // Idea in this method is that it MUST return one of the object types + * // supported by the MdE DB - for example "Image", "Video" or "Audio". + * // If plug-in supports only one type of objects then it can just return + * // always that like: + * // TPtrC ptrImage( KImage ); + * // aObjectType.Copy( KImage ); return; + * // + * // However if multiple MdE object types are supported then file content + * // needs to be checked for example from file MIME-type like here: + * + * TRAPD( err, content = CContent::NewL( aUri ) ); + * if (err == KErrNone) + * { + * err = content->GetStringAttribute( EMimeType, mime ); + * delete content; + * } + * + * TPtrC ptrImage( KImage ); + * + * // MdsUtils::Find tries to find word "image" from the MIME-type + * // so that we know the file is an image + * if( MdsUtils::Find( mime, ptrImage ) != KErrNotFound ) + * { + * WRITELOG1( "CHarvesterOMADRMPlugin::GetObjectType - mimetype %S. Object type changed to Image", &mime ); + * aObjectType.Copy( KImage ); + * return; + * } + * + * TPtrC ptrVideo( KVideo ); + * if( MdsUtils::Find( mime, ptrVideo ) != KErrNotFound ) + * { + * WRITELOG1( "CHarvesterOMADRMPlugin::GetObjectType - mimetype %S. Object type changed to Video", &mime ); + * aObjectType.Copy( KVideo ); + * return; + * } + * } + * + * void HarvestL( CHarvesterData* aHD ) + * { + * CMdEObject& mdeObject = aHD->MdeObject(); + * + * CMdeObjectWrapper* wrapper = CMdeObjectWrapper::NewL(); + * } + */ +class CHarvesterPlugin : public CActive + { +public: + + enum THarvesterState + { + EHarvesterIdle = 0, // No harvesting requests to process + EHarvesterGathering, // Harvesting a file + }; + + /** + * Construction + */ + IMPORT_C static CHarvesterPlugin* NewL( const TUid& aUid ); + + /** + * Lists all available implementations which satisfy this given interface. + * + * @param aImplInfoArray Reference to a list which will be populated with + * plug-in implementation details. + */ + IMPORT_C static void ListImplementationsL( RImplInfoPtrArray& aImplInfoArray ); + + /** + * Destructor - virtual and class not intended + * for derivation, so not exported. + */ + IMPORT_C virtual ~CHarvesterPlugin(); + + /** + * Method sets the Harvesting queue to the plug-in. + * + * @param aQueue Queue which contains harvesting requests. + */ + IMPORT_C virtual void SetQueue( RPointerArray& aQueue ); + + /** + * Method which starts the harvesting of the file. Called by the + * harvesting framework from CHarvesterPluginFactory::HarvestL. + */ + IMPORT_C virtual void StartHarvest(); + + /** + * Method which returns the MdE object type to harvesting FW when passing the file + * name to this method (aURI). The harvesting plug-in should overwrite method. In the + * case there are more than one plug-ins which support same file extension atleast + * one of these plug-ins needs to read the binary file for determining the valid MdE + * object type for the file. + * + * @param aUri URI of the file/item. + * @param aObjectType Reference to an object type which will returned to the FW + * from the plug-in + */ + IMPORT_C virtual void GetObjectType( const TDesC& aUri, TDes& aObjectType ); + + /** + * Method for setting the blacklisting functionality for the plug-in. + * + * @param aBlacklist Reference to blacklisting component. + */ + IMPORT_C virtual void SetBlacklist( CHarvesterBlacklist& aBlacklist ); + + /** + * Method to stop harvester plugin if needed. + */ + IMPORT_C virtual void StopHarvest(); + +protected: + + /** + * The method which does the actual harvesting. Harvesting plug-in MUST + * implelemt this method. + * + * @param aHD Pointer to harvesting data/request. + */ + IMPORT_C virtual void HarvestL( CHarvesterData* aHD ) = 0; + + /** + * Active object RunL implementation. + */ + IMPORT_C virtual void RunL(); + + /** + * Active object DoCancel implementation. + */ + IMPORT_C virtual void DoCancel(); + + /** + * Active object RunError implementation. + */ + IMPORT_C virtual TInt RunError( TInt aError ); + + /** + * Construction of the interface class + */ + void ConstructL(); + + /** + * Constuctor + */ + IMPORT_C CHarvesterPlugin(); + +public: + + /** + * Method for getting the mime type for given uri + */ + IMPORT_C virtual void GetMimeType( const TDesC& aUri, TDes& aMimeType ); + + /** + * Method for adding reference to harvester plugin factory + */ + IMPORT_C void SetHarvesterPluginFactory( CHarvesterPluginFactory& aFactory ); + + /** + * Method for checking if the plugin is in idle state + */ + IMPORT_C TBool PluginInIdleState(); + +private: + + /** + * Sets next state for the active object + * + * @param aState Next state to execute with RunL. + */ + void SetNextRequest( THarvesterState aState ); + + /** + * Method sets some default properties to the metadata object + * + * @param aData Pointer to harvesting data/request. + */ + void SetDefaultPropertiesL(CHarvesterData& aData); + +protected: + + /** + * Handle to File server session. + */ + RFs iFs; + + /** + * State of this active object. + */ + THarvesterState iState; + + /** + * Pointer to Harvesting request queue. + */ + RPointerArray* iQueue; + + /** + * Pointer to blacklisting functionality + */ + CHarvesterBlacklist* iBlacklist; + + // Not own + CHarvesterPluginFactory* iFactory; + + TBool iFastModeEnabled; + +private: + + /* Identification on cleanup */ + TUid iDtor_ID_Key; + + CMdEPropertyDef* iOriginPropertyDef; + CMdEPropertyDef* iTitlePropertyDef; + + TBool iHarvesting; + TBool iPaused; + + }; + +#endif // __CHARVESTERPLUGIN_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/inc/monitorplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/inc/monitorplugin.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,191 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definition of the Monitor plug-in ECom interface.* +*/ + +#ifndef __MONITORPLUGIN_H__ +#define __MONITORPLUGIN_H__ + +#include +#include + +#include + +// FORWARD DECLARATION +class CMdESession; +class CContextEngine; +class CHarvesterPluginFactory; + +// Uid for this interface +const TUid KMonitorPluginInterfaceUid = { 0x20007181 }; + +class TMountData + { + public: + enum TMountType + { + EMount, // Drive was mounted + EUnmount, // Drive was unmounted + EFormat // Drive was formatted + }; + + TMountType iMountType; // See above + TUint32 iMediaID; // Storage MediaID - TVolumeInfo::iUniqueID + TBuf<2> iDrivePath; // Drive letter + }; + +/** + * Monitor Plug-in ECom interface definition. Monitor plug-in implementation + * needs to inherit this class and implement the pure virtual methods which exist + * in this interface. All monitor plug-ins are provided a reference to the Harvester + * server (MMonitorPluginObserver) which hanles the new harvesting requests, open session + * to MdE for DB maintenance operations, pointer to ContextEngine and a pointer Harvester + * plug-in factory. + * + * Example: + * + * // interface for notifying Monitor plug-in about new files + * class MMonitorNotifier + * { + * public: + * /** + * * Called when we notice a new file/item + * * + * * @param aHarvesterData Pointer to harvesting related data/harvesting request data + * * + * virtual void NewFile( CHarvesterData* aHarvesterData ) = 0; + * } + * + * // Monitor plug-in implementation + * class CMyMonitorPlugin: public CMonitorPlugin, public MMonitorNotifier + * { + * public: + * TBool StartMonitoring(MMonitorPluginObserver& aObserver, CMdESession* aMdEClient, + * CContextEngine* aCtxEngine, CHarvesterPluginFactory* aHarvesterPluginFactory ); + * TBool StopMonitoring(); + * TBool ResumeMonitoring( MMonitorPluginObserver& aObserver, CMdESession* aMdEClient, + * CContextEngine* aCtxEngine, CHarvesterPluginFactory* aHarvesterPluginFactory ); + * TBool PauseMonitoring(); + * void NewFile( CHarvesterData* aHarvesterData ); + * + * private: + * MMonitorPluginObserver* iObserver; + * CMyActiveObjectNotifier* iNotifier; + * } + * + * TBool CMyMonitorPlugin::StartMonitoring(MMonitorPluginObserver& aObserver, CMdESession* aMdEClient, + * CContextEngine* aCtxEngine, CHarvesterPluginFactory* aHarvesterPluginFactory ) + * { + * iObserver = &aObserver; + * + * // Active object which observes the system and notices new files/items in the system + * iNotifier = CMyActiveObjectNotifier::NewL(*this); + * } + * TBool CMyMonitorPlugin::StopMonitoring() + * { + * iNotifier->StopNotifying(); + * } + * + * TBool CMyMonitorPlugin::ResumeMonitoring( MMonitorPluginObserver& aObserver, CMdESession* aMdEClient, + * CContextEngine* aCtxEngine, CHarvesterPluginFactory* aHarvesterPluginFactory ) + * { + * // Do what needs to be done when operation is resumed - for example handle + * // events received through callback CMyMonitorPlugin::NewFile during pause. + * } + * + * TBool CMyMonitorPlugin::PauseMonitoring() + * { + * // Do what needs to be done during pause - for example buffer all events coming + * // through callback CMyMonitorPlugin::NewFile + * } + * + * void CMyMonitorPlugin::NewFile( CHarvesterData* aHarvesterData ) + * { + * // Our CMyActiveObjectNotifier notifies us about new file and we notify the Harvester server about it. + * // Before this CMyActiveObjectNotifier has filled the need data to aHarvesterData like: + * aHarvesterData->SetEventType( EHarvesterAdd ); + * aHarvesterData->SetOrigin( aOrigin ); + * iObserver->MonitorEvent( aHarvesterData ); + * } + */ +class CMonitorPlugin : public CBase + { + public: + /** + * Creates and constructs a new instance of CMonitorPlugin. + * + * @param aUid An UID of desired implementation. + * @return A pointer to the new instance of CMonitorPlugin. + */ + IMPORT_C static CMonitorPlugin* NewL(const TUid& aUid); + + /** + * A static method which list all available implementations which satisfy this given interface. + * + * @param aImplInfoArray On return this contains information about all available implementations. + */ + IMPORT_C static void ListImplementationsL(RImplInfoPtrArray& aImplInfoArray); + + /** + * Destructor + */ + IMPORT_C virtual ~CMonitorPlugin(); + + /** + * A pure virtual method which starts the monitoring. + * + * @param aObserver All events are notified via the aObserver. + * @param aMdEClient A pointer to MdE client. + * @param aCtxEngine A pointer to context engine. + * @param aHarvesterPluginFactory A pointer to harvester plugin factory. + * @return ETrue if success, EFalse if not. + */ + virtual TBool StartMonitoring(MMonitorPluginObserver& aObserver, CMdESession* aMdEClient, + CContextEngine* aCtxEngine, CHarvesterPluginFactory* aHarvesterPluginFactory ) = 0; + + /** + * A pure virtual method which stops the monitoring. + * + * @return ETrue if success, EFalse if not. + */ + virtual TBool StopMonitoring() = 0; + + /** + * A pure virtual method which resumes the paused plug-in. + * + * @param aObserver All events are notified via the aObserver. + * @param aMdEClient A pointer to MdE client. + * @param aCtxEngine A pointer to context engine. + * @param aHarvesterPluginFactory A pointer to harvester plugin factory. + * @return ETrue if success, EFalse if not. + */ + virtual TBool ResumeMonitoring(MMonitorPluginObserver& aObserver, CMdESession* aMdEClient, + CContextEngine* aCtxEngine, CHarvesterPluginFactory* aHarvesterPluginFactory ) = 0; + + /** + * A pure virtual method which pauses the plug-in. + * + * @return ETrue if success, EFalse if not. + */ + virtual TBool PauseMonitoring() = 0; + + private: + + /** + * Identification on cleanup. + */ + TUid iDtor_ID_Key; + }; + +#endif // __MONITORPLUGIN_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/inc/placeholderdata.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/inc/placeholderdata.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,163 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Data transfer object for placeholder data +* +*/ + + +#ifndef PLACEHOLDERDATA_H +#define PLACEHOLDERDATA_H + +// INCLUDES +#include +#include +#include +#include + + +/** + * A helper class which encapsulates data needed for + * creating placeholder objects. + */ +NONSHARABLE_CLASS( CPlaceholderData ) : public CBase + { + public: + + /** + * Second phase construction + */ + IMPORT_C static CPlaceholderData* NewL(); + + /** + * Destructor. + */ + virtual ~CPlaceholderData(); + + /** + * Returns modification time - equals RFs::Modified() + * + * @param Last modification time + */ + IMPORT_C TTime Modified(); + + /** + * Sets modification time - should be RFs::Modified() + * for binary files + * + * @return Last modification time + */ + IMPORT_C void SetModified( TTime aModified ); + + /** + * Returns URI of the file/item. + * + * @return URI + */ + IMPORT_C TPtr16 Uri(); + + /** + * Sets URI of the file/item. + * + * @param aUri URI of the file + */ + IMPORT_C void SetUri( const TDesC& aUri ); + + /** + * Returns file size bytes. + * + * @return File size in bytes. + */ + IMPORT_C TUint32 FileSize(); + + /** + * Sets file size bytes. + * + * @param aUri File size bytes. + */ + IMPORT_C void SetFileSize( TUint32 aFileSize ); + + /** + * Returns MediaID which identifies the volume/drive where + * the file is located. Equals to TVolumeInfo::iUniqueID. + * + * @return MediaID + */ + IMPORT_C TUint MediaId(); + + /** + * Sets MediaID which identifies the volume/drive where + * the file is located. Equals to TVolumeInfo::iUniqueID. + * + * @param aMediaId MediaID of the volume. + */ + IMPORT_C void SetMediaId( TUint aMediaId ); + + /** + * Returns present state for the file. + * + * @return Present state. + */ + IMPORT_C TInt PresentState(); + + /** + * Sets present state for the file + * + * @param aState Present state. + */ + IMPORT_C void SetPresentState( TInt aState ); + + /** + * Returns whether file is pre-installed or not. + * + * @return Whether file is pre-installed or not. + */ + IMPORT_C TInt Preinstalled(); + + /** + * Sets whether file is pre-installed or not. + * + * @param aValue Whether file is pre-installed or not. + */ + IMPORT_C void SetPreinstalled( TInt aValue ); + + protected: + + /** + * Constructor + */ + void ConstructL(); + + private: + + /* URI of the placeholder */ + HBufC* iUri; + + /* Last modified time - RFs::Modified() */ + TTime iModified; + + /* File size in bytes */ + TUint32 iFileSize; + + /* Volume/Drive ID where file - TVolumeInfo::iUniqueID*/ + TUint32 iMediaId; + + /* Present/not present state */ + TInt iPresentState; + + /* Whether file is pre-installed or not */ + TInt iPreinstalled; + }; + +#endif // PLACEHOLDERDATA_H + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/Bmarm/ComposerPluginTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/Bmarm/ComposerPluginTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/Bwins/ComposerPluginTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/Bwins/ComposerPluginTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/conf/ComposerPluginTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/conf/ComposerPluginTest.cfg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,122 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Composer Plugin API tests +# + +// --------------------------------------------------------------------------- +// Composer Plugin API test cases +// --------------------------------------------------------------------------- + +// These should be run in sequential mode if several cases are run at the same +// time! + +[StifSettings] +TestThreadStackSize= 32768 +TestThreadMinHeap= 4096 +TestThreadMaxHeap= 16777216 +[EndStifSettings] + +[Test] +title Startup and Shutdown +create ComposerPluginTest test +request Session +test BeginComposerSession +wait Session +test LoadPlugins +test SetSessions +test ActiveWait +test RemoveSessions +test EndComposerSession +delete test +[Endtest] + +[Test] +title Modify Object 1 +create ComposerPluginTest test +request Session +test BeginComposerSession +wait Session +test LoadPlugins +test SetSessions +test ModifyObjects 1 e:\testing\data\Jpg.jpg +test WaitComposingComplete +test DeleteObject e:\testing\data\Jpg.jpg +test RemoveSessions +test EndComposerSession +delete test +[Endtest] + +[Test] +title Modify Object 2 +create ComposerPluginTest test +request Session +test BeginComposerSession +wait Session +test LoadPlugins +test SetSessions +test ModifyObjects 1 e:\testing\data\Animated.gif +test WaitComposingComplete +test DeleteObject e:\testing\data\Animated.gif +test RemoveSessions +test EndComposerSession +delete test +[Endtest] + +[Test] +title Modify Object 3 +create ComposerPluginTest test +request Session +test BeginComposerSession +wait Session +test LoadPlugins +test SetSessions +test ModifyObjects 1 e:\testing\data\H263.3gp +test WaitComposingComplete +test DeleteObject e:\testing\data\H263.3gp +test RemoveSessions +test EndComposerSession +delete test +[Endtest] + +[Test] +title Modify Object 4 +create ComposerPluginTest test +request Session +test BeginComposerSession +wait Session +test LoadPlugins +test SetSessions +test ModifyObjects 1 e:\testing\data\Wtf.wtf +test WaitComposingComplete +test DeleteObject e:\testing\data\Wtf.wtf +test RemoveSessions +test EndComposerSession +delete test +[Endtest] + +[Test] +title Modify Multiple Objects +create ComposerPluginTest test +request Session +test BeginComposerSession +wait Session +test LoadPlugins +test SetSessions +test ModifyObjects 100 +test WaitComposingComplete +test DeleteObjects 100 +test RemoveSessions +test EndComposerSession +delete test +[Endtest] \ No newline at end of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/eabi/ComposerPluginTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/eabi/ComposerPluginTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/group/ComposerPluginTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/group/ComposerPluginTest.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,46 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + +#include +#include + +TARGET ComposerPluginTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + +DEFFILE ComposerPluginTest.DEF + +SOURCEPATH ../src +SOURCE ComposerPluginTest.cpp +SOURCE ComposerPluginTestBlocks.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../../../inc +SYSTEMINCLUDE /epoc32/include/ecom + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY ecom.lib +LIBRARY composerplugininterface.lib +LIBRARY mdeclient.lib + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/group/ComposerPluginTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/group/ComposerPluginTest.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,56 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Installation file for API test +; + +; Languages +&EN + +; Header +#{"ComposerPluginTest"},(0x101FB3E3),1,0,0,TYPE=SA + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Install files +"\epoc32\release\armv5\urel\ComposerPluginTest.dll" - "c:\sys\bin\ComposerPluginTest.dll" +"..\conf\ComposerPluginTest.cfg" - "c:\TestFramework\ComposerPluginTest.cfg" +"..\init\ComposerPluginTest.ini" - "c:\TestFramework\ComposerPluginTest.ini" + +"..\..\data\mmc\HarvesterTest\Jpg.jpg" -"E:\testing\data\Jpg.jpg" +"..\..\data\mmc\HarvesterTest\Animated.gif" -"E:\testing\data\Animated.gif" +"..\..\data\mmc\HarvesterTest\Temp1.jpg" -"E:\testing\data\Temp1.jpg" +"..\..\data\mmc\HarvesterTest\Temp2.jpg" -"E:\testing\data\Temp2.jpg" +"..\..\data\mmc\HarvesterTest\Temp3.jpg" -"E:\testing\data\Temp3.jpg" +"..\..\data\mmc\HarvesterTest\H263.3gp" -"E:\testing\data\H263.3gp" +"..\..\data\mmc\HarvesterTest\bmp_burst.bmp" -"E:\testing\data\bmp_burst.bmp" +"..\..\data\mmc\HarvesterTest\GIF87testimage.gif" -"E:\testing\data\GIF87testimage.gif" +"..\..\data\mmc\HarvesterTest\gif89a_onemeg.gif" -"E:\testing\data\gif89a_onemeg.gif" +"..\..\data\mmc\HarvesterTest\Liverpool.jpg" -"E:\testing\data\Liverpool.jpg" +"..\..\data\mmc\HarvesterTest\MBMtestimage.mbm" -"E:\testing\data\MBMtestimage.mbm" +"..\..\data\mmc\HarvesterTest\wbmp_skull.wbmp" -"E:\testing\data\wbmp_skull.wbmp" +"..\..\data\mmc\HarvesterTest\ota_bmpiso.ota" -"E:\testing\data\ota_bmpiso.ota" +"..\..\data\mmc\HarvesterTest\PNGtestimage.png" -"E:\testing\data\PNGtestimage.png" +"..\..\data\mmc\HarvesterTest\G4.TIF" -"E:\testing\data\G4.TIF" +"..\..\data\mmc\HarvesterTest\G31D.TIF" -"E:\testing\data\G31D.TIF" +"..\..\data\mmc\HarvesterTest\PSRETRO.WMF" -"E:\testing\data\PSRETRO.WMF" +"..\..\data\mmc\HarvesterTest\Animated.gif" -"E:\testing\data\Animated.gif" +"..\..\data\mmc\HarvesterTest\Mbm.mbm" -"E:\testing\data\Mbm.mbm" +"..\..\data\mmc\HarvesterTest\MPEG4.3gp" -"E:\testing\data\MPEG4.3gp" +"..\..\data\mmc\HarvesterTest\MPEG4.mp4" -"E:\testing\data\MPEG4.mp4" +"..\..\data\mmc\HarvesterTest\00001.mp3" -"E:\testing\data\00001.mp3" + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +ComposerPluginTest.mmp + +PRJ_TESTEXPORTS + +../conf/ComposerPluginTest.cfg /epoc32/winscw/c/TestFramework/ComposerPluginTest.cfg +../init/ComposerPluginTest.ini /epoc32/winscw/c/TestFramework/ComposerPluginTest.ini + +../../data/mmc/HarvesterTest/bmp_burst.bmp /epoc32/winscw/c/Data/bmp_burst.bmp +../../data/mmc/HarvesterTest/G31D.TIF /epoc32/winscw/c/Data/G31D.TIF +../../data/mmc/HarvesterTest/G4.TIF /epoc32/winscw/c/Data/G4.TIF +../../data/mmc/HarvesterTest/GIF87testimage.gif /epoc32/winscw/c/Data/GIF87testimage.gif +../../data/mmc/HarvesterTest/gif89a_onemeg.gif /epoc32/winscw/c/Data/gif89a_onemeg.gif +../../data/mmc/HarvesterTest/Liverpool.jpg /epoc32/winscw/c/Data/Liverpool.jpg +../../data/mmc/HarvesterTest/MBMtestimage.mbm /epoc32/winscw/c/Data/MBMtestimage.mbm +../../data/mmc/HarvesterTest/ota_bmpiso.ota /epoc32/winscw/c/Data/ota_bmpiso.ota +../../data/mmc/HarvesterTest/PNGtestimage.png /epoc32/winscw/c/Data/PNGtestimage.png +../../data/mmc/HarvesterTest/PSRETRO.WMF /epoc32/winscw/c/Data/PSRETRO.WMF +../../data/mmc/HarvesterTest/wbmp_skull.wbmp /epoc32/winscw/c/Data/wbmp_skull.wbmp +../../data/mmc/HarvesterTest/Jpg.jpg /epoc32/winscw/c/Data/Jpg.jpg +../../data/mmc/HarvesterTest/Animated.gif /epoc32/winscw/c/Data/Animated.gif +../../data/mmc/HarvesterTest/Mbm.mbm /epoc32/winscw/c/Data/Mbm.mbm +../../data/mmc/HarvesterTest/H263.3gp /epoc32/winscw/c/Data/H263.3gp +../../data/mmc/HarvesterTest/MPEG4.mp4 /epoc32/winscw/c/Data/MPEG4.mp4 +../../data/mmc/HarvesterTest/MPEG4.3gp /epoc32/winscw/c/Data/MPEG4.3gp +../../data/mmc/HarvesterTest/Temp1.jpg /epoc32/winscw/c/Data/Temp1.jpg +../../data/mmc/HarvesterTest/Temp2.jpg /epoc32/winscw/c/Data/Temp2.jpg +../../data/mmc/HarvesterTest/Temp3.jpg /epoc32/winscw/c/Data/Temp3.jpg +../../data/mmc/HarvesterTest/00001.mp3 /epoc32/winscw/c/Data/00001.mp3 + + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/inc/ComposerPluginTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/inc/ComposerPluginTest.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef COMPOSERPLUGINTEST_H +#define COMPOSERPLUGINTEST_H + +// INCLUDES +#include +#include +#include + +#include +#include + +// CONSTANTS + +_LIT( KComposerPluginTestLogPath, "\\logs\\testframework\\ComposerPluginTest\\" ); +// Log file +_LIT( KComposerPluginTestLogFile, "ComposerPluginTest.txt" ); +_LIT( KComposerPluginTestLogFileWithTitle, "ComposerPluginTest_[%S].txt" ); + +// FORWARD DECLARATIONS +class CComposerPluginTest; + +// CLASS DECLARATION +NONSHARABLE_CLASS(CComposerPluginTest) : public CScriptBase, + public MMdESessionObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CComposerPluginTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CComposerPluginTest(); + + public: // Functions from base classes + + virtual TInt RunMethodL( CStifItemParser& aItem ); + + private: // Functions from base classes + + void HandleSessionOpened(CMdESession& aSession, TInt aError); + void HandleSessionError(CMdESession& aSession, TInt aError); + + private: + + /** + * C++ default constructor. + */ + CComposerPluginTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + */ + void Delete(); + + /** + * Test methods are listed below. + */ + //[TestMethods] - Do not remove + virtual TInt ActiveWait( CStifItemParser& aItem ); + virtual TInt BeginComposerSessionL( CStifItemParser& aItem ); + virtual TInt EndComposerSession( CStifItemParser& aItem ); + virtual TInt LoadPluginsL( CStifItemParser& aItem ); + virtual TInt SetSessions( CStifItemParser& aItem ); + virtual TInt RemoveSessions( CStifItemParser& aItem ); + virtual TInt ModifyObjectsL( CStifItemParser& aItem ); + virtual TInt DeleteObjectL( CStifItemParser& aItem ); + virtual TInt DeleteObjectsL( CStifItemParser& aItem ); + virtual TInt WaitComposingComplete( CStifItemParser& aItem ); + + private: // Data + + CMdESession* iMdEClient; + + RPointerArray iPluginArray; + }; + +#endif // COMPOSERPLUGINTEST_H + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/init/ComposerPluginTest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/init/ComposerPluginTest.ini Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,81 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= ComposerPluginTestLog + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 600000 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testframework\ComposerPluginTest.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +HardwareBasePath= C:\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/src/ComposerPluginTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/src/ComposerPluginTest.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// INCLUDE FILES +#include +#include "ComposerPluginTest.h" +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::CComposerPluginTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CComposerPluginTest::CComposerPluginTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CComposerPluginTest::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KComposerPluginTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KComposerPluginTestLogFile); + } + + iLog = CStifLogger::NewL( KComposerPluginTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CComposerPluginTest* CComposerPluginTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CComposerPluginTest* self = new (ELeave) CComposerPluginTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + + } + +// Destructor +CComposerPluginTest::~CComposerPluginTest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CComposerPluginTest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/src/ComposerPluginTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/ComposerPluginTest/src/ComposerPluginTestBlocks.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,1035 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include "ComposerPluginTest.h" + +#include "mdsutils.h" +#include "mdeconstants.h" + +using namespace MdeConstants; + +_LIT( KOpenErr, " ModifyObjects - Open error : %d" ); +_LIT( KCommErr, " ModifyObjects - Commit error : %d" ); +_LIT( KNull, " ModifyObjects - NULL object" ); +_LIT( KCommit, " ModifyObjects - Object committed" ); +_LIT( KUri, "C:\\Data\\Images\\Temp%d.jpg" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CComposerPluginTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CComposerPluginTest::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + ENTRY( "ActiveWait", CComposerPluginTest::ActiveWait ), + ENTRY( "BeginComposerSession", CComposerPluginTest::BeginComposerSessionL ), + ENTRY( "EndComposerSession", CComposerPluginTest::EndComposerSession ), + ENTRY( "LoadPlugins", CComposerPluginTest::LoadPluginsL ), + ENTRY( "SetSessions", CComposerPluginTest::SetSessions ), + ENTRY( "RemoveSessions", CComposerPluginTest::RemoveSessions ), + ENTRY( "ModifyObjects", CComposerPluginTest::ModifyObjectsL ), + ENTRY( "DeleteObject", CComposerPluginTest::DeleteObjectL ), + ENTRY( "DeleteObjects", CComposerPluginTest::DeleteObjectsL ), + ENTRY( "WaitComposingComplete", CComposerPluginTest::WaitComposingComplete ), + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::HandleSessionOpened +// ----------------------------------------------------------------------------- +// +void CComposerPluginTest::HandleSessionOpened( CMdESession& /*aClient*/, TInt aError ) + { + _LIT( KMsg, "CallBck HandleSessionOpened - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print(msg); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::HandleSessionError +// ----------------------------------------------------------------------------- +// +void CComposerPluginTest::HandleSessionError( CMdESession& /*aClient*/, TInt aError ) + { + _LIT( KMsg, "CallBck HandleSessionError - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print(msg); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::ActiveWait +// ----------------------------------------------------------------------------- +// +TInt CComposerPluginTest::ActiveWait( CStifItemParser& /* aItem */ ) + { + TTimeIntervalMicroSeconds32 timeout(2500000); + RTimer timer; + TRequestStatus status; + + timer.CreateLocal(); + timer.After(status,timeout); + + User::WaitForAnyRequest(); + + timer.Close(); + + _LIT( KMsg1, "Exit ActiveWait" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::BeginComposerSessionL +// ----------------------------------------------------------------------------- +// +TInt CComposerPluginTest::BeginComposerSessionL( CStifItemParser& /* aItem */ ) + { + iMdEClient = NULL; + TRAPD( error, iMdEClient = CMdESession::NewL( *this ) ); + + _LIT( KMsg, "Exit BeginComposerSession - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, error); + iLog->Log( msg ); + RDebug::Print(msg); + + User::LeaveIfError(error); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::EndComposerSession +// ----------------------------------------------------------------------------- +// +TInt CComposerPluginTest::EndComposerSession( CStifItemParser& /* aItem */ ) + { + iPluginArray.ResetAndDestroy(); + iPluginArray.Close(); + + if ( iMdEClient ) + { + delete iMdEClient; + iMdEClient = NULL; + } + + REComSession::FinalClose(); + + _LIT( KMsg, "Exit EndComposerSession" ); + iLog->Log( KMsg ); + RDebug::Print( KMsg ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::LoadPluginsL +// ----------------------------------------------------------------------------- +// +TInt CComposerPluginTest::LoadPluginsL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter LoadPlugins" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TUid imageComposerUID = { 0x20007185 }; // MDS image composer plugin + + RImplInfoPtrArray infoArray; + + TCleanupItem cleanupItem( MdsUtils::CleanupEComArray, &infoArray ); + CleanupStack::PushL( cleanupItem ); + + CComposerPlugin::ListImplementationsL( infoArray ); + TInt count( 0 ); + count = infoArray.Count(); + + for ( TInt i=0; i < count; i++ ) + { + TUid uid = infoArray[i]->ImplementationUid(); // Create the plug-ins + if( uid == imageComposerUID ) + { + iPluginArray.AppendL( CComposerPlugin::NewL( uid ) ); // and add them to array + } + } + + CleanupStack::PopAndDestroy( &infoArray ); // infoArray, results in a call to CleanupEComArray + + if( iPluginArray.Count() == 0 ) + { + return KErrNotFound; + } + + + _LIT( KMsg2, "Exit LoadPlugins" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::SetSessions +// ----------------------------------------------------------------------------- +// +TInt CComposerPluginTest::SetSessions( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter SetSessions" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iMdEClient ) + { + return KErrUnknown; + } + + for ( TInt i = 0; i < iPluginArray.Count(); ++i ) + { + iPluginArray[i]->SetSession( *iMdEClient ); + } + + _LIT( KMsg2, "Exit SetSessions" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::RemoveSessions +// ----------------------------------------------------------------------------- +// +TInt CComposerPluginTest::RemoveSessions( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter RemoveSessions" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + for(TInt i = 0; i < iPluginArray.Count(); ++i) + { + iPluginArray[i]->RemoveSession(); + } + + _LIT( KMsg2, "Exit RemoveSessions" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::ModifyObjectsL +// ----------------------------------------------------------------------------- +// +TInt CComposerPluginTest::ModifyObjectsL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "Enter ModifyObjects" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + CMdENamespaceDef& defaultNamespace = iMdEClient->GetDefaultNamespaceDefL(); + CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( Image::KImageObject ); + + // Mandatory parameters for any object. + CMdEPropertyDef& creationDef = imageDef.GetPropertyDefL( Object::KCreationDateProperty ); + CMdEPropertyDef& modifiedDef = imageDef.GetPropertyDefL( Object::KLastModifiedDateProperty ); + CMdEPropertyDef& sizeDef = imageDef.GetPropertyDefL( Object::KSizeProperty ); + CMdEPropertyDef& itemTypeDef = imageDef.GetPropertyDefL( Object::KItemTypeProperty ); + + CMdEPropertyDef& descriptionPropertyDef = imageDef.GetPropertyDefL( MediaObject::KDescriptionProperty ); + CMdEPropertyDef& widthDef = imageDef.GetPropertyDefL( MediaObject::KWidthProperty ); + CMdEPropertyDef& heightDef = imageDef.GetPropertyDefL( MediaObject::KHeightProperty ); + CMdEPropertyDef& commentDef = imageDef.GetPropertyDefL( MediaObject::KCommentProperty ); + CMdEPropertyDef& lastModifiedDateDef = imageDef.GetPropertyDefL( Image::KDateTimeProperty ); + CMdEPropertyDef& dateTimeDigitizedDef = imageDef.GetPropertyDefL( Image::KDateTimeDigitizedProperty ); + CMdEPropertyDef& makeDef = imageDef.GetPropertyDefL( Image::KMakeProperty ); + CMdEPropertyDef& modelDef = imageDef.GetPropertyDefL( Image::KModelProperty ); + CMdEPropertyDef& artistDef = imageDef.GetPropertyDefL( MediaObject::KArtistProperty ); // Ei toimi + CMdEPropertyDef& orientationDef = imageDef.GetPropertyDefL( Image::KOrientationProperty ); + CMdEPropertyDef& yCbCrPosDef = imageDef.GetPropertyDefL( Image::KYCbCrPositioningProperty ); + CMdEPropertyDef& resolutionDef = imageDef.GetPropertyDefL( MediaObject::KResolutionUnitProperty ); + CMdEPropertyDef& isoSpeedDef = imageDef.GetPropertyDefL( Image::KISOSpeedRatingsProperty ); + CMdEPropertyDef& soundFileDef = imageDef.GetPropertyDefL( Image::KRelatedSoundFileProperty ); + CMdEPropertyDef& exposureTimeDef = imageDef.GetPropertyDefL( Image::KExposureTimeProperty ); + CMdEPropertyDef& apertureDef = imageDef.GetPropertyDefL( Image::KApertureValueProperty ); + CMdEPropertyDef& colourSpaceDef = imageDef.GetPropertyDefL( Image::KColourSpaceProperty ); + CMdEPropertyDef& exposureBiasDef = imageDef.GetPropertyDefL( Image::KExposureBiasValueProperty ); + CMdEPropertyDef& meteringDef = imageDef.GetPropertyDefL( Image::KMeteringModeProperty ); + CMdEPropertyDef& exifVersionDef = imageDef.GetPropertyDefL( Image::KExifVersionProperty ); + CMdEPropertyDef& flashPixVersionDef = imageDef.GetPropertyDefL( Image::KFlashPixVersionProperty ); + CMdEPropertyDef& thumbXDef = imageDef.GetPropertyDefL( Image::KThumbXResolutionProperty ); + CMdEPropertyDef& thumbYDef = imageDef.GetPropertyDefL( Image::KThumbYResolutionProperty ); + CMdEPropertyDef& thumbResolutionUnitDef = imageDef.GetPropertyDefL( Image::KThumbResolutionUnitProperty ); + CMdEPropertyDef& thumbCompressionDef = imageDef.GetPropertyDefL( Image::KThumbCompressionProperty ); + CMdEPropertyDef& shutterSpeedDef = imageDef.GetPropertyDefL( Image::KShutterSpeedValueProperty ); + CMdEPropertyDef& componentsDef = imageDef.GetPropertyDefL( Image::KComponentsConfigurationProperty ); + CMdEPropertyDef& xResolutionDef = imageDef.GetPropertyDefL( Image::KXResolutionProperty ); + CMdEPropertyDef& yResolutionDef = imageDef.GetPropertyDefL( Image::KYResolutionProperty ); + CMdEPropertyDef& fNumberDef = imageDef.GetPropertyDefL( Image::KFNumberProperty ); + CMdEPropertyDef& focalLengthDef = imageDef.GetPropertyDefL( Image::KFocalLengthProperty ); + CMdEPropertyDef& focalIn35Def = imageDef.GetPropertyDefL( Image::KFocalLengthIn35mmFilmProperty ); + + TBuf <100> msg; + + TInt count( 0 ); + + User::LeaveIfError( aItem.GetNextInt( count ) ); + + if ( count == 1 ) + { + TItemId objectId(0); + TTime currTime; + currTime.HomeTime(); + TPtrC inputFile; + + User::LeaveIfError( aItem.GetNextString( inputFile )); + + // create object + iMdEClient->RemoveObjectL(inputFile); + CMdEObject* object = iMdEClient->NewObjectLC(imageDef, inputFile); + + object->AddTimePropertyL(creationDef, currTime); + object->AddTimePropertyL(modifiedDef, currTime); + object->AddUint32PropertyL( sizeDef, 0 ); + object->AddTextPropertyL( itemTypeDef, Image::KImageObject ); + + objectId = iMdEClient->AddObjectL(*object); + + CleanupStack::PopAndDestroy( object ); + object = NULL; + + // open object for modification + TRAPD( openError, object = iMdEClient->OpenObjectL(objectId) ); + + if ( !object || openError != KErrNone ) + { + msg.Format(KOpenErr, openError); + iLog->Log( msg ); + RDebug::Print(msg); + + User::LeaveIfError(openError); + } + + CleanupStack::PushL( object ); + + CMdEProperty* property = NULL; + + + // Modified date + object->Property( lastModifiedDateDef, property ); + + if ( property ) + { + CMdETimeProperty* modTimeProperty = (CMdETimeProperty*)property; + + modTimeProperty->SetValueL( 1 ); + } + else + { + object->AddTimePropertyL( lastModifiedDateDef, 1 ); + } + + property = NULL; + + // Date & time digitized + object->Property( dateTimeDigitizedDef, property ); + + if ( property ) + { + CMdETimeProperty* digiTimeProperty = (CMdETimeProperty*)property; + + digiTimeProperty->SetValueL( 9959267210000000 ); + } + else + { + object->AddTimePropertyL( dateTimeDigitizedDef, 9959267210000000 ); + } + + property = NULL; + + // Title + _LIT( KDesc, "Description" ); + object->Property( descriptionPropertyDef, property ); + + if ( property ) + { + property->SetTextValueL( KDesc ); + } + else + { + object->AddTextPropertyL( descriptionPropertyDef, KDesc ); + } + + property = NULL; + + // Comment + _LIT( KNoComment, "Comment" ); + object->Property( commentDef, property ); + + if ( property ) + { + property->SetTextValueL( KNoComment ); + } + else + { + object->AddTextPropertyL( commentDef, KNoComment ); + } + + property = NULL; + + // Maker + object->Property( makeDef, property ); + + _LIT( KOnkia, "Maker" ); + if ( property ) + { + property->SetTextValueL( KOnkia ); + } + else + { + object->AddTextPropertyL( makeDef, KOnkia ); + } + + property = NULL; + + // Model + object->Property( modelDef, property ); + _LIT( KModel, "Model" ); + if ( property ) + { + property->SetTextValueL( KModel ); + } + else + { + object->AddTextPropertyL( modelDef, KModel ); + } + + property = NULL; + + // Width + object->Property( widthDef, property ); + + if ( property ) + { + property->SetUint16ValueL( 100 ); + } + else + { + object->AddUint16PropertyL( widthDef, 100 ); + } + + property = NULL; + + // Height + object->Property( heightDef, property ); + + if ( property ) + { + property->SetUint16ValueL( 100 ); + } + else + { + object->AddUint16PropertyL( heightDef, 100 ); + } + + property = NULL; + + // Orientation + object->Property( orientationDef, property ); + + if ( property ) + { + property->SetUint16ValueL( 8 ); + } + else + { + object->AddUint16PropertyL( orientationDef, 8 ); + } + + property = NULL; + + // YCbCr positioning + object->Property( yCbCrPosDef, property ); + + if ( property ) + { + property->SetUint16ValueL( 2 ); + } + else + { + object->AddUint16PropertyL( yCbCrPosDef, 2 ); + } + + property = NULL; + + // ISO speed + object->Property( isoSpeedDef, property ); + + if ( property ) + { + property->SetUint16ValueL( 1600 ); + } + else + { + object->AddUint16PropertyL( isoSpeedDef, 1600 ); + } + + property = NULL; + + // Related soundfile + _LIT(KWavName, "Wav.wav"); + object->Property( soundFileDef, property); + + if(property) + { + property->SetTextValueL( KWavName ); + } + else + { + object->AddTextPropertyL( soundFileDef, KWavName ); + } + + property = NULL; + + // Exposure time + object->Property( exposureTimeDef, property); + + if(property) + { + property->SetReal32ValueL( 99.1f ); + } + else + { + object->AddReal32PropertyL( exposureTimeDef, 99.1f ); + } + + property = NULL; + + // Aperture + object->Property( apertureDef, property); + + if(property) + { + property->SetReal32ValueL( 5.0f ); + } + else + { + object->AddReal32PropertyL( apertureDef, 5.0f ); + } + + property = NULL; + + // Colour space + object->Property( colourSpaceDef, property); + + if (property) + { + property->SetUint16ValueL( 65535 ); + } + else + { + object->AddUint16PropertyL( colourSpaceDef, 65535 ); + } + + property = NULL; + + // Exposure bias + object->Property( exposureBiasDef, property); + + if(property) + { + property->SetReal32ValueL( 0.0f ); + } + else + { + object->AddReal32PropertyL( exposureBiasDef, 0.0f ); + } + + property = NULL; + + // Metering mode + object->Property( meteringDef, property); + + if (property) + { + property->SetUint16ValueL( 4 ); + } + else + { + object->AddUint16PropertyL( meteringDef, 4 ); + } + + property = NULL; + + // Thumb X + object->Property( thumbXDef, property); + + if(property) + { + property->SetUint32ValueL( 64 ); + } + else + { + object->AddUint32PropertyL( thumbXDef, 64 ); + } + + property = NULL; + + // Thumb Y + object->Property( thumbYDef, property); + + if(property) + { + property->SetUint32ValueL( 64 ); + } + else + { + object->AddUint32PropertyL( thumbYDef, 64 ); + } + + property = NULL; + + // Thumbnail resolution unit + object->Property( thumbResolutionUnitDef, property ); + + if ( property ) + { + property->SetUint16ValueL( 2 ); + } + else + { + object->AddUint16PropertyL( thumbResolutionUnitDef, 2 ); + } + + property = NULL; + + // Thumbnail compression + object->Property( thumbCompressionDef, property ); + + if ( property ) + { + property->SetUint16ValueL( 6 ); + } + else + { + object->AddUint16PropertyL( thumbCompressionDef, 6 ); + } + + property = NULL; + + // Shutter speed + object->Property( shutterSpeedDef, property ); + + if ( property ) + { + property->SetReal32ValueL( 9.0f ); + } + else + { + object->AddReal32PropertyL( shutterSpeedDef, 9.0f ); + } + + property = NULL; + + // Components configuration + object->Property( componentsDef, property ); + + if ( property ) + { + property->SetUint32ValueL( 197121 ); + } + else + { + object->AddUint32PropertyL( componentsDef, 197121 ); + } + + property = NULL; + + // X resolution + object->Property( xResolutionDef, property ); + + if ( property ) + { + property->SetReal32ValueL( 300.0f ); + } + else + { + object->AddReal32PropertyL( xResolutionDef, 300.0f ); + } + + property = NULL; + + // Y resolution + object->Property( yResolutionDef, property ); + + if ( property ) + { + property->SetReal32ValueL( 300.0f ); + } + else + { + object->AddReal32PropertyL( yResolutionDef, 300.0f ); + } + + property = NULL; + + // F number + object->Property( fNumberDef, property ); + + if ( property ) + { + property->SetReal32ValueL( 2.8f ); + } + else + { + object->AddReal32PropertyL( fNumberDef, 2.8f ); + } + + property = NULL; + + // Focal length + object->Property( focalLengthDef, property ); + + if ( property ) + { + property->SetReal32ValueL( 9.0f ); + } + else + { + object->AddReal32PropertyL( focalLengthDef, 9.0f ); + } + + property = NULL; + + // Focal length in 35 mm film + object->Property( focalIn35Def, property ); + + if ( property ) + { + property->SetUint16ValueL( 120 ); + } + else + { + object->AddUint16PropertyL( focalIn35Def, 120 ); + } + + // Commit object + TRAPD( commitError, iMdEClient->CommitObjectL(*object) ); + if ( commitError != KErrNone ) + { + msg.Format(KCommErr, commitError); + iLog->Log( msg ); + RDebug::Print(msg); + + User::LeaveIfError(commitError); + } + + iLog->Log( KCommit ); + RDebug::Print(KCommit); + + CleanupStack::PopAndDestroy( object ); + } + + // modify more than one object + else if ( count > 1 ) + { + RPointerArray objectArray; + CleanupClosePushL( objectArray ); + + CMdEObject* object = NULL; + TItemId objectId(0); + TTime currTime; + TBuf <100> uri; + + for ( TInt i = 0; i < count; ++i ) + { + uri.Format(KUri, i+1); + + // create object + iMdEClient->RemoveObjectL(uri); + object = iMdEClient->NewObjectLC(imageDef, uri); + + currTime.HomeTime(); + object->AddTimePropertyL(creationDef, currTime); + object->AddTimePropertyL(modifiedDef, currTime); + object->AddUint32PropertyL( sizeDef, 0 ); + object->AddTextPropertyL( itemTypeDef, Image::KImageObject ); + + objectId = iMdEClient->AddObjectL(*object); + + CleanupStack::PopAndDestroy(object); + object = NULL; + + // open for modification + TRAPD( openError, object = iMdEClient->OpenObjectL(objectId) ) + + if ( !object || openError != KErrNone ) + { + + if (openError != KErrNone) + { + msg.Format(KOpenErr, openError); + iLog->Log( msg ); + RDebug::Print(msg); + + User::LeaveIfError(openError); + } + else + { + iLog->Log( KNull ); + RDebug::Print(KNull); + } + + continue; + } + + CMdEProperty* property = NULL; + + // Description + _LIT( KDesc, "Description" ); + object->Property( descriptionPropertyDef, property ); + + if ( property ) + { + property->SetTextValueL( KDesc ); + } + else + { + object->AddTextPropertyL( descriptionPropertyDef, KDesc ); + } + + property = NULL; + + // Width + object->Property( widthDef, property ); + + if ( property ) + { + property->SetUint16ValueL( 100 ); + } + else + { + object->AddUint16PropertyL( widthDef, 100 ); + } + + property = NULL; + + // Height + object->Property( heightDef, property ); + + if ( property ) + { + property->SetUint16ValueL( 100 ); + } + else + { + object->AddUint16PropertyL( heightDef, 100 ); + } + + property = NULL; + + // Maker + object->Property( makeDef, property ); + + _LIT( KOnkia, "Maker" ); + if ( property ) + { + property->SetTextValueL( KOnkia ); + } + else + { + object->AddTextPropertyL( makeDef, KOnkia ); + } + + property = NULL; + + // Model + object->Property( modelDef, property ); + _LIT( KModel, "Model" ); + if ( property ) + { + property->SetTextValueL( KModel ); + } + else + { + object->AddTextPropertyL( modelDef, KModel ); + } + + objectArray.Append( object ); + } + + TRAPD( commitError, iMdEClient->CommitObjectsL(objectArray) ); + if ( commitError != KErrNone ) + { + msg.Format(KCommErr, commitError); + iLog->Log( msg ); + RDebug::Print(msg); + + User::LeaveIfError(commitError); + } + + iLog->Log( KCommit ); + RDebug::Print(KCommit); + + objectArray.ResetAndDestroy(); + CleanupStack::PopAndDestroy( &objectArray ); + } + + _LIT( KMsg2, "Exit ModifyObjects" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::DeleteObject +// ----------------------------------------------------------------------------- +// +TInt CComposerPluginTest::DeleteObjectL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "Enter DeleteObject" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TPtrC inputFile; + User::LeaveIfError( aItem.GetNextString( inputFile )); + + iMdEClient->RemoveObjectL(inputFile); + + _LIT( KMsg2, "Exit DeleteObject" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::DeleteObjects +// ----------------------------------------------------------------------------- +// +TInt CComposerPluginTest::DeleteObjectsL( CStifItemParser& aItem ) + { + TInt count(0); + TBuf <100> uri; + + User::LeaveIfError( aItem.GetNextInt( count ) ); + + for ( TInt i = 0; i < count; ++i ) + { + uri.Format(KUri, i+1); + + iMdEClient->RemoveObjectL(uri); + } + + _LIT( KMsg, "Exit DeleteObjects" ); + iLog->Log( KMsg ); + RDebug::Print(KMsg); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CComposerPluginTest::WaitComposingComplete +// ----------------------------------------------------------------------------- +// +TInt CComposerPluginTest::WaitComposingComplete( CStifItemParser& aItem ) + { + _LIT( KMsg1, "Enter WaitComposingComplete" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TBool complete = ETrue; + TBool waitingForComposingToEnd = ETrue; + + while( waitingForComposingToEnd ) + { + complete = ETrue; + + for(TInt i = 0; i < iPluginArray.Count(); ++i) + { + if( iPluginArray[i]->IsComposingComplete() == EFalse ) + { + complete = EFalse; + } + } + + if( complete ) + { + waitingForComposingToEnd = EFalse; + } + else + { + ActiveWait( aItem ); + } + } + + _LIT( KMsg2, "Exit WaitComposingComplete" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// [End of File] - Do not remove diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/Bmarm/HarvesterClientTestScripteru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/Bmarm/HarvesterClientTestScripteru.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/Bwins/HarvesterClientTestScripteru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/Bwins/HarvesterClientTestScripteru.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/conf/HarvesterClientTestScripter.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/conf/HarvesterClientTestScripter.cfg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,424 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Harvester Client API tests +# + +// --------------------------------------------------------------------------- +// Harvester Client API test cases +// --------------------------------------------------------------------------- + +// These should be run in sequential mode if several cases are run at the same +// time! + +[StifSettings] +TestThreadStackSize= 32768 +TestThreadMinHeap= 4096 +TestThreadMaxHeap= 16777216 +[EndStifSettings] + +[Test] +title Harvester Client Connect/Disconnect +timeout 180000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title Harvester Client Pause/Resume +timeout 180000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test HarvesterClientPause +test HarvesterClientResume +test HarvesterClientPause +test HarvesterClientResume +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title Set/Remove Harvester Observer +timeout 180000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test SetHarvesterObserver +test RemoveHarvesterObserver +test SetHarvesterObserver +test SetHarvesterObserver +test RemoveHarvesterObserver +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title Add/Remove Harvester Event Observer +timeout 180000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test AddHarvesterEventObserver 3 +test AddHarvesterEventObserver 6 +test RemoveHarvesterEventObserver 5 +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title HarvestFile 1 +timeout 500000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test SetHarvesterObserver +test AddHarvesterEventObserver 1 +test AddObjectObserver +test SetUpHarvesting e:\testing\data\bmp_burst.bmp +request Continue +test HarvestFile e:\testing\data\bmp_burst.bmp +wait Continue +test EndHarvesterSession +request Query +test QueryImageObjectByIdIndex 0 +wait Query +test RemoveObject e:\testing\data\bmp_burst.bmp +test Results +test RemoveHarvesterEventObserver 1 +test RemoveHarvesterObserver +test RemoveObjectObserver +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title HarvestFile 2 +timeout 500000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test SetHarvesterObserver +test AddHarvesterEventObserver 1 +test AddObjectObserver +test SetUpHarvesting e:\testing\data\G4.TIF +request Continue +test HarvestFile e:\testing\data\G4.TIF +wait Continue +test EndHarvesterSession +request Query +test QueryImageObjectByIdIndex 0 +wait Query +test RemoveObject e:\testing\data\G4.TIF +test Results +test RemoveHarvesterEventObserver 1 +test RemoveHarvesterObserver +test RemoveObjectObserver +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title HarvestFile 3 +timeout 500000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test SetHarvesterObserver +test AddHarvesterEventObserver 1 +test AddObjectObserver +test SetUpHarvesting e:\testing\data\GIF87testimage.gif +request Continue +test HarvestFile e:\testing\data\GIF87testimage.gif +wait Continue +test EndHarvesterSession +request Query +test QueryImageObjectByIdIndex 0 +wait Query +test RemoveObject e:\testing\data\GIF87testimage.gif +test Results +test RemoveHarvesterEventObserver 1 +test RemoveHarvesterObserver +test RemoveObjectObserver +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title HarvestFile 4 +timeout 500000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test SetHarvesterObserver +test AddHarvesterEventObserver 1 +test AddObjectObserver +test SetUpHarvesting e:\testing\data\Liverpool.jpg +test SetLocationInfo +request Continue +test HarvestFile e:\testing\data\Liverpool.jpg +wait Continue +test EndHarvesterSession +request Query +test QueryImageObjectByIdIndex 0 +wait Query +test RemoveObject e:\testing\data\Liverpool.jpg +test Results +test RemoveHarvesterEventObserver 1 +test RemoveHarvesterObserver +test RemoveObjectObserver +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title HarvestFile 5 +timeout 500000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test SetHarvesterObserver +test AddHarvesterEventObserver 1 +test AddObjectObserver +test SetUpHarvesting e:\testing\data\MBMtestimage.mbm +request Continue +test HarvestFile e:\testing\data\MBMtestimage.mbm +wait Continue +test EndHarvesterSession +request Query +test QueryImageObjectByIdIndex 0 +wait Query +test RemoveObject e:\testing\data\MBMtestimage.mbm +test Results +test RemoveHarvesterEventObserver 1 +test RemoveHarvesterObserver +test RemoveObjectObserver +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title HarvestFile 6 +timeout 500000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test SetHarvesterObserver +test AddHarvesterEventObserver 1 +test AddObjectObserver +test SetUpHarvesting e:\testing\data\PNGtestimage.png +request Continue +test HarvestFile e:\testing\data\PNGtestimage.png +wait Continue +test EndHarvesterSession +request Query +test QueryImageObjectByIdIndex 0 +wait Query +test RemoveObject e:\testing\data\PNGtestimage.png +test Results +test RemoveHarvesterEventObserver 1 +test RemoveHarvesterObserver +test RemoveObjectObserver +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title HarvestFileWithUID 1 +timeout 500000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test SetHarvesterObserver +test AddHarvesterEventObserver 1 +test AddObjectObserver +test SetUpHarvesting e:\testing\data\ota_bmpiso.ota +test SetLocationInfo +request Continue +test HarvestFileWithUID e:\testing\data\ota_bmpiso.ota +wait Continue +test EndHarvesterSession +request Query +test QueryImageObjectByIdIndex 0 +wait Query +test RemoveObject e:\testing\data\ota_bmpiso.ota +test Results +test RemoveHarvesterEventObserver 1 +test RemoveHarvesterObserver +test RemoveObjectObserver +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title HarvestFileWithUID 2 +timeout 500000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test SetHarvesterObserver +test AddHarvesterEventObserver 1 +test AddObjectObserver +test SetUpHarvesting e:\testing\data\00001.mp3 +request Continue +test HarvestFileWithUID e:\testing\data\00001.mp3 +wait Continue +test EndHarvesterSession +request Query +test QueryAudioObjectByIdIndex 0 +wait Query +test RemoveObject e:\testing\data\00001.mp3 +test Results +test RemoveHarvesterEventObserver 1 +test RemoveHarvesterObserver +test RemoveObjectObserver +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title Harvester Event Basic Test +timeout 180000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test AddHarvesterEventObserver 1 +test SetUpHarvesting e:\testing\data\bmp_burst.bmp +test SetUpHarvesting e:\testing\data\G4.TIF +test SetUpHarvesting e:\testing\data\PNGtestimage.png +test SetUpHarvesting e:\testing\data\GIF87testimage.gif +test SetUpHarvesting e:\testing\data\ota_bmpiso.ota +test SetUpHarvesting e:\testing\data\MBMtestimage.mbm +test SetUpHarvesting e:\testing\data\Liverpool.jpg +test SetUpHarvesting e:\testing\data\00001.mp3 +test HarvestFile e:\testing\data\bmp_burst.bmp +test HarvestFile e:\testing\data\G4.TIF +test HarvestFile e:\testing\data\PNGtestimage.png +test HarvestFile e:\testing\data\GIF87testimage.gif +test HarvestFile e:\testing\data\ota_bmpiso.ota +test HarvestFile e:\testing\data\MBMtestimage.mbm +test HarvestFile e:\testing\data\Liverpool.jpg +test HarvestFileWithUID e:\testing\data\00001.mp3 +test EndHarvesterSession +test RemoveObject e:\testing\data\bmp_burst.bmp +test RemoveObject e:\testing\data\G4.TIF +test RemoveObject e:\testing\data\PNGtestimage.png +test RemoveObject e:\testing\data\GIF87testimage.gif +test RemoveObject e:\testing\data\ota_bmpiso.ota +test RemoveObject e:\testing\data\MBMtestimage.mbm +test RemoveObject e:\testing\data\Liverpool.jpg +test RemoveObject e:\testing\data\00001.mp3 +test RemoveHarvesterEventObserver 1 +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title Harvester Client Long Session +timeout 500000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test SetHarvesterObserver +test AddHarvesterEventObserver 1 +test AddObjectObserver +test SetUpHarvesting e:\testing\data\GIF87testimage.gif +request Continue +test HarvestFile e:\testing\data\GIF87testimage.gif +wait Continue +test EndHarvesterSession +test HarvesterClientPause +test HarvesterClientResume +request Query +test QueryImageObjectByIdIndex 0 +wait Query +test RemoveObject e:\testing\data\GIF87testimage.gif +test Results +test SetUpHarvesting e:\testing\data\bmp_burst.bmp +test SetUpHarvesting e:\testing\data\MBMtestimage.mbm +test HarvestFile e:\testing\data\bmp_burst.bmp +test HarvestFile e:\testing\data\MBMtestimage.mbm +test HarvestFileWithUID e:\testing\data\00001.mp3 +test EndHarvesterSession +test RemoveObject e:\testing\data\bmp_burst.bmp +test RemoveObject e:\testing\data\G4.TIF +test RemoveObject e:\testing\data\PNGtestimage.png +test RemoveObject e:\testing\data\GIF87testimage.gif +test RemoveObject e:\testing\data\ota_bmpiso.ota +test RemoveObject e:\testing\data\MBMtestimage.mbm +test RemoveObject e:\testing\data\Liverpool.jpg +test RemoveObject e:\testing\data\00001.mp3 +test RemoveHarvesterEventObserver 1 +test RemoveHarvesterObserver +test RemoveObjectObserver +test HarvesterClientClose +test TearDown +delete test +[Endtest] + +[Test] +title Harvester Blacklist Test +timeout 180000 +create HarvesterClientTestScripter test +test SetUpBlacklist +test AddFileToBlacklist e:\testing\data\corrupt.jpg +test CheckBlacklist e:\testing\data\corrupt.jpg +test RemoveFileFromBlacklist e:\testing\data\corrupt.jpg +test TearDownBlacklist +delete test +[Endtest] + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/eabi/HarvesterClientTestScripteru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/eabi/HarvesterClientTestScripteru.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/group/HarvesterClientTestScripter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/group/HarvesterClientTestScripter.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + +#include +#include + +TARGET HarvesterClientTestScripter.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E7 + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + +DEFFILE HarvesterClientTestScripter.DEF + +SOURCEPATH ../src +SOURCE HarvesterClientTestScripter.cpp +SOURCE HarvesterClientTestScripterBlocks.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../../../inc +USERINCLUDE ../../../../../harvester/common/inc/ +USERINCLUDE ../../../../../harvester/blacklistclient/inc/ + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY harvesterclient.lib +LIBRARY mdeclient.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY harvestercommon.lib +LIBRARY blacklistclient.lib +LIBRARY efsrv.lib + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/group/HarvesterClientTestScripter.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/group/HarvesterClientTestScripter.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,57 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Installation file for API test +; + +; Languages +&EN + +; Header +#{"HarvesterClientTestScripter"},(0x101FB3E3),1,0,0,TYPE=SA + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Install files +"\epoc32\release\armv5\urel\HarvesterClientTestScripter.dll" - "c:\sys\bin\HarvesterClientTestScripter.dll" +"..\conf\HarvesterClientTestScripter.cfg" - "c:\TestFramework\HarvesterClientTestScripter.cfg" +"..\init\HarvesterClientTestScripter.ini" - "c:\TestFramework\HarvesterClientTestScripter.ini" + +"..\..\data\mmc\HarvesterTest\Jpg.jpg" -"E:\testing\data\Jpg.jpg" +"..\..\data\mmc\HarvesterTest\Animated.gif" -"E:\testing\data\Animated.gif" +"..\..\data\mmc\HarvesterTest\Temp1.jpg" -"E:\testing\data\Temp1.jpg" +"..\..\data\mmc\HarvesterTest\Temp2.jpg" -"E:\testing\data\Temp2.jpg" +"..\..\data\mmc\HarvesterTest\Temp3.jpg" -"E:\testing\data\Temp3.jpg" +"..\..\data\mmc\HarvesterTest\H263.3gp" -"E:\testing\data\H263.3gp" +"..\..\data\mmc\HarvesterTest\bmp_burst.bmp" -"E:\testing\data\bmp_burst.bmp" +"..\..\data\mmc\HarvesterTest\GIF87testimage.gif" -"E:\testing\data\GIF87testimage.gif" +"..\..\data\mmc\HarvesterTest\gif89a_onemeg.gif" -"E:\testing\data\gif89a_onemeg.gif" +"..\..\data\mmc\HarvesterTest\Liverpool.jpg" -"E:\testing\data\Liverpool.jpg" +"..\..\data\mmc\HarvesterTest\MBMtestimage.mbm" -"E:\testing\data\MBMtestimage.mbm" +"..\..\data\mmc\HarvesterTest\wbmp_skull.wbmp" -"E:\testing\data\wbmp_skull.wbmp" +"..\..\data\mmc\HarvesterTest\ota_bmpiso.ota" -"E:\testing\data\ota_bmpiso.ota" +"..\..\data\mmc\HarvesterTest\PNGtestimage.png" -"E:\testing\data\PNGtestimage.png" +"..\..\data\mmc\HarvesterTest\G4.TIF" -"E:\testing\data\G4.TIF" +"..\..\data\mmc\HarvesterTest\G31D.TIF" -"E:\testing\data\G31D.TIF" +"..\..\data\mmc\HarvesterTest\PSRETRO.WMF" -"E:\testing\data\PSRETRO.WMF" +"..\..\data\mmc\HarvesterTest\Animated.gif" -"E:\testing\data\Animated.gif" +"..\..\data\mmc\HarvesterTest\Mbm.mbm" -"E:\testing\data\Mbm.mbm" +"..\..\data\mmc\HarvesterTest\MPEG4.3gp" -"E:\testing\data\MPEG4.3gp" +"..\..\data\mmc\HarvesterTest\MPEG4.mp4" -"E:\testing\data\MPEG4.mp4" +"..\..\data\mmc\HarvesterTest\00001.mp3" -"E:\testing\data\00001.mp3" +"..\..\data\mmc\HarvesterTest\corrupt.jpg" -"E:\testing\data\corrupt.jpg" + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +HarvesterClientTestScripter.mmp + +PRJ_TESTEXPORTS + +../conf/HarvesterClientTestScripter.cfg /epoc32/winscw/c/TestFramework/HarvesterClientTestScripter.cfg +../init/HarvesterClientTestScripter.ini /epoc32/winscw/c/TestFramework/HarvesterClientTestScripter.ini + +../../data/mmc/HarvesterTest/bmp_burst.bmp /epoc32/winscw/c/Data/bmp_burst.bmp +../../data/mmc/HarvesterTest/G31D.TIF /epoc32/winscw/c/Data/G31D.TIF +../../data/mmc/HarvesterTest/G4.TIF /epoc32/winscw/c/Data/G4.TIF +../../data/mmc/HarvesterTest/GIF87testimage.gif /epoc32/winscw/c/Data/GIF87testimage.gif +../../data/mmc/HarvesterTest/gif89a_onemeg.gif /epoc32/winscw/c/Data/gif89a_onemeg.gif +../../data/mmc/HarvesterTest/Liverpool.jpg /epoc32/winscw/c/Data/Liverpool.jpg +../../data/mmc/HarvesterTest/MBMtestimage.mbm /epoc32/winscw/c/Data/MBMtestimage.mbm +../../data/mmc/HarvesterTest/ota_bmpiso.ota /epoc32/winscw/c/Data/ota_bmpiso.ota +../../data/mmc/HarvesterTest/PNGtestimage.png /epoc32/winscw/c/Data/PNGtestimage.png +../../data/mmc/HarvesterTest/PSRETRO.WMF /epoc32/winscw/c/Data/PSRETRO.WMF +../../data/mmc/HarvesterTest/wbmp_skull.wbmp /epoc32/winscw/c/Data/wbmp_skull.wbmp +../../data/mmc/HarvesterTest/Jpg.jpg /epoc32/winscw/c/Data/Jpg.jpg +../../data/mmc/HarvesterTest/Animated.gif /epoc32/winscw/c/Data/Animated.gif +../../data/mmc/HarvesterTest/Mbm.mbm /epoc32/winscw/c/Data/Mbm.mbm +../../data/mmc/HarvesterTest/H263.3gp /epoc32/winscw/c/Data/H263.3gp +../../data/mmc/HarvesterTest/MPEG4.mp4 /epoc32/winscw/c/Data/MPEG4.mp4 +../../data/mmc/HarvesterTest/MPEG4.3gp /epoc32/winscw/c/Data/MPEG4.3gp +../../data/mmc/HarvesterTest/Temp1.jpg /epoc32/winscw/c/Data/Temp1.jpg +../../data/mmc/HarvesterTest/Temp2.jpg /epoc32/winscw/c/Data/Temp2.jpg +../../data/mmc/HarvesterTest/Temp3.jpg /epoc32/winscw/c/Data/Temp3.jpg +../../data/mmc/HarvesterTest/00001.mp3 /epoc32/winscw/c/Data/00001.mp3 +../../data/mmc/HarvesterTest/corrupt.jpg /epoc32/winscw/c/Data/corrupt.jpg diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/inc/HarvesterClientTestScripter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/inc/HarvesterClientTestScripter.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,180 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef HARVESTERCLIENTTESTSCRIPTER_H +#define HARVESTERCLIENTTESTSCRIPTER_H + +// INCLUDES +#include +#include +#include +#include "harvesterclient.h" +#include "mdccommon.h" +#include "mdesession.h" +#include "mdequery.h" +#include "harvestermediaidutil.h" +#include "blacklistclient.h" + +// CONSTANTS + +// MACROS +// Logging path +_LIT( KHarvesterClientTestScripterLogPath, "\\logs\\testframework\\HarvesterClientTestScripter\\" ); +// Log file +_LIT( KHarvesterClientTestScripterLogFile, "HarvesterClientTestScripter.txt" ); +_LIT( KHarvesterClientTestScripterLogFileWithTitle, "HarvesterClientTestScripter_[%S].txt" ); + +// FORWARD DECLARATIONS +class CMdEHarvesterSession; +class CHarvesterClientTestScripter; + +// CLASS DECLARATION + +/** +* CHarvesterClientTestScripter test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CHarvesterClientTestScripter) : public CScriptBase, + public MMdESessionObserver, + public MHarvestObserver, + public MMdEQueryObserver, + public MMdEObjectObserver, + public MHarvesterEventObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CHarvesterClientTestScripter* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CHarvesterClientTestScripter(); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + private: // Functions from base classes + void HandleSessionOpened(CMdESession& aSession, TInt aError); + void HandleSessionError(CMdESession& aSession, TInt aError); + void HandleObjectNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray); + void HandleQueryNewResults(CMdEQuery& aQuery, + TInt aFirstNewItemIndex, + TInt aNewItemCount); + void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); + + void HarvestingComplete( TDesC& aURI, TInt aError ); + void HarvestingUpdated( HarvesterEventObserverType aHEObserverType, + HarvesterEventState aHarvesterEventState, + TInt aItemsLeft ); + + private: + + /** + * C++ default constructor. + */ + CHarvesterClientTestScripter( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + void CheckComplete(); + /** + * Test helper methods are listed below. + */ + virtual TInt AddObjectObserverL( CStifItemParser& aItem ); + virtual TInt RemoveObjectObserverL( CStifItemParser& aItem ); + virtual TInt BeginHarvesterSessionL( CStifItemParser& aItem ); + virtual TInt EndHarvesterSessionL( CStifItemParser& aItem ); + + /** + * Test methods are listed below. + */ + virtual TInt SetUp( CStifItemParser& aItem ); + virtual TInt TearDown( CStifItemParser& aItem ); + virtual TInt HarvesterClientConnectL( CStifItemParser& aItem ); + virtual TInt HarvesterClientCloseL( CStifItemParser& aItem ); + virtual TInt HarvesterClientPauseL( CStifItemParser& aItem ); + virtual TInt HarvesterClientResumeL( CStifItemParser& aItem ); + virtual TInt SetHarvesterObserverL( CStifItemParser& aItem ); + virtual TInt RemoveHarvesterObserverL( CStifItemParser& aItem ); + virtual TInt SetLocationInfoL( CStifItemParser& aItem ); + virtual TInt HarvestFileL( CStifItemParser& aItem ); + virtual TInt HarvestFileWithUIDL( CStifItemParser& aItem ); + virtual TInt QueryImageObjectByIdIndexL( CStifItemParser& aItem ); + virtual TInt QueryAudioObjectByIdIndexL( CStifItemParser& aItem ); + virtual TInt RemoveObjectL( CStifItemParser& aItem ); + virtual TInt Results( CStifItemParser& aItem ); + virtual TInt AddHarvesterEventObserverL( CStifItemParser& aItem ); + virtual TInt RemoveHarvesterEventObserverL( CStifItemParser& aItem ); + virtual TInt SetUpBlacklistL( CStifItemParser& aItem ); + virtual TInt TearDownBlacklistL( CStifItemParser& aItem ); + virtual TInt AddFileToBlacklistL( CStifItemParser& aItem ); + virtual TInt CheckBlacklistL( CStifItemParser& aItem ); + virtual TInt RemoveFileFromBlacklistL( CStifItemParser& aItem ); + + private: // Data + // Status booleans + TBool iHarvestingComplete; + TBool iPlaceholderComplete; + TBool iNewObjectComplete; + TBool iQuerySuccess; + TBool iObjectNotification; + TBool iSetLocation; + + // Test helper classes + CMdESession* iMdeSession; + CMdEHarvesterSession* iHarvesterSession; + CMdEQuery* iQuery; + + RHarvesterClient iHc; + RArray iAlbumIds; + RArray iObjectIdArray; + + TFileName iUri; + + RBlacklistClient iBlacklistClient; + CHarvesterMediaIdUtil* iMediaIdUtil; + RFs iFs; + }; + +#endif // HARVESTERCLIENTTESTSCRIPTER_H + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/init/HarvesterClientTestScripter.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/init/HarvesterClientTestScripter.ini Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,81 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= HarvesterClientTestScripterLog + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 600000 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testframework\HarvesterClientTestScripter.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +HardwareBasePath= C:\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/src/HarvesterClientTestScripter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/src/HarvesterClientTestScripter.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// INCLUDE FILES +#include +#include "HarvesterClientTestScripter.h" + +// EXTERNAL DATA STRUCTURES + +// EXTERNAL FUNCTION PROTOTYPES + +// CONSTANTS + +// MACROS + +// LOCAL CONSTANTS AND MACROS + +// MODULE DATA STRUCTURES + +// LOCAL FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS + +// ============================= LOCAL FUNCTIONS =============================== + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHarvesterClientTestScripter::CHarvesterClientTestScripter +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CHarvesterClientTestScripter::CHarvesterClientTestScripter( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTestScripter::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CHarvesterClientTestScripter::ConstructL() + { + iLog = CStifLogger::NewL( KHarvesterClientTestScripterLogPath, + KHarvesterClientTestScripterLogFile, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTestScripter::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CHarvesterClientTestScripter* CHarvesterClientTestScripter::NewL( + CTestModuleIf& aTestModuleIf ) + { + CHarvesterClientTestScripter* self = new (ELeave) CHarvesterClientTestScripter( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + + } + +// Destructor +CHarvesterClientTestScripter::~CHarvesterClientTestScripter() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CHarvesterClientTestScripter::NewL( aTestModuleIf ); + + } + + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/src/HarvesterClientTestScripterBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/src/HarvesterClientTestScripterBlocks.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,833 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include +#include "HarvesterClientTestScripter.h" +#include "mdcserializationbuffer.h" +#include "mdeharvestersession.h" +#include "mdsutils.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHarvesterClientTestScripter::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CHarvesterClientTestScripter::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTestScripter::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::RunMethodL( + CStifItemParser& aItem ) + { + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + ENTRY( "SetUp", CHarvesterClientTestScripter::SetUp ), + ENTRY( "TearDown", CHarvesterClientTestScripter::TearDown ), + + // Test helper methods + ENTRY( "AddObjectObserver", CHarvesterClientTestScripter::AddObjectObserverL ), + ENTRY( "RemoveObjectObserver", CHarvesterClientTestScripter::RemoveObjectObserverL ), + ENTRY( "SetUpHarvesting", CHarvesterClientTestScripter::BeginHarvesterSessionL ), + ENTRY( "EndHarvesterSession", CHarvesterClientTestScripter::EndHarvesterSessionL ), + + // Harvester tests + ENTRY( "HarvesterClientConnect", CHarvesterClientTestScripter::HarvesterClientConnectL ), + ENTRY( "HarvesterClientClose", CHarvesterClientTestScripter::HarvesterClientCloseL ), + ENTRY( "HarvesterClientPause", CHarvesterClientTestScripter::HarvesterClientPauseL ), + ENTRY( "HarvesterClientResume", CHarvesterClientTestScripter::HarvesterClientResumeL ), + ENTRY( "SetHarvesterObserver", CHarvesterClientTestScripter::SetHarvesterObserverL ), + ENTRY( "RemoveHarvesterObserver", CHarvesterClientTestScripter::RemoveHarvesterObserverL ), + ENTRY( "SetLocationInfo", CHarvesterClientTestScripter::SetLocationInfoL ), + ENTRY( "HarvestFile", CHarvesterClientTestScripter::HarvestFileL ), + ENTRY( "HarvestFileWithUID", CHarvesterClientTestScripter::HarvestFileWithUIDL ), + ENTRY( "QueryImageObjectByIdIndex", CHarvesterClientTestScripter::QueryImageObjectByIdIndexL ), + ENTRY( "QueryAudioObjectByIdIndex", CHarvesterClientTestScripter::QueryAudioObjectByIdIndexL ), + ENTRY( "RemoveObject", CHarvesterClientTestScripter::RemoveObjectL ), + ENTRY( "Results", CHarvesterClientTestScripter::Results ), + ENTRY( "AddHarvesterEventObserver", CHarvesterClientTestScripter::AddHarvesterEventObserverL ), + ENTRY( "RemoveHarvesterEventObserver", CHarvesterClientTestScripter::RemoveHarvesterEventObserverL ), + ENTRY( "SetUpBlacklist", CHarvesterClientTestScripter::SetUpBlacklistL ), + ENTRY( "TearDownBlacklist", CHarvesterClientTestScripter::TearDownBlacklistL ), + ENTRY( "AddFileToBlacklist", CHarvesterClientTestScripter::AddFileToBlacklistL ), + ENTRY( "CheckBlacklist", CHarvesterClientTestScripter::CheckBlacklistL ), + ENTRY( "RemoveFileFromBlacklist", CHarvesterClientTestScripter::RemoveFileFromBlacklistL ), + }; + + const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::SetUp +// Set up test. +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::SetUp( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "SetUp" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iHarvestingComplete = EFalse; + iPlaceholderComplete = EFalse; + iNewObjectComplete = EFalse; + iObjectNotification = EFalse; + iSetLocation = EFalse; + iObjectIdArray.Reset(); + TRAP_IGNORE( iMdeSession = CMdESession::NewL( *this ) ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::TearDown +// Tear down test. +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::TearDown( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "TearDown" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + delete iHarvesterSession; + iHarvesterSession = NULL; + delete iMdeSession; + iMdeSession = NULL; + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HarvesterClientConnectL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::HarvesterClientConnectL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "HarvesterClientConnectL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + User::LeaveIfError( iHc.Connect() ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HarvesterClientCloseL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::HarvesterClientCloseL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "HarvesterClientCloseL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iHc.Close(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HarvesterClientPauseL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::HarvesterClientPauseL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter HarvesterClientPauseL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + User::LeaveIfError( iHc.Pause() ); + + _LIT( KMsg2, "Exit HarvesterClientPauseL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HarvesterClientResumeL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::HarvesterClientResumeL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter HarvesterClientResumeL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + User::LeaveIfError( iHc.Resume() ); + + _LIT( KMsg2, "Exit HarvesterClientResumeL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::SetHarvesterObserverL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::SetHarvesterObserverL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "SetHarvesterObserverL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iHc.SetObserver( this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::RemoveHarvesterObserverL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::RemoveHarvesterObserverL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "RemoveHarvesterObserverL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iHc.RemoveObserver( this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::AddObjectObserverL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::AddObjectObserverL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "AddObjectObserverL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iMdeSession->AddObjectObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::AddObjectObserverL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::RemoveObjectObserverL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "RemoveObjectObserverL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TRAP_IGNORE( iMdeSession->RemoveObjectObserverL( *this ) ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::AddObjectObserverL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::SetLocationInfoL( CStifItemParser& /* aItem */ ) + { + iSetLocation = ETrue; + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::StartHarvesterSessionL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::BeginHarvesterSessionL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "Enter BeginHarvesterSessionL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TPtrC inputFile; + User::LeaveIfError( aItem.GetNextString( inputFile )); + + TRAP_IGNORE( iMdeSession->RemoveObjectL(inputFile) ); + + _LIT( KMsg2, "Exit BeginHarvesterSessionL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HarvestFileTestL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::HarvestFileL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "Enter HarvestFileL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TPtrC inputFile; + User::LeaveIfError( aItem.GetNextString( inputFile )); + iAlbumIds.Append( 1 ); + iQuerySuccess = EFalse; + + iUri = inputFile; + iHc.HarvestFile( inputFile, iAlbumIds, iSetLocation ); + + _LIT( KMsg2, "Exit HarvestFileL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HarvestFileTestL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::HarvestFileWithUIDL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "Enter HarvestFileWithUIDL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TUid uid( KNullUid ); + + TPtrC inputFile; + User::LeaveIfError( aItem.GetNextString( inputFile )); + iAlbumIds.Append( 1 ); + iQuerySuccess = EFalse; + + iUri = inputFile; + iHc.HarvestFileWithUID( inputFile, iAlbumIds, EFalse, uid ); + + _LIT( KMsg2, "Exit HarvestFileWithUIDL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HarvestingCompleteL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::EndHarvesterSessionL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "EndHarvesterSessionL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iAlbumIds.Close(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::QueryObjectByIdIndexL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::QueryImageObjectByIdIndexL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "QueryImageObjectByIdIndexL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt index; + User::LeaveIfError( aItem.GetNextInt( index )); + + CMdENamespaceDef& defNS = iMdeSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& objDef = defNS.GetObjectDefL( MdeConstants::Image::KImageObject ); + iQuery = iMdeSession->NewObjectQueryL( defNS, objDef, this ); + + iQuery->SetResultMode( EQueryResultModeItem ); + + iQuery->FindL(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::QueryObjectByIdIndexL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::QueryAudioObjectByIdIndexL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "QueryAudioObjectByIdIndexL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt index; + User::LeaveIfError( aItem.GetNextInt( index )); + + CMdENamespaceDef& defNS = iMdeSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& objDef = defNS.GetObjectDefL( MdeConstants::Audio::KAudioObject ); + iQuery = iMdeSession->NewObjectQueryL( defNS, objDef, this ); + + iQuery->SetResultMode( EQueryResultModeItem ); + + iQuery->FindL(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::RemoveObjectL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::RemoveObjectL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "RemoveObjectL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TPtrC inputFile; + User::LeaveIfError( aItem.GetNextString( inputFile )); + + TRAP_IGNORE( iMdeSession->RemoveObjectL( inputFile ) ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::Results +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::Results( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter Results" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if( !iQuerySuccess ) + { + return KErrNotFound; + } + + if( !iHarvestingComplete ) + { + return KErrUnknown; + } + + _LIT( KMsg2, "Enter Results" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::AddHarvesterEventObserver +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::AddHarvesterEventObserverL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "AddHarvesterEventObserverL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt testCount( 0 ); + User::LeaveIfError( aItem.GetNextInt( testCount ) ); + for( TInt i = 0; i < testCount; i++ ) + { + TInt err = iHc.AddHarvesterEventObserver( *this, EHEObserverTypePlaceholder, 3 ); + TL( err == KErrNone ); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::RemoveHarvesterEventObserver +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::RemoveHarvesterEventObserverL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "RemoveHarvesterEventObserverL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt testCount( 0 ); + User::LeaveIfError( aItem.GetNextInt( testCount ) ); + + for( TInt i = 0; i < testCount; i++ ) + { + TInt err = iHc.RemoveHarvesterEventObserver( *this ); + TL( err == KErrNone ); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::SetUpBlacklistL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::SetUpBlacklistL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter SetUpBlacklistL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + User::LeaveIfError( iBlacklistClient.Connect() ); + iBlacklistClient.LoadBlacklistL(); + iMediaIdUtil = &RMediaIdUtil::GetInstanceL(); + User::LeaveIfError( iFs.Connect() ); + + _LIT( KMsg2, "Exit SetUpBlacklistL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::TearDownBlacklistL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::TearDownBlacklistL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter TearDownBlacklistL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iBlacklistClient.CloseDBL(); + iBlacklistClient.Close(); + RMediaIdUtil::ReleaseInstance(); + iMediaIdUtil = NULL; + iFs.Close(); + + _LIT( KMsg2, "Exit TearDownBlacklistL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::AddFileToBlacklistL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::AddFileToBlacklistL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "Enter AddFileToBlacklistL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TPtrC inputFile; + User::LeaveIfError( aItem.GetNextString( inputFile )); + + TUint32 mediaId( 0 ); + TTime modified ( 0 ); + + TRAPD( err, iBlacklistClient.AddL( inputFile, mediaId, modified ) ); + if( err != KErrNone ) + { + return err; + } + + _LIT( KMsg2, "Exit AddFileToBlacklistL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::CheckBlacklistL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::CheckBlacklistL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "Enter CheckBlacklistL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TPtrC inputFile; + User::LeaveIfError( aItem.GetNextString( inputFile )); + + TUint32 mediaId( 0 ); + TTime modified ( 0 ); + + TBool isBlacklisted( ETrue ); + _LIT( KMsg2, "Check blacklist prepare state" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + TRAP_IGNORE( isBlacklisted = iBlacklistClient.IsBlacklistedL( inputFile, mediaId, modified ) ); + if( isBlacklisted ) + { + return KErrBadName; + } + + _LIT( KMsg3, "Close blacklist to commit the changes" ); + iLog->Log( KMsg3 ); + RDebug::Print( KMsg3 ); + iBlacklistClient.CloseDBL(); + iBlacklistClient.Close(); + + _LIT( KMsg4, "Re-open blacklist to check changes" ); + iLog->Log( KMsg4 ); + RDebug::Print( KMsg4 ); + User::LeaveIfError( iBlacklistClient.Connect() ); + iBlacklistClient.LoadBlacklistL(); + + _LIT( KMsg5, "Check changes" ); + iLog->Log( KMsg5 ); + RDebug::Print( KMsg5 ); + + isBlacklisted = EFalse; + TRAP_IGNORE( isBlacklisted = iBlacklistClient.IsBlacklistedL( inputFile, mediaId, modified ) ); + if( !isBlacklisted ) + { + return KErrNotFound; + } + + _LIT( KMsg6, "Exit CheckBlacklistL" ); + iLog->Log( KMsg6 ); + RDebug::Print( KMsg6 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::RemoveFileFromBlacklistL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterClientTestScripter::RemoveFileFromBlacklistL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "Enter CheckBlacklistL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TPtrC inputFile; + User::LeaveIfError( aItem.GetNextString( inputFile )); + + TUint32 mediaId( 0 ); + TTime modified ( 0 ); + + TRAPD( err, iBlacklistClient.RemoveL( inputFile, mediaId ) ); + if( err != KErrNone ) + { + return err; + } + + _LIT( KMsg2, "Exit CheckBlacklistL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HarvestingUpdated +// ----------------------------------------------------------------------------- +// +void CHarvesterClientTestScripter::HarvestingUpdated( + HarvesterEventObserverType /*aHEObserverType*/, + HarvesterEventState /*aHarvesterEventState*/, + TInt /*aItemsLeft*/ ) + { + _LIT( KMsg1, "CallBck HarvestingUpdated" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HarvestingComplete +// ----------------------------------------------------------------------------- +// +void CHarvesterClientTestScripter::HarvestingComplete( TDesC& aURI, TInt aError ) + { + _LIT( KMsg, "CallBck HarvestingComplete - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print( msg ); + + if( MdsUtils::Compare( aURI, iUri ) == 0 ) + { + if( iObjectNotification ) + { + iHarvestingComplete = ETrue; + // session event + TEventIf event( TEventIf::ESetEvent, _L("Continue") ); + TestModuleIf().Event( event ); + } + else + { + iHarvestingComplete = ETrue; + } + } + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HandleSessionOpened +// ----------------------------------------------------------------------------- +// +void CHarvesterClientTestScripter::HandleSessionOpened( CMdESession& /* aSession */, TInt aError ) + { + _LIT( KMsg, "CallBck HandleSessionOpened - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print( msg ); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HandleSessionError +// ----------------------------------------------------------------------------- +// +void CHarvesterClientTestScripter::HandleSessionError( CMdESession& /* aSession */, TInt aError ) + { + _LIT( KMsg, "CallBck HandleSessionError - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print( msg ); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HandleObjectNotification +// ----------------------------------------------------------------------------- +// +void CHarvesterClientTestScripter::HandleObjectNotification( + CMdESession& /* aSession */, + TObserverNotificationType aType, + const RArray& aObjectIdArray ) + { + _LIT( KMsg1, "CallBck HandleObjectNotification" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + switch( aType ) + { + case ENotifyAdd: + { + iPlaceholderComplete = ETrue; + break; + } + case ENotifyModify: + { + iNewObjectComplete = ETrue; + break; + } + case ENotifyRemove: + { + break; + } + } + + CMdEObject* temp = NULL; + TRAP_IGNORE( temp = iMdeSession->GetObjectL( iUri ) ); + if( temp && iHarvestingComplete ) + { + for ( TInt i = 0; i < aObjectIdArray.Count(); ++i ) + { + iObjectIdArray.Append( aObjectIdArray[i] ); + } + // session event + TEventIf event( TEventIf::ESetEvent, _L("Continue") ); + TestModuleIf().Event( event ); + iObjectNotification = ETrue; + } + else if( temp ) + { + for ( TInt i = 0; i < aObjectIdArray.Count(); ++i ) + { + iObjectIdArray.Append( aObjectIdArray[i] ); + } + iObjectNotification = ETrue; + } + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HandleQueryNewResults +// ----------------------------------------------------------------------------- +// +void CHarvesterClientTestScripter::HandleQueryNewResults( CMdEQuery& /* aQuery */, + TInt /* aFirstNewItemIndex */, + TInt /* aNewItemCount */ ) + { + _LIT( KMsg1, "CallBck HandleQueryNewResults" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + } + +// ----------------------------------------------------------------------------- +// CHarvesterClientTest::HandleQueryCompleted +// ----------------------------------------------------------------------------- +// +void CHarvesterClientTestScripter::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError) + { + _LIT( KMsg, "CallBck HandleQueryCompleted - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print( msg ); + + if( iQuery && iQuery == &aQuery ) + { + for( TInt i = 0; i < aQuery.Count(); i++ ) + { + TInt id = aQuery.ResultItem( i ).Id(); + CMdEObject* temp = NULL; + TRAP_IGNORE( temp = iMdeSession->GetFullObjectL( id ) ); + if( MdsUtils::Compare( temp->Uri(), iUri ) == 0 ) + { + iQuerySuccess = ETrue; + break; + } + } + } + + if( iQuerySuccess ) + { + // session event + TEventIf event( TEventIf::ESetEvent, _L("Query") ); + TestModuleIf().Event( event ); + } + } + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/Bmarm/HarvesterDataTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/Bmarm/HarvesterDataTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/Bwins/HarvesterDataTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/Bwins/HarvesterDataTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/conf/HarvesterDataTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/conf/HarvesterDataTest.cfg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,61 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Harvester Data API tests +# + +// --------------------------------------------------------------------------- +// Harvester Data API test cases +// --------------------------------------------------------------------------- + +// These should be run in sequential mode if several cases are run at the same +// time! + +[StifSettings] +TestThreadStackSize= 32768 +TestThreadMinHeap= 4096 +TestThreadMaxHeap= 16777216 +[EndStifSettings] + +[Test] +title Harvest Client Data Tests +create HarvesterDataTest test +request Session +test BeginTestSession +wait Session +test HarvestClientDataTests +test EndTestSession +delete test +[Endtest] + +[Test] +title Placeholder Data Tests +create HarvesterDataTest test +request Session +test BeginTestSession +wait Session +test PlaceholderDataTests +test EndTestSession +delete test +[Endtest] + +[Test] +title Harvester Data Tests +create HarvesterDataTest test +request Session +test BeginTestSession +wait Session +test HarvesterDataTests +test EndTestSession +delete test +[Endtest] \ No newline at end of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/eabi/HarvesterDataTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/eabi/HarvesterDataTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/group/HarvesterDataTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/group/HarvesterDataTest.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + +#include +#include + +TARGET HarvesterDataTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + +DEFFILE HarvesterDataTest.DEF + +SOURCEPATH ../src +SOURCE HarvesterDataTest.cpp +SOURCE HarvesterDataTestBlocks.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../../../inc +USERINCLUDE ../../../../../locationmanager/locationtrail/inc +SYSTEMINCLUDE /epoc32/include/ecom + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY ecom.lib +LIBRARY harvesterdata.lib +LIBRARY mdeclient.lib +LIBRARY etel3rdparty.lib +LIBRARY Lbs.lib + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/group/HarvesterDataTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/group/HarvesterDataTest.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,56 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Installation file for API test +; + +; Languages +&EN + +; Header +#{"HarvesterDataTest"},(0x101FB3E3),1,0,0,TYPE=SA + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Install files +"\epoc32\release\armv5\urel\HarvesterDataTest.dll" - "c:\sys\bin\HarvesterDataTest.dll" +"..\conf\HarvesterDataTest.cfg" - "c:\TestFramework\HarvesterDataTest.cfg" +"..\init\HarvesterDataTest.ini" - "c:\TestFramework\HarvesterDataTest.ini" + +"..\..\data\mmc\HarvesterTest\Jpg.jpg" -"E:\testing\data\Jpg.jpg" +"..\..\data\mmc\HarvesterTest\Animated.gif" -"E:\testing\data\Animated.gif" +"..\..\data\mmc\HarvesterTest\Temp1.jpg" -"E:\testing\data\Temp1.jpg" +"..\..\data\mmc\HarvesterTest\Temp2.jpg" -"E:\testing\data\Temp2.jpg" +"..\..\data\mmc\HarvesterTest\Temp3.jpg" -"E:\testing\data\Temp3.jpg" +"..\..\data\mmc\HarvesterTest\H263.3gp" -"E:\testing\data\H263.3gp" +"..\..\data\mmc\HarvesterTest\bmp_burst.bmp" -"E:\testing\data\bmp_burst.bmp" +"..\..\data\mmc\HarvesterTest\GIF87testimage.gif" -"E:\testing\data\GIF87testimage.gif" +"..\..\data\mmc\HarvesterTest\gif89a_onemeg.gif" -"E:\testing\data\gif89a_onemeg.gif" +"..\..\data\mmc\HarvesterTest\Liverpool.jpg" -"E:\testing\data\Liverpool.jpg" +"..\..\data\mmc\HarvesterTest\MBMtestimage.mbm" -"E:\testing\data\MBMtestimage.mbm" +"..\..\data\mmc\HarvesterTest\wbmp_skull.wbmp" -"E:\testing\data\wbmp_skull.wbmp" +"..\..\data\mmc\HarvesterTest\ota_bmpiso.ota" -"E:\testing\data\ota_bmpiso.ota" +"..\..\data\mmc\HarvesterTest\PNGtestimage.png" -"E:\testing\data\PNGtestimage.png" +"..\..\data\mmc\HarvesterTest\G4.TIF" -"E:\testing\data\G4.TIF" +"..\..\data\mmc\HarvesterTest\G31D.TIF" -"E:\testing\data\G31D.TIF" +"..\..\data\mmc\HarvesterTest\PSRETRO.WMF" -"E:\testing\data\PSRETRO.WMF" +"..\..\data\mmc\HarvesterTest\Animated.gif" -"E:\testing\data\Animated.gif" +"..\..\data\mmc\HarvesterTest\Mbm.mbm" -"E:\testing\data\Mbm.mbm" +"..\..\data\mmc\HarvesterTest\MPEG4.3gp" -"E:\testing\data\MPEG4.3gp" +"..\..\data\mmc\HarvesterTest\MPEG4.mp4" -"E:\testing\data\MPEG4.mp4" +"..\..\data\mmc\HarvesterTest\00001.mp3" -"E:\testing\data\00001.mp3" + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +HarvesterDataTest.mmp + +PRJ_TESTEXPORTS + +../conf/HarvesterDataTest.cfg /epoc32/winscw/c/TestFramework/HarvesterDataTest.cfg +../init/HarvesterDataTest.ini /epoc32/winscw/c/TestFramework/HarvesterDataTest.ini + +../../data/mmc/HarvesterTest/bmp_burst.bmp /epoc32/winscw/c/Data/bmp_burst.bmp +../../data/mmc/HarvesterTest/G31D.TIF /epoc32/winscw/c/Data/G31D.TIF +../../data/mmc/HarvesterTest/G4.TIF /epoc32/winscw/c/Data/G4.TIF +../../data/mmc/HarvesterTest/GIF87testimage.gif /epoc32/winscw/c/Data/GIF87testimage.gif +../../data/mmc/HarvesterTest/gif89a_onemeg.gif /epoc32/winscw/c/Data/gif89a_onemeg.gif +../../data/mmc/HarvesterTest/Liverpool.jpg /epoc32/winscw/c/Data/Liverpool.jpg +../../data/mmc/HarvesterTest/MBMtestimage.mbm /epoc32/winscw/c/Data/MBMtestimage.mbm +../../data/mmc/HarvesterTest/ota_bmpiso.ota /epoc32/winscw/c/Data/ota_bmpiso.ota +../../data/mmc/HarvesterTest/PNGtestimage.png /epoc32/winscw/c/Data/PNGtestimage.png +../../data/mmc/HarvesterTest/PSRETRO.WMF /epoc32/winscw/c/Data/PSRETRO.WMF +../../data/mmc/HarvesterTest/wbmp_skull.wbmp /epoc32/winscw/c/Data/wbmp_skull.wbmp +../../data/mmc/HarvesterTest/Jpg.jpg /epoc32/winscw/c/Data/Jpg.jpg +../../data/mmc/HarvesterTest/Animated.gif /epoc32/winscw/c/Data/Animated.gif +../../data/mmc/HarvesterTest/Mbm.mbm /epoc32/winscw/c/Data/Mbm.mbm +../../data/mmc/HarvesterTest/H263.3gp /epoc32/winscw/c/Data/H263.3gp +../../data/mmc/HarvesterTest/MPEG4.mp4 /epoc32/winscw/c/Data/MPEG4.mp4 +../../data/mmc/HarvesterTest/MPEG4.3gp /epoc32/winscw/c/Data/MPEG4.3gp +../../data/mmc/HarvesterTest/Temp1.jpg /epoc32/winscw/c/Data/Temp1.jpg +../../data/mmc/HarvesterTest/Temp2.jpg /epoc32/winscw/c/Data/Temp2.jpg +../../data/mmc/HarvesterTest/Temp3.jpg /epoc32/winscw/c/Data/Temp3.jpg +../../data/mmc/HarvesterTest/00001.mp3 /epoc32/winscw/c/Data/00001.mp3 + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/inc/HarvesterDataTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/inc/HarvesterDataTest.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,117 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + + +#ifndef HARVESTERDATATEST_H +#define HARVESTERDATATEST_H + +// INCLUDES +#include +#include +#include + +#include +#include +#include + +// Logging path +_LIT( KHarvesterDataTestLogPath, "\\logs\\testframework\\HarvesterDataTest\\" ); +// Log file +_LIT( KHarvesterDataTestLogFile, "HarvesterDataTest.txt" ); +_LIT( KHarvesterDataTestLogFileWithTitle, "HarvesterDataTest_[%S].txt" ); + +// FORWARD DECLARATIONS +class CHarvesterDataTest; + +// CLASS DECLARATION +NONSHARABLE_CLASS(CHarvesterDataTest) : public CScriptBase, + public MMdESessionObserver, + public MHarvesterPluginObserver, + public MMonitorPluginObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CHarvesterDataTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CHarvesterDataTest(); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + private: // Functions from base classes + + void HandleSessionOpened(CMdESession& aSession, TInt aError); + void HandleSessionError(CMdESession& aSession, TInt aError); + void HarvestingCompleted( CHarvesterData* aHarvesterData ); + void MonitorEvent( CHarvesterData* aHarvesterData ); + void MonitorEvent( RPointerArray& aHarvesterDataArray ); + + private: + + /** + * C++ default constructor. + */ + CHarvesterDataTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + virtual TInt ActiveWait( CStifItemParser& aItem ); + virtual TInt BeginTestSessionL( CStifItemParser& aItem ); + virtual TInt EndTestSession( CStifItemParser& aItem ); + virtual TInt HarvestClientDataTestsL( CStifItemParser& aItem ); + virtual TInt PlaceholderDataTestsL( CStifItemParser& aItem ); + virtual TInt HarvesterDataTestsL( CStifItemParser& aItem ); + + //[TestMethods] - Do not remove + + private: // Data + + CMdESession* iMdEClient; + + RArray iAlbumIds; + }; + +#endif // HARVESTERDATATEST_H + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/init/HarvesterDataTest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/init/HarvesterDataTest.ini Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,81 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= HarvesterDataTestLog + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 600000 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testframework\HarvesterDataTest.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +HardwareBasePath= C:\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/src/HarvesterDataTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/src/HarvesterDataTest.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// INCLUDE FILES +#include +#include "HarvesterDataTest.h" +#include + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::CHarvesterDataTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CHarvesterDataTest::CHarvesterDataTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CHarvesterDataTest::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KHarvesterDataTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KHarvesterDataTestLogFile); + } + + iLog = CStifLogger::NewL( KHarvesterDataTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CHarvesterDataTest* CHarvesterDataTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CHarvesterDataTest* self = new (ELeave) CHarvesterDataTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + + } + +// Destructor +CHarvesterDataTest::~CHarvesterDataTest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CHarvesterDataTest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/src/HarvesterDataTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterDataTest/src/HarvesterDataTestBlocks.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,568 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include +#include "HarvesterDataTest.h" + +#include +#include "cnetworkinfo.h" +#include "mdsutils.h" +#include "mdeconstants.h" + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CHarvesterDataTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CHarvesterDataTest::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + ENTRY( "ActiveWait", CHarvesterDataTest::ActiveWait ), + ENTRY( "BeginTestSession", CHarvesterDataTest::BeginTestSessionL ), + ENTRY( "EndTestSession", CHarvesterDataTest::EndTestSession ), + ENTRY( "HarvestClientDataTests", CHarvesterDataTest::HarvestClientDataTestsL ), + ENTRY( "PlaceholderDataTests", CHarvesterDataTest::PlaceholderDataTestsL ), + ENTRY( "HarvesterDataTests", CHarvesterDataTest::HarvesterDataTestsL ), + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::HandleSessionOpened +// ----------------------------------------------------------------------------- +// +void CHarvesterDataTest::HandleSessionOpened( CMdESession& /*aClient*/, TInt aError ) + { + _LIT( KMsg, "CallBck HandleSessionOpened - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print(msg); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::HandleSessionError +// ----------------------------------------------------------------------------- +// +void CHarvesterDataTest::HandleSessionError( CMdESession& /*aClient*/, TInt aError ) + { + _LIT( KMsg, "CallBck HandleSessionError - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print(msg); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::HarvestingCompleted +// ----------------------------------------------------------------------------- +// +void CHarvesterDataTest::HarvestingCompleted( CHarvesterData* /* aHarvesterData */ ) + { + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::MonitorEvent +// ----------------------------------------------------------------------------- +// +void CHarvesterDataTest::MonitorEvent( CHarvesterData* /* aHarvesterData */ ) + { + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::MonitorEvent +// ----------------------------------------------------------------------------- +// +void CHarvesterDataTest::MonitorEvent( RPointerArray& /* aHarvesterDataArray */ ) + { + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::ActiveWait +// ----------------------------------------------------------------------------- +// +TInt CHarvesterDataTest::ActiveWait( CStifItemParser& /* aItem */ ) + { + // 2,5 seconds + TTimeIntervalMicroSeconds32 timeout(2500000); + RTimer timer; + TRequestStatus status; + + timer.CreateLocal(); + timer.After(status,timeout); + + User::WaitForAnyRequest(); + + timer.Close(); + + _LIT( KMsg, "Exit ActiveWait" ); + iLog->Log( KMsg ); + RDebug::Print(KMsg); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::BeginTestSessionL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterDataTest::BeginTestSessionL( CStifItemParser& /* aItem */ ) + { + TRAPD( error, iMdEClient = CMdESession::NewL( *this ) ); + + _LIT( KMsg, "Exit BeginTestSession - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, error); + iLog->Log( msg ); + RDebug::Print(msg); + + User::LeaveIfError(error); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::EndTestSession +// ----------------------------------------------------------------------------- +// +TInt CHarvesterDataTest::EndTestSession( CStifItemParser& /* aItem */ ) + { + iAlbumIds.Close(); + + REComSession::FinalClose(); + + if ( iMdEClient ) + { + delete iMdEClient; + iMdEClient = NULL; + } + + _LIT( KMsg, "Exit EndTestSession" ); + iLog->Log( KMsg ); + RDebug::Print(KMsg); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::HarvestClientDataTests +// ----------------------------------------------------------------------------- +// +TInt CHarvesterDataTest::HarvestClientDataTestsL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter HarvestClientDataTestsL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + CHarvestClientData* data = NULL; + data = CHarvestClientData::NewL(); + + iAlbumIds.Reset(); + iAlbumIds.Append(55555); + iAlbumIds.Append(1); + iAlbumIds.Append(22); + iAlbumIds.Append(333); + iAlbumIds.Append(4444); + + data->SetAlbumIds( iAlbumIds ); + + delete data; + data = NULL; + + data = CHarvestClientData::New(); + + if( !data ) + { + User::Leave( KErrUnknown ); + } + + iAlbumIds.Reset(); + iAlbumIds.Append(1); + iAlbumIds.Append(22); + iAlbumIds.Append(333); + iAlbumIds.Append(4444); + iAlbumIds.Append(55555); + + data->SetAlbumIds( iAlbumIds ); + + delete data; + data = NULL; + + _LIT( KMsg2, "Exit HarvestClientDataTestsL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::PlaceholderDataTests +// ----------------------------------------------------------------------------- +// +TInt CHarvesterDataTest::PlaceholderDataTestsL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter PlaceholderDataTestsL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TTime time; + TUint32 size; + TUint id; + TBuf<100> tmp; + TInt state; + TInt preinstalled; + _LIT( KUri, "C:\\Data\\Images\\Jpg.jpg" ); + + CPlaceholderData* data = CPlaceholderData::NewL(); + CleanupStack::PushL( data ); + + // modified + _LIT( KMsg2, "modified" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + time.HomeTime(); + data->SetModified( time ); + TTime time2 = data->Modified(); + if( time != time2 ) + { + return KErrBadDescriptor; + } + + // uri + _LIT( KMsg3, "uri" ); + iLog->Log( KMsg3 ); + RDebug::Print( KMsg3 ); + data->SetUri( KUri ); + tmp = data->Uri(); + if( !(MdsUtils::Compare( tmp, KUri ) == 0) ) + { + return KErrBadDescriptor; + } + + // filesize + _LIT( KMsg4, "filesize" ); + iLog->Log( KMsg4 ); + RDebug::Print( KMsg4 ); + size = 8192; + data->SetFileSize( size ); + TUint32 size2 = data->FileSize(); + if( size != size2 ) + { + return KErrBadDescriptor; + } + + // mediaid + _LIT( KMsg5, "mediaid" ); + iLog->Log( KMsg5 ); + RDebug::Print( KMsg5 ); + id = 64; + data->SetMediaId( id ); + TUint32 id2 = data->MediaId(); + if( id != id2 ) + { + return KErrBadDescriptor; + } + + // state + _LIT( KMsg6, "state" ); + iLog->Log( KMsg6 ); + RDebug::Print( KMsg6 ); + state = 0; + data->SetPresentState( state ); + TInt state2 = data->PresentState(); + if( state != state2 ) + { + return KErrBadDescriptor; + } + + // preinstalled + _LIT( KMsg7, "preinstalled" ); + iLog->Log( KMsg7 ); + RDebug::Print( KMsg7 ); + preinstalled = 0; + data->SetPreinstalled( preinstalled ); + TInt preinstalled2 = data->Preinstalled(); + if( preinstalled != preinstalled2 ) + { + return KErrBadDescriptor; + } + + CleanupStack::PopAndDestroy( data ); + + _LIT( KMsg8, "Exit PlaceholderDataTestsL" ); + iLog->Log( KMsg8 ); + RDebug::Print( KMsg8 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterDataTest::HarvestClientDataTests +// ----------------------------------------------------------------------------- +// +TInt CHarvesterDataTest::HarvesterDataTestsL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter HarvesterDataTestsL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt errorcode; + THarvesterEventType event; + MHarvesterPluginObserver* pluginobs; + TOrigin origin; + TBool snap; + THarvesterObjectType type; + TAny* client; + CMdEObject* object; + TLocationData* location; + TUid uid; + TBool add; + CHarvesterPluginInfo* pluginInfo; + TBool binary; + + _LIT( KUri, "C:\\Data\\Images\\Jpg.jpg" ); + + // mdeobject + CMdENamespaceDef& defaultNamespace = iMdEClient->GetDefaultNamespaceDefL(); + CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); + + iMdEClient->RemoveObjectL( KUri ); + object = iMdEClient->NewObjectL( imageDef, KUri ); + + // harvesterdata object + HBufC* uriBuf = object->Uri().AllocLC(); + CHarvesterData* data = CHarvesterData::NewL( uriBuf ); + CleanupStack::Pop( uriBuf ); + + // uri + _LIT( KMsg2, "uri" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + TDesC uri2 = data->Uri(); + + + // errorcode + _LIT( KMsg3, "errorcode" ); + iLog->Log( KMsg3 ); + RDebug::Print( KMsg3 ); + errorcode = -1; + data->SetErrorCode( errorcode ); + TInt ret = data->ErrorCode(); + if( ret != errorcode ) + { + return KErrBadDescriptor; + } + + // eventtype + _LIT( KMsg4, "eventtype" ); + iLog->Log( KMsg4 ); + RDebug::Print( KMsg4 ); + event = EHarvesterAdd; + data->SetEventType(event); + THarvesterEventType event2 = data->EventType(); + if( event2 != event ) + { + return KErrBadDescriptor; + } + + // pluginobserver + _LIT( KMsg5, "pluginobserver" ); + iLog->Log( KMsg5 ); + RDebug::Print( KMsg5 ); + pluginobs = this; + data->SetPluginObserver( *pluginobs ); + MHarvesterPluginObserver* pluginobs2 = data->PluginObserver(); + if( pluginobs != pluginobs2 ) + { + return KErrBadDescriptor; + } + pluginobs = NULL; + + // origin + _LIT( KMsg6, "origin" ); + iLog->Log( KMsg6 ); + RDebug::Print( KMsg6 ); + origin = MdeConstants::Object::EDownloaded; + data->SetOrigin( origin ); + TOrigin origin2 = data->Origin(); + if( origin != origin2 ) + { + return KErrBadDescriptor; + } + + // takesnapshot + _LIT( KMsg7, "takesnapshot" ); + iLog->Log( KMsg7 ); + RDebug::Print( KMsg7 ); + snap = ETrue; + data->SetTakeSnapshot( snap ); + TBool snap2 = data->TakeSnapshot(); + if( !(snap && snap2) ) + { + return KErrBadDescriptor; + } + + // objecttype + _LIT( KMsg8, "objecttype" ); + iLog->Log( KMsg8 ); + RDebug::Print( KMsg8 ); + type = ENormal; + data->SetObjectType(type); + THarvesterObjectType type2 = data->ObjectType(); + if( type != type2 ) + { + return KErrBadDescriptor; + } + + // clientdata + _LIT( KMsg9, "clientdata" ); + iLog->Log( KMsg9 ); + RDebug::Print( KMsg9 ); + client = NULL; + data->SetClientData( NULL ); + TAny* client2 = data->ClientData(); + if( client != client2 ) + { + return KErrBadDescriptor; + } + client = NULL; + + // mdeobject + _LIT( KMsg10, "mdeobject" ); + iLog->Log( KMsg10 ); + RDebug::Print( KMsg10 ); + data->SetMdeObject( object ); + CMdEObject* object2 = &data->MdeObject(); + if( object != object2 ) + { + return KErrBadDescriptor; + } + data->SetMdeObject( NULL ); + + // locationdata + _LIT( KMsg11, "locationdata" ); + iLog->Log( KMsg11 ); + RDebug::Print( KMsg11 ); + location = new ( ELeave ) TLocationData; + location->iQuality = 0; + data->SetLocationData( location ); + TLocationData* location2 = data->LocationData(); + if( location != location2 ) + { + return KErrBadDescriptor; + } + + // clientid + _LIT( KMsg12, "clientid" ); + iLog->Log( KMsg12 ); + RDebug::Print( KMsg12 ); + uid = KNullUid; + data->SetClientId( uid ); + TUid uid2 = data->ClientId(); + if( uid2 != uid ) + { + return KErrBadDescriptor; + } + + // add location + _LIT( KMsg13, "add location" ); + iLog->Log( KMsg13 ); + RDebug::Print( KMsg13 ); + add = ETrue; + data->SetAddLocation( add ); + TBool add2 = data->AddLocation(); + if( !(add && add2) ) + { + return KErrBadDescriptor; + } + + // harvesterplugininfo + _LIT( KMsg14, "pluginobserver" ); + iLog->Log( KMsg14 ); + RDebug::Print( KMsg14 ); + pluginInfo = NULL; + data->SetHarvesterPluginInfo( pluginInfo ); + CHarvesterPluginInfo* pluginInfo2 = data->HarvesterPluginInfo(); + if( pluginInfo != pluginInfo2 ) + { + return KErrBadDescriptor; + } + pluginInfo = NULL; + + // binary + _LIT( KMsg15, "binary" ); + iLog->Log( KMsg15 ); + RDebug::Print( KMsg15 ); + binary = ETrue; + data->SetBinary( binary ); + TBool binary2 = data->IsBinary(); + if( !(binary && binary2) ) + { + return KErrBadDescriptor; + } + + delete data; + data = NULL; + + _LIT( KMsg16, "Exit HarvesterDataTestsL" ); + iLog->Log( KMsg16 ); + RDebug::Print( KMsg16 ); + + return KErrNone; + } + +// [End of File] - Do not remove diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/Bmarm/HarvesterPluginTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/Bmarm/HarvesterPluginTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/Bwins/HarvesterPluginTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/Bwins/HarvesterPluginTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/conf/HarvesterPluginTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/conf/HarvesterPluginTest.cfg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,47 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Harvester Plugin API tests +# + +// --------------------------------------------------------------------------- +// Harvester Plugin API test cases +// --------------------------------------------------------------------------- + +// These should be run in sequential mode if several cases are run at the same +// time! + +[StifSettings] +TestThreadStackSize= 32768 +TestThreadMinHeap= 4096 +TestThreadMaxHeap= 16777216 +[EndStifSettings] + +[Test] +title Test Harvester Plugins +timeout 500000 +create HarvesterPluginTest test +request Session +test BeginTestSession +wait Session +test LoadPlugins +test TestFunctions e:\testing\data\Jpg.jpg +test TestFunctions e:\testing\data\Animated.gif +test TestFunctions e:\testing\data\Mbm.mbm +test TestFunctions e:\testing\data\H263.3gp +test TestFunctions e:\testing\data\MPEG4.3gp +test TestFunctions e:\testing\data\MPEG4.mp4 +test TestFunctions e:\testing\data\00001.mp3 +test EndTestSession +delete test +[Endtest] diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/eabi/HarvesterPluginTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/eabi/HarvesterPluginTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,5 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + _ZTI17CMdeObjectHandler @ 2 NONAME ; ## + _ZTV17CMdeObjectHandler @ 3 NONAME ; ## + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/group/HarvesterPluginTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/group/HarvesterPluginTest.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + +#include +#include + +TARGET HarvesterPluginTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + +DEFFILE HarvesterPluginTest.DEF + +SOURCEPATH ../src +SOURCE HarvesterPluginTest.cpp +SOURCE HarvesterPluginTestBlocks.cpp + +SOURCEPATH ../../../../../harvester/server/src +SOURCE mdeobjecthandler.cpp + +SYSTEMINCLUDE /epoc32/include/ecom +USERINCLUDE ../inc +USERINCLUDE ../../../../../inc +USERINCLUDE ../../../../../harvester/common/inc +USERINCLUDE ../../../../../harvester/server/inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY mdeclient.lib +LIBRARY ecom.lib +LIBRARY contextengine.lib +LIBRARY contextplugininterface.lib +LIBRARY harvesterplugininterface.lib +LIBRARY harvesterdata.lib +LIBRARY mdccommon.lib +LIBRARY harvestercommon.lib diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/group/HarvesterPluginTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/group/HarvesterPluginTest.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,56 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Installation file for API test +; + +; Languages +&EN + +; Header +#{"HarvesterPluginTest"},(0x101FB3E3),1,0,0,TYPE=SA + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Install files +"\epoc32\release\armv5\urel\HarvesterPluginTest.dll" - "c:\sys\bin\HarvesterPluginTest.dll" +"..\conf\HarvesterPluginTest.cfg" - "c:\TestFramework\HarvesterPluginTest.cfg" +"..\init\HarvesterPluginTest.ini" - "c:\TestFramework\HarvesterPluginTest.ini" + +"..\..\data\mmc\HarvesterTest\Jpg.jpg" -"E:\testing\data\Jpg.jpg" +"..\..\data\mmc\HarvesterTest\Animated.gif" -"E:\testing\data\Animated.gif" +"..\..\data\mmc\HarvesterTest\Temp1.jpg" -"E:\testing\data\Temp1.jpg" +"..\..\data\mmc\HarvesterTest\Temp2.jpg" -"E:\testing\data\Temp2.jpg" +"..\..\data\mmc\HarvesterTest\Temp3.jpg" -"E:\testing\data\Temp3.jpg" +"..\..\data\mmc\HarvesterTest\H263.3gp" -"E:\testing\data\H263.3gp" +"..\..\data\mmc\HarvesterTest\bmp_burst.bmp" -"E:\testing\data\bmp_burst.bmp" +"..\..\data\mmc\HarvesterTest\GIF87testimage.gif" -"E:\testing\data\GIF87testimage.gif" +"..\..\data\mmc\HarvesterTest\gif89a_onemeg.gif" -"E:\testing\data\gif89a_onemeg.gif" +"..\..\data\mmc\HarvesterTest\Liverpool.jpg" -"E:\testing\data\Liverpool.jpg" +"..\..\data\mmc\HarvesterTest\MBMtestimage.mbm" -"E:\testing\data\MBMtestimage.mbm" +"..\..\data\mmc\HarvesterTest\wbmp_skull.wbmp" -"E:\testing\data\wbmp_skull.wbmp" +"..\..\data\mmc\HarvesterTest\ota_bmpiso.ota" -"E:\testing\data\ota_bmpiso.ota" +"..\..\data\mmc\HarvesterTest\PNGtestimage.png" -"E:\testing\data\PNGtestimage.png" +"..\..\data\mmc\HarvesterTest\G4.TIF" -"E:\testing\data\G4.TIF" +"..\..\data\mmc\HarvesterTest\G31D.TIF" -"E:\testing\data\G31D.TIF" +"..\..\data\mmc\HarvesterTest\PSRETRO.WMF" -"E:\testing\data\PSRETRO.WMF" +"..\..\data\mmc\HarvesterTest\Animated.gif" -"E:\testing\data\Animated.gif" +"..\..\data\mmc\HarvesterTest\Mbm.mbm" -"E:\testing\data\Mbm.mbm" +"..\..\data\mmc\HarvesterTest\MPEG4.3gp" -"E:\testing\data\MPEG4.3gp" +"..\..\data\mmc\HarvesterTest\MPEG4.mp4" -"E:\testing\data\MPEG4.mp4" +"..\..\data\mmc\HarvesterTest\00001.mp3" -"E:\testing\data\00001.mp3" + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +HarvesterPluginTest.mmp + +PRJ_TESTEXPORTS + +../conf/HarvesterPluginTest.cfg /epoc32/winscw/c/TestFramework/HarvesterPluginTest.cfg +../init/HarvesterPluginTest.ini /epoc32/winscw/c/TestFramework/HarvesterPluginTest.ini + +../../data/mmc/HarvesterTest/bmp_burst.bmp /epoc32/winscw/c/Data/bmp_burst.bmp +../../data/mmc/HarvesterTest/G31D.TIF /epoc32/winscw/c/Data/G31D.TIF +../../data/mmc/HarvesterTest/G4.TIF /epoc32/winscw/c/Data/G4.TIF +../../data/mmc/HarvesterTest/GIF87testimage.gif /epoc32/winscw/c/Data/GIF87testimage.gif +../../data/mmc/HarvesterTest/gif89a_onemeg.gif /epoc32/winscw/c/Data/gif89a_onemeg.gif +../../data/mmc/HarvesterTest/Liverpool.jpg /epoc32/winscw/c/Data/Liverpool.jpg +../../data/mmc/HarvesterTest/MBMtestimage.mbm /epoc32/winscw/c/Data/MBMtestimage.mbm +../../data/mmc/HarvesterTest/ota_bmpiso.ota /epoc32/winscw/c/Data/ota_bmpiso.ota +../../data/mmc/HarvesterTest/PNGtestimage.png /epoc32/winscw/c/Data/PNGtestimage.png +../../data/mmc/HarvesterTest/PSRETRO.WMF /epoc32/winscw/c/Data/PSRETRO.WMF +../../data/mmc/HarvesterTest/wbmp_skull.wbmp /epoc32/winscw/c/Data/wbmp_skull.wbmp +../../data/mmc/HarvesterTest/Jpg.jpg /epoc32/winscw/c/Data/Jpg.jpg +../../data/mmc/HarvesterTest/Animated.gif /epoc32/winscw/c/Data/Animated.gif +../../data/mmc/HarvesterTest/Mbm.mbm /epoc32/winscw/c/Data/Mbm.mbm +../../data/mmc/HarvesterTest/H263.3gp /epoc32/winscw/c/Data/H263.3gp +../../data/mmc/HarvesterTest/MPEG4.mp4 /epoc32/winscw/c/Data/MPEG4.mp4 +../../data/mmc/HarvesterTest/MPEG4.3gp /epoc32/winscw/c/Data/MPEG4.3gp +../../data/mmc/HarvesterTest/Temp1.jpg /epoc32/winscw/c/Data/Temp1.jpg +../../data/mmc/HarvesterTest/Temp2.jpg /epoc32/winscw/c/Data/Temp2.jpg +../../data/mmc/HarvesterTest/Temp3.jpg /epoc32/winscw/c/Data/Temp3.jpg +../../data/mmc/HarvesterTest/00001.mp3 /epoc32/winscw/c/Data/00001.mp3 + + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/inc/HarvesterPluginTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/inc/HarvesterPluginTest.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,141 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef HARVESTERPLUGINTEST_H +#define HARVESTERPLUGINTEST_H + +// INCLUDES +#include +#include +#include + +#include "contextengine.h" +#include +#include +#include "mdeharvestersession.h" +#include +#include "harvesterplugininfo.h" + +// CONSTANTS + +_LIT( KBlacklistDatabaseName, "C:[200009f5]blacklistdb.sq" ); + +// Logging path +_LIT( KHarvesterPluginTestLogPath, "\\logs\\testframework\\HarvesterPluginTest\\" ); +// Log file +_LIT( KHarvesterPluginTestLogFile, "HarvesterPluginTest.txt" ); +_LIT( KHarvesterPluginTestLogFileWithTitle, "HarvesterPluginTest_[%S].txt" ); + +// FORWARD DECLARATIONS +class CHarvesterPluginTest; +class CHarvesterBlacklist; +class CMdeObjectHandler; + +// CLASS DECLARATION +NONSHARABLE_CLASS(CHarvesterPluginTest) : public CScriptBase, + MMdESessionObserver, + MHarvesterPluginObserver + + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CHarvesterPluginTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CHarvesterPluginTest(); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + private: // Functions from base classes + + void HandleSessionOpened(CMdESession& aSession, TInt aError); + void HandleSessionError(CMdESession& aSession, TInt aError); + void HarvestingCompleted( CHarvesterData* aHarvesterData ); + + private: + + /** + * C++ default constructor. + */ + CHarvesterPluginTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + /** + * Test methods are listed below. + */ + + virtual TInt BeginTestSessionL( CStifItemParser& aItem ); + virtual TInt EndTestSession( CStifItemParser& aItem ); + virtual TInt LoadPluginsL( CStifItemParser& aItem ); + virtual TInt TestFunctionsL( CStifItemParser& aItem ); + + // helper methods + TBool GetObjectDef(const TDesC& aUri, TDes& aObjectDef, TBool aCheck); + TInt HarvestL( CHarvesterData* aHD ); + void AddNewPluginL( const TDesC8& aType, const TDesC8& aOpaque, TUid aPluginUid ); + CHarvesterPluginInfo* GetHPIFromFileNameL(const TDesC& aFileName); + CHarvesterPluginInfo* GetFromNormalFileL( TDesC& aExt ); + + public: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + protected: // Data + // ?one_line_short_description_of_data + //?data_declaration; + + private: // Data + + CMdESession* iMdeSession; + CMdEHarvesterSession* iSession; + + CContextEngine* iCtxEngine; + CHarvesterBlacklist* iBlacklist; + CMdeObjectHandler* iMdeObjectHandler; + + CHarvesterPlugin* iPlugin; + RPointerArray iPluginInfoArray; + + }; + +#endif // HARVESTERPLUGINTEST_H + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/init/HarvesterPluginTest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/init/HarvesterPluginTest.ini Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,81 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= HarvesterPluginTestLog + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 600000 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testframework\HarvesterPluginTest.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +HardwareBasePath= C:\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/src/HarvesterPluginTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/src/HarvesterPluginTest.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// INCLUDE FILES +#include +#include "HarvesterPluginTest.h" +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTest::CHarvesterPluginTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CHarvesterPluginTest::CHarvesterPluginTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CHarvesterPluginTest::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KHarvesterPluginTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KHarvesterPluginTestLogFile); + } + + iLog = CStifLogger::NewL( KHarvesterPluginTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CHarvesterPluginTest* CHarvesterPluginTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CHarvesterPluginTest* self = new (ELeave) CHarvesterPluginTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + + } + +// Destructor +CHarvesterPluginTest::~CHarvesterPluginTest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CHarvesterPluginTest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/src/HarvesterPluginTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/src/HarvesterPluginTestBlocks.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,560 @@ +/* +* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include "HarvesterPluginTest.h" + +#include "mdsutils.h" +#include "harvesterblacklist.h" +#include "mdeobject.h" +#include "mdeobjecthandler.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CHarvesterPluginTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CHarvesterPluginTest::RunMethodL( + CStifItemParser& aItem ) + { + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + ENTRY( "BeginTestSession", CHarvesterPluginTest::BeginTestSessionL ), + ENTRY( "EndTestSession", CHarvesterPluginTest::EndTestSession ), + ENTRY( "LoadPlugins", CHarvesterPluginTest::LoadPluginsL ), + ENTRY( "TestFunctions", CHarvesterPluginTest::TestFunctionsL ), + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTest::HandleSessionOpened +// ----------------------------------------------------------------------------- +// +void CHarvesterPluginTest::HandleSessionOpened( CMdESession& /*aClient*/, TInt aError ) + { + _LIT( KMsg, "CallBck HandleSessionOpened - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print(msg); + + TRAP_IGNORE( iMdeObjectHandler = CMdeObjectHandler::NewL( *iMdeSession ) ); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTest::HandleSessionError +// ----------------------------------------------------------------------------- +// +void CHarvesterPluginTest::HandleSessionError( CMdESession& /*aClient*/, TInt aError ) + { + _LIT( KMsg, "CallBck HandleSessionError - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print(msg); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTest::HarvestingCompleted +// ----------------------------------------------------------------------------- +// +void CHarvesterPluginTest::HarvestingCompleted( CHarvesterData* /* aHarvesterData */ ) + { + // harvest event + TEventIf event( TEventIf::ESetEvent, _L("Harvest") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTest::BeginTestSessionL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterPluginTest::BeginTestSessionL( CStifItemParser& /* aItem */ ) + { + TRAPD( error, iMdeSession = CMdESession::NewL( *this ) ); + + iSession = CMdEHarvesterSession::NewL( *iMdeSession ); + + iCtxEngine = NULL; + + iBlacklist = CHarvesterBlacklist::NewL(); + + _LIT( KMsg, "Exit BeginTestSession - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, error); + iLog->Log( msg ); + RDebug::Print( msg ); + + User::LeaveIfError( error ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTest::EndTestSession +// ----------------------------------------------------------------------------- +// +TInt CHarvesterPluginTest::EndTestSession( CStifItemParser& /* aItem */ ) + { + iPluginInfoArray.ResetAndDestroy(); + iPluginInfoArray.Close(); + + REComSession::FinalClose(); + + if ( iCtxEngine ) + { + iCtxEngine->ReleaseInstance(); + iCtxEngine = NULL; + } + + if ( iBlacklist ) + { + iBlacklist->CloseDatabase(); + delete iBlacklist; + } + + if ( iSession ) + { + delete iSession; + iSession = NULL; + } + + if ( iMdeObjectHandler ) + { + delete iMdeObjectHandler; + iMdeObjectHandler = NULL; + } + + if( iMdeSession ) + { + delete iMdeSession; + iMdeSession = NULL; + } + + _LIT( KMsg, "Exit EndTestSession" ); + iLog->Log( KMsg ); + RDebug::Print(KMsg); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTest::LoadPluginsL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterPluginTest::LoadPluginsL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter LoadPlugins" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + RImplInfoPtrArray infoArray; + + TCleanupItem cleanupItem( MdsUtils::CleanupEComArray, &infoArray ); + CleanupStack::PushL( cleanupItem ); + + CHarvesterPlugin::ListImplementationsL( infoArray ); + TInt count( 0 ); + count = infoArray.Count(); + + if( count == 0 ) + { + return KErrNotFound; + } + + for ( TInt i=0; i < count; i++ ) + { + // Parse the file extensions and resolve plug-in's uids from infoArray to iDataTypeArray + TBufC8<256> type; + TBufC8<256> opaque; + + type = infoArray[i]->DataType(); + opaque = infoArray[i]->OpaqueData(); + TUid implUID = infoArray[i]->ImplementationUid(); + + AddNewPluginL(type, opaque, implUID); + } + + CleanupStack::PopAndDestroy( &infoArray ); // infoArray, results in a call to CleanupEComArray + + _LIT( KMsg2, "Exit LoadPlugins" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTest::TestFunctionsL +// ----------------------------------------------------------------------------- +// +TInt CHarvesterPluginTest::TestFunctionsL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "Enter TestFunctions" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TPtrC inputFile; + User::LeaveIfError( aItem.GetNextString( inputFile ) ); + + iMdeSession->RemoveObjectL( inputFile ); + + TBuf<100> aObjectDef; + + _LIT( KMsg2_1, "enter GetObjectDef" ); + iLog->Log( KMsg2_1 ); + RDebug::Print( KMsg2_1 ); + + GetObjectDef( inputFile, aObjectDef, EFalse ); + + _LIT( KMsg2_2, "return from GetObjectDef" ); + iLog->Log( KMsg2_2 ); + RDebug::Print( KMsg2_2 ); + + // harvesterdata object + HBufC* uriBuf = inputFile.AllocLC(); + + _LIT( KMsg3, "Creating harvester data" ); + iLog->Log( KMsg3 ); + RDebug::Print( KMsg3 ); + + CHarvesterData* data = CHarvesterData::NewL( uriBuf ); + data->SetPluginObserver( *this ); + CMdEObject* mdeObject = NULL; + _LIT( string, "Image" ); + + _LIT( KMsg4, "Getting metadata object" ); + iLog->Log( KMsg4 ); + RDebug::Print( KMsg4 ); + + mdeObject = iMdeObjectHandler->GetMetadataObjectL( *data, string ); + + _LIT( KMsg5, "Setting metadata object" ); + iLog->Log( KMsg5 ); + RDebug::Print( KMsg5 ); + + data->SetMdeObject( mdeObject ); + + _LIT( KMsg6, "Metadata object set" ); + iLog->Log( KMsg6 ); + RDebug::Print( KMsg6 ); + + CleanupStack::Pop( uriBuf ); + + _LIT( KMsg7, "Calling HarvestL" ); + iLog->Log( KMsg7 ); + RDebug::Print( KMsg7 ); + + HarvestL( data ); + + _LIT( KMsg8, "Exit TestFunctions" ); + iLog->Log( KMsg8 ); + RDebug::Print( KMsg8 ); + + return KErrNone; + } + +// --------------------------------------------------------------------------- +// GetObjectDef +// --------------------------------------------------------------------------- +// +TBool CHarvesterPluginTest::GetObjectDef(const TDesC& aUri, TDes& aObjectDef, TBool aCheck) + { + _LIT( KMsg1, "GetObjectDef" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + CHarvesterPluginInfo* hpi = NULL; + + TRAPD( err, hpi = GetHPIFromFileNameL(aUri) ); + if ( err != KErrNone ) + { + _LIT( KMsg2, "GetHPIFromFileNameL not KErrNone, objectDef is 0, return" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + aObjectDef.Zero(); + return EFalse; + } + + if ( !hpi ) + { + _LIT( KMsg3, "no hpi, objectDef is 0, return" ); + iLog->Log( KMsg3 ); + RDebug::Print( KMsg3 ); + aObjectDef.Zero(); + } + else + { + _LIT( KMsg4, "hpi found" ); + iLog->Log( KMsg4 ); + RDebug::Print( KMsg4 ); + + if( hpi->iObjectTypes.Count() > 1) + { + _LIT( KMsg5_1, "plugin supports over 1 object type" ); + iLog->Log( KMsg5_1 ); + RDebug::Print( KMsg5_1 ); + + if( aCheck ) + { + aObjectDef.Zero(); + return ETrue; + } + + if ( ! hpi->iPlugin ) + { + TRAPD( error, hpi->iPlugin = CHarvesterPlugin::NewL( hpi->iPluginUid ) ); + if( error ) + { + aObjectDef.Zero(); + return EFalse; + } + else + { + hpi->iPlugin->SetQueue( hpi->iQueue ); + } + } + + _LIT( KMsg5_2, "calling iPlugin->GetObjectType" ); + iLog->Log( KMsg5_2 ); + RDebug::Print( KMsg5_2 ); + + hpi->iPlugin->GetObjectType( aUri, aObjectDef ); + + _LIT( KMsg5_3, "object type selected" ); + iLog->Log( KMsg5_3 ); + RDebug::Print( KMsg5_3 ); + } + else + { + _LIT( KMsg6_1, "plugin supports 1 object type, select it" ); + iLog->Log( KMsg6_1 ); + RDebug::Print( KMsg6_1 ); + + aObjectDef.Copy( *(hpi->iObjectTypes[0]) ); + _LIT( KMsg6_2, "object type selected" ); + iLog->Log( KMsg6_2 ); + RDebug::Print( KMsg6_2 ); + } + } + + return EFalse; + } + +// --------------------------------------------------------------------------- +// HarvestL +// --------------------------------------------------------------------------- +// +TInt CHarvesterPluginTest::HarvestL( CHarvesterData* aHD ) + { + _LIT( KMsg1, "Enter HarvestL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + CHarvesterPluginInfo* hpi = aHD->HarvesterPluginInfo(); + + if ( !hpi ) + { + hpi = GetHPIFromFileNameL( aHD->Uri() ); + } + + if ( hpi ) + { + if ( ! hpi->iPlugin ) + { + hpi->iPlugin = CHarvesterPlugin::NewL( hpi->iPluginUid ); + hpi->iPlugin->SetQueue( hpi->iQueue ); + hpi->iPlugin->SetBlacklist( *iBlacklist ); + } + + if( aHD->ObjectType() == EFastHarvest || aHD->Origin() == MdeConstants::Object::ECamera ) + { + hpi->iQueue.Insert( aHD, 0 ); + } + else + { + hpi->iQueue.AppendL( aHD ); + } + + hpi->iPlugin->StartHarvest(); + + _LIT( KMsg2, "Exit HarvestL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + + return KErrNotFound; + } + +// ----------------------------------------------------------------------------- +// AddNewPluginL +// ----------------------------------------------------------------------------- +// +void CHarvesterPluginTest::AddNewPluginL( const TDesC8& aType, const TDesC8& aOpaque, TUid aPluginUid ) + { + CHarvesterPluginInfo* pluginInfo = new (ELeave) CHarvesterPluginInfo; + CleanupStack::PushL( pluginInfo ); + + // get file extensions + TLex8 lex( aOpaque ); + while ( !lex.Eos() ) + { + /* Tokenizing file extensions using TLex8 */ + lex.SkipSpaceAndMark(); + + TPtrC8 extToken = lex.NextToken(); + + HBufC* str = HBufC::NewLC( extToken.Length() ); + str->Des().Copy( extToken ); + pluginInfo->iExtensions.AppendL( str ); + CleanupStack::Pop( str ); + } + + // get object types + TLex8 lexObjectTypes( aType ); + while ( !lexObjectTypes.Eos() ) + { + /* Tokenizing object types using TLex8 */ + lexObjectTypes.SkipSpaceAndMark(); + + TPtrC8 objectTypeToken = lexObjectTypes.NextToken(); + + HBufC* str = HBufC::NewLC( objectTypeToken.Length() ); + str->Des().Copy( objectTypeToken ); + pluginInfo->iObjectTypes.AppendL( str ); + CleanupStack::Pop( str ); + } + + /* We set plugin as NULL - we only load them when needed */ + pluginInfo->iPlugin = NULL; + pluginInfo->iPluginUid = aPluginUid; + iPluginInfoArray.AppendL( pluginInfo ); + CleanupStack::Pop( pluginInfo ); + } + +// --------------------------------------------------------------------------- +// GetHPIFromFileNameL +// --------------------------------------------------------------------------- +// +CHarvesterPluginInfo* CHarvesterPluginTest::GetHPIFromFileNameL(const TDesC& aFileName) + { + _LIT( KMsg1, "Enter GetHPIFromFileNameL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TParsePtrC parser( aFileName ); + + // without trailing dot "." + TPtrC ptr = parser.Ext(); + if ( ptr.Length() > 1 ) + { + ptr.Set( ptr.Mid( 1 ) ); + } + + _LIT( KMsg2, "Exit GetHPIFromFileNameL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return GetFromNormalFileL( ptr ); + } + +// --------------------------------------------------------------------------- +// GetFromNormalFile +// --------------------------------------------------------------------------- +// +CHarvesterPluginInfo* CHarvesterPluginTest::GetFromNormalFileL( TDesC& aExt ) + { + _LIT( KMsg1, "Enter GetFromNormalFileL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + CHarvesterPluginInfo* retVal = NULL; + + for ( TInt i = iPluginInfoArray.Count(); --i >= 0; ) + { + CHarvesterPluginInfo* info = iPluginInfoArray[i]; + TBool found = EFalse; + + for ( TInt k = info->iExtensions.Count(); --k >= 0; ) + { + TDesC* ext = info->iExtensions[k]; + + // checking against supported plugin file extensions + TInt result = ext->CompareF( aExt ); + if ( result == 0 ) + { + retVal = info; + found = ETrue; + break; + } + } + if ( found ) + { + break; + } + } + + _LIT( KMsg2, "Exit GetFromNormalFileL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return retVal; + } + +// [End of File] - Do not remove diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/Bmarm/MonitorPluginTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/Bmarm/MonitorPluginTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/Bwins/MonitorPluginTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/Bwins/MonitorPluginTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/conf/MonitorPluginTest.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/conf/MonitorPluginTest.cfg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,83 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Monitor Plugin API tests +# + +// --------------------------------------------------------------------------- +// Monitor Plugin API test cases +// --------------------------------------------------------------------------- + +// These should be run in sequential mode if several cases are run at the same +// time! + +[StifSettings] +TestThreadStackSize= 32768 +TestThreadMinHeap= 4096 +TestThreadMaxHeap= 16777216 +[EndStifSettings] + +[Test] +title Monitor Plugin Startup Shutdown +timeout 60000 +create MonitorPluginTest test +request Session +test BeginMonitorSession +wait Session +test LoadPlugins +test StartMonitoring +test ActiveWait +test StopMonitoring +test EndMonitorSession +delete test +[Endtest] + +[Test] +title Monitor Plugin Events +timeout 60000 +create MonitorPluginTest test +request Session +test BeginMonitorSession +wait Session +test LoadPlugins +test StartMonitoring +request Monitor +test CreateEvents +wait Monitor +request Monitor +test CreateEventsDelete +wait Monitor +test StopMonitoring +test EndMonitorSession +delete test +[Endtest] + +[Test] +title Monitor Events Pause Resume +timeout 60000 +create MonitorPluginTest test +request Session +test BeginMonitorSession +wait Session +test LoadPlugins +test StartMonitoring +test CreateEvents +test PauseMonitoring +test ActiveWait +test ResumeMonitoring +test ActiveWait +test ActiveWait +test StopMonitoring +test EndMonitorSession +delete test +[Endtest] diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/eabi/MonitorPluginTestu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/eabi/MonitorPluginTestu.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/group/MonitorPluginTest.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/group/MonitorPluginTest.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,49 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + +#include +#include + +TARGET MonitorPluginTest.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + +DEFFILE MonitorPluginTest.DEF + +SOURCEPATH ../src +SOURCE MonitorPluginTest.cpp +SOURCE MonitorPluginTestBlocks.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../../../inc +SYSTEMINCLUDE /epoc32/include/ecom + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY ecom.lib +LIBRARY harvesterdata.lib +LIBRARY mdeclient.lib +LIBRARY harvestercommon.lib +LIBRARY monitorplugininterface.lib bafl.lib efsrv.lib + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/group/MonitorPluginTest.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/group/MonitorPluginTest.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,56 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Installation file for API test +; + +; Languages +&EN + +; Header +#{"MonitorPluginTest"},(0x101FB3E3),1,0,0,TYPE=SA + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Install files +"\epoc32\release\armv5\urel\MonitorPluginTest.dll" - "c:\sys\bin\MonitorPluginTest.dll" +"..\conf\MonitorPluginTest.cfg" - "c:\TestFramework\MonitorPluginTest.cfg" +"..\init\MonitorPluginTest.ini" - "c:\TestFramework\MonitorPluginTest.ini" + +"..\..\data\mmc\HarvesterTest\Jpg.jpg" -"E:\testing\data\Jpg.jpg" +"..\..\data\mmc\HarvesterTest\Animated.gif" -"E:\testing\data\Animated.gif" +"..\..\data\mmc\HarvesterTest\Temp1.jpg" -"E:\testing\data\Temp1.jpg" +"..\..\data\mmc\HarvesterTest\Temp2.jpg" -"E:\testing\data\Temp2.jpg" +"..\..\data\mmc\HarvesterTest\Temp3.jpg" -"E:\testing\data\Temp3.jpg" +"..\..\data\mmc\HarvesterTest\H263.3gp" -"E:\testing\data\H263.3gp" +"..\..\data\mmc\HarvesterTest\bmp_burst.bmp" -"E:\testing\data\bmp_burst.bmp" +"..\..\data\mmc\HarvesterTest\GIF87testimage.gif" -"E:\testing\data\GIF87testimage.gif" +"..\..\data\mmc\HarvesterTest\gif89a_onemeg.gif" -"E:\testing\data\gif89a_onemeg.gif" +"..\..\data\mmc\HarvesterTest\Liverpool.jpg" -"E:\testing\data\Liverpool.jpg" +"..\..\data\mmc\HarvesterTest\MBMtestimage.mbm" -"E:\testing\data\MBMtestimage.mbm" +"..\..\data\mmc\HarvesterTest\wbmp_skull.wbmp" -"E:\testing\data\wbmp_skull.wbmp" +"..\..\data\mmc\HarvesterTest\ota_bmpiso.ota" -"E:\testing\data\ota_bmpiso.ota" +"..\..\data\mmc\HarvesterTest\PNGtestimage.png" -"E:\testing\data\PNGtestimage.png" +"..\..\data\mmc\HarvesterTest\G4.TIF" -"E:\testing\data\G4.TIF" +"..\..\data\mmc\HarvesterTest\G31D.TIF" -"E:\testing\data\G31D.TIF" +"..\..\data\mmc\HarvesterTest\PSRETRO.WMF" -"E:\testing\data\PSRETRO.WMF" +"..\..\data\mmc\HarvesterTest\Animated.gif" -"E:\testing\data\Animated.gif" +"..\..\data\mmc\HarvesterTest\Mbm.mbm" -"E:\testing\data\Mbm.mbm" +"..\..\data\mmc\HarvesterTest\MPEG4.3gp" -"E:\testing\data\MPEG4.3gp" +"..\..\data\mmc\HarvesterTest\MPEG4.mp4" -"E:\testing\data\MPEG4.mp4" +"..\..\data\mmc\HarvesterTest\00001.mp3" -"E:\testing\data\00001.mp3" + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +MonitorPluginTest.mmp + +PRJ_TESTEXPORTS + +../conf/MonitorPluginTest.cfg /epoc32/winscw/c/TestFramework/MonitorPluginTest.cfg +../init/MonitorPluginTest.ini /epoc32/winscw/c/TestFramework/MonitorPluginTest.ini + +../../data/mmc/HarvesterTest/bmp_burst.bmp /epoc32/winscw/c/Data/bmp_burst.bmp +../../data/mmc/HarvesterTest/G31D.TIF /epoc32/winscw/c/Data/G31D.TIF +../../data/mmc/HarvesterTest/G4.TIF /epoc32/winscw/c/Data/G4.TIF +../../data/mmc/HarvesterTest/GIF87testimage.gif /epoc32/winscw/c/Data/GIF87testimage.gif +../../data/mmc/HarvesterTest/gif89a_onemeg.gif /epoc32/winscw/c/Data/gif89a_onemeg.gif +../../data/mmc/HarvesterTest/Liverpool.jpg /epoc32/winscw/c/Data/Liverpool.jpg +../../data/mmc/HarvesterTest/MBMtestimage.mbm /epoc32/winscw/c/Data/MBMtestimage.mbm +../../data/mmc/HarvesterTest/ota_bmpiso.ota /epoc32/winscw/c/Data/ota_bmpiso.ota +../../data/mmc/HarvesterTest/PNGtestimage.png /epoc32/winscw/c/Data/PNGtestimage.png +../../data/mmc/HarvesterTest/PSRETRO.WMF /epoc32/winscw/c/Data/PSRETRO.WMF +../../data/mmc/HarvesterTest/wbmp_skull.wbmp /epoc32/winscw/c/Data/wbmp_skull.wbmp +../../data/mmc/HarvesterTest/Jpg.jpg /epoc32/winscw/c/Data/Jpg.jpg +../../data/mmc/HarvesterTest/Animated.gif /epoc32/winscw/c/Data/Animated.gif +../../data/mmc/HarvesterTest/Mbm.mbm /epoc32/winscw/c/Data/Mbm.mbm +../../data/mmc/HarvesterTest/H263.3gp /epoc32/winscw/c/Data/H263.3gp +../../data/mmc/HarvesterTest/MPEG4.mp4 /epoc32/winscw/c/Data/MPEG4.mp4 +../../data/mmc/HarvesterTest/MPEG4.3gp /epoc32/winscw/c/Data/MPEG4.3gp +../../data/mmc/HarvesterTest/Temp1.jpg /epoc32/winscw/c/Data/Temp1.jpg +../../data/mmc/HarvesterTest/Temp2.jpg /epoc32/winscw/c/Data/Temp2.jpg +../../data/mmc/HarvesterTest/Temp3.jpg /epoc32/winscw/c/Data/Temp3.jpg +../../data/mmc/HarvesterTest/00001.mp3 /epoc32/winscw/c/Data/00001.mp3 diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/inc/MonitorPluginTest.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/inc/MonitorPluginTest.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,124 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +* ============================================================================ +*/ + + +#ifndef MONITORPLUGINTEST_H +#define MONITORPLUGINTEST_H + +// INCLUDES +#include +#include +#include + +//#include +#include +#include "mdeharvestersession.h" +#include + +// CONSTANTS +// Logging path +_LIT( KMonitorPluginTestLogPath, "\\logs\\testframework\\MonitorPluginTest\\" ); +// Log file +_LIT( KMonitorPluginTestLogFile, "MonitorPluginTest.txt" ); +_LIT( KMonitorPluginTestLogFileWithTitle, "MonitorPluginTest_[%S].txt" ); + + +// FORWARD DECLARATIONS +class CMonitorPluginTest; + +// CLASS DECLARATION +NONSHARABLE_CLASS(CMonitorPluginTest) : public CScriptBase, + public MMonitorPluginObserver, + public MMdESessionObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CMonitorPluginTest* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CMonitorPluginTest(); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + private: // Functions from base classes + + void MonitorEvent( CHarvesterData* aHarvesterData ); + void MonitorEvent( RPointerArray& aHDArray ); + + void HandleSessionOpened(CMdESession& aClient, TInt aError); + void HandleSessionError(CMdESession& aClient, TInt aError); + + private: + + /** + * C++ default constructor. + */ + CMonitorPluginTest( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + void ActiveWait2(); + + /** + * Test methods are listed below. + */ + + virtual TInt ActiveWait( CStifItemParser& aItem ); + virtual TInt BeginMonitorSessionL( CStifItemParser& aItem ); + virtual TInt EndMonitorSession( CStifItemParser& aItem ); + virtual TInt LoadPluginsL( CStifItemParser& aItem ); + virtual TInt StartMonitoring( CStifItemParser& aItem ); + virtual TInt PauseMonitoring( CStifItemParser& aItem ); + virtual TInt ResumeMonitoring( CStifItemParser& aItem ); + virtual TInt StopMonitoring( CStifItemParser& aItem ); + virtual TInt CreateEventsL( CStifItemParser& aItem ); + virtual TInt CreateEventsDeleteL( CStifItemParser& aItem ); + + //[TestMethods] - Do not remove + + private: // Data + + RPointerArray iPluginArray; + CMdESession* iMdEClient; + }; + +#endif // MONITORPLUGINTEST_H + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/init/MonitorPluginTest.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/init/MonitorPluginTest.ini Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,81 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= MonitorPluginTestLog + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 600000 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testframework\MonitorPluginTest.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +HardwareBasePath= C:\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/src/MonitorPluginTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/src/MonitorPluginTest.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,132 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// INCLUDE FILES +#include +#include "MonitorPluginTest.h" +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::CMonitorPluginTest +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CMonitorPluginTest::CMonitorPluginTest( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CMonitorPluginTest::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KMonitorPluginTestLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KMonitorPluginTestLogFile); + } + + iLog = CStifLogger::NewL( KMonitorPluginTestLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMonitorPluginTest* CMonitorPluginTest::NewL( + CTestModuleIf& aTestModuleIf ) + { + CMonitorPluginTest* self = new (ELeave) CMonitorPluginTest( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + + } + +// Destructor +CMonitorPluginTest::~CMonitorPluginTest() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CMonitorPluginTest::NewL( aTestModuleIf ); + + } + + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/src/MonitorPluginTestBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/MonitorPluginTest/src/MonitorPluginTestBlocks.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,573 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include +#include +#include "MonitorPluginTest.h" + +#include "mdsutils.h" + + +_LIT( KFile1Src, "C:\\Data\\Jpg.jpg" ); +_LIT( KFile1Dst, "E:\\Images\\Jpg_copy.jpg" ); +_LIT( KFile1Dst2, "C:\\Data\\Images\\Pictures\\Jpg_copy2.jpg" ); +_LIT( KFile1Dst3, "C:\\Data\\Images\\Pictures\\Jpg_tmp.jpg" ); + +_LIT( KFile2Src, "C:\\Data\\Animated.gif" ); +_LIT( KFile2Dst, "E:\\Images\\Animated_copy.gif" ); +_LIT( KFile2Dst2, "C:\\Data\\Images\\Pictures\\Animated_copy2.gif" ); +_LIT( KFile2Dst3, "C:\\Data\\Images\\Pictures\\Animated_tmp.gif" ); + +_LIT( KFile3Src, "C:\\Data\\H263.3gp" ); +_LIT( KFile3Dst, "E:\\Videos\\H263_copy.3gp" ); +_LIT( KFile3Dst2, "C:\\Data\\H263_copy2.3gp" ); +_LIT( KFile3Dst3, "C:\\Data\\H263_tmp.3gp" ); + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CMonitorPluginTest::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CMonitorPluginTest::RunMethodL( + CStifItemParser& aItem ) + { + TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksHandles ); + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + + ENTRY( "ActiveWait", CMonitorPluginTest::ActiveWait ), + ENTRY( "BeginMonitorSession", CMonitorPluginTest::BeginMonitorSessionL ), + ENTRY( "EndMonitorSession", CMonitorPluginTest::EndMonitorSession ), + ENTRY( "LoadPlugins", CMonitorPluginTest::LoadPluginsL ), + ENTRY( "StartMonitoring", CMonitorPluginTest::StartMonitoring ), + ENTRY( "PauseMonitoring", CMonitorPluginTest::PauseMonitoring ), + ENTRY( "ResumeMonitoring", CMonitorPluginTest::ResumeMonitoring ), + ENTRY( "StopMonitoring", CMonitorPluginTest::StopMonitoring ), + ENTRY( "CreateEvents", CMonitorPluginTest::CreateEventsL ), + ENTRY( "CreateEventsDelete", CMonitorPluginTest::CreateEventsDeleteL ), + + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::MonitorEvent +// ----------------------------------------------------------------------------- +// +void CMonitorPluginTest::MonitorEvent( CHarvesterData* aHarvesterData ) + { + _LIT( KMsg, "CallBck MonitorEvent"); + iLog->Log( KMsg ); + RDebug::Print( KMsg ); + + switch ( aHarvesterData->EventType() ) + { + case EHarvesterAdd: + { + _LIT( KAdded, "File added" ); + iLog->Log( KAdded ); + RDebug::Print( KAdded ); + } + break; + + case EHarvesterEdit: + { + _LIT( KEdited, "File edited" ); + iLog->Log( KEdited ); + RDebug::Print( KEdited ); + } + break; + + case EHarvesterDelete: + { + _LIT( KDeleted, "File deleted" ); + iLog->Log( KDeleted ); + RDebug::Print( KDeleted ); + } + break; + + case EHarvesterUnknown: + { + _LIT( KUnknown, "Unknown event" ); + iLog->Log( KUnknown ); + RDebug::Print( KUnknown ); + } + break; + } + + // monitor event + TEventIf event( TEventIf::ESetEvent, _L("Monitor") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::MonitorEvent +// ----------------------------------------------------------------------------- +// +void CMonitorPluginTest::MonitorEvent( RPointerArray& aHDArray ) + { + _LIT( KMsg, "CallBck MonitorEvent"); + iLog->Log( KMsg ); + RDebug::Print( KMsg ); + + for( TInt i = 0; i < aHDArray.Count(); i++ ) + { + CHarvesterData* hd = aHDArray[i]; + switch ( hd->EventType() ) + { + case EHarvesterAdd: + { + _LIT( KAdded, " Files added." ); + iLog->Log( KAdded ); + RDebug::Print( KAdded ); + } + break; + + case EHarvesterEdit: + { + _LIT( KEdited, " Files edited." ); + iLog->Log( KEdited ); + RDebug::Print( KEdited ); + } + break; + + case EHarvesterDelete: + { + _LIT( KDeleted, " Files deleted." ); + iLog->Log( KDeleted ); + RDebug::Print( KDeleted ); + } + break; + + case EHarvesterUnknown: + { + _LIT( KUnknown, "Unknown event." ); + iLog->Log( KUnknown ); + RDebug::Print( KUnknown ); + } + break; + } + } + + // monitor event + TEventIf event( TEventIf::ESetEvent, _L("Monitor") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::HandleSessionOpened +// ----------------------------------------------------------------------------- +// +void CMonitorPluginTest::HandleSessionOpened( CMdESession& /*aClient*/, TInt aError ) + { + _LIT( KMsg, "CallBack HandleSessionOpened - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print(msg); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::HandleSessionError +// ----------------------------------------------------------------------------- +// +void CMonitorPluginTest::HandleSessionError( CMdESession& /*aClient*/, TInt aError ) + { + _LIT( KMsg, "CallBck HandleSessionError - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print(msg); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::ActiveWait +// ----------------------------------------------------------------------------- +// +TInt CMonitorPluginTest::ActiveWait( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter ActiveWait" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + // 2,5 seconds + TTimeIntervalMicroSeconds32 timeout( 2500000 ); + RTimer timer; + TRequestStatus status; + + timer.CreateLocal(); + timer.After(status,timeout); + + User::WaitForAnyRequest(); + + timer.Close(); + + _LIT( KMsg2, "Exit ActiveWait" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::ActiveWait +// ----------------------------------------------------------------------------- +// +void CMonitorPluginTest::ActiveWait2() + { + _LIT( KMsg1, "Enter ActiveWait2" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + // 2,5 seconds + TTimeIntervalMicroSeconds32 timeout( 2500000 ); + RTimer timer; + TRequestStatus status; + + timer.CreateLocal(); + timer.After(status,timeout); + + User::WaitForRequest( status); + + timer.Close(); + + _LIT( KMsg2, "Exit ActiveWait2" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::BeginMonitorSessionL +// ----------------------------------------------------------------------------- +// +TInt CMonitorPluginTest::BeginMonitorSessionL( CStifItemParser& /* aItem */ ) + { + iMdEClient = NULL; + TRAPD( error, iMdEClient = CMdESession::NewL( *this ) ); + + _LIT( KMsg, "Exit BeginMonitorSession - Error code : %d" ); + TBuf <100> msg; + msg.Format( KMsg, error); + iLog->Log( msg ); + RDebug::Print( msg ); + + User::LeaveIfError( error ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::EndMonitorSession +// ----------------------------------------------------------------------------- +// +TInt CMonitorPluginTest::EndMonitorSession( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter EndMonitorSession" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iPluginArray.ResetAndDestroy(); + iPluginArray.Close(); + + if ( iMdEClient ) + { + delete iMdEClient; + iMdEClient = NULL; + } + + REComSession::FinalClose(); + + _LIT( KMsg2, "Exit EndMonitorSession" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::LoadPluginsL +// ----------------------------------------------------------------------------- +// +TInt CMonitorPluginTest::LoadPluginsL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter LoadPlugins" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + RImplInfoPtrArray infoArray; + + TCleanupItem cleanupItem(MdsUtils::CleanupEComArray, &infoArray); + CleanupStack::PushL(cleanupItem); + + CMonitorPlugin::ListImplementationsL(infoArray); + TInt count( 0 ); + count = infoArray.Count(); + + for (TInt i=0; i < count; i++) + { + TUid uid = infoArray[i]->ImplementationUid(); // Create the plug-ins + iPluginArray.AppendL( CMonitorPlugin::NewL( uid ) ); // and add them to array + } + + CleanupStack::PopAndDestroy(&infoArray); // infoArray, results in a call to CleanupEComArray + + if( iPluginArray.Count() == 0 ) + { + return KErrNotFound; + } + + _LIT( KMsg2, "Exit LoadPlugins" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::StartMonitoring +// ----------------------------------------------------------------------------- +// +TInt CMonitorPluginTest::StartMonitoring( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter StartMonitoring" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt count( iPluginArray.Count() ); + + for (TInt i=0; i < count; i++) + { + TBool ok = iPluginArray[i]->StartMonitoring( *this, iMdEClient, NULL, NULL ); + if( ok ) + { + _LIT( KMsg2, "Starting monitoring ok" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + } + else + { + _LIT( KMsg3, "Starting monitoring failed" ); + iLog->Log( KMsg3 ); + RDebug::Print( KMsg3 ); + } + } + + _LIT( KMsg3, "Exit StartMonitoring" ); + iLog->Log( KMsg3 ); + RDebug::Print( KMsg3 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::PauseMonitoring +// ----------------------------------------------------------------------------- +// +TInt CMonitorPluginTest::PauseMonitoring( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter PauseMonitoring" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt count( iPluginArray.Count() ); + + for (TInt i = 0; i < count; i++ ) + { + iPluginArray[i]->PauseMonitoring(); + } + + _LIT( KMsg2, "Exit PauseMonitoring" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::ResumeMonitoring +// ----------------------------------------------------------------------------- +// +TInt CMonitorPluginTest::ResumeMonitoring( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter ResumeMonitoring" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt count( iPluginArray.Count() ); + + for (TInt i=0; i < count; i++) + { + iPluginArray[i]->ResumeMonitoring( *this, iMdEClient, NULL, NULL ); + } + + _LIT( KMsg2, "Exit ResumeMonitoring" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::StopMonitoring +// ----------------------------------------------------------------------------- +// +TInt CMonitorPluginTest::StopMonitoring( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter StopMonitoring" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt count( iPluginArray.Count() ); + + for (TInt i=0; i < count; i++) + { + iPluginArray[i]->StopMonitoring(); + } + + ActiveWait2(); + + _LIT( KMsg2, "Exit StopMonitoring" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::CreateEvents +// ----------------------------------------------------------------------------- +// +TInt CMonitorPluginTest::CreateEventsL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter CreateEvents" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + RFs fs; + User::LeaveIfError( fs.Connect() ); + + BaflUtils::CopyFile( fs, KFile1Src, KFile1Dst2 ); + BaflUtils::CopyFile( fs, KFile2Src, KFile2Dst2 ); + BaflUtils::CopyFile( fs, KFile3Src, KFile3Dst2 ); + + fs.Rename( KFile1Dst2, KFile1Dst3 ); + fs.Rename( KFile2Dst2, KFile2Dst3 ); + fs.Rename( KFile3Dst2, KFile3Dst3 ); + + fs.Replace( KFile1Dst3, KFile1Dst2 ); + fs.Replace( KFile2Dst3, KFile2Dst2 ); + fs.Replace( KFile3Dst3, KFile3Dst2 ); + + // MMC stuff + if( fs.IsValidDrive( EDriveE ) ) + { + fs.RemountDrive( EDriveE, NULL ,80000000 ); + + iMdEClient->RemoveObjectL( KFile1Dst ); + iMdEClient->RemoveObjectL( KFile2Dst ); + iMdEClient->RemoveObjectL( KFile3Dst ); + BaflUtils::DeleteFile( fs, KFile1Dst ); + BaflUtils::DeleteFile( fs, KFile2Dst ); + BaflUtils::DeleteFile( fs, KFile3Dst ); + + BaflUtils::CopyFile( fs, KFile1Src, KFile1Dst ); + BaflUtils::CopyFile( fs, KFile2Src, KFile2Dst ); + BaflUtils::CopyFile( fs, KFile3Src, KFile3Dst ); + } + + fs.Close(); + + _LIT( KMsg2, "Exit CreateEvents" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMonitorPluginTest::CreateEventsDelete +// ----------------------------------------------------------------------------- +// +TInt CMonitorPluginTest::CreateEventsDeleteL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "Enter CreateEventsDelete" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + RFs fs; + User::LeaveIfError(fs.Connect()); + + iMdEClient->RemoveObjectL( KFile1Src ); + iMdEClient->RemoveObjectL( KFile2Src ); + iMdEClient->RemoveObjectL( KFile3Src ); + iMdEClient->RemoveObjectL( KFile1Dst2 ); + iMdEClient->RemoveObjectL( KFile2Dst2 ); + iMdEClient->RemoveObjectL( KFile3Dst2 ); + + BaflUtils::DeleteFile( fs, KFile1Dst2 ); + BaflUtils::DeleteFile( fs, KFile2Dst2 ); + BaflUtils::DeleteFile( fs, KFile3Dst2 ); + BaflUtils::DeleteFile( fs, KFile1Dst3 ); + BaflUtils::DeleteFile( fs, KFile2Dst3 ); + BaflUtils::DeleteFile( fs, KFile3Dst3 ); + + fs.Close(); + + _LIT( KMsg2, "Exit CreateEventsDelete" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// [End of File] - Do not remove diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/00001.mp3 Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/00001.mp3 has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Animated.gif Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Animated.gif has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/G31D.TIF Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/G31D.TIF has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/G4.TIF Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/G4.TIF has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/GIF87testimage.gif Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/GIF87testimage.gif has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/H263.3gp Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/H263.3gp has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Jpg.jpg Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Jpg.jpg has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Liverpool.jpg Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Liverpool.jpg has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/MBMtestimage.mbm Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/MBMtestimage.mbm has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/MPEG4.3gp Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/MPEG4.3gp has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/MPEG4.mp4 Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/MPEG4.mp4 has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Mbm.mbm Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Mbm.mbm has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/PNGtestimage.png Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/PNGtestimage.png has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/PSRETRO.WMF Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/PSRETRO.WMF has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Temp1.jpg Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Temp1.jpg has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Temp2.jpg Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Temp2.jpg has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Temp3.jpg Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/Temp3.jpg has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/bmp_burst.bmp Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/bmp_burst.bmp has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/corrupt.jpg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/corrupt.jpg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,94 @@ +ZZZZ$Z$$$ZZ$$$$$77$777777777777777777777I77II7I?III?IIII???????+++????????++++++=++++++++++++++++++=++======+======+++++ +ZZZZZZZZ$$ZZ$77777777777III777777I7777IIIIIIIII??IIIIII???????++++???????++++++++++++?????++++++++++========+===~+=+++++ +ZZZZZZ$$$$$$77777$$77I77777777III77IIIIII7IIIII????II????I7$ZZZ$$7I???????++?+++++++++++++++++++++++==+=============++++ +$ZZ77$7$$$$$777777777777I7777IIII77I777III?III??????IDNNMNNNNNDDDNNNDDO7????+++++=++=++++++++=++++====+========~~===++++ +ZZ$$$7777$$$$$777777777777IIIIIIII7IIIIIIIIII?I??+IZNND8NNNMMMMNNNDDDNND8?+??+?++++++++++++++==+=+===++=======~~~====+++ +$$$$$$$$Z$$$$7777777777I7I?II??IIIIII?III???????$DMNN8O8NNNNNNNNMMMMND8DNMD$+++?++==++++++++=======~===========~~======+ +$$$$Z$$$$$$$7777I777IIIIII?IIIIIIIII?????+????ZNND8DDZZDDDDDDDNNNNNNMMMMNNNNNZ?++=====+++++++=====~~==~===~==~=~=~====== +$$$7$$$7$777III777IIIIIIIIIII??III??III???++?$MNNDDD8$O88DDDNMNNNNNNMMMMMMDNMMN7+=====+++++==========~~~~~~~~~~=~======+ +77777777777777IIIII7IIIII????????II?????++++$DN8Z7?+++=++???I$ODNNNMMMMMNNNNNMMM+=+===~==========~==~~~~~~~~~~~~=~====== +$$77777777777I77IIIIIIII????II?III?????++++I8N$I?+======++???I$O8DDNNNMMNNNMNMNMZ+=+==~===~~====~==~~~~~~~~~~~~~~~====== +$$77777777III77IIIIIIII??????I?I????+++++?I8NOI?=~~~~~~~~~==+?I7$ZDNNNNMMMMNNNMNMO+===~~===~~~~~~~~~~~~~~~~~~::~~======= +$$$$$$77II77IIIIIIIIIII?????????????+++++7NM87+=~:~~:~~~~~~==++I7$8DNNNMNMMMMMNMNMO=~=======~~~~~~~:~~~~~~:::::::~~===== +77777$$7IIII?II??II??????????++++??++===$NMNZI+=~~~~~~~~~~~==+?I7$OO8DNMNNNMNNMMNMM$==+++===~===~~~~~~~~:::::::::~~~==== +7II?I7I77III???+????++???????++????+==~+$DMD$I+=======~=====+???I7$ZO8DDNNMMNNMMMMMD???+++++++==~=~~~~=~~~~~:::::~~~==+= +777I777$7II???????++++??????+++???++==+IONM8$I+============+++??II7$ZZODNNNMMMMMMMMM7?I??????+=====~~~~~~~~~~::::~~~===+ +$7777$$ZZ7I7I??++?I?++?++???+++++++===7$DNNO7I++===~~=======++++++?I7$Z8NNNNNMNMNMMM8I7IIII7I+=====~+=~~::::~~~::~~~===+ +ZZZOOZ8OO$7III?II77I?+++++++++=====+=?78DMMZI?=+===~=~=~==++=+++???II7Z8NMMMMMMMNMNMD7$$$I77I????+++?=~~~~~~~::::::~==++ +O8888ZZZ88Z$$$$7777$7?I7?++=+=++====+7$8NMMOI?????+=+===?7$7IIIII77$ZZODNNMMMMMMNNMNN$OZ$7IIII?I??++?+?+=~~:~~:::::===++ +O8DD8OOOOOOOZ$$$$$Z$$$Z$7I++++++====?$Z8MMM87?I77$I++++?$ZOZZZZOZ$OOOOO8NNMMMMMMNNNMMOZ$ZZ$$777I??+??+?+=~~:~~~::::~==== +DDDD88OOOZZZZOOOZZOOOOZ$ZZ7+?+=++=++IOO8DNMDDDI777$ZI+?ZDDZ7$OOO8DMNO$ZODMMMNNNNMMMNMDOZZZZZ$III?I7$7I??=~~~~~~~:~==++++ +888888888OOOO8OZO8OOOZO$7$Z+?+=+++??IZDNNMMOZDIZNDO7I=I8O$I?IOZZZZ???I7O8MMNNMMMMMMMMNOOZZZZZ7$$$77$77I++~:::::~:~====+? +DD8D8O8OOO888OOOZ8D8O88ZZ8+???IZO$???ONNMMMZIIII$Z7?+=7ZZ7??I77$7I++?I7ODMMMMMMMMNNNMMO8OOOZ$7$$$77$777I?=~~~~~~~===+++? +8D88OO88OOO8888OODD888OOO8OZ7$OO$8Z7ZO8NMMN7?+=====+?+I77I?=~~~~~=??I7Z8DMMMMNMMMMMNNMZZZZZ$$777$$$Z$$$7I+==~==~=====++? +8DDDO88888888DDD8DD88DD8O888OZOZ$DO$OO8NMMM$?+====++++?II?+==~~~==?I7$Z8NMMMMNMMMMNNNMZZZZZZ$$Z$$$$ZZZ$7I?==========++?? +DD888D8OO8DDD8ODNDD88DDD8D8D8O8OODOO88DNNMM8I+=~==+++=?II?++====++I7$ZODNMMMNMMNMMNNNM77777I??I???????????++++++???????I +NMMNNNNNDDDND8D88DD8DDDDDD8DD8D8D8DNNNNNNMMD7+++==++++II7I?++==++?7$ZO8NNMMMNNNMMMMMNN88OOOOO$$$$$$$7I??I???++??III7$$7I +NMMNDDNNNDDDD88O88888D8DN8DDDDDDNNNMMNNNMMMMZ7++??I?=?777ZI++=+??I$ZOODNNMMMMMMMMMMMMNDD8O8OOOZZZZZZZ$ZZ$7I7777I7I7$$ZZZ +NNNNNDDNNDDDNDNDD888DD88DDDDDDDDDNNNNNMMMMMMD$II?++?$8NMND7++??II7ZO88DNMMMMMMMMMMMMMMNDDD888OOOOOO8OZ$Z$$$ZZZ$$$$$$$$ZZ +MMNMNDDNNNDDNDDDNDD8DD888D88DDDDNNNMNNNMMMMMNZ7II?==?NNN8ZI??III7$$ZO8DNMMMMMMMMMMMMMMN8OOOOOOOOZOOOZOZZZZOZZZZ$$$$$$ZZ$ +NNNMMNNDDNDDNDDDNND8DDDDDD88DDDDDNDNMMMMNMMMMO7I77?++I7$$77Z7IIII7ZZO8DNNMMMMMMMMMMMMNND888ZOOOZZZOOOOZZZZ$$77777$$ZZOO8 +MNNMNDDDNNNNNDDDDDD8DDNDDDDDDNNDNDDDNMMMNNMMMN7II7I?77$ZOOZ7I??II7ZO8DNNNMMMNNMMMMMMMNNN8OOZOZZZZZZZZZZZZ$$$$$$$$$$ZOOOO +NMMNDNNNNNDDDDDDDNNNNNMNDDDNDNNDD88DNNNNMMMMMMO7I?++IZZZZZ$77II7$$O8DDNNMMMMMMMMMMMMMNND8OOOOZZZOOZZZZZZZZZZZZZOOOZZZZZO +NMMNDNNNNNNDNDDDDNDNNNNNNNNDDDDDD88DNNMMMMMMMMNO$II??$$Z$77$777$ZZ8DDDNNMMMMMMMMMMMMMMDD8ZOO8OZZZ$ZZOOOOZZZZOOOOOOZOOZ$Z +NMMNNNNNNNNNNNNNDNNDDDDDD8D88D8D88O8NDDNMMMMMMMMNO7?+===?I777$ZO88DDDNMMMMMMMMMMMMMMMMND8O$ZZZ$$$$$ZOZOOZZZ$$$Z$$ZZ$ZOZZ +MNNMNNMNNNNNNNNNNNNNNNDDD888888888O8NNNMNNNMMNMMMMNOI++?I77$O88DDDDNNMMMMMMMMMMMMMMMMNNNDOZZZZ$$$$$$ZZZZOZ$$ZZOOO$$ZOZZO +NNMMMNMMMDDNNNNNNNNNDNNDDDDD88O8OOZ$8NNNMMMMMMMMMMMMNZZOO88DDDDDDNMMMNNNMMMNMMMMMMMMNMNNDZOZO8ZOOZZZOOZO8O8OOOOO8OZZZZ$$ +MMMNNNMMNNNDNDNNNNNNNDNNDDDDDD88OZZ$OMNMMMMMMMMMMMMMMMMMMMNNNMMMMMNNNNNNNNNMMMMMMMMMMNNNND88O8OOOOOZOOOO8OZO888888OZZZO8 +NMNNNMNMMMNDNNNNNNNND88DOO8OOZOOZZZ$ZDNMMMMMMMMMMMMMMMMNNMMMMMMNNNNNNDNDDNNMMMNMMMMMMNMMND88OOZZZZZ$OOO88OO8888O8O888OOO +MMMMMMMNMNNNNDDDDDDD8888D8OZZZZZZOZZO8NMMMMMMMMMMMMMMMN$ZO88DNNNDDD88OOO8DNNMMNMMMMNNNNNN8O8O8OOOO8OOOO8OZZZO88OOZOZZZO8 +MMMMMMMMMMNDNNNDD888OOO8OZ8OOOZOZZZZOOONMMNNMMMMMMMMMMMZI7$$OOO888OOZZZZZ8DNMNNNMMMMNNNMMDD8Z$77II7$77$$$$$$$77$7I??7$ZZ +NNMMMMMMMNDDND88D888O8OO8O88OOOOOOOO888NMMMNMMMMMMMMMMMD7II77$ZZZZZZ$$77$Z8NNDNMNNMNDNNMMMN8DD8O8O8OZZ7I77Z$77777$$ZOZ7$ +NNNNNNNNNNNND88DNNDDNNNNNOOOOOOOZOZONDDMMMMMMMMMMMMMMMN8$7III777$$777I7I7$Z8NNNNNNNN88MMMMMNMND888DNZOO8DNZ77II777ZZ$7$O +NNNNNNDNDDD88888D8DNNNNNMDD8O8DD8DNDNNMMMMMMMMMMMMMMMDOZ$7II?I7777IIIII?7$$ODNDDDDDN88MNNMMNNND8OO8NODD8DN8O7II77$Z$$7$O +NNNNNNNNDDDDD888D8NDDDO8NMNMNNNMNNMMNNNMMMMMMMMMMMNDO7I?I????????I?++????I7Z8DDNN88N8DMNMNNMNDDNNNND88ZZOOZZ7II?IZ$ZZ7$$ +NNNNNNNNNDDDD8DDNNDDDND8NMMMMMMNMNNMMMMMMMMNMMMNNZ$$7???++?+????+++++++++?I$O8NDDZ8D8DNNNNMMNDD8OZZZ7III???III7ZZ$ZOZZZ8 +MMNDDNMMNNND8DNDNNNDD8DDNMNDNMMMMNMMMMMMMMMMMM8$7I???=++=++++++++==+==+++I7ZDDDDOZ8D8NNNNNNNNMND8888O7+?I?7$$77$$$$ZOOOO +NMMNNNNMNNNDDDNDDDD8888NMMNDNMMMMMMMMMMMMMMMMMZIII++++++==+=+++++==+++????7Z888DOZ8DDNNNNNNNNMNND88D8$?IIII777$$Z$$$Z$$$ +NNNNNNMNNDDDNDDD8O8O8DDNMNNNNMMMMNNNMMMMMMMNNN7I?+++========++========++??I$8OO88O8DNMNNNNMDDNNMNDDDOO$I$7I??II??I777777 +NNNMNNNND8DDD8DDO8D8DNDNDDNNDDNMNNNMMMMMMMNNNOI+++++=~~=====+====~=====+?I$$8DO88O8NNMNNNDD88DDDNNNN8OO8Z$77Z7?7O777$O$$ +NDNNNDNNND8888O8OO8O8DDDNNDDDNNDNNMMMMMMNDDDO$?+==============~====+++++?I$8O888888MMMNN8ZZZ88DDNMMNND8Z$$IIIIII?IIII??? +NNNMNDMMNM8Z8$ZOOO8OODDDDD888DNNMMMMMMMM8OZZO7++======~~~=======~~==++?+?I$ZOO8D88DND888OZOZ7ZZZO8DNMMMND88888Z77777I?I? +NNNNNDMMNMDDN$ZOZZOOZO88DN888DMMMMMMMMMMOZZ$$?=+===========~=====~===+++?I$ZOO8DDD8OOZ$$$7$$$8DDDDNMNNMMMD8O88OZ$$$OO77$ +NNNNNNMMNNNDNMN8OZZO88O8D88DNMMMMMMMMMMNZ7II?+==========~======~=~===++??7ZOO888O$7$$$$I?IIII$O8DNMMMMMMMMNDD8ODD88888DO +DDNNDDNDDNNNNNNDNDOOOOOOO88MMMMMMMMMMMN8$III+===~=========~~=~~~==~==++?I$$ZZZZOOOZ7I?7$O888DNNNNNNMMMMMMMMNNDD88DNNDO$I +NNNNDDDNNNDNNNNNN88DDD8OZ$MMMMMMMMMMMMND7?++=======+===~~~~~~~~=~~~~~=+??7$$ZOO$7$ZO8DDNNNMMMMMMMMMMMMMMMMMMMD88DDD8888D +DNNNNNNNDDDDDNDDDDD888OZ$8MMMMMMMMMMMNDD87?++=~~=++++=~~~~~~~:~~~~~~===+?7ZZ$ZZODNNMNNDDNNNNMMMMMMMMMMMMMMMMMNMD8888DND8 +DNNNNNNNNND88D8888OZ$ZZZ8NMMMMMMMMMMNNDDDO$I?+===+?++==~~~~~~~~~~~~====?7$ZOO8DDNNNNDDMMMMMMMMMMMMMMMMMMMMMNNNMN888888D8 +NNDDND888OOO888OOOOO88DMMMMMMMMMMMMMNDD8DOOOD87I?I?+=~~~~~~=~~~~~===+I$ZOO8DNNMNNNNMMMMMMMMNMMMMMMMMMMMMMMMNMNMNDOOZOZO8 +NDND888O8888DO888DDDDMMMMMMMMMMMMMMNND88D8DD8888DDD8O7III?++=+==++I$$Z88ODMMNNNMMMMNNMNDNNNNMMMMMMMMMNMMMMMMMNNMMOOOZZ88 +NDDD8D8O8DDDD88888D8MMMMMMMMMMMMMMNDDDDDNNNDD8D8888OOOOOOOOO8OO8OZO8OODMD8NMMMMMMMMNNN8NNNNNMMMMMMMMMMMMMMMMMMMNMDDNDNDD +NNDDDDDD8888OOZOOZZZMMMMMMMMMMMMMNDNDNNDMMD8DD8O8OO8D888888D888888ODMMNDNMNMMMMMMNNNN8NMNNNNMMMMMMMMMMMMMMMMMMMMNNDDDDD8 +MMNDDD888888O8OOOZ$$MMMMMMMMMMMMMNDDNNNDMMDDDNDD8OOO88888D8DDD8DD8DNNNNMMMMMMMMMNNNMD8NMDNNNMMNNDNNNMMMMMMMMMMMMNM8O88D8 +MMMNNNDDD8888888DDDDMMMMMMMMMMMMMNNNMNDNMNNMNMD8D88DDD88DND8NNNDDNDNMMMMMMMMMMMMNNNNDNNDDNN8OODNDDNDNNMMNMMMMNNNMMNOOO88 +MMMNNNNNNDNDDDDDD8DDMMMMMMMMMMMMMNNMMNMMMNMMMNDDDD8DD88NNMNMD8NNDNMMMMMMMMMMMMNNNMNNNMNND88O888NNNNNDNNMMMMMMMNMNNMDOZZZ +MMMMMNNNNNNNNDDDDDDDMMMMMMMMMMMMMMMMMMMMNMMMMMNNNNNMNNNNMMMNNMNNMMMMMMMMMMMMMMMMMMMMMMDNND8O8D8N88DNNMMMMMMMNNNMMMMMNNND +MMMMNNNDDNDNNDDDNNNMMMMMMMMMMMMMMMMMMMMMNMMMMNNNMNNMNNNNMNNNNNMNNMMMMMMMMMMMMMMMMMMMMNNNDDO888O888DNMMMMMMMMNNNNNMNMMMNN +MMMNDD8D8888OOOO8DNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMNMMMMMNNNMNNNMMMMNMMMMMMMMMMMMMMMMNDND888888DNDNMMMNMMMMMMMNNNNNNMMD88 +MMD8888OOOO88OO88DNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNMMMMMMMMMMMMMMMMMMMMMMNDDDDD8ODDDNMMMMMMMMMMMMMNNNDNMMMMN88 +MD8D888888OOOOOO8NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNMMMMMMMMMMMMMMMMMMMMMMNNNDNND888DMMMNMMMMMMMMMMMMNNNNNNNNMDO +88DDD88888OOO888MMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMNNMMMMMMMMMMMMMMMMMMMMNMNNNNDDNNDNNNMMNMMMMMMMMMMMMMMNNNNNMNNMN8 +DDDDDDDDDD888DDNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMNNNNDNNNNNMMMMMMMMMMMMMMMMMMMNNNNNNNMMNN +NMMMMMMNNNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMNMMMMMMMMMMMMNNNNMMMNNNN +MMMNNMNNNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNMMNMMMMMMMMMMMMMMMMMMMMMMMNNNMMMMMMN +NMMMMMNNNNMMMMMMMMMMMMMMMNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNMNNMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNMMMN +NMMMNNMMMMMMMMMMMMMMMMMMMNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMNNNMNNNMMMNNNM +NNMMMMMMMMMMMMMMMMMMMMNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMNMMMMMMMMMMMMMMMNNMMNNMMMNNNN +NMMMMMMMMMMMMMMMMMMMMMMMNNNMMMMMMMMMMMMMMMMMMMMMMMMMMNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMNMMMMMMNNN +NMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMNMMNMMMMNN +NMMNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNMMMMMMMMMMMMMMMNNMNN +NMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNMMMMMMMMMMMMMMMMMMMNN +NMMMMMMMMMMMMMMNNMMMNDDDNMMMMMMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNMMNMNNMNM +MMMMMMMMMMMMMNNND88NMMMMNDDMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNMMMMNN +NMMMMMMMMMMNNNNNDDMMDDDNNNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNMMMMMMMMMNMMNNNMNNNNNNNNN +MMMMMMMMMMMMMMNNNMNODNND88NODD8DMNMND8OODDNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNMNNN +NMMMMMMMMMMMMMDDNDOOMMND8N8DDODMN8O$III77$Z8DMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNMNNNNNNMM +NMMMMMMMMMMMMN8NDNNNNDONMNNO8MDZ8IIIIIII77$$$7ZODNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNMNNMNNN +MMMMMMMMMMMMMNMDDMNMODMM8DNMMNOD$777IIII777777$$$$77$DMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNMMNNMNN +NMMMMMMMMMMMMNDNMNN8MMMNMNMNMD88$$777777777777777$$77$$8NMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNMMMNNNNN +NMMMMMMMMMMMMMMMMMDNNMMNMDMNMNNDZ$$$$$$$$7777777777$$$$$ZZZZNMMMMMMNNMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMMMMMMMNNNMNNNNNNN +NMMMMMMMMMMMMMMMMNNNMMNNNDMMNNM8ZZZZZ$$Z$$777777$$77$$$$77$$Z8NMMMMMNMMMMMMMMMMMMMMMMMMMMMMNMMNMMMMMMMMNMMMMNNNNNNNNMMNN +NNNMMMMMMMMMMMMMMMMMMMNMMMMMNNMND8888OOZZ$$$$$$7777777777777$$ZO88MNMNMMMMMMMMNNNDD8O8NNMMNNNMMMNMMMMMMNNMNNMNNNNNNNNNNN +NMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMDDNDD88ZZZ$$$$$7$$$$77$ZZ$7III$8NDNNMN8ZO8O88NMND888NNND8O88NNMMMMMMMMNMMNNNNNNNNNNNNNN +NNNNMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMMMNN8ZZZZZ$$$$Z$$$$$ZODD8777$7$D88D8OZZO8DD8O88DND88DNNNNNNNMMMMMMMMMMMNMMNMNNNMMMNNN +NMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMD888OOZZZZZ$$ZZZZ$$ZZ8NNOZ$$$$DDDDDNDOODDDDDDDDDDD8DNNDNNNNNMMMMMMMMMMMMMNNNNNNNMMNN \ No newline at end of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/gif89a_onemeg.gif Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/gif89a_onemeg.gif has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/ota_bmpiso.ota Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/ota_bmpiso.ota has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/wbmp_skull.wbmp Binary file mds_plat/harvester_framework_api/tsrc/data/mmc/HarvesterTest/wbmp_skull.wbmp has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/harvester_framework_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/harvester_framework_api/tsrc/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,65 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +../ComposerPluginTest/group/ComposerPluginTest.mmp +../HarvesterClientTest/group/HarvesterClientTestScripter.mmp +../HarvesterDataTest/group/HarvesterDataTest.mmp +../HarvesterPluginTest/group/HarvesterPluginTest.mmp +../MonitorPluginTest/group/MonitorPluginTest.mmp + +PRJ_TESTEXPORTS +../conf/ComposerPluginTest.cfg /epoc32/winscw/c/TestFramework/ComposerPluginTest.cfg +../conf/HarvesterClientTestScripter.cfg /epoc32/winscw/c/TestFramework/HarvesterClientTestScripter.cfg +../conf/HarvesterDataTest.cfg /epoc32/winscw/c/TestFramework/HarvesterDataTest.cfg +../conf/HarvesterPluginTest.cfg /epoc32/winscw/c/TestFramework/HarvesterPluginTest.cfg +../conf/MonitorPluginTest.cfg /epoc32/winscw/c/TestFramework/MonitorPluginTest.cfg + +../init/ComposerPluginTest.ini /epoc32/winscw/c/TestFramework/ComposerPluginTest.ini +../init/HarvesterClientTestScripter.ini /epoc32/winscw/c/TestFramework/HarvesterClientTestScripter.ini +../init/HarvesterDataTest.ini /epoc32/winscw/c/TestFramework/HarvesterDataTest.ini +../init/HarvesterPluginTest.ini /epoc32/winscw/c/TestFramework/HarvesterPluginTest.ini +../init/MonitorPluginTest.ini /epoc32/winscw/c/TestFramework/MonitorPluginTest.ini + +../data/mmc/HarvesterTest/bmp_burst.bmp /epoc32/winscw/c/Data/bmp_burst.bmp +../data/mmc/HarvesterTest/G31D.TIF /epoc32/winscw/c/Data/G31D.TIF +../data/mmc/HarvesterTest/G4.TIF /epoc32/winscw/c/Data/G4.TIF +../data/mmc/HarvesterTest/GIF87testimage.gif /epoc32/winscw/c/Data/GIF87testimage.gif +../data/mmc/HarvesterTest/gif89a_onemeg.gif /epoc32/winscw/c/Data/gif89a_onemeg.gif +../data/mmc/HarvesterTest/Liverpool.jpg /epoc32/winscw/c/Data/Liverpool.jpg +../data/mmc/HarvesterTest/MBMtestimage.mbm /epoc32/winscw/c/Data/MBMtestimage.mbm +../data/mmc/HarvesterTest/ota_bmpiso.ota /epoc32/winscw/c/Data/ota_bmpiso.ota +../data/mmc/HarvesterTest/PNGtestimage.png /epoc32/winscw/c/Data/PNGtestimage.png +../data/mmc/HarvesterTest/PSRETRO.WMF /epoc32/winscw/c/Data/PSRETRO.WMF +../data/mmc/HarvesterTest/wbmp_skull.wbmp /epoc32/winscw/c/Data/wbmp_skull.wbmp +../data/mmc/HarvesterTest/Jpg.jpg /epoc32/winscw/c/Data/Jpg.jpg +../data/mmc/HarvesterTest/Animated.gif /epoc32/winscw/c/Data/Animated.gif +../data/mmc/HarvesterTest/Mbm.mbm /epoc32/winscw/c/Data/Mbm.mbm +../data/mmc/HarvesterTest/H263.3gp /epoc32/winscw/c/Data/H263.3gp +../data/mmc/HarvesterTest/MPEG4.mp4 /epoc32/winscw/c/Data/MPEG4.mp4 +../data/mmc/HarvesterTest/MPEG4.3gp /epoc32/winscw/c/Data/MPEG4.3gp +../data/mmc/HarvesterTest/Temp1.jpg /epoc32/winscw/c/Data/Temp1.jpg +../data/mmc/HarvesterTest/Temp2.jpg /epoc32/winscw/c/Data/Temp2.jpg +../data/mmc/HarvesterTest/Temp3.jpg /epoc32/winscw/c/Data/Temp3.jpg +../data/mmc/HarvesterTest/00001.mp3 /epoc32/winscw/c/Data/00001.mp3 diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,43 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + +#include +#include "../../../locationmanager/inc/locplatsupport.mmh" + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS +../inc/rlocationtrail.h MW_LAYER_PLATFORM_EXPORT_PATH(rlocationtrail.h) +../inc/rlocationmanager.h MW_LAYER_PLATFORM_EXPORT_PATH(rlocationmanager.h) +../inc/locationtrailpskeys.h MW_LAYER_PLATFORM_EXPORT_PATH(locationtrailpskeys.h) +../inc/rtracklog.h MW_LAYER_PLATFORM_EXPORT_PATH(rtracklog.h) +../inc/rlocationobjectmanipulator.h MW_LAYER_PLATFORM_EXPORT_PATH(rlocationobjectmanipulator.h) +../inc/locationdatatype.h MW_LAYER_PLATFORM_EXPORT_PATH(locationdatatype.h) +../inc/locationeventdef.h MW_LAYER_PLATFORM_EXPORT_PATH(locationeventdef.h) +../inc/geotagobserver.h MW_LAYER_PLATFORM_EXPORT_PATH(geotagobserver.h) +../inc/rlocationgeotagger.h MW_LAYER_PLATFORM_EXPORT_PATH(rlocationgeotagger.h) +../inc/geotagger.h MW_LAYER_PLATFORM_EXPORT_PATH(geotagger.h) +../inc/reversegeocoderplugin.h MW_LAYER_PLATFORM_EXPORT_PATH(reversegeocoderplugin.h) +../inc/reversegeocoderplugin.inl MW_LAYER_PLATFORM_EXPORT_PATH(reversegeocoderplugin.inl) + +PRJ_MMPFILES + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/inc/geotagger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/geotagger.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A class responsible for geotagging of media files in background. +* +*/ + +#ifndef GEOTAGGER_H_ +#define GEOTAGGER_H_ + +#include +#include +#include +#include + + +/** + * GeoTagger converts a given cell ID(CGI Info) to geo-coordinates. + * Does reverse geocoding to get country and city name. + * Creates country and city tag for image/video files. + * @since S60 9.2 + */ + +NONSHARABLE_CLASS(CGeoTagger) : public CBase + { +public: + /** + * 2-phased constructor. + */ + IMPORT_C static CGeoTagger* NewL(MGeoTaggerObserver* aObserver, CMdESession* aMdeSession = NULL ); + +public: //exported API + /** + * Harvests location tags. + * @param aObserver, observer for geotagging. + * @return None. + */ + virtual void CreateGeoTagsL( const TConnectionOption = ESilent ) = 0; + + /** + * Is there any untagged photos with location info?. + * @return None. + */ + virtual void PendingGeoTagsL( TBool aTagInProgress ) = 0; + }; + +#endif // GEOTAGGER_H_ + +// End of file. + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/inc/geotagobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/geotagobserver.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,79 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: A class responsible for geotagging of media files in background. +* +*/ + +#ifndef GEOTAGOBSERVER_H_ +#define GEOTAGOBSERVER_H_ + +#include +#include +#include + +enum TConnectionOption + { + ESilent=0, + EInteractive + }; + +typedef enum + { + EGeoTaggingPending = 0x01, + EGeoTaggingGoingOn, + EGeoTagCmpt + }TGeoTaggingSatus; + + +class MGeoTaggerObserver + { +public: + /** + * This method is used for notifying completion of geotagging + */ + virtual void GeoTaggingCompleted( const TInt aError ) = 0; + + /** + * This method is used for notifying completion of query for pending geo tags + */ + virtual void PendingGeoTagReqComplete( const TInt aError ) = 0; + + /* + * Get registrer network country code + * + * @return current register n/w info + */ + virtual RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw() = 0; + + /* + * UE is registered to home network? + * + * @return ETrue if UE is registered at home network else EFalse + */ + virtual TBool IsRegisteredAtHomeNetwork() = 0; + + /* + * Get home network country code + * @param aHomeNwInfoAvailableFlag ETrue if home n/w info available else EFalse + * @return user home n/w info + */ + virtual const RMobilePhone::TMobilePhoneNetworkInfoV1& + GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag) = 0; + + }; + + +#endif // GEOTAGOBSERVER_H_ + +// End of file. diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/inc/locationdatatype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/locationdatatype.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,39 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef LOCATIONDATATYPE_H_ +#define LOCATIONDATATYPE_H_ + +#include +#include + +const TInt KMaxCountryName = 128; +typedef TBuf TCountryName; +/* + * TLocationData encapsulates all location data. + */ +struct TLocationData + { + TPosition iPosition; + CTelephony::TNetworkInfoV1 iNetworkInfo; + TCourse iCourse; + TCountryName iCountry; + TUint iSatellites; + TReal32 iQuality; + }; + +#endif /*LOCATIONDATATYPE_H_*/ + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/inc/locationeventdef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/locationeventdef.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,31 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definition file for Location Manager. +* +*/ + +#ifndef __LOCATIONEVENTDEF_H__ +#define __LOCATIONEVENTDEF_H__ + +enum TEventTypes + { + EStarted = 0, + EStopped, + ESignalChanged + }; + +#endif // __LOCATIONEVENTDEF_H__ + +// End of file. + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/inc/locationtrailpskeys.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/locationtrailpskeys.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,38 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Definition file for Location Trail PS keys. +* +*/ + +#ifndef __LOCATIONTRAILPSKEYS_H__ +#define __LOCATIONTRAILPSKEYS_H__ + +const TUid KPSUidLocationTrail = { 0x200071BE }; + +/** + * Used by location trail, indicating location trail state changes. + * + * Possible values: + * 0: Location trail stopped. + * 1: Location trail started, waiting for valid GPS data. + * 2: Location trail started, searching GPS device. + * 3: Location trail started. + */ +const TUint32 KLocationTrailState = 0x00000001; + + +#endif // __LOCATIONTRAILPSKEYS_H__ + +// End of file. + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/inc/reversegeocoderplugin.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/reversegeocoderplugin.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,209 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: The header file for ReverseGeoCoderPlugin that creates the ReverseGeocoder +* +*/ + + +#ifndef __REVERSEGEOCODERPLUGIN_H__ +#define __REVERSEGEOCODERPLUGIN_H__ + +// INCLUDES + +#include +#include +#include +#include +#include + +const TUid KReversegeocodeInterfaceUid = {0x2002DD13}; + + +/* + * Data class to get the address details. An handle to this type will be given to the + * user through MReverseGeocodeObserver::ReverseGeocodeComplete callback, through which + * user can retrieve the address details using the following interfaces. + * + **/ +class MAddressInfo + { + public: + /* + * Gets the reference to the country name. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the Country Name. + */ + virtual TDesC& GetCountryName()= 0; + + /* + * Gets the reference to the State. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the State name. + */ + virtual TDesC& GetState()= 0; + + /* + * Gets the reference to the City. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the City Name. + */ + virtual TDesC& GetCity()= 0; + + /* + * Gets the reference to the District name. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the District Name. + */ + virtual TDesC& GetDistrict()= 0; + + /* + * Gets the reference to the postal code. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the postal code. + */ + virtual TDesC& GetPincode()= 0; + + /* + * Gets the reference to the thoroughfare name. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the thoroughfare name. + */ + virtual TDesC& GetThoroughfareName()= 0; + + /* + * Gets the reference to the thoroughfare number. Scope of this returned reference is limited to + * this perticular call. User has to store it for their further processing. + * + * @return reference to the String which holds the thoroughfare number. + */ + virtual TDesC& GetThoroughfareNumber() = 0; + }; +/* + * Observer class which exposes callbacks to notify the completion of reversegeocoding event. + * + **/ +class MReverseGeocodeObserver + { + public: + /* + * Callback function which notifys the completion of reverse geocode event. This signals the completion + * of the asynchronous function CReverseGeoCode::GetAddressByCoordinate. + * + * @param aErrorcode Error status KErrNone in case of success or other system specific errorcodes + * in case of failures. + * + * @param aAddressInfo refrence to the address stucture, through which user can access the + * address information. + */ + + virtual void ReverseGeocodeComplete( TInt& aErrorcode, MAddressInfo& aAddressInfo ) =0; + + /* + * Get registrer network country code + * + * @return current register n/w info + */ + virtual RMobilePhone::TMobilePhoneNetworkInfoV2& GetCurrentRegisterNw() = 0; + + + /* + * UE is registered to home network? + * + * @return ETrue if UE is registered at home network else EFalse + */ + virtual TBool IsRegisteredAtHomeNetwork() = 0; + + /* + * Get home network country code + * @param aHomeNwInfoAvailableFlag ETrue if home n/w info available else EFalse + * @return user home n/w info + */ + virtual const RMobilePhone::TMobilePhoneNetworkInfoV1& + GetHomeNetworkInfo(TBool& aHomeNwInfoAvailableFlag) = 0; + }; + + +/** + * CReverseGeoCoderPlugin + * + * An implementation of the CReverseGeoCoderPlugin definition. + * Encapsulates the reverse goecoding functionality + * This is concrete class, instance of which + * ECOM framework gives to ECOM clients. + */ +class CReverseGeoCoderPlugin : public CBase + { +public: + + /** + * Create instance of concrete implementation. + * @return: Instance of this class. + */ + static CReverseGeoCoderPlugin* NewL(); + + + /** + * Destructor. + */ + virtual ~CReverseGeoCoderPlugin(); + + +public: + + /** + * Creates the instance of Reverse Geocoder + * + */ + virtual void CreateReverseGeoCoderL() = 0; + + /** + * Initializes the ReverseGeoCodeObserver + * @param: aObserver The observer class instance that is to be notified when reverse geocoding completes + * + */ + virtual void AddObserverL(MReverseGeocodeObserver& aObserver)=0; + + /** + * A wrapper API to fetch the address from geocoordinates + * Internally calls the ReverseGeoCoder + * @param aLocality A TLocality object that contains the geocoordinate information + * @param aOption Indicates if the connection is silent connection or not + * + */ + virtual void GetAddressByCoordinateL( TLocality aLocality,const TConnectionOption aOption )=0; + + /** + * Wrapper API to check if the ReverseGeoCoder allows a silent connection + * @return:TBool Indicates if a silent connection is allowed + * + */ + virtual TBool SilentConnectionAllowed() = 0; + +private: + + TUid iDtorKey; + + }; +#include "reversegeocoderplugin.inl" + +#endif //__REVERSEGEOCODERPLUGIN_H__ + +//End of file + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/inc/reversegeocoderplugin.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/reversegeocoderplugin.inl Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: This is partial interface implementation which is +* used by plugins. +* +*/ + + + +// INCLUDE FILES + +#include // declares E-com framework classes + + +// ----------------------------------------------------------------------------- +// CReverseGeoCoderPlugin::~CReverseGeoCoderPlugin() +// Destroys the plugin implementation +// ----------------------------------------------------------------------------- +// +inline CReverseGeoCoderPlugin::~CReverseGeoCoderPlugin() +{ + REComSession::DestroyedImplementation( iDtorKey ); +} + + +// ----------------------------------------------------------------------------- +// CReverseGeoCoderPlugin::NewL() +// Creates the instance of CReverseGeoCoderPlugin concrete implementation. +// ----------------------------------------------------------------------------- +// +inline CReverseGeoCoderPlugin* CReverseGeoCoderPlugin::NewL() +{ + RImplInfoPtrArray aImplInfoArray; + REComSession::ListImplementationsL(KReversegeocodeInterfaceUid, aImplInfoArray); + + TInt count = aImplInfoArray.Count(); + + if(!count) + { + /* No implementations found for the reverse geocoding functionality */ + User::Leave(KErrNotFound); + } + + /* One or more implementations found. Choose the first one */ + const CImplementationInformation* plugin = aImplInfoArray[0]; + TUid pluginId = plugin->ImplementationUid(); + + CReverseGeoCoderPlugin* self = reinterpret_cast( + REComSession::CreateImplementationL( + pluginId, _FOFF( CReverseGeoCoderPlugin,iDtorKey ) ) ); + + return self; +} + +// End of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/inc/rlocationgeotagger.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/rlocationgeotagger.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,81 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An interface to Location Trail. +* +*/ + +#ifndef R_RLOCATIONGEOTAGGER_H +#define R_RLOCATIONGEOTAGGER_H + +#include +#include +#include +#include +#include +#include + + +/** + * RLocationManager class is used for creating a Location Manager session. + * Location Manager is used to start and stop the location trail, retrieve + * location information and write the location information to images. + * + * @lib LocationManager.lib + * @since S60 9.2 + */ +NONSHARABLE_CLASS( RLocationGeoTagger ) : public RLocationManager + { +public: + +public: + IMPORT_C RLocationGeoTagger(); + + IMPORT_C ~RLocationGeoTagger(); + + + /** + * Is there any geo tag pending state. (Asynchronous call) + * @param aStatus - request status. + * @param aTagPendingFlag - tag pending flag (ETrue if few entry is yet to be tagged else EFalse) + * @return None + */ + IMPORT_C void GeoTagStaus( TRequestStatus& aStatus, + TGeoTaggingSatus& aTagPendingFlag ); + + /** + * Cancel tag pending request + * @return None + */ + IMPORT_C void CancelTagPendingRequest(); + + /** + * Cancel geo tagging request + * @return None + */ + IMPORT_C void CancelGeoTaggingRequest(); + + /** + * Start geo tagging. + * @param aConnectionOption - connection option (ESilent/EInteractive). + * @return None + */ + IMPORT_C void StartGeoTagging(TRequestStatus& aStatus, const TConnectionOption aConnectionOption ); + +private: + TPckg *iTagPendingData; + }; + +#endif // R_RLOCATIONGEOTAGGER_H + +//End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/inc/rlocationmanager.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/rlocationmanager.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An interface to Location Manager +* +*/ + +#ifndef R_RLOCATIONMANAGER_H +#define R_RLOCATIONMANAGER_H + +#include +#include +#include + +/** + * Base class for Location Manager client interfaces. + * @lib LocationManager.lib + * @since S60 3.1 + */ +NONSHARABLE_CLASS( RLocationManager ) : public RSessionBase + { +public: + + /** + * C++ default constructor. + * @since S60 3.1 + */ + IMPORT_C RLocationManager(); + + /** + * Creates new session to Location Manager Server. + * @since S60 3.1 + * @param None. + * @return KErrNone if successful. + */ + IMPORT_C TInt Connect(); + + /** + * Closes the connection with Location Manager Server + * @since S60 3.1 + * @param None. + */ + IMPORT_C void Close(); + +private: + /** + * Returns the version of Location Manager. + */ + TVersion Version() const; + +protected: + /** + * Completes an asynchronous request with an error code. + * @param aError Symbian error code + */ + void CompleteRequest(TRequestStatus& aStatus, TInt aError); + + }; + +#endif // R_RLOCATIONMANAGER_H + +//End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/inc/rlocationobjectmanipulator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/rlocationobjectmanipulator.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An interface to Location Object Manipulator. +* +*/ + +#ifndef R_RLOCATIONOBJECTMANIPULATOR_H +#define R_RLOCATIONOBJECTMANIPULATOR_H + +#include +#include +#include +#include + +#include "mdccommon.h" + +/** + * RLocationObjectManipulator class is used to create, edit, copy and delete + * location context objects and tags and relationships between them + * and media items in the MdE database. + * + * @lib LocationManager.lib + * @since S60 3.2 + */ +NONSHARABLE_CLASS( RLocationObjectManipulator ) : public RLocationManager + { + +public: + /** + * Creates a new location object in MdE database with given + * location data. Relationship is created between the location + * object and objects whose ID is given in the ID array. + * @since S60 3.2 + * @param aLocationData, Location data consist info for GPS + * and network data + * @param aObjectId, Create relationships with location data and + * given media object ID + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TInt CreateLocationObject( TLocationData& aLocationData, + TItemId aObjectId ); + + /** + * Creates a new location object in MdE database. + * Relationship is created between the location objects whose ID is given. + * Location data is taken from location trail. + * @since S60 3.2 + * @param aObjectId, Create relationships with location data and + * given media object ID + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TInt LocationSnapshot( TItemId aObjectId ); + + /** + * Deletes the relationship between an object and + * the location context object associated with it. + * @since S60 3.2 + * @param aObjId, Remove relationship from given media object ID + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TInt RemoveLocationObject( TItemId aObjId ); + + /** + * Copies location data of a media object to one or more + * media objects. If the target media object doesn’t have + * a location object associated to it, one will be created. + * @since S60 3.2 + * @param aSourceId, source media object ID + * @param aTargetIds, target media object ID + * @param aStatus Asynchronous request status + */ + IMPORT_C void CopyLocationData (TItemId aSourceId, + RArray& aTargetIds, + TRequestStatus& aStatus); + /** + * Copies location data of a media object to one or more + * media objects. If the target media object doesn’t have + * a location object associated to it, one will be created. + * @since S60 3.2 + * @param aSourceURI, source media object URI + * @param aTargetURIs, target media object URI + * @param aStatus Asynchronous request status + */ + IMPORT_C void CopyLocationData (TDesC& aSourceURI, + RPointerArray& aTargetURIs, + TRequestStatus& aStatus); + }; + + +#endif // R_RLOCATIONOBJECTMANIPULATOR_H + +//End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/inc/rlocationtrail.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/rlocationtrail.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,158 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An interface to Location Trail. +* +*/ + +#ifndef R_RLOCATIONTRAIL_H +#define R_RLOCATIONTRAIL_H + +#include +#include +#include +#include +#include + +typedef TPckg TLocalityPckg; + +/** + * RLocationManager class is used for creating a Location Manager session. + * Location Manager is used to start and stop the location trail, retrieve + * location information and write the location information to images. + * + * @lib LocationManager.lib + * @since S60 3.1 + */ +NONSHARABLE_CLASS( RLocationTrail ) : public RLocationManager + { +public: + /** + * Location trail states. + */ + enum TTrailState + { + ETrailStopped, + EWaitingGPSData, + ESearchingGPS, + ETrailStarted, + ETrailStopping, + ETrailStarting + }; + enum TTrailCaptureSetting + { + EOff, + ECaptureNetworkInfo, + ECaptureAll + }; + +public: + IMPORT_C RLocationTrail(); + + IMPORT_C ~RLocationTrail(); + + /** + * Starts recording location information to location trail. + * @since S60 3.2 + * @param aState, an enumeration of ECaptureNetworkInfo + * (only cell ID stored) and ECaptureAll + * (GPS coordinates and cell ID stored). + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TInt StartLocationTrail(TTrailCaptureSetting aState); + + /** + * Stops recording location information to location trail. + * @since S60 3.1 + * @param None. + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TInt StopLocationTrail(); + + /** + * Retuns the current state of the location trail. + * @since S60 3.1 + * @param aState, The state of the trail is returned. + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TInt GetLocationTrailState( TTrailState& aState ); + + /** + * Get notification when the location trail state changes. + * @since S60 3.1 + * @param aStatus, The request status. + * @return None. + */ + IMPORT_C void NotifyLocationTrailStateChange( TRequestStatus& aStatus ); + + /** + * Cancel notification request for the location trail state change. + * @since S60 3.1 + * @param None. + * @return None. + */ + IMPORT_C void CancelNotificationRequest(); + + /** + * Get location by time stamp. If the TLocality for given time stamp is + * found from the trail, it is returned even if the data in it wouldn't + * be valid. + * @since S60 3.1 + * @param aTimeStamp, Time stamp to get corresponding location. + * @param aPosition, Position value returned. + * @param aNetworkInfo, Network value returned. + * @param aState, State of the trail at given time. + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TInt RetrieveLocation( const TTime& aTimeStamp, + TLocationData& aLocationData, + TTrailState& aState ); + + /** + * Retrieve current location. If request is completed successfully, the + * result is returned via the aLocationInfo and aNetworkInfo arguments. + * The function is asynchronous, because it may take + * several minutes to get location information. + * @since S60 3.2 + * @param aStatus, The request status. + * @param aLocationData, locationData encapsulates all location data + * @return None. + */ + IMPORT_C void CurrentLocation( TRequestStatus& aStatus, + TLocationData& aLocationData); + + /** + * Cancel asynchronous location request. + * @since S60 3.1 + * @param None. + * @return None. + */ + IMPORT_C void CancelLocationRequest(); + + /** + * Get current trail capture setting. + * @return EOff, ECaptureNetworkInfo or ECaptureAll + */ + IMPORT_C TInt GetTrailCaptureSetting( TTrailCaptureSetting& aCaptureSetting ); + +private: + TPckg* iCurrentLocData; + }; + +#endif // R_RLOCATIONTRAIL_H + +//End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/inc/rtracklog.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/inc/rtracklog.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,199 @@ +/* +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: An interface to Track Log. +* +*/ + +#ifndef RTRACKLOG_H_ +#define RTRACKLOG_H_ + +#include +#include +#include + +// forward declaration +class MTrackLogObserver; +class CTrackLogObserverAO; + +/* + * TrackLog API is used to start, stop and delete track-logs, + * to get track-log status and to get track-log in GPX format. + * + * @lib LocationManager.lib + * @since S60 3.2 + */ +NONSHARABLE_CLASS( RTrackLog ) : public RLocationManager +{ + +public: + IMPORT_C RTrackLog(); + + /** + * Starts track-log recording. Also starts location trail recording + * if it is not already running. + * @since S60 3.2 + * @param None. + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TInt StartTrackLog(); + + /** + * Stops track-log recording. + * @since S60 3.2 + * @param None. + * @return None. + */ + IMPORT_C void StopTrackLog(); + + /** + * Gets the status of track-log recording and GPS signal quality. + * @since S60 3.2 + * @param aRecording, indicating track log recording status + * @param aFixQuality, GPS signal quality + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TInt GetStatus(TBool& aRecording, TPositionSatelliteInfo& aFixQuality); + + /** + * Deletes a track-log file + * @since S60 3.2 + * @param aUri, Track log URI + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TInt DeleteTrackLog(TDesC& aUri); + + /** + * Returns a boolean indicating track-log recording status. + * @since S60 3.2 + * @param None. + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TBool IsRecording(); + + /** + * Registers a new track-log observer. + * @since S60 3.2 + * @param aObserver, observer which is added. + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TInt AddObserver(MTrackLogObserver* aObserver ); + + /** + * Removes a registered track-log observer. + * @since S60 3.2 + * @param aObserver, observer which is removed. + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TInt RemoveObserver(MTrackLogObserver* aObserver); + + /** + * Returns the name of the current track-log file. + * @since S60 3.2 + * @param aTrackLogName, track log file name + * @return KErrNone if successful, otherwise one of the other + * system-wide error codes. + */ + IMPORT_C TInt TrackLogName(TDes& aTrackLogName); + + /** + * Overrides inherited class close. + * Close observers array and calls main class close. + * @since S60 3.2 + * @param None. + * @return None. + */ + IMPORT_C void Close(); + +public: + + /** + * @param aStatus, the request status of the active object + * @return None. + */ + void SendNotifyRequest( TRequestStatus& aStatus ); + + /** + * Notifies of an event in tracklog. The event can be of type EStarted/EStopped/ESignalChanged. + * @param aError error code + * @return None. + */ + void TrackLogEvent( TInt aError ); + + +private: + /** + * Array of observers + */ + RPointerArray iObservers; + + TBool iSubscribed; + /** + * An active object that observes tracklog events (starting/stopping/GPS fix quality changes). + */ + CTrackLogObserverAO* iTrackLogObserverAO; + + TPositionSatelliteInfo iFixQuality; + TBool iRecording; + TEventTypes iEventType; + TPckg iWrapQuality; + TPckg iWrapRec; + TPckg iWrapEventType; +}; + +/** + * Track log Observer interface class for receiving track-log events. + */ +class MTrackLogObserver +{ + +public: + /** + * Called to notify the observer that the + * Track-log recording has started. + * + * @param aError, KErrNone if successful, otherwise one of the other + * system-wide error codes. + * @return None. + */ + virtual void TrackLogStarted(TInt aError) = 0; + + /** + * Called to notify the observer that the + * Track-log recording was stopped. + * + * @param aError, KErrNone if successful, otherwise one of the other + * system-wide error codes. + * @return None. + */ + virtual void TrackLogStopped(TInt aError) = 0; + + /** + * Called to notify the observer that the + * GPS fix quality has changed. + * + * @param aFixQuality, GPS signal quality + * @param aTrackingActive, Is Tracking active + * @return None. + */ + virtual void GPSFixQualityChanged(TPositionSatelliteInfo& aFixQuality, TBool& aTrackingActive) = 0; + +private: +}; +#endif /*RTRACKLOG_H_*/ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/location_manager_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/location_manager_api.metaxml Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,14 @@ + + +location_manager_api +location manager api +c++ +locationmanager + + + + +no +no + + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/Bmarm/LocationManagerTestScripteru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/Bmarm/LocationManagerTestScripteru.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/Bwins/LocationManagerTestScripteru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/Bwins/LocationManagerTestScripteru.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/conf/LocationManagerTestScripter.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/conf/LocationManagerTestScripter.cfg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,272 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Location Manager API tests +# + +// --------------------------------------------------------------------------- +// Location Manager API test cases +// --------------------------------------------------------------------------- + +// These should be run in sequential mode if several cases are run at the same +// time! + +[StifSettings] +TestThreadStackSize= 32768 +TestThreadMinHeap= 4096 +TestThreadMaxHeap= 16777216 +[EndStifSettings] + +[Test] +title Location Manager Connect Disconnect +timeout 60000 +create LocationManagerTestScripter test +test Connect +test Close +delete test +[Endtest] + +[Test] +title Location Trail Connect Disconnect +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test TrailClose +delete test +[Endtest] + +[Test] +title Start-Stop Location Trail +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrailTests +test TrailClose +delete test +[Endtest] + +[Test] +title Get Location Trail State +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrail +test GetTrailState +test StopTrail +test TrailClose +delete test +[Endtest] + +[Test] +title Location Trail Notification Basic Test +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrail +test LocationTrailNotifyTest +test StopTrail +test TrailClose +delete test +[Endtest] + +[Test] +title Retrieve Location Basic Test +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrail +test RetrieveLocation +test StopTrail +test TrailClose +delete test +[Endtest] + +[Test] +title Current Location Basic Test +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrail +test CurrentLocation +test StopTrail +test TrailClose +delete test +[Endtest] + +[Test] +title Create Location Object Manipulator +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test TearDownOM +delete test +[Endtest] + +[Test] +title Create Location Object +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test TearDownOM +delete test +[Endtest] + +[Test] +title Location Snapshot +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test TearDownOM +delete test +[Endtest] + +[Test] +title Remove Location Object +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test TearDownOM +delete test +[Endtest] + +[Test] +title Copy By ID +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test CopyByID +test CloseOM +test CopyByIDDisco +test TearDownOM +delete test +[Endtest] + +[Test] +title Copy By URI +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test CopyByURI +test CloseOM +test CopyByURIDisco +test TearDownOM +delete test +[Endtest] + +[Test] +title Tracklog Connect Disconnect +timeout 60000 +create LocationManagerTestScripter test +test SetupTrackLog +test TearDownTrackLog +delete test +[Endtest] + +[Test] +title Start Stop Tracklog Recording +timeout 80000 +create LocationManagerTestScripter test +test SetupTrackLog +test AddObserver +request Recording +test StartTrackLog +wait Recording +test Recording +request StopRecording +test StopTrackLog +wait StopRecording +test NotRecording +test RemoveObserver +test TearDownTrackLog +delete test +[Endtest] + +[Test] +title Tracklog Observer test +timeout 60000 +create LocationManagerTestScripter test +test SetupTrackLog +test AddObserver +test AddObserver +test AddObserver +test RemoveObserver +test RemoveObserver +test TearDownTrackLog +delete test +[Endtest] + +[Test] +title Start Stop Tracklog Recording 2 +timeout 240000 +create LocationManagerTestScripter test +test SetupTrackLog +test AddObserver +request Recording +test StartTrackLog +wait Recording +test Recording +test GetFile +test GetStatus +request StopRecording +test StopTrackLog +wait StopRecording +test NotRecording +test DeleteFile +test GetStatus2 +test RemoveObserver +test TearDownTrackLog +delete test +[Endtest] + +[Test] +title Tracklog Crash Test +timeout 60000 +create LocationManagerTestScripter test +test SetupTrackLog +test AddObserver +request Recording +test StartTrackLog +wait Recording +test CrashLocationManager +test RemoveObserver +test TearDownTrackLog +delete test +create LocationManagerTestScripter test2 +test2 SetupTrackLog +test2 AddObserver +request Recording +test2 StartTrackLog +wait Recording +test2 StopTrackLog +test2 RemoveObserver +test2 TearDownTrackLog +delete test2 +[Endtest] + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/conf/LocationManagerTestScripter_reverse_geocode.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/conf/LocationManagerTestScripter_reverse_geocode.cfg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,345 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Location Manager API tests +# + +// --------------------------------------------------------------------------- +// Location Manager API test cases +// --------------------------------------------------------------------------- + +// These should be run in sequential mode if several cases are run at the same +// time! + +[StifSettings] +TestThreadStackSize= 32768 +TestThreadMinHeap= 4096 +TestThreadMaxHeap= 16777216 +[EndStifSettings] + +[Test] +title Location Manager Connect Disconnect +timeout 60000 +create LocationManagerTestScripter test +test Connect +test Close +delete test +[Endtest] + +[Test] +title Location Trail Connect Disconnect +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test TrailClose +delete test +[Endtest] + +[Test] +title Start-Stop Location Trail +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrailTests +test TrailClose +delete test +[Endtest] + +[Test] +title Get Location Trail State +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrail +test GetTrailState +test StopTrail +test TrailClose +delete test +[Endtest] + +[Test] +title Location Trail Notification Basic Test +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrail +test LocationTrailNotifyTest +test StopTrail +test TrailClose +delete test +[Endtest] + +[Test] +title Retrieve Location Basic Test +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrail +test RetrieveLocation +test StopTrail +test TrailClose +delete test +[Endtest] + +[Test] +title Current Location Basic Test +timeout 60000 +create LocationManagerTestScripter test +test TrailConnect +test StartTrail +test CurrentLocation +test StopTrail +test TrailClose +delete test +[Endtest] + +[Test] +title Create Location Object Manipulator +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test TearDownOM +delete test +[Endtest] + +[Test] +title Create Location Object +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test TearDownOM +delete test +[Endtest] + +[Test] +title Location Snapshot +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test TearDownOM +delete test +[Endtest] + +[Test] +title Remove Location Object +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test TearDownOM +delete test +[Endtest] + +[Test] +title Copy By ID +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test CopyByID +test CloseOM +test CopyByIDDisco +test TearDownOM +delete test +[Endtest] + +[Test] +title Copy By URI +timeout 60000 +create LocationManagerTestScripter test +request Session +test PrepareSession +wait Session +test SetupOM +test CopyByURI +test CloseOM +test CopyByURIDisco +test TearDownOM +delete test +[Endtest] + +[Test] +title Tracklog Connect Disconnect +timeout 60000 +create LocationManagerTestScripter test +test SetupTrackLog +test TearDownTrackLog +delete test +[Endtest] + +[Test] +title Start Stop Tracklog Recording +timeout 80000 +create LocationManagerTestScripter test +test SetupTrackLog +test AddObserver +request Recording +test StartTrackLog +wait Recording +test Recording +request StopRecording +test StopTrackLog +wait StopRecording +test NotRecording +test RemoveObserver +test TearDownTrackLog +delete test +[Endtest] + +[Test] +title Tracklog Observer test +timeout 60000 +create LocationManagerTestScripter test +test SetupTrackLog +test AddObserver +test AddObserver +test AddObserver +test RemoveObserver +test RemoveObserver +test TearDownTrackLog +delete test +[Endtest] + +[Test] +title Start Stop Tracklog Recording 2 +timeout 240000 +create LocationManagerTestScripter test +test SetupTrackLog +test AddObserver +request Recording +test StartTrackLog +wait Recording +test Recording +test GetFile +test GetStatus +request StopRecording +test StopTrackLog +wait StopRecording +test NotRecording +test DeleteFile +test GetStatus2 +test RemoveObserver +test TearDownTrackLog +delete test +[Endtest] + +[Test] +title Tracklog Crash Test +timeout 60000 +create LocationManagerTestScripter test +test SetupTrackLog +test AddObserver +request Recording +test StartTrackLog +wait Recording +test CrashLocationManager +test RemoveObserver +test TearDownTrackLog +delete test +create LocationManagerTestScripter test2 +test2 SetupTrackLog +test2 AddObserver +request Recording +test2 StartTrackLog +wait Recording +test2 StopTrackLog +test2 RemoveObserver +test2 TearDownTrackLog +delete test2 +[Endtest] + +[Test] +title StartGeoTagging Test +create LocationManagerTestScripter test +#test ConnectGeoTaggerL +test StartGeoTaggingL +test CloseGeoTaggerL +delete test +[Endtest] + + +[Test] +title TagComplete Status for GeoTagged Photos +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test TestGeoTagCompleteStatusL 0 +test CloseGeoTaggerL +delete test +[Endtest] + +[Test] +title TagPending Status for GeoTagged Photos +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test TestGeoTagPendingStatusL 0 +test CloseGeoTaggerL +delete test +[Endtest] + +[Test] +title TagGoingOn Status for GeoTagged Photos +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test TestGeoTagGoingOnStatusL 0 +test CloseGeoTaggerL +delete test +[Endtest] + + +[Test] +title TagComplete Status for NonGeoTagged Photos +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test TestGeoTagCompleteStatusL 1 +test CloseGeoTaggerL +delete test +[Endtest] + +[Test] +title TagPending Status for NonGeoTagged Photos +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test TestGeoTagPendingStatusL 1 +test CloseGeoTaggerL +delete test +[Endtest] + +[Test] +title TagGoingOn Status for NonGeoTagged Photos +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test TestGeoTagGoingOnStatusL 1 +test CloseGeoTaggerL +delete test +[Endtest] + +[Test] +title CancelGeoTagging +create LocationManagerTestScripter test +test ConnectGeoTaggerL +test CancelGeoTaggingL +test CloseGeoTaggerL +delete test +[Endtest] \ No newline at end of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/eabi/LocationManagerTestScripteru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/eabi/LocationManagerTestScripteru.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/group/LocationManagerTestScripter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/group/LocationManagerTestScripter.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + +#include +#include +#include "../../../../locationmanager/inc/locplatsupport.mmh" + +TARGET LocationManagerTestScripter.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + +DEFFILE LocationManagerTestScripter.def + +#ifdef _LOC_REVERSEGEOCODE +MACRO LOC_REVERSEGEOCODE +#endif + +SOURCEPATH ../src +SOURCE LocationManagerTestScripter.cpp +SOURCE LocationManagerTestScripterBlocks.cpp +SOURCE RTrackLogTest.cpp +SOURCE RLocationObjectManipulatorTest.cpp + +USERINCLUDE ../inc +USERINCLUDE ../../../../locationmanager/inc +USERINCLUDE ../../../../locationmanager/server/inc +USERINCLUDE ../../../../locationmanager/locationtrail/inc +USERINCLUDE ../../../../inc +USERINCLUDE ../../../../mds_plat/location_manager_api/inc +USERINCLUDE ../../../../metadataengine/server/inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY locationmanager.lib +LIBRARY mdeclient.lib +LIBRARY mdccommon.lib +LIBRARY etel3rdparty.lib +LIBRARY lbs.lib + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/group/LocationManagerTestScripter.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/group/LocationManagerTestScripter.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,33 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: Installation file for API test +; + +; Languages +&EN + +; Header +#{"LocationManagerTest"},(0x101FB3E3),1,0,0,TYPE=SA + +; Localised Vendor name +%{"Nokia"} + +; Unique Vendor name +:"Nokia" + +; Install files +"\epoc32\release\armv5\urel\LocationManagerTestScripter.dll" - "c:\sys\bin\LocationManagerTestScripter.dll" +"..\conf\LocationManagerTestScripter.cfg" - "c:\TestFramework\LocationManagerTestScripter.cfg" +"..\init\LocationManagerTestScripter.ini" - "c:\TestFramework\LocationManagerTestScripter.ini" + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,37 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + +#include "../../../../locationmanager/inc/locplatsupport.mmh" + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +LocationManagerTestScripter.mmp + +PRJ_TESTEXPORTS +#ifdef _LOC_REVERSEGEOCODE +../conf/LocationManagerTestScripter_reverse_geocode.cfg /epoc32/winscw/c/TestFramework/LocationManagerTestScripter.cfg +#else +../conf/LocationManagerTestScripter.cfg /epoc32/winscw/c/TestFramework/LocationManagerTestScripter.cfg +#endif + +../init/LocationManagerTestScripter.ini /epoc32/winscw/c/TestFramework/LocationManagerTestScripter.ini diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/inc/LocationManagerTestScripter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/inc/LocationManagerTestScripter.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,183 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#ifndef LOCATIONMANAGERTESTSCRIPTER_H +#define LOCATIONMANAGERTESTSCRIPTER_H + +// INCLUDES +#include +#include +#include +#include +#include +#include +#include "locationmanagerdefs.h" +#include "rlocationobjectmanipulator.h" +#include "mdccommon.h" +#include "mdesession.h" + +#ifdef LOC_REVERSEGEOCODE +#include "rlocationgeotagger.h" +#endif //LOC_REVERSEGEOCODE + +// CONSTANTS +// Logging path +_LIT( KLocationManagerTestScripterLogPath, "\\logs\\testframework\\LocationManagerTestScripter\\" ); +// Log file +_LIT( KLocationManagerTestScripterLogFile, "LocationManagerTestScripter.txt" ); +_LIT( KLocationManagerTestScripterLogFileWithTitle, "LocationManagerTestScripter_[%S].txt" ); + + +// FORWARD DECLARATIONS +class CMdEObject; +class CLocationManagerTestScripter; + + +// CLASS DECLARATION +NONSHARABLE_CLASS(CLocationManagerTestScripter) : public CScriptBase, + public MTrackLogObserver, + public MMdESessionObserver + { + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CLocationManagerTestScripter* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CLocationManagerTestScripter(); + + public: // Functions from base classes + + /** + * From CScriptBase Runs a script line. + * @since ?Series60_version + * @param aItem Script line containing method name and parameters + * @return Symbian OS error code + */ + virtual TInt RunMethodL( CStifItemParser& aItem ); + + public: // From MdESessionObserver + virtual void HandleSessionOpened(CMdESession& aSession, TInt aError); + virtual void HandleSessionError(CMdESession& aSession, TInt aError); + + virtual void GPSFixQualityChanged(TPositionSatelliteInfo& aFixQuality, + TBool& aTrackingActive ); + + private: + + /** + * C++ default constructor. + */ + CLocationManagerTestScripter( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + */ + void Delete(); + + CMdEObject* CreateMetadataObjectL(); + void TestLocationData( TLocationData& aLocationData ); + + TInt PrepareSessionL( CStifItemParser& aItem ); + TInt SetupOML( CStifItemParser& aItem ); + TInt LocationSnapshotL( CStifItemParser& aItem ); + TInt RemoveLocationObjectL( CStifItemParser& aItem ); + TInt TearDownOML( CStifItemParser& aItem ); + TInt CloseOML( CStifItemParser& aItem ); + virtual TInt RLocationObjectManipulatorTest_CopyByIDL( CStifItemParser& aItem ); + virtual TInt RLocationObjectManipulatorTest_CopyByURIL( CStifItemParser& aItem ); + TInt RLocationObjectManipulatorTest_CopyByURI_DisconnectedL( CStifItemParser& aItem ); + TInt RLocationObjectManipulatorTest_CopyByID_DisconnectedL( CStifItemParser& aItem ); + + virtual TInt ConnectL( CStifItemParser& aItem ); + virtual TInt CloseL( CStifItemParser& aItem ); + virtual TInt TrailConnectL( CStifItemParser& aItem ); + virtual TInt TrailCloseL( CStifItemParser& aItem ); + virtual TInt StartTrailL( CStifItemParser& aItem ); + virtual TInt StopTrailL( CStifItemParser& aItem ); + virtual TInt StartTrailTestsL( CStifItemParser& aItem ); + virtual TInt GetTrailStateL( CStifItemParser& aItem ); + virtual TInt LocationTrailNotifyTestL( CStifItemParser& aItem ); + virtual TInt RetrieveLocationL( CStifItemParser& aItem ); + virtual TInt CurrentLocationL( CStifItemParser& aItem ); + + TInt SetupTrackLogL( CStifItemParser& aItem ); + TInt TearDownTrackLog( CStifItemParser& aItem ); + TInt RTrackLogTest_AddObserverL( CStifItemParser& aItem ); + TInt RTrackLogTest_RemoveObserverL( CStifItemParser& aItem ); + virtual TInt RTrackLogTest_StartTrackLogL( CStifItemParser& aItem ); + virtual TInt RTrackLogTest_RecordingL( CStifItemParser& aItem ); + virtual TInt RTrackLogTest_StopTrackLogL( CStifItemParser& aItem ); + virtual TInt RTrackLogTest_NotRecordingL( CStifItemParser& aItem ); + TInt CrashLocationManagerL( CStifItemParser& aItem ); + TInt GetFileL( CStifItemParser& aItem ); + TInt DeleteFileL( CStifItemParser& aItem ); + TInt GetStatusL( CStifItemParser& aItem ); + TInt GetStatus2L( CStifItemParser& aItem ); + //ADD NEW METHOD DEC HERE + //[TestMethods] - Do not remove + +#ifdef LOC_REVERSEGEOCODE + TInt ConnectGeoTaggerL( CStifItemParser& /*aItem*/ ); + TInt CloseGeoTaggerL( CStifItemParser& /*aItem*/ ); + TInt StartGeoTaggingL( CStifItemParser& aItem ); + + TInt TestGeoTagCompleteStatusL( CStifItemParser& aItem ); + TInt TestGeoTagPendingStatusL( CStifItemParser& aItem ); + TInt TestGeoTagGoingOnStatusL( CStifItemParser& aItem ); + + TInt CancelGeoTaggingL( CStifItemParser& aItem ) ; +#endif //LOC_REVERSEGEOCODE + + public: // From MTrackLogObserver + void TrackLogStarted(TInt aError); + void TrackLogStopped(TInt aError); + + private: // Data + + RLocationManager iLocationManager; + RLocationTrail iLocationTrail; + + TBool iRunning; + RTrackLog iTrackLog; + RLocationObjectManipulator iOM; + + CMdEObject* iSourceObject; + CMdEObject* iTargetObject; + CMdESession* iMdeSession; + + CActiveSchedulerWait* iASW; + +#ifdef LOC_REVERSEGEOCODE + RLocationGeoTagger iLocationGeoTagger; + TBool iLocGeoTaggerConnected; +#endif //LOC_REVERSEGEOCODE + }; + +#endif // LOCATIONMANAGERTESTSCRIPTER_H + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/init/LocationManagerTestScripter.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/init/LocationManagerTestScripter.ini Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,81 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: +# + + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= LocationManagerTestScripterLog + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 600000 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testframework\LocationManagerTestScripter.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +HardwareBasePath= C:\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/src/LocationManagerTestScripter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/src/LocationManagerTestScripter.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,137 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// INCLUDE FILES +#include +#include "LocationManagerTestScripter.h" +#include + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::CLocationManagerTestScripter +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CLocationManagerTestScripter::CLocationManagerTestScripter( + CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CLocationManagerTestScripter::ConstructL() + { + +#ifdef LOC_REVERSEGEOCODE + iLocGeoTaggerConnected = EFalse; +#endif //LOC_REVERSEGEOCODE + + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KLocationManagerTestScripterLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KLocationManagerTestScripterLogFile); + } + + iLog = CStifLogger::NewL( KLocationManagerTestScripterLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CLocationManagerTestScripter* CLocationManagerTestScripter::NewL( + CTestModuleIf& aTestModuleIf ) + { + CLocationManagerTestScripter* self = new (ELeave) CLocationManagerTestScripter( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + + return self; + + } + +// Destructor +CLocationManagerTestScripter::~CLocationManagerTestScripter() + { + + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + + return ( CScriptBase* ) CLocationManagerTestScripter::NewL( aTestModuleIf ); + + } + + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/src/LocationManagerTestScripterBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/src/LocationManagerTestScripterBlocks.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,354 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include "LocationManagerTestScripter.h" + + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CLocationManagerTestScripter::Delete() + { + + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::RunMethodL( + CStifItemParser& aItem ) + { + + TestModuleIf().SetBehavior( CTestModuleIf::ETestLeaksRequests ); + + static TStifFunctionInfo const KFunctions[] = + { + // Copy this line for every implemented function. + // First string is the function name used in TestScripter script file. + // Second is the actual implementation member function. + ENTRY( "Connect", CLocationManagerTestScripter::ConnectL ), + ENTRY( "Close", CLocationManagerTestScripter::CloseL ), + ENTRY( "TrailConnect", CLocationManagerTestScripter::TrailConnectL ), + ENTRY( "TrailClose", CLocationManagerTestScripter::TrailCloseL ), + ENTRY( "StartTrail", CLocationManagerTestScripter::StartTrailL ), + ENTRY( "StopTrail", CLocationManagerTestScripter::StopTrailL ), + ENTRY( "StartTrailTests", CLocationManagerTestScripter::StartTrailTestsL ), + ENTRY( "GetTrailState", CLocationManagerTestScripter::GetTrailStateL ), + ENTRY( "LocationTrailNotifyTest", CLocationManagerTestScripter::LocationTrailNotifyTestL ), + ENTRY( "RetrieveLocation", CLocationManagerTestScripter::RetrieveLocationL ), + ENTRY( "CurrentLocation", CLocationManagerTestScripter::CurrentLocationL ), + + ENTRY( "PrepareSession", CLocationManagerTestScripter::PrepareSessionL ), + ENTRY( "SetupOM", CLocationManagerTestScripter::SetupOML ), + ENTRY( "LocationSnapshot", CLocationManagerTestScripter::LocationSnapshotL ), + ENTRY( "RemoveLocationObject", CLocationManagerTestScripter::RemoveLocationObjectL ), + ENTRY( "TearDownOM", CLocationManagerTestScripter::TearDownOML ), + ENTRY( "CloseOM", CLocationManagerTestScripter::CloseOML ), + ENTRY( "CopyByID", CLocationManagerTestScripter::RLocationObjectManipulatorTest_CopyByIDL ), + ENTRY( "CopyByURI", CLocationManagerTestScripter::RLocationObjectManipulatorTest_CopyByURIL ), + ENTRY( "CopyByIDDisco", CLocationManagerTestScripter::RLocationObjectManipulatorTest_CopyByID_DisconnectedL), + ENTRY( "CopyByURIDisco", CLocationManagerTestScripter::RLocationObjectManipulatorTest_CopyByURI_DisconnectedL), + + ENTRY( "SetupTrackLog", CLocationManagerTestScripter::SetupTrackLogL ), + ENTRY( "TearDownTrackLog", CLocationManagerTestScripter::TearDownTrackLog ), + ENTRY( "AddObserver", CLocationManagerTestScripter::RTrackLogTest_AddObserverL ), + ENTRY( "RemoveObserver", CLocationManagerTestScripter::RTrackLogTest_RemoveObserverL ), + ENTRY( "StartTrackLog", CLocationManagerTestScripter::RTrackLogTest_StartTrackLogL ), + ENTRY( "Recording", CLocationManagerTestScripter::RTrackLogTest_RecordingL ), + ENTRY( "StopTrackLog", CLocationManagerTestScripter::RTrackLogTest_StopTrackLogL ), + ENTRY( "NotRecording", CLocationManagerTestScripter::RTrackLogTest_NotRecordingL ), + ENTRY( "CrashLocationManager" , CLocationManagerTestScripter::CrashLocationManagerL ), + ENTRY( "GetFile" , CLocationManagerTestScripter::GetFileL ), + ENTRY( "DeleteFile" , CLocationManagerTestScripter::DeleteFileL ), + ENTRY( "GetStatus" , CLocationManagerTestScripter::GetStatusL ), + ENTRY( "GetStatus2" , CLocationManagerTestScripter::GetStatus2L ) + +#ifdef LOC_REVERSEGEOCODE + ,ENTRY( "ConnectGeoTaggerL", CLocationManagerTestScripter::ConnectGeoTaggerL ) + ,ENTRY( "CloseGeoTaggerL", CLocationManagerTestScripter::CloseGeoTaggerL ) + ,ENTRY( "StartGeoTaggingL", CLocationManagerTestScripter::StartGeoTaggingL ) + ,ENTRY( "TestGeoTagCompleteStatusL", CLocationManagerTestScripter::TestGeoTagCompleteStatusL ) + ,ENTRY( "TestGeoTagPendingStatusL", CLocationManagerTestScripter::TestGeoTagPendingStatusL ) + ,ENTRY( "TestGeoTagGoingOnStatusL", CLocationManagerTestScripter::TestGeoTagGoingOnStatusL ) + ,ENTRY( "CancelGeoTaggingL", CLocationManagerTestScripter::CancelGeoTaggingL ) +#endif //LOC_REVERSEGEOCODE + }; + + const TInt count = sizeof( KFunctions ) / + sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::Connect +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::ConnectL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "ConnectL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + User::LeaveIfError( iLocationManager.Connect() ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::Close +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::CloseL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "CloseL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iLocationManager.Close(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::Connect +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::TrailConnectL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "ConnectL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + User::LeaveIfError( iLocationTrail.Connect() ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::Close +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::TrailCloseL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "CloseL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iLocationTrail.Close(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::StartTrailL +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::StartTrailL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "StopTrailL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt error = iLocationTrail.StartLocationTrail( RLocationTrail::ECaptureAll ); + User::LeaveIfError( error ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::StopTrailL +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::StopTrailL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "StopTrailL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + User::LeaveIfError( iLocationTrail.StopLocationTrail() ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::StartTrailTestsL +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::StartTrailTestsL( CStifItemParser& /* aItem */ ) + { + _LIT( KMsg1, "StartTrailTestsL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt error( KErrNone ); + + error = iLocationTrail.StartLocationTrail( RLocationTrail::EOff ); + if( error != KErrArgument ) + { + User::LeaveIfError( error ); + } + RLocationTrail::TTrailCaptureSetting setting; + User::LeaveIfError( iLocationTrail.GetTrailCaptureSetting( setting ) ); + if( setting != RLocationTrail::EOff ) + { + return KErrUnknown; + } + + _LIT( KMsg2, "StartTrailTestsL, test 1 - Error code : %d" ); + TBuf <100> msg; + msg.Format( KMsg2, error ); + iLog->Log( msg ); + RDebug::Print( msg ); + + User::LeaveIfError( iLocationTrail.StopLocationTrail() ); + + error = iLocationTrail.StartLocationTrail( RLocationTrail::ECaptureNetworkInfo ); + User::LeaveIfError( error ); + User::LeaveIfError( iLocationTrail.GetTrailCaptureSetting( setting ) ); + if( setting != RLocationTrail::ECaptureNetworkInfo ) + { + return KErrUnknown; + } + + _LIT( KMsg3, "StartTrailTestsL, test 2 - Error code : %d" ); + msg.Format( KMsg3, error ); + iLog->Log( msg ); + RDebug::Print( msg ); + + User::LeaveIfError( iLocationTrail.StopLocationTrail() ); + + error = iLocationTrail.StartLocationTrail( RLocationTrail::ECaptureAll ); + User::LeaveIfError( error ); + User::LeaveIfError( iLocationTrail.GetTrailCaptureSetting( setting ) ); + if( setting != RLocationTrail::ECaptureAll ) + { + return KErrUnknown; + } + + _LIT( KMsg4, "StartTrailTestsL, test 2 - Error code : %d" ); + msg.Format( KMsg4, error ); + iLog->Log( msg ); + RDebug::Print( msg ); + + User::LeaveIfError( iLocationTrail.StopLocationTrail() ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::GetTrailStateL +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::GetTrailStateL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "GetTrailStateL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + RLocationTrail::TTrailState state; + iLocationTrail.GetLocationTrailState( state ); + if( state != RLocationTrail::ETrailStarting ) + { + return KErrUnknown; + } + + _LIT( KMsg, "GetTrailStateL - state : %d" ); + TBuf <100> msg; + msg.Format( KMsg, state ); + iLog->Log( msg ); + RDebug::Print( msg ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::LocationTrailNotifyTestL +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::LocationTrailNotifyTestL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "LocationTrailNotifyTestL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TRequestStatus status; + iLocationTrail.NotifyLocationTrailStateChange( status ); + iLocationTrail.CancelNotificationRequest(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::RetrieveLocationL +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::RetrieveLocationL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "RetrieveLocationL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TTime time; + time.UniversalTime(); + + TLocationData data; + RLocationTrail::TTrailState state; + + TInt error = iLocationTrail.RetrieveLocation( time, data, state ); + + _LIT( KMsg, "RetrieveLocationL - error : %d" ); + TBuf <100> msg; + msg.Format( KMsg, error ); + iLog->Log( msg ); + RDebug::Print( msg ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::CurrentLocationL +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::CurrentLocationL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "CurrentLocationL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TRequestStatus status; + TLocationData data; + iLocationTrail.CurrentLocation( status, data ); + iLocationTrail.CancelLocationRequest(); + + return KErrNone; + } + +// [End of File] - Do not remove diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/src/RLocationObjectManipulatorTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/src/RLocationObjectManipulatorTest.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,545 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#include "LocationManagerTestScripter.h" +#include "mdeobject.h" +#include "mdenamespacedef.h" +#include "mdeobjectdef.h" +#include "mdepropertydef.h" +#include "mdeconstants.h" +#include "locationdatatype.h" +#include "mdsutils.h" +#include +#include +#include +#include +#include + +using namespace MdeConstants; + +TInt CLocationManagerTestScripter::PrepareSessionL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "PrepareSessionL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + User::LeaveIfError( iOM.Connect() ); + iMdeSession = CMdESession::NewL( *this ); + + return KErrNone; + } + +TInt CLocationManagerTestScripter::SetupOML( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter SetupOM" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iSourceObject = CreateMetadataObjectL(); + TLocationData locationData; + TestLocationData( locationData ); + TInt error( KErrNone ); + error = iOM.CreateLocationObject( locationData, iSourceObject->Id() ); + if( error != KErrNone ) + { + return error; + } + iTargetObject = CreateMetadataObjectL(); + + _LIT( KMsg2, "Exit SetupOM" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +TInt CLocationManagerTestScripter::LocationSnapshotL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter LocationSnapshotL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iSourceObject = CreateMetadataObjectL(); + TInt error( KErrNone ); + error = iOM.LocationSnapshot( iSourceObject->Id() ); + + _LIT( KMsg2, "Exit LocationSnapshotL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return error; + } + +TInt CLocationManagerTestScripter::RemoveLocationObjectL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter RemoveLocationObjectL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt error( KErrNone ); + error = iOM.RemoveLocationObject( iSourceObject->Id() ); + + _LIT( KMsg2, "Exit RemoveLocationObjectL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return error; + } + +TInt CLocationManagerTestScripter::TearDownOML( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter TearDownOM" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iOM.Close(); + + if( iSourceObject && iMdeSession ) + { + TRAP_IGNORE( iMdeSession->RemoveObjectL( iSourceObject->Id() ) ); + } + delete iSourceObject; + iSourceObject = NULL; + if( iTargetObject && iMdeSession ) + { + TRAP_IGNORE( iMdeSession->RemoveObjectL( iTargetObject->Id() ) ); + } + delete iTargetObject; + iTargetObject = NULL; + delete iMdeSession; + iMdeSession = NULL; + + _LIT( KMsg2, "Exit TearDownOM" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +TInt CLocationManagerTestScripter::CloseOML( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "CloseOML" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iOM.Close(); + + return KErrNone; + } + +TInt CLocationManagerTestScripter::RLocationObjectManipulatorTest_CopyByIDL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter RLocationObjectManipulatorTest_CopyByIDL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TRequestStatus status = KRequestPending; + RArray items; + items.Append( iTargetObject->Id() ); + iOM.CopyLocationData( iSourceObject->Id(), items, status ); + User::WaitForRequest( status ); + TL( status.Int() == KErrNone ); + + status = KRequestPending; + iOM.CopyLocationData( TItemId(12345678), items, status ); + User::WaitForRequest( status ); + TL( status.Int() == KErrNotFound ); + + items.Reset(); + items.Append(TItemId(12345678)); + status = KRequestPending; + iOM.CopyLocationData( iSourceObject->Id(), items, status ); + User::WaitForRequest( status ); + TL( status.Int() == KErrNotFound ); + + status = KRequestPending; + iOM.CopyLocationData( TItemId(12345678), items, status ); + User::WaitForRequest( status ); + TL( status.Int() == KErrNotFound ); + + items.Close(); + + _LIT( KMsg2, "Exit RLocationObjectManipulatorTest_CopyByIDL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +TInt CLocationManagerTestScripter::RLocationObjectManipulatorTest_CopyByURIL( CStifItemParser& /*aItem*/ ) + { + _LIT(KURIThatDoesNotExist, "qwerty"); + + TRequestStatus status = KRequestPending; + RPointerArray items; + items.AppendL( &iTargetObject->Uri() ); + TBuf<256> source( iSourceObject->Uri() ); + iOM.CopyLocationData( source, items, status ); + User::WaitForRequest( status ); + TL( status.Int() == KErrNone ); + + source.Copy( KURIThatDoesNotExist ); + status = KRequestPending; + iOM.CopyLocationData( source, items, status ); + User::WaitForRequest( status ); + TL( status.Int() == KErrNotFound ); + + items.Reset(); + HBufC* nouri = source.AllocL(); + items.Append( nouri ); + source.Copy( iSourceObject->Uri() ); + status = KRequestPending; + iOM.CopyLocationData( source, items, status ); + User::WaitForRequest( status ); + TL( status.Int() == KErrNotFound ); + + status = KRequestPending; + source.Copy( KURIThatDoesNotExist ); + iOM.CopyLocationData( source, items, status ); + User::WaitForRequest( status ); + TL( status.Int() == KErrNotFound ); + + items.ResetAndDestroy(); + + return KErrNone; + } + +TInt CLocationManagerTestScripter::RLocationObjectManipulatorTest_CopyByID_DisconnectedL( + CStifItemParser& /*aItem*/ ) + { + TRequestStatus status = KRequestPending; + RArray items; + items.Append( 97976479 ); + iOM.CopyLocationData( iSourceObject->Id(), items, status ); + User::WaitForRequest( status ); + TL( status.Int() == KErrDisconnected ); + + return KErrNone; + } + +TInt CLocationManagerTestScripter::RLocationObjectManipulatorTest_CopyByURI_DisconnectedL( + CStifItemParser& /*aItem*/ ) + { + _LIT(KURIThatDoesNotExist, "notexistinganywhere"); + + TRequestStatus status = KRequestPending; + RPointerArray items; + items.AppendL( &KURIThatDoesNotExist ); + TBuf<256> source( iSourceObject->Uri() ); + iOM.CopyLocationData( source, items, status ); + User::WaitForRequest( status ); + TL( status.Int() == KErrDisconnected ); + + return KErrNone; + } + +CMdEObject* CLocationManagerTestScripter::CreateMetadataObjectL( ) + { + CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& objectDef = namespaceDef.GetObjectDefL( Image::KImageObject ); + CMdEObject *obj = iMdeSession->NewObjectLC( objectDef, Object::KAutomaticUri ); + + // required object properties + CMdEPropertyDef& creationDef = objectDef.GetPropertyDefL( Object::KCreationDateProperty ); + CMdEPropertyDef& modifiedDef = objectDef.GetPropertyDefL( Object::KLastModifiedDateProperty ); + CMdEPropertyDef& sizeDef = objectDef.GetPropertyDefL( Object::KSizeProperty ); + CMdEPropertyDef& itemTypeDef = objectDef.GetPropertyDefL( Object::KItemTypeProperty ); + + TTime timestamp( 0 ); + timestamp.UniversalTime(); + + // required object properties + obj->AddTimePropertyL( creationDef, timestamp ); + obj->AddTimePropertyL( modifiedDef, timestamp ); + obj->AddUint32PropertyL( sizeDef, 0 ); // always zero size for location objects + obj->AddTextPropertyL( itemTypeDef, Location::KLocationItemType ); + + iMdeSession->AddObjectL( *obj ); + CMdEObject* obj2 = iMdeSession->GetObjectL( obj->Id() ); + CleanupStack::Pop( obj ); + + return obj2; + } + +void CLocationManagerTestScripter::HandleSessionOpened(CMdESession& /*aSession*/, TInt aError) + { + _LIT( KMsg, "CallBck HandleSessionOpened - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print(msg); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +void CLocationManagerTestScripter::HandleSessionError(CMdESession& /*aSession*/, TInt aError) + { + _LIT( KMsg, "CallBck HandleSessionError - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print(msg); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Session") ); + TestModuleIf().Event( event ); + } + +void CLocationManagerTestScripter::TestLocationData( TLocationData& aLocationData ) + { + _LIT( temp, "XXX" ); + TBuf<3> countryTxt( temp ); + + TPosition testLocality; + testLocality.SetCoordinate( (TReal64)Math::Random()/KMaxTUint*180.0, (TReal64)Math::Random()/KMaxTUint*90.0, 10.0 ); + testLocality.SetAccuracy( 2.0, 2.0 ); + + CTelephony::TNetworkInfoV1 networkInfo; + networkInfo.iAccess = CTelephony::ENetworkAccessGsm; + networkInfo.iAreaKnown = ETrue; + networkInfo.iBandInfo = CTelephony::E800BandA; + networkInfo.iCellId = 1; + networkInfo.iLocationAreaCode = 1; + networkInfo.iMode = CTelephony::ENetworkModeGsm; + networkInfo.iStatus = CTelephony::ENetworkStatusCurrent; + networkInfo.iCountryCode = countryTxt; + networkInfo.iNetworkId = countryTxt; + + TCourse kurssi; + kurssi.SetCourse( 1.0 ); + kurssi.SetCourseAccuracy( 1.0 ); + kurssi.SetHeading( 10.0 ); + kurssi.SetSpeed( 10.0 ); + + aLocationData.iPosition = testLocality; + aLocationData.iCountry = countryTxt; + aLocationData.iNetworkInfo = networkInfo; + aLocationData.iSatellites = 4; + aLocationData.iCourse = kurssi; + aLocationData.iQuality = 1; + } + + +#ifdef LOC_REVERSEGEOCODE +TInt CLocationManagerTestScripter::ConnectGeoTaggerL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "ConnectGeoTaggerL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if(!iLocGeoTaggerConnected) + { + User::LeaveIfError( iLocationGeoTagger.Connect() ); + } + + iLocGeoTaggerConnected = ETrue; + return KErrNone; + } + +TInt CLocationManagerTestScripter::CloseGeoTaggerL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "CloseGeoTaggerL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iLocationGeoTagger.Close() ; + iLocGeoTaggerConnected = EFalse; + + return KErrNone; + } + + +TInt CLocationManagerTestScripter::StartGeoTaggingL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter StartGeoTagging" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + //rav + + if(!iLocGeoTaggerConnected) + { + User::LeaveIfError( iLocationGeoTagger.Connect() ); + } + + iLocGeoTaggerConnected = ETrue; + + + + TRequestStatus status(KRequestPending); + TConnectionOption conOption(ESilent); + iLocationGeoTagger.StartGeoTagging(status,conOption); + User::WaitForRequest( status ); + + _LIT( KMsg3, " status.Int() =%d" ); + iLog->Log( KMsg3,status.Int() ); + + TL( status.Int() == KErrNone ); + + + _LIT( KMsg2, "Exit StartGeoTagging" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::TestGeoTagCompleteStatusL +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::TestGeoTagCompleteStatusL( CStifItemParser& /*aItem*/) + { + _LIT( KMsg1, "TestGeoTagCompleteStatusL enter" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TRequestStatus status = KRequestPending; + TGeoTaggingSatus tagPendingFlag = EGeoTaggingPending; + iLocationGeoTagger.GeoTagStaus( status, tagPendingFlag ); + + User::WaitForRequest( status ); + + TL(status.Int() == KErrNone); + + TL(tagPendingFlag == EGeoTagCmpt); + + _LIT( KMsg2, "TestGeoTagCompleteStatusL exit" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::TestGeoTagPendingStatusL +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::TestGeoTagPendingStatusL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "TestGeoTagPendingStatusL enter" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt fntype; + aItem.GetNextInt(fntype); + + TRequestStatus status = KRequestPending; + TGeoTaggingSatus tagPendingFlag = EGeoTagCmpt; + iLocationGeoTagger.GeoTagStaus( status, tagPendingFlag ); + + User::WaitForRequest( status ); + + TL(status.Int() == KErrNone); + + if(fntype == 0 ) + { + //for geotagged photos the tag status will be pending + TL(tagPendingFlag == EGeoTaggingPending); + } + else + { + //for geotagged photos the tag status will be pending + TL(tagPendingFlag == EGeoTagCmpt); + } + + _LIT( KMsg2, "TestGeoTagPendingStatusL exit" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CLocationManagerTestScripter::TestGeoTagGoingOnStatusL +// ----------------------------------------------------------------------------- +// +TInt CLocationManagerTestScripter::TestGeoTagGoingOnStatusL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "TestGeoTagGoingOnStatusL enter" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt fntype; + aItem.GetNextInt(fntype); + + + TRequestStatus status = KRequestPending; + TGeoTaggingSatus tagPendingFlag = EGeoTagCmpt; + iLocationGeoTagger.GeoTagStaus( status, tagPendingFlag ); + + User::WaitForRequest( status ); + + TL(status.Int() == KErrNone); + + if(fntype == 0 ) + { + if(tagPendingFlag == EGeoTaggingPending) + { + TConnectionOption conOption(ESilent); + status = KRequestPending; + iLocationGeoTagger.StartGeoTagging(status,conOption); + iLocationGeoTagger.GeoTagStaus( status, tagPendingFlag ); + + TL(tagPendingFlag == EGeoTaggingGoingOn); + + User::WaitForRequest( status ); + + TL(status.Int() == KErrNone); + } + } + else + { + TL(tagPendingFlag == EGeoTagCmpt); + } + + _LIT( KMsg2, "TestGeoTagGoingOnStatusL exit" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + + +TInt CLocationManagerTestScripter::CancelGeoTaggingL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "Enter CancelGeoTaggingL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TRequestStatus status(KRequestPending); + TConnectionOption conOption(ESilent); + iLocationGeoTagger.StartGeoTagging(status,conOption); + iLocationGeoTagger.CancelGeoTaggingRequest(); + + User::WaitForRequest( status ); + + TL(status.Int() == KErrNone); + + + _LIT( KMsg2, "CancelGeoTaggingL exit" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + + } +#endif //LOC_REVERSEGEOCODE + + // End of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/location_manager_api/tsrc/src/RTrackLogTest.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/location_manager_api/tsrc/src/RTrackLogTest.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,253 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "LocationManagerTestScripter.h" +#include "mdsutils.h" +#include +#include +#include +#include +#include +#include + +TInt CLocationManagerTestScripter::SetupTrackLogL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "SetupTrackLog" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + User::LeaveIfError( iTrackLog.Connect() ); + + return KErrNone; + } + +TInt CLocationManagerTestScripter::TearDownTrackLog( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "TearDownTrackLog" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if ( iTrackLog.IsRecording() ) + { + iTrackLog.StopTrackLog(); + } + + iTrackLog.Close(); + + return KErrNone; + } + +TInt CLocationManagerTestScripter::RTrackLogTest_AddObserverL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "RTrackLogTest_AddObserver" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt error( KErrNone ); + error = iTrackLog.AddObserver( this ); + if( error != KErrNone && error != KErrAlreadyExists ) + { + return error; + } + + return KErrNone; + } + +TInt CLocationManagerTestScripter::RTrackLogTest_RemoveObserverL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "RTrackLogTest_RemoveObserver" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TInt error( KErrNone ); + error = iTrackLog.RemoveObserver( this ); + if( error != KErrNone && error != KErrNotFound ) + { + return error; + } + + return KErrNone; + } + +void CLocationManagerTestScripter::TrackLogStarted(TInt aError) + { + _LIT( KMsg, "CallBck HandleSessionOpened - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print(msg); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("Recording") ); + TestModuleIf().Event( event ); + } + +void CLocationManagerTestScripter::TrackLogStopped(TInt aError) + { + _LIT( KMsg, "CallBck HandleSessionOpened - Error code : %d" ); + TBuf <100> msg; + msg.Format(KMsg, aError); + iLog->Log( msg ); + RDebug::Print(msg); + + // session event + TEventIf event( TEventIf::ESetEvent, _L("StopRecording") ); + TestModuleIf().Event( event ); + } + +void CLocationManagerTestScripter::GPSFixQualityChanged(TPositionSatelliteInfo& /*aFixQuality*/, + TBool& /*aTrackingActive*/ ) + { + _LIT( KMsg1, "CallBck GPSFixQualityChanged" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + } + +TInt CLocationManagerTestScripter::RTrackLogTest_StartTrackLogL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "RTrackLogTest_StartTrackLogL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + User::LeaveIfError( iTrackLog.StartTrackLog() ); + + return KErrNone; + } + +TInt CLocationManagerTestScripter::RTrackLogTest_RecordingL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "RTrackLogTest_RecordingL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if ( !iTrackLog.IsRecording() ) + { + return KErrUnknown; + } + + return KErrNone; + } + +TInt CLocationManagerTestScripter::RTrackLogTest_StopTrackLogL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "RTrackLogTest_StopTrackLogL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + iTrackLog.StopTrackLog(); + + return KErrNone; + } + +TInt CLocationManagerTestScripter::RTrackLogTest_NotRecordingL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "RTrackLogTest_NotRecordingL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + if ( iTrackLog.IsRecording() ) + { + return KErrUnknown; + } + + return KErrNone; + } + +TInt CLocationManagerTestScripter::CrashLocationManagerL( CStifItemParser& /*aItem*/ ) + { + _LIT( name, "LocationManagerServ*" ); + TFindProcess findProcess( name ); + + RProcess locManProcess; + TFullName result; + findProcess.Next( result ); + User::LeaveIfError( locManProcess.Open( findProcess ) ); + locManProcess.Kill( KErrNone ); + locManProcess.Close(); + + return KErrNone; + } + +TInt CLocationManagerTestScripter::GetFileL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "GetFileL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TFileName name; + User::LeaveIfError( iTrackLog.TrackLogName( name ) ); + if( name.Length() <= 0 ) + { + return KErrNotFound; + } + + return KErrNone; + } + +TInt CLocationManagerTestScripter::DeleteFileL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "DeleteFileL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TFileName name; + TInt error( KErrNone ); + error = iTrackLog.TrackLogName( name ); + if( error != KErrNotFound ) + { + return KErrUnknown; + } + error = iTrackLog.DeleteTrackLog( name ); + if( error != KErrNone ) + { + return error; + } + + return KErrNone; + } + +TInt CLocationManagerTestScripter::GetStatusL( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "GetStatusL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TPositionSatelliteInfo info; + TBool recording; + User::LeaveIfError( iTrackLog.GetStatus( recording, info ) ); + + return KErrNone; + } + +TInt CLocationManagerTestScripter::GetStatus2L( CStifItemParser& /*aItem*/ ) + { + _LIT( KMsg1, "GetStatusL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TPositionSatelliteInfo info; + TBool recording; + User::LeaveIfError( iTrackLog.GetStatus( recording, info ) ); + if( recording ) + { + return KErrUnknown; + } + + return KErrNone; + } + +// End of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + + +#include + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS +../inc/mdccommon.h MW_LAYER_PLATFORM_EXPORT_PATH(mdccommon.h) +../inc/mdeerror.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeerror.h) +../inc/mdeinternalerror.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeinternalerror.h) +../inc/mdedatabuffer.h MW_LAYER_PLATFORM_EXPORT_PATH(mdedatabuffer.h) +../inc/mdequery.h MW_LAYER_PLATFORM_EXPORT_PATH(mdequery.h) +../inc/mdesession.h MW_LAYER_PLATFORM_EXPORT_PATH(mdesession.h) +../inc/mdeboolpropertycondition.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeboolpropertycondition.h) +../inc/mdecondition.h MW_LAYER_PLATFORM_EXPORT_PATH(mdecondition.h) +../inc/mdeconstants.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeconstants.h) +../inc/mdeevent.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeevent.h) +../inc/mdeeventcondition.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeeventcondition.h) +../inc/mdeeventdef.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeeventdef.h) +../inc/mdeeventquery.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeeventquery.h) +../inc/mdeinstanceitem.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeinstanceitem.h) +../inc/mdeitem.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeitem.h) +../inc/mdelogiccondition.h MW_LAYER_PLATFORM_EXPORT_PATH(mdelogiccondition.h) +../inc/mdenamespacedef.h MW_LAYER_PLATFORM_EXPORT_PATH(mdenamespacedef.h) +../inc/mdeobject.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeobject.h) +../inc/mdeobjectcondition.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeobjectcondition.h) +../inc/mdeobjectdef.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeobjectdef.h) +../inc/mdeobjectquery.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeobjectquery.h) +../inc/mdeorderrule.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeorderrule.h) +../inc/mdeproperty.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeproperty.h) +../inc/mdepropertycondition.h MW_LAYER_PLATFORM_EXPORT_PATH(mdepropertycondition.h) +../inc/mdepropertydef.h MW_LAYER_PLATFORM_EXPORT_PATH(mdepropertydef.h) +../inc/mderange.h MW_LAYER_PLATFORM_EXPORT_PATH(mderange.h) +../inc/mderange.inl MW_LAYER_PLATFORM_EXPORT_PATH(mderange.inl) +../inc/mderangepropertycondition.h MW_LAYER_PLATFORM_EXPORT_PATH(mderangepropertycondition.h) +../inc/mderelation.h MW_LAYER_PLATFORM_EXPORT_PATH(mderelation.h) +../inc/mderelationcondition.h MW_LAYER_PLATFORM_EXPORT_PATH(mderelationcondition.h) +../inc/mderelationdef.h MW_LAYER_PLATFORM_EXPORT_PATH(mderelationdef.h) +../inc/mderelationquery.h MW_LAYER_PLATFORM_EXPORT_PATH(mderelationquery.h) +../inc/mdetextpropertycondition.h MW_LAYER_PLATFORM_EXPORT_PATH(mdetextpropertycondition.h) +../inc/mdetextproperty.h MW_LAYER_PLATFORM_EXPORT_PATH(mdetextproperty.h) +../inc/mdetextproperty.inl MW_LAYER_PLATFORM_EXPORT_PATH(mdetextproperty.inl) +../inc/mdenumberproperty.h MW_LAYER_PLATFORM_EXPORT_PATH(mdenumberproperty.h) +../inc/mdenumberproperty.inl MW_LAYER_PLATFORM_EXPORT_PATH(mdenumberproperty.inl) +../inc/mdeversioncenrepkey.h MW_LAYER_PLATFORM_EXPORT_PATH(mdeversioncenrepkey.h) + +PRJ_MMPFILES + +PRJ_TESTMMPFILES + +PRJ_TESTEXPORTS diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdccommon.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdccommon.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,385 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Common message definitions and utilities +* +*/ + +#ifndef __MDCCOMMON_H__ +#define __MDCCOMMON_H__ + +// INCLUDE FILES +#include +#include + +// MDS version +#define MDS_VERSION_2_5 + +// Item id +typedef TUint32 TItemId; +typedef TUint32 TDefId; +typedef TUint32 TMdCOffset; + +const TItemId KNoId = 0; +const TItemId KSystemCapturedAlbumId = 2; +const TDefId KNoDefId = 0; + +// CONSTANTS +_LIT( KMdEDefaultNameSpace, "http://sw.nokia.com/MdE" ); + +// Type of property +enum TPropertyType + { + EPropertyBool = 0, + EPropertyInt8 = 1, + EPropertyUint8 = 2, + EPropertyInt16 = 3, + EPropertyUint16 = 4, + EPropertyInt32 = 5, + EPropertyUint32 = 6, + EPropertyInt64 = 7, + EPropertyReal32 = 8, + EPropertyReal64 = 9, + EPropertyTime = 10, + EPropertyText = 11, + }; + +/** + * Query types. + */ +enum TQueryType + { + EQueryTypeFirst = 0, // must always be the first one + + /** Query that returns CMdEObject items, IDs, count or distinct property values. */ + EQueryTypeObject, + + /** Query that returns CMdERelation items, IDs or count. */ + EQueryTypeRelation, + + /** Query that returns CMdEEvent items, IDs or count. */ + EQueryTypeEvent, + + EQueryTypeLast // must always be the last one + }; + +/** + * Query's result type. + */ +enum TQueryResultMode + { + EQueryResultModeFirst = 0, // must always be the first one + + /** Query returns whole items (objects are returned without freetexts). */ + EQueryResultModeItem, + + /** Query returns set of IDs. */ + EQueryResultModeId, + + /** Query returns count of items */ + EQueryResultModeCount, + + /** Query returns distinct values from specified property definition. + * Query's type must be EQueryTypeObject. */ + EQueryResultModeDistinctValues, + + /** Query returns whole items with freetexts. */ + EQueryResultModeObjectWithFreetexts, + + EQueryResultModeLast // must always be the last one + }; + +/** Types of sort order. */ +enum TMdESortOrder + { + ESortAscending = ETrue, + ESortDescending = EFalse + }; + +/** Types of result ordering rules. */ +enum TOrderRuleType + { + EOrderRuleTypeFirst = 0, + + /** Sort results with item ID. */ + EOrderRuleTypeItemID, + + /** Sort results by object URI. */ + EOrderRuleTypeObjectURI, + + /** Sort results by object definition. */ + EOrderRuleTypeObjectDef, + + /** Sort results by the value of a property. */ + EOrderRuleTypeProperty, + + /** Sort objects by usage count. */ + EOrderRuleTypeUsageCount, + + /** Sort events by creation time. */ + EOrderRuleTypeCreationTime, + + /** Sort events by source URI. */ + EOrderRuleTypeSourceURI, + + /** Sort events by participant URI. */ + EOrderRuleTypeParticipantURI, + + /** Sort events by target object's ID. */ + EOrderRuleTypeTargetObjectID, + + /** Sort events by event definition. */ + EOrderRuleTypeEventDef, + + /** Sort relations by last modified date. */ + EOrderRuleTypeLastModifiedDate, + + /** Sort relations by parameter. */ + EOrderRuleTypeParameterValue, + + /** Sort relations by left object's ID. */ + EOrderRuleTypeLeftObjectID, + + /** Sort relations by right object's ID. */ + EOrderRuleTypeRightObjectID, + + /** Sort relations by relation definition. */ + EOrderRuleTypeRelationDef, + + EOrderRuleTypeLast + }; + + +/** + * Condition types. + */ +enum TConditionType + { + EConditionTypeFirst = 0x0000, // must always be the first one + + /** logic conditions combine other conditions with logic operators */ + EConditionTypeLogic, + + /** conditions for object ID, URI, definition */ + EConditionTypeObject, + + /** conditions for the property definition */ + EConditionTypeProperty, + + /** condition for the value of a int property */ + EConditionTypePropertyIntRange, + + /** condition for the value of a int64 property */ + EConditionTypePropertyInt64Range, + + /** condition for the value of a uint property */ + EConditionTypePropertyUintRange, + + /** condition for the value of a real property */ + EConditionTypePropertyRealRange, + + /** condition for the value of a time property */ + EConditionTypePropertyTimeRange, + + /** condition for the value of a string property */ + EConditionTypePropertyText, + + /** condition for the value of a boolean property */ + EConditionTypePropertyBool, + + /** conditions for relation items */ + EConditionTypeRelation, + + /** conditions for an event */ + EConditionTypeEvent, + + EConditionTypeLast // must always be the last one + }; + +/** + * Observer notification types + */ +enum TObserverNotificationType + { + ENotifyAdd = 0x0001, + ENotifyModify = 0x0002, + ENotifyRemove = 0x0004, + }; + +/** Logic condition operators. */ +enum TLogicConditionOperator + { + ELogicConditionOperatorFirst = 0x0000, + + /** Boolean AND operator. */ + ELogicConditionOperatorAnd, + + /** Boolean OR operator. */ + ELogicConditionOperatorOr, + + ELogicConditionOperatorLast + }; + +/** Methods of comparing object data. */ +enum TObjectConditionCompareMethod + { + EObjectConditionCompareFirst = 0, + + /** NONE. Just for sending condition flags */ + EObjectConditionCompareNone, + + /** Object ID. */ + EObjectConditionCompareId, + + /** Object IDs. */ + EObjectConditionCompareIds, + + /** Object GUID. */ + EObjectConditionCompareGuid, + + /** Object definition. */ + EObjectConditionCompareObjectDef, + + /** Object URI. */ + EObjectConditionCompareUri, + + /** Object URI begins with specified string. */ + EObjectConditionCompareUriBeginsWith, + + /** Free text keyword associated with the object must be an + exact match. */ + EObjectConditionCompareFreeText, + + /** Free text keyword associated with the object contains + specified string. */ + EObjectConditionCompareFreeTextContains, + + /** Free text keyword associated with the object begins with + specified string. */ + EObjectConditionCompareFreeTextBeginsWith, + + /** Free text keyword associated with the object ends with + specified string. */ + EObjectConditionCompareFreeTextEndsWith, + + /** Usage count */ + EObjectConditionCompareUsageCount, + + /** Object URIcontains specified string. */ + EObjectConditionCompareUriContains, + + EObjectConditionCompareLast + }; + +/** Methods of filtering confidential and non-confidential objects. */ +enum TObjectConditionConfidentialityLevel + { + EObjectConditionLevelFirst = 0, + + /** Both confidential and non-confidential objects */ + EObjectConditionLevelIgnoreConfidentiality, + + /** Selects ONLY non-confidential objects */ + EObjectConditionLevelNormal, + + /** Selects ONLY confidential objects. */ + EObjectConditionLevelConfidential, + + EObjectConditionLevelLast + }; + +/** Methods of comparing event data. */ +enum TEventConditionCompareMethod + { + EEventConditionCompareFirst = 0x0000, + + /** No comparison specified. */ + EEventConditionCompareNone, + + /** Specified string must match the source URI. */ + EEventConditionCompareSourceURI, + + /** Specified string must match the participant URI. */ + EEventConditionCompareParticipantURI, + + /**Specified id must match events id*/ + EEventConditionCompareId, + + //ECompareSourceURIBeginsWith, + //ECompareParticipantRIBeginsWith, + + EEventConditionCompareLast + }; + +/** Side on which the relation must be in relation to a matched object. */ +enum TRelationConditionSide + { + /** Object must be on either the left or the right side of + the relation. */ + ERelationConditionSideEither, + + /** Object must be on the left side of the relation. */ + ERelationConditionSideLeft, + + /** Object must be on the right side of the relation. */ + ERelationConditionSideRight + }; + +/** Text value comparison methods. */ +enum TTextPropertyConditionCompareMethod + { + ETextPropertyConditionCompareFirst = 0x0000, + ETextPropertyConditionCompareEquals, // LIKE "str" + ETextPropertyConditionCompareContains, // LIKE "%str%" + ETextPropertyConditionCompareBeginsWith, // LIKE "str%" + ETextPropertyConditionCompareEndsWith, // LIKE "%str" + ETextPropertyConditionCompareLast + }; + + +/** + * Min and max value + * There are used like: + * for Real types: iMinValue.iReal, iMaxValue.iReal + * for Int64 types: iMinValue.iInt64, iMaxValue.iInt64 + * for Uint32 types: iMinValue.iUint32, iMaxValue.iUint32 + * (!!) others: iMinValue.iInt32, iMaxValue.iInt32 + */ +union TMdCValueUnion + { + TInt32 iInt32; + TUint32 iUint32; + TInt64 iInt64; + TReal64 iReal; + HBufC16* iText; + + struct + { + TUint32 iCount; + TMdCOffset iOffset; + } iPtr; + }; + +/** +* Common utilities. +* Used as a static function library - +* This class is not to be instantiated. +*/ +class MMdCCommon + { + public: // public definitions + /** Creates a panic */ + IMPORT_C static void Panic( TInt aPanicCode ); + }; + +#endif // __MDCCOMMON_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeboolpropertycondition.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeboolpropertycondition.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,106 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Property conditions for boolean property values +* +*/ + + +#ifndef __MDEBOOLPROPERTYCONDITION_H__ +#define __MDEBOOLPROPERTYCONDITION_H__ + + +#include + +/* Forward declarations. */ +class CMdEPropertyDef; +class CMdCSerializationBuffer; + +/** + * Property conditions for boolean property values. The condition is true + * when the property's value matches the condition's boolean value. + */ +NONSHARABLE_CLASS(CMdEBoolPropertyCondition) : public CMdEPropertyCondition + { + public: + + /** + * First-phase constructor + */ + static CMdEBoolPropertyCondition* NewL( const CMdEPropertyDef& aPropertyDef, + TBool aValue ); + + /** + * First-phase constructor + */ + static CMdEBoolPropertyCondition* NewLC( const CMdEPropertyDef& aPropertyDef, + TBool aValue ); + + /** + * Destructor. + */ + virtual ~CMdEBoolPropertyCondition(); + + + /* Methods. */ + + /** + * Returns the boolean condition value. + */ + IMPORT_C TBool Value() const; + + /** + * Get possible query's internal optimization flags from condition. + * + * @param aFlaga query's internal optimization flags + * @return last level internal optimization flags + */ + TUint32 InternalQueryOptimizationFlags(TUint32& aFlags); + + /** + * Get required size of serialized buffer when this is serialized. + * + * @return required size of serialized buffer + */ + TUint32 RequiredBufferSize() const; + + /** + * Serialize own data to serialized buffer (correct position must be set + * before calling) and return new position of serialized buffer. + * + * @param aBuffer serialized buffer. + */ + void SerializeL(CMdCSerializationBuffer& aBuffer, + TMdCOffset& aFreespaceOffset) const; + +private: + /** + * Constructor. + * + * @param aValue boolean value + */ + CMdEBoolPropertyCondition(const CMdEPropertyDef& aPropertyDef, + TBool aValue); + + /** + * Second-phase constructor. + */ + void ConstructL(); + +private: + + /** The boolean value to compare against. */ + TBool iValue; + }; + +#endif // __MDEBOOLPROPERTYCONDITION_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdecondition.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdecondition.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,151 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Base class for all search condition tree nodes. +* +*/ + + +#ifndef __MDECONDITION_H__ +#define __MDECONDITION_H__ + + +#include + +#include + +// Forward declaration +class CMdCSerializationBuffer; + +/** + * Base class for all search condition tree nodes. + */ +NONSHARABLE_CLASS(CMdECondition) : public CBase + { +public: + + /* Destructor. */ + + /** + * Destructor. + */ + virtual ~CMdECondition(); + + + /* Methods. */ + + /** + * Returns the type of the condition. + * + * @return Condition type. + */ + IMPORT_C TConditionType Type() const; + + /** + * Determines whether the condition is negated. + * + * @return ETrue, if the condition is negated. + * Otherwise EFalse. + */ + IMPORT_C TBool Negate() const; + + /** + * Sets the negate flag. The negate flag negates the meaning of the + * condition like a boolean NOT operator. + * + * @param aNegate ETrue to negate. + */ + IMPORT_C void SetNegate(TBool aNegate); + + /** + * Determines whether the condition node has been locked. Attempting to + * modify locked conditions causes a panic. + * + * @return ETrue, if the condition is locked. Otherwise + * EFalse. + */ + IMPORT_C TBool Locked() const; + + /** + * Locks the condition to prevent changes. Attempting to change a locked + * condition causes a panic. + * + * @param aLocked ETrue to lock; EFalse to + * unlock. + */ + IMPORT_C virtual void SetLocked(TBool aLocked = ETrue); + + /** + * Get possible query's internal optimization flags from condition. + * + * @param aFlaga query's internal optimization flags + * @return last level internal optimization flags + */ + virtual TUint32 InternalQueryOptimizationFlags(TUint32& aFlags) = 0; + + /** + * Get required size of serialized buffer when this is serialized. + * + * @return required size of serialized buffer + */ + virtual TUint32 RequiredBufferSize() const = 0; + + /** + * Serialize own data to serialized buffer (correct position must be set + * before calling). + * + * @param aBuffer serialized buffer. + */ + virtual void SerializeL(CMdCSerializationBuffer& aBuffer, + TMdCOffset& aFreespaceOffset) const = 0; + + /* Constructors. */ + + /** + * Constructor. + * + * @param aType Type of the condition node. + */ + CMdECondition(TConditionType aType); + +protected: + /** + * Second-phase constructor. + */ + void ConditionConstruct(); + + + /* Utility methods. */ + + /** + * Panics if the condition is not locked. + * + * @panic TMdEPanic::EConditionLocked Condition is locked against + * changes. + */ + void AssertNotLocked() const; + +protected: + + /** Type of the condition. */ + TConditionType iType; + + /** The negate flag negates the result of the condition: if the + condition evaluates to True, the result will really be False. */ + TBool iNegated; + + /** Locked conditions can't be modified. */ + TBool iLocked; + }; + +#endif // __MDECONDITION_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeconstants.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeconstants.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,290 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Metadata Engine's literals. +* +*/ + +// conforms to Metadata schema version 1.6 + +#ifndef MDECONSTANTS_H +#define MDECONSTANTS_H + +namespace MdeConstants + { + namespace Object + { + _LIT( KBaseObject, "Object" ); + _LIT( KAutomaticUri, "" ); + + _LIT( KSizeProperty, "Size" ); + _LIT( KOriginProperty, "Origin" ); + _LIT( KUsageCountProperty, "UsageCount" ); + _LIT( KCreationDateProperty, "CreationDate" ); + _LIT( KLastModifiedDateProperty, "LastModifiedDate" ); + _LIT( KItemTypeProperty, "ItemType" ); + _LIT( KTitleProperty, "Title" ); + _LIT( KTimeOffsetProperty, "TimeOffset" ); + _LIT( KInDefaultFolder, "InDefaultFolder" ); + + enum TOrigin + { + EOther = 0, + ECamera = 1, + EDownloaded = 2, + ESideLoaded = 3, + ERecorded = 4 + }; + } + typedef MdeConstants::Object::TOrigin Origin; // deprecated + + namespace Location + { + _LIT( KLocationObject, "Location" ); + _LIT( KLocationItemType, "application/vnd.nokia.mde.locationcontext" ); + + _LIT( KCellIdProperty, "CellID" ); + _LIT( KCountryCodeProperty, "CountryCodeStr" ); + _LIT( KNetworkCodeProperty, "NetworkCodeStr" ); + _LIT( KLocationAreaCodeProperty, "LocationAreaCode" ); + _LIT( KSpeedProperty, "Speed" ); + _LIT( KDirectionProperty, "Direction" ); + _LIT( KQualityProperty, "Quality" ); + _LIT( KLatitudeProperty, "Latitude" ); + _LIT( KLongitudeProperty, "Longitude" ); + _LIT( KAltitudeProperty, "Altitude" ); + _LIT( KSatellitesProperty, "Satellites" ); + _LIT( KCountryProperty, "Country" ); + _LIT( KCellNameProperty, "CellName" ); + } + + namespace Calendar + { + _LIT( KCalendarObject, "Calendar" ); + _LIT( KCalendarItemType, "application/vnd.nokia.mde.calendarcontext" ); + + _LIT( KCalendarTypeProperty, "CalendarType" ); + _LIT( KStartTimeProperty, "StartTime" ); + _LIT( KEndTimeProperty, "EndTime" ); + _LIT( KLocationProperty, "Location" ); + _LIT( KvCalendarProperty, "vCalendar" ); + _LIT( KLocalUidProperty, "LocalUid" ); + } + + namespace Contact + { + _LIT( KContactObject, "Contact" ); + _LIT( KContactItemType, "application/vnd.nokia.mde.contactcontext" ); + + _LIT( KNumberProperty, "Number" ); + _LIT( KEmailAddressProperty, "EmailAddress" ); + _LIT( KCompanyProperty, "Company" ); + _LIT( KJobTitleProperty, "JobTitle" ); + _LIT( KAddressProperty, "Address" ); + _LIT( KURLProperty, "ContactURL" ); + _LIT( KvCardProperty, "vCard" ); + } + + namespace Message + { + _LIT( KMessageObject, "Message" ); + _LIT( KSMSItemType, "application/vnd.nokia.mde.sms" ); + _LIT( KMMSItemType, "application/vnd.nokia.mde.mms" ); + + _LIT( KReceivedProperty, "Received" ); + _LIT( KSenderProperty, "Sender" ); + _LIT( KToWhomProperty, "ToWhom" ); + } + + namespace Album + { + _LIT( KAlbumObject, "Album" ); + _LIT( KAlbumItemType, "application/vnd.nokia.mde.album" ); + + _LIT( KOrderedProperty, "Ordered" ); + _LIT( KTypeProperty, "Type" ); + + // Depricated + _LIT( KPropertiesProperty, "Properties" ); + _LIT( KSlideshowWallpaperProperty, "SlideshowWallpaper" ); + + enum TAlbumType + { + EAlbumUser = 0, + EAlbumUserPredefined = 1, + EAlbumSystemFavourite = 2, + EAlbumSystemCamera = 3, + }; + typedef MdeConstants::Album::TAlbumType AlbumType; // deprecated + } + + namespace Tag + { + _LIT( KTagObject, "Tag" ); + _LIT( KTagItemType, "application/vnd.nokia.mde.tag" ); + enum TTagType + { + EUserDefineTags = 0, + ESystemDefineCityTags = 1, + ESystemDefineCountryTags = 2, + EUnMappedLocationTags = 3 + }; + } + + namespace MediaObject + { + _LIT( KMediaObject, "MediaObject" ); + + _LIT( KProtectedProperty, "Protected" ); + _LIT( KDRMProperty, "DRM" ); + _LIT( KThumbnailPresentProperty, "ThumbnailPresent" ); + _LIT( KResizedProperty, "Resized" ); + _LIT( KSampleProperty, "Sample" ); + _LIT( KRatingProperty, "Rating" ); + _LIT( KPrivacyProperty, "Privacy" ); + _LIT( KResolutionUnitProperty, "ResolutionUnit" ); + _LIT( KBitrateProperty, "Bitrate" ); + _LIT( KWidthProperty, "Width" ); + _LIT( KHeightProperty, "Height" ); + _LIT( KPreinstalledProperty, "Preinstalled" ); + _LIT( KAccessCountProperty, "AccessCount" ); + _LIT( KDownloadIdProperty, "DownloadID" ); + _LIT( KDurationProperty, "Duration" ); + _LIT( KReleaseDateProperty, "ReleaseDate" ); + _LIT( KCaptureDateProperty, "CaptureDate" ); + _LIT( KArtistProperty, "Artist" ); + _LIT( KAuthorProperty, "Author" ); + _LIT( KCopyrightProperty, "Copyright" ); + _LIT( KLegalProperty, "Legal" ); + _LIT( KDescriptionProperty, "Description" ); + _LIT( KCommentProperty, "Comment" ); + _LIT( KGenreProperty, "Genre" ); + _LIT( KTrackProperty, "Track" ); + _LIT( KAudioFourCCProperty, "AudioFourCC" ); + + enum TPreinstalledFlag + { + ENotPreinstalled = 0, + EPreinstalled = 1 + }; + } + + namespace Video // derived from MediaObject + { + _LIT( KVideoObject, "Video" ); + + _LIT( KAgeProfileProperty, "AgeProfile" ); + _LIT( KRecordingFlagsProperty, "RecordingFlags" ); + _LIT( KLastPlayPositionProperty, "LastPlayPosition" ); + _LIT( KFramerateProperty, "Framerate" ); + _LIT( KAudioLanguageProperty, "AudioLanguage" ); + } + + namespace Image // derived from MediaObject + { + _LIT( KImageObject, "Image" ); + + _LIT( KDraftProperty, "Draft" ); + _LIT( KFocalPlaneResolutionUnitProperty, "FocalPlaneResolutionUnit" ); + _LIT( KExposureProgramProperty, "ExposureProgram" ); + _LIT( KFocalLengthIn35mmFilmProperty, "FocalLengthIn35mmFilm" ); + _LIT( KISOSpeedRatingsProperty, "ISOSpeedRatings" ); + _LIT( KMeteringModeProperty, "MeteringMode" ); + _LIT( KWhiteBalanceProperty, "WhiteBalance" ); + _LIT( KFlashProperty, "Flash" ); + _LIT( KColourSpaceProperty, "ColourSpace" ); + _LIT( KOrientationProperty, "Orientation" ); + _LIT( KSamplesPerPixelProperty, "SamplesPerPixel" ); + _LIT( KBitsPerSampleProperty, "BitsPerSample" ); + _LIT( KYCbCrPositioningProperty, "YCbCrPositioning" ); + _LIT( KThumbCompressionProperty, "ThumbCompression" ); + _LIT( KThumbResolutionUnitProperty, "ThumbResolutionUnit" ); + _LIT( KThumbOrientationProperty, "ThumbOrientation" ); + _LIT( KFrameCountProperty, "FrameCount" ); + _LIT( KPixelXDimensionProperty, "PixelXDimension" ); + _LIT( KPixelYDimensionProperty, "PixelYDimension" ); + _LIT( KExifVersionProperty, "ExifVersion" ); + _LIT( KComponentsConfigurationProperty, "ComponentsConfiguration" ); + _LIT( KFlashPixVersionProperty, "FlashPixVersion" ); + _LIT( KThumbXResolutionProperty, "ThumbXResolution" ); + _LIT( KThumbYResolutionProperty, "ThumbYResolution" ); + _LIT( KFocalPlaneXResolutionProperty, "FocalPlaneXResolution" ); + _LIT( KFocalPlaneYResolutionProperty, "FocalPlaneYResolution" ); + _LIT( KExposureTimeProperty, "ExposureTime" ); + _LIT( KExposureBiasValueProperty, "ExposureBiasValue" ); + _LIT( KFNumberProperty, "FNumber" ); + _LIT( KFocalLengthProperty, "FocalLength" ); + _LIT( KApertureValueProperty, "ApertureValue" ); + _LIT( KMaxApertureProperty, "MaxAperture" ); + _LIT( KShutterSpeedValueProperty, "ShutterSpeedValue" ); + _LIT( KXResolutionProperty, "XResolution" ); + _LIT( KYResolutionProperty, "YResolution" ); + _LIT( KDateTimeProperty, "DateTime" ); + _LIT( KDateTimeDigitizedProperty, "DateTimeDigitized" ); + _LIT( KDateTimeOriginalProperty, "DateTimeOriginal" ); + _LIT( KPixelFormatProperty, "PixelFormat" ); + _LIT( KModelProperty, "Model" ); + _LIT( KMakeProperty, "Make" ); + _LIT( KRelatedSoundFileProperty, "RelatedSoundFile" ); + } + + namespace Audio // derived from MediaObject + { + _LIT( KAudioObject, "Audio" ); + + _LIT( KSamplingFrequencyProperty, "SamplingFrequency" ); + _LIT( KAlbumProperty, "Album" ); + _LIT( KComposerProperty, "Composer" ); + _LIT( KOriginalArtistProperty, "OriginalArtist" ); + _LIT( KAlbumArtistProperty, "AlbumArtist" ); + } + + namespace Events + { + _LIT( KCreated, "Created" ); + _LIT( KDeleted, "Deleted" ); + _LIT( KOpened, "Opened" ); + _LIT( KPlayed, "Played" ); + _LIT( KEdited, "Edited" ); + _LIT( KSent, "Sent" ); + _LIT( KReceived, "Received" ); + } + + namespace Relations + { + _LIT( KContains, "Contains" ); + _LIT( KReplaces, "Replaces" ); + _LIT( KIsVersionOf, "IsVersionOf" ); + _LIT( KRequires, "Requires" ); + _LIT( KUses, "Uses" ); + _LIT( KReferences, "References" ); + _LIT( KSummarises, "Summarises" ); + _LIT( KContainsLocation, "ContainsLocation" ); + } + + namespace TrackLog + { + _LIT( KTrackLogObject, "TrackLog" ); + _LIT( KTrackLogItemType, "application/vnd.nokia.mde.tracklog" ); + _LIT( KLengthProperty, "Length" ); + _LIT( KStartTimeProperty, "StartTime" ); + _LIT( KStopTimeProperty, "StopTime" ); + } + } + +// type definitions + +typedef MdeConstants::Object::TOrigin TOrigin; + + +#endif // MDECONSTANTS_H diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdedatabuffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdedatabuffer.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Serializard data buffer container +* +*/ + +#ifndef _MDEDATABUFFER_H_ +#define _MDEDATABUFFER_H_ + +#include + +// forward declaration +class CMdCSerializationBuffer; + +class RMdEDataBuffer +{ +public: + IMPORT_C RMdEDataBuffer(); + + IMPORT_C void Close(); + + /** + * Set buffer to data buffer. Data buffer takes the ownership of the + * buffer. + * + * @param aBuffer serialization buffer + */ + void SetBufferL(CMdCSerializationBuffer* aBuffer); + + CMdCSerializationBuffer* GetBufferLC(); + +private: + RMdEDataBuffer(const RMdEDataBuffer&); + +private: + CMdCSerializationBuffer* iBuffer; +}; + +#endif /*_MDEDATABUFFER_H_*/ + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeerror.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeerror.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,60 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Common error code definitions +* +*/ + + +#ifndef MDEERROR_H +#define MDEERROR_H + +#include + +/** + * Canceled or commited object is not locked. + */ +const TInt KErrMdENotLocked = -36200; + +/** + * Property's type is different than expected. + */ +const TInt KErrMdEIncorrectType = -36201; + +/** + * Mandatory property is missing from object. + */ +const TInt KErrMdEMandatoryPropertyMissing = -36202; + +/** + * Property's value is not between allowed minimum and maximum value. + */ +const TInt KErrMdEPropertyValueNotBetweenAllowedMinMax = -36203; + +/** + * First MdE's internal error code. + * + * All MdE's internal error codes (defined in mdeinternalerror.h) are be + * between KErrMdEFirstInternalError and KErrMdELastInternalError. + */ +const TInt KErrMdEFirstInternalError = -36240; + +/** + * Last MdE's internal error code. + * + * All MdE's internal error codes (defined in mdeinternalerror.h) are be + * between KErrMdEFirstInternalError and KErrMdELastInternalError. + */ +const TInt KErrMdELastInternalError = -36299; + +#endif /*MDEERROR_H_*/ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeevent.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeevent.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,174 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Representation of single event +* +*/ + + +#ifndef __MDEEVENT_H__ +#define __MDEEVENT_H__ + + +#include + +class CMdEEventDef; +class CMdCSerializationBuffer; +class CMdENamespaceDef; + +/** + * Event. + */ +NONSHARABLE_CLASS(CMdEEvent) : public CMdEInstanceItem + { +public: + + /** + * Create new event from serialized buffer + * + * @param aBuffer serialized relation + * @return new event + */ + static CMdEEvent* NewL(CMdESession* aSession, CMdCSerializationBuffer& aBuffer, CMdENamespaceDef& aNamespaceDef ); + + /** + * Create new event from serialized buffer and leaves it on stack + * + * @param aBuffer serialized relation + * @return new event + */ + static CMdEEvent* NewLC(CMdESession* aSession, CMdCSerializationBuffer& aBuffer, CMdENamespaceDef& aNamespaceDef ); + + /** + * Create new event from serialized buffer + * + * @param aDef Definition of the new event. + * @param aObjectId Identifier of the object that the new event is related to. + * @param aTime Time when the new event occurred. + * @param aSource Source of the new event. Ownership of the pointed object remains on caller. + * @param aParticipant Participant of the new event. Ownership of the pointed object remains on caller. + * @return new event + */ + static CMdEEvent* NewL(CMdEEventDef& aDef, TItemId aObjectId, TTime aTime, + const TDesC* aSource, const TDesC* aParticipant); + + /** + * Create new event from serialized buffer and leaves it on stack + * + * @param aDef Definition of the new event. + * @param aObjectId Identifier of the object that the new event is related to. + * @param aTime Time when the new event occurred. + * @param aSource Source of the new event. Ownership of the pointed object remains on caller. + * @param aParticipant Participant of the new event. Ownership of the pointed object remains on caller. + * @return new event + */ + static CMdEEvent* NewLC(CMdEEventDef& aDef, TItemId aObjectId, TTime aTime, + const TDesC* aSource, const TDesC* aParticipant ); + + /** + * Destructor. + */ + virtual ~CMdEEvent(); + + + /* Methods. */ + + /** + * Returns the definition of the event. + * + * @return Event definition. + */ + IMPORT_C CMdEEventDef& Def() const; + + /** + * Returns the identifier of the object that the event is related to. + * + * @return Object identifier. + */ + IMPORT_C TItemId ObjectId() const; + + /** + * Returns the time when the event occurred. + * + * @return Time. + */ + IMPORT_C TTime Time() const; + + /** + * Returns the source of the event. + * + * @return Source. + */ + IMPORT_C const TDesC* Source() const; + + /** + * Returns the participant of the event. + * + * @return Participant. + */ + IMPORT_C const TDesC* Participant() const; + + /** + * Calculates required size for buffer to serialize event + * + * @return necessary buffer size + */ + TUint32 RequiredBufferSize() const; + + /** + * Serialize event + * + * @param aBuffer buffer where serialized event should go + */ + TMdCOffset SerializeL(CMdCSerializationBuffer& aBuffer, TMdCOffset aFreespaceOffset) const; + + TMdEInstanceType InstanceType() const; + +private: + /** + * Constructs a new event. + * + * @param aDef Definition of the new event. + * @param aObjectId Identifier of the object that the new event is related to. + * @param aTime Time when the new event occurred. + */ + CMdEEvent(CMdESession* aSession, TItemId aId, CMdEEventDef& aDef, TItemId aObjectId, TTime aTime); + + /** + * Second-phase constructor. + * + * @param aSource Source of the new event. Ownership of the pointed object remains on caller. + * @param aParticipant Participant of the new event. Ownership of the pointed object remains on caller. + */ + void ConstructL(const TDesC* aSource, const TDesC* aParticipant); + + +private: + + /** Event definition. */ + CMdEEventDef& iDef; + + /** Object identifier. */ + TItemId iObjectId; + + /** Time when the event occurred. */ + TTime iTime; + + /** Source descriptor. */ + HBufC* iSource; + + /** Participant descriptor. */ + HBufC* iParticipant; + }; + +#endif // __MDEEVENT_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeeventcondition.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeeventcondition.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,202 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Representation of query event condition +* +*/ + +#ifndef __MDEEVENTCONDITION_H__ +#define __MDEEVENTCONDITION_H__ + + +#include +#include + + +/* Forward declarations. */ +class CMdELogicCondition; +class CMdEEventDef; +class CMdEEventDef; + + +/** + * Query condition for events. + */ +NONSHARABLE_CLASS(CMdEEventCondition) : public CMdECondition + { +public: + + /* Constructors and destructor. */ + + /** + * Create new CMdEEventCondition from serialized buffer + * + * @return new CMdEEventCondition + */ + static CMdEEventCondition* NewL( TItemId aEventId = KNoId, + const CMdEEventDef* aEventDef = NULL, + const TMdETimeRange* aCreationTimeRange = NULL, + TEventConditionCompareMethod aCompareMethod = EEventConditionCompareNone, + const TDesC* aString = NULL ); + + /** + * Create new CMdEEventCondition from serialized buffer and leaves it on stack + * + * @return new CMdEEventCondition + */ + static CMdEEventCondition* NewLC( TItemId aEventId = KNoId, + const CMdEEventDef* aEventDef = NULL, + const TMdETimeRange* aCreationTimeRange = NULL, + TEventConditionCompareMethod aCompareMethod = EEventConditionCompareNone, + const TDesC* aString = NULL ); + + /** + * Destructor. + */ + virtual ~CMdEEventCondition(); + + + /* Methods. */ + + /** + * Returns the logic condition root node of the conditions defined for + * the object which the event is attached to. + * + * @return Logic condition. + */ + IMPORT_C CMdELogicCondition& ObjectConditionsL(); + + /** + * Returns the logic condition root node of the condition defined for + * the object whose URI matches the source URI of the event. + */ + IMPORT_C CMdELogicCondition& SourceObjectConditionsL(); + + /** + * Returns the logic condition root node of the condition defined for + * the object whose URI matches the source URI of the event. + */ + IMPORT_C CMdELogicCondition& ParticipantObjectConditionsL(); + + /** + * Returns the event ID that the condition matches against. + * + * @return Event ID. + */ + IMPORT_C TItemId EventId() const; + + /** + * Returns the event definition that the condition matches against. + * + * @return Event definition. NULL, if not defined. + */ + IMPORT_C const CMdEEventDef* EventDef() const; + + /** + * Returns the creation time range of the condition. + * + * @return Pointer to the time range. NULL, + * if not defined. + */ + IMPORT_C const TMdETimeRange* TimeRange() const; + + /** + * Returns the source URI the condition matches against. + * + * @return Source URI. NULL, if not defined. + */ + IMPORT_C const TDesC* SourceURI() const; + + /** + * Returns the participant URI the condition matches against. + * + * @return Participant URI. NULL, if not defined. + */ + IMPORT_C const TDesC* ParticipantURI() const; + + /** + * Get possible query's internal optimization flags from condition. + * + * @param aFlaga query's internal optimization flags + * @return last level internal optimization flags + */ + TUint32 InternalQueryOptimizationFlags(TUint32& aFlags); + + /** + * Get required size of serialized buffer when it is serialized. + * + * @return required serialized buffer size + */ + TUint32 RequiredBufferSize() const; + + /** + * Serialize own data to serialized buffer (correct position must be set + * before calling) and return new position of serialized buffer. + * + * @param aBuffer serialized buffer. + */ + void SerializeL(CMdCSerializationBuffer& aBuffer, + TMdCOffset& aFreespaceOffset) const; + +private: + + /* Private methods. */ + + /** + * Constructor for a condition that requires that the event ID a + * certain ID or event is of a certain type. + * + * @param aEventId Event ID. + * @param aEventDef Event definition. + */ + CMdEEventCondition(TItemId aEventId, const CMdEEventDef* aEventDef); + + /** + * Second-phase constructor. Pass NULL in parameters that + * are not needed. + * + * @param aCreationTimeRange Range for the creation time. + * @param aCompareMethod Comparison method for the string. + * @param aString Text string to match. + */ + void ConstructL(const TMdETimeRange* aCreationTimeRange, + TEventConditionCompareMethod aCompareMethod = EEventConditionCompareNone, + const TDesC* aString = 0); + +private: + + const TItemId iEventId; + + /** Event definition to match. NULL, if not defined. */ + const CMdEEventDef* iEventDef; + + /** Conditions for the object which the event is associated with. */ + CMdELogicCondition* iObjectConditions; + + /** Creation time range. NULL, if not defined. */ + TMdETimeRange* iCreationTimeRange; + + /** Source of participant URI to match. NULL, if not defined. */ + HBufC* iURI; + + /** Conditions for the object whose URI matches the source URI. */ + CMdELogicCondition* iSourceConditions; + + /** Conditions for the object whose URI matches the participant URI. */ + CMdELogicCondition* iParticipantConditions; + + /** Method of comparison. */ + TEventConditionCompareMethod iCompareMethod; + }; + +#endif // __MDEEVENTCONDITION_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeeventdef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeeventdef.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,86 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDEEVENTDEF_H__ +#define __MDEEVENTDEF_H__ + +#include + +#include + +// Forward declaration +class CMdCSerializationBuffer; +class CMdENamespaceDef; +class TMdCEventDef; + +/** + * Event definition. + */ +NONSHARABLE_CLASS(CMdEEventDef) : public CBase + { +public: + /** + * Returns the name of the item. + * + * @return name + */ + IMPORT_C const TDesC& Name() const; + + /** + * Compare this event definition with other event definition. + * + * @param aEventDef other event definition + * + * @return 0 if events are same, 1 or more if this is greater than other + * and -1 or less if this is less than other. + */ + IMPORT_C TInt Compare(const CMdEEventDef& aEventDef) const; + + /** + Returns namespacedef which is associated with eventdef + @return namespacedef which is associated with eventdef + */ + IMPORT_C CMdENamespaceDef& NamespaceDef() const; + +public: + static CMdEEventDef* NewL(const TMdCEventDef& aEventDef, CMdCSerializationBuffer& aSchemaBuffer, + CMdENamespaceDef& aNamespaceDef); + + static CMdEEventDef* NewLC(const TMdCEventDef& aEventDef, CMdCSerializationBuffer& aSchemaBuffer, + CMdENamespaceDef& aNamespaceDef); + + /** + * Destructor. + */ + virtual ~CMdEEventDef(); + + TDefId Id() const; + +private: + CMdEEventDef(const TMdCEventDef& aEventDef, CMdENamespaceDef& aNamespaceDef); + + void ConstructL(CMdCSerializationBuffer& aSchemaBuffer); + +private: + const TMdCEventDef& iEventDef; + CMdENamespaceDef& iNamespaceDef; + + TPtrC16 iName; + }; + +#endif // __MDEEVENTDEF_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeeventquery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeeventquery.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,76 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Represents event query +* +*/ + + +#ifndef __MDEEVENTQUERY_H__ +#define __MDEEVENTQUERY_H__ + + +#include + + +/* Forward declarations. */ +class CMdEEvent; +class CMdENamespaceDef; + +/** + * A query that retrieves a set of events from the metadata engine database. + * Most functionality is provided by the CMdEQuery base class. + */ +NONSHARABLE_CLASS(CMdEEventQuery) : public CMdEQuery + { +public: + + /** + * Destructor. + */ + virtual ~CMdEEventQuery(); + + + /* Methods. */ + + /** + * Returns one of the result events. + * + * @param aIndex Index number of the result item. + * + * @return The result event that was requested. The query retains + * ownership of the returned event item. + */ + IMPORT_C CMdEEvent& Result(TInt aIndex) const; + + +protected: + + /* Constructors. */ + + /** + * Constructor. + * + * @param aSession Session. + */ + CMdEEventQuery(CMdESession& aSession, CMdENamespaceDef& aNamespaceDef); + + /** + * Second-phase constructor. + */ + void EventQueryConstructL(); + + virtual void DoCancel(); + }; + +#endif // __MDEEVENTQUERY_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeinstanceitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeinstanceitem.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDEINSTANCEITEM_H__ +#define __MDEINSTANCEITEM_H__ + + +#include + +enum TMdEInstanceType + { + EMdETypeObject = 1, + EMdETypeRelation, + EMdETypeEvent, + EMdETypeProperty + }; + +/** + * Abstract base class for all instance items stored in the metadata engine database. + */ +NONSHARABLE_CLASS(CMdEInstanceItem) : public CMdEItem + { +public: + + /* Destructor. */ + + /** + * Destructor. + */ + virtual ~CMdEInstanceItem(); + + + /* Methods. */ + + virtual TMdEInstanceType InstanceType() const = 0; + +protected: + + /* Constructors. */ + + /** + * Constructor. + */ + CMdEInstanceItem(CMdESession* aSession, TItemId aId); + + /** + * Second-phase constructor. + */ + void InstanceItemBaseConstruct(); + }; + +#endif // __MDEINSTANCEITEM_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeinternalerror.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeinternalerror.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,113 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Common internal error code definitions +* +*/ + +#ifndef MDEINTERNALERROR_H +#define MDEINTERNALERROR_H + +#include + +/* + * Internal error. Unknown namespace definition. + */ +const TInt KErrMdEUnknownNamespaceDef = -36240; + +/* + * Internal error. Unknown object definition. + */ +const TInt KErrMdEUnknownObjectDef = -36241; + +/* + * Internal error. Unknown property definition. + */ +const TInt KErrMdEUnknownPropertyDef = -36242; + +/* + * Internal error. Unknown relation definition. + */ +const TInt KErrMdEUnknownRelationDef = -36243; + +/* + * Internal error. Unknown event definition. + */ +const TInt KErrMdEUnknownEventDef = -36244; + +/* + * Internal error. Unknown property type. + */ +const TInt KErrMdEUnknownPropertyType = -36245; + +/* + * Internal error. Unknown confidentiality level. + */ +const TInt KErrMdEUnknownConfidentialityLevel = -36246; + +/* + * Internal error. Unknown compare method. + */ +const TInt KErrMdEUnknownCompareMethod = -36247; + +/* + * Internal error. Unknown query type. + */ +const TInt KErrMdEUnknownQueryType = -36248; + +/* + * Internal error. Unknown query result mode. + */ +const TInt KErrMdEUnknownQueryResultMode = -36249; + +/* + * Internal error. Range type is not expected. + */ +const TInt KErrMdEUnknownRangeType = -36250; + +/* + * Internal error. Unknown condition type. + */ +const TInt KErrMdEUnknownConditionType = -36251; + +/* + * Internal error. Unknown condition compare method. + */ +const TInt KErrMdEUnknownConditionCompareMethod = -36252; + +/* + * Internal error. Condition operator is not expected. + */ +const TInt KErrMdEIncorrectConditionOperator = -36253; + +/* + * Internal error. Serialized type is not expected. + */ +const TInt KErrMdEIncorrectSerializedType = -36254; + +/* + * Internal error. Size of serialized type is not expected. + */ +const TInt KErrMdEIncorrectSerializedTypeSize = -36255; + +/* + * Internal error. Schema contains illegal character. + */ +const TInt KErrMdESchemaContainsIllegalCharacter = -36256; + +/* + * Internal error. Schema contains reserved word. + */ +const TInt KErrMdESchemaContainsReservedWord = -36257; + +#endif /*MDEINTERNALERROR_H*/ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeitem.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDEITEM_H__ +#define __MDEITEM_H__ + + +#include + +#include + +/** + * Internal identifier for metadata engine database items. Must always be + * different from 0. + */ +class CMdESession; + +/** + * Abstract base class for all items stored in the metadata engine database. + */ +NONSHARABLE_CLASS(CMdEItem) : public CBase + { +public: + + /** + * Destructor. + */ + virtual ~CMdEItem(); + + + /* Methods. */ + + /** + * Returns whether the item belongs to a session. + * + * @return ETrue, if the item belongs to a session; + * EFalse, otherwise + */ + IMPORT_C TBool BelongsToSession() const; + + /** + * Returns the session the item belongs to. Panics if + * the item does not belong to any session. + * + * @return session that the item belongs to + */ + IMPORT_C CMdESession& Session() const; + + /** + * Returns whether the item is stored in the database. + * + * @return ETrue, if the item is in the database; + * EFalse, otherwise + */ + IMPORT_C TBool InDatabase() const; + + /** + * Returns the internal database identifier of the item. + * + * @return internal database identifier or KNoId if item is not stored in database. + */ + IMPORT_C TItemId Id() const; + + /** + * Sets that the internal database identifier of the object. + * + * @param aId internal database identifier + */ + void SetId(TItemId aId); + + /** + * Sets the session the item belongs to. + * + * @param aSession session + */ + void SetSession(CMdESession& aSession); + +protected: + + /* Constructors and destructor. */ + + /** + * Constructor. Note that if the new item is in the database + * (i.e., it has an internal database identifier), it must also belong + * to a session. + * + * @param aSession session that the new item belongs to; + * or 0, if the new item does not belong to any session + * @param aId internal database identifier of the new item, + * if the item is in the database (note that then also + * aSession must be different from 0); + * or 0, if the item is not in the database + */ + CMdEItem(CMdESession* aSession, TItemId aId); + + /** + * Second-phase constructor. + */ + void ItemBaseConstruct(); + + /* Utility methods. */ + + /** + * Panics if the item does not belong to any session. + */ + void CheckSession() const; + + +private: + + /** Session. */ + CMdESession* iSession; + + /** Internal database identifier. */ + TItemId iId; + + friend class CMdESession; + }; + +#endif // __MDEITEM_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdelogiccondition.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdelogiccondition.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,656 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDELOGICCONDITION_H__ +#define __MDELOGICCONDITION_H__ + + +#include + +#include +#include +#include +#include + + +/* Forward declarations. */ +class CMdEBoolPropertyCondition; +class CMdEObjectDef; +class CMdEPropertyDef; +class CMdERelationDef; +class CMdEEventDef; +class CMdCSerializationBuffer; +class CMdEEventCondition; +class CMdEObjectCondition; +class CMdEPropertyCondition; +class CMdERelationCondition; + +/** + * Logic conditions are used for combining other conditions with boolean + * AND or OR operators. Each logic condition can have an unlimited number of + * child conditions. The same operator is applied to all of the child + * conditions: (X and Y and Z), (X or Y or Z). + * + * CMdELogicCondition provides a number of factory methods for creating and + * adding new nodes as children of the logic condition node. Always use the + * factory methods when constructing a query condition tree. + * + * A logic condition node owns all of its children. + */ +NONSHARABLE_CLASS(CMdELogicCondition) : public CMdECondition + { +public: + + /* Constructors and destructor. */ + + /** + * Constructs a new logic condition node. + * + * @param aOperator Operator to use for the child conditions. + */ + IMPORT_C static CMdELogicCondition* NewL(TLogicConditionOperator aOperator); + + /** + * Constructs a new logic condition node, leaving the node on the + * cleanup stack. + * + * @param aOperator Operator to use for the child conditions. + */ + IMPORT_C static CMdELogicCondition* NewLC(TLogicConditionOperator aOperator); + + + /** + * Destructor. + */ + virtual ~CMdELogicCondition(); + + + /* Methods. */ + + /** + * Returns the operator of the logic condition. + * + * @return Logic operator. + */ + IMPORT_C TLogicConditionOperator Operator() const; + + /** + * Changes the operator of the logic condition. + * + * @param aLogicOperator The new logic operator for the condition. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C void SetOperator(TLogicConditionOperator aLogicOperator); + + /** + * Determines the number of child conditions. + * + * @return Number of conditions in the logic operation. + */ + IMPORT_C TInt Count() const; + + /** + * Returns a child condition node. + * + * @param aIndex Index of the condition to return. + * + * @return Condition node at the specified index. + */ + IMPORT_C CMdECondition& Condition(TInt aIndex) const; + + /** + * Removes a condition node from the logic condition. + * + * @param aIndex Index of the condition to remove. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C void Remove(TInt aIndex); + + + /* Factory methods for creating and adding new condition nodes into + * the tree. */ + + /** + * Creates a new logic condition and makes it a child condition of this + * logic condition node. + * + * @param aLogicOperator Operator of the new logic condition. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdELogicCondition& AddLogicConditionL(TLogicConditionOperator aLogicOperator); + + /** + * Creates a new object condition and makes it a child condition of this + * logic condition node. The object condition node sets a requirement for + * the object class. + * + * Example: + * // We want the condition to match with image objects. + * CMdELogicCondition* condition = CMdELogicCondition::NewL( ELogicConditionOperatorAnd ); + * CleanupStack::PushL( condition ); + * + * CMdENamespaceDef& defaultNamespace = iMdeSession->GetDefaultNamespaceDefL(); + * CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); + * condition->AddObjectConditionL( imageDef ); + * + * @param aObjectDef Object definition. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEObjectCondition& + AddObjectConditionL(const CMdEObjectDef& aObjectDef); + + /** + * Creates a new object condition and makes it a child condition of this + * logic condition node. The object condition node sets a requirement for + * the object's ID number. + * + * Example: + * CMdERelationQuery* relationQuery = iMdeSession->NewRelationQueryL( defNamespace, this ); + * CMdERelationCondition& filterCond = relationQuery->Conditions(). + * AddRelationConditionL( ERelationConditionSideRight ); + * // Left object in relation must have this ID. + * filterCond.LeftL().AddObjectConditionL( aObjectId ); + * + * @param aObjectId ID number of the object. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEObjectCondition& AddObjectConditionL(TItemId aObjectId); + + /** + * Creates a new object condition and makes it a child condition of this + * logic condition node. The object condition node sets a requirement for + * the objects' ID numbers. + * + * @param aObjectId ID numbers of objects. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + * + */ + IMPORT_C CMdEObjectCondition& AddObjectConditionL( + const RArray& aObjectIds); + + /** + * Creates a new object condition and makes it a child condition of this + * logic condition node. The object condition node sets a requirement for + * the object's GUID. + * + * @param aObjectGuidHigh GUID high part of the object. + * @param aObjectGuidLow GUID low part of the object. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEObjectCondition& AddObjectConditionL( + TInt64 aObjectGuidHigh, TInt64 aObjectGuidLow); + + /** + * Creates a new object condition and makes it a child condition of this + * logic condition node. + * + * @param aCompareMethod Comparison method. + * @param aString Text string to look for. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEObjectCondition& AddObjectConditionL( + TObjectConditionCompareMethod aCompareMethod, + const TDesC& aString); + + /** + * Creates a new object condition and makes it a child condition of this + * logic condition node. + * + * @param aRange range for usage count + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEObjectCondition& AddObjectConditionL( + const TMdEUintRange& aRange); + + /** + * Creates a new property condition and makes it a child condition of this + * logic condition node. The property condition tests if a property + * exists in an object. + * + * Example: + * CMdEPropertyDef& commentDef = objDef.GetPropertyDefL( MdeConstants::MediaObject::KCommentProperty ); + * iQuery->Conditions().AddPropertyConditionL( commentDef ); + * + * @param aPropertyDef The property to look for. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEPropertyCondition& AddPropertyConditionL( + const CMdEPropertyDef& aPropertyDef); + + /** + * Creates a new boolean property condition and makes it a child + * condition of this logic condition node. The property condition + * tests the value of a boolean property. + * + * Example: + * CMdEPropertyDef& commentDef = objDef.GetPropertyDefL( MdeConstants::MediaObject::KProtectedProperty ); + * iQuery->Conditions().AddPropertyConditionL( commentDef, ETrue ); + * + * @param aPropertyDef Property definition. + * @param aBoolValue Boolean value. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEBoolPropertyCondition& AddPropertyConditionL( + const CMdEPropertyDef& aPropertyDef, TBool aBoolValue); + + /** + * Creates a new integer property condition and makes it a child + * condition of this logic condition node. The property condition defines + * a range of integer values. If the property's value is within the range + * the condition evaluates to True. + * + * Example: + * CMdEPropertyDef& frameCountDef = objDef.GetPropertyDefL( MdeConstants::Image::FrameCount ); + * iQuery->Conditions().AddPropertyConditionL( frameCountDef, TMdEIntRange(0, 5, rangeType) ); + * + * @param aPropertyDef Property definition. + * @param aIntRange Range of integer values. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEIntRangePropertyCondition& AddPropertyConditionL( + const CMdEPropertyDef& aPropertyDef, + const TMdEIntRange& aIntRange); + + /** + * Creates a new 64 bit integer property condition and makes it a child + * condition of this logic condition node. The property condition defines + * a range of integer values. If the property's value is within the range + * the condition evaluates to True. + * + * @param aPropertyDef Property definition. + * @param aInt64Range Range of 64 bit integer values. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEInt64RangePropertyCondition& AddPropertyConditionL( + const CMdEPropertyDef& aPropertyDef, + const TMdEInt64Range& aIntRange); + + /** + * Creates a new unsigned integer property condition and makes it a child + * condition of this logic condition node. The property condition defines + * a range of unsigned integer values. If the property's value is within + * the range the condition evaluates to True. + * + * @param aPropertyDef Property definition. + * @param aUintRange Range of unsigned integer values. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEUintRangePropertyCondition& AddPropertyConditionL( + const CMdEPropertyDef& aPropertyDef, + const TMdEUintRange& aUintRange); + + /** + * Creates a new floating-point property condition and makes it a child + * condition of this logic condition node. The property condition defines + * a range of floating-point values. If the property's value is within + * the range the condition evaluates to True. + * + * @param aPropertyDef Property definition. + * @param aRealRange Range of floating-point values. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdERealRangePropertyCondition& AddPropertyConditionL( + const CMdEPropertyDef& aPropertyDef, + const TMdERealRange& aRealRange); + + /** + * Creates a new time property condition and makes it a child + * condition of this logic condition node. The property condition defines + * a range of time values. If the property's value is within the range + * the condition evaluates to True. + * + * @param aPropertyDef Property definition. + * @param aTimeRange Range of time values. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdETimeRangePropertyCondition& AddPropertyConditionL( + const CMdEPropertyDef& aPropertyDef, + const TMdETimeRange& aTimeRange); + + /** + * Creates a new text property condition and makes it a child condition + * of this logic condition node. + * + * @param aPropertyDef Property definition. + * @param aCompareMethod Comparison method. + * @param aText Text string to look for. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdETextPropertyCondition& AddPropertyConditionL( + const CMdEPropertyDef& aPropertyDef, + TTextPropertyConditionCompareMethod aCompareMethod, + const TDesC& aText); + + /** + * Creates a new relation condition and makes it a child condition of this + * logic condition node. The new relation condition contains no parameters + * by default. It is assumed that the relation condition is augmented + * with further conditions for the objects to which the relation is + * attached. + * + * Example: + * TItemId relationId( 1 ); + * CMdERelationCondition& relationCond = relationQuery->Conditions(). + * AddRelationConditionL( relationId, ERelationConditionSideRight ); + * + * @param aRelationId Relation ID. + * @param aSide The side on which an object must be. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdERelationCondition& AddRelationConditionL(TItemId aRelationId, + TRelationConditionSide aSide = ERelationConditionSideEither); + + /** + * Creates a new relation condition and makes it a child condition of this + * logic condition node. The new relation condition contains no parameters + * by default. It is assumed that the relation condition is augmented + * with further conditions for the objects to which the relation is + * attached. + * + * Example: + * RArray arrayOfIds; + * arrayOfIds.Append( TItemId( 1 ) ); + * arrayOfIds.Append( TItemId( 2 ) ); + * CMdERelationCondition& relationCond = relationQuery->Conditions(). + * AddRelationConditionL( arrayOfIds, ERelationConditionSideRight ); + * + * @param aRelationIds Array of Relation IDs. + * @param aSide The side on which an object must be. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdERelationCondition& AddRelationConditionL( + RArray& aRelationIds, + TRelationConditionSide aSide = ERelationConditionSideEither); + + /** + * Creates a new relation condition and makes it a child condition of this + * logic condition node. The new relation condition contains no parameters + * by default. It is assumed that the relation condition is augmented + * with further conditions for the objects to which the relation is + * attached. + * + * Example: + * CMdERelationCondition& relationCond = relationQuery->Conditions(). + * AddRelationConditionL( ERelationConditionSideRight ); + * + * @param aSide The side on which an object must be. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdERelationCondition& AddRelationConditionL( + TRelationConditionSide aSide = ERelationConditionSideEither); + + /** + * Creates a new relation condition and makes it a child condition of this + * logic condition node. The new relation condition tests the relation's + * type. The relation condition can be augmented with further conditions + * for the objects to which the relation is attached. + * + * @param aRelationDef relation definition + * @param aSide The side on which an object must be. Defaults to + * ERelationConditionSideEither. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdERelationCondition& AddRelationConditionL( + const CMdERelationDef& aRelationDef, + TRelationConditionSide aSide = ERelationConditionSideEither); + + /** + * Creates a new relation condition and makes it a child condition of this + * logic condition node. The new relation condition tests the relation's + * type. The relation condition can be augmented with further conditions + * for the objects to which the relation is attached. + * + * @param aRelationDef relation definition + * @param aIntRange parameter range conditions + * @param aSide The side on which an object must be. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdERelationCondition& AddRelationConditionL( + const CMdERelationDef& aRelationDef, const TMdEIntRange& aIntRange, + TRelationConditionSide aSide = ERelationConditionSideEither); + + + /** + * Creates a new event condition and makes it a child condition of this + * logic condition node. The new event condition contains no parameters + * by default. It is assumed that the event condition is augmented + * with further conditions for the object to which the event is attached. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEEventCondition& AddEventConditionL(); + + /** + * Creates a new event condition and makes it a child condition of this + * logic condition node. The new event condition tests the event's type. + * The event condition can be augmented with further conditions + * for the object to which the event is attached. + * + * @param aEventId Event ID. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEEventCondition& AddEventConditionL(TItemId aEventId); + + /** + * Creates a new event condition and makes it a child condition of this + * logic condition node. The new event condition tests the event's type. + * The event condition can be augmented with further conditions + * for the object to which the event is attached. + * + * @param aEventDef Event definition. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEEventCondition& AddEventConditionL( + const CMdEEventDef& aEventDef); + + /** + * Creates a new event condition and makes it a child condition of this + * logic condition node. The new event condition tests the event's + * creation time. The event condition can be augmented with further + * conditions for the object to which the event is attached. + * + * @param aCreationTimeRange Time range. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEEventCondition& AddEventConditionL( + const TMdETimeRange& aCreationTimeRange); + + /** + * Creates a new event condition and makes it a child condition of this + * logic condition node. The new event condition tests the event's + * source or participant. The event condition can be augmented with + * further conditions for the object to which the event is attached. + * + * @param aCompareMethod Comparison method. + * @param aString Text string to look for. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEEventCondition& AddEventConditionL( + TEventConditionCompareMethod aCompareMethod, const TDesC& aString); + + /** + * Creates a new event condition and makes it a child condition of this + * logic condition node. The new event condition tests the event's + * creation time. The new event condition also tests the event's + * source or participant. The event condition can be augmented with + * further conditions for the object to which the event is attached. + * + * @param aCreationTimeRange Time range. + * @param aCompareMethod Comparison method. + * @param aString Text string to look for. + * + * @return Reference to the new condition node. + * + * @panic TMdEPanic::EConditionLocked Condition node is locked. + */ + IMPORT_C CMdEEventCondition& AddEventConditionL( + const TMdETimeRange& aCreationTimeRange, + TEventConditionCompareMethod aCompareMethod, const TDesC& aString); + + /** + * Locking a logic condition causes all children to be locked as well. + * Attempting to modify a locked condition causes a panic. + * + * @param aLocked ETrue to lock; + * EFalse to unlock. + */ + void SetLocked(TBool aLocked = ETrue); + + /** + * Get possible query's internal optimization flags from condition. + * + * @param aFlaga query's internal optimization flags + * @return last level internal optimization flags + */ + TUint32 InternalQueryOptimizationFlags(TUint32& aFlags); + + /** + * Get required size of serialized buffer when this is serialized. + * + * @return required size of serialized buffer + */ + TUint32 RequiredBufferSize() const; + + /** + * Serialize own data to serialized buffer (correct position must be set + * before calling). + * + * @param aBuffer serialized buffer. + */ + void SerializeL(CMdCSerializationBuffer& aBuffer, + TMdCOffset& aFreespaceOffset) const; + +protected: + + /* Constructors. */ + + /** + * Constructor. + * + * @param aOperator Logic operator. + */ + CMdELogicCondition(TLogicConditionOperator aOperator); + + /** + * Second-phase constructor. + */ + void ConstructL(); + + + /* Utility methods. */ + + /** + * Makes an existing condition node a child node of this logic condition. + * The logic condition takes ownership of the node. + * + * @param aCondition Condition node. + * + * @return Reference to the added node (aCondition). + */ + CMdECondition& AddL(CMdECondition* aCondition); + + +private: + + /** Type of the condition. */ + TLogicConditionOperator iOperator; + + /** Children of the condition. The logic condition owns all the + child nodes. */ + RPointerArray iChildren; + + TUint32 iOptimizationFlags; + }; + +#endif // __MDELOGICCONDITION_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdenamespacedef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdenamespacedef.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,222 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + +#ifndef __MDENAMESPACEDEF_H__ +#define __MDENAMESPACEDEF_H__ + + +#include + +class CMdESession; +class CMdCSerializationBuffer; +class CMdERelationDef; +class CMdEEventDef; +class CMdEObjectDef; + +class TMdCNamespaceDef; + + +/** + * Namespace definition. + */ +NONSHARABLE_CLASS(CMdENamespaceDef) : public CBase + { +public: + /** + * Returns whether the namespace is read only. + * + * @return ETrue, if the namespace is read only; + * EFalse, otherwise + */ + IMPORT_C TBool ReadOnly() const; + + /** + * Returns the name of the item. + * + * @return name + */ + IMPORT_C const TDesC& Name() const; + + /** + * Compare this namespace definition with other namespace definition. + * + * @param aNamespaceDef other namespace definition + * + * @return 0 if namespaces are same, 1 or more if this is greater than other + * and -1 or less if this is less than other. + */ + IMPORT_C TInt Compare(const CMdENamespaceDef& aNamespaceDef) const; + + /** + * Returns the number of object definitions. + * + * @return number of object definitions + */ + IMPORT_C TInt ObjectDefCount() const; + + /** + * Returns the object definition at the specified index. + * + * @param aIndex index + * + * @return object definition or leave, if there is no object definition + * with the specified name. + * + * @panics if aIndex is out of bounds + */ + IMPORT_C CMdEObjectDef& ObjectDefL(TInt aIndex); + + /** + * Returns the object definition with the specified name. + * + * @param aName name + * + * @return object definition or leave, if there is no object definition + * with the specified name. + */ + IMPORT_C CMdEObjectDef& GetObjectDefL(const TDesC& aName); + + /** + * Returns the number of relation definitions. + * + * @return number of relation definitions + */ + IMPORT_C TInt RelationDefCount() const; + + /** + * Returns the relation definition at the specified index. + * + * @param aIndex index + * + * @return relation definition or leave, if there is no object definition + * with the specified name. + */ + IMPORT_C CMdERelationDef& RelationDefL(TInt aIndex); + + /** + * Returns the relation definition with the specified name. + * + * @param aName name + * + * @return relation definition or leave, if there is no object definition + * with the specified name. + * + * @panics if aIndex is out of bounds + */ + IMPORT_C CMdERelationDef& GetRelationDefL(const TDesC& aName); + + /** + * Returns the number of event definitions. + * + * @return number of event definitions + */ + IMPORT_C TInt EventDefCount() const; + + /** + * Returns the event definition at the specified index. + * + * @param aIndex index + * + * @return event definition or leave, if there is no object definition + * with the specified name. + * + * @panics if aIndex is out of bounds + */ + IMPORT_C CMdEEventDef& EventDefL(TInt aIndex); + + /** + * Returns the event definition with the specified name. + * + * @param aName name + * + * @return event definition or leave, if there is no object definition + * with the specified name. + */ + IMPORT_C CMdEEventDef& GetEventDefL(const TDesC& aName); + +public: + static CMdENamespaceDef* NewL(const CMdESession& aMdeSession, + const TMdCNamespaceDef& aNamespaceDef, + CMdCSerializationBuffer& aSchemaBuffer); + + static CMdENamespaceDef* NewLC(const CMdESession& aMdeSession, + const TMdCNamespaceDef& aNamespaceDef, + CMdCSerializationBuffer& aSchemaBuffer); + + /** + * Destructor. + */ + virtual ~CMdENamespaceDef(); + + TDefId Id() const; + + /** + * Returns the object definition with the specified id. + * + * @param aId id + * + * @return object definition; or 0, if there is no object definition + * with the specified id + */ + CMdEObjectDef* GetObjectDefL(TDefId aId); + + /** + * Returns the relation definition with the specified id. + * + * @param aId id + * + * @return relation definition; or 0, if there is no relation definition + * with the specified id + */ + CMdERelationDef* GetRelationDefL(TDefId aId); + + /** + * Returns the event definition with the specified id. + * + * @param aId id + * + * @return event definition; or 0, if there is no event definition + * with the specified id + */ + CMdEEventDef* GetEventDefL(TDefId aId); + + /** + * Returns the MdE session where namespace definition belongs. + * + * @return MdE session + */ + const CMdESession& Session() const; + +private: + CMdENamespaceDef(const CMdESession& aMdeSession, + const TMdCNamespaceDef& aNamespaceDef); + + void ConstructL(CMdCSerializationBuffer& aSchemaBuffer); + +private: + const CMdESession& iMdeSession; + + const TMdCNamespaceDef& iNamespaceDef; + + TPtrC16 iName; + + RPointerArray iObjectDefs; + RPointerArray iRelationDefs; + RPointerArray iEventDefs; + }; + +#endif // __MDENAMESPACEDEF_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdenumberproperty.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdenumberproperty.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,61 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMdENumberPropertys' compatible wrapper to CMdEProperty +* +*/ + +#ifndef __MDENUMBERPROPERTY_H__ +#define __MDENUMBERPROPERTY_H__ + +#include + +/** + * Template for number property compatibility wrappers to property. + */ +template< class T > +class CMdENumberProperty : public CMdEProperty + { +public: + /** + * Returns the value of the property. + * + * @return value + */ + T Value() const; + + /** + * Sets the value of the property. + * + * @param aValue New value. + */ + void SetValueL(T aValue); + }; + +/* Typedefs for numeric properties. */ +typedef CMdENumberProperty CMdEBoolProperty; +typedef CMdENumberProperty CMdEInt8Property; +typedef CMdENumberProperty CMdEUint8Property; +typedef CMdENumberProperty CMdEInt16Property; +typedef CMdENumberProperty CMdEUint16Property; +typedef CMdENumberProperty CMdEInt32Property; +typedef CMdENumberProperty CMdEUint32Property; +typedef CMdENumberProperty CMdEInt64Property; +typedef CMdENumberProperty CMdEReal32Property; +typedef CMdENumberProperty CMdEReal64Property; +typedef CMdENumberProperty CMdETimeProperty; + + +#include + +#endif // __MDENUMBERPROPERTY_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdenumberproperty.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdenumberproperty.inl Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMdENumberPropertys' compatible wrapper to CMdEProperty +* +*/ + + +#include + +#define MDE_DEFINE_NUMBER_PROPERTY(PropertyType) \ +template<> inline T##PropertyType CMdENumberProperty< T##PropertyType >::Value() const \ + { \ + T##PropertyType value = NULL; \ + TRAPD( err, value = PropertyType##ValueL() ); \ + if( err != KErrNone ) \ + { \ + _LIT( KCMdEPropertyGetValuePanic, "CMdE##PropertyType##Property::Value" ); \ + User::Panic( KCMdEPropertyGetValuePanic, KErrNotSupported ); \ + } \ + return value; \ + } \ + template<> inline void CMdENumberProperty::SetValueL(T##PropertyType aValue) \ + { \ + TRAPD( err, Set##PropertyType##ValueL( aValue ) ); \ + if( err != KErrNone ) \ + { \ + _LIT( KCMdEPropertySetValuePanic, "CMdE##PropertyType##Property::SetValueL" ); \ + User::Panic( KCMdEPropertySetValuePanic, KErrNotSupported ); \ + } \ + } + +MDE_DEFINE_NUMBER_PROPERTY(Bool) +MDE_DEFINE_NUMBER_PROPERTY(Int8) +MDE_DEFINE_NUMBER_PROPERTY(Uint8) +MDE_DEFINE_NUMBER_PROPERTY(Int16) +MDE_DEFINE_NUMBER_PROPERTY(Uint16) +MDE_DEFINE_NUMBER_PROPERTY(Int32) +MDE_DEFINE_NUMBER_PROPERTY(Uint32) +MDE_DEFINE_NUMBER_PROPERTY(Int64) +MDE_DEFINE_NUMBER_PROPERTY(Real32) +MDE_DEFINE_NUMBER_PROPERTY(Real64) +MDE_DEFINE_NUMBER_PROPERTY(Time) + +#undef MDE_DEFINE_NUMBER_PROPERTY diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeobject.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeobject.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,733 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDEOBJECT_H__ +#define __MDEOBJECT_H__ + +//#include + +#include + +// CMdEProperty compatibility wrappers +#include +#include + +/* Forward declarations. */ +class CMdEObjectDef; +class CMdEPropertyDef; +class CMdEProperty; +class CMdCSerializationBuffer; +class CMdENamespaceDef; + +NONSHARABLE_CLASS( TMdEObject ) + { +public: + /* Constructors and destructor. */ + + /** + * Constructs a new object. + */ + IMPORT_C TMdEObject(); + + /** + * Returns the ID of the object. + * + * @return Object ID. + */ + IMPORT_C TItemId Id() const; + + /** + * Returns the definition of the object. Leaves with error code + * KErrNotFound if object definition is missing. + * + * @return Object definition. + */ + IMPORT_C const CMdEObjectDef& DefL() const; + + /** + * Returns whether object is confidential or not. + * + * @return ETrue, if the object has been set to confidential. + * EFalse, otherwise. + */ + IMPORT_C TBool Confidential() const; + + /** + * Returns whether object is placeholder or not. + * + * @return ETrue, if the object has been set to placeholder. + * EFalse, otherwise. + */ + IMPORT_C TBool Placeholder() const; + + /** + * Returns whether object is removed or not. + * + * @return ETrue, if the object has been set to removed. + * EFalse, otherwise. + */ + IMPORT_C TBool Removed() const; + + /** + * Returns whether object is present or not. + * + * @return ETrue, if the object has been set to not present. + * EFalse, otherwise. + */ + IMPORT_C TBool NotPresent() const; + +public: + /** + * Calculates required size for buffer to serialize object + * + * @return necessary buffer size + */ + static TUint32 RequiredBufferSize(); + + /** + * Retrieve object from serialized buffer + * + * @param aBuffer buffer where serialized object is + * @param aNamespaceDef namespace definition of namespace where object is + * located + */ + void DeSerializeL(CMdCSerializationBuffer& aBuffer, + CMdENamespaceDef& aNamespaceDef); + +protected: + /** object ID */ + TItemId iId; + + /** Pointer to object definition, this doesn't own it. */ + CMdEObjectDef* iDef; + + /** various flags */ + TUint32 iFlags; + }; + +/** + * Object. + */ +NONSHARABLE_CLASS(CMdEObject) : public CMdEInstanceItem + { +public: + + /* Constructors and destructor. */ + + /** + * Constructs a new object from serialized buffer + * + * @param aBuffer buffer which contains serialized object + * @param aNamespaceDef reference to namespace where to object is created + */ + static CMdEObject* NewL( CMdESession* aSession, CMdCSerializationBuffer& aBuffer, CMdENamespaceDef& aNamespaceDef ); + + /** + * Constructs a new object from serialized buffer and leave it on stack + * + * @param aBuffer buffer which contains serialized object + * @param aNamespaceDef reference to namespace where to object is created + */ + static CMdEObject* NewLC( CMdESession* aSession, CMdCSerializationBuffer& aBuffer, CMdENamespaceDef& aNamespaceDef ); + + /** + * Constructs a new object. + * + * @param aDef Definition of the new object. + * @param aUri URI of the new object. + * @param aMediaId mediaid of object. Defaults to 0. + */ + + static CMdEObject* NewL( CMdEObjectDef& aDef, const TDesC& aUri, TUint32 aMediaId = 0 ); + + /** + * Constructs a new object. + * + * @param aDef Definition of the new object. + * @param aUri URI of the new object. + * @param aMediaId mediaid of object. Defaults to 0. + */ + static CMdEObject* NewLC( CMdEObjectDef& aDef, const TDesC& aUri, TUint32 aMediaId = 0 ); + + + /** + * Destructor. + */ + virtual ~CMdEObject(); + + /* Methods. */ + + /** + * Returns the definition of the object. + * + * @return Object definition. + */ + IMPORT_C CMdEObjectDef& Def() const; + + /** + * Sets the definition of the object. Object's old object definition must + * be "Object" and object must not belong to any session, otherwise method + * leaves with error code KErrNotSupported. + * + * @param aDef New object definition. + */ + IMPORT_C void SetDefL(CMdEObjectDef& aDef); + + /** + * Returns the URI of the object. + * + * @return URI. + */ + IMPORT_C const TDesC& Uri() const; + + /** + * Sets the URI of the object. + * + * @param aUri New URI. + */ + IMPORT_C void SetUriL(const TDesC& aUri); + + /** + * Returns whether object is confidential or not. + * + * @return ETrue, if the object has been set to confidential. + * EFalse, otherwise. + */ + IMPORT_C TBool Confidential() const; + + /** + * Returns whether object is confidential or not. + * + * @param aValue ETrue, if the object is confidential. + * EFalse, otherwise. + */ + IMPORT_C void SetConfidential(TBool aValue); + + /** + * Returns whether object is placeholder or not. + * + * @return ETrue, if the object has been set to placeholder. + * EFalse, otherwise. + */ + IMPORT_C TBool Placeholder() const; + + /** + * Returns whether object is placeholder or not. + * + * @param aValue ETrue, if the object is placeholder. + * EFalse, otherwise. + */ + IMPORT_C void SetPlaceholder(TBool aValue); + + + /** + * Returns the Media ID of the object. + * + * @return Media ID. + */ + IMPORT_C TUint32 MediaId() const; + + /** + * Sets the Media ID of the object. + * + * @param aMediaId New Media ID. + */ + IMPORT_C void SetMediaId(TUint32 aMediaId); + + /** + * Returns the usage count of the object. + * + * @return usage count + */ + IMPORT_C TUint32 UsageCount() const; + + /** + * Returns the Guid of the object. + * + * @param aGuidHigh reference where GuidHigh will be stored + * @param aGuidLow reference where GuidLow will be stored + */ + IMPORT_C void Guid( TInt64& aGuidHigh, TInt64& aGuidLow ) const; + + /** + * Sets the Guid of the object. + * + * @param aGuidHigh new GuidHigh value + * @param aGuidLow new GuidLow value + */ + IMPORT_C void SetGuid( const TInt64& aGuidHigh, const TInt64& aGuidLow ); + + /** + * Returns whether the object is open for modifications or not. + * + * @return ETrue, if the object is open for modifications. + * EFalse, otherwise. + */ + IMPORT_C TBool OpenForModifications() const; + + /* Methods for accessing properties. */ + + /** + * Returns the number of properties. + * + * @return number of properties + */ + IMPORT_C TInt PropertyCount() const; + + /** + * Returns the property at the specified index. + * + * @param aIndex index + * + * @return property + */ + IMPORT_C CMdEProperty& PropertyL(TInt aIndex) const; + + /** + * Returns the property by given property def + * + * Example: + * CMdENamespaceDef& defaultNamespace = iMdeSession->GetDefaultNamespaceDefL(); + * CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); + * CMdEObject* image = iMdESession->OpenObjectL( 17, imageDef ); + * + * CMdEPropertyDef& lastModDatePropDef = imageDef.GetPropertyDefL( + * Object::KLastModifiedDateProperty ); + * + * CMdEProperty* lastModDateProp = NULL; + * image->Property( lastModDatePropDef, lastModDateProp ); + * + * @param aDef property definition + * @param aProperty ref to pointer that will receive property address, if such is found. + * @param aStartAt index where to begin search(by default starts from beginning) + * + * @return Index, or KErrNotFound. + */ + IMPORT_C TInt Property(const CMdEPropertyDef& aDef, CMdEProperty*& aProperty, TInt aStartAt=0) const; + + /** + * Returns the number of properties of the specified definition. + * + * @param aDef property definition + * + * @return number of properties + */ + IMPORT_C TInt PropertyCount(const CMdEPropertyDef& aDef) const; + + /** + * Adds a new bool property to the object. If property definition doesn't + * match with value, method leaves with error code KErrArgument. + * + * Example: + * CMdEPropertyDef& receivedDef = objectDef.GetPropertyDefL( MdeConstants::Message::KReceivedProperty ); + * metadataObject.AddBoolPropertyL( receivedDef, ETrue ); + * + * @param aDef Definition of the new property. + * @param aValue Value of the new property. + * + * @return New property. + */ + IMPORT_C CMdEProperty& AddBoolPropertyL(CMdEPropertyDef& aDef, TBool aValue); + + /** + * Adds a new signed 8-bit integer property to the object. If property + * definition doesn't match with value, method leaves with error code + * KErrArgument. + * + * Example: + * CMdEPropertyDef& eightBitDef = objectDef.GetPropertyDefL( MdeConstants::Object::KProperty ); + * metadataObject.AddInt8PropertyL( eightBitDef, value ); + * + * @param aDef Definition of the new property. + * @param aValue Value of the new property. + * + * @return New property. + */ + IMPORT_C CMdEProperty& AddInt8PropertyL(CMdEPropertyDef& aDef, TInt8 aValue); + + /** + * Adds a new unsigned 8-bit integer property to the object. If property + * definition doesn't match with value, method leaves with error code + * KErrArgument. + * + * Example: + * CMdEPropertyDef& eightBitDef = objectDef.GetPropertyDefL( MdeConstants::Object::KProperty ); + * metadataObject.AddUint8PropertyL( eightBitDef, value ); + * + * @param aDef Definition of the new property. + * @param aValue Value of the new property. + * + * @return New property. + */ + IMPORT_C CMdEProperty& AddUint8PropertyL(CMdEPropertyDef& aDef, TUint8 aValue); + + /** + * Adds a new signed 16-bit integer property to the object. If property + * definition doesn't match with value, method leaves with error code + * KErrArgument. + * + * Example: + * CMdEPropertyDef& propertyDef = objectDef.GetPropertyDefL( MdeConstants::Object::KProperty ); + * metadataObject.AddInt16PropertyL( propertyDef, value ); + * + * @param aDef Definition of the new property. + * @param aValue Value of the new property. + * + * @return New property. + */ + IMPORT_C CMdEProperty& AddInt16PropertyL(CMdEPropertyDef& aDef, TInt16 aValue); + + /** + * Adds a new unsigned 16-bit integer property to the object. If property + * definition doesn't match with value, method leaves with error code + * KErrArgument. + * + * Example: + * CMdEPropertyDef& propertyDef = objectDef.GetPropertyDefL( MdeConstants::Object::KProperty ); + * metadataObject.AddUint16PropertyL( propertyDef, value ); + * + * @param aDef Definition of the new property. + * @param aValue Value of the new property. + * + * @return New property. + */ + IMPORT_C CMdEProperty& AddUint16PropertyL(CMdEPropertyDef& aDef, TUint16 aValue); + + /** + * Adds a new signed 32-bit integer property to the object. If property + * definition doesn't match with value, method leaves with error code + * KErrArgument. + * + * Example: + * CMdEPropertyDef& propertyDef = objectDef.GetPropertyDefL( MdeConstants::Object::KProperty ); + * metadataObject.AddInt32PropertyL( propertyDef, value ); + * + * @param aDef Definition of the new property. + * @param aValue Value of the new property. + * + * @return New property. + */ + IMPORT_C CMdEProperty& AddInt32PropertyL(CMdEPropertyDef& aDef, TInt32 aValue); + + /** + * Adds a new unsigned 32-bit integer property to the object. If property + * definition doesn't match with value, method leaves with error code + * KErrArgument. + * + * Example: + * CMdEPropertyDef& propertyDef = objectDef.GetPropertyDefL( MdeConstants::Object::KProperty ); + * metadataObject.AddUint32PropertyL( propertyDef, value ); + * + * @param aDef Definition of the new property. If property definition doesn't + * match with value, method leaves with error code KErrArgument. + * @param aValue Value of the new property. + * + * @return New property. + */ + IMPORT_C CMdEProperty& AddUint32PropertyL(CMdEPropertyDef& aDef, TUint32 aValue); + + /** + * Adds a new 64-bit integer property to the object. If property definition + * doesn't match with value, method leaves with error code KErrArgument. + * + * Example: + * CMdEPropertyDef& propertyDef = objectDef.GetPropertyDefL( MdeConstants::Object::KProperty ); + * metadataObject.AddInt64PropertyL( propertyDef, value ); + * + * @param aDef Definition of the new property. + * @param aValue Value of the new property. + * + * @return New property. + */ + IMPORT_C CMdEProperty& AddInt64PropertyL(CMdEPropertyDef& aDef, TInt64 aValue); + + /** + * Adds a new 32-bit real property to the object. If property definition + * doesn't match with value, method leaves with error code KErrArgument. + * + * Example: + * CMdEPropertyDef& propertyDef = objectDef.GetPropertyDefL( MdeConstants::Object::KProperty ); + * metadataObject.AddReal32PropertyL( propertyDef, realValue ); + * + * @param aDef Definition of the new property. + * @param aValue Value of the new property. + * + * @return New property. + */ + IMPORT_C CMdEProperty& AddReal32PropertyL(CMdEPropertyDef& aDef, TReal32 aValue); + + /** + * Adds a new 64-bit real property to the object. If property definition + * doesn't match with value, method leaves with error code KErrArgument. + * + * Example: + * CMdEPropertyDef& propertyDef = objectDef.GetPropertyDefL( MdeConstants::Object::KProperty ); + * metadataObject.AddReal64PropertyL( propertyDef, realValue ); + * + * @param aDef Definition of the new property. + * @param aValue Value of the new property. + * + * @return New property. + */ + IMPORT_C CMdEProperty& AddReal64PropertyL(CMdEPropertyDef& aDef, TReal64 aValue); + + /** + * Adds a new text property to the object. If property definition doesn't + * match with value, method leaves with error code KErrArgument. + * + * Example: + * CMdEPropertyDef& propertyDef = objectDef.GetPropertyDefL( MdeConstants::Object::KProperty ); + * metadataObject.AddTextPropertyL( propertyDef, text ); + * + * @param aDef Definition of the new property. + * @param aValue Value of the new property. + * + * @return New property. + */ + IMPORT_C CMdEProperty& AddTextPropertyL(CMdEPropertyDef& aDef, const TDesC& aValue); + + /** + * Adds a new time property to the object. If property definition doesn't + * match with value, method leaves with error code KErrArgument. + * + * Example: + * CMdEPropertyDef& propertyDef = objectDef.GetPropertyDefL( MdeConstants::Object::KProperty ); + * metadataObject.AddTimePropertyL( propertyDef, time ); + * + * @param aDef Definition of the new property. + * @param aValue Value of the new property. + * + * @return New property. + */ + IMPORT_C CMdEProperty& AddTimePropertyL(CMdEPropertyDef& aDef, TTime aValue); + + /** + * Removes the property at the specified index. + * + * @param aIndex index + */ + IMPORT_C void RemoveProperty(TInt aIndex); + + + /* Methods for accessing free text keywords. */ + + /** + * Returns the number of free text keywords. + * + * @return number of free text keywords + */ + IMPORT_C TInt FreeTextCount() const; + + /** + * Returns the free text keyword at the specified index + * + * @param aIndex index + * + * @return free text keyword + */ + IMPORT_C TPtrC FreeText(TInt aIndex) const; + + /** + * Returns the index of the specified free text. + * + * @param aFreeText Free text. + * + * @return Index, or KErrNotFound. + */ + IMPORT_C TInt FreeTextIndex(const TDesC& aFreeText) const; + + /** + * Adds a new free text keyword. + * + * @param aFreeText free text keyword + */ + IMPORT_C void AddFreeTextL(const TDesC& aFreeText); + + /** + * Removes the free text keyword at the specified index. + * + * @param aIndex index + */ + IMPORT_C void RemoveFreeText(TInt aIndex); + + /** + * Move all properties from object which is given as a paremeter to this object + * + * @param aObject object from where move properties + */ + IMPORT_C void MovePropertiesL(CMdEObject& aObject); + + /** + * Returns whether the object has been modified or not. + * + * @return ETrue, if the URI, MediaId or Guids has been modified. + * EFalse, otherwise. + */ + TBool ObjectModified() const; + + /** + * Returns whether the free text array has been modified or not. + * + * @return ETrue, if FreeTexts has been modified. + * EFalse, otherwise. + */ + TBool FreeTextModified() const; + + /** + * Returns whether one of the properties has been modified or not. + * + * @return Are properties modified. + */ + TBool PropertyModified() const; + + /* + * clear all modification flags and removes removed properties + */ + void ClearObject( TBool aClearFlags = ETrue ); + + /** + * Sets that the object is not open for modifications. + */ + void SetNotOpenForModifications(); + + /** + * Left locked automatically after it's added to DB. + */ + void AutoLockL() const; + + /** + * Calculates required size for buffer to serialize object + * + * @return necessary buffer size + */ + TUint32 RequiredBufferSize() const; + + /** + * Serialize object + * RequiredBufferSize() MUST be always called before this function! + * + * @param aBuffer buffer where serialized object should go + */ + TMdCOffset SerializeL(CMdCSerializationBuffer& aBuffer, TMdCOffset aFreespaceOffset) const; + +protected: + + virtual TMdEInstanceType InstanceType() const; + +private: + + /** + * Constructs a new object. + * + * @param aSession session owner + * @param aId object id + * @param aDef Definition of the new object. + */ + CMdEObject( CMdESession* aSession, TItemId aId, CMdEObjectDef& aDef ); + + /** + * Second-phase constructor. + * @param aUri URI of the new object. + * @param aMediaId mediaid of object. Defaults to 0. + */ + void ConstructL( const TDesC& aUri, TUint32 aMediaId = 0 ); + + /** + * Sets the URI of the object. + * + * @param aUri New URI. + */ + void DoSetUriL(const TDesC& aUri); + + /** + * Adds a new property to the object. + * + * @param aProperty New property. + * @param aState Modification state of the new property. + */ + void DoAddPropertyL(CMdEProperty& aProperty); + + /** + * Compares two properties. + * + * @param aFirst First property. + * @param aSecond Second property. + * + * @return 0, if the properties are equal; + * a negative value, if the first property is less than the second; + * a positive value, if the first property is greater than the second. + */ + static TInt CompareProperties(const CMdEProperty& aFirst, + const CMdEProperty& aSecond); + + /** + * Adds a new free text to the object. + * + * @param aFreeText New free text. + */ + TInt DoAddFreeTextL(const HBufC& aFreeText); + + /** + * Compares two free texts. + * + * @param aFirst First free text. + * @param aSecond Second free text. + * + * @return 0, if the texts are equal; + * a negative value, if the first text is less than the second; + * a positive value, if the first text is greater than the second. + */ + static TInt CompareFreeTexts(const HBufC& aFirst, const HBufC& aSecond); + + /** + * Returns how many properties is modified and should be send to server + */ + TUint32 ModifiedPropertiesCount() const; + +private: + + /** Object definition. + * This pointer must be initialized in constructor and + * not must be NULL in any point. */ + CMdEObjectDef* iDef; + + /** Array for properties. */ + RPointerArray iPropertyArray; + + /** Array for free text. */ + RPointerArray iFreeTextArray; + + /** various flags */ + mutable TUint32 iFlags; + + /** memory card Id */ + TUint32 iMediaId; + + /** usage count (read-only) */ + TUint32 iUsageCount; + + /** Guid Low and High */ + TInt64 iGuidHigh; + TInt64 iGuidLow; + + /** URI descriptor. */ + HBufC* iUri; + }; + + +#endif // __MDEOBJECT_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeobjectcondition.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeobjectcondition.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,279 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDEOBJECTCONDITION_H__ +#define __MDEOBJECTCONDITION_H__ + + +#include +#include + +/* Forward declarations. */ +class CMdEObjectDef; + + +/** + * Query condition for objects. + */ +NONSHARABLE_CLASS(CMdEObjectCondition) : public CMdECondition + { +public: + + /* Constructors and destructor. */ +/** + * Two-phased constructor. + */ + + static CMdEObjectCondition* NewL( TObjectConditionCompareMethod aCompareMethod, + TItemId aObjectId = KNoId, + const CMdEObjectDef* aObjectDef = NULL, + TInt64 aObjectGuidHigh = 0, TInt64 aObjectGuidLow = 0 ); + + static CMdEObjectCondition* NewLC( TObjectConditionCompareMethod aCompareMethod, + TItemId aObjectId = KNoId, + const CMdEObjectDef* aObjectDef = NULL, + TInt64 aObjectGuidHigh = 0, TInt64 aObjectGuidLow = 0 ); + + static CMdEObjectCondition* NewL( TObjectConditionCompareMethod aCompareMethod, + const RArray* aObjectIds = NULL, + const TDesC* aString = NULL, + const TMdEUintRange* aRange = NULL ); + + static CMdEObjectCondition* NewLC( TObjectConditionCompareMethod aCompareMethod, + const RArray* aObjectIds = NULL, + const TDesC* aString = NULL, + const TMdEUintRange* aRange = NULL ); + + + /** + * Destructor. + */ + virtual ~CMdEObjectCondition(); + + /* Methods. */ + + /** + * Returns the object definition of the condition. + * + * @return Object definition. NULL, if not defined. + */ + IMPORT_C const CMdEObjectDef* ObjectDef() const; + + /** + * Returns the object ID number of the condition. + * + * @return Object ID. Zero, if not defined. + */ + IMPORT_C TItemId ObjectId() const; + + /** + * Returns the object ID numbers of the condition. + * + * @return Object IDs. NULL, if not defined. + */ + IMPORT_C const RArray* ObjectIds() const; + + /** + * Returns the string of the condition. + * + * @return String descriptor. NULL, if not defined. + */ + IMPORT_C const TDesC* String() const; + + /** + * Returns the comparison method of the condition. + * + * @return Comparison method. + */ + IMPORT_C TObjectConditionCompareMethod CompareMethod() const; + + /** + * Returns the level of confidentiality of the condition. + * + * @return Confidentiality level of condition. + */ + IMPORT_C TObjectConditionConfidentialityLevel ConfidentialityLevel() const; + + /** + * Sets the confidentiality level for the condition. + * Default level is ELevelNormal. + * + * @param aLevel focuses the search to confidential or + * non-confidential objects or both of them. + */ + IMPORT_C void SetConfidentialityLevel( TObjectConditionConfidentialityLevel aLevel ); + + /** + * Determines whether the condition requires the object + * to be a present object or not. + * + * @return ETrue, if not present objects are requested; + * EFalse otherwise. + */ + IMPORT_C TBool NotPresent() const; + + /** + * Sets whether the condition requires the object + * to be a present object or not. + * + * @param aNotPresent ETrue, if the object should + * be a not present object. + * EFalse otherwise. + */ + IMPORT_C void SetNotPresent(TBool aNotPresent); + + /** + * Determines whether the condition requires the object + * to be a not placeholder object. + * + * @return ETrue, if not placeholder objects are excluded; + * EFalse otherwise. + */ + IMPORT_C TBool NotPlaceholder() const; + + /** + * Sets whether the condition requires the object + * to be a not placeholder object. + * + * @param aNotPlaceholder ETrue, if the object should + * be a not placeholder object. + * EFalse otherwise. + */ + IMPORT_C void SetNotPlaceholder(TBool aNotPlaceholder); + + /** + * Get possible query's internal optimization flags from condition. + * + * @param aFlaga query's internal optimization flags + * @return last level internal optimization flags + */ + TUint32 InternalQueryOptimizationFlags(TUint32& aFlags); + + /** + * Get required size of serialized buffer when this is serialized. + * + * @return required size of serialized buffer + */ + TUint32 RequiredBufferSize() const; + + /** + * Serialize own data to serialized buffer (correct position must be set + * before calling) and return new position of serialized buffer. + * + * @param aBuffer serialized buffer. + */ + void SerializeL(CMdCSerializationBuffer& aBuffer, + TMdCOffset& aFreespaceOffset) const; + + /** + * Determines whether the condition requires the object + * to be a not placeholder object. + * + * @return ETrue, if not placeholder objects are excluded; + * EFalse otherwise. + */ + IMPORT_C TBool PlaceholderOnly() const; + + /** + * Sets whether the condition requires the object + * to be a not placeholder object. + * + * @param aNotPlaceholder ETrue, if the object should + * be a not placeholder object. + * EFalse otherwise. + */ + IMPORT_C void SetPlaceholderOnly( TBool aPlaceholderOnly ); + +private: + + /** + * Constructor. + * + * @param aCompareMethod Comparison method. + * @param aObjectId ID number of an object. + * @param aObjectDef Object definition. + * @param aObjectGuidHigh object's GUID high part. + * @param aObjectGuidLow object's GUID low part. + */ + CMdEObjectCondition( TObjectConditionCompareMethod aCompareMethod, + TItemId aObjectId, const CMdEObjectDef* aObjectDef, + TInt64 aObjectGuidHigh, TInt64 aObjectGuidLow ); + + /** + * Constructor. + * + * @param aCompareMethod Comparison method. + */ + CMdEObjectCondition( TObjectConditionCompareMethod aCompareMethod ); + + /** + * Second-phase constructor. + */ + void ConstructL(); + + /** + * Second-phase constructor. + * + * @param aString Text string to look for. + * @param aObjectIds object IDs to look for. + */ + void ConstructL( const RArray* aObjectIds, + const TDesC* aString, const TMdEUintRange* aRange ); + +private: + + /** Object definition to match. NULL, if not applicable. */ + const CMdEObjectDef* iObjectDef; + + /** The object's ID. */ + TItemId iObjectId; + + /** The objects' ID. */ + RArray* iObjectIds; + + /** String to match. NULL, if not applicable. */ + HBufC* iString; + + /** Compare method for the string. */ + TObjectConditionCompareMethod iCompareMethod; + + /** + * Object condition flags + * not present + * not placeholder + */ + TUint32 iFlags; + + /** + * Determines confidentiality level of result object. + * By default level is ELevelNormal, which means that + * query returns only non-confidential objects as result. + */ + TObjectConditionConfidentialityLevel iConfidentialityLevel; + + /** Object's GUID high part. */ + TInt64 iGuidHigh; + + /** Object's GUID low part. */ + TInt64 iGuidLow; + + TMdEUintRange* iRange; + TBool iPlaceholdersOnly; + }; + +#endif // __MDEOBJECTCONDITION_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeobjectdef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeobjectdef.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,131 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDEOBJECTDEF_H__ +#define __MDEOBJECTDEF_H__ + + +#include +//#include + +#include + +// Forward declaration +class CMdEPropertyDef; +class CMdCSerializationBuffer; +class CMdENamespaceDef; +class TMdCObjectDef; + +/** + * Object definition. + */ +NONSHARABLE_CLASS(CMdEObjectDef) : public CBase + { +public: + IMPORT_C CMdEObjectDef* ParentL(); + + /** + * Returns the name of the item. + * + * @return name + */ + IMPORT_C const TDesC& Name() const; + + /** + * Returns the number of property definitions. + * + * @return number of property definitions + */ + IMPORT_C TInt PropertyDefCount() const; + + /** + * Returns the property definition at the specified index. + * + * @return property definition + */ + IMPORT_C CMdEPropertyDef& PropertyDefL(TInt aIndex); + + /** + * Returns the property definition with the specified name. + * + * @param aName name + * + * @return property definition; + * or 0 if there is no property definition with the specified name + */ + IMPORT_C CMdEPropertyDef& GetPropertyDefL(const TDesC& aName); + + /** + * Compare this object definition with other object definition. + * + * @param aObjectDef other object definition + * + * @return 0 if objects are same, 1 or more if this is greater than other + * and -1 or less if this is less than other. + */ + IMPORT_C TInt Compare(const CMdEObjectDef& aObjectDef) const; + + /** + * Returns namespacedef where this objectdef belongs to. + * @Return namespacedef where this objectdef belongs to. + */ + IMPORT_C CMdENamespaceDef& NamespaceDef() const; + +public: + static CMdEObjectDef* NewL(const TMdCObjectDef& aObjectDef, CMdCSerializationBuffer& aSchemaBuffer, CMdENamespaceDef& aNamespaceDef ); + + static CMdEObjectDef* NewLC(const TMdCObjectDef& aObjectDef, CMdCSerializationBuffer& aSchemaBuffer, CMdENamespaceDef& aNamespaceDef ); + + /** + * Destructor. + */ + virtual ~CMdEObjectDef(); + + IMPORT_C TDefId Id() const; + + /** + * Returns the property definition with the specified id + * + * @param aId id + * + * @return property definition; + * or NULL if there is no property definition with the specified id + */ + CMdEPropertyDef* GetPropertyDefL(TDefId aId, CMdEObjectDef* aChild = NULL); + +private: + CMdEObjectDef(const TMdCObjectDef& aObjectDef, CMdENamespaceDef& aNamespaceDef); + + CMdEPropertyDef* PropertyDefL(TInt aIndex, CMdEObjectDef* aChild); + + CMdEPropertyDef* GetPropertyDefL(const TDesC& aName, CMdEObjectDef* aChild); + + void ConstructL(CMdCSerializationBuffer& aSchemaBuffer); + + static TInt CompareProperties(const CMdEPropertyDef& aFirst, const CMdEPropertyDef& aSecond); + +private: + const TMdCObjectDef& iObjectDef; + CMdENamespaceDef& iNamespaceDef; + + TPtrC16 iName; + + RPointerArray iPropertyDefs; + }; + +#endif // __MDEOBJECTDEF_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeobjectquery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeobjectquery.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,134 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Interface for object query +* +*/ + + +#ifndef __MDEOBJECTQUERY_H__ +#define __MDEOBJECTQUERY_H__ + + +#include + +/* Forward declarations. */ +class CMdEObject; +class CMdEObjectDef; +class CMdEPropertyDef; +class CMdEObjectDef; +class CMdESession; + +/** + * A query that fetches a set of objects from the metadata engine database. + */ +NONSHARABLE_CLASS(CMdEObjectQuery) : public CMdEQuery + { +public: + + /* Constructors and destructor. */ + + /** + * Destructor. + */ + virtual ~CMdEObjectQuery(); + + + /* Methods. */ + + + /** + * Adds new propertyfilter. Propertyfilters determines which properties + * are included in result. + + * @param aPropertyDef property definition of property which is wanted to + be part of result. + */ + IMPORT_C void AddPropertyFilterL( const CMdEPropertyDef* aPropertyDef ); + + /** + Clears propertyfilters. After call to this function all properties are + returned unless call to AddPropertyFilterL is done. + */ + + IMPORT_C void ResetPropertyFilter(); + + /** + * Returns one of the result objects. + * + * @return The result object that was requested. The query retains + * ownership of the returned object. + */ + IMPORT_C CMdEObject& Result(TInt aIndex) const; + + /** + * Returns query's object definition. + * + * @return object definition. + */ + IMPORT_C CMdEObjectDef& ObjectDef() const; + +public: + RPointerArray& PropertyFilter(); + + RPointerArray* ObjectDefs() const; + +protected: + + /* Constructors. */ + + /** + * Constuctor. + * + * @param aSession Session. + */ + CMdEObjectQuery(CMdESession& aSession, CMdENamespaceDef& aNamespaceDef, + CMdEObjectDef& aObjectDef, RPointerArray* aObjectDefs); + + /** + * Second-phase constructor. + */ + void ObjectQueryConstructL(); + + virtual void DoCancel(); + +private: + + /* Private methods. */ + + +private: + + /** + * Properties to include when fetching results. Empty, if + * all available properties should be fetched. + */ + RPointerArray iPropertyFilters; + + /** + * Query's object definition. + */ + CMdEObjectDef& iObjectDef; + + /** + * Query's object definition. + */ + RPointerArray* iObjectDefs; + + /** + * Speed optimization to drop freetexts from results. + */ + TBool iFreetextsInResult; + }; + +#endif // __MDEOBJECTQUERY_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeorderrule.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeorderrule.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,156 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDEORDERRULE_H__ +#define __MDEORDERRULE_H__ + + +#include + +#include + +/* Forward declarations. */ +class CMdEPropertyDef; +class CMdCSerializationBuffer; + +/** + * TMdEOrderRule defines a rule that is used for sorting the results of a + * query. A query may use multiple order rules. + */ +class TMdEOrderRule + { +public: + + /* Constructors. */ + + /** + * Constructor. + * + * @param aType Type of the order rule. + * @param aAscending ETrue, if the rule order is + * ascending. + */ + IMPORT_C TMdEOrderRule(TOrderRuleType aType, TBool aAscending = ETrue); + + /** + * Constructor. + * + * @param aPropertyDef Property definition. + * @param aAscending ETrue, if the rule order is + * ascending. + */ + IMPORT_C TMdEOrderRule(const CMdEPropertyDef& aPropertyDef, + TBool aAscending = ETrue); + + + /* Methods. */ + + /** + * Returns the type of the order rule. + * + * @return Order rule type constant. + */ + IMPORT_C TOrderRuleType Type() const; + + /** + * Sets the type of the order rule. + * + * @param aType Order rule type constant. + */ + IMPORT_C void SetType(TOrderRuleType aType); + + /** + * Determines whether the ordering is ascending. + * + * @return ETrue ascending order, + * EFalse descending order. + */ + IMPORT_C TBool Ascending() const; + + /** + * Sets the order rule to ascending or descending order. + * + * @param aAscending ETrue ascending order, + * EFalse descending order. + */ + IMPORT_C void SetAscending(TBool aAscending = ETrue); + + /** + * Returns the property definition associated with the order rule. + * + * @return Property definition. NULL, if no property + * definition has been associated with the rule. + */ + IMPORT_C const CMdEPropertyDef* PropertyDef() const; + + /** + * Associates a property definition with the order rule. + * + * @param aPropertyDef Property definition. + */ + IMPORT_C void SetPropertyDef(const CMdEPropertyDef& aPropertyDef); + + /** + * Sets text sorting case sensitive or case insensitive. + * + * @param aCaseSensitive ETrue case sensitive sort. + EFalse case insensitive sort. + */ + IMPORT_C void SetCaseSensitive(TBool aCaseSensitive); + + /** + * Returns type of text comparison, whether case sensitive + * or case insensitive. + * + * @return ETrue case sensitive sort. + * EFalse case insensitive sort. + */ + IMPORT_C TBool CaseSensitive(); + + /** + * Get required size of serialized buffer when this is serialized. + * + * @return required size of serialized buffer + */ + TUint32 RequiredBufferSize() const; + + /** + * Serialize own data to serialized buffer (correct position must be set + * before calling) and return new position of serialized buffer. + * + * @param aBuffer serialized buffer. + */ + void SerializeL(CMdCSerializationBuffer& aBuffer, + TMdCOffset& aFreespaceOffset) const; + +private: + + /** Type of the order rule. */ + TOrderRuleType iType; + + /** Optional. */ + const CMdEPropertyDef* iPropertyDef; + + /** Flag for ascending order. */ + TBool iAscending; + + /** Flag for text sorting. Default value is EFalse */ + TBool iCaseSensitive; + }; + +#endif // __MDEORDERRULE_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeproperty.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeproperty.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,330 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDEPROPERTY_H__ +#define __MDEPROPERTY_H__ + +#include + +#include + + +/* Forward declarations. */ +class CMdEObject; +class CMdEPropertyDef; +class CMdCSerializationBuffer; + +/** + * Abstract base class for properties. + */ +NONSHARABLE_CLASS(CMdEProperty) : public CMdEInstanceItem + { + friend class CMdEObject; +public: + /** + * Destructor. + */ + virtual ~CMdEProperty(); + + + /* Methods. */ + + /** + * Constructs a new property. + * + * @param aObject owner object of property + * @param aBuffer buffer where property was serialized + * @return new numeric property + */ + static CMdEProperty* NewL( const CMdEObject& aObject, CMdCSerializationBuffer& aBuffer ); + + /** + * Constructs a new property and leave it on the cleanup stack. + * + * @param aObject owner object of property + * @param aBuffer buffer where property was serialized + * @return new numeric property + */ + static CMdEProperty* NewLC( const CMdEObject& aObject, CMdCSerializationBuffer& aBuffer ); + + /** + * Constructs a new property. + * + * @param aDef property definition + * @param aObject owner object of property + * @return new numeric property + */ + static CMdEProperty* NewL(const CMdEPropertyDef& aDef, const CMdEObject& aObject); + + /** + * Constructs a new property. + * + * @param aDef property definition + * @param aObject owner object of property + * @return new numeric property + */ + static CMdEProperty* NewLC(const CMdEPropertyDef& aDef, const CMdEObject& aObject); + + + /** + * Returns the definition of the integer property. + * + * @return property definition + */ + IMPORT_C const CMdEPropertyDef& Def() const; + + /** + * Returns the object which the property belongs to. + * + * @return Object. + */ + IMPORT_C const CMdEObject& Object() const; + + /** + * @return ETrue if property was modified, + * EFalse otherwise + */ + IMPORT_C TBool Modified() const; + + + /** value getters */ + + /** + * Returns the TBool value of the property. + * @return value + */ + IMPORT_C TBool BoolValueL() const; + + /** + * Returns the TInt8 value of the property. + * @return value + */ + IMPORT_C TInt8 Int8ValueL() const; + + /** + * Returns the TUint8 value of the property. + * @return value + */ + + IMPORT_C TUint8 Uint8ValueL() const; + + /** + * Returns the TInt16 value of the property. + * @return value + */ + IMPORT_C TInt16 Int16ValueL() const; + + /** + * Returns the TUint16 value of the property. + * @return value + */ + IMPORT_C TUint16 Uint16ValueL() const; + + /** + * Returns the TInt32 value of the property. + * @return value + */ + IMPORT_C TInt32 Int32ValueL() const; + + /** + * Returns the TUint32 value of the property. + * @return value + */ + IMPORT_C TUint32 Uint32ValueL() const; + + /** + * Returns the TInt64 value of the property. + * @return value + */ + IMPORT_C TInt64 Int64ValueL() const; + + /** + * Returns the TReal32 value of the property. + * @return value + */ + IMPORT_C TReal32 Real32ValueL() const; + + /** + * Returns the TReal64 value of the property. + * @return value + */ + IMPORT_C TReal64 Real64ValueL() const; + + /** + * Returns the TTime value of the property. + * @return value + */ + IMPORT_C TTime TimeValueL() const; + + /** + * Returns the text value of the property. + * + * @return value + */ + IMPORT_C const TDesC& TextValueL() const; + + + /** setter methods */ + /** + * Sets the TBool value of the property. + * @param aValue New value. + */ + IMPORT_C void SetBoolValueL(TBool aValue); + + /** + * Sets the TInt8 value of the property. + * @param aValue New value. + */ + IMPORT_C void SetInt8ValueL(TInt8 aValue); + + /** + * Sets the TUint8 value of the property. + * @param aValue New value. + */ + IMPORT_C void SetUint8ValueL(TUint8 aValue); + + /** + * Sets the TInt16 value of the property. + * @param aValue New value. + */ + IMPORT_C void SetInt16ValueL(TInt16 aValue); + + /** + * Sets the TUint16 value of the property. + * @param aValue New value. + */ + IMPORT_C void SetUint16ValueL(TUint16 aValue); + + /** + * Sets the TInt32 value of the property. + * @param aValue New value. + */ + IMPORT_C void SetInt32ValueL(TInt32 aValue); + + /** + * Sets the TUint32 value of the property. + * @param aValue New value. + */ + IMPORT_C void SetUint32ValueL(TUint32 aValue); + + /** + * Sets the TInt64 value of the property. + * @param aValue New value. + */ + IMPORT_C void SetInt64ValueL(TInt64 aValue); + + /** + * Sets the TReal32 value of the property. + * @param aValue New value. + */ + IMPORT_C void SetReal32ValueL(TReal32 aValue); + + /** + * Sets the TReal64 value of the property. + * @param aValue New value. + */ + IMPORT_C void SetReal64ValueL(TReal64 aValue); + + /** + * Sets the TTime value of the property. + * @param aValue New value. + */ + IMPORT_C void SetTimeValueL(const TTime& aValue); + + /** + * Sets the text value of the property. + * + * @param aValue New value. + */ + IMPORT_C void SetTextValueL(const TDesC& aValue); + + + /** + * Return required size for property serialization + * + * @return size of serialized property + */ + TUint32 RequiredBufferSize() const; + + /** + * Serialize object + * + * @param aBuffer buffer where serialized object should go + */ + TMdCOffset SerializeL(CMdCSerializationBuffer& aBuffer, TMdCOffset aFreespaceOffset) const; + +private: + + TUint8 ModFlags() const; + + void SetRemoved(); + TBool Removed(); + + void ClearFlags(); + + void SetModified(); + + + /* Constructors. */ + + /** + * Constructor. + * + * @param aDef Definition of the new property. + * @param aObject object where this property belongs to. + */ + CMdEProperty(const CMdEPropertyDef& aDef, const CMdEObject& aObject); + + /** + * Second-phase constructor. + * + * @param aSource Source of the new property. + */ + void BaseConstructL(); + + + /* Methods. */ + + /** + * Check if property has value is between min and max + * and leave if not! + */ +#ifdef _DEBUG + void CheckValueMinMaxL( const TMdCValueUnion& aValue ) const; +#endif + + void DoSetTextValueL(const TDesC& aValue); + + TMdEInstanceType InstanceType() const; + +protected: + /** property modifications flags */ + TUint8 iModFlags; + +private: + /** Property definition. */ + const CMdEPropertyDef& iDef; + + /** Object this property belongs to. */ + const CMdEObject& iObject; + + /** Value. */ + TMdCValueUnion iValue; + }; + +#endif // __MDEPROPERTY_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdepropertycondition.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdepropertycondition.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,116 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Represent property condition +* +*/ + +#ifndef __MDEPROPERTYCONDITION_H__ +#define __MDEPROPERTYCONDITION_H__ + +#include + +/* Forward declarations. */ +class CMdEPropertyDef; +class CMdCSerializationBuffer; + +/** + * CMdEPropertyCondition is the base class for all property conditions. + * Instances of CMdEPropertyCondition and its subclasses are always associated + * with a property definition. + */ +NONSHARABLE_CLASS(CMdEPropertyCondition) : public CMdECondition + { +public: + + /* Types. */ + + /** + * Two-phased constructor. + */ + static CMdEPropertyCondition* NewL( const CMdEPropertyDef& aPropertyDef ); + + /** + * Two-phased constructor. + */ + static CMdEPropertyCondition* NewLC( const CMdEPropertyDef& aPropertyDef ); + + + /** + * Destructor. + */ + virtual ~CMdEPropertyCondition(); + + + /* Methods. */ + + /** + * Returns the property definition of the condition. + * + * @return Property definition. + */ + IMPORT_C const CMdEPropertyDef& PropertyDef() const; + + /** + * Get possible query's internal optimization flags from condition. + * + * @param aFlaga query's internal optimization flags + * @return last level internal optimization flags + */ + TUint32 InternalQueryOptimizationFlags(TUint32& aFlags); + + /** + * Get required size of serialized buffer when this is serialized. + * + * @return required size of serialized buffer + */ + virtual TUint32 RequiredBufferSize() const; + + /** + * Serialize own data to serialized buffer (correct position must be set + * before calling) and return new position of serialized buffer. + * + * @param aBuffer serialized buffer. + */ + virtual void SerializeL(CMdCSerializationBuffer& aBuffer, + TMdCOffset& aFreespaceOffset) const; + +protected: + + /** + * Constructor for a condition that tests the existence of properties. + * + * @param aPropertDef Property definition. + */ + CMdEPropertyCondition(const CMdEPropertyDef& aPropertyDef); + + /** + * Second-phase constructor. + */ + void ConstructL(); + + /** + * Constructor that sets the condition type as well. + * + * @param aType Type of the condition node. + */ + CMdEPropertyCondition(TConditionType aConditionType, + const CMdEPropertyDef& aPropertyDef); + +protected: + + /** The property this condition operates on. */ + const CMdEPropertyDef& iPropertyDef; + }; + +#endif // __MDEPROPERTYCONDITION_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdepropertydef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdepropertydef.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,135 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDEPROPERTYDEF_H__ +#define __MDEPROPERTYDEF_H__ + +#include + +// Forward declaration +class CMdCSerializationBuffer; +class CMdEObjectDef; +class CMdENamespaceDef; +class TMdCPropertyDef; + +/** + * Class for property definitions. + */ +NONSHARABLE_CLASS(CMdEPropertyDef) : public CBase + { +public: + /** + * Returns the name of the item. + * + * @return name + */ + IMPORT_C const TDesC& Name() const; + + /** + * Returns the type of the property. + * + * @return property type + */ + IMPORT_C TPropertyType PropertyType() const; + + /** + * Returns whether the property is read only. + * + * @return ETrue, if the property is read only; + * EFalse, otherwise + */ + IMPORT_C TBool ReadOnly() const; + + /** + * Returns whether the property is mandatory. + * + * @return ETrue, if the property is mandatory; + * EFalse, otherwise + */ + IMPORT_C TBool Mandatory() const; + + /** + * Compare this property definition with other property definition. + * + * @param aPropertyDef other property definition + * + * @return 0 if properties are same, 1 or more if this is greater than other + * and -1 or less if this is less than other. + */ + IMPORT_C TInt Compare(const CMdEPropertyDef& aPropertyDef) const; + + + IMPORT_C CMdEObjectDef& ObjectDef() const; + + IMPORT_C TInt32 MinInt32ValueL() const; + + IMPORT_C TInt32 MaxInt32ValueL() const; + + IMPORT_C TUint32 MinUint32ValueL() const; + + IMPORT_C TUint32 MaxUint32ValueL() const; + + IMPORT_C TInt64 MinInt64ValueL() const; + + IMPORT_C TInt64 MaxInt64ValueL() const; + + IMPORT_C TReal MinRealValueL() const; + + IMPORT_C TReal MaxRealValueL() const; + + IMPORT_C TTime MinTimeValueL() const; + + IMPORT_C TTime MaxTimeValueL() const; + + IMPORT_C TInt MinTextLengthL() const; + + IMPORT_C TInt MaxTextLengthL() const; + + IMPORT_C CMdENamespaceDef& NamespaceDef() const; + +public: + static CMdEPropertyDef* NewL(const TMdCPropertyDef& aPropertyDef, CMdCSerializationBuffer& aSchemaBuffer, CMdEObjectDef& aObjectDef); + + static CMdEPropertyDef* NewLC(const TMdCPropertyDef& aPropertyDef, CMdCSerializationBuffer& aSchemaBuffer, CMdEObjectDef& aObjectDef); + + void SerializeL(CMdCSerializationBuffer& aBuffer) const; + + /** + * Destructor. + */ + virtual ~CMdEPropertyDef(); + + TDefId Id() const; + void SetId(TDefId aId); + + TDefId ObjectDefId() const; + +private: + CMdEPropertyDef(const TMdCPropertyDef& aPropertyDef, CMdEObjectDef& aObjectDef); + + void ConstructL(CMdCSerializationBuffer& aSchemaBuffer ); + +private: + + const TMdCPropertyDef& iPropertyDef; + CMdEObjectDef& iObjectDef; + + TPtrC16 iName; + }; + +#endif // __MDEPROPERTYDEF_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdequery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdequery.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,674 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Query base class +* +*/ + + +#ifndef __MDEQUERY_H__ +#define __MDEQUERY_H__ + + +#include +#include + +#include + + +/* Forward declarations. */ +class CMdESession; +class CMdEQuery; +class CMdELogicCondition; +class TMdEOrderRule; +class CMdENamespaceDef; +class CMdEItem; +class CMdEInstanceItem; + + +/** + * Observer interface for MdE database queries. + * + * Example of doing a query to metadata database: + * + * A class needs to implement MMdEQueryObserver interface if it is going to do a query to MdE database. + * + * class CMdEQueryExample : public MMdEQueryObserver + * { + * void HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex, TInt aNewItemCount); + * void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError); + * ... + * CMdESession* iMdeSession; // session to MdE, created before trying to do the query + * CMdEQuery* iQuery; + * }; + * + * void CMdEQueryExample::DoQuery() + * { + * CMdENamespaceDef& defNS = iMdeSession->GetDefaultNamespaceDefL(); + * + * // In this function we create a query with following conditions: + * // Right object in relation must be a location object. + * // Left object in relation must have id 6. + * + * // First create an object query. We want to find location objects so let's give that + * // as a condition to the query. + * CMdEObjectDef& rightObjDef = defNS.GetObjectDefL( + * MdeConstants::Location::KLocationObject ); + * iQuery = iMdeSession->NewObjectQueryL( defNS, rightObjDef, this ); + * + * // Result mode EQueryResultModeItem means we want the query to return items. + * // Other options are: EQueryResultModeId, EQueryResultModeCount, + * // EQueryResultModeDistinctValues and EQueryResultModeObjectWithFreetexts. + * iQuery->SetResultMode( EQueryResultModeItem ); + * + * // ELogicConditionOperatorAnd means we want all conditions to be true. + * iQuery->Conditions().SetOperator( ELogicConditionOperatorAnd ); + * + * // Add a relation condition to the query. The location object is the right side object of + * // the relation. + * CMdERelationCondition& filterCond = iQuery->Conditions(). + * AddRelationConditionL( ERelationConditionSideRight ); + * + * // The object on the left side of the relation must have ID 6. + * filterCond.LeftL().AddObjectConditionL( 6 ); + * + * iQuery->FindL( 10, 1 ); // Start the query! The first parameter is maximum number of result items. + * // The second parameter is number of results per observer + * // notification. This query returns maximum of 10 location items + * // and gives a notification (HandleQueryNewResults) for each. + * } + * + * void CMdEQueryExample::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ) + * { + * // query is completed + * if( aQuery.Count() > 0 && aError == KErrNone ) + * { + * // some items were found! + * } + * } + * + * void CMdEQueryExample::HandleQueryNewResults(CMdEQuery& aQuery, TInt aFirstNewItemIndex, + * TInt aNewItemCount) + * { + * // query is not yet completed but new results were found + * } + * + * @see CMdEQuery::FindL + */ +class MMdEQueryObserver + { +public: + + /** + * Called to notify the observer that new results have been received + * in the query. + * + * @param aQuery Query instance that received new results. + * @param aFirstNewItemIndex Index of the first new item that was added + * to the result item array. + * @param aNewItemCount Number of items added to the result item + * array. + */ + virtual void HandleQueryNewResults(CMdEQuery& aQuery, + TInt aFirstNewItemIndex, + TInt aNewItemCount) = 0; + + + + /** + * Called to notify the observer that the query has been completed, + * or that an error has occured. + * + * @param aQuery Query instance. + * @param aError KErrNone, if the query was completed + * successfully. Otherwise one of the system-wide error + * codes. + */ + virtual void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError) = 0; + + }; + + +/** Default count for finding items. */ +static const TUint KMdEQueryDefaultMaxCount = KMaxTUint; + + +/** + * MdE database query. This is the abstract base class for all metadata engine + * database queries. Instances of a query class own all the result items + * fetched from the database; when the query instance is destroyed, the + * results will be destroyed as well. + * + * If a query is restarted by calling FindL() after a previous query operation + * has been completed, any new results are appended to the end of the result + * item list. The previous results are not affected by subsequent calls to + * FindL(). + * + * The query parameters (order rules, search conditions, property filters) + * must be configured before FindL() is called. FindL() may be called several + * times, but the query parameters that were in effect for the first Find() + * are used for all FindL()s. + */ + +NONSHARABLE_CLASS(CMdEQuery) : public CBase + { +public: + + /** + * Query states. + */ + enum TState + { + EStateFirst = 0x0000, + + /** The query has been created. The query parameters are specified + during this state. */ + EStateNew, + + /** The query has been started with Find(). All the results received + so far are available to the user. */ + EStateSearching, + + /** All the results have been found and they are available to + the user. */ + EStateCompleted, + + /** An error has occured. */ + EStateError, + + EStateLast + }; + + /* Constants. */ + + /* Constructors and destructor. */ + + /** + * Destructor. + */ + virtual ~CMdEQuery(); + + + /* Methods. */ + + /** + * Returns the type of the query. + * + * @return Query type. + */ + IMPORT_C TQueryType Type() const; + + /** + * Returns the namespace definition of the query. + * + * @return Namespace definition. + */ + IMPORT_C CMdENamespaceDef& NamespaceDef() const; + + /** + * Returns the session of the query. + * + * @return Session. + */ + IMPORT_C CMdESession& Session() const; + + /** + * Returns the root of the condition tree. + * + * @return Logic condition that acts as the root of the search conditions + * tree. + */ + IMPORT_C CMdELogicCondition& Conditions() const; + + /** + * Appends a new result ordering rule into the end of list of order rules. + * + * Example: + * CMdEObjectDef& objdef = iDefaultNamespaceDef->GetObjectDefL( MdeConstants::Object::KBaseObject ); + * CMdEPropertyDef& propDef = objdef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty ); + * TMdEOrderRule rule( *propDef, ETrue ); + * iQuery->AppendOrderRuleL( rule ); // iQuery is CMdEQuery* + * + * @param aRule Order rule. + */ + IMPORT_C void AppendOrderRuleL(const TMdEOrderRule& aRule); + + /** + * Insert a new result ordering rule into the list of order rules. + * The first rule is at position zero. + * + * Example: + * CMdEObjectDef& objdef = iDefaultNamespaceDef->GetObjectDefL( MdeConstants::Object::KBaseObject ); + * CMdEPropertyDef& propDef = objdef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty ); + * TMdEOrderRule rule( *propDef, ETrue ); + * iQuery->InsertOrderRuleL( rule, 0 ); // iQuery is CMdEQuery* + * + * @param aRule Order rule. + * @param aPos Position in the list of rules to insert into. + */ + IMPORT_C void InsertOrderRuleL(const TMdEOrderRule& aRule, TInt aPos); + + /** + * Returns the number of order rules currently defined. + * + * @return Number of order rules. + */ + IMPORT_C TInt OrderRuleCount() const; + + /** + * Removes an order rule. + * + * @param aIndex Index of the rule to remove. + */ + IMPORT_C void RemoveOrderRule(TInt aIndex); + + /** + * Gets an order rule. + * + * @param aIndex Index of the rule to return. + * @param aRule Reference to the TMdEOrderRule where the rule is stored. + */ + IMPORT_C TMdEOrderRule OrderRule(TInt aIndex) const; + + /** + * Starts a query operation and returns immediately. The observers of + * the query instance will be notified when the query is completed, or + * if it fails. The query parameters (order rules, search conditions, + * property filters) must be configured before FindL() is called. + * + * The caller can perform a find operation in several steps by using a + * sufficiently small maximum number of result items. Notifications + * about progress of query is returned is steps, continuing the previously + * started find operation. + * + * @param aMaxCount Maximum number of result items. Defaults to + * unlimited. + * @param aNotifyCount Maximum number of results per observer + * notification. Defaults to unlimited. + * + * @leave KErrNotReady The query is in the Searching state. + * + * @panic TMdEPanic::EQueryStateIllegalOperation + * Query is in a state that prohibits calling this method. + */ + IMPORT_C void FindL(TUint aMaxCount = KMdEQueryDefaultMaxCount, + TUint aNotifyCount = KMdEQueryDefaultMaxCount); + + /** + * Cancels the currently running query operation. Does nothing if the + * query is not currently running. + */ + IMPORT_C void Cancel(); + + /** + * Returns whether the query has been completed. + * + * @return ETrue, if the query is not currently running. + * Otherwise EFalse. + */ + IMPORT_C TBool IsComplete() const; + + /** + * Returns the error code of the latest completed query. The same error + * code has been passed to the query observer. + * + * @return Error code. + */ + IMPORT_C TInt Error() const; + + /** + * Returns the current state of the query. + * + * @return Query state. + */ + IMPORT_C TState State() const; + + /** + * Returns the number of received result items. This can be called at any + * time during the query instance's lifetime. + * + * @return The number of results. + */ + IMPORT_C TInt Count() const; + + + /** + * Returns one of the result items. + * + * Example: + * void CExampleClass::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ) + * { + * CMdEItem& mdeItem = aQuery.ResultItem( 0 ); + * ... + * } + * + * @param aIndex index of the returned item. + * @panics if aIndex is out of bounds + * @return Result item. + */ + IMPORT_C CMdEItem& ResultItem(TInt aIndex) const; + + /** + * Returns one of the result ids. + * + * Example: + * void CExampleClass::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ) + * { + * TItemId mdeItemId = aQuery.ResultId( 0 ); + * ... + * } + * + * @param aIndex index of the returned id. + * @panics if aIndex is out of bounds + * @return Result id. + */ + IMPORT_C TItemId ResultId(TInt aIndex) const; + + /** + * Returns all of the result ids. + * + * @return Result ids. + */ + IMPORT_C const RArray& ResultIds() const; + + /** + * Returns one of the result items. Ownership of the item is transferred + * to the caller. The results array element at the specified index will + * still point to the result item. + * + * @param aIndex Result index. + * + * @return Pointer to result item. + */ + IMPORT_C CMdEItem* TakeOwnershipOfResult(TInt aIndex); + + /** + * Determines whether the query owns a result item. + * @param aIndex index of the result item which ownership is checked. + * @panics if aIndex is out of bounds + * @return ETrue, if the query owns the item. Otherwise + * EFalse. + */ + IMPORT_C TBool OwnsResult(TInt aIndex); + + + /** + * Adds a new observer. + * + * @param aObserver to add. + */ + IMPORT_C void AddObserverL(MMdEQueryObserver& aObserver); + + /** + * Removes an observer. + * + * @param aObserver to remove. + */ + IMPORT_C void RemoveObserver(MMdEQueryObserver& aObserver); + + /** + * Sets type of query results. Whether whole items or only IDs. + * Default value is EModeItem. + * + * @param aMode Determines type of query results. Can be set of + * instance items or set of item IDs + */ + IMPORT_C void SetResultMode( TQueryResultMode aMode ); + + /** + * Returns type of query results, whether whole items or only IDs. + * + * @return Type of query results. + */ + IMPORT_C TQueryResultMode ResultMode() const; + + /** + * Returns result object item + * + * @return Result object item. + */ + IMPORT_C CMdEItem& ResultObjectItem() const; + + /** + * Returns one of the result distinct values + * + * @return Result distinct value + */ + IMPORT_C TPtrC16 ResultDistinctValue(TInt aIndex) const; + + /** + * Returns order rules + * + * @return Order rules + */ + RArray& OrderRules(); + + void SetQueryId( TUint32 aQueryId ) const + { + iQueryId = aQueryId; + } + + TUint32 GetQueryId() const + { + return iQueryId; + } + +protected: + + /* Constructors. */ + + /** + * Constructor. Note that new queries should be created using the factory + * methods in CMdESession. + * + * @param aType Type of the query. + * @param aSession + */ + CMdEQuery(TQueryType aType, CMdESession& aSession, CMdENamespaceDef& aNamespaceDef); + + /** + * Second-phase constructor. Creates the root node of the conditions tree. + */ + void QueryConstructL(); + + + /* Implementation methods. */ + + /** + * As Find(). + */ + virtual void DoFindL(TUint aMaxCount, TUint aNotifyCount) = 0; + + /** + * As Cancel(). + */ + virtual void DoCancel(); + + + /* Notification methods. */ + + /** + * Appends new item results to the results array. This query instance takes + * ownership of the items. + * + * If a leave occurs, the query won't take ownership of any of the new + * result items. The caller is responsible for destroying the result + * items in this case. + * + * This operation is atomic: either all of the new results are added to + * the results array and the query takes ownership of them, or none of + * results are added to the results array. + * + * @param aNewResults contains result items + */ + virtual void NotifyNewResultsL(const RPointerArray& aNewResults); + + /** + * Appends new ID results to the results array. + * + * @param aNewResults contains results from ID query + */ + virtual void NotifyNewResultsL(const RArray& aNewResults); + + /** + * Appends distinct value results to the results array. + * + * @param aResults contains results from distinct value query + */ + virtual void NotifyNewResultsL( const CDesCArray& aNewResults ); + + + /** + * Gets result from count query. + * + * @param aResults contains result from count query + */ + virtual void NotifyNewResults(TUint32 aResult); + + /** + * Notifies observers that the query was completed. + */ + virtual void NotifyCompleted(TInt aError); + + + /* Utility methods. */ + + /** + * Sets the state of the query. + * + * @param aState Query state. + */ + void SetState(TState aState); + + /** + * Panics if the state of the query is the specified state. + * + * @param aState Query state. + * + * @panic TMdEPanic::EQueryStateIllegalOperation The query was not + * in the given state. + */ + void AssertInState(TState aState); + + /** + * Panics if the state of the query is not the specified state. + * + * @param aState Query state. + * + * @panic TMdEPanic::EQueryStateIllegalOperation The query was in the + * given state. + */ + void AssertNotInState(TState aState); + + +private: + + /* Private data structures. */ + + // Result item for instances + struct TResult + { + /** Result item. */ + CMdEItem* iItem; + + /** Query has the ownership of the result item. */ + TBool iOwned; + + /** Constructor for initializing the struct. */ + TResult(CMdEItem* aItem) : iItem(aItem), iOwned(EFalse) {} + }; + + +private: + + /* Private methods. */ + + /** + * Appends new result items into the results array. Does not transfer + * ownership of the new results to the query. + * + * @param aNewResults Array of result items. + */ + void AppendResultsL(const RPointerArray& aNewResults); + + void AppendResultsL(const RArray& aNewResults); + + /*void AppendResultsL(CMdEInstanceItem* aObjectResult, + const RPointerArray& aRelationResults, + const RPointerArray& aEventResults);*/ + + void AppendResultsL(const CDesCArray& aNewResults); + +private: + + mutable TUint32 iQueryId; + + /** The session of the query. */ + CMdESession& iSession; + + /** The namespace definition of the query */ + CMdENamespaceDef& iNamespaceDef; + + /** Type of the query. */ + TQueryType iType; + + /** Type of results. */ + TQueryResultMode iResultMode; + + /** State of the query. */ + TState iState; + + /** Latest error code. */ + TInt iError; + + /** Root node of the conditions tree. Always present. */ + CMdELogicCondition* iConditions; + + /** Array of result ordering rules. */ + RArray iOrderRules; + + /** Instance result items. */ + RArray iResults; + + /** ID result items. */ + RArray iIdResults; + + /** Instance result object item */ + TResult iObjectResult; + + /** Results of count query */ + TInt iCountResult; + + /** Observers. */ + RPointerArray iObservers; + + CDesCArray* iDistinctResults; + + TBool iDestroyed; + }; + + +// includes only for client more convinient usage + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +// end + +#endif // __MDEQUERY_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mderange.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mderange.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,50 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Used for representing value ranges of various types. +* +*/ + + +#ifndef __MDERANGE_H__ +#define __MDERANGE_H__ + +#include + +class CMdCSerializationBuffer; + +enum TMdERangeType + { + EMdERangeTypeAny = 0, + EMdERangeTypeEqual, + EMdERangeTypeNotEqual, + EMdERangeTypeLess, + EMdERangeTypeLessOrEqual, + EMdERangeTypeGreater, + EMdERangeTypeGreaterOrEqual, + EMdERangeTypeBetween, + EMdERangeTypeNotBetween + }; + +class TMdESerializeRange + { + public: + static void SerializeL( CMdCSerializationBuffer& aBuffer, TMdERangeType aType, + void* aMin, void* aMax, TInt aValueSize ); + static TUint32 RequiredBufferSize( TInt aValueSize ); + }; + +#include "mderange.inl" + +#endif // __MDERANGE_H__ + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mderange.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mderange.inl Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,345 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ +#ifndef MDERANGE_INL_ +#define MDERANGE_INL_ + +/** + * The TMdERange template is used for representing value ranges of various + * types. A range is composed of an upper limit, a lower limit, and type + * that describe how the limits are to be interpreted. + * + * Value ranges are used with CMdERangePropertyCondition nodes to define + * a range of values that the condition matches. Basic operations such as + * "greater than", "equals to", and "between" are all implemented using + * value ranges. There are also more complex ranges that can be used in + * loops. + * + * TMdERange is the base template for many different kind of value ranges. + * However, all ranges can be processed with the Min(), Max(), and Type() + * methods, regardless of any extra data defined by a specialized range type. + */ +template +class TMdERange + { +public: + + /* Methods. */ + + /** + * Returns the lower limit of the range. + * + * @return The minimum value. + */ + inline const T& Min() const + { + return iMin; + } + + /** + * Returns the upper limit of the range. + * + * @return The maximum value. + */ + inline const T& Max() const + { + return iMax; + } + + /** + * Returns the type of the range. + * + * @return type + */ + inline const TMdERangeType& Type() const + { + return iType; + } + + /** + * Sets the lower limit of the range. + * + * @param aMin The minimum value. + */ + inline void SetMin(const T& aMin) + { + iMin = aMin; + } + + /** + * Sets the upper limit of the range. + * + * @param aMax The maximum value. + */ + inline void SetMax(const T& aMax) + { + iMax = aMax; + } + + /** + * Sets the type of the range. + * + * @param aType The new type. + */ + inline void SetType(TMdERangeType aType) + { + iType = aType; + } + + /** + * Get required size of serialized buffer when this is serialized. + * + * @return required size of serialized buffer + */ + TUint32 RequiredBufferSize() + { + return TMdESerializeRange::RequiredBufferSize( sizeof(T) ); + } + + /** + * Serialize own data to serialized buffer (correct position must be set + * before calling) and return new position of serialized buffer. + * + * @param aBuffer serialized buffer. + */ + void SerializeL(CMdCSerializationBuffer& aBuffer) + { + TMdESerializeRange::SerializeL( aBuffer, iType, &iMin, &iMax, sizeof(T) ); + } + + /* Constructor. */ + TMdERange(const T& aMin, const T& aMax, TMdERangeType aType = EMdERangeTypeAny) + : iType(aType), iMin(aMin), iMax(aMax) + { + } + + /** + * Test if value is in the range. + * + * @param aValue Tested value. + */ + TBool InRange(const T& aValue) + { + switch( iType ) + { + case EMdERangeTypeAny: + { + // always match + return ETrue; + } + case EMdERangeTypeEqual: + { + return ( aValue == iMin ); + } + case EMdERangeTypeNotEqual: + { + return ( aValue != iMin ); + } + case EMdERangeTypeLess: + { + return ( aValue < iMax ); + } + case EMdERangeTypeLessOrEqual: + { + return ( aValue <= iMax ); + } + case EMdERangeTypeGreater: + { + return ( aValue > iMin ); + } + case EMdERangeTypeGreaterOrEqual: + { + return ( aValue >= iMin ); + } + case EMdERangeTypeBetween: + { + // edges belong to range + return ( ( iMin <= aValue ) && ( aValue <= iMax ) ); + } + case EMdERangeTypeNotBetween: + { + // edges belong to range + return ( ( iMin > aValue ) || ( aValue > iMax ) ); + } + default: + { + // should never happen + return EFalse; + } + } + } + +private: + + /** Type. */ + TMdERangeType iType; + + /** Beginning of the range. */ + T iMin; + + /** End of the range. */ + T iMax; + }; + + +/** + * Value range that covers everything. + */ +template +class TMdEAny : public TMdERange + { +public: + TMdEAny() + : TMdERange(T(0), T(0), EMdERangeTypeAny) {} + }; + + +/** + * TMdEEquals defines a range that contains only a single point. Thus it + * functions as an equivalence operator. + */ +template +class TMdEEqual : public TMdERange + { +public: + TMdEEqual(const T& aValue) + : TMdERange(aValue, aValue, EMdERangeTypeEqual) {} + }; + +/** + * Range that contains all values except for one point. + */ +template +class TMdENotEqual : public TMdERange + { +public: + TMdENotEqual(const T& aValue) + : TMdERange(aValue, aValue, EMdERangeTypeNotEqual) {} + }; + +/** + * Less-than range. + */ +template +class TMdELess : public TMdERange + { +public: + TMdELess(const T& aLimit) + : TMdERange(T(0), aLimit, EMdERangeTypeLess) {} + }; + + +/** + * Less-than-or-equal-to range. + */ +template +class TMdELessEqual : public TMdERange + { +public: + TMdELessEqual(const T& aLimit) + : TMdERange(T(0), aLimit, EMdERangeTypeLessOrEqual) {} + }; + + +/** + * Greater-than range. + */ +template +class TMdEGreater : public TMdERange + { +public: + TMdEGreater(const T& aLimit) + : TMdERange(aLimit, T(0), EMdERangeTypeGreater) {} + }; + + +/** + * Greater-than-or-equal-to range. + */ +template +class TMdEGreaterEqual : public TMdERange + { +public: + TMdEGreaterEqual(const T& aLimit) + : TMdERange(aLimit, T(0), EMdERangeTypeGreaterOrEqual) {} + }; + + +/** + * Between range. The upper and lower limits are inclusive by default. + */ +template +class TMdEBetween : public TMdERange + { +public: + TMdEBetween(const T& aMin, const T& aMax) + : TMdERange(aMin, aMax, EMdERangeTypeBetween) {} + }; + + +/** + * Not-between range. The upper and lower limits are inclusive by + * default. + */ +template +class TMdENotBetween : public TMdERange + { +public: + TMdENotBetween(const T& aMin, const T& aMax) + : TMdERange(aMin, aMax, EMdERangeTypeNotBetween) {} + }; + + +/* Types that will be used in practice. */ + +/** Value range of type TInt. */ +typedef TMdERange TMdEIntRange; + +/** Value range of type TUint. */ +typedef TMdERange TMdEUintRange; + +/** Value range of type TInt64. */ +typedef TMdERange TMdEInt64Range; + +/** Value range of type TReal. */ +typedef TMdERange TMdERealRange; + +/** Value range of type TTime. */ +typedef TMdERange TMdETimeRange; + + +/** Macro for defining the real typenames. Makes four versions of each + range type. */ +#define MDE_DEFINE_ACTUAL_RANGE_TYPES(RangeName) \ + typedef TMdE##RangeName TMdEInt##RangeName; \ + typedef TMdE##RangeName TMdEUint##RangeName; \ + typedef TMdE##RangeName TMdEInt64##RangeName; \ + typedef TMdE##RangeName TMdEReal##RangeName; \ + typedef TMdE##RangeName TMdETime##RangeName; + +MDE_DEFINE_ACTUAL_RANGE_TYPES(Any) +MDE_DEFINE_ACTUAL_RANGE_TYPES(Equal) +MDE_DEFINE_ACTUAL_RANGE_TYPES(NotEqual) +MDE_DEFINE_ACTUAL_RANGE_TYPES(Less) +MDE_DEFINE_ACTUAL_RANGE_TYPES(LessEqual) +MDE_DEFINE_ACTUAL_RANGE_TYPES(Greater) +MDE_DEFINE_ACTUAL_RANGE_TYPES(GreaterEqual) +MDE_DEFINE_ACTUAL_RANGE_TYPES(Between) +MDE_DEFINE_ACTUAL_RANGE_TYPES(NotBetween) + +#undef MDE_DEFINE_ACTUAL_RANGE_TYPES + +#endif /*MDERANGE_INL_*/ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mderangepropertycondition.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mderangepropertycondition.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,171 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Represents value range of property condition +* +*/ + + +#ifndef __MDERANGEPROPERTYCONDITION_H__ +#define __MDERANGEPROPERTYCONDITION_H__ + + +#include +#include + +/* Forward declarations. */ +class CMdEPropertyDef; +class CMdCSerializationBuffer; + +class TMdESerializeRangePropertyCondition +{ +public: + static void SerializeL( CMdCSerializationBuffer& aBuffer, + const CMdEPropertyCondition& aPropertyCondition, + TMdERangeType aType, const void* aMin, const void* aMax, + TInt aValueSize, TMdCOffset& aFreespaceOffset ); + static TUint32 RequiredBufferSize( TInt aValueSize ); +}; + +/** + * Instances of CMdERangePropertyCondition are associated with a specific + * property definition. + */ +template +NONSHARABLE_CLASS(CMdERangePropertyCondition) : public CMdEPropertyCondition + { +public: + /* Constructors and destructor. */ + + /** + * Two-phased constructor. + */ + static CMdERangePropertyCondition* NewL( const CMdEPropertyDef& aPropertyDef, + const TMdERange& aValueRange) + { + CMdERangePropertyCondition* self = + CMdERangePropertyCondition::NewLC( aPropertyDef, aValueRange ); + CleanupStack::Pop( self ); + return self; + } + + /** + * Two-phased constructor. + */ + static CMdERangePropertyCondition* NewLC( const CMdEPropertyDef& aPropertyDef, + const TMdERange& aValueRange) + { + CMdERangePropertyCondition* self = + new ( ELeave ) CMdERangePropertyCondition( aPropertyDef, aValueRange ); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + + + /** + * Destructor. + */ + virtual ~CMdERangePropertyCondition() + { + } + + + /* Methods. */ + + /** + * Returns the range of the property condition. + * + * @return Range. + */ + inline const TMdERange& Range() const + { + return iRange; + } + + /** + * Get possible query's internal optimization flags from condition. + * + * @param aFlaga query's internal optimization flags + * @return last level internal optimization flags + */ + TUint32 InternalQueryOptimizationFlags(TUint32& aFlags) + { + return CMdEPropertyCondition::InternalQueryOptimizationFlags(aFlags); + } + + /** + * Get required size of serialized buffer when this is serialized. + * + * @return required size of serialized buffer + */ + TUint32 RequiredBufferSize() const + { + return TMdESerializeRangePropertyCondition::RequiredBufferSize( + sizeof(T) ); + } + + /** + * Serialize own data to serialized buffer (correct position must be set + * before calling) and return new position of serialized buffer. + * + * @param aBuffer serialized buffer. + */ + void SerializeL(CMdCSerializationBuffer& aBuffer, + TMdCOffset& aFreespaceOffset) const + { + TMdESerializeRangePropertyCondition::SerializeL( aBuffer, *this, iRange.Type(), + &iRange.Min(), &iRange.Max(), sizeof(T), aFreespaceOffset ); + } + +protected: + + /* Utility methods. */ + + +private: + + /* Private methods. */ + /** + * Constructor. + * + * @param aType type of the condition node + */ + CMdERangePropertyCondition(const CMdEPropertyDef& aPropertyDef, + const TMdERange& aValueRange) + : CMdEPropertyCondition(KConditionType, aPropertyDef), + iRange(aValueRange) + { + } + +private: + + /** The value range that is valid for the condition. */ + TMdERange iRange; + }; + + +/* The actual RangePropertyConditions. */ + +#define MDE_DEFINE_RANGE_CONDITION(RangeType) \ + typedef CMdERangePropertyCondition CMdE##RangeType##RangePropertyCondition; + +MDE_DEFINE_RANGE_CONDITION(Int) +MDE_DEFINE_RANGE_CONDITION(Int64) +MDE_DEFINE_RANGE_CONDITION(Uint) +MDE_DEFINE_RANGE_CONDITION(Real) +MDE_DEFINE_RANGE_CONDITION(Time) + +#undef MDE_DEFINE_RANGE_CONDITION + +#endif // __MDERANGEPROPERTYCONDITION_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mderelation.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mderelation.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,261 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDERELATION_H__ +#define __MDERELATION_H__ + + +#include + + +class CMdERelationDef; +class CMdCSerializationBuffer; +class CMdENamespaceDef; + + +NONSHARABLE_CLASS(TMdERelation) + { + public: + + TMdERelation(); + + IMPORT_C TItemId Id() const; + + /** + * Returns the definition of the relation. + * + * @return relation definition + */ + IMPORT_C CMdERelationDef& DefL() const; + + /** + * Returns the identifier of the left object of the relation. + * + * @return object identifier + */ + IMPORT_C TItemId LeftObjectId() const; + + /** + * Returns the identifier of the right object of the relation. + * + * @return object identifier + */ + IMPORT_C TItemId RightObjectId() const; + + public: + /** + * Calculates required size for buffer to serialize relation + * + * @return necessary buffer size + */ + TUint32 RequiredBufferSize() const; + + /** + * DeSerialize relation + * + * @param aBuffer buffer where is serialized relation + */ + void DeSerializeL(CMdCSerializationBuffer& aBuffer, CMdENamespaceDef& aNamespaceDef); + + private: + + TItemId iId; + + TItemId iLeftObjectId; + TItemId iRightObjectId; + + /** Relation definition. */ + CMdERelationDef* iDef; + }; + +/** + * Relation between two objects. + */ +NONSHARABLE_CLASS(CMdERelation) : public CMdEInstanceItem + { +public: + + /* Constructors and destructor. */ + + /** + * Create new realation from serialized buffer + * + * @param aBuffer serialized relation + * @return new relation + */ + static CMdERelation* NewL(CMdESession* aSession, CMdCSerializationBuffer& aBuffer, CMdENamespaceDef& aNamespaceDef); + + /** + * Create new realation from serialized buffer and leaves it on stack + * + * @param aBuffer serialized relation + * @return new relation + */ + static CMdERelation* NewLC(CMdESession* aSession, CMdCSerializationBuffer& aBuffer, CMdENamespaceDef& aNamespaceDef); + + + static CMdERelation* NewL(CMdERelationDef& aDef, TItemId aLeftObjectId, + TItemId aRightObjectId, TInt32 aParameter); + + static CMdERelation* NewLC(CMdERelationDef& aDef, TItemId aLeftObjectId, + TItemId aRightObjectId, TInt32 aParameter); + + /** + * Destructor. + */ + virtual ~CMdERelation(); + + + /* Methods. */ + + /** + * Returns the definition of the relation. + * + * @return relation definition + */ + IMPORT_C CMdERelationDef& Def() const; + + /** + * Returns the identifier of the left object of the relation. + * + * @return object identifier + */ + IMPORT_C TItemId LeftObjectId() const; + + /** + * Returns the identifier of the right object of the relation. + * + * @return object identifier + */ + IMPORT_C TItemId RightObjectId() const; + + /** + * Returns the parameter value associated with this relation + * + * @return The parameter value + */ + IMPORT_C TInt32 Parameter() const; + + /** + * Set the parameter. + * @param aParameter new value for parameter + */ + IMPORT_C void SetParameter(TInt32 aParameter); + + /** + * Sets left object ID. + * @param aLeftObjectId left object ID + */ + IMPORT_C void SetLeftObjectIdL( TItemId aLeftObjectId ); + + /** + * Sets right object ID. + * @param aRightObjectId right object ID + */ + IMPORT_C void SetRightObjectIdL( TItemId aRightObjectId ); + + /** + * Returns the GUID of the relation. + * + * @param aGuidHigh reference where GuidHigh will be stored + * @param aGuidLow reference where GuidLow will be stored + */ + IMPORT_C void Guid(TInt64& aGuidHigh, TInt64& aGuidLow) const; + + /** + * Sets the GUID of the relation. + * + * @param aGuidHigh new GuidHigh value + * @param aGuidLow new GuidLow value + */ + IMPORT_C void SetGuid(const TInt64& aGuidHigh, const TInt64& aGuidLow); + + /** + * Returns last modified date of the relation. + * + * @return last modified date + */ + IMPORT_C TTime LastModifiedDate() const; + + /** + * Sets last modified date of the relation. + * + * @param aLastModifiedDate last modified date + */ + IMPORT_C void SetLastModifiedDate(TTime aLastModifiedDate); + + /** + * Calculates required size for buffer to serialize relation + * + * @return necessary buffer size + */ + TUint32 RequiredBufferSize() const; + + /** + * Serialize relation + * + * @param aBuffer buffer where serialized relation should go + */ + TMdCOffset SerializeL(CMdCSerializationBuffer& aBuffer, TMdCOffset aFreespaceOffset) const; + +protected: + + /** + * Constructs a new relation. + * + * @param aDef definition of the new relation + * @param aLeftObjectId identifier of the left object of the new relation + * @param aRightObjectId identifier of the right object of the new relation + * @param aParameter value for parameter + * + */ + CMdERelation(CMdESession* aSession, TItemId aId, + CMdERelationDef& aDef, TItemId aLeftObjectId, + TItemId aRightObjectId, TInt32 aParameter); + + /** + * Second-phase constructor. + */ + void ConstructL(); + + TMdEInstanceType InstanceType() const; + + +private: + + /** Relation definition. */ + CMdERelationDef& iDef; + + /** Left object ID. */ + TItemId iLeftObjectId; + + /** Right object ID. */ + TItemId iRightObjectId; + + /** Parameter value */ + TInt32 iParameter; + + /** Guid High and Low */ + TInt64 iGuidHigh; + TInt64 iGuidLow; + + /** Relations last modified date */ + TTime iLastModifiedDate; + }; + +#endif // __MDERELATION_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mderelationcondition.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mderelationcondition.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,237 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDERELATIONCONDITION_H__ +#define __MDERELATIONCONDITION_H__ + + +#include +#include +#include + + +/* Forward declarations. */ +class CMdELogicCondition; +class CMdERelationDef; + +/** + * Search condition for relations. + */ +NONSHARABLE_CLASS(CMdERelationCondition) : public CMdECondition + { +public: + + /* Constructors and destructor. */ + + static CMdERelationCondition* NewL( TItemId aRelationId = KNoId, + const RArray* aRelationIds = NULL, + TRelationConditionSide aSide = ERelationConditionSideEither, + const CMdERelationDef* aRelationDef = NULL, + const TMdEIntRange* aParameterRange = NULL ); + + static CMdERelationCondition* NewLC( TItemId aRelationId = KNoId, + const RArray* aRelationIds = NULL, + TRelationConditionSide aSide = ERelationConditionSideEither, + const CMdERelationDef* aRelationDef = NULL, + const TMdEIntRange* aParameterRange = NULL ); + + /** + * Destructor. + */ + virtual ~CMdERelationCondition(); + + /* Methods. */ + + /** + * Returns the relation ID. + * + * @return Relation ID. + */ + IMPORT_C TItemId RelationId() const; + + /** + * Returns the relation IDs. + * + * @return Relation IDs. + */ + IMPORT_C const RArray* RelationIds() const; + + /** + * Returns a pointer to the relation definition. + * + * @return Relation definition; or NULL, + * if no relation definition has been associated with this + * condition. + */ + IMPORT_C const CMdERelationDef* RelationDef() const; + + /** + * Returns the conditions for the object on the left side of the relation. + * + * @return Logic condition node. + */ + IMPORT_C CMdELogicCondition& LeftL(); + + /** + * Returns the conditions for the object on the right side of the + * relation. + * + * @return Logic condition node. + */ + IMPORT_C CMdELogicCondition& RightL(); + + /** + * Returns the side on which a matched object must be. + * @return The side on which an object must be. + */ + TRelationConditionSide Side() const; + + /** + * Sets the side on which a matched object must be. + * @return The side on which an object must be. + */ + IMPORT_C void SetSide(TRelationConditionSide aSide); + + /** + * Returns the relation parameter range. + * @return Parameter's range conditions + */ + IMPORT_C const TMdEIntRange* ParameterRange() const; + + /** + * Sets the GUID which a relation must match. + * + * @param aGuidHigh new GuidHigh value + * @param aGuidLow new GuidLow value + */ + IMPORT_C void SetGuid(const TInt64& aGuidHigh, const TInt64& aGuidLow); + + /** + * Gets the GUID which a relation must match. + * + * @param aGuidHigh reference where GuidHigh will be stored + * @param aGuidLow reference where GuidLow will be stored + * @return returns ETrue if relation condition contains GUID condition, + * otherwise doesn't change parameters' values and returns EFalse + */ + IMPORT_C TBool Guid(TInt64& aGuidHigh, TInt64& aGuidLow) const; + + /** + * Sets the last modified date range which a relation must match. + * + * @param aLastModifiedTimeRange last modified date range + */ + IMPORT_C void SetLastModifiedDateRangeL(const TMdETimeRange& aLastModifiedDateRange); + + /** + * Gets the last modified date range which a relation must match. + * + * @param aLastModifiedDateRange reference where last modified date range will be stored + * @return returns ETrue if relation condition contains last modified date range condition, + * otherwise doesn't change parameter's value and returns EFalse + */ + IMPORT_C TBool LastModifiedDateRange(TMdETimeRange& aLastModifiedDateRange) const; + + /** + * Get possible query's internal optimization flags from condition. + * + * @param aFlaga query's internal optimization flags + * @return last level internal optimization flags + */ + TUint32 InternalQueryOptimizationFlags(TUint32& aFlags); + + /** + * Get required size of serialized buffer when it is serialized. + * + * @return required serialized buffer size + */ + TUint32 RequiredBufferSize() const; + + /** + * Serialize own data to serialized buffer (correct position must be set + * before calling). + * + * @param aBuffer serialized buffer. + */ + void SerializeL(CMdCSerializationBuffer& aBuffer, + TMdCOffset& aFreespaceOffset) const; + +protected: + + /* Constructor. */ + + + /* Utility methods. */ + + +private: + + /* Private methods. */ + + /** + * Constructor. + * + * @param aRelationId The relation ID which an relation must match. + * @param aSide The side on which an object must be. + * @param aRelationDef relation definition + */ + CMdERelationCondition(TItemId aRelationId, TRelationConditionSide aSide, + const CMdERelationDef* aRelationDef); + + /** + * Second-phase constructor. Creates two LogicConditions as children of + * this relation condition and creates range condition for parameter. + * Ownership of the parameter stays with caller. + * + * @param aRelationIds The relation IDs which an relation must match. + * @param aParameterRange parameter range conditions + */ + void ConstructL(const RArray* aRelationIds, + const TMdEIntRange* aParameterRange); + + +private: + + const TItemId iRelationId; + + RArray* iRelationIds; + + /** Relation definition. */ + const CMdERelationDef* iRelationDef; + + /** Conditions for the left object. */ + CMdELogicCondition* iLeftCondition; + + /** Conditions for the right object. */ + CMdELogicCondition* iRightCondition; + + /** The side on which an object must be. */ + TRelationConditionSide iSide; + + /** Conditions for the relation parameter. */ + TMdEIntRange* iParameterRange; + + /** Conditions for the relation GUID. */ + TInt64 iGuidHigh; + TInt64 iGuidLow; + + /** Conditions for the relation last modified date. */ + TMdETimeRange* iLastModifiedDateRange; + }; + +#endif // __MDERELATIONCONDITION_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mderelationdef.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mderelationdef.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + +#ifndef __MDERELATIONDEF_H__ +#define __MDERELATIONDEF_H__ + + +#include + +#include + +// Forward declaration +class CMdCSerializationBuffer; +class CMdENamespaceDef; +class TMdCRelationDef; + + +/** + * Relation definition. + */ +NONSHARABLE_CLASS(CMdERelationDef) : public CBase + { +public: + + static CMdERelationDef* NewL(const TMdCRelationDef& aRelationDef, CMdCSerializationBuffer& aSchemaBuffer, + CMdENamespaceDef& aNamespaceDef); + + static CMdERelationDef* NewLC(const TMdCRelationDef& aRelationDef, CMdCSerializationBuffer& aSchemaBuffer, + CMdENamespaceDef& aNamespaceDef); + + /** + * Returns the name of the item. + * + * @return name + */ + IMPORT_C const TDesC& Name() const; + + /** + * Compare this relation definition with other relation definition. + * + * @param aRelationDef other relation definition + * + * @return 0 if relations are same, 1 or more if this is greater than other + * and -1 or less if this is less than other. + */ + IMPORT_C TInt Compare(const CMdERelationDef& aRelationDef) const; + + /** + * Returns namespace definition of namespace which contains this relation + * @return namespace definition of relation + */ + IMPORT_C CMdENamespaceDef& NamespaceDef() const; + +public: + + /** + * Destructor. + */ + virtual ~CMdERelationDef(); + + TDefId Id() const; + +private: + CMdERelationDef(const TMdCRelationDef& aRelationDef, CMdENamespaceDef& aNamespaceDef); + + void ConstructL(CMdCSerializationBuffer& aSchemaBuffer); + +private: + const TMdCRelationDef& iRelationDef; + CMdENamespaceDef& iNamespaceDef; + + TPtrC16 iName; + }; + +#endif // __MDERELATIONDEF_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mderelationquery.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mderelationquery.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,85 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDERELATIONQUERY_H__ +#define __MDERELATIONQUERY_H__ + + +#include + + +/* Forward declarations. */ +class CMdERelation; +class CMdENamespaceDef; +class CMdESession; + +/** + * Query that fetches a set of relation items from the metadata engine + * database. + */ +NONSHARABLE_CLASS(CMdERelationQuery) : public CMdEQuery + { +public: + + /* Constructors and destructor. */ + + /** + * Destructor. + */ + virtual ~CMdERelationQuery(); + + + /* Methods. */ + + /** + * Returns one of the result objects. + * + * @return The result object that was requested. The query retains + * ownership of the returned object. + */ + IMPORT_C CMdERelation& Result(TInt aIndex) const; + + +protected: + + /* Constructors. */ + + /** + * Constructor. + * + * @param aType type of the condition node + */ + CMdERelationQuery(CMdESession& aSession, CMdENamespaceDef& aNamespaceDef); + + /** + * Second-phase constructor. + */ + void RelationQueryConstructL(); + + virtual void DoCancel(); + +private: + + /* Private methods. */ + + +private: + + }; + +#endif // __MDERELATIONQUERY_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdesession.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdesession.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,1803 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Metadata engine client session +* +*/ + + +#ifndef __MDESESSION_H__ +#define __MDESESSION_H__ + + +#include +#include + +#include + + +/* Forward declarations. */ +class CMdESession; +class CMdEObjectDef; +class CMdERelationDef; +class CMdEEventDef; +class CMdEObject; +class TMdEObject; +class CMdERelation; +class TMdERelation; +class CMdEEvent; +class CMdEObjectQuery; +class CMdERelationQuery; +class CMdEEventQuery; +class CMdELogicCondition; +class CMdEInstanceItem; +class RMdEEngineSession; +class MMdEQueryObserver; +class CMdENamespaceDef; +class RMdEDataBuffer; +class CMdECondition; + + + +/** + * Observer interface for a metadata engine session. + * + * + * + * Examples of MdE session usage: + * + * The class that needs a MdE session needs to implement MMdESessionObserver interface to get + * a notification of completed session opening or an error that has occurred. + * + * class CMdESessionExample : public MMdESessionObserver + * { + * void HandleSessionOpened(CMdESession& aSession, TInt aError); + * void HandleSessionError(CMdESession& aSession, TInt aError); + * ... + * + * CMdESession* iMdeSession; + * }; + * + * The session is opened simply by creating an instance of CMdESession. + * + * void CMdESessionExample::OpenSession() + * { + * iMdeSession = CMdESession::NewL( *this ); + * } + * + * void CMdESessionExample::HandleSessionOpened(CMdESession& aSession, TInt aError) + * { + * if ( KErrNone != aError ) { + * // Error occurred when opening session. iMdeSession must be deleted and new + * // session opened if we wish to use MdE. + * + * delete iMdeSession; iMdeSession = NULL; + * return; + * } + * + * // The session was opened successfully. + * ... + * } + * + * void CMdESessionError::HandleSessionError(CMdESession& aSession, TInt aError) + * { + * // This function is called when an error has occurred in the session by some + * // external source (e.g. other clients). It’s important to notice, that + * // this method is called when the session has already been opened, not when + * // error happens during opening. Session can't be used anymore and it must be deleted. + * + * delete iMdeSession; iMdeSession = NULL; + * } + */ +class MMdESessionObserver + { +public: + + /** + * Called to notify the observer that opening the session has been + * completed and, if the opening succeeded, the session is ready for use. + * + * @param aSession session + * @param aError KErrNone, if opening the session succeeded; + * or one of the system-wide error codes, if opening the + * session failed + */ + virtual void HandleSessionOpened(CMdESession& aSession, TInt aError) = 0; + + /** + * Called to notify the observer about errors, which are not a direct + * consequence of the operations initiated by the client but caused by + * some external source (e.g., other clients). The error cannot be + * recovered and all on-going operations initiated by the client have been + * aborted. Any attempts to continue using the session will cause a panic. + * The client should close the session immediately and try to open a new + * session, if it needs to continue using the metadata engine. + * + * @param aSession session + * @param aError one of the system-wide error codes + */ + virtual void HandleSessionError(CMdESession& aSession, TInt aError) = 0; + }; + + +/** + * Observer interface for modifications of the metadata engine schema. + */ +class MMdESchemaObserver + { +public: + + /** + * Called to notify the observer that the schema has been modified. + * + * @param none + */ + virtual void HandleSchemaModified() = 0; + }; + +/** + * Observer interface for modifications of the objects in the metadata engine + * database. + * + * Examples of observers. + * A class that is interested in observing events in the DB must implement observer interfaces + * and register as observer. Following examples show how this is done for objects but observing + * relations and events works the same way. + * + * class CMdeObserverExample : public MMdEObjectObserver, public MMdEObjectPresentObserver + * { + * void HandleObjectNotification(CMdESession& aSession, TObserverNotificationType aType, + * const RArray& aObjectIdArray); + * void HandleObjectPresentNotification(CMdESession& aSession, TBool aPresent, + * const RArray& aObjectIdArray); + * ... + * CMdESession* iMdeSession; + * }; + * + * void CMdeObserverExample::ConstructL() + * { + * // Register this class as observer and start listening to object remove events. + * // The logic condition can be as complicated as is necessary. In this example + * // the condition as simple as possible. + * CMdELogicCondition* condition = CMdELogicCondition::NewL( ELogicConditionOperatorAnd ); + * iMdeSession->AddObjectObserverL( *this, condition, ENotifyRemove, + * &iMdeSession->GetDefaultNamespaceDefL() ); + * + * // Start listening to changes in object present status. + * iMdeSession->AddObjectPresentObserverL( *this ); + * } + * + * @see MMdEObjectObserver::HandleObjectNotification + * void CMdeObserverExample::HandleObjectNotification(CMdESession& aSession, TObserverNotificationType aType, + * const RArray& aObjectIdArray) + * { + * if ( aType == ENotifyAdd ) + * { + * // object was added to DB + * } else if ( aType == ENotifyModify ) + * { + * // object was modified + * } else if ( aType == ENotifyRemove ) + * { + * // object was removed from DB + * } + * + * // aObjectIdArray contains ids for all objects that were added/modified/removed + * } + * + * void CMdeObserverExample::HandleObjectPresentNotification(CMdESession& aSession, + * TBool aPresent, const RArray& aObjectIdArray) + * { + * if ( aPresent ) + * { + * // objects in aObjectIdArray were set as present + * } + * } + */ +class MMdEObjectObserver + { +public: + + /** + * Called to notify the observer that new objects has been + * added/modified/removed in the metadata engine database. + * + * @param aSession session + * @param aType defines if object was added/modified/remove + * @param aObjectIdArray IDs of added object + * @see CMdESession::AddObjectObserverL + * @see CMdELogicCondition + */ + virtual void HandleObjectNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray) = 0; + }; + +class MMdEObjectObserverWithUri + { +public: + + /** + * Called to notify the observer that new objects has been + * added/modified/removed in the metadata engine database. + * + * @param aSession session + * @param aType defines if object was added/modified/remove + * @param aObjectIdArray IDs of added object + * @param aUriArray Uris of added object + * @see CMdESession::AddObjectObserverL + * @see CMdELogicCondition + */ + virtual void HandleUriObjectNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray, + const RPointerArray& aObjectUriArray) = 0; + }; + +/** + * Observer interface for modifications of the objects in the metadata engine + * database. + */ +class MMdEObjectPresentObserver + { +public: + + /** + * Called to notify the observer that objects has been set + * to present or not present state in the metadata engine database. + * + * @param aSession session + * @param aPresent state: ETrue - present or EFales - not present + * @param aObjectIdArray object IDs which are set to present state + */ + virtual void HandleObjectPresentNotification(CMdESession& aSession, + TBool aPresent, const RArray& aObjectIdArray) = 0; + }; + +/** + * Observer interface for modifications of the relations in the metadata + * engine database. + */ +class MMdERelationPresentObserver + { +public: + + /** + * Called to notify the observer that objects has been set + * to present or not present state in the metadata engine database. + * + * @param aSession session + * @param aPresent state: ETrue - present or EFales - not present + * @param aObjectIdArray object IDs which are set to present state + */ + virtual void HandleRelationPresentNotification(CMdESession& aSession, + TBool aPresent, const RArray& aRelationIdArray) = 0; + }; + + +/** + * Observer interface for modifications of relations in the metadata engine + * database. This observer returns only relations IDs. + */ +class MMdERelationObserver + { +public: + + /** + * Called to notify the observer that new relations has been + * added/modified/removed in the metadata engine database. + * + * @param aSession session + * @param aType defines if relation was added/modified/remove + * @param aRelationIdArray IDs of relations + */ + virtual void HandleRelationNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aRelationIdArray) = 0; + }; + +/** + * Observer interface for modifications of relations in the metadata engine + * database. This observer returns relations (not only IDs). + */ +class MMdERelationItemObserver + { +public: + + /** + * Called to notify the observer that new relations has been + * added/modified/removed in the metadata engine database. + * + * @param aSession session + * @param aType if relation was added/modified/remove + * @param aRelationArray relations + */ + virtual void HandleRelationItemNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aRelationArray) = 0; + }; + +/** + * Observer interface for additions or removes of new events to the metadata + * engine database. + */ +class MMdEEventObserver + { +public: + + /** + * Called to notify the observer that new events has been + * added or removed in the metadata engine database. + * + * @param aSession session + * @param aType if event was added or removed + * @param aEventIdArray IDs of added events + */ + virtual void HandleEventNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aEventIdArray) = 0; + + }; + +/** + * Metadata engine session. + */ +NONSHARABLE_CLASS(CMdESession) : public CBase + { +public: + + /* Constructors and destructor. */ + + /** + * Opens a new metadata engine session. + * + * @param aObserver observer to notify when opening the session has been + * completed + * + * @return metadata engine session + */ + IMPORT_C static CMdESession* NewL(MMdESessionObserver& aObserver); + + /** + * Opens a new metadata engine session and leaves the session in the + * cleanup stack. + * + * @param aObserver observer to notify when opening the session has been + * completed + * + * @return metadata engine session + */ + IMPORT_C static CMdESession* NewLC(MMdESessionObserver& aObserver); + + /** + * Destructor. + */ + virtual ~CMdESession(); + + /* Methods for managing namespace definitions. */ + + /** + * Returns the number of namespace definitions. + * + * @return number of namespace definitions + */ + virtual TInt NamespaceDefCount() const = 0; + + /** + * Returns the namespace definition at the specified index. + * + * @param aIndex index + * + * @return namespace definition + */ + virtual CMdENamespaceDef& NamespaceDefL(TInt aIndex) = 0; + + /** + * Returns the namespace definition with the specified name. + * + * @param aName name + * + * @return namespace definition; or 0, if there is no object definition + * with the specified name + */ + virtual CMdENamespaceDef& GetNamespaceDefL(const TDesC& aName) = 0; + + /* Returns the default namespace definition. + * + * @return the default namespace definition. + */ + virtual CMdENamespaceDef& GetDefaultNamespaceDefL() = 0; + + /** + * Adds a new relation definition to namespace, + * + * Example: + * void AddRelationL() + * { + * _LIT( TestRelation, "TestRelation" ); + * TBuf <15> relname( TestRelation ); + * iMdeSession->AddRelationDefL( *iDefaultNamespaceDef, relname ); + * } + * + * @param aNamespaceDef namespace definition to which relation belongs + * @param aName relation definitions name + */ + virtual void AddRelationDefL(const CMdENamespaceDef &aNamespaceDef, + const TDesC &aName) = 0; + + /** + * Adds a new event definition to namespace. + * + * Example: + * void AddEventDefL() + * { + * _LIT( TestEvent, "TestEvent" ); + * TBuf <10> eventName( TestEvent ); + * iMdeSession->AddRelationDefL( *iDefaultNamespaceDef, eventName ); + * } + * + * @param aNamespaceDef namespace definition to which event belongs + * @param aName event definitions name + */ + virtual void AddEventDefL(const CMdENamespaceDef &aNamespaceDef, + const TDesC &aName) = 0; + + /* Methods for managing objects. */ + + /** + * Adds multiple instance items to metadata database. + * The array contains the items, any other type than object, relation or + * event causes a leave. + * + * @param aItems list of items to add + * @return first item error + */ + virtual TInt AddItemsL( RPointerArray& aItems ) = 0; + + /** + * Commits multiple instance items to metadata database. + * The array contains the items, any other type than object, relation or + * event causes a leave. + * + * @param aItems list of items to add + * @return first item error + */ + virtual TInt UpdateItemsL( RPointerArray& aItems ) = 0; + + /** + * Adds multiple instance items asynchronously to metadata database. + * The array contains the items, any other type than object, relation or + * event causes a leave. Returned serialized list of item IDs must be + * deserialized with DeserializeItemsL method. + * + * Example: + * class CExampleActiveObject : public CActive + * { + * void CActiveObject::AddItemsL(); + * ... + * RPointerArray iItems; + * RMdEDataBuffer iResultBuffer; + * }; + * + * void CExampleActiveObject::AddItemsL() + * { + * iMdeSession->AddItemsAsyncL( iItems, iStatus, iResultBuffer ); + * SetActive(); + * } + * + * When adding items is finished, RunL() will be called. + * + * @param aItems List of item to add. + * @param aStatus Returns the result code after the asynchronous call + * completes. + * @param aSerializedItemIds Returned serialized list of item IDs. + */ + virtual void AddItemsAsyncL( + RPointerArray& aItems, + TRequestStatus& aStatus, + RMdEDataBuffer& aSerializedItemIds) = 0; + + /** + * Commits multiple instance items asynchronously to metadata database. + * The array contains the items, any other type than object, relation or + * event causes a leave. Returned serialized list of item IDs must be + * deserialized with DeserializeItemsL method. + * + * Example: + * class CExampleActiveObject : public CActive + * { + * void CActiveObject::UpdateItemsL(); + * ... + * RPointerArray iItems; + * RMdEDataBuffer iResultBuffer; + * }; + * + * void CExampleActiveObject::UpdateItemsL() + * { + * iMdeSession->UpdateItemsAsyncL( iItems, iStatus, iResultBuffer ); + * SetActive(); + * } + * + * @param aItems List of item to add. + * @param aStatus Returns the result code after the asynchronous call + * completes. + * @param aSerializedItemIds Returned serialized list of item IDs. + */ + virtual void UpdateItemsAsyncL( + RPointerArray& aItems, + TRequestStatus& aStatus, + RMdEDataBuffer& aSerializedItemIds ) = 0; + + /** + * Constructs a new empty object. Note that the object is not inserted in + * the database. The ownership of the new object is passed to the caller + * (that is, the caller is responsible for deleting the object). + * + * Example: + * _LIT( KObjectDef, "ObjectDefName" ); + * TBuf<13> objDefStr( KObjectDef ); + * CMdENamespaceDef& defNS = iMdESession->GetDefaultNamespaceDefL(); + * CMdEObjectDef& mdeObjectDef = defNS.GetObjectDefL( objDefStr ); + * CMdEObject* mdeObject = iMdESession->NewObjectL( mdeObjectDef, aUri ); + * + * @param aDef definition of the new object + * @param aUri URI of the new object + * @param aMediaId media ID of the new object (default 0) + * + * @return new object + */ + virtual CMdEObject* NewObjectL( CMdEObjectDef& aDef, const TDesC& aUri, + TUint32 aMediaId = 0 ) = 0; + + /** + * Constructs a new empty object and leaves it in the cleanup stack. + * Note that the object is not inserted in the database. The ownership of + * the new object is passed to the caller (that is, the caller is + * responsible for deleting the object). + * + * Example: + * _LIT( KObjectDef, "ObjectDefName" ); + * TBuf<13> objDefStr( KObjectDef ); + * CMdENamespaceDef& defNS = iMdESession->GetDefaultNamespaceDefL(); + * CMdEObjectDef& mdeObjectDef = defNS.GetObjectDefL( objDefStr ); + * CMdEObject* mdeObject = iMdESession->NewObjectLC( mdeObjectDef, aUri ); + * + * @param aDef definition of the new object + * @param aUri URI of the new object + * @param aMediaId media ID of the new object (default 0) + * + * @return new object + */ + virtual CMdEObject* NewObjectLC( CMdEObjectDef& aDef, const TDesC& aUri, + TUint32 aMediaId = 0 ) = 0; + + /** + * Adds the specified new object to metadata database. + * aObject is modified so that it has the new item ID. + * If object adding fails object's ID is KNoId, + * otherwise object adding is successful. + * + * @param aObject object to be added + * + * @return item ID of the added object + */ + virtual TItemId AddObjectL(CMdEObject& aObject) = 0; + + /** + * Adds multiple object items to the metadata engine database. + * The array contains the object items. aObjects are modified + * so that those has the new item IDs. If object adding fails + * object's ID is KNoId, otherwise object adding is successful. + * + * @param aObjects list of objects to be added + * @return first object error + */ + virtual TInt AddObjectsL(RPointerArray& aObjects) = 0; + + /** + * Deserialize serialized list of item IDs + * + * @param aSerializedItemIds serialized list of item IDs + * @param aResultObjects if not NULL object IDs are deserialized from + * buffer to this ID array + * @param aResultEvents if not NULL event IDs are deserialized from + * buffer to this ID array + * @param aResultRelations if not NULL relation IDs are deserialized + * from buffer to this ID array + * + * @return error code of first failed item, if no errors KErrNone + */ + virtual TInt DeserializeIdsL( RMdEDataBuffer& aSerializedItemIds, + RArray* aResultObjects = NULL, + RArray* aResultEvents = NULL, + RArray* aResultRelations = NULL ) = 0; + + /** + * Deserialize serialized list of items + * + * @param aSerializedItems serialized list of items + * @param aItems items are deserialized from buffer to this item array + * + * @return first item error + */ + virtual TInt DeserializeItemsL( RMdEDataBuffer& aSerializedItems, + RPointerArray& aItems ) = 0; + + /** + * Removes the object with the specified identifier from metadata database. + * + * @param aId identifier + * @param aNamespaceDef namespace where object is removed, if NULL default + * namespace is used + * @return KNoId if removing has failed, otherwise removed object's ID + */ + virtual TItemId RemoveObjectL( TItemId aId, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Removes the object with the specified URI from metadata database. + * + * @param aUri URI + * @param aNamespaceDef namespace from remove object, if NULL default + * namespace is used + * @return KNoId if removing has failed, otherwise removed object's ID + */ + virtual TItemId RemoveObjectL( const TDesC& aUri, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Removes the array of objects with the specified identifier from + * metadata database. + * + * @param aId object IDs to be removed + * @param aResult result array where succefully removed object IDs are + * added (KNoId is added from those objects which removing + * has failed) + * @param aNamespaceDef namespace where object is removed, if NULL default + * namespace is used + * @return first item error + */ + virtual TInt RemoveObjectsL( + const RArray& aId, RArray& aResult, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Removes the array of objects with the specified URI from metadata + * database. + * + * @param aUri object URIs to be removed + * @param aResult result array where succefully removed object IDs are + * added (KNoId is added from those objects which removing + * has failed) + * @param aNamespaceDef namespace where object is removed, if NULL default + * namespace is used + * @return first item error + */ + virtual TInt RemoveObjectsL( + const RPointerArray& aUri, RArray& aResult, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Asynchronously removes the array of objects with the specified + * object IDs from metadata database. Returned serialized list of item IDs + * must be deserialized with DeserializeIdsL method. + * + * @param aId object IDs to be removed + * @param aStatus returns the result code after the asynchronous call + * completes. + * @param aSerializedObjectIds returned serialized list of object IDs + * @param aNamespaceDef namespace where object is removed, if NULL default + * namespace is used + */ + virtual void RemoveObjectsAsyncL( + const RArray& aId, TRequestStatus& aStatus, + RMdEDataBuffer& aSerializedObjectIds, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Asynchronously removes the array of objects with the specified URI from + * metadata database. Returned serialized list of item IDs must be + * deserialized with DeserializeIdsL method. + * + * @param aUri object URIs to be removed + * @param aStatus returns the result code after the asynchronous call + * completes. + * @param aSerializedObjectIds returned serialized list of object IDs + * @param aNamespaceDef namespace where object is removed, if NULL default + * namespace is used + */ + virtual void RemoveObjectsAsyncL( + const RPointerArray& aUri, TRequestStatus& aStatus, + RMdEDataBuffer& aSerializedObjectIds, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Returns the object with the specified ID and specified object + * definition. + * + * Example: + * CMdENamespaceDef& defaultNamespace = iSession->GetDefaultNamespaceDefL(); + * CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); + * CMdEObject* object = iSession->GetObjectL( aObjectId, imageObjDef ); + * + * @param aId object ID + * @param aObjectDef object definition + * + * @return object or NULL, if there is no object with the specified + * identifier in the metadata engine database + */ + virtual CMdEObject* GetObjectL( const TItemId aId, + CMdEObjectDef& aObjectDef ) = 0; + + /** + * Returns the object (object may contain only properties defined in + * "Object") with the specified ID and specified namespace (if namespace + * is NULL, the default namespace is used). + * + * @param aId object ID + * @param aNamespaceDef namespace + * + * @return object or NULL, if there is no object with the specified + * identifier in the metadata engine database + */ + virtual CMdEObject* GetObjectL( const TItemId aId, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Returns the object (object will contain all it's properties) + * with the specified ID and specified namespace + * (if namespace is NULL, the default namespace is used). + * + * @param aId object ID + * @param aNamespaceDef namespace + * + * @return object or NULL, if there is no object with the specified + * identifier in the metadata engine database + */ + virtual CMdEObject* GetFullObjectL( const TItemId aId, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Returns the object with the specified GUID and specified object + * definition. + * + * Example: + * CMdENamespaceDef& defaultNamespace = iSession->GetDefaultNamespaceDefL(); + * CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); + * CMdEObject* object = iMdeSession->GetObjectL( 12345, 67890, imageObjDef ); + * + * @param aGuidHigh GUID high + * @param aGuidLow GUID low + * @param aObjectDef object definition + * + * @return object or NULL, if there is no object with the specified + * identifier in the metadata engine database + */ + virtual CMdEObject* GetObjectL( + const TInt64 aGuidHigh, const TInt64 aGuidLow, + CMdEObjectDef& aObjectDef ) = 0; + + /** + * Returns the object (object may contain only properties definied in + * "Object") with the specified GUID and specified namespace (if namespace + * is NULL, the default namespace is used). + * + * Example: + * CMdEObject* object = iMdeSession->GetObjectL( 12345, 67890 ); + * + * @param aGuidHigh GUID high + * @param aGuidLow GUID low + * @param aNamespaceDef namespace + * + * @return object or NULL, if there is no object with the specified + * identifier in the metadata engine database + */ + virtual CMdEObject* GetObjectL( + const TInt64 aGuidHigh, const TInt64 aGuidLow, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Returns the object (object will contain all it's properties) + * with the specified GUID and specified namespace + * (if namespace is NULL, the default namespace is used). + * + * Example: + * CMdEObject* object = iMdeSession->GetFullObjectL( 12345, 67890 ); + * + * @param aGuidHigh GUID high + * @param aGuidLow GUID low + * @param aNamespaceDef namespace + * + * @return object or NULL, if there is no object with the specified + * identifier in the metadata engine database + */ + virtual CMdEObject* GetFullObjectL( + const TInt64 aGuidHigh, const TInt64 aGuidLow, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Returns the object with the specified URI and specified object + * definition. + * + * Example: + * CMdENamespaceDef& defaultNamespace = iSession->GetDefaultNamespaceDefL(); + * CMdEObjectDef& imageObjDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); + * CMdEObject* object = iMdeSession->GetObjectL( aUri, imageObjDef ); + * + * @param aUri object URI + * @param aObjectDef object definition + * + * @return object or NULL, if there is no object with the specified + * identifier in the metadata engine database + */ + virtual CMdEObject* GetObjectL( const TDesC& aUri, + CMdEObjectDef& aObjectDef ) = 0; + + /** + * Returns the object (object may contain only properties definied in + * "Object") with the specified URI specified namespace (if namespace is + * NULL, the default namespace is used). + * + * @param aUri object URI + * @param aNamespaceDef namespace + * + * @return object or NULL, if there is no object with the specified + * identifier in the metadata engine database + */ + virtual CMdEObject* GetObjectL( const TDesC& aUri, + CMdENamespaceDef* aNamespaceDef = NULL) = 0; + + /** + * Returns the object (object will contain all it's properties) with the + * specified URI specified namespace (if namespace is NULL, the default + * namespace is used). + * + * @param aUri object URI + * @param aNamespaceDef namespace + * + * @return object or NULL, if there is no object with the specified + * identifier in the metadata engine database + */ + virtual CMdEObject* GetFullObjectL( const TDesC& aUri, + CMdENamespaceDef* aNamespaceDef = NULL) = 0; + + /** + * Opens the object with the specified ID and specified object + * definition for modifications. The object is locked so that nobody else + * can open it for modifications. The modifications are committed by + * calling the CommitObject() method, which releases the lock. + * The modifications can be canceled by calling the + * CancelObject() method, which also releases the lock. + * + * Example: + * CMdENamespaceDef& defaultNamespace = iMdeSession->GetDefaultNamespaceDefL(); + * CMdEObjectDef& imageDef = defaultNamespace.GetObjectDefL( MdeConstants::Image::KImageObject ); + * CMdEObject* image = iMdESession->OpenObjectL( 17, imageDef ); + * + * CMdEPropertyDef& lastModDatePropDef = imageDef.GetPropertyDefL( + * Object::KLastModifiedDateProperty ); + * + * CMdEProperty* lastModDateProp = NULL; + * image->Property( lastModDatePropDef, lastModDateProp, 0 ); + * + * TTime currenttime( 0 ); + * currenttime.UniversalTime(); + * + * if ( lastModDateProp ) + * { + * lastModDateProp->SetTimeValueL( currenttime ); + * } + * else + * { + * image->AddTimePropertyL( lastModDatePropDef, currenttime ); + * } + * } + * iMdeSession->CommitObjectL( *image ); + * + * + * @param aId object ID + * @param aObjectDef object definition + * + * @return Object or NULL, if there is no object with the specified + * identifier in the metadata engine database. + */ + virtual CMdEObject* OpenObjectL( const TItemId aId, + CMdEObjectDef& aObjectDef ) = 0; + + /** + * Opens the object (object may contain only properties definied in "Object") + * with the specified ID and specified namespace + * (if namespace is NULL, the default namespace is used) for modifications. + * The object is locked so that nobody else can open it for modifications. + * The modifications are committed by calling the CommitObject() + * method, which releases the lock. The modifications can be canceled by + * calling the CancelObject() method, which also releases the + * lock. + * + * @param aId object ID. + * @param aNamespaceDef namespace + * + * @return Object or NULL, if there is no object with the specified + * identifier in the metadata engine database. + */ + virtual CMdEObject* OpenObjectL( const TItemId aId, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Opens the object (object will contain all it's properties) + * with the specified ID and specified namespace + * (if namespace is NULL, the default namespace is used) for modifications. + * The object is locked so that nobody else can open it for modifications. + * The modifications are committed by calling the CommitObject() + * method, which releases the lock. The modifications can be canceled by + * calling the CancelObject() method, which also releases the + * lock. + * + * @param aId object ID. + * @param aNamespaceDef namespace + * + * @return Object or NULL, if there is no object with the specified + * identifier in the metadata engine database. + */ + virtual CMdEObject* OpenFullObjectL( const TItemId aId, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + + /** + * Opens the object with the specified GUID and specified object + * definition for modifications. The object is locked so that nobody else + * can open it for modifications. The modifications are committed by + * calling the CommitObject() method, which releases the lock. + * The modifications can be canceled by calling the + * CancelObject() method, which also releases the lock. + * + * @param aGuidHigh GUID high + * @param aGuidLow GUID low + * @param aObjectDef object definition + * + * @return Object or NULL, if there is no object with the specified + * identifier in the metadata engine database. + */ + virtual CMdEObject* OpenObjectL( + const TInt64 aGuidHigh, const TInt64 aGuidLow, + CMdEObjectDef& aObjectDef ) = 0; + + /** + * Opens the object (object may contain only properties definied in "Object") + * with the specified GUID and specified namespace + * (if namespace is NULL, the default namespace is used) for modifications. + * The object is locked so that nobody else can open it for modifications. + * The modifications are committed by calling the CommitObject() + * method, which releases the lock. The modifications can be canceled by + * calling the CancelObject() method, which also releases the + * lock. + * + * @param aGuidHigh GUID high + * @param aGuidLow GUID low + * @param aNamespaceDef namespace + * + * @return Object or NULL, if there is no object with the specified + * identifier in the metadata engine database. + */ + virtual CMdEObject* OpenObjectL( + const TInt64 aGuidHigh, const TInt64 aGuidLow, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Opens the object (object will contain all it's properties) + * with the specified GUID and specified namespace + * (if namespace is NULL, the default namespace is used) for modifications. + * The object is locked so that nobody else can open it for modifications. + * The modifications are committed by calling the CommitObject() + * method, which releases the lock. The modifications can be canceled by + * calling the CancelObject() method, which also releases the + * lock. + * + * @param aGuidHigh GUID high + * @param aGuidLow GUID low + * @param aNamespaceDef namespace + * + * @return Object or NULL, if there is no object with the specified + * identifier in the metadata engine database. + */ + virtual CMdEObject* OpenFullObjectL( + const TInt64 aGuidHigh, const TInt64 aGuidLow, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + + /** + * Opens the object with the specified URI for modifications and specified + * object definition. The object is locked so that nobody else can open it + * for modifications. The modifications are committed by calling the + * CommitObject() method, which releases the lock. The + * modifications can be canceled by calling the CancelObject() + * method, which also releases the lock. + * + * @param aUri object URI + * @param aObjectDef object definition + * + * @return Object or NULL, if there is no object with the specified + * identifier in the metadata engine database. + */ + virtual CMdEObject* OpenObjectL( const TDesC& aUri, + CMdEObjectDef& aObjectDef ) = 0; + + /** + * Opens the object (object may contain only properties definied in "Object") + * with the specified ID and specified namespace + * (if namespace is NULL, the default namespace is used) for modifications. + * The object is locked so that nobody else can open it for modifications. + * The modifications are committed by calling the CommitObject() + * method, which releases the lock. The modifications can be canceled by + * calling the CancelObject() method, which also releases the + * lock. + * + * @param aUri Object URI. + * @param aNamespaceDef namespace + * + * @return Object or NULL, if there is no object with the specified + * identifier in the metadata engine database. + */ + virtual CMdEObject* OpenObjectL( const TDesC& aUri, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Opens the object (object will contain all it's properties) + * with the specified ID and specified namespace + * (if namespace is NULL, the default namespace is used) for modifications. + * The object is locked so that nobody else can open it for modifications. + * The modifications are committed by calling the CommitObject() + * method, which releases the lock. The modifications can be canceled by + * calling the CancelObject() method, which also releases the + * lock. + * + * @param aUri Object URI. + * @param aNamespaceDef namespace + * + * @return Object or NULL, if there is no object with the specified + * identifier in the metadata engine database. + */ + virtual CMdEObject* OpenFullObjectL( const TDesC& aUri, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Gets metadata object id, definition and some flags by URI. Does not return the whole object. + * + * @param aObject on return contains information about the metadata object + * @param aUri metadata object URI + * @param aNamespaceDef namespace definition. If namespace is NULL then the default namespace is used. + */ + virtual void CheckObjectL( TMdEObject& aObject, const TDesC& aUri, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Gets metadata object id, definition and some flags by id. Does not return the whole object. + * + * @param aObject on return contains information about the metadata object + * @param aId metadata object id + * @param aNamespaceDef namespace definition. If namespace is NULL then the default namespace is used. + */ + virtual void CheckObjectL( TMdEObject& aObject, TItemId aId, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Gets an array of TMdEObject objects that contain metadata object ids, definitions and + * some flags by object ids. Does not return whole objects. + * + * @param aObjects on return contains an array of objects containing information about metadata objects + * @param aIds array of metadata object ids + * @param aNamespaceDef namespace definition. If namespace is NULL then the default namespace is used. + */ + virtual void CheckObjectL( RArray& aObjects, + const RArray& aIds, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Commits the modifications made to the object to the database + * and releases the modification lock. + * + * @param aObject Object. + */ + virtual void CommitObjectL(CMdEObject& aObject) = 0; + + /** + * Commits the modifications made to objects to the database + * and releases the modification locks. + * + * @param aObject Object. + */ + virtual void CommitObjectsL(RPointerArray& aObjects) = 0; + + /** + * Cancels the modifications made to the object and releases the + * modification lock. + * + * @param aObject Object. + */ + virtual TItemId CancelObjectL(CMdEObject& aObject) = 0; + + + /* Methods for managing relations. */ + + /** + * Returns the relation with the specified ID and specified namespace + * (if namespace is NULL, the default namespace is used). + * + * Note that the ownership of the returned relation is passed to the + * caller of the method (that is, the caller is responsible for deleting + * the relation). + * + * @param aId relation ID + * @param aNamespaceDef namespace + * + * @return relation or NULL, if there is no relation with the specified ID + * in the metadata engine database + */ + virtual CMdERelation* GetRelationL(TItemId aId, + CMdENamespaceDef* aNamespacedef = NULL) = 0; + + /** + * Constructs a new empty relation. Note that the relation is not inserted + * in the database. The ownership of the new relation is passed to the + * caller (that is, the caller is responsible for deleting the relation). + * + * Example: + * CMdERelationDef& relationDef = namespaceDef.GetRelationDefL( MdeConstants::Relations::KContains ); + * + * CMdERelation* relation = iMdeSession->NewRelationLC( relationDef, albumObject->Id(), audioObject->Id() ); + * iMdeSession->AddRelationL( *relation ); + * + * @param aDef definition of the new relation + * @param aLeftObjectId id of the left side of the relation + * @param aRightObjectId id of the right side of the relation + * @param aParameter the relation parameter + * + * @return new relation + */ + virtual CMdERelation* NewRelationLC(CMdERelationDef& aDef, + TItemId aLeftObjectId, TItemId aRightObjectId, + TInt32 aParameter = 0) = 0; + + /** + * Constructs a new empty relation. Note that the relation is not inserted + * in the database. The ownership of the new relation is passed to the + * caller (that is, the caller is responsible for deleting the relation). + * + * Example: + * CMdERelationDef& relationDef = namespaceDef.GetRelationDefL( MdeConstants::Relations::KContains ); + * + * CMdERelation* relation = iMdeSession->NewRelationL( relationDef, albumObject->Id(), audioObject->Id() ); + * iMdeSession->AddRelationL( *relation ); + * + * @param aDef definition of the new relation + * @param aLeftObjectId id of the left side of the relation + * @param aRightObjectId id of the right side of the relation + * @param aParameter the relation parameter + * + * @return new relation + */ + virtual CMdERelation* NewRelationL(CMdERelationDef& aDef, + TItemId aLeftObjectId, TItemId aRightObjectId, + TInt32 aParameter = 0) = 0; + + /** + * Adds a new relation to the metadata engine database. + * + * @param relation + * + * @return identifier of the new relation + */ + virtual TItemId AddRelationL( CMdERelation& aRelation ) = 0; + + /** + * Commits changes made to the relation to the metadata engine database. + * + * @param relation + * + * @return identifier of the new relation + */ + virtual TItemId UpdateRelationL( CMdERelation& aRelation ) = 0; + + /** + * Removes the relation with the specified identifier and specified + * namespace (if namespace is NULL, the default namespace is used) + * from the metadata engine database. + * + * @param aId ID of the relation to remove. + * @param aNamespaceDef namespace + * + * @return relation ID or KNoId, if there is no relation with the + * specified ID in the metadata engine database + */ + virtual TItemId RemoveRelationL( TItemId aId, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Removes multiple relations with the specified IDs and specified + * namespace (if namespace is NULL, the default namespace is used) + * from the metadata engine database. + * + * @param aId IDs of relations to remove. + * @param aSuccessful Successfully removed IDs of relations (if removing + * has failed KNoId is added). + * @param aNamespaceDef namespace + */ + virtual TInt RemoveRelationsL( + const RArray& aId, RArray& aSuccessful, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Removes multiple relations asynchronous with the specified IDs and + * specified namespace (if namespace is NULL, the default namespace is + * used) from the metadata engine database. Returned serialized list of + * item IDs must be deserialized with DeserializeIdsL method. + * + * @param aId IDs of relations to remove. + * @param aStatus returns the result code after the asynchronous call + * completes. + * @param aSerializedRelationIds returned serialized list of relation IDs + * @param aNamespaceDef namespace + */ + virtual void RemoveRelationsAsyncL( + const RArray& aId, TRequestStatus& aStatus, + RMdEDataBuffer& aSerializedRelationIds, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /* Methods for managing events. */ + + /** + * Constructs a new empty event. Note that the event is not inserted in the + * database. The ownership of the new event is passed to the caller (that + * is, the caller is responsible for deleting the event). + * + * Example: + * CMdEEventDef* eventDef = &iDefaultNamespace->GetEventDefL( Events::KCreated ); + * CMdEEvent* event = iMdeSession->NewEventLC( *eventDef, objectId, time ); + * + * @param aDef definition of the new event + * @param aObjectId the target object id + * @param aTime time of the event + * @param aSource source of the event + * @param aParticipant participant of the event + * + * @return new event + */ + virtual CMdEEvent* NewEventLC(CMdEEventDef& aDef, + TItemId aObjectId, TTime aTime, + const TDesC* aSource = NULL, const TDesC* aParticipant = NULL) = 0; + + /** + * Constructs a new empty event. Note that the event is not inserted in the + * database. The ownership of the new event is passed to the caller (that + * is, the caller is responsible for deleting the event). + * + * Example: + * CMdEEventDef* eventDef = &iDefaultNamespace->GetEventDefL( Events::KCreated ); + * CMdEEvent* event = iMdeSession->NewEventL( *eventDef, objectId, time ); + * + * @param aDef definition of the new event + * @param aObjectId the target object id + * @param aTime time of the event + * @param aSource source of the event + * @param aParticipant participant of the event + * + * @return new event + */ + virtual CMdEEvent* NewEventL(CMdEEventDef& aDef, + TItemId aObjectId, TTime aTime, + const TDesC* aSource = NULL, const TDesC* aParticipant = NULL) = 0; + + /** + * Returns the event with the specified identifier and specified namespace + * (if namespace is NULL, the default namespace is used). + * Note that the ownership of the returned event is passed to the caller of + * the method (that is, the caller is responsible for deleting the event). + * + * @param aId Identifier. + * @param aNamespaceDef namespace + * + * @return Event or NULL, if there is no event with the specified + * identifier in the metadata engine database. + */ + virtual CMdEEvent* GetEventL(TItemId aId, + CMdENamespaceDef* aNamespaceDef = NULL) = 0; + + /** + * Adds a new event to the metadata engine database. + * + * @param event + * + * @return Identifier of the new event. + */ + virtual TItemId AddEventL( CMdEEvent& aEvent ) = 0; + + /** + * Removes the event with the specified identifier and specified namespace + * (if namespace is NULL, the default namespace is used) from the metadata + * engine database. + * + * @param aId ID of the event to remove. + * @param aNamespaceDef namespace + * + * @return event ID or KNoId, if there is no event with the specified ID + * in the metadata engine database + */ + virtual TItemId RemoveEventL( TItemId aId, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Removes multiple events with the specified IDs and specified + * namespace (if namespace is NULL, the default namespace is used) + * from the metadata engine database. + * + * @param aId IDs of events to remove. + * @param aSuccessful Successfully removed IDs of events (if removing has + * failed KNoId is added). + * @param aNamespaceDef namespace + */ + virtual TInt RemoveEventsL( + const RArray& aId, RArray& aSuccessful, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Removes multiple events asynchronous with the specified IDs and + * specified namespace (if namespace is NULL, the default namespace is + * used) from the metadata engine database. Returned serialized list of + * item IDs must be deserialized with DeserializeIdsL method. + * + * @param aId IDs of events to remove. + * @param aStatus returns the result code after the asynchronous call + * completes. + * @param aSerializedEventIds returned serialized list of event IDs + * @param aNamespaceDef namespace + */ + virtual void RemoveEventsAsyncL( + const RArray& aId, TRequestStatus& aStatus, + RMdEDataBuffer& aSerializedEventIds, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + + /* Methods for searching objects, relations, and events. */ + + /** + * Creates a new object query. + * + * Note that the ownership of the returned query is passed to the caller of + * the method (that is, the caller is responsible for deleting the query). + * + * @param aNamespaceDef namespace where query will be run + * @param aObjectDef object definition which defines objects which will be + * queried + * @param aObserver observer which callback methods will be called + * + * @return New object query. + */ + virtual CMdEObjectQuery* NewObjectQueryL(CMdENamespaceDef& aNamespaceDef, + CMdEObjectDef& aObjectDef, MMdEQueryObserver* aObserver = 0) = 0; + + /** + * Creates a new object query. + * + * Note that the ownership of the returned query is passed to the caller of + * the method (that is, the caller is responsible for deleting the query). + * + * @param aObjectDef Object definition which defines the parent object. + * @param aObjectDefs Object definitions which defines objects which will + * be queried. Ownership of aObjectDefs will change to + * query. + * @param aObserver Observer which callback methods will be called. + * + * @return New object query. + */ + virtual CMdEObjectQuery* NewObjectQueryL( + CMdEObjectDef& aObjectDef, + RPointerArray* aObjectDefs, + MMdEQueryObserver* aObserver = 0) = 0; + + /** + * Creates a new relation query. + * + * Note that the ownership of the returned query is passed to the caller of + * the method (that is, the caller is responsible for deleting the query). + * + * @param aNamespaceDef namespace where query will be run + * @param aObserver observer which callback methods will be called + * + * @return New relation query. + */ + virtual CMdERelationQuery* NewRelationQueryL( + CMdENamespaceDef& aNamespaceDef, + MMdEQueryObserver* aObserver = 0) = 0; + + /** + * Creates a new event query. + * + * Note that the ownership of the returned query is passed to the caller of + * the method (that is, the caller is responsible for deleting the query). + * + * @param aNamespaceDef namespace where query will be run + * @param aObserver observer which callback methods will be called + * + * @return New event query. + */ + virtual CMdEEventQuery* NewEventQueryL(CMdENamespaceDef& aNamespaceDef, + MMdEQueryObserver* aObserver = 0) = 0; + + + /* Methods for managing observers. */ + + /** + * Adds a new schema observer to the session. No duplicate + * observers are allowed. + * + * @param aObserver observer + */ + virtual void AddSchemaObserverL(MMdESchemaObserver& aObserver) = 0; + + /** + * Removes the specified schema observer from the session. + * + * @param aObserver observer + */ + virtual void RemoveSchemaObserverL(MMdESchemaObserver& aObserver) = 0; + + /** + * Adds a new object observer to the session. No duplicate observers are + * allowed. + * + * The following restrictions are placed on the condition nodes: + * - Only CMdEObjectCondition and CMdEPropertyCondition nodes can be + * used. CMdERangePropertyConditions are not allowed. + * - No nested logic conditions are allowed. + * + * @param aObserver Observer. + * @param aCondition Condition that the objects, about which the observer + * wants to receive notifications, must fulfill or NULL, + * to receive notifications of all objects. + * Ownership of the condition is transferred to the + * session. + * @param aNotificationType what event type (add, modify, remove) should + * be notified to client + * @param aNamespaceDef specified namespace (if namespace is NULL, the + * default namespace is used) + * + * @leave KErrAlreadyExists if the same observer has already been added + */ + virtual void AddObjectObserverL(MMdEObjectObserver& aObserver, + CMdELogicCondition* aCondition = NULL, + TUint32 aNotificationType = ENotifyAdd | ENotifyModify | ENotifyRemove, + CMdENamespaceDef* aNamespaceDef = NULL) = 0; + + /** + * Removes the specified object observer from the session. + * + * @param aObserver observer + * @param aNamespaceDef specified namespace (if namespace is NULL, the + * default namespace is used) + */ + virtual void RemoveObjectObserverL(MMdEObjectObserver& aObserver, + CMdENamespaceDef* aNamespaceDef = NULL) = 0; + + /** + * Adds a new object present observer to the session. No duplicate + * observers are allowed. + * + * @param aObserver Observer + * + * @leave KErrAlreadyExists if the same observer has already been added + */ + virtual void AddObjectPresentObserverL( + MMdEObjectPresentObserver& aObserver) = 0; + + /** + * Removes the specified object present observer from the session. + * + * @param aObserver observer + */ + virtual void RemoveObjectPresentObserverL( + MMdEObjectPresentObserver& aObserver)= 0; + + /** + * Adds a new relation observer to the session. No duplicate observers + * are allowed. + * + * The following restrictions are placed on the condition nodes: + * - Only CMdERelationCondition nodes are allowed. + * - No nested logic conditions are allowed. + * + * @param aObserver Observer. + * @param aCondition Condition that the relations, about which the observer + * wants to receive notifications, must fulfill + * or NULL, to receive notifications of all relations. + * Ownership of the condition is transferred to the + * session. + * @param aNotificationType what event type (add, modify, remove) should + * be notified to client + * @param aNamespaceDef specified namespace (if namespace is NULL, the + * default namespace is used) + * + * @leave KErrAlreadyExists if the same observer has already been added + */ + virtual void AddRelationObserverL(MMdERelationObserver& aObserver, + CMdECondition* aCondition = NULL, + TUint32 aNotificationType = ENotifyAdd | ENotifyModify | ENotifyRemove, + CMdENamespaceDef* aNamespaceDef = NULL)= 0; + /** + * Removes the specified relation observer from the session. + * + * @param aObserver Observer. + * @param aNamespaceDef specified namespace (if namespace is NULL, the + * default namespace is used) + */ + virtual void RemoveRelationObserverL(MMdERelationObserver& aObserver, + CMdENamespaceDef* aNamespaceDef = NULL) = 0; + + /** + * Adds a new relation item observer to the session. + * No duplicate observers are allowed. + * + * The following restrictions are placed on the condition nodes: + * - Only CMdERelationCondition nodes are allowed. + * - No nested logic conditions are allowed. + * + * @param aObserver Observer. + * @param aCondition Condition that the relations, about which the observer + * wants to receive notifications, must fulfill + * or NULL, to receive notifications of all relations. + * Ownership of the condition is transferred to the + * session. + * @param aNotificationType what event type (add, modify, remove) should + * be notified to client + * @param aNamespaceDef specified namespace (if namespace is NULL, the + * default namespace is used) + * + * @leave KErrAlreadyExists if the same observer has already been added + */ + virtual void AddRelationItemObserverL(MMdERelationItemObserver& aObserver, + CMdECondition* aCondition = NULL, + TUint32 aNotificationType = /*ENotifyAdd | ENotifyModify |*/ ENotifyRemove, + CMdENamespaceDef* aNamespaceDef = NULL)= 0; + /** + * Removes the specified relation observer from the session. + * + * @param aObserver Observer. + * @param aNamespaceDef specified namespace (if namespace is NULL, the + * default namespace is used) + */ + virtual void RemoveRelationItemObserverL(MMdERelationItemObserver& aObserver, + CMdENamespaceDef* aNamespaceDef = NULL) = 0; + + /** + * Adds a new realation present observer to the session. No duplicate observers are + * allowed. + * + * @param aObserver Observer. + * + * @leave KErrAlreadyExists if the same observer has already been added + */ + virtual void AddRelationPresentObserverL( + MMdERelationPresentObserver& aObserver) = 0; + + /** + * Removes the specified relation present observer from the session. + * + * @param aObserver observer + */ + virtual void RemoveRelationPresentObserverL( + MMdERelationPresentObserver& aObserver)= 0; + + /** + * Adds a new event observer to the session. No duplicate observers + * are allowed. + * + * The following restrictions are placed on the condition nodes: + * - Only CMdEEventCondition nodes are allowed. + * - No nested logic conditions are allowed. + * + * @param aObserver Observer. + * @param aCondition Condition that the events, about which the observer + * wants to receive notifications, must fulfill + * or NULL, to receive notifications of all events. + * @param aNotificationType what event type (add or remove) should + * be notified to client + * @param aNamespaceDef specified namespace (if namespace is NULL, the + * default namespace is used) + * + * @leave KErrAlreadyExists if the same observer has already been added + */ + virtual void AddEventObserverL(MMdEEventObserver& aObserver, + CMdECondition* aCondition = NULL, + TUint32 aNotificationType = ENotifyAdd | ENotifyRemove, + CMdENamespaceDef* aNamespaceDef = NULL) = 0; + + /** + * Removes the specified event observer from the session. + * + * @param aObserver Observer. + * @param aNamespaceDef specified namespace (if namespace is NULL, the + * default namespace is used) + */ + virtual void RemoveEventObserverL(MMdEEventObserver& aObserver, + CMdENamespaceDef* aNamespaceDef = NULL) = 0; + + + /* Methods for import/export */ + + /** + * Imports schemadata from file to default database. + * + * @param aFileName filename where the schemadata to import is. + */ + virtual void ImportSchemaL( const TDesC& aFileName ) = 0; + + /** + * Imports metadata from file to default database. + * + * @param aFileName filename where the metadata to import is. + * @return The number of failed imports + */ + virtual TInt ImportMetadataL( const TDesC& aFileName ) = 0; + + /** + * Imports metadata asynchronously from file to default database. + * + * @param aFileName Filename where the metadata to import is. + * @param aResult The number of failed imports and possible error code. + * @param aStatus Returned status of method call. + */ + virtual void ImportMetadata( const TDesC& aFileName, + TPckgBuf& aResult, TRequestStatus& aStatus ) = 0; + + /** + * Exports metadata to file. + * + * @param aFileName filename where the metadata is to be exported. + * @param aNamespaceDef specified namespace (if namespace is NULL, the + * default namespace is used), ownership doesn't + * change + * @param aObjectDefs object types to export (if NULL all objects are + * exported), ownership doesn't change + * @param aRelationDefs relation types to export (if NULL all relations + * are exported), ownership doesn't change + * @param aEventDefs event types to export (if NULL all events are + * exported), ownership doesn't change + */ + virtual void ExportMetadataL( const TDesC& aFileName, + const CMdENamespaceDef* aNamespaceDef = NULL, + const RPointerArray* aObjectDefs = NULL, + const RPointerArray* aRelationDefs = NULL, + const RPointerArray* aEventDefs = NULL ) = 0; + + /** + * Exports metadata asynchronously to file. + * + * @param aFileName Filename where the metadata is to be exported. + * @param aStatus Returns the result code after the asynchronous call + * completes. + * @param aBuffer Serialized buffer of export types, must be valid until + * aStatus is completed and can be closed after that. + * @param aNamespaceDef Specified namespace (if namespace is NULL, the + * default namespace is used), ownership doesn't + * change. + * @param aObjectDefs Object types to export (if NULL all objects are + * exported), ownership doesn't change. + * @param aRelationDefs Relation types to export (if NULL all relations + * are exported), ownership doesn't change. + * @param aEventDefs Event types to export (if NULL all events are + * exported), ownership doesn't change. + */ + virtual void ExportMetadataL( const TDesC& aFileName, + TRequestStatus& aStatus, RMdEDataBuffer& aBuffer, + const CMdENamespaceDef* aNamespaceDef = NULL, + const RPointerArray* aObjectDefs = NULL, + const RPointerArray* aRelationDefs = NULL, + const RPointerArray* aEventDefs = NULL ) = 0; + /** + * Load whole schema from server side. + */ + virtual void LoadSchemaL() = 0; + + /** + * Get engine session reference. + */ + virtual RMdEEngineSession& EngineSession() = 0; + + /** + * Get schema version's major and minor version. + * + * @param aMajorVersion returned major version + * @param aMinorVersion returned minor version + */ + virtual void GetSchemaVersionL( + TInt& aMajorVersion, TInt& aMinorVersion) = 0; + + /** + * Set object to "present" state by GUID. + * + * @param aGuidHigh Guid's high part + * @param aGuidLow Guid's low part + * + * @leave KErrNotFound MdE can't find object in "not present" state + * with matching GUID + */ + virtual void SetObjectToPresentByGuidL( + const TInt64& aGuidHigh, const TInt64& aGuidLow ) = 0; + + /** + * Adds a new object observer to the session. No duplicate observers are + * allowed. + * + * The following restrictions are placed on the condition nodes: + * - Only CMdEObjectCondition and CMdEPropertyCondition nodes can be + * used. CMdERangePropertyConditions are not allowed. + * - No nested logic conditions are allowed. + * + * Be adviced, this version with the URI in the callback is much less + * efficient than using version without the URI + * + * @param aObserver Observer. + * @param aCondition Condition that the objects, about which the observer + * wants to receive notifications, must fulfill or NULL, + * to receive notifications of all objects. + * Ownership of the condition is transferred to the + * session. + * @param aNotificationType what event type (add, modify, remove) should + * be notified to client + * @param aNamespaceDef specified namespace (if namespace is NULL, the + * default namespace is used) + * @param aUriRequired determines if uri is required in the callback + * + * @leave KErrAlreadyExists if the same observer has already been added + */ + virtual void AddObjectObserverWithUriL( MMdEObjectObserverWithUri& aObserver, + CMdELogicCondition* aCondition = NULL, + TUint32 aNotificationType = ENotifyAdd | ENotifyModify | ENotifyRemove, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + + /** + * Removes the specified object observer from the session. + * + * @param aObserver observer + */ + virtual void RemoveObjectObserverWithUriL( MMdEObjectObserverWithUri& aObserver, + CMdENamespaceDef* aNamespaceDef = NULL ) = 0; + +protected: + + /* Constructors. */ + + /** + * Constructor. + */ + CMdESession(); + + /** + * Second-phase constructor. + */ + void SessionConstruct(); + }; + +// includes only for client more convinient usage +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif // __MDESESSION_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdetextproperty.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdetextproperty.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,48 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMdETextProperty's compatible wrapper to CMdEProperty +* +*/ + + +#ifndef __MDETEXTPROPERTY_H__ +#define __MDETEXTPROPERTY_H__ + +#include + +/** + * Text property compatibility wrapper to property. + */ +NONSHARABLE_CLASS(CMdETextProperty) : public CMdEProperty + { +public: + /** + * Returns the text value of the property. + * + * @return value + */ + const TDesC& Value() const; + + /** + * Sets the text value of the property. + * + * @param aValue New value. + */ + void SetValueL(const TDesC& aValue); + }; + +#include + +#endif // __MDETEXTPROPERTY_H__ + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdetextproperty.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdetextproperty.inl Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,54 @@ +/* +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: CMdETextProperty's compatibility wrapper to CMdEProperty +* +*/ + +_LIT( KCMdETextPropertyGetValuePanic, "CMdETextProperty::Value" ); +_LIT( KCMdETextPropertySetValuePanic, "CMdETextProperty::SetValueL" ); + +// --------------------------------------------------------------------------- +// Value +// --------------------------------------------------------------------------- +// +inline const TDesC& CMdETextProperty::Value() const + { + TDesC* des = NULL; + + TRAPD( err, des = CONST_CAST( TDesC*, &TextValueL() ) ); + if( err != KErrNone ) + { +#ifdef _DEBUG + User::Panic( KCMdETextPropertyGetValuePanic, KErrNotSupported ); +#endif + return KNullDesC; + } + return *des; + } + +// --------------------------------------------------------------------------- +// SetValueL +// --------------------------------------------------------------------------- +// +inline void CMdETextProperty::SetValueL(const TDesC& aValue) + { + TRAPD( err, SetTextValueL( aValue ) ); + if( err != KErrNone ) + { +#ifdef _DEBUG + User::Panic( KCMdETextPropertySetValuePanic, KErrNotSupported ); +#endif + } + } + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdetextpropertycondition.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdetextpropertycondition.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,140 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +#ifndef __MDETEXTPROPERTYCONDITION_H__ +#define __MDETEXTPROPERTYCONDITION_H__ + + +#include + + +/* Forward declarations. */ +class CMdEPropertyDef; + + +/** + * Instances of CMdETextPropertyCondition are associated with a specific + * property definition. + */ +NONSHARABLE_CLASS(CMdETextPropertyCondition) : public CMdEPropertyCondition + { +public: + + /* Constructors and destructor. */ + + /** + * Constructs a new text property condition node. + * + * @param aPropertyDef Property definition. + * @param aCompareMethod Text comparison method. + * @param aText Text to look for. + */ + static CMdETextPropertyCondition* NewL(const CMdEPropertyDef& aPropertyDef, + TTextPropertyConditionCompareMethod aCompareMethod, + const TDesC& aText); + + /** + * Constructs a new text property condition node, leaving it on the + * cleanup stack. + * + * @param aPropertyDef Property definition. + * @param aCompareMethod Text comparison method. + * @param aText Text to look for. + */ + static CMdETextPropertyCondition* NewLC(const CMdEPropertyDef& aPropertyDef, + TTextPropertyConditionCompareMethod aCompareMethod, + const TDesC& aText); + + /** + * Destructor. + */ + virtual ~CMdETextPropertyCondition(); + + + /* Methods. */ + + /** + * Returns the text of the condition. + * + * @return Text descriptor. + */ + const TDesC& Text() const; + + /** + * Returns the comparison method of the condition. + * + * @return Comparison method. + */ + TTextPropertyConditionCompareMethod CompareMethod() const; + + /** + * Get possible query's internal optimization flags from condition. + * + * @param aFlaga query's internal optimization flags + * @return last level internal optimization flags + */ + TUint32 InternalQueryOptimizationFlags(TUint32& aFlags); + + /** + * Get required size of serialized buffer when this is serialized. + * + * @return required size of serialized buffer + */ + TUint32 RequiredBufferSize() const; + + /** + * Serialize own data to serialized buffer (correct position must be set + * before calling) and return new position of serialized buffer. + * + * @param aBuffer serialized buffer. + */ + void SerializeL(CMdCSerializationBuffer& aBuffer, + TMdCOffset& aFreespaceOffset) const; + +protected: + + /** + * Constructor. + * + * @param aType type of the condition node + */ + CMdETextPropertyCondition(const CMdEPropertyDef& aPropertyDef, + TTextPropertyConditionCompareMethod aCompareMethod); + + + /** + * Second-phase constuctor. + */ + void ConstructL(const TDesC& aText); + + +private: + + /* Private methods. */ + + +private: + + /** The comparison method used when searching for the string. */ + TTextPropertyConditionCompareMethod iCompareMethod; + + /** The string to look for. */ + HBufC* iText; + }; + +#endif // __MDETEXTPROPERTYCONDITION_H__ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/inc/mdeversioncenrepkey.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/inc/mdeversioncenrepkey.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,26 @@ +/* +* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MDEVERSIONCENREPKEY_H +#define MDEVERSIONCENREPKEY_H + +const TUid KMetadataEngineRepoUid = { 0x200009F3 }; + +const TUint32 KMdEVersionMajorKey = 0x1; +const TUint32 KMdEVersionMinorKey = 0x2; + +#endif /*MDEVERSIONCENREPKEY_H*/ diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/metadata_engine_api.metaxml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/metadata_engine_api.metaxml Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,15 @@ + + +metadata_engine_api +metadata engine api +c++ +metadataengine + + + + + +no +no + + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/Bmarm/MdETestScripteru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/Bmarm/MdETestScripteru.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/Bwins/MdETestScripteru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/Bwins/MdETestScripteru.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * LibEntryL(class CTestModuleIf &) + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/conf/MdETestScripter.cfg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/conf/MdETestScripter.cfg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3188 @@ +# +# Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). +# All rights reserved. +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Nokia Corporation - initial contribution. +# +# Contributors: +# +# Description: Metadata Engine API tests +# + +// --------------------------------------------------------------------------- +// Metadata Engine API test cases +// --------------------------------------------------------------------------- + +// These should be run in sequential mode if several cases are run at the same +// time! + +[Define] +KErrNotFound -1 +KErrGeneral -2 +KErrNotSupported -5 +KErrArgument -6 +KErrCorrupt -20 +KErrAccessDenied -21 +KErrLocked -22 +KErrAlreadyExists -11 + +KErrIncorrectType = -36201 + +KLast -1; + +KById 0 +KByUri 1 +KByGuid 2 +KByIds 3 +KByDef 4 +KByIndex 5 + +KAsync 0 +KSync 1 + +KL 0 +KLC 1 + +EFalse 0 +ETrue 1 + +ESession 0 +EObjectDef 1 +ERelationDef 2 +EPropertyDef 3 +EEventDef 4 +ENamespaceDef 5 +EObject 6 +ERelation 7 +EProperty 8 +EEvent 9 + +ENotifyAdd 1 +ENotifyModify 2 +ENotifyRemove 4 + +ESortDescending 0 +ESortAscending 1 + +// enum TOrderRuleType +EOrderRuleTypeItemID 1 +EOrderRuleTypeObjectURI 2 +EOrderRuleTypeObjectDef 3 +EOrderRuleTypeProperty 4 +EOrderRuleTypeCreationTime 5 +EOrderRuleTypeUsageCount 6 +EOrderRuleTypeSourceURI 7 +EOrderRuleTypeParticipantURI 8 +EOrderRuleTypeTargetObjectID 9 +EOrderRuleTypeEventDef 10 +EOrderRuleTypeParameterValue 11 +EOrderRuleTypeLeftObjectID 12 +EOrderRuleTypeRightObjectID 13 +EOrderRuleTypeRelationDef 14 + +KNoNegate 0 +KNegate 1 + +EOther 0 +ECamera 1 +EDownloaded 2 +ESideLoaded 3 +ERecorded 4 + +ELogicConditionOperatorAnd 1 +ELogicConditionOperatorOr 2 + +EAlbumUser 0 +EAlbumUserPredefined 1 +EAlbumSystemFavourite 2 + +[Enddefine] + +[Test] +title Observer 1: Add*ObserverL, Remove*ObserverL +create MdETestScripter test +waittestclass test +test AddSchemaObserverL +test RemoveSchemaObserverL +allownextresult KErrNotFound +test RemoveSchemaObserverL +test AddObjectObserverL +test RemoveObjectObserverL +allownextresult KErrNotFound +test RemoveObjectObserverL +test AddObjectObserverWithUriL +test RemoveObjectObserverWithUriL +allownextresult KErrNotFound +test RemoveObjectObserverWithUriL +test AddObjectPresentObserverL +test RemoveObjectPresentObserverL +allownextresult KErrNotFound +test RemoveObjectPresentObserverL +test AddRelationObserverL +test RemoveRelationObserverL +allownextresult KErrNotFound +test RemoveRelationObserverL +test AddRelationItemObserverL +test RemoveRelationItemObserverL +allownextresult KErrNotFound +test RemoveRelationItemObserverL +test AddRelationPresentObserverL +test RemoveRelationPresentObserverL +allownextresult KErrNotFound +test RemoveRelationPresentObserverL +test AddEventObserverL +test RemoveEventObserverL +allownextresult KErrNotFound +test RemoveEventObserverL +delete test +[Endtest] + +[Test] +title Schema 1: ImportMetadataL, ExportMetadataL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test ImportMetadataL \Data\MdETestScripterImportMetadata.mde KSync +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_01.mde KSync EFalse EFalse EFalse +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_02.mde KSync EFalse EFalse ETrue +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_03.mde KSync EFalse ETrue EFalse +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_04.mde KSync EFalse ETrue ETrue +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_05.mde KSync ETrue EFalse EFalse +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_06.mde KSync ETrue EFalse ETrue +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_07.mde KSync ETrue ETrue EFalse +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_08.mde KSync ETrue ETrue ETrue +test ImportMetadataL \Data\MdETestScripterImportMetadata.mde KAsync +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_11.mde KAsync EFalse EFalse EFalse +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_12.mde KAsync EFalse EFalse ETrue +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_13.mde KAsync EFalse ETrue EFalse +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_14.mde KAsync EFalse ETrue ETrue +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_15.mde KAsync ETrue EFalse EFalse +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_16.mde KAsync ETrue EFalse ETrue +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_17.mde KAsync ETrue ETrue EFalse +test ExportMetadataL defaultNs \Data\MdETestScripterExportMetadata1_18.mde KAsync ETrue ETrue ETrue +delete test +[Endtest] + +[Test] +title Schema 2: ImportSchemaL, NamespaceDefCountL +create MdETestScripter test +waittestclass test +test ImportSchemaL \Data\MDETestScripterSchema.mde +allowerrorcodes KErrCorrupt +test ImportSchemaL \Data\MdETestScripterSchema2.mde +test NamespaceDefCountL 3 +test LoadSchemaL +test EngineSessionL +test GetSchemaVersionL 1 0 +delete test +[Endtest] + +[Test] +title Schema 3: GetNamespaceDefL, GetDefaultNamespaceDefL, NamespaceDefL, CompareL, NameL, ReadOnlyL +create MdETestScripter test +waittestclass test +test GetNamespaceDefL ns "http:\/\/sw.nokia.com/MdE" +test NameL ENamespaceDef ns "http:\/\/sw.nokia.com/MdE" +test GetDefaultNamespaceDefL defaultNs +test NameL ENamespaceDef defaultNs "http:\/\/sw.nokia.com/MdE" +test NamespaceDefL ns2 ESession 0 +test NameL ENamespaceDef ns2 "http:\/\/sw.nokia.com/MdE" +test CompareL ENamespaceDef ns defaultNs 0 +test CompareL ENamespaceDef defaultNs ns 0 +test ReadOnlyL ENamespaceDef defaultNs EFalse +delete test +[Endtest] + +[Test] +title Schema 4: SetObjectToPresentByGuidL +create MdETestScripter test +waittestclass test +allownextresult KErrNotFound +test SetObjectToPresentByGuidL 123 456 +delete test +[Endtest] + +[Test] +title Definitions 1: AddRelationDefL +create MdETestScripter test +waittestclass test +allowerrorcodes KErrCorrupt +test ImportSchemaL \Data\MdETestScripterSchema2.mde +test GetNamespaceDefL testNs "http:\/\/sw.nokia.com/MdE/TestSchema2" +test AddSchemaObserverL +request ESchemaModified +allowerrorcodes KErrAlreadyExists +test AddRelationDefL testNs TestRelation +wait ESchemaModified +release ESchemaModified +test ResetNamespaceDefArray +test GetNamespaceDefL testNs "http:\/\/sw.nokia.com/MdE/TestSchema2" +test GetRelationDefL relationDef testNs TestRelation +// Relation name must only be characters +allownextresult KErrGeneral +test AddRelationDefL testNs TestRelation1 +delete test +[Endtest] + +[Test] +title Definitions 2: AddEventDefL +create MdETestScripter test +waittestclass test +allowerrorcodes KErrCorrupt +test ImportSchemaL \Data\MdETestScripterSchema2.mde +test GetNamespaceDefL testNs "http:\/\/sw.nokia.com/MdE/TestSchema2" +test AddSchemaObserverL +request ESchemaModified +allowerrorcodes KErrAlreadyExists +test AddEventDefL testNs TestEvent +wait ESchemaModified +release ESchemaModified +test ResetNamespaceDefArray +test GetNamespaceDefL testNs "http:\/\/sw.nokia.com/MdE/TestSchema2" +test GetEventDefL eventDef testNs TestEvent +// Relation name must only be characters +allownextresult KErrGeneral +test AddEventDefL testNs TestEvent1 +delete test +[Endtest] + +[Test] +title Definitions 3: GetRelationDefL, RelationDefL, RelationDefCountL, GetEventDefL, EventDefL, EventDefCountL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetRelationDefL relDefContains defaultNs Contains +test GetRelationDefL relDefReplaces defaultNs Replaces +test GetRelationDefL relDefIsVersionOf defaultNs IsVersionOf +test GetRelationDefL relDefRequiresf defaultNs Requires +test GetRelationDefL relDefUses defaultNs Uses +test GetRelationDefL relDefReferences defaultNs References +test GetRelationDefL relDefSummarises defaultNs Summarises +test GetRelationDefL relDefContainsLocation defaultNs ContainsLocation +loop 8 +test RelationDefL relDefARRAY_INDEX defaultNs LOOP_COUNTER +endloop +test RelationDefCountL defaultNs 8 +test GetEventDefL eventDefCreated defaultNs Created +test GetEventDefL eventDefDeleted defaultNs Deleted +test GetEventDefL eventDefOpened defaultNs Opened +test GetEventDefL eventDefPlayed defaultNs Played +test GetEventDefL eventDefEdited defaultNs Edited +test GetEventDefL eventDefSent defaultNs Sent +test GetEventDefL eventDefReceived defaultNs Received +loop 7 +test EventDefL eventDefARRAY_INDEX defaultNs LOOP_COUNTER +endloop +test EventDefCountL defaultNs 7 +test NamespaceDefL ns1 ERelationDef relDefContains +test NamespaceDefL ns2 EEventDef eventDefCreated +delete test +[Endtest] + +[Test] +title Definitions 4: GetObjectDefL, GetPropertyDefL, ReadOnlyL, MandatoryL, NameL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL objectDefLocation defaultNs Location +test GetObjectDefL objectDefCalendar defaultNs Calendar +test GetObjectDefL objectDefContact defaultNs Contact +test GetObjectDefL objectDefMessage defaultNs Message +test GetObjectDefL objectDefAlbum defaultNs Album +test GetObjectDefL objectDefTag defaultNs Tag +test GetObjectDefL objectDefMediaObject defaultNs MediaObject +test GetObjectDefL objectDefVideo defaultNs Video +test ParentL objectDefVideo objectDefMediaObject +test PropertyDefCountL objectDefVideo 5 +test PropertyDefL propDefVideo0 defaultNs objectDefVideo 0 +allownextresult KErrArgument +test PropertyDefL propDefErr defaultNs objectDefVideo -1 +test GetPropertyDefL videoCreationDatePropDef objectDefVideo CreationDate +test NameL EPropertyDef videoCreationDatePropDef "CreationDate" +test ReadOnlyL EPropertyDef videoCreationDatePropDef EFalse +test MandatoryL videoCreationDatePropDef ETrue +test ObjectDefL EPropertyDef objectDefVideo2 videoCreationDatePropDef +test GetPropertyDefL lastModifiedDatePropDef objectDefVideo LastModifiedDate +test NameL EPropertyDef lastModifiedDatePropDef "LastModifiedDate" +test ReadOnlyL EPropertyDef lastModifiedDatePropDef EFalse +test MandatoryL lastModifiedDatePropDef ETrue +test ObjectDefL EPropertyDef objectDefVideo3 lastModifiedDatePropDef +test GetObjectDefL objectDefImage defaultNs Image +test ParentL objectDefImage objectDefMediaObject +test GetPropertyDefL imageCreationDatePropDef objectDefImage CreationDate +test NameL EPropertyDef imageCreationDatePropDef "CreationDate" +test ReadOnlyL EPropertyDef imageCreationDatePropDef EFalse +test ObjectDefL EPropertyDef objectDefImage2 imageCreationDatePropDef +test MandatoryL imageCreationDatePropDef ETrue +test GetPropertyDefL imageLastModifiedDatePropDef objectDefImage LastModifiedDate +test NameL EPropertyDef imageLastModifiedDatePropDef "LastModifiedDate" +test ReadOnlyL EPropertyDef imageLastModifiedDatePropDef EFalse +test ObjectDefL EPropertyDef objectDefImage3 imageLastModifiedDatePropDef +test MandatoryL imageLastModifiedDatePropDef ETrue +test GetObjectDefL audioObjDef defaultNs Audio +test GetPropertyDefL audioCreationDatePropDef audioObjDef CreationDate +test NameL EPropertyDef audioCreationDatePropDef "CreationDate" +test ReadOnlyL EPropertyDef audioCreationDatePropDef EFalse +test ObjectDefL EPropertyDef audioObjDef2 audioCreationDatePropDef +test MandatoryL audioCreationDatePropDef ETrue +test GetPropertyDefL audioLastModifiedDatePropDef audioObjDef LastModifiedDate +test NameL EPropertyDef audioLastModifiedDatePropDef "LastModifiedDate" +test ReadOnlyL EPropertyDef audioLastModifiedDatePropDef EFalse +test ObjectDefL EPropertyDef audioObjDef3 audioLastModifiedDatePropDef +test MandatoryL audioLastModifiedDatePropDef ETrue +test GetObjectDefL objectDefTrackLog defaultNs TrackLog +test ObjectDefCountL defaultNs 12 +test NamespaceDefL ns1 EPropertyDef videoCreationDatePropDef +delete test +[Endtest] + +[Test] +title Edit Object 1: NewObjectL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test NewObjectL obj1 videoObjDef KLC +delete test +[Endtest] + +[Test] +title Edit Object 2: OpenObjectL, CancelObjectL, OpenForModificationsL, MovePropertiesL, CommitObjectL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test ImportMetadataL \Data\MdETestScripterImportMetadata.mde KSync +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\test2video1.3gp +test OpenForModificationsL obj0 ETrue +test OpenObjectL obj1 obj0 KByUri ENamespaceDef defaultNs +test OpenForModificationsL obj1 ETrue +allownextresult KErrLocked +test OpenObjectL objNone obj1 KByUri ENamespaceDef defaultNs +// objNone does not exist because open failed +test CancelObjectL obj1 +test OpenForModificationsL obj1 EFalse +allownextresult KErrAccessDenied +test MovePropertiesL obj0 obj1 +test OpenObjectL obj2 obj1 KByUri ENamespaceDef defaultNs +test SetMediaIdL obj2 121212 +test CommitObjectL obj2 +test OpenObjectL obj3 obj1 KByGuid ENamespaceDef defaultNs +test CommitObjectL obj3 +test OpenObjectL obj4 obj1 KById ENamespaceDef defaultNs +test CommitObjectL obj4 +test OpenObjectL obj5 obj1 KByUri EObjectDef videoObjDef +test CommitObjectL obj5 +test OpenObjectL obj6 obj1 KByGuid EObjectDef videoObjDef +test CommitObjectL obj6 +test OpenObjectL obj7 obj1 KById EObjectDef videoObjDef +test SetGuidL EObject obj7 000002 000001 +test CommitObjectL obj7 +delete test +[Endtest] + +[Test] +title Edit Object 3: CommitObjectsL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test ImportMetadataL \Data\MdETestScripterImportMetadata.mde KSync +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\test3video1.3gp +test OpenObjectL obj1 obj0 KByUri ENamespaceDef defaultNs +test SetUriL obj0 e:\testing\data\test3video2.mp4 +test OpenObjectL obj2 obj0 KByUri ENamespaceDef defaultNs +// Commit two objects at starting from obj1 which created before obj2 +test SetGuidL EObject obj2 000003 000002 +test CommitObjectsL obj1 2 +delete test +[Endtest] + +[Test] +title Edit Object 4: OpenFullObjectL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test ImportMetadataL \Data\MdETestScripterImportMetadata.mde KSync +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\test4video1.3gp +test OpenFullObjectL obj1 obj0 KByUri +allownextresult KErrLocked +test OpenFullObjectL objNone obj0 KByUri +// objNone does not exist because open failed +test CancelObjectL obj1 +test OpenFullObjectL obj2 obj1 KByUri +test CommitObjectL obj2 +test OpenFullObjectL obj3 obj1 KByGuid +test CommitObjectL obj3 +test OpenFullObjectL obj4 obj1 KById +test SetGuidL EObject obj4 000004 000001 +test CommitObjectL obj4 +delete test +[Endtest] + +[Test] +title Edit Object 5: GetObjectL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test ImportMetadataL \Data\MdETestScripterImportMetadata.mde KSync +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\testvideo2.mp4 +test GetObjectL obj1 obj0 KByUri EObjectDef videoObjDef +test GetObjectL obj2 obj1 KById EObjectDef videoObjDef +test GetObjectL obj3 obj1 KByGuid EObjectDef videoObjDef +test GetObjectL obj4 obj1 KByUri ENamespaceDef defaultNs +test GetObjectL obj5 obj1 KById ENamespaceDef defaultNs +test GetObjectL obj6 obj1 KByGuid ENamespaceDef defaultNs +delete test +[Endtest] + +[Test] +title Edit Object 6: GetFullObjectL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test ImportMetadataL \Data\MdETestScripterImportMetadata.mde KSync +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\testvideo2.mp4 +test GetFullObjectL obj1 videoObjDef obj0 KByUri +test GetFullObjectL obj2 videoObjDef obj1 KById +test GetFullObjectL obj3 videoObjDef obj1 KByGuid +delete test +[Endtest] + +[Test] +title Edit Object 7: AddObjectL, AddObjectsL, RemoveObjectL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs + +// Create four objects. +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test GetPropertyDefL creaDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creaDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000007 000001 +test NewObjectL obj1 videoObjDef KL +test GetPropertyDefL creaDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creaDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test SetGuidL EObject obj1 000007 000002 +test NewObjectL obj2 videoObjDef KL +test GetPropertyDefL creaDatePropDef2 videoObjDef CreationDate +test AddTimePropertyL obj2 creaDatePropDef2 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef2 videoObjDef LastModifiedDate +test AddTimePropertyL obj2 lastModDatePropDef2 20081130:235959.999999 +test SetGuidL EObject obj2 000007 000003 +test NewObjectL obj3 videoObjDef KL +test GetPropertyDefL creaDatePropDef3 videoObjDef CreationDate +test AddTimePropertyL obj3 creaDatePropDef3 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef3 videoObjDef LastModifiedDate +test AddTimePropertyL obj3 lastModDatePropDef3 20081130:235959.999999 +test SetGuidL EObject obj3 000007 000004 + +// Add the objects to the database, observe the additions and verify the observed results. +test AddObjectObserverL +test AddObjectL obj0 +waittestclass test +test VerifyObserverNotificationTypeL ENotifyAdd +test AddObjectsL obj1 3 +waittestclass test +test VerifyObserverNotificationTypeL ENotifyAdd +test RemoveObjectObserverL +test VerifyTItemIdsL EObject 0 4 + +// Remove the objects, observe the removals and verify the observed results. +test AddObjectObserverL +test RemoveObjectL obj0 KById +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +test RemoveObjectL obj1 KById +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +test RemoveObjectL obj2 KById +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +test RemoveObjectL obj3 KById +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +test RemoveObjectObserverL +test VerifyTItemIdsL EObject 0 4 + +// Final cleanup. +delete test +[Endtest] + +[Test] +title Edit Object 8: CheckObjectL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test ImportMetadataL \Data\MdETestScripterImportMetadata.mde KSync +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\testvideo2.mp4 +test GetObjectL obj1 obj0 KByUri EObjectDef videoObjDef +test SetUriL obj0 e:\testing\data\testvideo1.3gp +test GetObjectL obj2 obj0 KByUri EObjectDef videoObjDef +test CheckObjectL obj1 KByUri +test CheckObjectL obj1 KById +test CheckObjectL obj1 KByIds 2 +delete test +[Endtest] + +[Test] +title Edit Object 9: MovePropertiesL, PropertyCountL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test GetPropertyDefL creationDatePropDef videoObjDef CreationDate +test GetPropertyDefL lastModDatePropDef videoObjDef LastModifiedDate +test GetPropertyDefL durationPropDef videoObjDef Duration +test GetPropertyDefL sizePropDef videoObjDef Size +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\test9video0.mp4 +test AddTimePropertyL obj0 creationDatePropDef 20090611:235959.999999 +test AddTimePropertyL obj0 lastModDatePropDef 20090611:235959.999999 +test AddReal32PropertyL obj0 durationPropDef 30 +test AddUint32PropertyL obj0 sizePropDef 999999 +test AddObjectL obj0 +test NewObjectL obj1 videoObjDef KL +test SetUriL obj1 e:\testing\data\test9video0.mp4 +test GetObjectL obj2 obj1 KByUri EObjectDef videoObjDef +test SetGuidL EObject obj2 000009 000001 +test PropertyCountL EObject obj2 4 +test MovePropertiesL obj2 obj1 +test PropertyCountL EObject obj2 0 +test PropertyCountL EObject obj1 4 +test GetPropertyDefL creaDatePropDef0 videoObjDef CreationDate +test PropertyCountL EPropertyDef obj1 creaDatePropDef0 1 +test SetUriL obj1 e:\testing\data\test9video1.mp4 +test AddObjectL obj1 +test RemoveObjectsL KSync KById obj0 2 1 +delete test +[Endtest] + +[Test] +title Edit Object 10: Add*PropertyL, Set*ValueL, RemovePropertyL, PropertyL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL KLast e:\testing\data\test10video2.mp4 +test GetPropertyDefL creaDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creaDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test GetPropertyDefL titleDef videoObjDef Title +test AddTextPropertyL obj0 titleDef "Testi" +test GetPropertyDefL descrDef videoObjDef Description +test AddTextPropertyL obj0 descrDef "Testi" +test GetPropertyDefL commentDef videoObjDef Comment +test AddTextPropertyL obj0 commentDef "Testi" +test GetPropertyDefL ratingDef videoObjDef Rating +test AddUint8PropertyL obj0 ratingDef 3 +test GetPropertyDefL genreDef videoObjDef Genre +test AddTextPropertyL obj0 genreDef "Testi" +test GetPropertyDefL copyrightDef videoObjDef Copyright +test AddTextPropertyL obj0 copyrightDef "Testi" +test GetPropertyDefL authorDef videoObjDef Author +test AddTextPropertyL obj0 authorDef "Testi" +test GetPropertyDefL bitrateDef videoObjDef Bitrate +test AddUint16PropertyL obj0 bitrateDef 32 +test GetPropertyDefL framerateDef videoObjDef Framerate +test AddReal32PropertyL obj0 framerateDef 32 +test PropertyCountL EObject obj0 11 +test SetGuidL EObject obj0 000010 000001 +test AddObjectL obj0 +loop 11 +test PropertyL propARRAY_INDEX KByDef obj0 LOOP_COUNTER 0 +test BelongsToSessionL EProperty KLast ETrue +test InDatabaseL EProperty KLast ETrue +test DefL defARRAY_INDEX EPropertyDef KLast +test CompareL EPropertyDef KLast LOOP_COUNTER 0 +endloop +loop 11 +test PropertyL prop2_ARRAY_INDEX KByIndex obj0 LOOP_COUNTER +endloop +// Test out of range index parameters to PropertyL +allownextresult KErrArgument +test PropertyL propErr KByIndex obj0 -1 +allownextresult KErrArgument +test PropertyL propErr KByIndex obj0 12 +test SetTextValueL prop2 "Testi2" +test SetTextValueL prop3 "Testi2" +test SetTextValueL prop4 "Testi2" +test SetUint8ValueL prop5 4 +test SetTextValueL prop6 "Testi2" +test SetTextValueL prop7 "Testi2" +test SetTextValueL prop8 "Testi2" +test SetUint16ValueL prop9 16 +test SetReal32ValueL prop10 16 +test PropertyCountL EObject obj0 11 +loop 11 +test ObjectL LOOP_COUNTER obj0 +endloop +test OpenObjectL obj1 obj0 KById ENamespaceDef defaultNs +test RemovePropertyL obj1 Title +test RemovePropertyL obj1 Description +test RemovePropertyL obj1 Comment +test RemovePropertyL obj1 Rating +test RemovePropertyL obj1 Genre +test RemovePropertyL obj1 Copyright +test RemovePropertyL obj1 Author +test RemovePropertyL obj1 Bitrate +test RemovePropertyL obj1 Framerate +test PropertyCountL EObject obj1 3 +test CommitObjectL obj1 +test RemoveObjectL obj1 KById +delete test +[Endtest] + +[Test] +title Edit Object 11: NewRelationL, AddRelationL, RemoveRelationL, SetGuid, GuidL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs + +// Create two objects and add them to the database. +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test GetPropertyDefL creteDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creteDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000011 000001 +test AddObjectL obj0 +test NewObjectL obj1 videoObjDef KL +test GetPropertyDefL creteDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creteDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test SetGuidL EObject obj1 000011 000002 +test AddObjectL obj1 + +// Now add some relations between the two objects. +test GetRelationDefL relDefContains defaultNs Contains +test NewRelationL rel0 obj1 relDefContains obj0 0 KL +test SetGuidL ERelation rel0 000011 000101 +test GetRelationDefL relDefReplaces defaultNs Replaces +test NewRelationL rel1 obj1 relDefReplaces obj0 0 KLC +test SetGuidL ERelation rel1 000011 000102 +test GetRelationDefL relDefIsVersionOf defaultNs IsVersionOf +test NewRelationL rel2 obj1 relDefIsVersionOf obj0 0 KL +test SetGuidL ERelation rel2 000011 000103 +test GetRelationDefL relDefRequires defaultNs Requires +test NewRelationL rel3 obj1 relDefRequires obj0 0 KLC +test SetGuidL ERelation rel3 000011 000104 +test GetRelationDefL relDefUses defaultNs Uses +test NewRelationL rel4 obj1 relDefUses obj0 0 KL +test SetGuidL ERelation rel4 000011 000105 +test GetRelationDefL relDefReferences defaultNs References +test NewRelationL rel5 obj1 relDefReferences obj0 0 KLC +test SetGuidL ERelation rel5 000011 000106 +test GetRelationDefL relDefSummarises defaultNs Summarises +test NewRelationL rel6 obj1 relDefSummarises obj0 0 KL +test SetGuidL ERelation rel6 000011 000107 +test CompareL ERelationDef relDefContains relDefContains 0 +test CompareL ERelationDef relDefReplaces relDefContains 1 + +// Now add the relations to the database, observe the additions and verify the observed results. +test AddRelationObserverL +loop 7 +test BelongsToSessionL ERelation LOOP_COUNTER EFalse +test InDatabaseL ERelation LOOP_COUNTER EFalse +test AddRelationL LOOP_COUNTER +waittestclass test +test VerifyObserverNotificationTypeL ENotifyAdd +test BelongsToSessionL ERelation LOOP_COUNTER ETrue +test SessionL ERelation LOOP_COUNTER +test InDatabaseL ERelation LOOP_COUNTER ETrue +endloop +test RemoveRelationObserverL +test VerifyTItemIdsL ERelation 0 7 + +test GuidL ERelation rel0 000011 000101 +test GuidL ERelation rel1 000011 000102 +test GuidL ERelation rel2 000011 000103 +test GuidL ERelation rel3 000011 000104 +test GuidL ERelation rel4 000011 000105 +test GuidL ERelation rel5 000011 000106 +test GuidL ERelation rel6 000011 000107 + +// Remove the relations, observe the removals and verify the observed results. +test AddRelationItemObserverL +test AddRelationObserverL +loop 7 +test RemoveRelationL LOOP_COUNTER +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +endloop +test RemoveRelationItemObserverL +test RemoveRelationObserverL +test VerifyMdERelationsL 0 7 + +// Final cleanup. +test RemoveObjectL obj0 KById +test RemoveObjectL obj1 KById +delete test +[Endtest] + +[Test] +title Edit Object 12: NewEventL, AddEventL, GetEventL, RemoveEventL, CompareL, ObjectIdL, TimeL, SourceL, ParticipantL, DefL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs + +// Create an object and add it to the database. +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000012 000001 +test AddObjectL obj0 + +// Add some events for the object. +test GetEventDefL createdEventDef defaultNs Created +test NewEventL event0 obj0 createdEventDef TestSource TestParticipant 20081130:235959.999999 KL +test GetEventDefL deletedEventDef defaultNs Deleted +test NewEventL event1 obj0 deletedEventDef TestSource TestParticipant 20081130:235959.999999 KLC +test GetEventDefL opendedEventDef defaultNs Opened +test NewEventL event2 obj0 opendedEventDef TestSource TestParticipant 20081130:235959.999999 KL +test GetEventDefL playedEventDef defaultNs Played +test NewEventL event3 obj0 playedEventDef TestSource TestParticipant 20081130:235959.999999 KLC +test GetEventDefL editedEventDef defaultNs Edited +test NewEventL event4 obj0 editedEventDef TestSource TestParticipant 20081130:235959.999999 KL +test GetEventDefL sentEventDef defaultNs Sent +test NewEventL event5 obj0 sentEventDef TestSource TestParticipant 20081130:235959.999999 KLC +test GetEventDefL receivedEventDef defaultNs Received +test NewEventL event6 obj0 receivedEventDef TestSource TestParticipant 20081130:235959.999999 KL + +// Test some assorted CMdEEvent methods. +test DefL eventDef EEventDef event0 +// Note: the last parameter to CompareL (in this case 0) is the expected result of the call to *::Compare. +test CompareL EEventDef createdEventDef eventDef 0 +test ObjectIdL event0 obj0 +test TimeL event0 20081130:235959.999999 +test SourceL event0 TestSource 0 +test ParticipantL event0 TestParticipant 0 +test CompareL EEventDef createdEventDef createdEventDef 0 +test CompareL EEventDef deletedEventDef createdEventDef 1 + +// Now add the events to the database, observe the additions and verify the observed results. +test AddEventObserverL +loop 7 +test BelongsToSessionL EEvent LOOP_COUNTER EFalse +test InDatabaseL EEvent LOOP_COUNTER EFalse +test AddEventL LOOP_COUNTER +waittestclass test +test VerifyObserverNotificationTypeL ENotifyAdd +test BelongsToSessionL EEvent LOOP_COUNTER ETrue +test SessionL EEvent LOOP_COUNTER +test InDatabaseL EEvent LOOP_COUNTER ETrue +endloop +test RemoveEventObserverL +test VerifyTItemIdsL EEvent 0 7 + +test GetEventL event7 event0 + +// Remove the events, observe the removals and verify the observed results. +test AddEventObserverL +loop 7 +test RemoveEventL LOOP_COUNTER +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +endloop +test RemoveEventObserverL +test VerifyTItemIdsL EEvent 0 7 + +// Final cleanup. +test RemoveObjectL obj0 KById +delete test +[Endtest] + +[Test] +title Edit Object 13: RemoveEventsL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs + +// Create an object and add it to the database. +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000013 000001 +test AddObjectL obj0 + +// Add some events for the object. +test GetEventDefL createdEventDef defaultNs Created +test NewEventL event0 obj0 createdEventDef TestSource TestParticipant 20081130:235959.999999 KL +test GetEventDefL deletedEventDef defaultNs Deleted +test NewEventL event1 obj0 deletedEventDef TestSource TestParticipant 20081130:235959.999999 KLC +test GetEventDefL opendedEventDef defaultNs Opened +test NewEventL event2 obj0 opendedEventDef TestSource TestParticipant 20081130:235959.999999 KL +test GetEventDefL playedEventDef defaultNs Played +test NewEventL event3 obj0 playedEventDef TestSource TestParticipant 20081130:235959.999999 KLC +test GetEventDefL editedEventDef defaultNs Edited +test NewEventL event4 obj0 editedEventDef TestSource TestParticipant 20081130:235959.999999 KL +test GetEventDefL sentEventDef defaultNs Sent +test NewEventL event5 obj0 sentEventDef TestSource TestParticipant 20081130:235959.999999 KLC +test GetEventDefL receivedEventDef defaultNs Received +test NewEventL event6 obj0 receivedEventDef TestSource TestParticipant 20081130:235959.999999 KL + +// Now add the events to the database, observe the additions and verify the observed results. +test AddEventObserverL +loop 7 +test BelongsToSessionL EEvent LOOP_COUNTER EFalse +test InDatabaseL EEvent LOOP_COUNTER EFalse +test AddEventL LOOP_COUNTER +waittestclass test +test VerifyObserverNotificationTypeL ENotifyAdd +test BelongsToSessionL EEvent LOOP_COUNTER ETrue +test SessionL EEvent LOOP_COUNTER +test InDatabaseL EEvent LOOP_COUNTER ETrue +endloop +test RemoveEventObserverL +test VerifyTItemIdsL EEvent 0 7 + +// Remove the events, observe the removals and verify the observed results. +test AddEventObserverL +test RemoveEventsL KSync event0 3 + +request EEventsAsyncRemoved +test RemoveEventsL KAsync event3 4 +wait EEventsAsyncRemoved +release EEventsAsyncRemoved + +// Final cleanup. +test RemoveEventObserverL +test RemoveObjectL obj0 KById +delete test +[Endtest] + +[Test] +title Edit Object 14: NewRelationL, AddRelationL, GetRelationL, UpdateRelationL, RemoveRelationL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs + +// Create two objects and add them to the database. +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000014 000001 +test AddObjectL obj0 +test NewObjectL obj1 videoObjDef KL +test GetPropertyDefL creationDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj1 000014 000002 +test AddObjectL obj1 + +// Now add some relations between the two objects. +test GetRelationDefL relDefContains defaultNs Contains +test NewRelationL rel0 obj1 relDefContains obj0 0 KL +test GetRelationDefL relDefReplaces defaultNs Replaces +test NewRelationL rel1 obj1 relDefReplaces obj0 0 KLC +test GetRelationDefL relDefIsVersionOf defaultNs IsVersionOf +test NewRelationL rel2 obj1 relDefIsVersionOf obj0 0 KL +test GetRelationDefL relDefRequires defaultNs Requires +test NewRelationL rel3 obj1 relDefRequires obj0 0 KLC +test GetRelationDefL relDefUses defaultNs Uses +test NewRelationL rel4 obj1 relDefUses obj0 0 KL +test GetRelationDefL relDefReferences defaultNs References +test NewRelationL rel5 obj1 relDefReferences obj0 0 KLC +test GetRelationDefL relDefSummarises defaultNs Summarises +test NewRelationL rel6 obj1 relDefSummarises obj0 0 KL + +// Now add the relations to the database. +loop 7 +test BelongsToSessionL ERelation LOOP_COUNTER EFalse +test InDatabaseL ERelation LOOP_COUNTER EFalse +test AddRelationL LOOP_COUNTER +test BelongsToSessionL ERelation LOOP_COUNTER ETrue +test SessionL ERelation LOOP_COUNTER +test InDatabaseL ERelation LOOP_COUNTER ETrue +endloop + +// Test UpdateRelationL. +test GetRelationL rel7 rel0 +test UpdateRelationL 7 + +// Now remove the relations from the database. +loop 7 +test RemoveRelationL LOOP_COUNTER +endloop + +// Final cleanup. +test RemoveObjectL obj0 KById +test RemoveObjectL obj1 KById +delete test +[Endtest] + +[Test] +title Edit Object 15: LeftObjectIdL, RightObjectIdL, ParameterL, SetParameterL, ... +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs + +// Create three objects and add them to the database. +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000015 000001 +test AddObjectL obj0 +test NewObjectL obj1 videoObjDef KL +test GetPropertyDefL creationDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test SetGuidL EObject obj1 000015 000002 +test AddObjectL obj1 +test NewObjectL obj2 videoObjDef KL +test GetPropertyDefL creationDatePropDef2 videoObjDef CreationDate +test AddTimePropertyL obj2 creationDatePropDef2 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef2 videoObjDef LastModifiedDate +test AddTimePropertyL obj2 lastModDatePropDef2 20081130:235959.999999 +test SetGuidL EObject obj2 000015 000003 +test AddObjectL obj2 + +// Create some relations between obj1 and obj0. +test GetRelationDefL relDefContains defaultNs Contains +test NewRelationL rel0 obj1 relDefContains obj0 999 KL +test GetRelationDefL relDefReplaces defaultNs Replaces +test NewRelationL rel1 obj1 relDefReplaces obj0 999 KLC +test GetRelationDefL relDefIsVersionOf defaultNs IsVersionOf +test NewRelationL rel2 obj1 relDefIsVersionOf obj0 999 KL +test GetRelationDefL relDefRequires defaultNs Requires +test NewRelationL rel3 obj1 relDefRequires obj0 0 KLC +test GetRelationDefL relDefUses defaultNs Uses +test NewRelationL rel4 obj1 relDefUses obj0 0 KL +test GetRelationDefL relDefReferences defaultNs References +test NewRelationL rel5 obj1 relDefReferences obj0 0 KLC +test GetRelationDefL relDefSummarises defaultNs Summarises +test NewRelationL rel6 obj1 relDefSummarises obj0 0 KL + +// Test some relation methods. +test LeftObjectIdL rel0 obj1 +test RightObjectIdL rel0 obj0 +test ParameterL rel0 999 +test SetParameterL rel0 1000 +test ParameterL rel0 1000 +allownextresult KErrArgument +test SetLeftObjectIdL rel0 obj0 +test SetLeftObjectIdL rel0 obj2 +allownextresult KErrArgument +test SetRightObjectIdL rel0 obj2 +test SetRightObjectIdL rel0 obj1 +test SetLastModifiedDateL rel0 20101010:235959.999999 +test LastModifiedDateL rel0 20101010:235959.999999 + +// Now add the relations to the database. +loop 7 +test BelongsToSessionL ERelation LOOP_COUNTER EFalse +test InDatabaseL ERelation LOOP_COUNTER EFalse +test AddRelationL LOOP_COUNTER +test BelongsToSessionL ERelation LOOP_COUNTER ETrue +test SessionL ERelation LOOP_COUNTER +test InDatabaseL ERelation LOOP_COUNTER ETrue +endloop + +// Now remove the relations from the database. +test RemoveRelationsL KSync rel0 3 + +request ERelationsAsyncRemoved +test RemoveRelationsL KAsync rel3 4 +wait ERelationsAsyncRemoved +release ERelationsAsyncRemoved + +// Final cleanup. +test RemoveObjectL obj0 KById +test RemoveObjectL obj1 KById +test RemoveObjectL obj2 KById +delete test +[Endtest] + +[Test] +title Edit Object 16: UriL, SetUriL, DefL, SetDefL, CompareL, MediaIdL, ... +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test ImportMetadataL \Data\MdETestScripterImportMetadata.mde KSync + +// Create an object and test some object definition primitives. +test GetObjectDefL objDef defaultNs Object +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test DefL objDef2 EObjectDef obj0 +test CompareL EObjectDef videoObjDef objDef2 0 +allownextresult KErrNotSupported +test SetDefL obj0 videoObjDef + +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000016 000001 + +// Test the object's SetUri, Uri, SetMediaId, MediaId, SetConfidential, Confidential, SetPlaceholder and Placeholder methods. +test SetUriL obj0 e:\testing\data\Test16Video1.3gp +test UriL obj0 e:\testing\data\test16video1.3gp +test SetMediaIdL obj0 121212 +test MediaIdL obj0 121212 +test SetConfidentialL obj0 EFalse +test ConfidentialL obj0 EFalse +test SetConfidentialL obj0 ETrue +test ConfidentialL obj0 ETrue +test SetPlaceholderL obj0 EFalse +test PlaceholderL obj0 EFalse +test SetPlaceholderL obj0 ETrue +test PlaceholderL obj0 ETrue + +// Now add the object to the database. +test UsageCountL obj0 0 +test BelongsToSessionL EObject KLast EFalse +test InDatabaseL EObject KLast EFalse +test AddObjectObserverL +test AddObjectL obj0 +waittestclass test +test VerifyObserverNotificationTypeL ENotifyAdd +test RemoveObjectObserverL +test VerifyTItemIdsL EObject 0 1 +test BelongsToSessionL EObject KLast ETrue +test SessionL EObject KLast +test InDatabaseL EObject KLast ETrue + +// Final cleanup. +test RemoveObjectL obj0 KById +delete test +[Endtest] + +[Test] +title Edit Object 17: Create JPG Object +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL imageObjDef defaultNs Image +test NewObjectL obj0 imageObjDef KL +test SetUriL obj0 c:\Test17Image1.jpg +test GetPropertyDefL originPropDef imageObjDef Origin +test AddUint8PropertyL obj0 originPropDef 0 +test GetPropertyDefL creationDatePropDef imageObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 imageObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test GetPropertyDefL sizePropDef imageObjDef Size +test AddUint32PropertyL obj0 sizePropDef 733064 +test GetPropertyDefL itemTypePropDef imageObjDef ItemType +test AddTextPropertyL obj0 itemTypePropDef "image/jpg" +test GetPropertyDefL drmPropDef imageObjDef DRM +test AddBoolPropertyL obj0 drmPropDef 0 +test GetPropertyDefL releaseDatePropDef imageObjDef ReleaseDate +test AddTimePropertyL obj0 releaseDatePropDef 20081130:235959.999999 +test GetPropertyDefL widthPropDef imageObjDef Width +test AddUint16PropertyL obj0 widthPropDef 1024 +test GetPropertyDefL heightPropDef imageObjDef Height +test AddUint16PropertyL obj0 heightPropDef 768 +test SetGuidL EObject obj0 000017 000001 +test BelongsToSessionL EObject KLast EFalse +test InDatabaseL EObject KLast EFalse +test AddObjectL obj0 +test BelongsToSessionL EObject KLast ETrue +test SessionL EObject KLast +test InDatabaseL EObject KLast ETrue +test RemoveObjectL obj0 KById +delete test +[Endtest] + +[Test] +title Edit Object 18: AddFreeTextL, RemoveFreeTextL, FreeTextCountL, FreeTextL, FreeTextIndexL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\Test18Video1.3gp +test GetPropertyDefL creationDatePropDef videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test AddFreeTextL obj0 TestFreeText1 +test FreeTextL obj0 0 TestFreeText1 +test FreeTextIndexL obj0 0 TestFreeText1 +test FreeTextCountL obj0 1 +test RemoveFreeTextL obj0 0 +allowerrorcodes KErrNotFound +test FreeTextIndexL obj0 0 TestFreeText1 +test FreeTextCountL obj0 0 +test AddFreeTextL obj0 TestFreeText1 +test SetGuidL EObject KLast 000018 000001 +test BelongsToSessionL EObject KLast EFalse +test InDatabaseL EObject KLast EFalse +test AddObjectL obj0 +test BelongsToSessionL EObject KLast ETrue +test SessionL EObject KLast +test InDatabaseL EObject KLast ETrue +test RemoveObjectL obj0 KById +delete test +[Endtest] + +[Test] +title Edit Object 19: Create MP3 Object With 8 Text 7 Int Properties +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL audioObjectDef defaultNs Audio +test NewObjectL obj0 audioObjectDef KL +test SetUriL 0 c:\Test19Audio1.mp3 +test GetPropertyDefL creationDatePropDef audioObjectDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 audioObjectDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test GetPropertyDefL sizePropDef audioObjectDef Size +test AddUint32PropertyL obj0 sizePropDef 5000 +test GetPropertyDefL itemTypePropDef audioObjectDef ItemType +test AddTextPropertyL obj0 itemTypePropDef "audio/mp3" +test GetPropertyDefL titlePropDef audioObjectDef Title +test AddTextPropertyL obj0 titlePropDef "TestMp3" +test GetPropertyDefL drmPropDef audioObjectDef DRM +test AddBoolPropertyL obj0 drmPropDef 1 +test GetPropertyDefL durationPropDef audioObjectDef Duration +test AddReal32PropertyL obj0 durationPropDef 1234 +test GetPropertyDefL trackPropDef audioObjectDef Track +test AddUint16PropertyL obj0 trackPropDef 12 +test GetPropertyDefL descriptionPropDef audioObjectDef Description +test AddTextPropertyL obj0 descriptionPropDef "Ambient noise from street" +test GetPropertyDefL commentPropDef audioObjectDef Comment +test AddTextPropertyL obj0 commentPropDef "No comments." +test GetPropertyDefL genrePropDef audioObjectDef Genre +test AddTextPropertyL obj0 genrePropDef "ambient" +test GetPropertyDefL artistPropDef audioObjectDef Artist +test AddTextPropertyL obj0 artistPropDef "Cars on street" +test GetPropertyDefL albumPropDef audioObjectDef Album +test AddTextPropertyL obj0 albumPropDef "Noises" +test GetPropertyDefL composerPropDef audioObjectDef Composer +test AddTextPropertyL obj0 composerPropDef "Myself" +test SetGuidL EObject obj0 000019 000001 +test BelongsToSessionL EObject KLast EFalse +test InDatabaseL EObject KLast EFalse +test AddObjectL obj0 +test BelongsToSessionL EObject KLast ETrue +test SessionL EObject KLast +test InDatabaseL EObject KLast ETrue +test RemoveObjectL obj0 KById +delete test +[Endtest] + +[Test] +title Edit Object 20: Create MP4 Object With 17 Properties +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\Test20Video1.mp4 +test GetPropertyDefL creationDatePropDef videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test GetPropertyDefL titlePropDef videoObjDef Title +test AddTextPropertyL obj0 titlePropDef "Party video 1/2" +test GetPropertyDefL sizePropDef videoObjDef Size +test AddUint32PropertyL obj0 sizePropDef 12345678 +test GetPropertyDefL descriptionPropDef videoObjDef Description +test AddTextPropertyL obj0 descriptionPropDef "First video from party." +test GetPropertyDefL commentPropDef videoObjDef Comment +test AddTextPropertyL obj0 commentPropDef "No comments." +test GetPropertyDefL ratingPropDef videoObjDef Rating +test AddUint8PropertyL obj0 ratingPropDef 4 +test GetPropertyDefL accessCountPropDef videoObjDef AccessCount +test AddUint32PropertyL obj0 accessCountPropDef 0 +test GetPropertyDefL genrePropDef videoObjDef Genre +test AddTextPropertyL obj0 genrePropDef "Party." +test GetPropertyDefL drmPropDef videoObjDef DRM +test AddBoolPropertyL obj0 drmPropDef 1 +test GetPropertyDefL releasedatePropDef videoObjDef ReleaseDate +test AddTimePropertyL obj0 releasedatePropDef 20081130:235959.999999 +test GetPropertyDefL itemTypePropDef videoObjDef ItemType +test AddTextPropertyL obj0 itemTypePropDef "video/mp4" +test GetPropertyDefL widthPropDef videoObjDef Width +test AddUint16PropertyL obj0 widthPropDef 640 +test GetPropertyDefL heightPropDef videoObjDef Height +test AddUint16PropertyL obj0 heightPropDef 480 +test GetPropertyDefL durationPropDef videoObjDef Duration +test AddReal32PropertyL obj0 durationPropDef 1234 +test GetPropertyDefL bitratePropDef videoObjDef Bitrate +test AddUint16PropertyL obj0 bitratePropDef 25 +test GetPropertyDefL artistPropDef videoObjDef Artist +test AddTextPropertyL obj0 artistPropDef "Myself" +test SetGuidL EObject obj0 000020 000001 +test BelongsToSessionL EObject KLast EFalse +test InDatabaseL EObject KLast EFalse +test AddObjectL obj0 +test BelongsToSessionL EObject KLast ETrue +test SessionL EObject KLast +test InDatabaseL EObject KLast ETrue +test RemoveObjectL obj0 KByUri +delete test +[Endtest] + +[Test] +title Edit Object 21: Create MP4 Object +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\Test21Video1.mp4 +test GetPropertyDefL creationDatePropDef videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test GetPropertyDefL sizePropDef videoObjDef Size +test AddUint32PropertyL obj0 sizePropDef 12345678 +test GetPropertyDefL accessCountPropDef videoObjDef AccessCount +test AddUint32PropertyL obj0 accessCountPropDef 0 +test GetPropertyDefL drmPropDef videoObjDef DRM +test AddBoolPropertyL obj0 drmPropDef 1 +test GetPropertyDefL releasedatePropDef videoObjDef ReleaseDate +test AddTimePropertyL obj0 releasedatePropDef 20081130:235959.999999 +test GetPropertyDefL itemTypePropDef videoObjDef ItemType +test AddTextPropertyL obj0 itemTypePropDef "video/mp4" +test GetPropertyDefL widthPropDef videoObjDef Width +test AddUint16PropertyL obj0 widthPropDef 640 +test GetPropertyDefL heightPropDef videoObjDef Height +test AddUint16PropertyL obj0 heightPropDef 480 +test GetPropertyDefL durationPropDef videoObjDef Duration +test AddReal32PropertyL obj0 durationPropDef 1234 +test SetGuidL EObject obj0 000021 000001 +test BelongsToSessionL EObject KLast EFalse +test InDatabaseL EObject KLast EFalse +test AddObjectL obj0 +test BelongsToSessionL EObject KLast ETrue +test SessionL EObject KLast +test InDatabaseL EObject KLast ETrue +test RemoveObjectL obj0 KByUri +delete test +[Endtest] + +[Test] +title Edit Object 22: Create Album Object +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL albumObjDef defaultNs Album +test NewObjectL obj0 albumObjDef KL +test GetPropertyDefL creationDatePropDef albumObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 albumObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test GetPropertyDefL typePropDef albumObjDef Type +test AddUint16PropertyL obj0 typePropDef 25 +test GetPropertyDefL orderedPropDef albumObjDef Ordered +test AddBoolPropertyL obj0 orderedPropDef EFalse +test SetGuidL EObject obj0 000022 000001 +test BelongsToSessionL EObject KLast EFalse +test InDatabaseL EObject KLast EFalse +test AddObjectL obj0 +test BelongsToSessionL EObject KLast ETrue +test SessionL EObject KLast +test InDatabaseL EObject KLast ETrue +test RemoveObjectL obj0 KById +delete test +[Endtest] + +[Test] +title Edit Object 23: Create Video Object +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\Test23Video1.mp4 +test GetPropertyDefL creationDatePropDef videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test GetPropertyDefL frameratePropDef videoObjDef Framerate +test AddReal32PropertyL obj0 frameratePropDef 25 +test GetPropertyDefL audioFourCCPropDef videoObjDef AudioFourCC +test AddUint32PropertyL obj0 audioFourCCPropDef 2000 +test GetPropertyDefL drmPropDef videoObjDef DRM +test AddBoolPropertyL obj0 drmPropDef 1 +test GetPropertyDefL accessCountPropDef videoObjDef AccessCount +test AddUint32PropertyL obj0 accessCountPropDef 10 +test GetPropertyDefL releaseDatePropDef videoObjDef ReleaseDate +test AddTimePropertyL obj0 releaseDatePropDef 20081130:235959.999999 +test GetPropertyDefL durationPropDef videoObjDef Duration +test AddReal32PropertyL obj0 durationPropDef 60 +test SetGuidL EObject obj0 000023 000001 +test BelongsToSessionL EObject KLast EFalse +test InDatabaseL EObject KLast EFalse +test AddObjectL obj0 +test BelongsToSessionL EObject KLast ETrue +test SessionL EObject KLast +test InDatabaseL EObject KLast ETrue +test RemoveObjectL obj0 KByUri +delete test +[Endtest] + +[Test] +title Edit Object 24: Create Audio Object +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL audioObjDef defaultNs Audio +test NewObjectL obj0 audioObjDef KL +test SetUriL obj0 e:\testing\data\Test24Audio1.mp3 +test GetPropertyDefL creationDatePropDef audioObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModifiedDatePropDef audioObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModifiedDatePropDef 20081130:235959.999999 +test GetPropertyDefL samplingFrequencyPropDef audioObjDef SamplingFrequency +test AddReal32PropertyL obj0 samplingFrequencyPropDef 25 +test GetPropertyDefL composerPropDef audioObjDef Composer +test AddTextPropertyL obj0 composerPropDef "Bach" +test GetPropertyDefL trackPropDef audioObjDef Track +test AddUint16PropertyL obj0 trackPropDef 1 +test GetPropertyDefL originalArtistPropDef audioObjDef OriginalArtist +test AddTextPropertyL obj0 originalArtistPropDef "Nightwish" +test SetGuidL EObject obj0 000024 000001 +test BelongsToSessionL EObject KLast EFalse +test InDatabaseL EObject KLast EFalse +test AddObjectL obj0 +test BelongsToSessionL EObject KLast ETrue +test SessionL EObject KLast +test InDatabaseL EObject KLast ETrue +test RemoveObjectL obj0 KByUri +delete test +[Endtest] + +[Test] +title Edit Object 25: Create Image Object +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL imageObjDef defaultNs Image +test NewObjectL obj0 imageObjDef KL +test SetUriL obj0 e:\testing\data\Test25Image1.jpg +test GetPropertyDefL creationDatePropDef imageObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModifiedDatePropDef imageObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModifiedDatePropDef 20081130:235959.999999 +test GetPropertyDefL pixelXDimensionPropDef imageObjDef PixelXDimension +test AddUint32PropertyL obj0 pixelXDimensionPropDef 20 +test GetPropertyDefL pixelYDimensionPropDef imageObjDef PixelYDimension +test AddUint32PropertyL obj0 pixelYDimensionPropDef 20 +test GetPropertyDefL maxAperturePropDef imageObjDef MaxAperture +test AddReal32PropertyL obj0 maxAperturePropDef 20 +test SetGuidL EObject obj0 000025 000001 +test BelongsToSessionL EObject KLast EFalse +test InDatabaseL EObject KLast EFalse +test AddObjectL obj0 +test BelongsToSessionL EObject KLast ETrue +test SessionL EObject KLast +test InDatabaseL EObject KLast ETrue +test RemoveObjectL obj0 KByUri +delete test +[Endtest] + +[Test] +title Edit Object 26: *ValueL: Video +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL KLast e:\testing\data\test26video1.3gp +test RemoveObjectsL KSync KByUri obj0 1 0 +test ImportMetadataL \Data\MdETestScripterImportMetadata.mde KSync +test OpenFullObjectL obj1 obj0 KByUri +test GetPropertyDefL creationDatePropDef videoObjDef CreationDate +test PropertyL creationDate KByDef obj1 creationDatePropDef 0 +test TimeValueL creationDate 20080707: +test GetPropertyDefL lastModifiedDatePropDef videoObjDef LastModifiedDate +test PropertyL lastModifiedDate KByDef obj1 lastModifiedDatePropDef 0 +test TimeValueL lastModifiedDate 20080707: +test GetPropertyDefL bitratePropDef videoObjDef Bitrate +test PropertyL bitrate KByDef obj1 bitratePropDef 0 +test Uint16ValueL bitrate 23 +test GetPropertyDefL sizePropDef videoObjDef Size +test PropertyL size KByDef obj1 sizePropDef 0 +test Uint32ValueL size 66192 +test GetPropertyDefL ratingPropDef videoObjDef Rating +test PropertyL rating KByDef obj1 ratingPropDef 0 +test Uint8ValueL rating 4 +test GetPropertyDefL widthPropDef videoObjDef Width +test PropertyL width KByDef obj1 widthPropDef 0 +test Uint16ValueL width 176 +test GetPropertyDefL heightPropDef videoObjDef Height +test PropertyL height KByDef obj1 heightPropDef 0 +test Uint16ValueL height 144 +test GetPropertyDefL durationPropDef videoObjDef Duration +test PropertyL duration KByDef obj1 durationPropDef 0 +test Real32ValueL duration 21 +test GetPropertyDefL releaseDatePropDef videoObjDef ReleaseDate +test PropertyL releaseDate KByDef obj1 releaseDatePropDef 0 +test TimeValueL releaseDate 20080707: +test GetPropertyDefL captureDatePropDef videoObjDef CaptureDate +test PropertyL captureDate KByDef obj1 captureDatePropDef 0 +test TimeValueL captureDate 20080707: +test GetPropertyDefL frameratePropDef videoObjDef Framerate +test PropertyL framerate KByDef obj1 frameratePropDef 0 +test Real32ValueL framerate 7 +test GetPropertyDefL drmPropDef videoObjDef DRM +test PropertyL drm KByDef obj1 drmPropDef 0 +test BoolValueL drm EFalse +delete test +[Endtest] + +[Test] +title Edit Object 27: *ValueL: All property types +create MdETestScripter test +waittestclass test +allowerrorcodes KErrCorrupt +test ImportSchemaL \Data\MdETestScripterSchema2.mde +test GetNamespaceDefL testNs "http:\/\/sw.nokia.com/MdE/TestSchema2" +test GetObjectDefL testObjDef testNs TestObjectType +test NewObjectL obj0 testObjDef KL +test SetUriL obj0 c:\data\other\testobject27 +test GetPropertyDefL testPropertyBoolDef testObjDef TestPropertyBool +test AddBoolPropertyL obj0 testPropertyBoolDef EFalse +test PropertyL boolProp KByDef obj0 testPropertyBoolDef EFalse +test ReadOnlyL EPropertyDef testPropertyBoolDef EFalse +test BoolValueL boolProp EFalse +test GetPropertyDefL testPropertyInt8Def testObjDef TestPropertyInt8 +test AddInt8PropertyL obj0 testPropertyInt8Def 0 +test PropertyL int8Prop KByDef obj0 testPropertyInt8Def 0 +test ReadOnlyL EPropertyDef testPropertyInt8Def ETrue +test Int8ValueL int8Prop 0 +test GetPropertyDefL testPropertyUint8Def testObjDef TestPropertyUint8 +test AddUint8PropertyL obj0 testPropertyUint8Def 0 +test PropertyL uint8Prop KByDef obj0 testPropertyUint8Def 0 +test ReadOnlyL EPropertyDef testPropertyUint8Def EFalse +test Uint8ValueL uint8Prop 0 +test GetPropertyDefL testPropertyInt16Def testObjDef TestPropertyInt16 +test AddInt16PropertyL obj0 testPropertyInt16Def 0 +test PropertyL int16Prop KByDef obj0 testPropertyInt16Def 0 +test ReadOnlyL EPropertyDef testPropertyInt16Def ETrue +test Int16ValueL int16Prop 0 +test GetPropertyDefL testPropertyUint16Def testObjDef TestPropertyUint16 +test AddUint16PropertyL obj0 testPropertyUint16Def 0 +test PropertyL uint16Prop KByDef obj0 testPropertyUint16Def 0 +test ReadOnlyL EPropertyDef testPropertyUint16Def EFalse +test Uint16ValueL uint16Prop 0 +test GetPropertyDefL testPropertyInt32Def testObjDef TestPropertyInt32 +test AddInt32PropertyL obj0 testPropertyInt32Def 0 +test PropertyL int32Prop KByDef obj0 testPropertyInt32Def 0 +test ReadOnlyL EPropertyDef testPropertyInt32Def ETrue +test Int32ValueL int32Prop 0 +test GetPropertyDefL testPropertyUint32Def testObjDef TestPropertyUint32 +test AddUint32PropertyL obj0 testPropertyUint32Def 0 +test PropertyL uint32Prop KByDef obj0 testPropertyUint32Def 0 +test ReadOnlyL EPropertyDef testPropertyUint32Def EFalse +test Uint32ValueL uint32Prop 0 +test GetPropertyDefL testPropertyInt64Def testObjDef TestPropertyInt64 +test AddInt64PropertyL obj0 testPropertyInt64Def 0 +test PropertyL int64Prop KByDef obj0 testPropertyInt64Def 0 +test ReadOnlyL EPropertyDef testPropertyInt64Def ETrue +test Int64ValueL int64Prop 0 +test GetPropertyDefL testPropertyReal32Def testObjDef TestPropertyReal32 +test AddReal32PropertyL obj0 testPropertyReal32Def 0 +test PropertyL real32Prop KByDef obj0 testPropertyReal32Def 0 +test ReadOnlyL EPropertyDef testPropertyReal32Def EFalse +test Real32ValueL real32Prop 0 +test GetPropertyDefL testPropertyReal64Def testObjDef TestPropertyReal64 +test AddReal64PropertyL obj0 testPropertyReal64Def 0 +test PropertyL real64Prop KByDef obj0 testPropertyReal64Def 0 +test ReadOnlyL EPropertyDef testPropertyReal64Def ETrue +test Real64ValueL real64Prop 0 +test GetPropertyDefL testPropertyTimeDef testObjDef TestPropertyTime +test AddTimePropertyL obj0 testPropertyTimeDef 20081130:235959.999999 +test PropertyL timeProp KByDef obj0 testPropertyTimeDef 0 +test ReadOnlyL EPropertyDef testPropertyTimeDef EFalse +test TimeValueL timeProp 20081130:235959.999999 +test GetPropertyDefL testPropertyTextDef testObjDef TestPropertyText +test AddTextPropertyL obj0 testPropertyTextDef "Test Text" +test PropertyL textProp KByDef obj0 testPropertyTextDef 0 +test ReadOnlyL EPropertyDef testPropertyTextDef ETrue +test TextValueL textProp "Test Text" +test GetPropertyDefL creaDatePropDef0 testObjDef CreationDate +test AddTimePropertyL obj0 creaDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 testObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000027 000001 +test AddObjectL obj0 +test BelongsToSessionL EObject obj0 ETrue +test SessionL EObject obj0 +test InDatabaseL EObject obj0 ETrue +delete test +[Endtest] + +[Test] +title Edit Object 28: Add*PropertyL: KErrArgument +create MdETestScripter test +waittestclass test +allowerrorcodes KErrCorrupt +test ImportSchemaL \Data\MdETestScripterSchema2.mde +test GetNamespaceDefL testNs "http:\/\/sw.nokia.com/MdE/TestSchema2" +test GetObjectDefL testObjDef testNs TestObjectType +test NewObjectL obj0 testObjDef KL +test SetUriL obj0 c:\data\other\testobject28 +test GetPropertyDefL testPropertyTimeDef testObjDef TestPropertyTime +test GetPropertyDefL testPropertyTextDef testObjDef TestPropertyText +allownextresult KErrArgument +test AddBoolPropertyL obj0 testPropertyTimeDef EFalse +allownextresult KErrArgument +test AddInt8PropertyL obj0 testPropertyTimeDef 0 +allownextresult KErrArgument +test AddUint8PropertyL obj0 testPropertyTimeDef 0 +allownextresult KErrArgument +test AddInt16PropertyL obj0 testPropertyTimeDef 0 +allownextresult KErrArgument +test AddUint16PropertyL obj0 testPropertyTimeDef 0 +allownextresult KErrArgument +test AddInt32PropertyL obj0 testPropertyTimeDef 0 +allownextresult KErrArgument +test AddUint32PropertyL obj0 testPropertyTimeDef 0 +allownextresult KErrArgument +test AddInt64PropertyL obj0 testPropertyTimeDef 0 +allownextresult KErrArgument +test AddReal32PropertyL obj0 testPropertyTimeDef 0 +allownextresult KErrArgument +test AddReal64PropertyL obj0 testPropertyTimeDef 0 +allownextresult KErrArgument +test AddTextPropertyL obj0 testPropertyTimeDef "Test Text" +allownextresult KErrArgument +test AddTimePropertyL obj0 testPropertyTextDef 20080707: +test ReadOnlyL EPropertyDef testPropertyTextDef ETrue +test GetPropertyDefL creaDatePropDef0 testObjDef CreationDate +test AddTimePropertyL obj0 creaDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 testObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000028 000001 +test AddObjectL obj0 +test BelongsToSessionL EObject obj0 ETrue +test SessionL EObject obj0 +test InDatabaseL EObject obj0 ETrue +delete test +[Endtest] + +[Test] +title Edit Object 29: Min*ValueL, Max*ValueL +create MdETestScripter test +waittestclass test +allowerrorcodes KErrCorrupt +test ImportSchemaL \Data\MdETestScripterSchema2.mde +test GetNamespaceDefL testNs "http:\/\/sw.nokia.com/MdE/TestSchema2" +test GetObjectDefL testObjDef testNs TestObjectType +test GetPropertyDefL testPropInt32 testObjDef TestPropertyInt32 +test MinInt32ValueL testPropInt32 -2147483648 +test MaxInt32ValueL testPropInt32 2147483647 +test GetPropertyDefL testPropUint32 testObjDef TestPropertyUint32 +test MinUint32ValueL testPropUint32 0 +test MaxUint32ValueL testPropUint32 4294967295 +test GetPropertyDefL testPropInt64 testObjDef TestPropertyInt64 +test MinInt64ValueL testPropInt64 -9223372036854775808 +test MaxInt64ValueL testPropInt64 +9223372036854775807 +test GetPropertyDefL testPropReal64 testObjDef TestPropertyReal64 +test MinRealValueL testPropReal64 "-1.797693134862e+308" +test MaxRealValueL testPropReal64 "1.797693134862e+308" +test GetPropertyDefL testPropTime testObjDef TestPropertyTime +test MinTimeValueL testPropTime 00000000: +test MaxTimeValueL testPropTime 20100528:163021 +test GetPropertyDefL testPropText testObjDef TestPropertyText +test MinTextLengthL testPropText 1 +test MaxTextLengthL testPropText 65535 +delete test +[Endtest] + +[Test] +title Edit Object 30: RemoveObjectsL KSync KById +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000030 000001 +test AddObjectL obj0 +test NewObjectL obj1 videoObjDef KL +test GetPropertyDefL creationDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test SetGuidL EObject obj1 000030 000002 +test AddObjectL obj1 +test NewObjectL obj2 videoObjDef KL +test GetPropertyDefL creationDatePropDef2 videoObjDef CreationDate +test AddTimePropertyL obj2 creationDatePropDef2 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef2 videoObjDef LastModifiedDate +test AddTimePropertyL obj2 lastModDatePropDef2 20081130:235959.999999 +test SetGuidL EObject obj2 000030 000003 +test AddObjectL obj2 +test NewObjectL obj3 videoObjDef KL +test GetPropertyDefL creationDatePropDef3 videoObjDef CreationDate +test AddTimePropertyL obj3 creationDatePropDef3 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef3 videoObjDef LastModifiedDate +test AddTimePropertyL obj3 lastModDatePropDef3 20081130:235959.999999 +test SetGuidL EObject obj3 000030 000004 +test AddObjectL obj3 +test NewObjectL obj4 videoObjDef KL +test GetPropertyDefL creationDatePropDef4 videoObjDef CreationDate +test AddTimePropertyL obj4 creationDatePropDef4 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef4 videoObjDef LastModifiedDate +test AddTimePropertyL obj4 lastModDatePropDef4 20081130:235959.999999 +test SetGuidL EObject obj4 000030 000005 +test AddObjectL obj4 +test RemoveObjectsL KSync KById obj0 5 +delete test +[Endtest] + +[Test] +title Edit Object 31: RemoveObjectsL KSync KByUri +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000031 000001 +test SetUriL obj0 e:\testing\data\Test31Video1.3gp +test AddObjectL obj0 +test NewObjectL obj1 videoObjDef KL +test GetPropertyDefL creationDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test SetGuidL EObject obj1 000031 000002 +test SetUriL obj1 e:\testing\data\Test31Video2.3gp +test AddObjectL obj1 +test NewObjectL obj2 videoObjDef KL +test GetPropertyDefL creationDatePropDef2 videoObjDef CreationDate +test AddTimePropertyL obj2 creationDatePropDef2 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef2 videoObjDef LastModifiedDate +test AddTimePropertyL obj2 lastModDatePropDef2 20081130:235959.999999 +test SetGuidL EObject obj2 000031 000003 +test SetUriL obj2 e:\testing\data\Test31Video3.3gp +test AddObjectL obj2 +test NewObjectL obj3 videoObjDef KL +test GetPropertyDefL creationDatePropDef3 videoObjDef CreationDate +test AddTimePropertyL obj3 creationDatePropDef3 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef3 videoObjDef LastModifiedDate +test AddTimePropertyL obj3 lastModDatePropDef3 20081130:235959.999999 +test SetGuidL EObject obj3 000031 000004 +test SetUriL obj3 e:\testing\data\Test31Video4.3gp +test AddObjectL obj3 +test NewObjectL obj4 videoObjDef KL +test GetPropertyDefL creationDatePropDef4 videoObjDef CreationDate +test AddTimePropertyL obj4 creationDatePropDef4 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef4 videoObjDef LastModifiedDate +test AddTimePropertyL obj4 lastModDatePropDef4 20081130:235959.999999 +test SetGuidL EObject obj4 000031 000005 +test SetUriL obj4 e:\testing\data\Test31Video5.3gp +test AddObjectL obj4 +test RemoveObjectsL KSync KByUri obj0 5 +delete test +[Endtest] + +[Test] +title Edit Object 32: RemoveObjectsL KAsync KById +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000032 000001 +test AddObjectL obj0 +test NewObjectL obj1 videoObjDef KL +test GetPropertyDefL creationDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test SetGuidL EObject obj1 000032 000002 +test AddObjectL obj1 +test NewObjectL obj2 videoObjDef KL +test GetPropertyDefL creationDatePropDef2 videoObjDef CreationDate +test AddTimePropertyL obj2 creationDatePropDef2 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef2 videoObjDef LastModifiedDate +test AddTimePropertyL obj2 lastModDatePropDef2 20081130:235959.999999 +test SetGuidL EObject obj2 000032 000003 +test AddObjectL obj2 +test NewObjectL obj3 videoObjDef KL +test GetPropertyDefL creationDatePropDef3 videoObjDef CreationDate +test AddTimePropertyL obj3 creationDatePropDef3 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef3 videoObjDef LastModifiedDate +test AddTimePropertyL obj3 lastModDatePropDef3 20081130:235959.999999 +test SetGuidL EObject obj3 000032 000004 +test AddObjectL obj3 +test NewObjectL obj4 videoObjDef KL +test GetPropertyDefL creationDatePropDef4 videoObjDef CreationDate +test AddTimePropertyL obj4 creationDatePropDef4 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef4 videoObjDef LastModifiedDate +test AddTimePropertyL obj4 lastModDatePropDef4 20081130:235959.999999 +test SetGuidL EObject obj4 000032 000005 +test AddObjectL obj4 +request EObjectsAsyncRemoved +test RemoveObjectsL KAsync KById obj0 5 +wait EObjectsAsyncRemoved +release EObjectsAsyncRemoved +delete test +[Endtest] + +[Test] +title Edit Object 33: RemoveObjectsL KAsync KByUri +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000033 000001 +test SetUriL obj0 e:\testing\data\Test33Video1.3gp +test AddObjectL obj0 +test NewObjectL obj1 videoObjDef KL +test GetPropertyDefL creationDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test SetGuidL EObject obj1 000033 000002 +test SetUriL obj1 e:\testing\data\Test33Video2.3gp +test AddObjectL obj1 +test NewObjectL obj2 videoObjDef KL +test GetPropertyDefL creationDatePropDef2 videoObjDef CreationDate +test AddTimePropertyL obj2 creationDatePropDef2 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef2 videoObjDef LastModifiedDate +test AddTimePropertyL obj2 lastModDatePropDef2 20081130:235959.999999 +test SetGuidL EObject obj2 000033 000003 +test SetUriL obj2 e:\testing\data\Test33Video3.3gp +test AddObjectL obj2 +test NewObjectL obj3 videoObjDef KL +test GetPropertyDefL creationDatePropDef3 videoObjDef CreationDate +test AddTimePropertyL obj3 creationDatePropDef3 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef3 videoObjDef LastModifiedDate +test AddTimePropertyL obj3 lastModDatePropDef3 20081130:235959.999999 +test SetGuidL EObject obj3 000033 000004 +test SetUriL obj3 e:\testing\data\Test33Video4.3gp +test AddObjectL obj3 +test NewObjectL obj4 videoObjDef KL +test GetPropertyDefL creationDatePropDef4 videoObjDef CreationDate +test AddTimePropertyL obj4 creationDatePropDef4 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef4 videoObjDef LastModifiedDate +test AddTimePropertyL obj4 lastModDatePropDef4 20081130:235959.999999 +test SetGuidL EObject obj4 000033 000005 +test SetUriL obj4 e:\testing\data\Test33Video5.3gp +test AddObjectL obj4 +request EObjectsAsyncRemoved +test RemoveObjectsL KAsync KByUri obj0 5 +wait EObjectsAsyncRemoved +release EObjectsAsyncRemoved +delete test +[Endtest] + +[Test] +title Edit Object 34: AddItemsL KSync KAsync +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test NewObjectL obj0 videoObjDef KL +test AddTimePropertyL obj0 creationDatePropDef0 20090507: +test AddTimePropertyL obj0 lastModDatePropDef0 20090507: +test SetGuidL EObject obj0 000034 000001 +test SetUriL obj0 e:\testing\data\Test34Video1.3gp +test NewObjectL obj1 videoObjDef KL +test AddTimePropertyL obj1 creationDatePropDef0 20090507: +test AddTimePropertyL obj1 lastModDatePropDef0 20090507: +test SetGuidL EObject obj1 000034 000002 +test SetUriL obj1 e:\testing\data\Test34Video2.3gp +test NewObjectL obj2 videoObjDef KL +test AddTimePropertyL obj2 creationDatePropDef0 20090507: +test AddTimePropertyL obj2 lastModDatePropDef0 20090507: +test SetGuidL EObject obj2 000034 000003 +test SetUriL obj2 e:\testing\data\Test34Video3.mp4 +test AddItemsL KSync EObject 0 1 +request EItemsAsyncAdd +test AddItemsL KAsync EObject 1 2 +wait EItemsAsyncAdd +release EItemsAsyncAdd +delete test +[Endtest] + +[Test] +title Edit Object 35: UpdateItemsL KSync KAsync +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test NewObjectL obj0 videoObjDef KL +test AddTimePropertyL obj0 creationDatePropDef0 20090601: +test AddTimePropertyL obj0 lastModDatePropDef0 20090601: +test SetGuidL EObject obj0 000035 000001 +test SetUriL obj0 e:\testing\data\Test35Video1.3gp +test AddItemsL KSync EObject 0 1 +test OpenObjectL obj1 obj0 KByUri ENamespaceDef defaultNs +test SetGuidL EObject obj1 000035 000002 +test SetUriL obj1 e:\testing\data\Test35Video2.3gp +test UpdateItemsL KSync EObject 1 1 +test OpenObjectL obj2 obj1 KByUri ENamespaceDef defaultNs +test SetGuidL EObject obj2 000035 000003 +test SetUriL obj2 e:\testing\data\Test35Video3.3gp +request EItemsAsyncUpdate +test UpdateItemsL KAsync EObject 2 1 +wait EItemsAsyncUpdate +release EItemsAsyncUpdate +delete test +[Endtest] + +[Test] +title Edit Object 36: AddObjectL, AddObjectsL, RemoveObjectL, UriL, SetUriL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs + +// Create four objects. +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test GetPropertyDefL creaDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creaDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000036 000001 +test NewObjectL obj1 videoObjDef KL +test GetPropertyDefL creaDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creaDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test SetGuidL EObject obj1 000036 000002 +test NewObjectL obj2 videoObjDef KL +test GetPropertyDefL creaDatePropDef2 videoObjDef CreationDate +test AddTimePropertyL obj2 creaDatePropDef2 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef2 videoObjDef LastModifiedDate +test AddTimePropertyL obj2 lastModDatePropDef2 20081130:235959.999999 +test SetGuidL EObject obj2 000036 000003 +test NewObjectL obj3 videoObjDef KL +test GetPropertyDefL creaDatePropDef3 videoObjDef CreationDate +test AddTimePropertyL obj3 creaDatePropDef3 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef3 videoObjDef LastModifiedDate +test AddTimePropertyL obj3 lastModDatePropDef3 20081130:235959.999999 +test SetGuidL EObject obj3 000036 000004 + +// Test objects' SetUri & Uri +test SetUriL obj0 e:\testing\data\Test36Video1.3gp +test UriL obj0 e:\testing\data\test36video1.3gp +test SetUriL obj1 e:\testing\data\Test36Video2.mp4 +test UriL obj1 e:\testing\data\test36video2.mp4 + +// Add the objects to the database, observe the additions and verify the observed results. +test AddObjectObserverL +test AddObjectL obj0 +waittestclass test +test VerifyObserverNotificationTypeL ENotifyAdd +test AddObjectsL obj1 3 +waittestclass test +test VerifyObserverNotificationTypeL ENotifyAdd +test RemoveObjectObserverL +test VerifyTItemIdsL EObject 0 4 + +// Remove the objects, observe the removals and verify the observed results. +test AddObjectObserverL +test RemoveObjectL obj0 KById +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +test RemoveObjectL obj1 KById +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +test RemoveObjectL obj2 KById +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +test RemoveObjectL obj3 KById +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +test RemoveObjectObserverL +test VerifyTItemIdsL EObject 0 4 + +// Final cleanup. +delete test +[Endtest] + +[Test] +title Query 1: Object +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +// Add 4 video objects to DB +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\TEST_VIDEO8.mp4 +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test NewObjectL obj1 videoObjDef KL +test SetUriL obj1 e:\testing\data\TEST_VIDEO9.mp4 +test GetPropertyDefL creationDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test NewObjectL obj2 videoObjDef KL +test SetUriL obj2 e:\testing\data\TEST_VIDEO10.mp4 +test GetPropertyDefL creationDatePropDef2 videoObjDef CreationDate +test AddTimePropertyL obj2 creationDatePropDef2 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef2 videoObjDef LastModifiedDate +test AddTimePropertyL obj2 lastModDatePropDef2 20081130:235959.999999 +test NewObjectL obj3 videoObjDef KL +test SetUriL obj3 e:\testing\data\TEST_VIDEO11.mp4 +test GetPropertyDefL creationDatePropDef3 videoObjDef CreationDate +test AddTimePropertyL obj3 creationDatePropDef3 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef3 videoObjDef LastModifiedDate +test AddTimePropertyL obj3 lastModDatePropDef3 20081130:235959.999999 +test AddObjectsL obj0 4 + +// Query +test NewObjectQueryL rootCond defaultNs Item Video Object + +test AddObjectConditionL objCond rootCond ObjectConditionCompare Uri e:\testing\data\TEST_VIDEO8.mp4 + +test SetObjectQueryResultL { obj0 } +test FindL -1 -1 +waittestclass test + +test RemoveObjectsL KSync KById obj0 4 +delete test +[Endtest] + +[Test] +title Query 2: Relation Conditions +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +// Add 4 video objects to DB +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\TEST_VIDEO12.mp4 +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test NewObjectL obj1 videoObjDef KL +test SetUriL obj1 e:\testing\data\TEST_VIDEO13.mp4 +test GetPropertyDefL creationDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test NewObjectL obj2 videoObjDef KL +test SetUriL obj2 e:\testing\data\TEST_VIDEO14.mp4 +test GetPropertyDefL creationDatePropDef2 videoObjDef CreationDate +test AddTimePropertyL obj2 creationDatePropDef2 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef2 videoObjDef LastModifiedDate +test AddTimePropertyL obj2 lastModDatePropDef2 20081130:235959.999999 +test NewObjectL obj3 videoObjDef KL +test SetUriL obj3 e:\testing\data\TEST_VIDEO15.mp4 +test GetPropertyDefL creationDatePropDef3 videoObjDef CreationDate +test AddTimePropertyL obj3 creationDatePropDef3 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef3 videoObjDef LastModifiedDate +test AddTimePropertyL obj3 lastModDatePropDef3 20081130:235959.999999 +test AddObjectsL obj0 4 +test GetRelationDefL relDefContains defaultNs Contains +test NewRelationL rel0 obj0 relDefContains obj1 0 KL +test NewRelationL rel1 obj0 relDefContains obj2 0 KL +test NewRelationL rel2 obj2 relDefContains obj3 0 KLC +loop 3 +test AddRelationL LOOP_COUNTER +endloop + +// Query +test NewRelationQueryL rootCond defaultNs Item Video Object + +test AddRelationConditionL containsRelCond rootCond Left RelationDef Contains + +test LeftL leftCond containsRelCond +test AddObjectConditionL objCond leftCond ObjectConditionCompare Uri e:\testing\data\TEST_VIDEO12.mp4 + +test SetRelationQueryResultL { rel0 rel1 } +test FindL -1 -1 +waittestclass test + +test RemoveRelationsL KSync rel0 3 +test RemoveObjectsL KSync KById obj0 4 +delete test +[Endtest] + + +[Test] +title Query 3: Time Property Conditions +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +// Add 4 video objects to DB +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\TEST_VIDEO16.mp4 +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test NewObjectL obj1 videoObjDef KL +test SetUriL obj1 e:\testing\data\TEST_VIDE17.mp4 +test GetPropertyDefL creationDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20090000:000000.000000 +test NewObjectL obj2 videoObjDef KL +test SetUriL obj2 e:\testing\data\TEST_VIDEO18.mp4 +test GetPropertyDefL creationDatePropDef2 videoObjDef CreationDate +test AddTimePropertyL obj2 creationDatePropDef2 20090000:000000.000000 +test GetPropertyDefL lastModDatePropDef2 videoObjDef LastModifiedDate +test AddTimePropertyL obj2 lastModDatePropDef2 20090000:000000.000001 +test NewObjectL obj3 videoObjDef KL +test SetUriL obj3 e:\testing\data\TEST_VIDEO19.mp4 +test GetPropertyDefL creationDatePropDef3 videoObjDef CreationDate +test AddTimePropertyL obj3 creationDatePropDef3 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef3 videoObjDef LastModifiedDate +test AddTimePropertyL obj3 lastModDatePropDef3 20090000:000000.000002 +test AddObjectsL obj0 4 + + +test NewObjectQueryL rootCond defaultNs Item Video Object +test AddPropertyConditionL propCond rootCond lastModDatePropDef0 TimeRange Greater 20090000:000000.000000 00000000:000000.000000 + + +test SetObjectQueryResultL { obj2 obj3 } +test FindL -1 -1 +waittestclass test + +test RemoveObjectsL KSync KById obj0 4 +delete test +[Endtest] + + +[Test] +title Query 4: all images with JPEG MIME +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL imageObjDef defaultNs Image +test NewObjectL obj0 imageObjDef KL +test SetUriL obj0 e:\testing\data\Test25Image1.jpg +test GetPropertyDefL itemTypePropertyPropDef imageObjDef ItemType +test AddTextPropertyL obj0 itemTypePropertyPropDef "image/jpeg" +test GetPropertyDefL creationDatePropDef imageObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModifiedDatePropDef imageObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModifiedDatePropDef 20081130:235959.999999 +test AddObjectL obj0 + +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj1 videoObjDef KL +test SetUriL obj1 e:\testing\data\TEST_VIDE17.mp4 +test GetPropertyDefL creationDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20090000:000000.000000 +test AddObjectL obj1 + +test NewObjectQueryL rootCond defaultNs Item Image Object +test AddPropertyConditionL jpegMimeCond rootCond itemTypePropertyPropDef TextCompare Equals image/jpeg +test SetObjectQueryResultL { obj0 } +test FindL -1 -1 +waittestclass test +test RemoveObjectL obj0 KById +delete test +[Endtest] + +[Test] +title Query 5: all mediaobject properties from images and videos +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL mediaObjectDef defaultNs MediaObject +test GetObjectDefL imageObjDef defaultNs Image +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 imageObjDef KL +test SetUriL obj0 e:\testing\data\Test25Image1.jpg +test GetPropertyDefL itemTypePropertyPropDef imageObjDef ItemType +test AddTextPropertyL obj0 itemTypePropertyPropDef "image/jpeg" +test GetPropertyDefL creationDatePropDef imageObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModifiedDatePropDef imageObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModifiedDatePropDef 20081130:235959.999999 +test AddObjectL obj0 + +test NewObjectL obj1 videoObjDef KL +test SetUriL obj1 e:\testing\data\TEST_VIDE17.mp4 +test GetPropertyDefL creationDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20090000:000000.000000 +test AddObjectL obj1 + +test NewObjectQueryL rootCond defaultNs Item MediaObject LookupObject { imageObjDef videoObjDef } +test SetObjectQueryResultL { obj0 obj1 } +test FindL -1 -1 +waittestclass test + +test RemoveObjectsL KSync KById obj0 2 +[Endtest] + +[Test] +title Query 6: usage counts and titles from "user" albums, sorted by title A->Z +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs + +test GetObjectDefL albumObjDef defaultNs Album +test NewObjectL obj0 albumObjDef KL +test GetPropertyDefL titleDef albumObjDef Title +test AddTextPropertyL obj0 titleDef "Humppaa 0" +// test GetPropertyDefL usageCountPropDef albumObjDef UsageCount +// test AddInt32PropertyL obj0 usageCountPropDef 25 +test GetPropertyDefL creationDatePropDef albumObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 albumObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test GetPropertyDefL typePropDef albumObjDef Type +test AddUint16PropertyL obj0 typePropDef EAlbumUser +test GetPropertyDefL orderedPropDef albumObjDef Ordered +test AddBoolPropertyL obj0 orderedPropDef EFalse +test SetGuidL EObject obj0 000022 000001 +test AddObjectL obj0 + +test GetObjectDefL albumObjDef1 defaultNs Album +test NewObjectL obj1 albumObjDef1 KL +// test GetPropertyDefL titleDef albumObjDef Title +test AddTextPropertyL obj1 titleDef "Humppaa 1" +// test GetPropertyDefL usageCountPropDef1 albumObjDef1 UsageCount +// test AddInt32PropertyL obj1 usageCountPropDef1 10 +test GetPropertyDefL creationDatePropDef1 albumObjDef1 CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 albumObjDef1 LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test GetPropertyDefL typePropDef1 albumObjDef1 Type +test AddUint16PropertyL obj1 typePropDef1 EAlbumUser +test GetPropertyDefL orderedPropDef1 albumObjDef1 Ordered +test AddBoolPropertyL obj1 orderedPropDef1 EFalse +test SetGuidL EObject obj1 000022 000002 +test AddObjectL obj1 + + +test NewObjectL obj2 albumObjDef KL +// test GetPropertyDefL titleDef albumObjDef Title +test AddTextPropertyL obj2 titleDef "Humppaa 2" +// test GetPropertyDefL usageCountPropDef1 albumObjDef1 UsageCount +// test AddInt32PropertyL obj2 usageCountPropDef1 10 +test AddTimePropertyL obj2 creationDatePropDef1 20081130:235959.999999 +test AddTimePropertyL obj2 lastModDatePropDef1 20081130:235959.999999 +test AddUint16PropertyL obj2 typePropDef1 EAlbumUserPredefined +test AddBoolPropertyL obj2 orderedPropDef1 EFalse +test SetGuidL EObject obj2 000022 000003 +test AddObjectL obj2 + +test GetRelationDefL relDefContains defaultNs Contains +test NewRelationL rel0 obj0 relDefContains obj1 0 KL +test NewRelationL rel1 obj0 relDefContains obj2 0 KL + +// test UsageCountL obj0 2 +// test UsageCountL obj1 1 +// test UsageCountL obj2 1 + +loop 2 +test AddRelationL LOOP_COUNTER +endloop + + + +test NewObjectQueryL rootCond defaultNs Item Album Object + +test GetPropertyDefL titlePropDef albumObjDef Title +test AddPropertyFilterL titlePropDef +test AppendOrderRuleL ESortAscending EOrderRuleTypeProperty titlePropDef + +test SetOperatorL rootCond ELogicConditionOperatorOr +test AddPropertyConditionL albumPropCond rootCond typePropDef UintRange Less EAlbumUserPredefined EAlbumUserPredefined +test AddPropertyConditionL typePropCond rootCond typePropDef PropCond +test SetNegateL typePropCond ETrue + +test SetObjectQueryResultL { obj0 obj1 } +test FindL -1 -1 +waittestclass test + + + +test RemoveRelationsL KSync rel0 2 +test RemoveObjectsL KSync KById obj0 2 +[Endtest] + +[Test] +title Query 7: usage counts and titles from used tags and sort in descending order by usage count +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs + +test GetObjectDefL albumObjDef defaultNs Album +test NewObjectL obj0 albumObjDef KL +test GetPropertyDefL titleDef albumObjDef Title +test AddTextPropertyL obj0 titleDef "Humppaa 0" +// test GetPropertyDefL usageCountPropDef albumObjDef UsageCount +// test AddInt32PropertyL obj0 usageCountPropDef 25 +test GetPropertyDefL creationDatePropDef albumObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 albumObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test GetPropertyDefL typePropDef albumObjDef Type +test AddUint16PropertyL obj0 typePropDef EAlbumUser +test GetPropertyDefL orderedPropDef albumObjDef Ordered +test AddBoolPropertyL obj0 orderedPropDef EFalse +test SetGuidL EObject obj0 000022 000001 +test AddObjectL obj0 + +test GetObjectDefL albumObjDef1 defaultNs Album +test NewObjectL obj1 albumObjDef1 KL +// test GetPropertyDefL titleDef albumObjDef Title +test AddTextPropertyL obj1 titleDef "Humppaa 1" +// test GetPropertyDefL usageCountPropDef1 albumObjDef1 UsageCount +// test AddInt32PropertyL obj1 usageCountPropDef1 10 +test GetPropertyDefL creationDatePropDef1 albumObjDef1 CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 albumObjDef1 LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test GetPropertyDefL typePropDef1 albumObjDef1 Type +test AddUint16PropertyL obj1 typePropDef1 EAlbumUser +test GetPropertyDefL orderedPropDef1 albumObjDef1 Ordered +test AddBoolPropertyL obj1 orderedPropDef1 EFalse +test SetGuidL EObject obj1 000022 000002 +test AddObjectL obj1 + + +test NewObjectL obj2 albumObjDef KL +// test GetPropertyDefL titleDef albumObjDef Title +test AddTextPropertyL obj2 titleDef "Humppaa 2" +// test GetPropertyDefL usageCountPropDef1 albumObjDef1 UsageCount +// test AddInt32PropertyL obj2 usageCountPropDef1 10 +test AddTimePropertyL obj2 creationDatePropDef1 20081130:235959.999999 +test AddTimePropertyL obj2 lastModDatePropDef1 20081130:235959.999999 +test AddUint16PropertyL obj2 typePropDef1 EAlbumUserPredefined +test AddBoolPropertyL obj2 orderedPropDef1 EFalse +test SetGuidL EObject obj2 000022 000003 +test AddObjectL obj2 + +test GetObjectDefL tagObjDef defaultNs Tag + +test NewObjectL tag0 tagObjDef KL +test AddTimePropertyL tag0 creationDatePropDef1 20081130:235959.999999 +test AddTimePropertyL tag0 lastModDatePropDef1 20081130:235959.999999 + +test NewObjectL tag1 tagObjDef KL +test AddTimePropertyL tag1 creationDatePropDef1 20081130:235959.999999 +test AddTimePropertyL tag1 lastModDatePropDef1 20081130:235959.999999 + +test AddObjectL tag0 +test AddObjectL tag1 + +test GetRelationDefL relDefContains defaultNs Contains +test NewRelationL rel0 obj0 relDefContains tag0 0 KL +test NewRelationL rel1 obj1 relDefContains tag1 0 KL +test NewRelationL rel2 obj2 relDefContains tag1 0 KL + +loop 3 +test AddRelationL LOOP_COUNTER +endloop + +test NewObjectQueryL rootCond defaultNs Count Object Object + +test AddRelationConditionL relCond rootCond Left RelationDef Contains +test RightL rightRelCond relCond +test AddObjectConditionL objCond rightRelCond Object tag1 1 + +test SetObjectQueryResultL { obj1 obj2 } +test FindL -1 -1 +waittestclass test + +test RemoveRelationsL KSync rel0 3 +test RemoveObjectsL KSync KById obj0 2 +test RemoveObjectsL KSync KById tag0 2 +[Endtest] + +[Test] +title Query 8: object IDs from defined album +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs + + +test GetObjectDefL albumObjDef defaultNs Album +test NewObjectL albumObj0 albumObjDef KL +test GetPropertyDefL titleDef albumObjDef Title +test AddTextPropertyL albumObj0 titleDef "Humppaa 0" +test GetPropertyDefL creationDatePropDef albumObjDef CreationDate +test AddTimePropertyL albumObj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 albumObjDef LastModifiedDate +test AddTimePropertyL albumObj0 lastModDatePropDef0 20081130:235959.999999 +test GetPropertyDefL typePropDef albumObjDef Type +test AddUint16PropertyL albumObj0 typePropDef 25 +test GetPropertyDefL orderedPropDef albumObjDef Ordered +test AddBoolPropertyL albumObj0 orderedPropDef EFalse +test SetGuidL EObject albumObj0 000022 000001 +test AddObjectL albumObj0 + +test GetObjectDefL audioObjDef defaultNs Audio +test NewObjectL track0 audioObjDef KL +test AddTextPropertyL track0 titleDef "HumppaSong" +test AddTimePropertyL track0 creationDatePropDef 20081130:235959.999999 +test AddTimePropertyL track0 lastModDatePropDef0 20081130:235959.999999 +test AddObjectL track0 + +test GetRelationDefL relDefContains defaultNs Contains +test NewRelationL rel0 albumObj0 relDefContains track0 0 KL +test AddRelationL rel0 + +test NewObjectQueryL rootCond defaultNs Id Object Object +test AddRelationConditionL containsRelCond rootCond Right RelationDef Contains +test LeftL leftRelCond containsRelCond +test AddObjectConditionL objCond leftRelCond Object albumObj0 1 + + +test SetObjectQueryResultL { track0 } +test FindL -1 -1 +waittestclass test + +test RemoveRelationL rel0 +test RemoveObjectsL KSync KById albumObj0 2 + +[Endtest] + +[Test] +title Query 9: object count from defined tag +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs + +test GetObjectDefL albumObjDef defaultNs Album +test NewObjectL albumObj0 albumObjDef KL +test GetPropertyDefL titleDef albumObjDef Title +test AddTextPropertyL albumObj0 titleDef "Humppaa 0" +test GetPropertyDefL creationDatePropDef albumObjDef CreationDate +test AddTimePropertyL albumObj0 creationDatePropDef 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 albumObjDef LastModifiedDate +test AddTimePropertyL albumObj0 lastModDatePropDef0 20081130:235959.999999 +test GetPropertyDefL typePropDef albumObjDef Type +test AddUint16PropertyL albumObj0 typePropDef 25 +test GetPropertyDefL orderedPropDef albumObjDef Ordered +test AddBoolPropertyL albumObj0 orderedPropDef EFalse +test SetGuidL EObject albumObj0 000022 000001 + + +test GetObjectDefL audioObjDef defaultNs Audio +test NewObjectL track0 audioObjDef KL +test AddTextPropertyL track0 titleDef "HumppaSong" +test AddTimePropertyL track0 creationDatePropDef 20081130:235959.999999 +test AddTimePropertyL track0 lastModDatePropDef0 20081130:235959.999999 + +test AddObjectL albumObj0 +test AddObjectL track0 + +test GetRelationDefL relDefContains defaultNs Contains +test NewRelationL rel0 albumObj0 relDefContains track0 0 KL + + +test AddRelationL rel0 + +test NewObjectQueryL rootCond defaultNs Count Object Object +test AddRelationConditionL containsRelCond rootCond Left RelationDef Contains +test RightL rightRelCond containsRelCond +test AddObjectConditionL objCond rightRelCond Object track0 1 + +test SetObjectQueryResultL { track0 } +test FindL -1 -1 +waittestclass test + +test RemoveRelationL rel0 +test RemoveObjectsL KSync KById albumObj0 2 + +// test RemoveRelationsL KSync rel0 1 +[Endtest] + +[Test] +title Query 10: videos created within a year and (length less or equal than 30 seconds or size less than 1 MB) +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +// Add 4 video objects to DB +test GetObjectDefL videoObjDef defaultNs Video + + +test GetPropertyDefL creationDatePropDef videoObjDef CreationDate +test GetPropertyDefL lastModDatePropDef videoObjDef LastModifiedDate + +test GetPropertyDefL durationPropDef videoObjDef Duration +test GetPropertyDefL sizePropDef videoObjDef Size + +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\TEST_VIDEO16.mp4 +test AddTimePropertyL obj0 creationDatePropDef 20071130:235959.999999 +test AddTimePropertyL obj0 lastModDatePropDef 20081130:235959.999999 +test AddReal32PropertyL obj0 durationPropDef 30 +test AddUint32PropertyL obj0 sizePropDef 999999 + +test NewObjectL obj1 videoObjDef KL +test SetUriL obj1 e:\testing\data\TEST_VIDEO17.mp4 +test AddTimePropertyL obj1 creationDatePropDef 20081130:235959.999999 +test AddTimePropertyL obj1 lastModDatePropDef 20090000:000000.000000 +test AddReal32PropertyL obj1 durationPropDef 28 +test AddUint32PropertyL obj1 sizePropDef 999999 + +test NewObjectL obj2 videoObjDef KL +test SetUriL obj2 e:\testing\data\TEST_VIDEO18.mp4 +test AddTimePropertyL obj2 creationDatePropDef 20080001:000000.000000 +test AddTimePropertyL obj2 lastModDatePropDef 20090000:000000.000001 +test AddReal32PropertyL obj2 durationPropDef 28 +test AddUint32PropertyL obj2 sizePropDef 1000000 + +test NewObjectL obj3 videoObjDef KL +test SetUriL obj3 e:\testing\data\TEST_VIDEO19.mp4 +test AddTimePropertyL obj3 creationDatePropDef 20091130:235959.999999 +test AddTimePropertyL obj3 lastModDatePropDef 20090000:000000.000002 +test AddReal32PropertyL obj3 durationPropDef 28 +test AddUint32PropertyL obj3 sizePropDef 999999 + +test AddObjectsL obj0 4 + +test NewObjectQueryL rootCond defaultNs Item Video Object +test AddPropertyConditionL propCond rootCond creationDatePropDef TimeRange Between 20080000:000000.000000 20090000:000000.000000 +test AddLogicConditionL durationCond rootCond OR + +test AddPropertyConditionL durationPropCond durationCond durationPropDef RealRange LessOrEqual 30 30 +test AddPropertyConditionL sizePropCond durationCond sizePropDef UintRange Less 1000000 1000000 + +test SetObjectQueryResultL { obj1 obj2 } +test FindL -1 -1 +waittestclass test + +test RemoveObjectsL KSync KById obj0 4 +delete test +[Endtest] + +[Test] +title Query 11: images within some region (GPS location in some rectangle) +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +// Add 4 video objects to DB +test GetObjectDefL imageObjDef defaultNs Image + + +test GetPropertyDefL creationDatePropDef imageObjDef CreationDate +test GetPropertyDefL lastModDatePropDef imageObjDef LastModifiedDate + +test GetPropertyDefL sizePropDef imageObjDef Size + +test NewObjectL image0 imageObjDef KL +test SetUriL image0 e:\testing\data\TEST_IMAGE16.jpg +test AddTimePropertyL image0 creationDatePropDef 20071130:235959.999999 +test AddTimePropertyL image0 lastModDatePropDef 20081130:235959.999999 +test AddUint32PropertyL image0 sizePropDef 999999 + +test NewObjectL image1 imageObjDef KL +test SetUriL image1 e:\testing\data\TEST_IMAGE17.jpg +test AddTimePropertyL image1 creationDatePropDef 20081130:235959.999999 +test AddTimePropertyL image1 lastModDatePropDef 20090000:000000.000000 +test AddUint32PropertyL image1 sizePropDef 999999 + +test NewObjectL image2 imageObjDef KL +test SetUriL image2 e:\testing\data\TEST_IMAGE18.jpg +test AddTimePropertyL image2 creationDatePropDef 20080001:000000.000000 +test AddTimePropertyL image2 lastModDatePropDef 20090000:000000.000001 +test AddUint32PropertyL image2 sizePropDef 999999 + +test NewObjectL image3 imageObjDef KL +test SetUriL image3 e:\testing\data\TEST_IMAGE19.jpg +test AddTimePropertyL image3 creationDatePropDef 20091130:235959.999999 +test AddTimePropertyL image3 lastModDatePropDef 20090000:000000.000002 +test AddUint32PropertyL image3 sizePropDef 999999 + +test AddObjectsL image0 4 + +test GetObjectDefL locationObjectDef defaultNs Location +test GetPropertyDefL latitudeLocationPropDef locationObjectDef Latitude +test GetPropertyDefL longitudeLocationPropDef locationObjectDef Longitude + +test NewObjectL loc0 locationObjectDef KL +test AddTimePropertyL loc0 creationDatePropDef 20091130:235959.999999 +test AddTimePropertyL loc0 lastModDatePropDef 20090000:000000.000002 +test AddReal64PropertyL loc0 latitudeLocationPropDef 61 +test AddReal64PropertyL loc0 longitudeLocationPropDef 26 + +test NewObjectL loc1 locationObjectDef KL +test AddTimePropertyL loc1 creationDatePropDef 20091130:235959.999999 +test AddTimePropertyL loc1 lastModDatePropDef 20090000:000000.000002 +test AddReal64PropertyL loc1 latitudeLocationPropDef 62 +test AddReal64PropertyL loc1 longitudeLocationPropDef 60 + +test AddObjectsL loc0 2 + +test GetRelationDefL relContainsLocationDef defaultNs ContainsLocation + +test NewRelationL rel00 image0 relContainsLocationDef loc0 0 KL +test NewRelationL rel11 image1 relContainsLocationDef loc1 0 KL +test NewRelationL rel21 image2 relContainsLocationDef loc1 0 KL + +test AddRelationL rel00 +test AddRelationL rel11 +test AddRelationL rel21 + +test NewObjectQueryL rootCond defaultNs Item Image Object + +test AddRelationConditionL relCond rootCond Left RelationDef ContainsLocation +test RightL rightRelCond relCond + +test AddPropertyConditionL latitudePropCond rightRelCond latitudeLocationPropDef RealRange Between 60 63 +test AddPropertyConditionL longitudePropCond rightRelCond longitudeLocationPropDef RealRange Between 21 27 + +test SetObjectQueryResultL { image0 } +test FindL -1 -1 +waittestclass test + +test RemoveObjectsL KSync KById image0 4 +test RemoveObjectsL KSync KById loc0 2 +test RemoveRelationsL KSync rel00 3 + +delete test +[Endtest] + +[Test] +title Query 12: from downloaded objects, which are modified (last modified date) during this month +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +// Add 4 video objects to DB +test GetObjectDefL imageObjDef defaultNs Image +test GetObjectDefL videoObjDef defaultNs Video +test GetObjectDefL objDef defaultNs Object + +test GetPropertyDefL originPropDef objDef Origin + +test GetPropertyDefL creationDatePropDef imageObjDef CreationDate +test GetPropertyDefL lastModDatePropDef imageObjDef LastModifiedDate + +test GetPropertyDefL videoCreationDatePropDef videoObjDef CreationDate +test GetPropertyDefL videoLastModDatePropDef videoObjDef LastModifiedDate + +test GetPropertyDefL sizePropDef imageObjDef Size + +test NewObjectL image0 imageObjDef KL +test SetUriL image0 e:\testing\data\TEST_IMAGE16.jpg +test AddTimePropertyL image0 creationDatePropDef 20071130:235959.999999 +test AddTimePropertyL image0 lastModDatePropDef 20081130:235959.999999 +test AddUint32PropertyL image0 sizePropDef 999999 +test AddUint8PropertyL image0 originPropDef ECamera + +test NewObjectL image1 imageObjDef KL +test SetUriL image1 e:\testing\data\TEST_IMAGE17.jpg +test AddTimePropertyL image1 creationDatePropDef 20081130:235959.999999 +test AddTimePropertyL image1 lastModDatePropDef 20090001:000000.000000 +test AddUint32PropertyL image1 sizePropDef 999999 +test AddUint8PropertyL image1 originPropDef EDownloaded + +test NewObjectL video0 videoObjDef KL +test SetUriL video0 e:\testing\data\TEST_VIDEO18.jpg +test AddTimePropertyL video0 videoCreationDatePropDef 20080001:000000.000000 +test AddTimePropertyL video0 videoLastModDatePropDef 20090000:000000.000001 +test AddUint32PropertyL video0 sizePropDef 999999 +test AddUint8PropertyL video0 originPropDef ESideLoaded + +test NewObjectL video1 videoObjDef KL +test SetUriL video1 e:\testing\data\TEST_VIDEO19.jpg +test AddTimePropertyL video1 videoCreationDatePropDef 20091130:235959.999999 +test AddTimePropertyL video1 videoLastModDatePropDef 20091130:235959.999999 +test AddUint32PropertyL video1 sizePropDef 999999 +test AddUint8PropertyL video1 originPropDef EDownloaded + +test AddObjectsL image0 2 +test AddObjectsL video0 2 + +test NewObjectQueryL rootCond defaultNs Item Object Object + +test AddPropertyFilterL sizePropDef +test AddPropertyConditionL originPropCond rootCond originPropDef UintRange Equal EDownloaded 0 +test AddPropertyConditionL lastModPropCond rootCond videoLastModDatePropDef TimeRange Between 20090000:000000.000000 20090100:000000.000000 + +test SetObjectQueryResultL { image1 } +test FindL -1 -1 +waittestclass test + +test RemoveObjectsL KSync KById image0 2 +test RemoveObjectsL KSync KById video0 2 + + +[Endtest] + +[Test] +title Query 13: width, height and size properties from images and videos, sorted by size (largest->smallest) +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +// Add 2 image objects and 2 video objects to DB +test GetObjectDefL imageObjDef defaultNs Image +test GetObjectDefL videoObjDef defaultNs Video +test GetObjectDefL objDef defaultNs Object +test GetObjectDefL mediaObjDef defaultNs MediaObject + +test GetPropertyDefL originPropDef objDef Origin + +test GetPropertyDefL creationDatePropDef imageObjDef CreationDate +test GetPropertyDefL lastModDatePropDef imageObjDef LastModifiedDate + +test GetPropertyDefL videoCreationDatePropDef videoObjDef CreationDate +test GetPropertyDefL videoLastModDatePropDef videoObjDef LastModifiedDate + +test GetPropertyDefL widthPropDef mediaObjDef Width +test GetPropertyDefL heightPropDef mediaObjDef Height +test GetPropertyDefL sizePropDef imageObjDef Size + +test NewObjectL image0 imageObjDef KL +test SetUriL image0 e:\testing\data\TEST_IMAGE16.jpg +test AddTimePropertyL image0 creationDatePropDef 20071130:235959.999999 +test AddTimePropertyL image0 lastModDatePropDef 20081130:235959.999999 +test AddUint32PropertyL image0 sizePropDef 999999 +test AddUint8PropertyL image0 originPropDef ECamera +test AddUint16PropertyL image0 widthPropDef 200 +test AddUint16PropertyL image0 heightPropDef 100 + +test NewObjectL image1 imageObjDef KL +test SetUriL image1 e:\testing\data\TEST_IMAGE17.jpg +test AddTimePropertyL image1 creationDatePropDef 20081130:235959.999999 +test AddTimePropertyL image1 lastModDatePropDef 20090000:000000.000000 +test AddUint32PropertyL image1 sizePropDef 999997 +test AddUint8PropertyL image1 originPropDef EDownloaded +test AddUint16PropertyL image1 widthPropDef 200 +test AddUint16PropertyL image1 heightPropDef 100 + +test NewObjectL video0 videoObjDef KL +test SetUriL video0 e:\testing\data\TEST_VIDEO18.mp4 +test AddTimePropertyL video0 videoCreationDatePropDef 20080001:000000.000000 +test AddTimePropertyL video0 videoLastModDatePropDef 20090000:000000.000001 +test AddUint32PropertyL video0 sizePropDef 999998 +test AddUint8PropertyL video0 originPropDef ESideLoaded +test AddUint16PropertyL video0 widthPropDef 200 +test AddUint16PropertyL video0 heightPropDef 100 + +test NewObjectL video1 videoObjDef KL +test SetUriL video1 e:\testing\data\TEST_VIDEO19.mp4 +test AddTimePropertyL video1 videoCreationDatePropDef 20091130:235959.999999 +test AddTimePropertyL video1 videoLastModDatePropDef 20091130:235959.999999 +test AddUint32PropertyL video1 sizePropDef 999996 +test AddUint8PropertyL video1 originPropDef EDownloaded +test AddUint16PropertyL video1 widthPropDef 200 +test AddUint16PropertyL video1 heightPropDef 100 + +test AddObjectsL image0 2 +test AddObjectsL video0 2 + +test NewObjectQueryL rootCond defaultNs Item MediaObject LookupObject { imageObjDef videoObjDef } + +test AddPropertyFilterL widthPropDef +test AddPropertyFilterL heightPropDef +test AddPropertyFilterL sizePropDef +test AppendOrderRuleL ESortDescending EOrderRuleTypeProperty sizePropDef + +test SetObjectQueryResultL { image0 video0 image1 video1 } +test FindL -1 -1 +waittestclass test + +test RemoveObjectsL KSync KById image0 2 +test RemoveObjectsL KSync KById video0 2 +[Endtest] + +[Test] +title Query 14: distinct models from images by prefix "N", sorted A->Z +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +// Add 4 video objects to DB +test GetObjectDefL imageObjDef defaultNs Image +test GetObjectDefL videoObjDef defaultNs Video +test GetObjectDefL objDef defaultNs Object +test GetObjectDefL mediaObjDef defaultNs MediaObject + +test GetPropertyDefL originPropDef objDef Origin + +test GetPropertyDefL creationDatePropDef imageObjDef CreationDate +test GetPropertyDefL lastModDatePropDef imageObjDef LastModifiedDate + + + +test GetPropertyDefL widthPropDef mediaObjDef Width +test GetPropertyDefL heightPropDef mediaObjDef Height +test GetPropertyDefL sizePropDef imageObjDef Size +test GetPropertyDefL modelPropDef imageObjDef Model + +test NewObjectL image0 imageObjDef KL +test SetUriL image0 e:\testing\data\TEST_IMAGE16.jpg +test AddTimePropertyL image0 creationDatePropDef 20071130:235959.999999 +test AddTimePropertyL image0 lastModDatePropDef 20081130:235959.999999 +test AddUint32PropertyL image0 sizePropDef 999999 +test AddUint8PropertyL image0 originPropDef ECamera +test AddUint16PropertyL image0 widthPropDef 200 +test AddUint16PropertyL image0 heightPropDef 100 +test AddTextPropertyL image0 modelPropDef "NModel" + +test NewObjectL image1 imageObjDef KL +test SetUriL image1 e:\testing\data\TEST_IMAGE17.jpg +test AddTimePropertyL image1 creationDatePropDef 20081130:235959.999999 +test AddTimePropertyL image1 lastModDatePropDef 20090000:000000.000000 +test AddUint32PropertyL image1 sizePropDef 999999 +test AddUint8PropertyL image1 originPropDef EDownloaded +test AddUint16PropertyL image1 widthPropDef 200 +test AddUint16PropertyL image1 heightPropDef 100 +test AddTextPropertyL image1 modelPropDef "NModel" + +test NewObjectL image2 imageObjDef KL +test SetUriL image2 e:\testing\data\TEST_IMAGE18.jpg +test AddTimePropertyL image2 creationDatePropDef 20080001:000000.000000 +test AddTimePropertyL image2 lastModDatePropDef 20090000:000000.000001 +test AddUint32PropertyL image2 sizePropDef 999999 +test AddUint8PropertyL image2 originPropDef ESideLoaded +test AddUint16PropertyL image2 widthPropDef 200 +test AddUint16PropertyL image2 heightPropDef 100 +test AddTextPropertyL image2 modelPropDef "NModel" + +test NewObjectL image3 imageObjDef KL +test SetUriL image3 e:\testing\data\TEST_IMAGE39.jpg +test AddTimePropertyL image3 creationDatePropDef 20091130:235959.999999 +test AddTimePropertyL image3 lastModDatePropDef 20091130:235959.999999 +test AddUint32PropertyL image3 sizePropDef 999999 +test AddUint8PropertyL image3 originPropDef EDownloaded +test AddUint16PropertyL image3 widthPropDef 200 +test AddUint16PropertyL image3 heightPropDef 100 +test AddTextPropertyL image3 modelPropDef "ModelN" + +test AddObjectsL image0 2 +test AddObjectsL image2 2 + +test NewObjectQueryL rootCond defaultNs DistinctValues Image Object + +test AddPropertyConditionL modelPropCond rootCond modelPropDef TextCompare BeginsWith N +test AppendOrderRuleL ESortAscending EOrderRuleTypeProperty modelPropDef +test AddPropertyFilterL modelPropDef + +test SetObjectQueryResultL { image0 image1 image2 } +test FindL -1 -1 +waittestclass test + +test RemoveObjectsL KSync KById image0 2 +test RemoveObjectsL KSync KById image2 2 + +[Endtest] + +[Test] +title Query 15: objects with freetexts with freetext contains some text +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +// Add 4 video objects to DB +test GetObjectDefL imageObjDef defaultNs Image +test GetObjectDefL videoObjDef defaultNs Video +test GetObjectDefL objDef defaultNs Object +test GetObjectDefL mediaObjDef defaultNs MediaObject + +test GetPropertyDefL originPropDef objDef Origin + +test GetPropertyDefL creationDatePropDef imageObjDef CreationDate +test GetPropertyDefL lastModDatePropDef imageObjDef LastModifiedDate + + + +test GetPropertyDefL widthPropDef mediaObjDef Width +test GetPropertyDefL heightPropDef mediaObjDef Height +test GetPropertyDefL sizePropDef imageObjDef Size +test GetPropertyDefL modelPropDef imageObjDef Model + +test NewObjectL image0 imageObjDef KL +test SetUriL image0 e:\testing\data\TEST_IMAGE16.jpg +test AddTimePropertyL image0 creationDatePropDef 20071130:235959.999999 +test AddTimePropertyL image0 lastModDatePropDef 20081130:235959.999999 +test AddUint32PropertyL image0 sizePropDef 999999 +test AddUint8PropertyL image0 originPropDef ECamera +test AddUint16PropertyL image0 widthPropDef 200 +test AddUint16PropertyL image0 heightPropDef 100 + +test AddFreeTextL image0 cat + +test NewObjectL image1 imageObjDef KL +test SetUriL image1 e:\testing\data\TEST_IMAGE17.jpg +test AddTimePropertyL image1 creationDatePropDef 20081130:235959.999999 +test AddTimePropertyL image1 lastModDatePropDef 20090000:000000.000000 +test AddUint32PropertyL image1 sizePropDef 999999 +test AddUint8PropertyL image1 originPropDef EDownloaded +test AddUint16PropertyL image1 widthPropDef 200 +test AddUint16PropertyL image1 heightPropDef 100 + +test AddFreeTextL image1 cata + +test NewObjectL image2 imageObjDef KL +test SetUriL image2 e:\testing\data\TEST_IMAGE18.jpg +test AddTimePropertyL image2 creationDatePropDef 20080001:000000.000000 +test AddTimePropertyL image2 lastModDatePropDef 20090000:000000.000001 +test AddUint32PropertyL image2 sizePropDef 999999 +test AddUint8PropertyL image2 originPropDef ESideLoaded +test AddUint16PropertyL image2 widthPropDef 200 +test AddUint16PropertyL image2 heightPropDef 100 + +test AddFreeTextL image2 acat + +test NewObjectL image3 imageObjDef KL +test SetUriL image3 e:\testing\data\TEST_IMAGE39.jpg +test AddTimePropertyL image3 creationDatePropDef 20091130:235959.999999 +test AddTimePropertyL image3 lastModDatePropDef 20091130:235959.999999 +test AddUint32PropertyL image3 sizePropDef 999999 +test AddUint8PropertyL image3 originPropDef EDownloaded +test AddUint16PropertyL image3 widthPropDef 200 +test AddUint16PropertyL image3 heightPropDef 100 + +test AddFreeTextL image3 TestFreeText3 + +test AddObjectsL image0 4 + + +test NewObjectQueryL rootCond defaultNs ObjectWithFreetexts Object Object +test AddObjectConditionL objCond rootCond ObjectConditionCompare FreeTextContains cat + +test SetObjectQueryResultL { image0 image1 image2 } +test FindL -1 -1 +waittestclass test + +test RemoveObjectsL KSync KById image0 2 +test RemoveObjectsL KSync KById image2 2 + + +[Endtest] + +[Test] +title Query 16: 5 newest objects, sort by creation date, limit to 5 +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +// Add 6 image objects and 1 video object to DB +test GetObjectDefL imageObjDef defaultNs Image +test GetObjectDefL videoObjDef defaultNs Video +test GetObjectDefL objDef defaultNs Object +test GetObjectDefL mediaObjDef defaultNs MediaObject + +test GetPropertyDefL originPropDef objDef Origin + +test GetPropertyDefL creationDatePropDef imageObjDef CreationDate +test GetPropertyDefL lastModDatePropDef imageObjDef LastModifiedDate + + + +test GetPropertyDefL widthPropDef mediaObjDef Width +test GetPropertyDefL heightPropDef mediaObjDef Height +test GetPropertyDefL sizePropDef imageObjDef Size +test GetPropertyDefL modelPropDef imageObjDef Model + +test NewObjectL image0 imageObjDef KL +test SetUriL image0 e:\testing\data\TEST_IMAGE16.jpg +test AddTimePropertyL image0 creationDatePropDef 20171130:235959.999999 +test AddTimePropertyL image0 lastModDatePropDef 20081130:235959.999999 +test AddUint32PropertyL image0 sizePropDef 999999 +test AddUint8PropertyL image0 originPropDef ECamera +test AddUint16PropertyL image0 widthPropDef 200 +test AddUint16PropertyL image0 heightPropDef 100 +test AddTextPropertyL image0 modelPropDef "NModel" +test AddFreeTextL image0 cat + +test NewObjectL image1 imageObjDef KL +test SetUriL image1 e:\testing\data\TEST_IMAGE17.jpg +test AddTimePropertyL image1 creationDatePropDef 20181130:235959.999999 +test AddTimePropertyL image1 lastModDatePropDef 20090000:000000.000000 +test AddUint32PropertyL image1 sizePropDef 999999 +test AddUint8PropertyL image1 originPropDef EDownloaded +test AddUint16PropertyL image1 widthPropDef 200 +test AddUint16PropertyL image1 heightPropDef 100 +test AddTextPropertyL image1 modelPropDef "NModel" +test AddFreeTextL image1 cata + +test NewObjectL image2 imageObjDef KL +test SetUriL image2 e:\testing\data\TEST_IMAGE18.jpg +test AddTimePropertyL image2 creationDatePropDef 20180001:000000.000000 +test AddTimePropertyL image2 lastModDatePropDef 20090000:000000.000001 +test AddUint32PropertyL image2 sizePropDef 999999 +test AddUint8PropertyL image2 originPropDef ESideLoaded +test AddUint16PropertyL image2 widthPropDef 200 +test AddUint16PropertyL image2 heightPropDef 100 +test AddTextPropertyL image2 modelPropDef "NModel" +test AddFreeTextL image2 acat + +test NewObjectL image3 imageObjDef KL +test SetUriL image3 e:\testing\data\TEST_IMAGE39.jpg +test AddTimePropertyL image3 creationDatePropDef 20191130:235959.999999 +test AddTimePropertyL image3 lastModDatePropDef 20091130:235959.999999 +test AddUint32PropertyL image3 sizePropDef 999999 +test AddUint8PropertyL image3 originPropDef EDownloaded +test AddUint16PropertyL image3 widthPropDef 200 +test AddUint16PropertyL image3 heightPropDef 100 +test AddTextPropertyL image3 modelPropDef "ModelN" +test AddFreeTextL image3 TestFreeText3 + +test NewObjectL image4 imageObjDef KL +test SetUriL image4 e:\testing\data\TEST_IMAGE49.jpg +test AddTimePropertyL image4 creationDatePropDef 20191130:235959.999999 +test AddTimePropertyL image4 lastModDatePropDef 20091130:235959.999999 +test AddUint32PropertyL image4 sizePropDef 999999 +test AddUint8PropertyL image4 originPropDef EDownloaded +test AddUint16PropertyL image4 widthPropDef 200 +test AddUint16PropertyL image4 heightPropDef 100 +test AddTextPropertyL image4 modelPropDef "ModelN" +test AddFreeTextL image4 TestFreeText3 + +test NewObjectL image5 imageObjDef KL +test SetUriL image5 e:\testing\data\TEST_IMAGE59.jpg +test AddTimePropertyL image5 creationDatePropDef 20161130:235959.999999 +test AddTimePropertyL image5 lastModDatePropDef 20091130:235959.999999 +test AddUint32PropertyL image5 sizePropDef 999999 +test AddUint8PropertyL image5 originPropDef EDownloaded +test AddUint16PropertyL image5 widthPropDef 200 +test AddUint16PropertyL image5 heightPropDef 100 +test AddTextPropertyL image5 modelPropDef "ModelN" +test AddFreeTextL image5 TestFreeText3 + + +test GetPropertyDefL durationPropDef videoObjDef Duration + +test NewObjectL video0 videoObjDef KL +test SetUriL video0 e:\testing\data\TEST_VIDEO16.mp4 +test AddTimePropertyL video0 creationDatePropDef 20181130:235959.999999 +test AddTimePropertyL video0 lastModDatePropDef 20081130:235959.999999 +test AddReal32PropertyL video0 durationPropDef 30 +test AddUint32PropertyL video0 sizePropDef 999999 + +test AddObjectsL image0 6 +test AddObjectsL video0 1 + +test NewObjectQueryL rootCond defaultNs ObjectWithFreetexts Object Object +test AppendOrderRuleL ESortDescending EOrderRuleTypeProperty creationDatePropDef + +test SetObjectQueryResultL { image1 image2 image3 image4 video0 } +test FindL 5 -1 +waittestclass test + +test RemoveObjectsL KSync KById image0 6 +test RemoveObjectsL KSync KById video0 1 +[Endtest] + +[Test] +title Query 17: all Played events, which belongs to object with some ID +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000013 000001 +test AddObjectL obj0 + +test NewObjectL obj1 videoObjDef KL +test AddTimePropertyL obj1 creationDatePropDef0 20081130:235959.999999 +test AddTimePropertyL obj1 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj1 000013 000002 +test AddObjectL obj1 + +test GetEventDefL createdEventDef defaultNs Created +test NewEventL event0 obj0 createdEventDef TestSource TestParticipant 20081130:235959.999999 KL +test GetEventDefL deletedEventDef defaultNs Deleted +test NewEventL event1 obj0 deletedEventDef TestSource TestParticipant 20081130:235959.999999 KLC +test GetEventDefL playedEventDef defaultNs Played +test NewEventL event2 obj0 playedEventDef TestSource TestParticipant 20081130:235959.999999 KL +test NewEventL event3 obj1 playedEventDef TestSource TestParticipant 20081130:235959.999999 KLC +test GetEventDefL editedEventDef defaultNs Edited +test NewEventL event4 obj1 editedEventDef TestSource TestParticipant 20081130:235959.999999 KL +test GetEventDefL sentEventDef defaultNs Sent +test NewEventL event5 obj1 sentEventDef TestSource TestParticipant 20081130:235959.999999 KLC +test GetEventDefL receivedEventDef defaultNs Received +test NewEventL event6 obj1 receivedEventDef TestSource TestParticipant 20081130:235959.999999 KL +loop 7 +test BelongsToSessionL EEvent LOOP_COUNTER EFalse +test InDatabaseL EEvent LOOP_COUNTER EFalse +test AddEventL LOOP_COUNTER +test BelongsToSessionL EEvent LOOP_COUNTER ETrue +test SessionL EEvent LOOP_COUNTER +test InDatabaseL EEvent LOOP_COUNTER ETrue +endloop + + +test NewEventQueryL rootCond defaultNs Item + +test AddEventConditionL eventCond rootCond EventDef Played +test ObjectConditionsL objectCondition eventCond +test AddObjectConditionL objCond objectCondition Object obj1 1 + +test SetEventQueryResultL { event3 } +test FindL -1 -1 +waittestclass test + +test RemoveEventsL KSync event0 3 +request EEventsAsyncRemoved +test RemoveEventsL KAsync event3 4 +wait EEventsAsyncRemoved +release EEventsAsyncRemoved +test RemoveObjectL obj0 KById +test RemoveObjectL obj1 KById +delete test +[Endtest] + +[Test] +title Query 18: all IsVersionOf relations, which belongs to video objects and parameter is not equal to +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +// Add 4 video objects to DB +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\TEST_VIDEO12.mp4 +test GetPropertyDefL creationDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creationDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test NewObjectL obj1 videoObjDef KL +test SetUriL obj1 e:\testing\data\TEST_VIDEO13.mp4 +test GetPropertyDefL creationDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creationDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test NewObjectL obj2 videoObjDef KL +test SetUriL obj2 e:\testing\data\TEST_VIDEO14.mp4 +test GetPropertyDefL creationDatePropDef2 videoObjDef CreationDate +test AddTimePropertyL obj2 creationDatePropDef2 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef2 videoObjDef LastModifiedDate +test AddTimePropertyL obj2 lastModDatePropDef2 20081130:235959.999999 +test NewObjectL obj3 videoObjDef KL +test SetUriL obj3 e:\testing\data\TEST_VIDEO15.mp4 +test GetPropertyDefL creationDatePropDef3 videoObjDef CreationDate +test AddTimePropertyL obj3 creationDatePropDef3 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef3 videoObjDef LastModifiedDate +test AddTimePropertyL obj3 lastModDatePropDef3 20081130:235959.999999 +test AddObjectsL obj0 4 + +test GetRelationDefL relDefContains defaultNs Contains +test GetRelationDefL isVersionOfRelDef defaultNs IsVersionOf +test NewRelationL rel0 obj0 isVersionOfRelDef obj1 1 KL +test NewRelationL rel1 obj0 isVersionOfRelDef obj2 1 KL +test NewRelationL rel2 obj2 isVersionOfRelDef obj3 0 KLC +loop 3 +test AddRelationL LOOP_COUNTER +endloop + +// Query +test NewRelationQueryL rootCond defaultNs Item Video Object + +test AddRelationConditionL isVersionOfRelCond rootCond Left RelationDefRange IsVersionOf NotEqual 0 0 + +test LeftL leftRelCond isVersionOfRelCond +test AddObjectConditionL objCond leftRelCond ObjectDef Video + +test SetRelationQueryResultL { rel0 rel1 } +test FindL -1 -1 +waittestclass test + +test RemoveRelationsL KSync rel0 3 +test RemoveObjectsL KSync KById obj0 4 +delete test +[Endtest] + +[Test] +title Query 19: query the videos that are modified in the last 30 seconds +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs +// Add 3 video objects to DB +test GetObjectDefL videoObjDef defaultNs Video + +test GetPropertyDefL creationDatePropDef videoObjDef CreationDate +test GetPropertyDefL lastModDatePropDef videoObjDef LastModifiedDate + +test NewObjectL obj0 videoObjDef KL +test SetUriL obj0 e:\testing\data\TEST_VIDEO19_1.mp4 +test AddTimePropertyL obj0 creationDatePropDef 20090101:000000.000000 +test AddTimePropertyL obj0 lastModDatePropDef 20090809:115000.000000 + +test NewObjectL obj1 videoObjDef KL +test SetUriL obj1 e:\testing\data\TEST_VIDEO19_2.mp4 +test AddTimePropertyL obj1 creationDatePropDef 20090101:000000.000000 +test AddTimePropertyL obj1 lastModDatePropDef 20090808:115000.000000 + +test NewObjectL obj2 videoObjDef KL +test SetUriL obj2 e:\testing\data\TEST_VIDEO19_3.3gp +test AddTimePropertyL obj2 creationDatePropDef 20090101:000000.000000 +test AddTimePropertyL obj2 lastModDatePropDef 20090809:115020.000000 + +test AddObjectsL obj0 3 + +test NewObjectQueryL rootCond defaultNs Item Video Object +test AddPropertyConditionL propCond rootCond lastModDatePropDef TimeRange Between 20090809:115000.000000 20090809:115030.000000 + +test SetObjectQueryResultL { obj0 obj2 } +test FindL -1 -1 +waittestclass test + +test RemoveObjectsL KSync KById obj0 3 +delete test +[Endtest] + +// [Test] +// title Query : TestPopulateDbL +// create MdETestScripter test +// waittestclass test +// test TestPopulateDbL +// waittestclass test +// [Endtest] diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/data/mmc/MDETestScripterSchema.mde --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/data/mmc/MDETestScripterSchema.mde Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +// TestSchema.mde + +namespace http://sw.nokia.com/MdE/TestSchema 0 diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/data/mmc/MDETestScripterSchema2.mde --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/data/mmc/MDETestScripterSchema2.mde Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,18 @@ +// TestSchema2.mde + +namespace http://sw.nokia.com/MdE/TestSchema2 0 + +object http://sw.nokia.com/MdE/TestSchema2 TestObjectType Object 1 +property TestPropertyBool 0 0 0 min max +property TestPropertyInt8 1 0 1 min max +property TestPropertyUint8 0 0 2 min max +property TestPropertyInt16 1 0 3 min max +property TestPropertyUint16 0 0 4 min max +property TestPropertyInt32 1 0 5 min max +property TestPropertyUint32 0 0 6 min max +property TestPropertyInt64 1 0 7 min max +property TestPropertyReal32 0 0 8 min max +property TestPropertyReal64 1 0 9 min max +property TestPropertyTime 0 0 10 min 20100629163021 +property TestPropertyText 1 0 11 min max + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/data/mmc/MdETestScripterImportMetadata.mde --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/data/mmc/MdETestScripterImportMetadata.mde Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,134 @@ +object http://sw.nokia.com/MdE Video "e:\testing\data\test2video1.3gp" 4184041685 +property Origin 0 +property Size 66192 +property TimeOffset 120 +property CreationDate 20071217163916 +property LastModifiedDate 20071217143916 +property ItemType "video/H263-2000" +property Bitrate 23 +property Width 176 +property Height 144 +property Duration 21 +property ReleaseDate 20071217163916 +property CaptureDate 20071217163916 +property Framerate 7 + +object http://sw.nokia.com/MdE Video "e:\testing\data\test2video2.mp4" 4184041685 +property Origin 0 +property Size 733064 +property TimeOffset 120 +property CreationDate 20071217163916 +property LastModifiedDate 20071217143916 +property Bitrate 288 +property Width 320 +property Height 240 +property Duration 20 +property ReleaseDate 20071217163916 +property CaptureDate 20071217163916 +property Framerate 14 + +object http://sw.nokia.com/MdE Video "e:\testing\data\test3video1.3gp" 4184041685 +property Origin 0 +property Size 66192 +property TimeOffset 120 +property CreationDate 20071217163916 +property LastModifiedDate 20071217143916 +property ItemType "video/H263-2000" +property Bitrate 23 +property Width 176 +property Height 144 +property Duration 21 +property ReleaseDate 20071217163916 +property CaptureDate 20071217163916 +property Framerate 7 + +object http://sw.nokia.com/MdE Video "e:\testing\data\test3video2.mp4" 4184041685 +property Origin 0 +property Size 733064 +property TimeOffset 120 +property CreationDate 20071217163916 +property LastModifiedDate 20071217143916 +property Bitrate 288 +property Width 320 +property Height 240 +property Duration 20 +property ReleaseDate 20071217163916 +property CaptureDate 20071217163916 +property Framerate 14 + +object http://sw.nokia.com/MdE Video "e:\testing\data\test4video1.3gp" 4184041685 +property Origin 0 +property Size 66192 +property TimeOffset 120 +property CreationDate 20071217163916 +property LastModifiedDate 20071217143916 +property ItemType "video/H263-2000" +property Bitrate 23 +property Width 176 +property Height 144 +property Duration 21 +property ReleaseDate 20071217163916 +property CaptureDate 20071217163916 +property Framerate 7 + +object http://sw.nokia.com/MdE Video "e:\testing\data\test4video2" 4184041685 +property Origin 0 +property Size 733064 +property TimeOffset 120 +property CreationDate 20071217163916 +property LastModifiedDate 20071217143916 +property Bitrate 288 +property Width 320 +property Height 240 +property Duration 20 +property ReleaseDate 20071217163916 +property CaptureDate 20071217163916 +property Framerate 14 + +object http://sw.nokia.com/MdE Video "e:\testing\data\test26video1.3gp" 4184041685 +property Origin 0 +property Size 66192 +property TimeOffset 120 +property CreationDate 20080808000000 +property LastModifiedDate 20080808000000 +property ItemType "video/H263-2000" +property Bitrate 23 +property Size 12345678 +property Rating 4 +property Width 176 +property Height 144 +property Duration 21 +property ReleaseDate 20080808000000 +property CaptureDate 20080808000000 +property Framerate 7 +property DRM 0 + +object http://sw.nokia.com/MdE Video "e:\testing\data\testvideo1.3gp" 4184041685 +property Origin 0 +property Size 66192 +property TimeOffset 120 +property CreationDate 20071217163916 +property LastModifiedDate 20071217143916 +property ItemType "video/H263-2000" +property Bitrate 23 +property Width 176 +property Height 144 +property Duration 21 +property ReleaseDate 20071217163916 +property CaptureDate 20071217163916 +property Framerate 7 + +object http://sw.nokia.com/MdE Video "e:\testing\data\testvideo2.mp4" 4184041685 +property Origin 0 +property Size 733064 +property TimeOffset 120 +property CreationDate 20071217163916 +property LastModifiedDate 20071217143916 +property Bitrate 288 +property Width 320 +property Height 240 +property Duration 20 +property ReleaseDate 20071217163916 +property CaptureDate 20071217163916 +property Framerate 14 + \ No newline at end of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/data/mmc/test26video1.3gp Binary file mds_plat/metadata_engine_api/tsrc/data/mmc/test26video1.3gp has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/data/mmc/test2video1.3gp Binary file mds_plat/metadata_engine_api/tsrc/data/mmc/test2video1.3gp has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/data/mmc/test2video2.mp4 Binary file mds_plat/metadata_engine_api/tsrc/data/mmc/test2video2.mp4 has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/data/mmc/test3video1.3gp Binary file mds_plat/metadata_engine_api/tsrc/data/mmc/test3video1.3gp has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/data/mmc/test3video2.mp4 Binary file mds_plat/metadata_engine_api/tsrc/data/mmc/test3video2.mp4 has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/data/mmc/test4video1.3gp Binary file mds_plat/metadata_engine_api/tsrc/data/mmc/test4video1.3gp has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/data/mmc/test4video2 Binary file mds_plat/metadata_engine_api/tsrc/data/mmc/test4video2 has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/data/mmc/testvideo1.3gp Binary file mds_plat/metadata_engine_api/tsrc/data/mmc/testvideo1.3gp has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/data/mmc/testvideo2.mp4 Binary file mds_plat/metadata_engine_api/tsrc/data/mmc/testvideo2.mp4 has changed diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/eabi/MdETestScripteru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/eabi/MdETestScripteru.def Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,3 @@ +EXPORTS + _Z9LibEntryLR13CTestModuleIf @ 1 NONAME + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/group/MdETestScripter.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/group/MdETestScripter.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,51 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Project definition file +* +*/ + + +#include +#include + +TARGET MdETestScripter.dll +TARGETTYPE dll +UID 0x1000008D 0x101FB3E3 + +CAPABILITY ALL -TCB +VENDORID VID_DEFAULT + +DEFFILE MdETestScripter.DEF + +SOURCEPATH ../src +SOURCE MdETestScripter.cpp +SOURCE MdETestScripterBlocks.cpp +SOURCE MdETestScripterEditCommands.cpp +SOURCE MdETestScripterSchemaCommands.cpp +SOURCE MdETestScripterQueryCommands.cpp +SOURCE MdETestScripterAO.cpp + +USERINCLUDE ../inc + +MW_LAYER_SYSTEMINCLUDE + +LIBRARY euser.lib +LIBRARY efsrv.lib +LIBRARY stiftestinterface.lib +LIBRARY stiftestengine.lib +LIBRARY mdccommon.lib +LIBRARY mdeclient.lib +LIBRARY PlatformEnv.lib +LIBRARY bafl.lib + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/group/MdETestScripter.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/group/MdETestScripter.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,47 @@ +; +; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +; All rights reserved. +; This component and the accompanying materials are made available +; under the terms of "Eclipse Public License v1.0" +; which accompanies this distribution, and is available +; at the URL "http://www.eclipse.org/legal/epl-v10.html". +; +; Initial Contributors: +; Nokia Corporation - initial contribution. +; +; Contributors: +; +; Description: +; +; Installation file for API test + +; Languages +&EN + +; Header +#{"MdETestScripter"},(0x101FB3E3),1,0,1,TYPE=SA + +; Localised Vendor name +%{"Nokia-EN"} + +; Unique Vendor name +:"Nokia" + +; Files +"\epoc32\release\armv5\urel\MdETestScripter.dll" -"C:\sys\bin\MdETestScripter.dll" +"..\init\MdETestScripter.ini" -"C:\testframework\MdETestScripter.ini" +"..\conf\MdETestScripter.cfg" -"C:\testframework\MdETestScripter.cfg" + +"..\data\mmc\MdETestScripterImportMetadata.mde" -"E:\testing\data\MdETestScripterImportMetadata.mde" +"..\data\mmc\MdETestScripterSchema.mde" -"E:\testing\data\MdETestScripterSchema.mde" +"..\data\mmc\MdETestScripterSchema2.mde" -"E:\testing\data\MdETestScripterSchema2.mde" + +"..\data\mmc\test2video1.3gp" -"E:\testing\data\test2video1.3gp" +"..\data\mmc\test2video2.mp4" -"E:\testing\data\test2video2.mp4" +"..\data\mmc\test3video1.3gp" -"E:\testing\data\test3video1.3gp" +"..\data\mmc\test3video2.mp4" -"E:\testing\data\test3video2.mp4" +"..\data\mmc\test4video1.3gp" -"E:\testing\data\test4video1.3gp" +"..\data\mmc\test4video2" -"E:\testing\data\test4video2" +"..\data\mmc\test26video1.3gp" -"E:\testing\data\test26video1.3gp" +"..\data\mmc\testvideo1.3gp" -"E:\testing\data\testvideo1.3gp" +"..\data\mmc\testvideo2.mp4" -"E:\testing\data\testvideo2.mp4" diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Build information file +* +*/ + + +PRJ_PLATFORMS + DEFAULT + +PRJ_EXPORTS + +PRJ_MMPFILES + +PRJ_TESTMMPFILES +MdETestScripter.mmp + +PRJ_TESTEXPORTS +../conf/MdETestScripter.cfg /epoc32/winscw/c/TestFramework/MdETestScripter.cfg +../init/MdETestScripter.ini /epoc32/winscw/c/TestFramework/MdETestScripter.ini +../data/mmc/MdETestScripterImportMetadata.mde /epoc32/winscw/c/data/MdETestScripterImportMetadata.mde +../data/mmc/MdETestScripterSchema.mde /epoc32/winscw/c/data/MdETestScripterSchema.mde +../data/mmc/MdETestScripterSchema2.mde /epoc32/winscw/c/data/MdETestScripterSchema2.mde + +../data/mmc/test2video1.3gp /epoc32/winscw/c/Data/test2video1.3gp +../data/mmc/test2video2.mp4 /epoc32/winscw/c/Data/test2video2.mp4 +../data/mmc/test3video1.3gp /epoc32/winscw/c/Data/test3video1.3gp +../data/mmc/test3video2.mp4 /epoc32/winscw/c/Data/test3video2.mp4 +../data/mmc/test4video1.3gp /epoc32/winscw/c/Data/test4video1.3gp +../data/mmc/test4video2 /epoc32/winscw/c/Data/test4video2 +../data/mmc/test26video1.3gp /epoc32/winscw/c/Data/test26video1.3gp +../data/mmc/testvideo1.3gp /epoc32/winscw/c/Data/testvideo1.3gp +../data/mmc/testvideo2.mp4 /epoc32/winscw/c/Data/testvideo2.mp4 diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/inc/MdETestScripter.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/inc/MdETestScripter.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,544 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef MDETESTSCRIPTER_H +#define MDETESTSCRIPTER_H + +// INCLUDES +#include +#include +#include +#include +#include +#include + +// CONSTANTS +const TInt KPathPrefixLength( 2 ); + +const TInt KLast = -1; + +const TInt KById = 0; +const TInt KByUri = 1; +const TInt KByGuid = 2; +const TInt KByIds = 3; +const TInt KByDef = 4; +const TInt KByIndex = 5; + +const TInt KL = 0; +const TInt KLC = 1; + +const TInt KAsync = 0; +const TInt KSync = 1; + +const TInt ESession = 0; +const TInt EObjectDef = 1; +const TInt ERelationDef = 2; +const TInt EPropertyDef = 3; +const TInt EEventDef = 4; +const TInt ENamespaceDef = 5; +const TInt EObject = 6; +const TInt ERelation = 7; +const TInt EProperty = 8; +const TInt EEvent = 9; + +// MACROS +_LIT( KMdETestScripter, "MdETestScripter" ); +#if ( defined (__WINS__) || defined (__WINSCW__) ) +_LIT( KMdETestDataPath, "" ); +#else +_LIT( KMdETestDataPath, "\\testing" ); +#endif + +_LIT( KMdETestScripterLogPath, "\\logs\\testframework\\MdETestScripter\\" ); + +// Log file +_LIT( KMdETestScripterLogFile, "MdETestScripter.txt" ); +_LIT( KMdETestScripterLogFileWithTitle, "MdETestScripter_[%S].txt" ); + +// Events +// Events for schema +_LIT( KMdESchemaModified, "ESchemaModified" ); + +// Events for async request +_LIT( KMdEItemsAsyncAdd, "EItemsAsyncAdd" ); +_LIT( KMdEObjectsAsyncAdd, "EObjectsAsyncAdd" ); +_LIT( KMdERelationsAsyncAdd, "ERelationsAsyncAdd" ); +_LIT( KMdEEventsAsyncAdd, "EEventsAsyncAdd" ); + +_LIT( KMdEItemsAsyncUpdate, "EItemsAsyncUpdate" ); +_LIT( KMdEObjectsAsyncUpdate, "EObjectsAsyncUpdate" ); +_LIT( KMdERelationsAsyncUpdate, "ERelationsAsyncUpdate" ); +_LIT( KMdEEventsAsyncUpdate, "EEventsAsyncUpdate" ); + +_LIT( KMdEObjectsAsyncRemoved, "EObjectsAsyncRemoved" ); +_LIT( KMdERelationsAsyncRemoved, "ERelationsAsyncRemoved" ); +_LIT( KMdEEventsAsyncRemoved, "EEventsAsyncRemoved" ); + + +// FUNCTION PROTOTYPES + +// FORWARD DECLARATIONS +class CMdETestScripter; +class CMdESession; +class CMdENamespaceDef; +class CMdEObject; +class CMdEInstanceItem; +class CMdEQuery; +class CMdELogicCondition; +class CMdETestScripterAO; + +// DATA TYPES + +// CLASS DECLARATION + +/** +* CMdETestScripter test class for STIF Test Framework TestScripter. +* ?other_description_lines +* +* @lib ?library +* @since ?Series60_version +*/ +NONSHARABLE_CLASS(CMdETestScripter) : public CScriptBase, + public MMdESchemaObserver, + public MMdEObjectObserver, + public MMdEObjectObserverWithUri, + public MMdEObjectPresentObserver, + public MMdERelationObserver, + public MMdERelationItemObserver, + public MMdERelationPresentObserver, + public MMdESessionObserver, + public MMdEEventObserver, + public MMdEQueryObserver + { + friend class CMdETestScripterAO; + public: // Constructors and destructor + + /** + * Two-phased constructor. + */ + static CMdETestScripter* NewL( CTestModuleIf& aTestModuleIf ); + + /** + * Destructor. + */ + virtual ~CMdETestScripter(); + + public: // New functions + + public: // Functions from base classes + virtual TInt RunMethodL( CStifItemParser& aItem ); + + protected: // New functions + + + protected: // Functions from base classes + + + private: + + /** + * C++ default constructor. + */ + CMdETestScripter( CTestModuleIf& aTestModuleIf ); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + + /** + * Frees all resources allocated from test methods. + * @since ?Series60_version + */ + void Delete(); + + template T* SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, + CStifItemParser& aItem ); + CMdEInstanceItem* GetInstanceItemByArrayIndexL( + TInt aMode, CStifItemParser& aItem ); + void CheckTMdEObjectL( const TMdEObject& aTObject, const CMdEObject& aObject ); + void CheckTMdERelationL( const TMdERelation& aTRelation, const CMdERelation& aRelation ); + template void CheckTInstanceL( const T1& aT1, const T2& aT2 ); + void CheckTMdEObjectArrayL( + const RArray& aTObjects, TInt objIndex, TInt aCount ); + void CheckTMdERelationArrayL( + const RArray& aTRelations, const TInt aObjIndex, const TInt aCount ); + template void CheckTItemIdArrayL( + const RArray& aTItemIds, const RPointerArray& aArray, + const TInt aIndex, const TInt aCount ); + TInt CheckAsyncResultArrayL( TEventIf aEvent ); + void FormInstanceItemArrayL( + CStifItemParser& aItem, RPointerArray& aItemArray ) const; + + /** + * Test methods are listed below. + */ + + // Observer add/remove test primitives + virtual TInt AddSchemaObserverL( CStifItemParser& aItem ); + virtual TInt RemoveSchemaObserverL( CStifItemParser& aItem ); + virtual TInt AddObjectObserverL( CStifItemParser& aItem ); + virtual TInt RemoveObjectObserverL( CStifItemParser& aItem ); + virtual TInt AddObjectObserverWithUriL( CStifItemParser& aItem ); + virtual TInt RemoveObjectObserverWithUriL( CStifItemParser& aItem ); + virtual TInt AddObjectPresentObserverL( CStifItemParser& aItem ); + virtual TInt RemoveObjectPresentObserverL( CStifItemParser& aItem ); + virtual TInt AddRelationObserverL( CStifItemParser& aItem ); + virtual TInt RemoveRelationObserverL( CStifItemParser& aItem ); + virtual TInt AddRelationItemObserverL( CStifItemParser& aItem ); + virtual TInt RemoveRelationItemObserverL( CStifItemParser& aItem ); + virtual TInt AddRelationPresentObserverL( CStifItemParser& aItem ); + virtual TInt RemoveRelationPresentObserverL( CStifItemParser& aItem ); + virtual TInt AddEventObserverL( CStifItemParser& aItem ); + virtual TInt RemoveEventObserverL( CStifItemParser& aItem ); + + // Notification resulated test primitives + virtual TInt VerifyTItemIdsL( CStifItemParser& aItem ); + virtual TInt VerifyMdERelationsL( CStifItemParser& aItem ); + virtual TInt VerifyObserverNotificationTypeL( CStifItemParser& aItem ); + + // Metadata/schema/namespace test primitives. + virtual TInt ObjectDefCountL( CStifItemParser& aItem ); + virtual TInt ObjectDefL( CStifItemParser& aItem ); + virtual TInt GetObjectDefL( CStifItemParser& aItem ); + virtual TInt RelationDefCountL( CStifItemParser& aItem ); + virtual TInt RelationDefL( CStifItemParser& aItem ); + virtual TInt GetRelationDefL( CStifItemParser& aItem ); + virtual TInt EventDefCountL( CStifItemParser& aItem ); + virtual TInt EventDefL( CStifItemParser& aItem ); + virtual TInt GetEventDefL( CStifItemParser& aItem ); + + virtual TInt ExportMetadataL( CStifItemParser& aItem ); + virtual TInt ImportMetadataL( CStifItemParser& aItem ); + virtual TInt ImportSchemaL( CStifItemParser& aItem ); + virtual TInt NamespaceDefCountL( CStifItemParser& aItem ); + virtual TInt NamespaceDefL( CStifItemParser& aItem ); + virtual TInt GetNamespaceDefL( CStifItemParser& aItem ); + virtual TInt ResetNamespaceDefArray( CStifItemParser& aItem ); + virtual TInt GetDefaultNamespaceDefL( CStifItemParser& aItem ); + virtual TInt LoadSchemaL( CStifItemParser& aItem ); + virtual TInt EngineSessionL( CStifItemParser& aItem ); + virtual TInt GetSchemaVersionL( CStifItemParser& aItem ); + virtual TInt SetObjectToPresentByGuidL( CStifItemParser& aItem ); + + // Item / InstanceItem test primitives. + virtual TInt BelongsToSessionL( CStifItemParser& aItem ); + virtual TInt SessionL( CStifItemParser& aItem ); + virtual TInt InDatabaseL( CStifItemParser& aItem ); + virtual TInt AddItemsL( CStifItemParser& aItem ); + virtual TInt UpdateItemsL( CStifItemParser& aItem ); + + // Definition test primitives. + virtual TInt AddRelationDefL( CStifItemParser& aItem ); + virtual TInt AddEventDefL( CStifItemParser& aItem ); + virtual TInt PropertyDefCountL( CStifItemParser& aItem ); + virtual TInt PropertyDefL( CStifItemParser& aItem ); + virtual TInt GetPropertyDefL( CStifItemParser& aItem ); + virtual TInt MandatoryL( CStifItemParser& aItem ); + virtual TInt MinInt32ValueL( CStifItemParser& aItem ); + virtual TInt MaxInt32ValueL( CStifItemParser& aItem ); + virtual TInt MinUint32ValueL( CStifItemParser& aItem ); + virtual TInt MaxUint32ValueL( CStifItemParser& aItem ); + virtual TInt MinInt64ValueL( CStifItemParser& aItem ); + virtual TInt MaxInt64ValueL( CStifItemParser& aItem ); + virtual TInt MinRealValueL( CStifItemParser& aItem ); + virtual TInt MaxRealValueL( CStifItemParser& aItem ); + virtual TInt MinTimeValueL( CStifItemParser& aItem ); + virtual TInt MaxTimeValueL( CStifItemParser& aItem ); + virtual TInt MinTextLengthL( CStifItemParser& aItem ); + virtual TInt MaxTextLengthL( CStifItemParser& aItem ); + virtual TInt CompareL( CStifItemParser& aItem ); + virtual TInt ParentL( CStifItemParser& aItem ); + virtual TInt NameL( CStifItemParser& aItem ); + virtual TInt ReadOnlyL( CStifItemParser& aItem ); + virtual TInt DefL( CStifItemParser& aItem ); + + // Object test primitives. + virtual TInt SetDefL( CStifItemParser& aItem ); + virtual TInt UriL( CStifItemParser& aItem ); + virtual TInt SetUriL( CStifItemParser& aItem ); + virtual TInt ConfidentialL( CStifItemParser& aItem ); + virtual TInt SetConfidentialL( CStifItemParser& aItem ); + virtual TInt PlaceholderL( CStifItemParser& aItem ); + virtual TInt SetPlaceholderL( CStifItemParser& aItem ); + virtual TInt MediaIdL( CStifItemParser& aItem ); + virtual TInt SetMediaIdL( CStifItemParser& aItem ); + virtual TInt UsageCountL( CStifItemParser& aItem ); + virtual TInt GuidL( CStifItemParser& aItem ); + virtual TInt SetGuidL( CStifItemParser& aItem ); + virtual TInt OpenForModificationsL( CStifItemParser& aItem ); + virtual TInt NewObjectL( CStifItemParser& aItem ); + virtual TInt AddObjectL( CStifItemParser& aItem ); + virtual TInt AddObjectsL( CStifItemParser& aItem ); + virtual TInt GetObjectL( CStifItemParser& aItem ); + virtual TInt GetFullObjectL( CStifItemParser& aItem ); + virtual TInt CheckObjectL( CStifItemParser& aItem ); + virtual TInt RemoveObjectL( CStifItemParser& aItem ); + virtual TInt RemoveObjectsL( CStifItemParser& aItem ); + virtual TInt RemoveAllObjectsL( CStifItemParser& aItem ); + virtual TInt OpenObjectL( CStifItemParser& aItem ); + virtual TInt OpenFullObjectL( CStifItemParser& aItem ); + virtual TInt CommitObjectL( CStifItemParser& aItem ); + virtual TInt CommitObjectsL( CStifItemParser& aItem ); + virtual TInt CancelObjectL( CStifItemParser& aItem ); + + virtual TInt PropertyL( CStifItemParser& aItem ); + virtual TInt PropertyCountL( CStifItemParser& aItem ); + virtual TInt AddBoolPropertyL( CStifItemParser& aItem ); + virtual TInt AddInt8PropertyL( CStifItemParser& aItem ); + virtual TInt AddUint8PropertyL( CStifItemParser& aItem ); + virtual TInt AddInt16PropertyL( CStifItemParser& aItem ); + virtual TInt AddUint16PropertyL( CStifItemParser& aItem ); + virtual TInt AddInt32PropertyL( CStifItemParser& aItem ); + virtual TInt AddUint32PropertyL( CStifItemParser& aItem ); + virtual TInt AddInt64PropertyL( CStifItemParser& aItem ); + virtual TInt AddReal32PropertyL( CStifItemParser& aItem ); + virtual TInt AddReal64PropertyL( CStifItemParser& aItem ); + virtual TInt AddTextPropertyL( CStifItemParser& aItem ); + virtual TInt AddTimePropertyL( CStifItemParser& aItem ); + + // Property test primitives. + virtual TInt ObjectL( CStifItemParser& aItem ); + virtual TInt BoolValueL( CStifItemParser& aItem ); + virtual TInt Int8ValueL( CStifItemParser& aItem ); + virtual TInt Uint8ValueL( CStifItemParser& aItem ); + virtual TInt Int16ValueL( CStifItemParser& aItem ); + virtual TInt Uint16ValueL( CStifItemParser& aItem ); + virtual TInt Int32ValueL( CStifItemParser& aItem ); + virtual TInt Uint32ValueL( CStifItemParser& aItem ); + virtual TInt Int64ValueL( CStifItemParser& aItem ); + virtual TInt Real32ValueL( CStifItemParser& aItem ); + virtual TInt Real64ValueL( CStifItemParser& aItem ); + virtual TInt TimeValueL( CStifItemParser& aItem ); + virtual TInt TextValueL( CStifItemParser& aItem ); + virtual TInt SetBoolValueL( CStifItemParser& aItem ); + virtual TInt SetInt8ValueL( CStifItemParser& aItem ); + virtual TInt SetUint8ValueL( CStifItemParser& aItem ); + virtual TInt SetInt16ValueL( CStifItemParser& aItem ); + virtual TInt SetUint16ValueL( CStifItemParser& aItem ); + virtual TInt SetInt32ValueL( CStifItemParser& aItem ); + virtual TInt SetUint32ValueL( CStifItemParser& aItem ); + virtual TInt SetInt64ValueL( CStifItemParser& aItem ); + virtual TInt SetReal32ValueL( CStifItemParser& aItem ); + virtual TInt SetReal64ValueL( CStifItemParser& aItem ); + virtual TInt SetTimeValueL( CStifItemParser& aItem ); + virtual TInt SetTextValueL( CStifItemParser& aItem ); + virtual TInt RemovePropertyL( CStifItemParser& aItem ); + virtual TInt MovePropertiesL( CStifItemParser& aItem ); + + // Free text test primitives. + virtual TInt FreeTextCountL( CStifItemParser& aItem ); + virtual TInt FreeTextL( CStifItemParser& aItem ); + virtual TInt FreeTextIndexL( CStifItemParser& aItem ); + virtual TInt AddFreeTextL( CStifItemParser& aItem ); + virtual TInt RemoveFreeTextL( CStifItemParser& aItem ); + + // Relation test primitives. + virtual TInt NewRelationL( CStifItemParser& aItem ); + virtual TInt AddRelationL( CStifItemParser& aItem ); + virtual TInt LeftObjectIdL( CStifItemParser& aItem ); + virtual TInt RightObjectIdL( CStifItemParser& aItem ); + virtual TInt ParameterL( CStifItemParser& aItem ); + virtual TInt SetParameterL( CStifItemParser& aItem ); + virtual TInt SetLeftObjectIdL( CStifItemParser& aItem ); + virtual TInt SetRightObjectIdL( CStifItemParser& aItem ); + virtual TInt LastModifiedDateL( CStifItemParser& aItem ); + virtual TInt SetLastModifiedDateL( CStifItemParser& aItem ); + virtual TInt GetRelationL( CStifItemParser& aItem ); + virtual TInt UpdateRelationL( CStifItemParser& aItem ); + virtual TInt RemoveRelationL( CStifItemParser& aItem ); + virtual TInt RemoveRelationsL( CStifItemParser& aItem ); + + // Event test primitives. + virtual TInt NewEventL( CStifItemParser& aItem ); + virtual TInt AddEventL( CStifItemParser& aItem ); + virtual TInt ObjectIdL( CStifItemParser& aItem ); + virtual TInt TimeL( CStifItemParser& aItem ); + virtual TInt SourceL( CStifItemParser& aItem ); + virtual TInt ParticipantL( CStifItemParser& aItem ); + virtual TInt GetEventL( CStifItemParser& aItem ); + virtual TInt RemoveEventL( CStifItemParser& aItem ); + virtual TInt RemoveEventsL( CStifItemParser& aItem ); + //[TestMethods] - Do not remove + + // Metadata framework observer callback methods + void HandleObjectNotification( CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray ); + void HandleUriObjectNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray, + const RPointerArray& aObjectUriArray); + void HandleObjectPresentNotification(CMdESession& aSession, + TBool aPresent, const RArray& aObjectIdArray); + void HandleRelationNotification( CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aRelationIdArray ); + void HandleRelationItemNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aRelationArray); + void HandleRelationPresentNotification(CMdESession& aSession, + TBool aPresent, const RArray& aRelationIdArray); + void HandleEventNotification( CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aEventIdArray ); + void HandleSessionOpened( CMdESession& aSession, TInt aError ); + void HandleSessionError( CMdESession& aSession, TInt aError ); + void HandleSchemaModified(); + TInt QueryObjectL( CStifItemParser& aItem ); + TInt QueryRelationL( CStifItemParser& aItem ); + TInt QueryEventL( CStifItemParser& aItem ); + + TInt TestPopulateDbL( CStifItemParser& aItem ); + +private: + CMdEObjectDef& GetObjectDefStrL( CStifItemParser& aItem ); + CMdERelationDef& GetRelationDefStrL( CStifItemParser& aItem ); + static TQueryResultMode CMdETestScripter::ResultModeL(TDesC& aModeString); + static TObjectConditionCompareMethod CompareMethodL( TDesC& aMethodString ); + static TMdERangeType RangeTypeL( TDesC& aTypeString ); + + TInt GetObjectDefIndexL( CStifItemParser& aItem ); + TInt GetRelationDefIndexL( CStifItemParser& aItem ); + TInt GetEventDefIndexL( CStifItemParser& aItem ); + TInt GetPropertyDefIndexL( CStifItemParser& aItem ); + + TInt GetObjectIndexL( CStifItemParser& aItem ); + TInt GetEventIndexL( CStifItemParser& aItem ); + TInt GetRelationIndexL( CStifItemParser& aItem ); + TInt GetPropertyIndexL( CStifItemParser& aItem ); + + TInt GetLogicConditionIndexL( CStifItemParser& aItem ); + TInt GetRelationConditionIndexL( CStifItemParser& aItem ); + + void AppendNameL(CDesCArrayFlat* aNameArray, const TDesC& aName) + { + TInt pos; + TBuf<32> name(aName); + pos = name.Find(_L("ARRAY_INDEX")); + if ( pos != KErrNotFound ) + { + name.SetLength( pos ); + name.AppendNum( aNameArray->Count() ); + } + if ( aNameArray->Find( name, pos ) ) + { + aNameArray->AppendL( name ); + } + else + { // + iLog->Log( _L( "indentifier = %S already used" ), &name ); + User::Leave( KErrAlreadyExists ); + } + } + + +public: + + TInt NewObjectQueryL( CStifItemParser& aItem ); + TInt NewRelationQueryL( CStifItemParser& aItem ); + TInt NewEventQueryL( CStifItemParser& aItem ); + TInt AddPropertyFilterL( CStifItemParser& aItem ); + TInt AppendOrderRuleL( CStifItemParser& aItem ); + TInt NewLogicConditionL( CStifItemParser& aItem ); + TInt AddLogicConditionL( CStifItemParser& aItem ); + TInt AddObjectConditionL( CStifItemParser& aItem ); + TInt AddPropertyConditionL( CStifItemParser& aItem ); + TInt AddRelationConditionL( CStifItemParser& aItem ); + TInt AddEventConditionL( CStifItemParser& aItem ); + + TInt ObjectConditionsL( CStifItemParser& aItem ); + + TInt RightL( CStifItemParser& aItem ); + TInt LeftL( CStifItemParser& aItem ); + TInt SetOperatorL( CStifItemParser& aItem ); + TInt SetNegateL( CStifItemParser& aItem ); + + TInt FindL( CStifItemParser& aItem ); + + void HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ); + + void HandleQueryNewResults(CMdEQuery& aQuery, + TInt aFirstNewItemIndex, + TInt aNewItemCount); + TInt SetObjectQueryResultL( CStifItemParser& aItem ); + TInt SetEventQueryResultL( CStifItemParser& aItem ); + TInt SetRelationQueryResultL( CStifItemParser& aItem ); + + private: + // Data + TInt iError; + + RPointerArray iObjectDefArray; + RPointerArray iRelationDefArray; + RPointerArray iEventDefArray; + RPointerArray iPropertyDefArray; + RPointerArray iNamespaceDefArray; + + RPointerArray iObjectArray; + RPointerArray iRelationArray; + RPointerArray iEventArray; + RPointerArray iPropertyArray; + RPointerArray iLogicConditionArray; + RPointerArray iRelationConditionArray; + RPointerArray iObjectConditionArray; + RPointerArray iPropertyConditionArray; + RPointerArray iEventConditionArray; + + // Result data from callbacks. + TObserverNotificationType iNotificationType; + CMdESession* iNotificationSession; + RArray iNotificationRelationArray; + RArray iNotificationItemIdArray; + + CDesCArrayFlat *iObjectDefNameArray; + CDesCArrayFlat *iRelationDefNameArray; + CDesCArrayFlat *iEventDefNameArray; + CDesCArrayFlat *iPropertyDefNameArray; + CDesCArrayFlat *iNamespaceDefNameArray; + + CDesCArrayFlat *iObjectNameArray; + CDesCArrayFlat *iRelationNameArray; + CDesCArrayFlat *iEventNameArray; + + CDesCArrayFlat *iPropertyNameArray; + + CDesCArrayFlat *iRelationConditionNameArray; + CDesCArrayFlat *iObjectConditionNameArray; + CDesCArrayFlat *iEventConditionNameArray; + + CDesCArrayFlat *iLogicConditionNameArray; + CDesCArrayFlat *iPropertyConditionNameArray; + + RArray iResultIndices; + + CMdESession* iMdeSession; + CMdENamespaceDef* iDefaultNamespaceDef; + CMdEQuery *iQuery; + CMdELogicCondition *iQueryRoot; + TFileName iFilePath; + + CMdETestScripterAO* iAsyncHandler; + RMdEDataBuffer iMdEDataBuf; // Buffer for mde async request results + RPointerArray iItemArray; + TInt iItemCount; + }; + +#endif // MDETESTSCRIPTER_H + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/inc/MdETestScripterAO.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/inc/MdETestScripterAO.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,55 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#ifndef CMDETESTSCRIPTERAO_H +#define CMDETESTSCRIPTERAO_H + +#include +#include +#include + +class CMdETestScripter; + +NONSHARABLE_CLASS(CMdETestScripterAO) : public CActive + { +public: + + ~CMdETestScripterAO(); + + static CMdETestScripterAO* NewL(); + + static CMdETestScripterAO* NewLC(); + +public: + void Start( CMdETestScripter* aScripter, TEventIf aEvent ); + +private: + CMdETestScripterAO(); + + void ConstructL(); + +private: + void RunL(); + void DoCancel(); + TInt RunError(TInt aError); + +private: + CMdETestScripter* iScripter; + TEventIf iEvent; + }; + +#endif // CMDETESTSCRIPTERAO_H diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/init/MdETestScripter.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/init/MdETestScripter.ini Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,64 @@ +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT or HTML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 600000 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[New_Module] +ModuleName= TestScripter +TestCaseFile= c:\testframework\MdETestScripter.cfg +[End_Module] + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +CreateLogDirectories= YES # Possible values: YES or NO + +#EmulatorBasePath= C:\LOGS\TestFramework\ +#EmulatorFormat= HTML # Possible values: TXT or HTML +#EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +HardwareBasePath= C:\ +#HardwareFormat= HTML # Possible values: TXT or HTML +#HardwareOutput= FILE # Possible values: FILE or RDEBUG + +#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +#ThreadIdToLogFile= YES # Possible values: YES or NO +#WithTimeStamp= YES # Possible values: YES or NO +#WithLineBreak= YES # Possible values: YES or NO +#WithEventRanking= YES # Possible values: YES or NO + +#FileUnicode= YES # Possible values: YES or NO +#AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/src/MdETestScripter.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/src/MdETestScripter.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,160 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include +#include "MdETestScripter.h" +#include "MdETestScripterAO.h" + +// ============================= LOCAL FUNCTIONS =============================== + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CMdETestScripter::CMdETestScripter +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +CMdETestScripter::CMdETestScripter( CTestModuleIf& aTestModuleIf ): + CScriptBase( aTestModuleIf ) + { + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::ConstructL() + { + //Read logger settings to check whether test case name is to be + //appended to log file name. + RSettingServer settingServer; + TInt ret = settingServer.Connect(); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Struct to StifLogger settigs. + TLoggerSettings loggerSettings; + // Parse StifLogger defaults from STIF initialization file. + ret = settingServer.GetLoggerSettings(loggerSettings); + if(ret != KErrNone) + { + User::Leave(ret); + } + // Close Setting server session + settingServer.Close(); + + TFileName logFileName; + + if(loggerSettings.iAddTestCaseTitle) + { + TName title; + TestModuleIf().GetTestCaseTitleL(title); + logFileName.Format(KMdETestScripterLogFileWithTitle, &title); + } + else + { + logFileName.Copy(KMdETestScripterLogFile); + } + +#if ( defined (__WINS__) || defined (__WINSCW__) ) + iFilePath.Copy( PathInfo::PhoneMemoryRootPath().Left( KPathPrefixLength )); +#else + iFilePath.Copy( PathInfo::MemoryCardRootPath ().Left( KPathPrefixLength )); +#endif + iFilePath.Append( KMdETestDataPath ); + iFilePath.ZeroTerminate(); + + iLog = CStifLogger::NewL( KMdETestScripterLogPath, + logFileName, + CStifLogger::ETxt, + CStifLogger::EFile, + EFalse ); + iObjectDefNameArray = new (ELeave )CDesCArrayFlat( 8 ); + iRelationDefNameArray = new (ELeave )CDesCArrayFlat( 8 ); + iEventDefNameArray = new (ELeave )CDesCArrayFlat( 8 ); + iPropertyDefNameArray = new (ELeave )CDesCArrayFlat( 8 ); + iNamespaceDefNameArray = new (ELeave )CDesCArrayFlat( 8 ); + + iObjectNameArray = new (ELeave )CDesCArrayFlat( 8 ); + iRelationNameArray = new (ELeave )CDesCArrayFlat( 8 ); + iEventNameArray = new (ELeave )CDesCArrayFlat( 8 ); + + iPropertyNameArray = new (ELeave )CDesCArrayFlat( 8 ); + + iRelationConditionNameArray = new (ELeave )CDesCArrayFlat( 8 ); + iObjectConditionNameArray = new (ELeave )CDesCArrayFlat( 8 ); + iEventConditionNameArray = new (ELeave )CDesCArrayFlat( 8 ); + + iPropertyConditionNameArray = new (ELeave )CDesCArrayFlat( 8 ); + iLogicConditionNameArray = new (ELeave )CDesCArrayFlat( 8 ); + + iMdeSession = CMdESession::NewL( *this ); + iAsyncHandler = CMdETestScripterAO::NewL(); + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +CMdETestScripter* CMdETestScripter::NewL( + CTestModuleIf& aTestModuleIf ) + { + CMdETestScripter* self = new (ELeave) CMdETestScripter( aTestModuleIf ); + + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop(); + + return self; + } + +// ----------------------------------------------------------------------------- +// ~CMdETestScripter() +// Destructor. +// ----------------------------------------------------------------------------- +// +CMdETestScripter::~CMdETestScripter() + { + // Delete resources allocated from test methods + Delete(); + + // Delete logger + delete iLog; + } + +// ========================== OTHER EXPORTED FUNCTIONS ========================= + +// ----------------------------------------------------------------------------- +// LibEntryL is a polymorphic Dll entry point. +// Returns: CScriptBase: New CScriptBase derived object +// ----------------------------------------------------------------------------- +// +EXPORT_C CScriptBase* LibEntryL( + CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework + { + return ( CScriptBase* ) CMdETestScripter::NewL( aTestModuleIf ); + } + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/src/MdETestScripterAO.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/src/MdETestScripterAO.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "MdETestScripterAO.h" +#include "MdETestScripter.h" +#include + +CMdETestScripterAO::CMdETestScripterAO() : CActive( EPriorityStandard ) + { + } + +CMdETestScripterAO* CMdETestScripterAO::NewLC() + { + CMdETestScripterAO* self = new (ELeave) CMdETestScripterAO(); + CleanupStack::PushL( self ); + self->ConstructL(); + return self; + } + +CMdETestScripterAO* CMdETestScripterAO::NewL() + { + CMdETestScripterAO* self = CMdETestScripterAO::NewLC(); + CleanupStack::Pop(); + return self; + } + +void CMdETestScripterAO::ConstructL() + { + CActiveScheduler::Add( this ); + } + +CMdETestScripterAO::~CMdETestScripterAO() + { + Cancel(); + } + +void CMdETestScripterAO::Start( CMdETestScripter* aScripter, TEventIf aEvent ) + { + Cancel(); + iScripter = aScripter; + iEvent = aEvent; + SetActive(); + } + +void CMdETestScripterAO::RunL() + { + iScripter->CheckAsyncResultArrayL( iEvent ); + iScripter->TestModuleIf().Event( iEvent ); + } + +void CMdETestScripterAO::DoCancel() + { + } + +TInt CMdETestScripterAO::RunError(TInt aError) + { + return aError; + } diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/src/MdETestScripterBlocks.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/src/MdETestScripterBlocks.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,880 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include +#include +#include +#include +#include "MdETestScripter.h" +#include "MdETestScripterAO.h" + +// ============================= LOCAL FUNCTIONS =============================== + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// CMdETestScripter::Delete +// Delete here all resources allocated and opened from test methods. +// Called from destructor. +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::Delete() + { + iObjectDefArray.Reset(); + iRelationDefArray.Reset(); + iEventDefArray.Reset(); + + iLogicConditionArray.Reset(); + iRelationConditionArray.Reset(); + iNotificationRelationArray.Reset(); + + RArray objectIds; + RArray resultObjectIds; + RArray eventIds; + RArray resultEventIds; + RArray relationIds; + RArray resultRelationIds; + + TInt count = iObjectArray.Count(); + for (TInt i = 0; i < count; i++) + { + objectIds.Append(iObjectArray[i]->Id()); + } + + count = iEventArray.Count(); + for (TInt i = 0; i < count; i++) + { + eventIds.Append(iEventArray[i]->Id()); + } + + count = iRelationArray.Count(); + for (TInt i = 0; i < count; i++) + { + relationIds.Append(iRelationArray[i]->Id()); + } + + if (objectIds.Count()) + { + TRAP_IGNORE( iMdeSession->RemoveObjectsL( objectIds, resultObjectIds) ); + } + + iObjectArray.ResetAndDestroy(); + + if (eventIds.Count()) + { + TRAP_IGNORE( iMdeSession->RemoveEventsL( eventIds, resultEventIds) ); + } + iEventArray.ResetAndDestroy(); + + if (relationIds.Count()) + { + TRAP_IGNORE( iMdeSession->RemoveRelationsL( relationIds, resultRelationIds) ); + } + iRelationArray.ResetAndDestroy(); + + TInt allRemoved = ETrue; + count = iObjectArray.Count(); + for (TInt i = 0; i < count; i++) + { + if (resultObjectIds[i] == KNoId) + { + allRemoved = EFalse; + break; + } + } + if (!allRemoved) + { + iLog->Log(_L( "All objects not removed from DB!!")); + } + + allRemoved = ETrue; + count = iEventArray.Count(); + for (TInt i = 0; i < count; i++) + { + if (resultEventIds[i] == KNoId) + { + allRemoved = EFalse; + break; + } + } + if (!allRemoved) + { + iLog->Log(_L( "All events not removed from DB!!")); + } + iEventArray.ResetAndDestroy(); + + allRemoved = ETrue; + count = iRelationArray.Count(); + for (TInt i = 0; i < count; i++) + { + if (resultRelationIds[i] == KNoId) + { + allRemoved = EFalse; + break; + } + } + if (!allRemoved) + { + iLog->Log(_L( "All relations not removed from DB!!")); + } + + objectIds.Close(); + resultObjectIds.Close(); + eventIds.Close(); + resultEventIds.Close(); + relationIds.Close(); + resultRelationIds.Close(); + + iPropertyDefArray.Reset(); + + delete iObjectDefNameArray; + delete iRelationDefNameArray; + delete iEventDefNameArray; + delete iPropertyDefNameArray; + delete iNamespaceDefNameArray; + + delete iObjectNameArray; + delete iRelationNameArray; + delete iEventNameArray; + + delete iPropertyNameArray; + + delete iLogicConditionNameArray; + delete iRelationConditionNameArray; + delete iObjectConditionNameArray; + + delete iPropertyConditionNameArray; + delete iEventConditionNameArray; + + delete iQuery; + delete iMdeSession; + iMdeSession = NULL; + delete iAsyncHandler; + iAsyncHandler = NULL; + iMdEDataBuf.Close(); + iItemArray.Close();//Do not need call destroy because it does not own its pointers + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RunMethodL +// Run specified method. Contains also table of test mothods and their names. +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RunMethodL( CStifItemParser& aItem ) + { + static TStifFunctionInfo const KFunctions[] = + { + // Observer add/remove methods + ENTRY( "AddSchemaObserverL", CMdETestScripter::AddSchemaObserverL ), + ENTRY( "RemoveSchemaObserverL", CMdETestScripter::RemoveSchemaObserverL ), + ENTRY( "AddObjectObserverL", CMdETestScripter::AddObjectObserverL ), + ENTRY( "RemoveObjectObserverL", CMdETestScripter::RemoveObjectObserverL ), + ENTRY( "AddObjectObserverWithUriL", CMdETestScripter::AddObjectObserverWithUriL ), + ENTRY( "RemoveObjectObserverWithUriL", CMdETestScripter::RemoveObjectObserverWithUriL ), + ENTRY( "AddObjectPresentObserverL", CMdETestScripter::AddObjectPresentObserverL ), + ENTRY( "RemoveObjectPresentObserverL", CMdETestScripter::RemoveObjectPresentObserverL ), + ENTRY( "AddRelationObserverL", CMdETestScripter::AddRelationObserverL ), + ENTRY( "RemoveRelationObserverL", CMdETestScripter::RemoveRelationObserverL ), + ENTRY( "AddRelationItemObserverL", CMdETestScripter::AddRelationItemObserverL ), + ENTRY( "RemoveRelationItemObserverL", CMdETestScripter::RemoveRelationItemObserverL ), + ENTRY( "AddRelationPresentObserverL", CMdETestScripter::AddRelationPresentObserverL ), + ENTRY( "RemoveRelationPresentObserverL", CMdETestScripter::RemoveRelationPresentObserverL ), + ENTRY( "AddEventObserverL", CMdETestScripter::AddEventObserverL ), + ENTRY( "RemoveEventObserverL", CMdETestScripter::RemoveEventObserverL ), + + // Notification resulated test primitives + ENTRY( "VerifyTItemIdsL", CMdETestScripter::VerifyTItemIdsL ), + ENTRY( "VerifyMdERelationsL", CMdETestScripter::VerifyMdERelationsL ), + ENTRY( "VerifyObserverNotificationTypeL", CMdETestScripter::VerifyObserverNotificationTypeL ), + + // Metadata/schema/namespace test primitives. + ENTRY( "ObjectDefCountL", CMdETestScripter::ObjectDefCountL ), + ENTRY( "ObjectDefL", CMdETestScripter::ObjectDefL ), + ENTRY( "GetObjectDefL", CMdETestScripter::GetObjectDefL ), + ENTRY( "RelationDefCountL", CMdETestScripter::RelationDefCountL ), + ENTRY( "RelationDefL", CMdETestScripter::RelationDefL ), + ENTRY( "GetRelationDefL", CMdETestScripter::GetRelationDefL ), + ENTRY( "EventDefCountL", CMdETestScripter::EventDefCountL ), + ENTRY( "EventDefL", CMdETestScripter::EventDefL ), + ENTRY( "GetEventDefL", CMdETestScripter::GetEventDefL ), + + ENTRY( "ExportMetadataL", CMdETestScripter::ExportMetadataL ), + ENTRY( "ImportMetadataL", CMdETestScripter::ImportMetadataL ), + ENTRY( "ImportSchemaL", CMdETestScripter::ImportSchemaL ), + ENTRY( "NamespaceDefCountL", CMdETestScripter::NamespaceDefCountL ), + ENTRY( "NamespaceDefL", CMdETestScripter::NamespaceDefL ), + ENTRY( "GetNamespaceDefL", CMdETestScripter::GetNamespaceDefL ), + ENTRY( "GetDefaultNamespaceDefL", CMdETestScripter::GetDefaultNamespaceDefL ), + ENTRY( "ResetNamespaceDefArray", CMdETestScripter::ResetNamespaceDefArray ), + ENTRY( "LoadSchemaL", CMdETestScripter::LoadSchemaL ), + ENTRY( "EngineSessionL", CMdETestScripter::EngineSessionL ), + ENTRY( "GetSchemaVersionL", CMdETestScripter::GetSchemaVersionL ), + ENTRY( "SetObjectToPresentByGuidL", CMdETestScripter::SetObjectToPresentByGuidL ), + + // Item / InstanceItem test primitives. + ENTRY( "BelongsToSessionL", CMdETestScripter::BelongsToSessionL ), + ENTRY( "SessionL", CMdETestScripter::SessionL ), + ENTRY( "InDatabaseL", CMdETestScripter::InDatabaseL ), + ENTRY( "AddItemsL", CMdETestScripter::AddItemsL ), + ENTRY( "UpdateItemsL", CMdETestScripter::UpdateItemsL ), + + // Definition test primitives. + ENTRY( "AddRelationDefL", CMdETestScripter::AddRelationDefL ), + ENTRY( "AddEventDefL", CMdETestScripter::AddEventDefL ), + ENTRY( "PropertyDefCountL", CMdETestScripter::PropertyDefCountL ), + ENTRY( "PropertyDefL", CMdETestScripter::PropertyDefL ), + ENTRY( "GetPropertyDefL", CMdETestScripter::GetPropertyDefL ), + ENTRY( "MandatoryL", CMdETestScripter::MandatoryL ), + ENTRY( "MinInt32ValueL", CMdETestScripter::MinInt32ValueL ), + ENTRY( "MaxInt32ValueL", CMdETestScripter::MaxInt32ValueL ), + ENTRY( "MinUint32ValueL", CMdETestScripter::MinUint32ValueL ), + ENTRY( "MaxUint32ValueL", CMdETestScripter::MaxUint32ValueL ), + ENTRY( "MinInt64ValueL", CMdETestScripter::MinInt64ValueL ), + ENTRY( "MaxInt64ValueL", CMdETestScripter::MaxInt64ValueL ), + ENTRY( "MinRealValueL", CMdETestScripter::MinRealValueL ), + ENTRY( "MaxRealValueL", CMdETestScripter::MaxRealValueL ), + ENTRY( "MinTimeValueL", CMdETestScripter::MinTimeValueL ), + ENTRY( "MaxTimeValueL", CMdETestScripter::MaxTimeValueL ), + ENTRY( "MinTextLengthL", CMdETestScripter::MinTextLengthL ), + ENTRY( "MaxTextLengthL", CMdETestScripter::MaxTextLengthL ), + ENTRY( "CompareL", CMdETestScripter::CompareL ), + ENTRY( "ParentL", CMdETestScripter::ParentL ), + ENTRY( "NameL", CMdETestScripter::NameL ), + ENTRY( "ReadOnlyL", CMdETestScripter::ReadOnlyL ), + ENTRY( "DefL", CMdETestScripter::DefL ), + + // Object test primitives. + ENTRY( "SetDefL", CMdETestScripter::SetDefL ), + ENTRY( "UriL", CMdETestScripter::UriL ), + ENTRY( "SetUriL", CMdETestScripter::SetUriL ), + ENTRY( "ConfidentialL", CMdETestScripter::ConfidentialL ), + ENTRY( "SetConfidentialL", CMdETestScripter::SetConfidentialL ), + ENTRY( "PlaceholderL", CMdETestScripter::PlaceholderL ), + ENTRY( "SetPlaceholderL", CMdETestScripter::SetPlaceholderL ), + ENTRY( "MediaIdL", CMdETestScripter::MediaIdL ), + ENTRY( "SetMediaIdL", CMdETestScripter::SetMediaIdL ), + ENTRY( "UsageCountL", CMdETestScripter::UsageCountL ), + ENTRY( "GuidL", CMdETestScripter::GuidL ), + ENTRY( "SetGuidL", CMdETestScripter::SetGuidL ), + ENTRY( "OpenForModificationsL", CMdETestScripter::OpenForModificationsL ), + ENTRY( "NewObjectL", CMdETestScripter::NewObjectL ), + ENTRY( "AddObjectL", CMdETestScripter::AddObjectL ), + ENTRY( "AddObjectsL", CMdETestScripter::AddObjectsL ), + ENTRY( "GetObjectL", CMdETestScripter::GetObjectL ), + ENTRY( "GetFullObjectL", CMdETestScripter::GetFullObjectL ), + ENTRY( "CheckObjectL", CMdETestScripter::CheckObjectL ), + ENTRY( "RemoveObjectL", CMdETestScripter::RemoveObjectL ), + ENTRY( "RemoveObjectsL", CMdETestScripter::RemoveObjectsL ), + ENTRY( "RemoveAllObjectsL", CMdETestScripter::RemoveAllObjectsL ), + ENTRY( "OpenObjectL", CMdETestScripter::OpenObjectL ), + ENTRY( "OpenFullObjectL", CMdETestScripter::OpenFullObjectL ), + ENTRY( "CommitObjectL", CMdETestScripter::CommitObjectL ), + ENTRY( "CommitObjectsL", CMdETestScripter::CommitObjectsL ), + ENTRY( "CancelObjectL", CMdETestScripter::CancelObjectL ), + + ENTRY( "PropertyL", CMdETestScripter::PropertyL ), + ENTRY( "PropertyCountL", CMdETestScripter::PropertyCountL ), + ENTRY( "AddBoolPropertyL", CMdETestScripter::AddBoolPropertyL ), + ENTRY( "AddInt8PropertyL", CMdETestScripter::AddInt8PropertyL ), + ENTRY( "AddUint8PropertyL", CMdETestScripter::AddUint8PropertyL ), + ENTRY( "AddInt16PropertyL", CMdETestScripter::AddInt16PropertyL ), + ENTRY( "AddUint16PropertyL", CMdETestScripter::AddUint16PropertyL ), + ENTRY( "AddInt32PropertyL", CMdETestScripter::AddInt32PropertyL ), + ENTRY( "AddUint32PropertyL", CMdETestScripter::AddUint32PropertyL ), + ENTRY( "AddInt64PropertyL", CMdETestScripter::AddInt64PropertyL ), + ENTRY( "AddReal32PropertyL", CMdETestScripter::AddReal32PropertyL ), + ENTRY( "AddReal64PropertyL", CMdETestScripter::AddReal64PropertyL ), + ENTRY( "AddTextPropertyL", CMdETestScripter::AddTextPropertyL ), + ENTRY( "AddTimePropertyL", CMdETestScripter::AddTimePropertyL ), + + // Property test primitives. + ENTRY( "ObjectL", CMdETestScripter::ObjectL ), + ENTRY( "BoolValueL", CMdETestScripter::BoolValueL ), + ENTRY( "Int8ValueL", CMdETestScripter::Int8ValueL ), + ENTRY( "Uint8ValueL", CMdETestScripter::Uint8ValueL ), + ENTRY( "Int16ValueL", CMdETestScripter::Int16ValueL ), + ENTRY( "Uint16ValueL", CMdETestScripter::Uint16ValueL ), + ENTRY( "Int32ValueL", CMdETestScripter::Int32ValueL ), + ENTRY( "Uint32ValueL", CMdETestScripter::Uint32ValueL ), + ENTRY( "Int64ValueL", CMdETestScripter::Int64ValueL ), + ENTRY( "Real32ValueL", CMdETestScripter::Real32ValueL ), + ENTRY( "Real64ValueL", CMdETestScripter::Real64ValueL ), + ENTRY( "TimeValueL", CMdETestScripter::TimeValueL ), + ENTRY( "TextValueL", CMdETestScripter::TextValueL ), + ENTRY( "SetBoolValueL", CMdETestScripter::SetBoolValueL ), + ENTRY( "SetInt8ValueL", CMdETestScripter::SetInt8ValueL ), + ENTRY( "SetUint8ValueL", CMdETestScripter::SetUint8ValueL ), + ENTRY( "SetInt16ValueL", CMdETestScripter::SetInt16ValueL ), + ENTRY( "SetUint16ValueL", CMdETestScripter::SetUint16ValueL ), + ENTRY( "SetInt32ValueL", CMdETestScripter::SetInt32ValueL ), + ENTRY( "SetUint32ValueL", CMdETestScripter::SetUint32ValueL ), + ENTRY( "SetInt64ValueL", CMdETestScripter::SetInt64ValueL ), + ENTRY( "SetReal32ValueL", CMdETestScripter::SetReal32ValueL ), + ENTRY( "SetReal64ValueL", CMdETestScripter::SetReal64ValueL ), + ENTRY( "SetTimeValueL", CMdETestScripter::SetTimeValueL ), + ENTRY( "SetTextValueL", CMdETestScripter::SetTextValueL ), + ENTRY( "RemovePropertyL", CMdETestScripter::RemovePropertyL ), + ENTRY( "MovePropertiesL", CMdETestScripter::MovePropertiesL ), + + // Free text test primitives. + ENTRY( "FreeTextCountL", CMdETestScripter::FreeTextCountL ), + ENTRY( "FreeTextL", CMdETestScripter::FreeTextL ), + ENTRY( "FreeTextIndexL", CMdETestScripter::FreeTextIndexL ), + ENTRY( "AddFreeTextL", CMdETestScripter::AddFreeTextL ), + ENTRY( "RemoveFreeTextL", CMdETestScripter::RemoveFreeTextL ), + + // Relation test primitives. + ENTRY( "NewRelationL", CMdETestScripter::NewRelationL ), + ENTRY( "AddRelationL", CMdETestScripter::AddRelationL ), + ENTRY( "LeftObjectIdL", CMdETestScripter::LeftObjectIdL ), + ENTRY( "RightObjectIdL", CMdETestScripter::RightObjectIdL ), + ENTRY( "ParameterL", CMdETestScripter::ParameterL ), + ENTRY( "SetParameterL", CMdETestScripter::SetParameterL ), + ENTRY( "SetLeftObjectIdL", CMdETestScripter::SetLeftObjectIdL ), + ENTRY( "SetRightObjectIdL", CMdETestScripter::SetRightObjectIdL ), + ENTRY( "LastModifiedDateL", CMdETestScripter::LastModifiedDateL ), + ENTRY( "SetLastModifiedDateL", CMdETestScripter::SetLastModifiedDateL ), + ENTRY( "GetRelationL", CMdETestScripter::GetRelationL ), + ENTRY( "UpdateRelationL", CMdETestScripter::UpdateRelationL ), + ENTRY( "RemoveRelationL", CMdETestScripter::RemoveRelationL ), + ENTRY( "RemoveRelationsL", CMdETestScripter::RemoveRelationsL ), + + // Event test primitives. + ENTRY( "NewEventL", CMdETestScripter::NewEventL ), + ENTRY( "AddEventL", CMdETestScripter::AddEventL ), + ENTRY( "ObjectIdL", CMdETestScripter::ObjectIdL ), + ENTRY( "TimeL", CMdETestScripter::TimeL ), + ENTRY( "SourceL", CMdETestScripter::SourceL ), + ENTRY( "ParticipantL", CMdETestScripter::ParticipantL ), + ENTRY( "GetEventL", CMdETestScripter::GetEventL ), + ENTRY( "RemoveEventL", CMdETestScripter::RemoveEventL ), + ENTRY( "RemoveEventsL", CMdETestScripter::RemoveEventsL ), + ENTRY( "NewObjectQueryL", CMdETestScripter::NewObjectQueryL ), + ENTRY( "NewRelationQueryL", CMdETestScripter::NewRelationQueryL ), + ENTRY( "NewEventQueryL", CMdETestScripter::NewEventQueryL ), + + ENTRY( "QueryObjectL", CMdETestScripter::QueryObjectL ), + ENTRY( "QueryRelationL", CMdETestScripter::QueryRelationL ), + ENTRY( "QueryEventL", CMdETestScripter::QueryEventL ), + ENTRY( "AddPropertyFilterL", CMdETestScripter::AddPropertyFilterL ), + ENTRY( "AppendOrderRuleL", CMdETestScripter::AppendOrderRuleL ), + ENTRY( "NewLogicConditionL", CMdETestScripter::NewLogicConditionL ), + ENTRY( "AddLogicConditionL", CMdETestScripter::AddLogicConditionL ), + ENTRY( "AddObjectConditionL", CMdETestScripter::AddObjectConditionL ), + ENTRY( "AddPropertyConditionL", CMdETestScripter::AddPropertyConditionL ), + ENTRY( "AddRelationConditionL", CMdETestScripter::AddRelationConditionL ), + ENTRY( "AddEventConditionL", CMdETestScripter::AddEventConditionL ), + ENTRY( "FindL", CMdETestScripter::FindL ), + ENTRY( "SetObjectQueryResultL", CMdETestScripter::SetObjectQueryResultL ), + ENTRY( "SetEventQueryResultL", CMdETestScripter::SetEventQueryResultL ), + ENTRY( "SetRelationQueryResultL", CMdETestScripter::SetRelationQueryResultL ), + ENTRY( "RightL", CMdETestScripter::RightL ), + ENTRY( "LeftL", CMdETestScripter::LeftL ), + ENTRY( "SetOperatorL", CMdETestScripter::SetOperatorL ), + ENTRY( "SetNegateL", CMdETestScripter::SetNegateL ), + ENTRY( "ObjectConditionsL", CMdETestScripter::ObjectConditionsL ), + ENTRY( "TestPopulateDbL", CMdETestScripter::TestPopulateDbL ) + + // [test cases entries] - Do not remove + }; + + const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); + + return RunInternalL( KFunctions, count, aItem ); + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTestScripter::HandleObjectNotification +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::HandleObjectNotification( CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray ) + { + iLog->Log(_L( "HandleObjectNotification" )); + + iNotificationSession = &aSession; + iNotificationType = aType; + for ( TInt i = 0; i < aObjectIdArray.Count(); ++i ) + { + iNotificationItemIdArray.Append( aObjectIdArray[ i ] ); + } + + Signal(); + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTestScripter::HandleUriObjectNotification +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::HandleUriObjectNotification( CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray, + const RPointerArray& /* aObjectUriArray */ ) + { + iLog->Log(_L( "HandleUriObjectNotification" )); + + iNotificationSession = &aSession; + iNotificationType = aType; + for ( TInt i = 0; i < aObjectIdArray.Count(); ++i ) + { + iNotificationItemIdArray.Append( aObjectIdArray[ i ] ); + } + + Signal(); + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTestScripter::HandleObjectPresentNotification +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::HandleObjectPresentNotification( CMdESession& /* aSession */, + TBool /* aPresent */, const RArray& /* aObjectIdArray */ ) + { + + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTestScripter::HandleSessionOpened +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::HandleSessionOpened( CMdESession& /* aSession */, TInt aError ) + { + iLog->Log(_L( "HandleSessionOpened, aError == %d"), aError ); + + Signal(); + + iError = aError; + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTestScripter::HandleSessionError +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) + { + iLog->Log(_L( "HandleSessionError, aError == %d"), aError ); + + iError = aError; + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTestScripter::HandleSchemaModified +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::HandleSchemaModified() + { + iLog->Log(_L( "HandleSchemaModified" )); + + TEventIf event( TEventIf::ESetEvent, TName( KMdESchemaModified ) ); + TestModuleIf().Event( event ); + + Signal();// This can be removed after modify all related cases. + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTestScripter::HandleRelationNotification +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::HandleRelationNotification( CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aRelationIdArray ) + { + iLog->Log(_L( "HandleRelationNotification" )); + + iNotificationSession = &aSession; + iNotificationType = aType; + for ( TInt i = 0; i < aRelationIdArray.Count(); ++i ) + { + iNotificationItemIdArray.Append( aRelationIdArray[ i ] ); + } + + Signal(); + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTestScripter::HandleRelationItemNotification +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::HandleRelationItemNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aRelationArray ) + { + iLog->Log(_L( "HandleRelationItemNotification" )); + + iNotificationSession = &aSession; + iNotificationType = aType; + for ( TInt i = 0; i < aRelationArray.Count(); ++i ) + { + iNotificationRelationArray.Append( aRelationArray[ i ] ); + } + + Signal(); + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTestScripter::HandleRelationPresentNotification +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::HandleRelationPresentNotification(CMdESession& /* aSession */, + TBool /* aPresent */, + const RArray& /* aRelationIdArray */ ) + { + + } + +// ----------------------------------------------------------------------------- +// CHarvesterPluginTestScripter::HandleEventNotification +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::HandleEventNotification( CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aEventIdArray ) + { + iLog->Log(_L( "HandleEventNotification" )); + + iNotificationSession = &aSession; + iNotificationType = aType; + for ( TInt i = 0; i < aEventIdArray.Count(); ++i ) + { + iNotificationItemIdArray.Append( aEventIdArray[ i ] ); + } + + Signal(); + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::GetInstanceItemByArrayIndexL +// ----------------------------------------------------------------------------- +// +CMdEInstanceItem* CMdETestScripter::GetInstanceItemByArrayIndexL( + const TInt aMode, CStifItemParser& aItem ) + { + CMdEInstanceItem* ret = NULL; + + if ( aMode == EObject ) + { + ret = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + TL( ret->InstanceType() == EMdETypeObject ) + } + else if ( aMode == ERelation ) + { + ret = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + TL( ret->InstanceType() == EMdETypeRelation ) + } + else if ( aMode == EEvent ) + { + ret = SanitizeArrayIndexL( iEventArray, *iEventNameArray, aItem ); + TL( ret->InstanceType() == EMdETypeEvent ) + } + else if ( aMode == EProperty ) + { + ret = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + TL( ret->InstanceType() == EMdETypeProperty ) + } + else + { + User::Leave( KErrArgument ); + } + + return ret; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::CheckTMdEObjectL +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::CheckTMdEObjectL( const TMdEObject& aTObject, const CMdEObject& aObject ) + { + TL( aObject.Id() == aTObject.Id()); + TL( aObject.Def().Compare( aTObject.DefL()) == 0 ); + TL( aObject.Confidential() == aTObject.Confidential()); + TL( aObject.Placeholder() == aTObject.Placeholder()); + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::CheckTMdERelationL +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::CheckTMdERelationL( const TMdERelation& aTRelation, const CMdERelation& aRelation ) + { + TL( aRelation.Id() == aTRelation.Id()); + TL( aRelation.Def().Compare( aTRelation.DefL()) == 0 ); + TL( aRelation.LeftObjectId() == aTRelation.LeftObjectId()) + TL( aRelation.RightObjectId() == aTRelation.RightObjectId()) + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::CheckTMdEObjectArrayL +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::CheckTMdEObjectArrayL( + const RArray& aTObjects, const TInt aIndex, const TInt aCount ) + { + TL( aTObjects.Count() == aCount ); + + for ( TInt i = 0; i < aTObjects.Count(); ++i ) + { + const CMdEObject* object = NULL; + TInt j; + + for ( j = 0; aIndex + j < iObjectArray.Count(); ++j ) + { + if ( iObjectArray[ aIndex + j ]->Id() == aTObjects[ i ].Id()) + { + object = iObjectArray[ aIndex + j ]; + + CheckTMdEObjectL( aTObjects[ i ], *object ); + break; + } + } + TL( object ); + } + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::CheckTMdERelationArrayL +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::CheckTMdERelationArrayL( + const RArray& aTRelations, const TInt aIndex, const TInt aCount ) + { + TL( aTRelations.Count() == aCount ); + + for ( TInt i = 0; i < aTRelations.Count(); ++i ) + { + const CMdERelation* relation = NULL; + TInt j; + + for ( j = 0; aIndex + j < iRelationArray.Count(); ++j ) + { + if ( iRelationArray[ aIndex + j ]->Id() == aTRelations[ i ].Id()) + { + relation = iRelationArray[ aIndex + j ]; + + CheckTMdERelationL( aTRelations[ i ], *relation ); + break; + } + } + TL( relation ); + } + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::CheckTItemIdArrayL +// ----------------------------------------------------------------------------- +// +template void CMdETestScripter::CheckTItemIdArrayL( + const RArray& aTItemIds, const RPointerArray& aArray, + const TInt aIndex, const TInt aCount ) + { + TL( aTItemIds.Count() == aCount ); + + for ( TInt i = 0; i < aTItemIds.Count(); ++i ) + { + const T* t = NULL; + TInt j; + + for ( j = 0; aIndex + j < aArray.Count(); ++j ) + { + if ( aArray[ aIndex + j ]->Id() == aTItemIds[ i ] ) + { + t = aArray[ aIndex + j ]; + + break; + } + } + TL( t ); + } + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::CheckAsyncResultArrayL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::CheckAsyncResultArrayL( TEventIf aEvent ) + { + TInt err = KErrNone; + if ( 0 == aEvent.Name().Compare( KMdEItemsAsyncAdd ) + || 0 == aEvent.Name().Compare( KMdEItemsAsyncUpdate ) ) + { + //Check result item ids count of iMdEDataBuf + //Update ids of iItemArray( iObjectArray, iRelationArray, iEventsArray ) to clear temp test data in delete() later. + err = iMdeSession->DeserializeItemsL( iMdEDataBuf, iItemArray ); + } + else if ( 0 == aEvent.Name().Compare( KMdEObjectsAsyncRemoved ) + || 0 == aEvent.Name().Compare( KMdEEventsAsyncRemoved ) + || 0 == aEvent.Name().Compare( KMdERelationsAsyncRemoved ) ) + { + RArray objectIds, eventIds, relationIds; + err = iMdeSession->DeserializeIdsL( iMdEDataBuf, &objectIds, &eventIds, &relationIds ); + + //Check result item ids count of iMdEDataBuf + if ( 0 == aEvent.Name().Compare( KMdEObjectsAsyncRemoved ) ) + { + TL( objectIds.Count() == iItemCount ); + } + else if ( 0 == aEvent.Name().Compare( KMdEEventsAsyncRemoved ) ) + { + TL( eventIds.Count() == iItemCount ); + } + else if ( 0 == aEvent.Name().Compare( KMdERelationsAsyncRemoved ) ) + { + TL( relationIds.Count() == iItemCount ); + } + objectIds.Close(); + eventIds.Close(); + relationIds.Close(); + } + iItemCount = 0; + iItemArray.Reset(); + iMdEDataBuf.Close();//Clean mde buffer + return err; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::FormInstanceItemArrayL +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::FormInstanceItemArrayL( + CStifItemParser& aItem, RPointerArray& aItemArray ) const + { + TInt mode2; + TInt index; + TInt count; + + User::LeaveIfError( aItem.GetNextInt( mode2 )); + User::LeaveIfError( aItem.GetNextInt( index )); + User::LeaveIfError( aItem.GetNextInt( count )); + + for ( TInt i = 0; i < count; ++i ) + { + if ( mode2 == EObject ) + { + aItemArray.Append( iObjectArray[ index + i ] ); + } + else if ( mode2 == ERelation ) + { + aItemArray.Append( iRelationArray[ index + i ] ); + } + else if ( mode2 == EEvent ) + { + aItemArray.Append( iEventArray[ index + i ] ); + } + else if ( mode2 == EProperty ) + { + aItemArray.Append( iPropertyArray[ index + i ] ); + } + } + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SanitizeArrayIndexL +// ----------------------------------------------------------------------------- +// +template T* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, + CStifItemParser& aItem ) + { + __ASSERT_ALWAYS( aArray.Count() == aNameArray.Count(), + User::Panic( KMdETestScripter, KErrGeneral )); + + TPtrC nameOrIndex; + User::LeaveIfError( aItem.GetNextString( nameOrIndex )); + TLex lex( nameOrIndex ); + TInt index; + TInt err = lex.Val( index ); + if ( err == KErrGeneral ) + { // string is name identifier + for ( TInt nameIndex = 0; nameIndex < aNameArray.Count(); nameIndex++) + { + if ( nameOrIndex.Compare( aNameArray[ nameIndex ] ) == 0 ) + { + return aArray[ nameIndex ]; + } + } + User::Leave( KErrNotFound ); + return NULL; // suppress compile warning + } + else + { + if ( index == KLast ) + { + index = aArray.Count() - 1; + } + + TL( aArray.Count() > index ); + return aArray[ index ]; + } + } + +// ========================== TEMPLATE METHOD INSTANTIATIONS =================== + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SanitizeArrayIndexL +// ----------------------------------------------------------------------------- +// +template CMdEObjectDef* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, CStifItemParser& aItem ); +template CMdERelationDef* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, CStifItemParser& aItem ); +template CMdEEventDef* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, CStifItemParser& aItem ); +template CMdEPropertyDef* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, CStifItemParser& aItem ); +template CMdENamespaceDef* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, CStifItemParser& aItem ); +template CMdEObject* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, CStifItemParser& aItem ); +template CMdERelation* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, CStifItemParser& aItem ); +template CMdEEvent* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, CStifItemParser& aItem ); +template CMdEProperty* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, CStifItemParser& aItem ); +template CMdERelationCondition* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, CStifItemParser& aItem ); +template CMdELogicCondition* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, CStifItemParser& aItem ); +template CMdEPropertyCondition* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, CStifItemParser& aItem ); +template CMdEEventCondition* CMdETestScripter::SanitizeArrayIndexL( + RPointerArray& aArray, const CDesCArrayFlat& aNameArray, CStifItemParser& aItem ); + +// ----------------------------------------------------------------------------- +// CMdETestScripter::CheckTItemIdArrayL +// ----------------------------------------------------------------------------- +// +template void CMdETestScripter::CheckTItemIdArrayL( + const RArray& aTItemIds, const RPointerArray& aArray, + const TInt aIndex, const TInt aCount ); +template void CMdETestScripter::CheckTItemIdArrayL( + const RArray& aTItemIds, const RPointerArray& aArray, + const TInt aIndex, const TInt aCount ); +template void CMdETestScripter::CheckTItemIdArrayL( + const RArray& aTItemIds, const RPointerArray& aArray, + const TInt aIndex, const TInt aCount ); + +// ========================== OTHER EXPORTED FUNCTIONS ========================= +// None + +// [End of File] - Do not remove diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/src/MdETestScripterEditCommands.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/src/MdETestScripterEditCommands.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,2647 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include +#include "MdETestScripter.h" +#include "MdETestScripterAO.h" + +// ----------------------------------------------------------------------------- +// CMdETestScripter::BelongsToSessionL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::BelongsToSessionL( CStifItemParser& aItem ) + { + TInt mode; + TInt state; + + User::LeaveIfError( aItem.GetNextInt( mode )); + CMdEInstanceItem* instanceItem = GetInstanceItemByArrayIndexL( mode, aItem ); + User::LeaveIfError( aItem.GetNextInt( state )); + + TL( instanceItem->BelongsToSession() == (TBool)state ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SessionL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SessionL( CStifItemParser& aItem ) + { + TInt mode; + + User::LeaveIfError( aItem.GetNextInt( mode )); + CMdEInstanceItem* instanceItem = GetInstanceItemByArrayIndexL( mode, aItem ); + TL( iMdeSession == &instanceItem->Session()); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::InDatabaseL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::InDatabaseL( CStifItemParser& aItem ) + { + TInt mode; + TInt state; + + User::LeaveIfError( aItem.GetNextInt( mode )); + CMdEInstanceItem* instanceItem = GetInstanceItemByArrayIndexL( mode, aItem ); + User::LeaveIfError( aItem.GetNextInt( state )); + TL( instanceItem->InDatabase() == (TBool)state ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddItemsL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddItemsL( CStifItemParser& aItem ) + { + TInt mode1, err = KErrNone; + User::LeaveIfError( aItem.GetNextInt( mode1 )); + + if ( mode1 == KSync ) + { + RPointerArray itemArray; + FormInstanceItemArrayL( aItem, itemArray ); + err = iMdeSession->AddItemsL( itemArray ); + } + else if ( mode1 == KAsync ) + { + FormInstanceItemArrayL( aItem, iItemArray ); + TEventIf event( TEventIf::ESetEvent, TName( KMdEItemsAsyncAdd ) ); + iAsyncHandler->Start( this, event ); + iMdEDataBuf.Close();// make sure the last async request buffer cleaned before using again. + iMdeSession->AddItemsAsyncL( iItemArray, iAsyncHandler->iStatus, iMdEDataBuf ); + } + else + { + User::Leave( KErrArgument ); + } + + return err; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::UpdateItemsL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::UpdateItemsL( CStifItemParser& aItem ) + { + TInt mode1, err = KErrNone; + User::LeaveIfError( aItem.GetNextInt( mode1 )); + + if ( mode1 == KSync ) + { + RPointerArray itemArray; + FormInstanceItemArrayL( aItem, itemArray ); + err = iMdeSession->UpdateItemsL( itemArray ); + } + else if ( mode1 == KAsync ) + { + FormInstanceItemArrayL( aItem, iItemArray ); + TEventIf event( TEventIf::ESetEvent, TName( KMdEItemsAsyncUpdate ) ); + iAsyncHandler->Start( this, event ); + iMdEDataBuf.Close();// make sure the last async request buffer cleaned before using again. + iMdeSession->UpdateItemsAsyncL( iItemArray, iAsyncHandler->iStatus, iMdEDataBuf ); + } + else + { + User::Leave( KErrArgument ); + } + + return err; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddRelationDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddRelationDefL( CStifItemParser& aItem ) + { + TPtrC relationString; + + CMdENamespaceDef* namespaceDef = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( relationString )); + TRAPD( err, iMdeSession->AddRelationDefL( *namespaceDef, relationString ) ); + if( KErrAlreadyExists == err ) + { + TEventIf event( TEventIf::ESetEvent, TName( KMdESchemaModified ) ); + TestModuleIf().Event( event ); + } + return err; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddEventDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddEventDefL( CStifItemParser& aItem ) + { + TPtrC eventString; + + CMdENamespaceDef* namespaceDef = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( eventString )); + TRAPD( err, iMdeSession->AddEventDefL( *namespaceDef, eventString ) ); + if( KErrAlreadyExists == err ) + { + TEventIf event( TEventIf::ESetEvent, TName( KMdESchemaModified ) ); + TestModuleIf().Event( event ); + } + return err; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::PropertyDefCountL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::PropertyDefCountL( CStifItemParser& aItem ) + { + TInt count; + + CMdEObjectDef* objectDef = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem); + User::LeaveIfError( aItem.GetNextInt( count )); + TL( objectDef->PropertyDefCount() == count ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::PropertyDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::PropertyDefL( CStifItemParser& aItem ) + { + TInt index; + + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem); + CMdEObjectDef* objectDef = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem); + User::LeaveIfError( aItem.GetNextInt( index )); + CMdEPropertyDef& propertyDef = objectDef->PropertyDefL( index ); + TL( &propertyDef ); + iPropertyDefArray.Append( &propertyDef ); + AppendNameL( iPropertyDefNameArray, name ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::GetPropertyDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::GetPropertyDefL( CStifItemParser& aItem ) + { + TPtrC propertyString; + + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + CMdEObjectDef* objectDef = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem); + User::LeaveIfError( aItem.GetNextString( propertyString )); + CMdEPropertyDef& propertyDef = objectDef->GetPropertyDefL( propertyString ); + iPropertyDefArray.Append( &propertyDef ); + AppendNameL( iPropertyDefNameArray, name ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::CompareL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::CompareL( CStifItemParser& aItem ) + { + TInt mode; + + TInt expected; + + User::LeaveIfError( aItem.GetNextInt( mode )); + TInt result( -1 ); + + if ( mode == EObjectDef ) + { + CMdEObjectDef* item1 = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem ); + CMdEObjectDef* item2 = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem ); + result = item1->Compare( *item2 ); + } + else if ( mode == ERelationDef ) + { + CMdERelationDef* item1 = SanitizeArrayIndexL( iRelationDefArray, *iRelationDefNameArray, aItem ); + CMdERelationDef* item2 = SanitizeArrayIndexL( iRelationDefArray, *iRelationDefNameArray, aItem ); + result = item1->Compare( *item2 ); + } + else if ( mode == EEventDef ) + { + CMdEEventDef* item1 = SanitizeArrayIndexL( iEventDefArray, *iEventDefNameArray, aItem ); + CMdEEventDef* item2 = SanitizeArrayIndexL( iEventDefArray, *iEventDefNameArray, aItem ); + result = item1->Compare( *item2 ); + } + else if ( mode == EPropertyDef ) + { + CMdEPropertyDef* item1 = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + CMdEPropertyDef* item2 = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + result = item1->Compare( *item2 ); + } + else if ( mode == ENamespaceDef ) + { + CMdENamespaceDef* item1 = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + CMdENamespaceDef* item2 = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + result = item1->Compare( *item2 ); + } + else + { + User::Leave( KErrArgument ); + } + + User::LeaveIfError( aItem.GetNextInt( expected )); + TL( result == expected ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ReadOnlyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::ReadOnlyL( CStifItemParser& aItem ) + { + TInt mode; + TBool state; + + User::LeaveIfError( aItem.GetNextInt( mode )); + + if ( mode == EPropertyDef ) + { + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( state )); + TL( propertyDef->ReadOnly() == (TBool)state ); + } + else if ( mode == ENamespaceDef ) + { + CMdENamespaceDef* namespaceDef = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( state )); + TL( namespaceDef->ReadOnly() == state ); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MandatoryL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MandatoryL( CStifItemParser& aItem ) + { + TBool state; + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( state )); + TL( propertyDef->Mandatory() == (TBool)state ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MinInt32ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MinInt32ValueL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + TLex lex( value ); + TInt32 valueU; + lex.BoundedVal( valueU, 0x7FFFFFFF ); + TL( propertyDef->MinInt32ValueL() == valueU ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MaxInt32ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MaxInt32ValueL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + TLex lex( value ); + TInt32 valueU; + lex.BoundedVal( valueU, 0x7FFFFFFF ); + TL( propertyDef->MaxInt32ValueL() == valueU ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MinUint32ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MinUint32ValueL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + TLex lex( value ); + TUint32 valueU; + lex.BoundedVal( valueU, EDecimal, 0xFFFFFFFF ); + TL( propertyDef->MinUint32ValueL() == valueU ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MaxUint32ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MaxUint32ValueL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + TLex lex( value ); + TUint32 valueU; + lex.BoundedVal( valueU, EDecimal, 0xFFFFFFFF ); + TL( propertyDef->MaxUint32ValueL() == valueU ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MinInt64ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MinInt64ValueL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + TLex lex( value ); + TInt64 value64; + lex.Val( value64, 0x7FFFFFFFFFFFFFFF ); + TL( propertyDef->MinInt64ValueL() == value64 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MaxInt64ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MaxInt64ValueL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + TLex lex( value ); + TInt64 value64; + lex.Val( value64, 0x7FFFFFFFFFFFFFFF ); + TL( propertyDef->MaxInt64ValueL() == value64 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MinRealValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MinRealValueL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + User::LeaveIfError( aItem.GetNextString( value )); + TLex lex( value ); + TReal valueR; + lex.Val( valueR ); + TL( propertyDef->MinRealValueL() == valueR ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MaxRealValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MaxRealValueL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + User::LeaveIfError( aItem.GetNextString( value )); + TLex lex( value ); + TReal valueR; + lex.Val( valueR ); + TL( propertyDef->MaxRealValueL() == valueR ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MinTimeValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MinTimeValueL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + TTime time; + TL( time.Set( value ) == KErrNone ); + TL( propertyDef->MinTimeValueL() == time ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MaxTimeValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MaxTimeValueL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + TTime time; + TL( time.Set( value ) == KErrNone ); + TL( propertyDef->MaxTimeValueL() == time ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MinTextLengthL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MinTextLengthL( CStifItemParser& aItem ) + { + TInt value; + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + TL( propertyDef->MinTextLengthL() == value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MaxTextLengthL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MaxTextLengthL( CStifItemParser& aItem ) + { + TInt value; + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + TL( propertyDef->MaxTextLengthL() == value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::DefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::DefL( CStifItemParser& aItem ) + { + TInt mode; + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + User::LeaveIfError( aItem.GetNextInt( mode )); + + if ( mode == EObjectDef ) + { + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem); + CMdEObjectDef& objDef = object->Def(); + TL( &objDef ); + iObjectDefArray.Append( &objDef ); + AppendNameL( iObjectDefNameArray, name ); + } + else if ( mode == ERelationDef ) + { + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem); + CMdERelationDef& relDef = relation->Def(); + TL( &relDef ); + iRelationDefArray.Append( &relDef ); + AppendNameL( iRelationDefNameArray, name ); + } + else if ( mode == EPropertyDef ) + { + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem); + const CMdEPropertyDef& propDef = property->Def(); + TL( &propDef ); + iPropertyDefArray.Append( &propDef ); + AppendNameL( iPropertyDefNameArray, name ); + } + else if ( mode == EEventDef ) + { + CMdEEvent* event = SanitizeArrayIndexL( iEventArray, *iEventNameArray, aItem ); + CMdEEventDef& eventDef = event->Def(); + TL( &eventDef ); + iEventDefArray.Append( &eventDef ); + AppendNameL( iEventDefNameArray, name ); + } + else + { + User::Leave( KErrArgument ); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetDefL( CStifItemParser& aItem ) + { + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEObjectDef* objectDef = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem ); + object->SetDefL( *objectDef ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::UriL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::UriL( CStifItemParser& aItem ) + { + + TPtrC uri; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( uri )); + TL( object->Uri().Compare( uri ) == 0 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetUriL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetUriL( CStifItemParser& aItem ) + { + + TPtrC uri; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( uri )); + object->SetUriL( uri ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ConfidentialL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::ConfidentialL( CStifItemParser& aItem ) + { + TInt state; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( state )); + TL( object->Confidential() == (TBool)state ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetConfidentialL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetConfidentialL( CStifItemParser& aItem ) + { + TInt state; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( state )); + + object->SetConfidential( (TBool)state ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::PlaceholderL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::PlaceholderL( CStifItemParser& aItem ) + { + TInt state; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( state )); + TL( object->Placeholder() == (TBool)state ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetPlaceholderL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetPlaceholderL( CStifItemParser& aItem ) + { + TInt state; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( state )); + + object->SetPlaceholder( (TBool)state ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MediaIdL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MediaIdL( CStifItemParser& aItem ) + { + TInt mediaId; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( mediaId )); + + TL( object->MediaId() == mediaId ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetMediaIdL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetMediaIdL( CStifItemParser& aItem ) + { + TInt mediaId; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( mediaId )); + + object->SetMediaId( mediaId ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::UsageCountL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::UsageCountL( CStifItemParser& aItem ) + { + + TInt count; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( count )); + + TL( object->UsageCount() == count ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::GuidL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::GuidL( CStifItemParser& aItem ) + { + TInt mode; + + TInt guidHighExpected; + TInt guidLowExpected; + TInt64 guidHigh; + TInt64 guidLow; + + User::LeaveIfError( aItem.GetNextInt( mode )); + if ( mode == EObject ) + { + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( guidHighExpected )); + User::LeaveIfError( aItem.GetNextInt( guidLowExpected )); + object->Guid( guidHigh, guidLow ); + } + else if ( mode == ERelation ) + { + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( guidHighExpected )); + User::LeaveIfError( aItem.GetNextInt( guidLowExpected )); + relation->Guid( guidHigh, guidLow ); + } + + TL( guidHighExpected == guidHigh ); + TL( guidLowExpected == guidLow ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetGuidL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetGuidL( CStifItemParser& aItem ) + { + TInt mode; + + TInt guidHigh; + TInt guidLow; + + User::LeaveIfError( aItem.GetNextInt( mode )); + if ( mode == EObject ) + { + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( guidHigh )); + User::LeaveIfError( aItem.GetNextInt( guidLow )); + object->SetGuid( guidHigh, guidLow ); + } + else if ( mode == ERelation ) + { + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( guidHigh )); + User::LeaveIfError( aItem.GetNextInt( guidLow )); + relation->SetGuid( guidHigh, guidLow ); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::OpenForModifications +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::OpenForModificationsL( CStifItemParser& aItem ) + { + TInt open; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( open )); + + TBool state = object->OpenForModifications(); + TL( (TBool)open == state ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::NewObjectL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::NewObjectL( CStifItemParser& aItem ) + { + TInt mode; + CMdEObject* object = NULL; + + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + CMdEObjectDef* objectDef = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( mode )); + + if ( mode == KL ) + { + object = iMdeSession->NewObjectL( + *objectDef, MdeConstants::Object::KAutomaticUri ); + } + else if ( mode == KLC ) + { + object = iMdeSession->NewObjectLC( + *objectDef, MdeConstants::Object::KAutomaticUri ); + CleanupStack::Pop( object ); + } + else + { + User::Leave( KErrArgument ); + } + + TL( object ); + iObjectArray.Append( object ); + AppendNameL( iObjectNameArray, name ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddObjectL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddObjectL( CStifItemParser& aItem ) + { + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + + TItemId id = iMdeSession->AddObjectL( *object ); + TL( id != KNoId ); + TL( object->Id() == id ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddObjectsL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddObjectsL( CStifItemParser& aItem ) + { + TInt count; + RPointerArray objectArray; + + TInt firstIndex = GetObjectIndexL( aItem ); + User::LeaveIfError( aItem.GetNextInt( count )); + + for ( TInt i = 0; i < count; ++i ) + { + objectArray.Append( iObjectArray[ firstIndex + i ] ); + } + + TInt err = iMdeSession->AddObjectsL( objectArray ); + objectArray.Reset(); + T1L ( err, KErrNone ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::GetObjectL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::GetObjectL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + TInt mode1; + TInt mode2; + CMdEObject* newObject = NULL; + CMdEObjectDef* objectDef = NULL; + CMdENamespaceDef* namespaceDef = NULL; + TInt64 guidHigh = 0; + TInt64 guidLow = 0; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + + User::LeaveIfError( aItem.GetNextInt( mode1 )); + User::LeaveIfError( aItem.GetNextInt( mode2 )); + + if ( mode2 == EObjectDef ) + { + objectDef = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem ); + } + else if ( mode2 == ENamespaceDef ) + { + namespaceDef = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + } + + if ( mode1 == KById && mode2 == EObjectDef ) + { + newObject = iMdeSession->GetObjectL( object->Id(), *objectDef ); + } + else if ( mode1 == KById && mode2 == ENamespaceDef ) + { + newObject = iMdeSession->GetObjectL( object->Id(), namespaceDef ); + } + else if ( mode1 == KByUri && mode2 == EObjectDef ) + { + newObject = iMdeSession->GetObjectL( object->Uri(), *objectDef ); + } + else if ( mode1 == KByUri && mode2 == ENamespaceDef ) + { + newObject = iMdeSession->GetObjectL( object->Uri(), namespaceDef ); + } + else if ( mode1 == KByGuid && mode2 == EObjectDef ) + { + object->Guid( guidHigh, guidLow ); + newObject = iMdeSession->GetObjectL( guidHigh, guidLow, *objectDef ); + } + else if ( mode1 == KByGuid && mode2 == ENamespaceDef ) + { + object->Guid( guidHigh, guidLow ); + newObject = iMdeSession->GetObjectL( guidHigh, guidLow, namespaceDef ); + } + else + { + User::Leave( KErrArgument ); + } + + TL( newObject ); + iObjectArray.Append( newObject ); + AppendNameL( iObjectNameArray, name ); + + iLog->Log( _L( "Object Id = %d URI = %S Propertycount = %d" ), + newObject->Id(), &newObject->Uri(), newObject->PropertyCount() ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::GetFullObjectL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::GetFullObjectL( CStifItemParser& aItem ) + { + TInt mode; + CMdEObject* newObject = NULL; + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + CMdEObjectDef* objectDef = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem ); + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( mode )); + if ( mode == KById ) + { + newObject = iMdeSession->GetFullObjectL( object->Id()); + } + else if ( mode == KByUri ) + { + newObject = iMdeSession->GetFullObjectL( object->Uri()); + } + else if ( mode == KByGuid ) + { + TInt64 guidHigh; + TInt64 guidLow; + + object->Guid( guidHigh, guidLow ); + newObject = iMdeSession->GetFullObjectL( guidHigh, guidLow ); + } + else + { + User::Leave( KErrArgument ); + } + TL( newObject ); + iObjectArray.Append( newObject ); + AppendNameL( iObjectNameArray, name ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::CheckObjectL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::CheckObjectL( CStifItemParser& aItem ) + { + TInt objIndex; + TInt mode; + TMdEObject tObject; + + objIndex = GetObjectIndexL( aItem ); + User::LeaveIfError( aItem.GetNextInt( mode )); + + if ( mode == KById ) + { + iMdeSession->CheckObjectL( tObject, iObjectArray[ objIndex ]->Id() ); + CheckTMdEObjectL( tObject, *iObjectArray[ objIndex ] ); + } + else if ( mode == KByUri ) + { + iMdeSession->CheckObjectL( tObject, iObjectArray[ objIndex ]->Uri() ); + CheckTMdEObjectL( tObject, *iObjectArray[ objIndex ] ); + } + else if ( mode == KByIds ) + { + TInt count; + RArray ids; + RArray tObjects; + + User::LeaveIfError( aItem.GetNextInt( count )); + TL( iObjectArray.Count() > objIndex + count - 1 ); + + for ( TInt i = 0; i < count; ++i ) + { + ids.Append( iObjectArray[ objIndex + i ]->Id() ); + } + iMdeSession->CheckObjectL( tObjects, ids ); + CheckTMdEObjectArrayL( tObjects, objIndex, count ); + + tObjects.Reset(); + ids.Reset(); + } + else + { + User::Leave( KErrArgument ); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveObjectL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveObjectL( CStifItemParser& aItem ) + { + TInt mode; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( mode )); + + TItemId id = KNoId; + + if ( mode == KById ) + { + id = iMdeSession->RemoveObjectL( object->Id() ); + } + else if ( mode == KByUri ) + { + id = iMdeSession->RemoveObjectL( object->Uri() ); + } + else + { + User::Leave( KErrArgument ); + } + + TL( id != KNoId ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveObjectsL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveObjectsL( CStifItemParser& aItem ) + { + TInt mode1; + TInt mode2; + TInt objIndex; + TInt count; + TInt needMacroVerifyResult; + RArray objectIdArray; + RPointerArray objectUriArray; + RArray successful; + TRequestStatus status = KRequestPending; + + User::LeaveIfError( aItem.GetNextInt( mode1 )); + User::LeaveIfError( aItem.GetNextInt( mode2 )); + objIndex = GetObjectIndexL( aItem ); + User::LeaveIfError( aItem.GetNextInt( count )); + TL( iObjectArray.Count() > objIndex + count - 1 ); + TRAPD( err, aItem.GetNextInt( needMacroVerifyResult ) ); + if ( KErrNone != err ) + { + needMacroVerifyResult = 1; + } + + for ( TInt i = 0; i < count; ++i ) + { + if ( mode2 == KById ) + { + objectIdArray.Append( iObjectArray[ objIndex + i ]->Id() ); + } + else if ( mode2 == KByUri ) + { + objectUriArray.Append( &iObjectArray[ objIndex + i ]->Uri() ); + } + } + + if ( mode1 == KSync && mode2 == KById ) + { + iMdeSession->RemoveObjectsL( objectIdArray, successful ); + } + else if ( mode1 == KSync && mode2 == KByUri ) + { + iMdeSession->RemoveObjectsL( objectUriArray, successful ); + } + else if ( mode1 == KAsync && mode2 == KById ) + { + iItemCount = count; + TEventIf event( TEventIf::ESetEvent, TName( KMdEObjectsAsyncRemoved ) ); + iAsyncHandler->Start( this, event ); + iMdEDataBuf.Close();// make sure the last async request buffer cleaned before using again. + iMdeSession->RemoveObjectsAsyncL( objectIdArray, iAsyncHandler->iStatus, iMdEDataBuf ); + } + else if ( mode1 == KAsync && mode2 == KByUri ) + { + iItemCount = count; + TEventIf event( TEventIf::ESetEvent, TName( KMdEObjectsAsyncRemoved ) ); + iAsyncHandler->Start( this, event ); + iMdEDataBuf.Close();// make sure the last async request buffer cleaned before using again. + iMdeSession->RemoveObjectsAsyncL( objectUriArray, iAsyncHandler->iStatus, iMdEDataBuf ); + } + else + { + User::Leave( KErrArgument ); + } + + if( needMacroVerifyResult && KSync == mode1 ) + { + TL( successful.Count() == count ); + for ( TInt i = 0; i < successful.Count(); ++i ) + { + TL( successful[ i ] != KNoId ); + } + } + + successful.Reset(); + objectIdArray.Reset(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveAllObjectsL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveAllObjectsL( CStifItemParser& /* aItem */ ) + { + TInt count = iObjectArray.Count(); + RArray successful; + RArray objectIdArray; + + for ( TInt i = 0; i < count; ++i ) + { + objectIdArray.Append( iObjectArray[ i ]->Id() ); + } + + if (count) + { + iMdeSession->RemoveObjectsL( objectIdArray, successful ); + } + objectIdArray.Reset(); + successful.Reset(); + + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CMdETestScripter::OpenObjectL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::OpenObjectL( CStifItemParser& aItem ) + { + _LIT( KMsg1, "Enter OpenObjectL" ); + iLog->Log( KMsg1 ); + RDebug::Print( KMsg1 ); + + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + TInt mode1; + TInt mode2; + CMdEObject* newObject = NULL; + CMdEObjectDef* objectDef = NULL; + CMdENamespaceDef* namespaceDef = NULL; + TInt64 guidHigh = 0; + TInt64 guidLow = 0; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( mode1 )); + User::LeaveIfError( aItem.GetNextInt( mode2 )); + + if ( mode2 == EObjectDef ) + { + objectDef = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem ); + } + else if ( mode2 == ENamespaceDef ) + { + namespaceDef = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + } + + if ( mode1 == KById && mode2 == EObjectDef ) + { + newObject = iMdeSession->OpenObjectL( object->Id(), *objectDef ); + } + else if ( mode1 == KById && mode2 == ENamespaceDef ) + { + newObject = iMdeSession->OpenObjectL( object->Id(), namespaceDef ); + } + else if ( mode1 == KByUri && mode2 == EObjectDef ) + { + newObject = iMdeSession->OpenObjectL( object->Uri(), *objectDef ); + } + else if ( mode1 == KByUri && mode2 == ENamespaceDef ) + { + newObject = iMdeSession->OpenObjectL( object->Uri(), namespaceDef ); + } + else if ( mode1 == KByGuid && mode2 == EObjectDef ) + { + object->Guid( guidHigh, guidLow ); + newObject = iMdeSession->OpenObjectL( guidHigh, guidLow, *objectDef ); + } + else if ( mode1 == KByGuid && mode2 == ENamespaceDef ) + { + object->Guid( guidHigh, guidLow ); + newObject = iMdeSession->OpenObjectL( guidHigh, guidLow, namespaceDef ); + } + else + { + User::Leave( KErrArgument ); + } + TL( newObject ); + iObjectArray.Append( newObject ); + AppendNameL( iObjectNameArray, name ); + + _LIT( KMsg2, "Exit OpenObjectL" ); + iLog->Log( KMsg2 ); + RDebug::Print( KMsg2 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::OpenFullObjectL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::OpenFullObjectL( CStifItemParser& aItem ) + { + TInt mode; + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + CMdEObject* newObject = NULL; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + + User::LeaveIfError( aItem.GetNextInt( mode )); + + if ( mode == KById ) + { + newObject = iMdeSession->OpenFullObjectL( object->Id() ); + } + else if ( mode == KByUri ) + { + newObject = iMdeSession->OpenFullObjectL( object->Uri() ); + } + else if ( mode == KByGuid ) + { + TInt64 guidHigh; + TInt64 guidLow; + + object->Guid( guidHigh, guidLow ); + newObject = iMdeSession->OpenFullObjectL( guidHigh, guidLow ); + } + else + { + User::Leave( KErrArgument ); + } + TL( newObject ); + if ( !newObject->OpenForModifications() ) + { + return KErrLocked; + } + iObjectArray.Append( newObject ); + AppendNameL( iObjectNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::CommitObjectL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::CommitObjectL( CStifItemParser& aItem ) + { + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + iMdeSession->CommitObjectL( *object ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::CommitObjectsL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::CommitObjectsL( CStifItemParser& aItem ) + { + TInt objIndex; + TInt count; + RPointerArray objectArray; + + objIndex = GetObjectIndexL( aItem ); + + User::LeaveIfError( aItem.GetNextInt( count )); + + for ( TInt i = 0; i < count; ++i ) + { + objectArray.Append( iObjectArray[ objIndex + i ] ); + } + + iMdeSession->CommitObjectsL( objectArray ); + + objectArray.Reset(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::CancelObjectL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::CancelObjectL( CStifItemParser& aItem ) + { + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + + iMdeSession->CancelObjectL( *object ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::PropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::PropertyL( CStifItemParser& aItem ) + { + TInt mode; + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + User::LeaveIfError( aItem.GetNextInt( mode )); + + const CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEProperty* property; + + if ( mode == KByIndex ) + { + TInt index; + + User::LeaveIfError( aItem.GetNextInt( index )); + property = &object->PropertyL( index ); + } + else if ( mode == KByDef ) + { + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + TInt startAt; + User::LeaveIfError( aItem.GetNextInt( startAt )); + TL( object->Property( *propertyDef, property, startAt ) != KErrNotFound ); + } + else + { + User::Leave( KErrArgument ); + } + TL( property ); + + iPropertyArray.Append ( property ); + AppendNameL( iPropertyNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::PropertyCountL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::PropertyCountL( CStifItemParser& aItem ) + { + TInt mode; + TInt count; + TInt state = 0; + + User::LeaveIfError( aItem.GetNextInt( mode )); + const CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + + if ( mode == EObject ) + { + state = object->PropertyCount(); + } + else if ( mode == EPropertyDef ) + { + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + state = object->PropertyCount( *propertyDef ); + } + else + { + User::Leave( KErrArgument ); + } + + User::LeaveIfError( aItem.GetNextInt( count )); + TL( count == state ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddBoolPropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddBoolPropertyL( CStifItemParser& aItem ) + { + TInt value; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + + CMdEProperty& prop = object->AddBoolPropertyL( *propertyDef, (TBool)value ); + TL( &prop ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddInt8PropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddInt8PropertyL( CStifItemParser& aItem ) + { + TInt value; + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + + User::LeaveIfError( aItem.GetNextInt( value )); + + CMdEProperty& prop = object->AddInt8PropertyL( *propertyDef, value ); + TL( &prop ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddUint8PropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddUint8PropertyL( CStifItemParser& aItem ) + { + TInt value; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + + CMdEProperty& prop = object->AddUint8PropertyL( *propertyDef, value ); + TL( &prop ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddInt16PropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddInt16PropertyL( CStifItemParser& aItem ) + { + TInt value; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + + CMdEProperty& prop = object->AddInt16PropertyL( *propertyDef, value ); + TL( &prop ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddUint16PropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddUint16PropertyL( CStifItemParser& aItem ) + { + TInt value; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + + CMdEProperty& prop = object->AddUint16PropertyL( *propertyDef, value ); + TL( &prop ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddInt32PropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddInt32PropertyL( CStifItemParser& aItem ) + { + TInt value; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + + CMdEProperty& prop = object->AddInt32PropertyL( *propertyDef, value ); + TL( &prop ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddUint32PropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddUint32PropertyL( CStifItemParser& aItem ) + { + TInt value; + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + + CMdEProperty& prop = object->AddUint32PropertyL( *propertyDef, value ); + TL( &prop ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddInt64PropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddInt64PropertyL( CStifItemParser& aItem ) + { + TInt value; + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + + CMdEProperty& prop = object->AddInt64PropertyL( *propertyDef, value ); + TL( &prop ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddReal32PropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddReal32PropertyL( CStifItemParser& aItem ) + { + TInt value; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + + CMdEProperty& prop = object->AddReal32PropertyL( *propertyDef, value ); + TL( &prop ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddReal64PropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddReal64PropertyL( CStifItemParser& aItem ) + { + TInt value; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + + User::LeaveIfError( aItem.GetNextInt( value )); + + CMdEProperty& prop = object->AddReal64PropertyL( *propertyDef, value ); + TL( &prop ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddTextPropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddTextPropertyL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + User::LeaveIfError( aItem.GetNextString( value )); + + CMdEProperty& prop = object->AddTextPropertyL( *propertyDef, value ); + TL( &prop ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddTimePropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddTimePropertyL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + + TTime time; + TL( time.Set( value ) == KErrNone ); + CMdEProperty& prop = object->AddTimePropertyL( *propertyDef, time ); + TL( &prop ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ObjectL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::ObjectL( CStifItemParser& aItem ) + { + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + TL( object == &property->Object() ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::BoolValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::BoolValueL( CStifItemParser& aItem ) + { + TInt value; + + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + + TL( property->BoolValueL() == value ); + + return KErrNone; + } +// ----------------------------------------------------------------------------- +// CMdETestScripter::Int8ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::Int8ValueL( CStifItemParser& aItem ) + { + TInt value; + + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + TL( property->Int8ValueL() == value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::Uint8ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::Uint8ValueL( CStifItemParser& aItem ) + { + TInt value; + + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + TL( property->Uint8ValueL() == value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::Int16ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::Int16ValueL( CStifItemParser& aItem ) + { + TInt value; + + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + TL( property->Int16ValueL() == value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::Uint16ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::Uint16ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + TL( property->Uint16ValueL() == value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::Int32ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::Int32ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + TL( property->Int32ValueL() == value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::Uint32ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::Uint32ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + TL( property->Uint32ValueL() == value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::Int64ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::Int64ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + TL( property->Int64ValueL() == value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::Real32ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::Real32ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + TL( property->Real32ValueL() == value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::Real64ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::Real64ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + TL( property->Real64ValueL() == value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::TimeValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::TimeValueL( CStifItemParser& aItem ) + { + TPtrC value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + + TTime time; + TL( time.Set( value ) == KErrNone ); + TL( property->TimeValueL() == time ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::TextValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::TextValueL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + User::LeaveIfError( aItem.GetNextString( value )); + + TL( value.Compare( property->TextValueL()) == 0 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetBoolValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetBoolValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + + property->SetBoolValueL( value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetInt8ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetInt8ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + + property->SetInt8ValueL( value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetUint8ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetUint8ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + property->SetUint8ValueL( value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetInt16ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetInt16ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + property->SetInt16ValueL( value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetUint16ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetUint16ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + property->SetUint16ValueL( value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetInt32ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetInt32ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + property->SetInt32ValueL( value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetUint32ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetUint32ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + property->SetUint32ValueL( value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetInt64ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetInt64ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + + property->SetInt64ValueL( value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetReal32ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetReal32ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + property->SetReal32ValueL( value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetReal64ValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetReal64ValueL( CStifItemParser& aItem ) + { + TInt value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( value )); + + property->SetReal64ValueL( value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetTimeValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetTimeValueL( CStifItemParser& aItem ) + { + TPtrC value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + TTime time; + TL( time.Set( value ) == KErrNone ); + property->SetTimeValueL( time ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetTextValueL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetTextValueL( CStifItemParser& aItem ) + { + TPtrC value; + CMdEProperty* property = SanitizeArrayIndexL( iPropertyArray, *iPropertyNameArray, aItem ); + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + User::LeaveIfError( aItem.GetNextString( value )); + property->SetTextValueL( value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemovePropertyL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemovePropertyL( CStifItemParser& aItem ) + { + TPtrC propertyDefName; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( propertyDefName )); + + CMdEPropertyDef& propertyDef = object->Def().GetPropertyDefL( propertyDefName ); + CMdEProperty* property = NULL; + TInt propIndex = object->Property( propertyDef, property ); + TL( propIndex ); + object->RemoveProperty( propIndex ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::FreeTextCountL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::FreeTextCountL( CStifItemParser& aItem ) + { + TInt count; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( count )); + + TInt state = object->FreeTextCount(); + TL( count == state ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::FreeTextL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::FreeTextL( CStifItemParser& aItem ) + { + TInt index; + TPtrC text; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( index )); + User::LeaveIfError( aItem.GetNextString( text )); + + TPtrC state = object->FreeText( index ); + TL( text.Compare( state ) == 0 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::FreeTextIndexL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::FreeTextIndexL( CStifItemParser& aItem ) + { + TInt index; + TPtrC value; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( index )); + User::LeaveIfError( aItem.GetNextString( value )); + + TInt state = object->FreeTextIndex( value ); + TA1L( state, index ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddFreeTextL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddFreeTextL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + + object->AddFreeTextL( value ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveFreeTextL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveFreeTextL( CStifItemParser& aItem ) + { + TInt index; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( index )); + + object->RemoveFreeText( index ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::MovePropertiesL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::MovePropertiesL( CStifItemParser& aItem ) + { + CMdEObject* sourceObj = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEObject* targetObj = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + + targetObj->MovePropertiesL( *sourceObj ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::NewRelationL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::NewRelationL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + TPtrC relationString; + TInt parameter; + TInt mode; + + CMdEObject* sourceObj = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdERelationDef* relationDef = SanitizeArrayIndexL( iRelationDefArray, *iRelationDefNameArray, aItem ); + CMdEObject* targetObj = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( parameter )); + User::LeaveIfError( aItem.GetNextInt( mode )); + + CMdERelation* relation = NULL; + + if ( mode == KL ) + { + relation = iMdeSession->NewRelationL( *relationDef, sourceObj->Id(), targetObj->Id(), parameter ); + } + else if ( mode == KLC ) + { + relation = iMdeSession->NewRelationLC( *relationDef, sourceObj->Id(), targetObj->Id(), parameter ); + CleanupStack::Pop( relation ); + } + else + { + User::Leave( KErrArgument ); + } + + TL( relation ); + iRelationArray.Append( relation ); + AppendNameL( iRelationNameArray, name ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddRelationL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddRelationL( CStifItemParser& aItem ) + { + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + + TItemId id = iMdeSession->AddRelationL( *relation ); + TL( id != KNoId ); + TL( relation->Id() == id ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::LeftObjectIdL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::LeftObjectIdL( CStifItemParser& aItem ) + { + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + + TL( relation->LeftObjectId() == object->Id() ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RightObjectIdL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RightObjectIdL( CStifItemParser& aItem ) + { + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + + TL( relation->RightObjectId() == object->Id() ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ParameterL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::ParameterL( CStifItemParser& aItem ) + { + TInt parameter; + + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( parameter )); + + TL( relation->Parameter() == parameter ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetParameterL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetParameterL( CStifItemParser& aItem ) + { + TInt parameter; + + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( parameter )); + + relation->SetParameter( parameter ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetLeftObjectIdL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetLeftObjectIdL( CStifItemParser& aItem ) + { + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + + relation->SetLeftObjectIdL( object->Id() ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetRightObjectIdL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetRightObjectIdL( CStifItemParser& aItem ) + { + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + + relation->SetRightObjectIdL( object->Id() ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::LastModifiedDateL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::LastModifiedDateL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + + TTime time; + TL( time.Set( value ) == KErrNone ); + + TL( relation->LastModifiedDate() == time ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetLastModifiedDateL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetLastModifiedDateL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + + TTime time; + TL( time.Set( value ) == KErrNone ); + + relation->SetLastModifiedDate( time ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::GetRelationL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::GetRelationL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + + CMdERelation* newRelation = iMdeSession->GetRelationL( relation->Id()); + + TL( newRelation ); + iRelationArray.Append( newRelation ); + AppendNameL( iRelationNameArray, name ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::UpdateRelationL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::UpdateRelationL( CStifItemParser& aItem ) + { + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + + TItemId id = iMdeSession->UpdateRelationL( *relation ); + TL( id != KNoId ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveRelationL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveRelationL( CStifItemParser& aItem ) + { + CMdERelation* relation = SanitizeArrayIndexL( iRelationArray, *iRelationNameArray, aItem ); + + TItemId id = iMdeSession->RemoveRelationL( relation->Id() ); + TL( id != KNoId ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveRelationsL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveRelationsL( CStifItemParser& aItem ) + { + TInt mode; + TInt relIndex; + TInt count; + RArray relationIdArray; + + User::LeaveIfError( aItem.GetNextInt( mode )); + relIndex = GetRelationIndexL( aItem ); + + User::LeaveIfError( aItem.GetNextInt( count )); + TL( iRelationArray.Count() > relIndex + count - 1 ); + + for ( TInt i = 0; i < count; ++i ) + { + relationIdArray.Append( iRelationArray[ relIndex + i ]->Id() ); + } + + if ( mode == KSync ) + { + RArray successful; + + iMdeSession->RemoveRelationsL( relationIdArray, successful ); + } + else if ( mode == KAsync ) + { + iItemCount = count; + TEventIf event( TEventIf::ESetEvent, TName( KMdERelationsAsyncRemoved ) ); + iAsyncHandler->Start( this, event ); + iMdEDataBuf.Close();// make sure the last async request buffer cleaned before using again. + iMdeSession->RemoveRelationsAsyncL( relationIdArray, iAsyncHandler->iStatus, iMdEDataBuf ); + } + else + { + User::Leave( KErrArgument ); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::NewEventL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::NewEventL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + TPtrC eventSource; + TPtrC eventParticipant; + TPtrC value; + TInt mode; + + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + CMdEEventDef* eventDef = SanitizeArrayIndexL( iEventDefArray, *iEventDefNameArray, aItem ); + + User::LeaveIfError( aItem.GetNextString( eventSource )); + User::LeaveIfError( aItem.GetNextString( eventParticipant )); + User::LeaveIfError( aItem.GetNextString( value )); + User::LeaveIfError( aItem.GetNextInt( mode )); + + TTime time; + TL( time.Set( value ) == KErrNone ); + CMdEEvent* event = NULL; + + if ( mode == KL ) + { + event = iMdeSession->NewEventL( + *eventDef, object->Id(), + time, &eventSource, &eventParticipant ); + } + else if ( mode == KLC ) + { + event = iMdeSession->NewEventLC( + *eventDef, object->Id(), + time, &eventSource, &eventParticipant ); + CleanupStack::Pop( event ); + } + else + { + User::Leave( KErrArgument ); + } + + TL( event ); + iEventArray.Append( event ); + AppendNameL( iEventNameArray, name ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddEventL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddEventL( CStifItemParser& aItem ) + { + CMdEEvent* event = SanitizeArrayIndexL( iEventArray, *iEventNameArray, aItem ); + + TItemId id = iMdeSession->AddEventL( *event ); + TL( id != KNoId ); + TL( event->Id() == id ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ObjectIdL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::ObjectIdL( CStifItemParser& aItem ) + { + CMdEEvent* event = SanitizeArrayIndexL( iEventArray, *iEventNameArray, aItem ); + CMdEObject* object = SanitizeArrayIndexL( iObjectArray, *iObjectNameArray, aItem ); + + TL( event->ObjectId() == object->Id() ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::TimeL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::TimeL( CStifItemParser& aItem ) + { + TPtrC value; + + CMdEEvent* event = SanitizeArrayIndexL( iEventArray, *iEventNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( value )); + + TTime time; + TL( time.Set( value ) == KErrNone ); + + TL( event->Time() == time ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SourceL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SourceL( CStifItemParser& aItem ) + { + TPtrC source; + TInt expected; + + CMdEEvent* event = SanitizeArrayIndexL( iEventArray, *iEventNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( source )); + User::LeaveIfError( aItem.GetNextInt( expected )); + + TInt result = event->Source()->Compare( source ); + TL( result == expected ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ParticipantL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::ParticipantL( CStifItemParser& aItem ) + { + TPtrC participant; + TInt expected; + + CMdEEvent* event = SanitizeArrayIndexL( iEventArray, *iEventNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( participant )); + User::LeaveIfError( aItem.GetNextInt( expected )); + + TInt result = event->Participant()->Compare( participant ); + TL( result == expected ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::GetEventL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::GetEventL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + CMdEEvent* event = SanitizeArrayIndexL( iEventArray, *iEventNameArray, aItem ); + + CMdEEvent* newEvent = iMdeSession->GetEventL( event->Id()); + + TL( event ); + iEventArray.Append( newEvent ); + AppendNameL( iEventNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveEventL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveEventL( CStifItemParser& aItem ) + { + CMdEEvent* event = SanitizeArrayIndexL( iEventArray, *iEventNameArray, aItem ); + TItemId id = iMdeSession->RemoveEventL( event->Id() ); + TL( id != KNoId ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveEventsL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveEventsL( CStifItemParser& aItem ) + { + TInt mode; + TInt eventIndex; + TInt count; + RArray successful; + RArray eventIdArray; + + User::LeaveIfError( aItem.GetNextInt( mode )); + eventIndex = GetEventIndexL( aItem ); + User::LeaveIfError( eventIndex ); + TL( iEventArray.Count() > eventIndex ); + User::LeaveIfError( aItem.GetNextInt( count )); + TL( iEventArray.Count() > eventIndex + count - 1 ); + + for ( TInt i = 0; i < count; ++i ) + { + eventIdArray.Append( iEventArray[ eventIndex + i ]->Id() ); + } + + if ( mode == KSync ) + { + iMdeSession->RemoveEventsL( eventIdArray, successful ); + } + else if ( mode == KAsync ) + { + iItemCount = count; + TEventIf event( TEventIf::ESetEvent, TName( KMdEEventsAsyncRemoved ) ); + iAsyncHandler->Start( this, event ); + iMdEDataBuf.Close();// make sure the last async request buffer cleaned before using again. + iMdeSession->RemoveEventsAsyncL( eventIdArray, iAsyncHandler->iStatus, iMdEDataBuf ); + } + else + { + User::Leave( KErrArgument ); + } + + successful.Reset(); + eventIdArray.Reset(); + + return KErrNone; + } + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/src/MdETestScripterQueryCommands.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/src/MdETestScripterQueryCommands.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,1826 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include +#include "MdETestScripter.h" + +const TInt KRootCond = -1; + +// ----------------------------------------------------------------------------- +// CMdETestScripter::FindL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::FindL( CStifItemParser& aItem ) + { + TInt maxCount; + User::LeaveIfError( aItem.GetNextInt( maxCount ) ); + TInt notifyCount; + User::LeaveIfError( aItem.GetNextInt( notifyCount ) ); + + iQuery->FindL( maxCount, notifyCount ); + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CMdETestScripter::QueryObjectL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::QueryObjectL( CStifItemParser& aItem ) + { + TPtrC objectString; + + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + + User::LeaveIfError( aItem.GetNextString( objectString )); + CMdEObjectDef& objdef = space->GetObjectDefL( objectString ); + + delete iQuery; + iQuery = NULL; + iQuery = iMdeSession->NewObjectQueryL( *space, objdef, this ); + iQuery->SetResultMode( EQueryResultModeId ); + iQuery->FindL(1); + + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CMdETestScripter::NewObjectQueryL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::NewObjectQueryL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + TPtrC modeString; + User::LeaveIfError( aItem.GetNextString( modeString )); + TQueryResultMode modeEnum = ResultModeL( modeString ); + + TPtrC objectString; + User::LeaveIfError( aItem.GetNextString( objectString )); + + CMdEObjectDef& objdef = space->GetObjectDefL( objectString ); + + delete iQuery; + iQuery = NULL; + + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + if ( type.Compare(_L("Object")) == 0 ) + { + iQuery = iMdeSession->NewObjectQueryL( *space, objdef, this ); + } + else if ( type.Compare(_L("LookupObject")) == 0 ) + { + RPointerArray *objDefs = new (ELeave) RPointerArray; + TPtrC startMark; + User::LeaveIfError( aItem.GetNextString( startMark )); + if ( startMark.Compare(_L("{")) == 0) + { + TInt index; + while( ETrue ) + { + index = GetObjectDefIndexL( aItem ); + if ( index == KErrCompletion ) + { + break; + } + objDefs->Append( iObjectDefArray[ index ] ); + } + } + iQuery = iMdeSession->NewObjectQueryL( objdef, objDefs, this ); + } + else + { + User::Leave( KErrArgument ); + } + + + iQuery->SetResultMode( modeEnum ); + CMdELogicCondition* rootLogicCondition = &iQuery->Conditions(); + iLogicConditionArray.Append( rootLogicCondition ); + AppendNameL( iLogicConditionNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::NewRelationQueryL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::NewRelationQueryL( CStifItemParser& aItem ) + { + + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + delete iQuery; + iQuery = NULL; + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + TPtrC modeString; + User::LeaveIfError( aItem.GetNextString( modeString )); + TQueryResultMode modeEnum = ResultModeL( modeString ); + + iQuery = iMdeSession->NewRelationQueryL( *space, this ); + iQuery->SetResultMode( modeEnum ); + CMdELogicCondition* rootLogicCondition = &iQuery->Conditions(); + iLogicConditionArray.Append( rootLogicCondition ); + AppendNameL( iLogicConditionNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::NewEventQueryL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::NewEventQueryL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + delete iQuery; + iQuery = NULL; + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + TPtrC modeString; + User::LeaveIfError( aItem.GetNextString( modeString )); + TQueryResultMode modeEnum = ResultModeL( modeString ); + + iQuery = iMdeSession->NewEventQueryL( *space, this ); + iQuery->SetResultMode( modeEnum ); + CMdELogicCondition* rootLogicCondition = &iQuery->Conditions(); + iLogicConditionArray.Append( rootLogicCondition ); + AppendNameL( iLogicConditionNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdEObjectQuery::AddPropertyFilterL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddPropertyFilterL( CStifItemParser& aItem ) + { + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem); + ((CMdEObjectQuery *)iQuery)->AddPropertyFilterL( propertyDef ); + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CMdEObjectQuery::AppendOrderRuleL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AppendOrderRuleL( CStifItemParser& aItem ) + { + TInt ascending; + User::LeaveIfError( aItem.GetNextInt( ascending ) ); + TInt orderRule; + User::LeaveIfError( aItem.GetNextInt( orderRule ) ); + if ( orderRule == EOrderRuleTypeProperty ) + { + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem); + ((CMdEObjectQuery *)iQuery)->AppendOrderRuleL( TMdEOrderRule( *propertyDef, ascending )); + } + else + { + ((CMdEObjectQuery *)iQuery)->AppendOrderRuleL( TMdEOrderRule( (TOrderRuleType) orderRule, ascending )); + } + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CMdETestScripter::HandleQueryNewResults +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::HandleQueryNewResults( CMdEQuery& /*aQuery*/, + TInt /*aFirstNewItemIndex*/, TInt aNewItemCount ) + { + _LIT( KMessage, "Query new results count: " ); + _LIT( KMessage2, " new count: " ); + TBuf<128> buf( KMessage ); + buf.Append( KMessage2 ); + buf.AppendNum( aNewItemCount ); + + } + + +// ----------------------------------------------------------------------------- +// CMdETestScripter::QueryRelationL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::QueryRelationL( CStifItemParser& aItem ) + { + TPtrC relationString; + User::LeaveIfError( aItem.GetNextString( relationString )); + + CMdERelationDef& reldef = iNamespaceDefArray[0]->GetRelationDefL( relationString ); + + delete iQuery; + iQuery = NULL; + iQuery = iMdeSession->NewRelationQueryL( *iNamespaceDefArray[0], this ); + iQuery->SetResultMode( EQueryResultModeId ); + iQueryRoot = &iQuery->Conditions(); + iQueryRoot->AddRelationConditionL( reldef ); + iQuery->FindL(1); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::QueryEventL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::QueryEventL( CStifItemParser& aItem ) + { + TPtrC eventString; + User::LeaveIfError( aItem.GetNextString( eventString )); + + CMdEEventDef& evdef = iNamespaceDefArray[0]->GetEventDefL( eventString ); + + delete iQuery; + iQuery = NULL; + iQuery = iMdeSession->NewEventQueryL( *iNamespaceDefArray[0], this ); + iQuery->SetResultMode( EQueryResultModeId ); + iQueryRoot = &iQuery->Conditions(); + iQueryRoot->AddEventConditionL( evdef ); + iQuery->FindL(1); + + return KErrNone; + } + +_LIT(KAND , "AND"); +_LIT(KOR , "OR"); + +// ----------------------------------------------------------------------------- +// CMdETestScripter::NewLogicConditionL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::NewLogicConditionL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + TPtrC logicOperator; + User::LeaveIfError( aItem.GetNextString( logicOperator )); + TLogicConditionOperator logCondOperator = ELogicConditionOperatorAnd; + if ( logicOperator.Compare( KAND ) == 0) + { + logCondOperator = ELogicConditionOperatorAnd; + } + else if ( logicOperator.Compare( KOR ) == 0) + { + logCondOperator = ELogicConditionOperatorOr; + } + else + { + User::Leave( KErrArgument ); + } + CMdELogicCondition* condition = CMdELogicCondition::NewL( logCondOperator ); + iLogicConditionArray.Append( condition ); + AppendNameL( iEventConditionNameArray, name ); + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RightL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RightL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + CMdERelationCondition* relationCond = SanitizeArrayIndexL( + iRelationConditionArray, *iRelationConditionNameArray, aItem ); + CMdELogicCondition* rightCond = &relationCond->RightL(); + iLogicConditionArray.Append( rightCond ); + AppendNameL( iLogicConditionNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::LeftL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::LeftL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + CMdERelationCondition* relationCond = SanitizeArrayIndexL( + iRelationConditionArray, *iRelationConditionNameArray, aItem ); + CMdELogicCondition* leftCond = &relationCond->LeftL(); + iLogicConditionArray.Append( leftCond ); + AppendNameL( iLogicConditionNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetOperatorL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetOperatorL( CStifItemParser& aItem ) + { + CMdELogicCondition* logicCondition = SanitizeArrayIndexL( iLogicConditionArray, *iLogicConditionNameArray, aItem ); + TInt logicalOperator; + User::LeaveIfError( aItem.GetNextInt( logicalOperator )); + logicCondition->SetOperator( ( TLogicConditionOperator )logicalOperator ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetNegateL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetNegateL( CStifItemParser& aItem ) + { + CMdEPropertyCondition* condition = SanitizeArrayIndexL( iPropertyConditionArray, *iPropertyConditionNameArray, aItem ); + TInt boolean; + User::LeaveIfError( aItem.GetNextInt( boolean )); + ((CMdECondition *)condition)->SetNegate( boolean ); + return KErrNone; + } + + + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddLogicConditionL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddLogicConditionL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + CMdELogicCondition* logicCondition = SanitizeArrayIndexL( iLogicConditionArray, *iLogicConditionNameArray, aItem ); + + TPtrC logicOperator; + User::LeaveIfError( aItem.GetNextString( logicOperator )); + TLogicConditionOperator logCondOperator = ELogicConditionOperatorAnd; + if ( logicOperator.Compare( KAND ) == 0) + { + logCondOperator = ELogicConditionOperatorAnd; + } + else if ( logicOperator.Compare( KOR ) == 0) + { + logCondOperator = ELogicConditionOperatorOr; + } + else + { + User::Leave( KErrArgument ); + } + CMdELogicCondition* condition = &logicCondition->AddLogicConditionL( logCondOperator ); + iLogicConditionArray.Append( condition ); + AppendNameL( iLogicConditionNameArray, name ); + return KErrNone; + } + + + _LIT(KRelationDef, "RelationDef"); + _LIT(KRelationDefRange, "RelationDefRange"); + + _LIT(KAny, "Any"); + _LIT(KEqual, "Equal"); + _LIT(KNotEqual, "NotEqual"); + _LIT(KLess, "Less"); + _LIT(KLessOrEqual, "LessOrEqual"); + _LIT(KGreater, "Greater"); + _LIT(KGreaterOrEqual, "GreaterOrEqual"); + _LIT(KBetween, "Between"); + _LIT(KNotBetween, "NotBetween"); + + _LIT(KObject , "Object"); + _LIT(KObjectDef , "ObjectDef"); + _LIT(KGuid , "Guid"); + + _LIT(KNone , "None"); + _LIT(KId , "Id"); + _LIT(KIds , "Ids"); + _LIT(KUri , "Uri"); + _LIT(KUriBeginsWith , "UriBeginsWith"); + _LIT(KFreeText , "FreeText"); + _LIT(KFreeTextContains , "FreeTextContains"); + _LIT(KFreeTextBeginsWith , "FreeTextBeginsWith"); + _LIT(KFreeTextEndsWith , "FreeTextEndsWith"); + _LIT(KFreeTextUsageCount , "FreeTextUsageCount"); + + + _LIT(KCount , "Count"); + _LIT(KItem , "Item"); + _LIT(KDistinctValues , "DistinctValues"); + _LIT(KObjectWithFreetexts , "ObjectWithFreetexts"); + + + +TQueryResultMode CMdETestScripter::ResultModeL(TDesC& aModeString) + { + TQueryResultMode modeEnum = EQueryResultModeId; + if ( aModeString.Compare( KId ) == 0 ) + { + modeEnum = EQueryResultModeId; + } + else if ( aModeString.Compare( KItem ) == 0 ) + { + modeEnum = EQueryResultModeItem; + } + else if ( aModeString.Compare( KCount ) == 0 ) + { + modeEnum = EQueryResultModeCount; + } + else if ( aModeString.Compare( KDistinctValues ) == 0 ) + { + modeEnum = EQueryResultModeDistinctValues; + } + else if ( aModeString.Compare( KObjectWithFreetexts ) == 0 ) + { + modeEnum = EQueryResultModeObjectWithFreetexts; + } + else + { + User::Leave( KErrArgument ); + } + return modeEnum; + } + + +CMdERelationDef& CMdETestScripter::GetRelationDefStrL( CStifItemParser& aItem ) + { + TPtrC relationDefStr; + User::LeaveIfError( aItem.GetNextString( relationDefStr )); + TLex lex( relationDefStr ); + TInt integer; + TInt err = lex.Val( integer ); + if ( err == KErrGeneral ) + { + return iNamespaceDefArray[0]->GetRelationDefL( relationDefStr ); + } + else + { + return *iRelationDefArray[ integer ]; + } + } + +TInt CMdETestScripter::GetObjectDefIndexL( CStifItemParser& aItem ) + { + TPtrC objectDefStr; + User::LeaveIfError( aItem.GetNextString( objectDefStr )); + TLex lex( objectDefStr ); + TInt integer; + TInt err = lex.Val( integer ); + if ( err == KErrGeneral ) + { + if ( objectDefStr.Compare( _L("}")) == 0) + { + return KErrCompletion; // indictes end of list + } + for ( TInt i = 0; i < iObjectDefNameArray->Count(); i++) + { + if ( objectDefStr.Compare( (*iObjectDefNameArray)[i] ) == 0 ) + { + return i; + } + } + return KErrNotFound; + } + else + { + return integer ; + } + } + +TInt CMdETestScripter::GetRelationDefIndexL( CStifItemParser& aItem ) + { + TPtrC relationDefStr; + User::LeaveIfError( aItem.GetNextString( relationDefStr )); + TLex lex( relationDefStr ); + TInt integer; + TInt err = lex.Val( integer ); + if ( err == KErrGeneral ) + { + for ( TInt i = 0; i < iRelationDefNameArray->Count(); i++) + { + if ( relationDefStr.Compare( (*iRelationDefNameArray)[i] ) == 0 ) + { + return i; + } + } + return KErrNotFound; + } + else + { + return integer ; + } + } + +TInt CMdETestScripter::GetEventDefIndexL( CStifItemParser& aItem ) + { + TPtrC eventDefStr; + User::LeaveIfError( aItem.GetNextString( eventDefStr )); + TLex lex( eventDefStr ); + TInt integer; + TInt err = lex.Val( integer ); + if ( err == KErrGeneral ) + { + for ( TInt i = 0; i < iEventDefNameArray->Count(); i++) + { + if ( eventDefStr.Compare( (*iEventDefNameArray)[i] ) == 0 ) + { + return i; + } + } + return KErrNotFound; + } + else + { + return integer ; + } + } + +TInt CMdETestScripter::GetObjectIndexL( CStifItemParser& aItem ) + { + TPtrC objectStr; + User::LeaveIfError( aItem.GetNextString( objectStr )); + TLex lex( objectStr ); + TInt integer; + TInt err = lex.Val( integer ); + if ( err == KErrGeneral ) + { + if ( objectStr.Compare( _L("}")) == 0) + { + return KErrCompletion; // indictes end of list + } + for ( TInt i = 0; i < iObjectNameArray->Count(); i++) + { + if ( objectStr.Compare( (*iObjectNameArray)[i] ) == 0 ) + { + return i; + } + } + return KErrNotFound; + } + else + { + return integer ; + } + } + + +TInt CMdETestScripter::GetEventIndexL( CStifItemParser& aItem ) + { + TPtrC eventStr; + User::LeaveIfError( aItem.GetNextString( eventStr )); + TLex lex( eventStr ); + TInt integer; + TInt err = lex.Val( integer ); + if ( err == KErrGeneral ) + { + if ( eventStr.Compare( _L("}")) == 0) + { + return KErrCompletion; // indictes end of list + } + for ( TInt i = 0; i < iEventNameArray->Count(); i++) + { + if ( eventStr.Compare( (*iEventNameArray)[i] ) == 0 ) + { + return i; + } + } + return KErrNotFound; + } + else + { + return integer ; + } + } + +TInt CMdETestScripter::GetRelationIndexL( CStifItemParser& aItem ) + { + TPtrC relationStr; + User::LeaveIfError( aItem.GetNextString( relationStr )); + TLex lex( relationStr ); + TInt integer; + TInt err = lex.Val( integer ); + if ( err == KErrGeneral ) + { + if ( relationStr.Compare( _L("}")) == 0) + { + return KErrCompletion; // indictes end of list + } + for ( TInt i = 0; i < iRelationNameArray->Count(); i++) + { + if ( relationStr.Compare( (*iRelationNameArray)[i] ) == 0 ) + { + return i; + } + } + return KErrNotFound; + } + else + { + return integer ; + } + } + +TInt CMdETestScripter::GetLogicConditionIndexL( CStifItemParser& aItem ) + { + TPtrC logicConditionStr; + User::LeaveIfError( aItem.GetNextString( logicConditionStr )); + TLex lex( logicConditionStr ); + TInt integer; + TInt err = lex.Val( integer ); + if ( err == KErrGeneral ) + { + for ( TInt i = 0; i < iLogicConditionNameArray->Count(); i++) + { + if ( logicConditionStr.Compare( (*iLogicConditionNameArray)[i] ) == 0 ) + { + return i; + } + } + return KErrNotFound; + } + else + { + return integer ; + } + } + + +TInt CMdETestScripter::GetRelationConditionIndexL( CStifItemParser& aItem ) + { + TPtrC relationConditionStr; + User::LeaveIfError( aItem.GetNextString( relationConditionStr )); + TLex lex( relationConditionStr ); + TInt integer; + TInt err = lex.Val( integer ); + if ( err == KErrGeneral ) + { + for ( TInt i = 0; i < iRelationConditionNameArray->Count(); i++) + { + if ( relationConditionStr.Compare( (*iRelationConditionNameArray)[i] ) == 0 ) + { + return i; + } + } + return KErrNotFound; + } + else + { + return integer ; + } + } + + + +TInt CMdETestScripter::GetPropertyDefIndexL( CStifItemParser& aItem ) + { + TPtrC propertyDefStr; + User::LeaveIfError( aItem.GetNextString( propertyDefStr )); + TLex lex( propertyDefStr ); + TInt integer; + TInt err = lex.Val( integer ); + if ( err == KErrGeneral ) + { + if ( propertyDefStr.Compare( _L("}")) == 0) + { + return KErrCompletion; // indictes end of list + } + for ( TInt i = 0; i < iPropertyDefNameArray->Count(); i++) + { + if ( propertyDefStr.Compare( (*iPropertyDefNameArray)[i] ) == 0 ) + { + return i; + } + } + return KErrNotFound; + } + else + { + return integer ; + } + } + +TInt CMdETestScripter::GetPropertyIndexL( CStifItemParser& aItem ) + { + TPtrC propertyStr; + User::LeaveIfError( aItem.GetNextString( propertyStr )); + TLex lex( propertyStr ); + TInt integer; + TInt err = lex.Val( integer ); + if ( err == KErrGeneral ) + { + for ( TInt i = 0; i < iPropertyNameArray->Count(); i++) + { + if ( propertyStr.Compare( (*iPropertyNameArray)[i] ) == 0 ) + { + return i; + } + } + return KErrNotFound; + } + else + { + return integer ; + } + } + + +CMdEObjectDef& CMdETestScripter::GetObjectDefStrL( CStifItemParser& aItem ) + { + TPtrC objectDefStr; + User::LeaveIfError( aItem.GetNextString( objectDefStr )); + TLex lex( objectDefStr ); + TInt integer; + TInt err = lex.Val( integer ); + if ( err == KErrGeneral ) + { + return iNamespaceDefArray[0]->GetObjectDefL( objectDefStr ); + } + else + { + return *iObjectDefArray[ integer ]; + } + } + +TObjectConditionCompareMethod CMdETestScripter::CompareMethodL(TDesC& aMethodString) + { + TObjectConditionCompareMethod methodEnum = EObjectConditionCompareNone; + if ( aMethodString.Compare( KNone ) == 0 ) + { + methodEnum = EObjectConditionCompareNone; + } + else if ( aMethodString.Compare( KId ) == 0 ) + { + methodEnum = EObjectConditionCompareId; + } + else if ( aMethodString.Compare( KIds ) == 0 ) + { + methodEnum = EObjectConditionCompareIds; + } + else if ( aMethodString.Compare( KGuid ) == 0 ) + { + methodEnum = EObjectConditionCompareGuid; + } + else if ( aMethodString.Compare( KObjectDef ) == 0 ) + { + methodEnum = EObjectConditionCompareObjectDef; + } + else if ( aMethodString.Compare( KUri ) == 0 ) + { + methodEnum = EObjectConditionCompareUri; + } + else if ( aMethodString.Compare( KUriBeginsWith ) == 0 ) + { + methodEnum = EObjectConditionCompareUriBeginsWith; + } + else if ( aMethodString.Compare( KFreeText ) == 0 ) + { + methodEnum = EObjectConditionCompareFreeText; + } + else if ( aMethodString.Compare( KFreeTextContains ) == 0 ) + { + methodEnum = EObjectConditionCompareFreeTextContains; + } + else if ( aMethodString.Compare( KFreeTextBeginsWith ) == 0 ) + { + methodEnum = EObjectConditionCompareFreeTextBeginsWith; + } + else if ( aMethodString.Compare( KFreeTextEndsWith ) == 0 ) + { + methodEnum = EObjectConditionCompareFreeTextEndsWith; + } + else if ( aMethodString.Compare( KFreeTextUsageCount ) == 0 ) + { + methodEnum = EObjectConditionCompareUsageCount; + } + else + { + User::Leave( KErrArgument ); + } + return methodEnum; + } + + +TMdERangeType CMdETestScripter::RangeTypeL(TDesC& aTypeString) + { + TMdERangeType rangeType = EMdERangeTypeAny; + if ( aTypeString.Compare( KAny ) == 0 ) + { + rangeType = EMdERangeTypeAny; + } + else if ( aTypeString.Compare( KEqual ) == 0 ) + { + rangeType = EMdERangeTypeEqual; + } + else if ( aTypeString.Compare( KNotEqual ) == 0 ) + { + rangeType = EMdERangeTypeNotEqual; + } + else if ( aTypeString.Compare( KLess ) == 0 ) + { + rangeType = EMdERangeTypeLess; + } + else if ( aTypeString.Compare( KLessOrEqual ) == 0 ) + { + rangeType = EMdERangeTypeLessOrEqual; + } + else if ( aTypeString.Compare( KGreater ) == 0 ) + { + rangeType = EMdERangeTypeGreater; + } + else if ( aTypeString.Compare( KGreaterOrEqual ) == 0 ) + { + rangeType = EMdERangeTypeGreaterOrEqual; + } + else if ( aTypeString.Compare( KBetween ) == 0 ) + { + rangeType = EMdERangeTypeBetween; + } + else if ( aTypeString.Compare( KNotBetween ) == 0 ) + { + rangeType = EMdERangeTypeNotBetween; + } + else + { + User::Leave( KErrArgument ); + } + return rangeType; + } + + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddObjectConditionL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddObjectConditionL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + CMdEObjectCondition* newObjectCondition = NULL; + + + CMdELogicCondition* logicCondition = SanitizeArrayIndexL( iLogicConditionArray, *iLogicConditionNameArray, aItem ); + +#if 0 + logicConditionIndex = GetLogicConditionIndexL( aItem ); + CMdELogicCondition* logicCondition; + if ( logicConditionIndex >= 0 ) + { + logicCondition = iLogicConditionArray[ logicConditionIndex ]; + } + else if ( logicConditionIndex == KRootCond ) + { + logicCondition = &iQuery->Conditions(); + } + else + { + User::Leave( logicConditionIndex ); + } + +#endif + + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + + _LIT(KObjectConditionCompare , "ObjectConditionCompare"); + + _LIT(KRange , "Range"); + + if ( type.Compare( KObject ) == 0) + { + TInt firstIndex = GetObjectIndexL( aItem ); + TInt objectCount; + User::LeaveIfError( aItem.GetNextInt( objectCount )); + if ( objectCount == 1 ) + { + newObjectCondition = &logicCondition->AddObjectConditionL( iObjectArray[ firstIndex ]->Id() ); + } + else + { + RArray objectIdArray; + for ( TInt i = firstIndex ; i < firstIndex + objectCount ; i++ ) + { + objectIdArray.Append( iObjectArray[ i ]->Id() ); + } + newObjectCondition = &logicCondition->AddObjectConditionL( objectIdArray ); + objectIdArray.Reset(); + } + } + else if ( type.Compare( KObjectDef ) == 0 ) + { + newObjectCondition = &logicCondition->AddObjectConditionL( GetObjectDefStrL( aItem ) ); + } + else if ( type.Compare( KGuid ) == 0 ) + { + TInt guidHigh; + TInt guidLow; + TInt64 guidHigh64; + TInt64 guidLow64; + User::LeaveIfError( aItem.GetNextInt( guidHigh )); + guidHigh64 = guidHigh; + User::LeaveIfError( aItem.GetNextInt( guidLow )); + guidLow64 = guidLow; + newObjectCondition = &logicCondition->AddObjectConditionL( guidHigh64, guidLow64 ); + } + else if ( type.Compare( KObjectConditionCompare ) == 0 ) + { + TPtrC method; + User::LeaveIfError( aItem.GetNextString( method )); + TObjectConditionCompareMethod methodEnum = CompareMethodL( method ); + + TPtrC string; + User::LeaveIfError( aItem.GetNextString( string )); + if ( methodEnum == EObjectConditionCompareId ) + { + TLex lex( string ); + TInt integer; + TInt err = lex.Val( integer ); + if ( err == KErrGeneral ) + { // string is not a number so it should be a object name + for ( TInt i = 0; i < iObjectNameArray->Count(); i++) + { + if ( string.Compare( (*iObjectNameArray)[i] ) == 0 ) + { + TBuf<20> objIdString; + objIdString.Num(iObjectArray[i]->Id()); + newObjectCondition = &logicCondition->AddObjectConditionL( + EObjectConditionCompareId, + objIdString ); + break; + } + } + } + } + else + { + newObjectCondition = &logicCondition->AddObjectConditionL( + methodEnum, + string); + } + } + else if ( type.Compare( KRange ) == 0 ) + { + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + TMdERangeType rangeType = RangeTypeL( type ); + + TInt min; + User::LeaveIfError( aItem.GetNextInt( min ) ); + TInt max; + User::LeaveIfError( aItem.GetNextInt( max ) ); + newObjectCondition = &logicCondition->AddObjectConditionL( TMdEUintRange(min, max, rangeType)); + } + else + { + User::Leave( KErrArgument ); + } + iObjectConditionArray.Append( newObjectCondition ); + AppendNameL( iObjectConditionNameArray, name ); + + return KErrNone; + } + + +_LIT(KTimeRange, "TimeRange"); + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddPropertyConditionL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddPropertyConditionL( CStifItemParser& aItem ) + { + + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + CMdELogicCondition* logicCondition = SanitizeArrayIndexL( iLogicConditionArray, *iLogicConditionNameArray, aItem ); + + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem); + + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + _LIT(KPropCond, "PropCond"); + _LIT(KBool, "Bool"); + _LIT(KIntRange, "IntRange"); + _LIT(KInt64Range, "Int64Range"); + _LIT(KUintRange, "UintRange"); + _LIT(KRealRange, "RealRange"); + + _LIT(KTextCompare, "TextCompare"); + _LIT(KEquals, "Equals"); + _LIT(KContains, "Contains"); + _LIT(KBeginsWith, "BeginsWith"); + _LIT(KEndsWith, "EndsWith"); + + CMdEPropertyCondition* propertyCondition = NULL; + if (type.Compare( KPropCond ) == 0) + { + + propertyCondition = &logicCondition->AddPropertyConditionL( *propertyDef ); + } + else if (type.Compare( KBool ) == 0) + { + TInt boolean; + User::LeaveIfError( aItem.GetNextInt( boolean ) ); + } + else if (type.Compare( KIntRange ) == 0) + { + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + TMdERangeType rangeType = RangeTypeL( type ); + + TInt min; + User::LeaveIfError( aItem.GetNextInt( min ) ); + TInt max; + User::LeaveIfError( aItem.GetNextInt( max ) ); + propertyCondition = &logicCondition->AddPropertyConditionL( *propertyDef, TMdEIntRange( min, max, rangeType ) ); + } + else if (type.Compare( KInt64Range ) == 0) + { + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + TMdERangeType rangeType = RangeTypeL( type ); + + TInt min; + User::LeaveIfError( aItem.GetNextInt( min ) ); + TInt64 min64 = min ; + TInt max; + User::LeaveIfError( aItem.GetNextInt( max ) ); + TInt64 max64 = max ; + propertyCondition = &logicCondition->AddPropertyConditionL( *propertyDef, TMdEInt64Range( min64, max64, rangeType ) ); + } + else if (type.Compare( KUintRange ) == 0) + { + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + TMdERangeType rangeType = RangeTypeL( type ); + + TUint min; + User::LeaveIfError( aItem.GetNextInt( min ) ); + TUint max; + User::LeaveIfError( aItem.GetNextInt( max ) ); + propertyCondition = &logicCondition->AddPropertyConditionL( *propertyDef, TMdEUintRange( min, max, rangeType ) ); + } + else if (type.Compare( KRealRange ) == 0) + { + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + + TMdERangeType rangeType = RangeTypeL( type ); + + TReal min; + TPtrC minStr; + User::LeaveIfError( aItem.GetNextString( minStr ) ); + TLex lex( minStr ); + lex.Val( min ); + + TReal max; + TPtrC maxStr; + User::LeaveIfError( aItem.GetNextString( maxStr ) ); + lex.Assign( maxStr ); + lex.Val( max ); + + propertyCondition = &logicCondition->AddPropertyConditionL( *propertyDef, TMdEIntRange( min, max, rangeType ) ); + } + else if (type.Compare( KTimeRange ) == 0) + { + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + + TMdERangeType rangeType = RangeTypeL( type ); + + TTime min; + TPtrC minStr; + User::LeaveIfError( aItem.GetNextString( minStr ) ); + min.Set( minStr ); + + TTime max; + TPtrC maxStr; + User::LeaveIfError( aItem.GetNextString( maxStr ) ); + max.Set( maxStr ); + + + propertyCondition = &logicCondition->AddPropertyConditionL( *propertyDef, TMdETimeRange( min, max, rangeType ) ); + } + else if (type.Compare( KTextCompare ) == 0) + { + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + TTextPropertyConditionCompareMethod compareMethod = ETextPropertyConditionCompareEquals; + if (type.Compare( KEquals ) == 0) + { + compareMethod = ETextPropertyConditionCompareEquals; + } + else if (type.Compare( KContains ) == 0) + { + compareMethod = ETextPropertyConditionCompareContains; + } + else if (type.Compare( KBeginsWith ) == 0) + { + compareMethod = ETextPropertyConditionCompareBeginsWith; + } + else if (type.Compare( KEndsWith ) == 0) + { + compareMethod = ETextPropertyConditionCompareEndsWith; + } + else + { + User::Leave( KErrArgument ); + } + TPtrC text; + User::LeaveIfError( aItem.GetNextString( text ) ); + propertyCondition = &logicCondition->AddPropertyConditionL( + *propertyDef, + compareMethod, + text); + } + else + { + User::Leave( KErrArgument ); + } + + iPropertyConditionArray.Append( propertyCondition ); + + AppendNameL(iPropertyConditionNameArray, name ); + return KErrNone; + } + + +_LIT(KTimeAndEventCompare, "TimeAndEventCompare"); + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddRelationConditionL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddRelationConditionL( CStifItemParser& aItem ) + { + _LIT(KRelationId, "RelationId"); + _LIT(KLeft, "Left"); + _LIT(KRight, "Right"); + _LIT(KEither, "Either"); + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + CMdELogicCondition* logicCondition = SanitizeArrayIndexL( iLogicConditionArray, *iLogicConditionNameArray, aItem ); + +#if 0 + TInt logicConditionIndex = GetLogicConditionIndexL( aItem ); + CMdELogicCondition* logicCondition; + if ( logicConditionIndex >= 0 ) + { + logicCondition = iLogicConditionArray[ logicConditionIndex ]; + } + else if ( logicConditionIndex == KRootCond ) + { + logicCondition = &iQuery->Conditions(); + } + else + { + User::Leave( logicConditionIndex ); + } +#endif + + CMdERelationCondition* newRelation = NULL; + + TPtrC side; + User::LeaveIfError( aItem.GetNextString( side )); + TRelationConditionSide condSide = ERelationConditionSideEither; + if (side.Compare( KLeft ) == 0) + { + condSide = ERelationConditionSideLeft; + } + else if (side.Compare( KRight ) == 0) + { + condSide = ERelationConditionSideRight; + } + else if (side.Compare( KEither ) == 0) + { + condSide = ERelationConditionSideEither; + } + else + { + User::Leave( KErrArgument ); + } + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + if (type.Compare( KRelationId ) == 0) + { + TInt id; + + TInt relationIdCount; + User::LeaveIfError( aItem.GetNextInt( relationIdCount )); + if ( relationIdCount == 1 ) + { + User::LeaveIfError( aItem.GetNextInt( id ) ); + newRelation = &logicCondition->AddRelationConditionL( TItemId ( id ) , condSide); + } + else + { + RArray relationIdArray; + for ( TInt i = 0 ; i < relationIdCount ; i++ ) + { + aItem.GetNextInt( id ); + relationIdArray.Append( TItemId ( id )); + } + newRelation = &logicCondition->AddRelationConditionL( TItemId ( id ), condSide ); + relationIdArray.Reset(); + } + + } + else if ( type.Compare( KRelationDef ) == 0) + { + CMdERelationDef& relationDef = GetRelationDefStrL( aItem ); + newRelation = &logicCondition->AddRelationConditionL( relationDef, condSide ); + } + else if (type.Compare( KRelationDefRange ) == 0) + { + CMdERelationDef& relationDef = GetRelationDefStrL( aItem ); + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + TMdERangeType rangeType = RangeTypeL( type ); + + TInt min; + User::LeaveIfError( aItem.GetNextInt( min ) ); + TInt max; + User::LeaveIfError( aItem.GetNextInt( max ) ); + + newRelation = &logicCondition->AddRelationConditionL( relationDef, + TMdEIntRange( min, max, rangeType ), condSide ); + } + else + { + User::Leave( KErrArgument ); + } + + iRelationConditionArray.Append( newRelation ); + AppendNameL( iRelationConditionNameArray, name ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddEventConditionL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddEventConditionL( CStifItemParser& aItem ) + { + _LIT(KEventId, "EventId"); + _LIT(KNoParam, "NoParam"); + _LIT(KEventDef, "EventDef"); + _LIT(KEventCompare, "EventCompare"); + + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + CMdEEventCondition* newEvent = NULL; + + TInt logicConditionIndex = GetLogicConditionIndexL( aItem ); + CMdELogicCondition* logicCondition = NULL; + if ( logicConditionIndex >= 0 ) + { + logicCondition = iLogicConditionArray[ logicConditionIndex ]; + } + else if ( logicConditionIndex == KRootCond ) + { + logicCondition = &iQuery->Conditions(); + } + else + { + User::Leave( logicConditionIndex ); + } + + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + if (type.Compare( KNoParam ) == 0) + { + logicCondition->AddEventConditionL(); + } + else if (type.Compare( KEventId ) == 0) + { + TInt id; + User::LeaveIfError( aItem.GetNextInt( id ) ); + newEvent = &logicCondition->AddEventConditionL( TItemId(id) ); + } + else if (type.Compare( KEventDef ) == 0) + { + TPtrC eventString; + User::LeaveIfError( aItem.GetNextString( eventString )); + + CMdEEventDef& evdef = iNamespaceDefArray[0]->GetEventDefL( eventString ); + newEvent = &logicCondition->AddEventConditionL( evdef ); + } + else if (type.Compare( KTimeRange ) == 0) + { + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + + TMdERangeType rangeType = RangeTypeL( type ); + + TInt64 min; + TPtrC minStr; + User::LeaveIfError( aItem.GetNextString( minStr ) ); + TLex lex( minStr ); + lex.Val( min ); + + TInt64 max; + TPtrC maxStr; + User::LeaveIfError( aItem.GetNextString( maxStr ) ); + lex.Assign( maxStr ); + lex.Val( max ); + + newEvent = &logicCondition->AddEventConditionL( TMdETimeRange( min, max, rangeType ) ); + } + else if (type.Compare( KEventCompare ) == 0) + { + + + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + + _LIT( KNone, "None"); + _LIT( KSourceURI, "SourceURI"); + _LIT( KParticipantURI, "ParticipantURI"); + _LIT( KId, "Id"); + + TEventConditionCompareMethod compareMethod = EEventConditionCompareNone; + if (type.Compare( KNone ) == 0) + { + compareMethod = EEventConditionCompareNone; + } + else if (type.Compare( KSourceURI ) == 0) + { + compareMethod = EEventConditionCompareSourceURI; + } + else if (type.Compare( KParticipantURI ) == 0) + { + compareMethod = EEventConditionCompareParticipantURI; + } + else if (type.Compare( KId ) == 0) + { + compareMethod = EEventConditionCompareId; + } + else + { + User::Leave( KErrArgument ); + } + + TPtrC text; + User::LeaveIfError( aItem.GetNextString( text ) ); + newEvent = &logicCondition->AddEventConditionL( compareMethod, text ); + } + else if (type.Compare( KTimeAndEventCompare ) == 0) + { + + _LIT( KNone, "None"); + _LIT( KSourceURI, "SourceURI"); + _LIT( KParticipantURI, "ParticipantURI"); + _LIT( KId, "Id"); + + TPtrC type; + User::LeaveIfError( aItem.GetNextString( type )); + + TMdERangeType rangeType = RangeTypeL( type ); + + TInt64 min; + TPtrC minStr; + User::LeaveIfError( aItem.GetNextString( minStr ) ); + TLex lex( minStr ); + lex.Val( min ); + + TInt64 max; + TPtrC maxStr; + User::LeaveIfError( aItem.GetNextString( maxStr ) ); + lex.Assign( maxStr ); + lex.Val( max ); + + TEventConditionCompareMethod compareMethod = EEventConditionCompareNone; + if (type.Compare( KNone ) == 0) + { + compareMethod = EEventConditionCompareNone; + } + else if (type.Compare( KSourceURI ) == 0) + { + compareMethod = EEventConditionCompareSourceURI; + } + else if (type.Compare( KParticipantURI ) == 0) + { + compareMethod = EEventConditionCompareParticipantURI; + } + else if (type.Compare( KId ) == 0) + { + compareMethod = EEventConditionCompareId; + } + else + { + User::Leave( KErrArgument ); + } + + TPtrC text; + User::LeaveIfError( aItem.GetNextString( text ) ); + newEvent = &logicCondition->AddEventConditionL( TMdETimeRange( min, max, rangeType ), + compareMethod, text ); + } + + AppendNameL( iEventConditionNameArray , name ); + iEventConditionArray.AppendL( newEvent ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ObjectConditionsL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::ObjectConditionsL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + CMdEEventCondition* eventCondition = SanitizeArrayIndexL( iEventConditionArray, *iEventConditionNameArray, aItem ); + CMdELogicCondition& objectConditions = eventCondition->ObjectConditionsL(); + AppendNameL( iLogicConditionNameArray , name ); + iLogicConditionArray.AppendL( &objectConditions ); + return KErrNone; + } + +#if 0 + +void CMdETestScripter::HandleQueryCompleted(CMdEQuery& aQuery, TInt aError) + { + TBuf<128> buf; + + Signal(); + + if (aQuery.Type() == EQueryTypeObject) + { + iLog->Log(_L("Object query completed notification: Error=%d"), aError); + + TQueryResultMode mode = aQuery.ResultMode(); + if ( mode == EQueryResultModeItem ) + { + TInt cou = aQuery.Count(); + + buf.Format(_L(" EModeItem, results=%d"), cou); + iLog->Log(buf); + + for( TInt i = 0; i < cou; i++ ) + { + const TInt64 rid = (TInt64)aQuery.ResultItem( i ).Id(); + buf.Format(_L(" Id %d = %Ld"), i, rid); + iLog->Log(buf); + } + } + else if ( mode == EQueryResultModeId ) + { + TInt cou = aQuery.Count(); + + buf.Format(_L(" EModeId, results=%d"), cou); + iLog->Log(buf); + TInt i; + TInt64 rid; + RArray ridArray; + for( i = 0; i < cou; i++ ) + { + rid = (TInt64)aQuery.ResultId( i ); + ridArray.Append( rid ); + } + + for( i = cou; --i >= 0; ) + { + for( TInt j = iResultIndices.Count(); --j >= 0 ; ) + { + if ( iObjectArray[ iResultIndices[j]]->Id() == ridArray[i] ) + { // matching result + iResultIndices.Remove( j ); + ridArray.Remove( i ); + } + } + } + + if ( iResultIndices.Count() != 0 || iObjectArray.Count() != 0 ) + { + _LIT( KTestMessage1, "Not expected object query result" ); + iLog->Log( KTestMessage1 ); + return; + } + } + else if ( mode == EQueryResultModeCount ) + { + TInt cou = aQuery.Count(); + buf.Format(_L(" EModeCount, results=%d"), cou); + iLog->Log(buf); + } + } + else if (aQuery.Type() == EQueryTypeRelation) + { + iLog->Log(_L("Relation query completed notification: Error=%d"), aError); + + TInt cou = aQuery.Count(); + + buf.Format(_L(" results=%d"), cou); + iLog->Log(buf); + } + else if (aQuery.Type() == EQueryTypeEvent) + { + iLog->Log(_L("Event query completed notification: Error=%d"), aError); + + TInt cou = aQuery.Count(); + + buf.Format(_L(" results=%d"), cou); + iLog->Log(buf); + } + else + { + _LIT( KTestMessage2, "Query completed notification of unknown query" ); + iLog->Log( KTestMessage2 ); + } + } + +#else + +void CMdETestScripter::HandleQueryCompleted(CMdEQuery& aQuery, TInt /* aError */ ) + { + TBuf<128> buf; + + Signal(); + + RArray expectedIdArray; + RArray resultIdArray; + + if (aQuery.Type() == EQueryTypeObject) + { + for( TInt j = iResultIndices.Count(); --j >= 0 ; ) + { + expectedIdArray.Append( iObjectArray[ iResultIndices[j]]->Id() ); + } + } + else if (aQuery.Type() == EQueryTypeRelation) + { + for( TInt j = iResultIndices.Count(); --j >= 0 ; ) + { + expectedIdArray.Append( iRelationArray[ iResultIndices[j]]->Id() ); + } + } + else if (aQuery.Type() == EQueryTypeEvent) + { + for( TInt j = iResultIndices.Count(); --j >= 0 ; ) + { + expectedIdArray.Append( iEventArray[ iResultIndices[j]]->Id() ); + } + } + else + { + _LIT( KTestMessage3, "Query completed notification of unknown query" ); + iLog->Log( KTestMessage3 ); + } + + TQueryResultMode mode = aQuery.ResultMode(); + if ( mode == EQueryResultModeCount ) + { + if (aQuery.Count() != iResultIndices.Count()) + { + _LIT( KTestMessage4, "Not expected query result count" ); + iLog->Log( KTestMessage4 ); + expectedIdArray.Reset(); + return; + } + } + else + { + for (TInt i = 0; i < aQuery.Count(); i++) + { + if (aQuery.ResultMode() == EQueryResultModeId) + { + _LIT(KFormat3,"ID: %Ld"); + const TInt64 id = (TInt64)aQuery.ResultId(i); + resultIdArray.Append( id ); + iLog->Log(KFormat3, id); + } + else if (aQuery.ResultMode() == EQueryResultModeItem + || aQuery.ResultMode() == EQueryResultModeObjectWithFreetexts) + { + switch( aQuery.Type() ) + { + case EQueryTypeObject: + { + _LIT(KFormat5o,"Object ID: %Ld URI: '%S' Def: '%S' Properties: %d Freetexts: %d UsageCount: %d"); + + CMdEObject& obj = (CMdEObject&)aQuery.ResultItem(i); + const TInt64 objId = (TInt64)obj.Id(); + resultIdArray.Append( objId ); + iLog->Log(KFormat5o, objId, &obj.Uri(), &obj.Def().Name(), obj.PropertyCount(), obj.FreeTextCount(), obj.UsageCount()); + } + break; + case EQueryTypeRelation: + { + _LIT(KFormat4r,"Relation ID: %Ld Def: '%S' Left ID: %Ld Right ID: %Ld Param: %d"); + + CMdERelation& rel = (CMdERelation&)aQuery.ResultItem(i); + const TInt64 relId = (TInt64)rel.Id(); + resultIdArray.Append( relId ); + const TInt64 relLId = (TInt64)rel.LeftObjectId(); + const TInt64 relRId = (TInt64)rel.RightObjectId(); + iLog->Log(KFormat4r, relId, &rel.Def().Name(), relLId, relRId, rel.Parameter()); + } + break; + case EQueryTypeEvent: + { + _LIT(KFormat4e,"Event ID: %Ld Def: '%S' Object ID: %Ld"); + + CMdEEvent& eve = (CMdEEvent&)aQuery.ResultItem(i); + const TInt64 eveId = (TInt64)eve.Id(); + resultIdArray.Append( eveId ); + const TInt64 eveOId = (TInt64)eve.ObjectId(); + iLog->Log(KFormat4e, eveId, &eve.Def().Name(), eveOId); + } + break; + } + } + else if (aQuery.ResultMode() == EQueryResultModeDistinctValues) + { + _LIT(KFormat5,"Found with text: "); + + buf = KFormat5; + buf.Append( aQuery.ResultDistinctValue(i) ); + iLog->Log( buf ); + } + } + + + if (aQuery.ResultMode() == EQueryResultModeId || aQuery.ResultMode() == EQueryResultModeItem + || aQuery.ResultMode() == EQueryResultModeObjectWithFreetexts ) + { + for(TInt i = resultIdArray.Count(); --i >= 0; ) + { + for( TInt j = expectedIdArray.Count(); --j >= 0 ; ) + { + if ( expectedIdArray[j] == resultIdArray[i] ) + { // matching result + expectedIdArray.Remove( j ); + resultIdArray.Remove( i ); + break; + } + } + } + + if ( expectedIdArray.Count() != 0 || resultIdArray.Count() != 0 ) + { + expectedIdArray.Reset(); + resultIdArray.Reset(); + _LIT( KTestMessage5, "Not expected object query result" ); + iLog->Log( KTestMessage5 ); + return; + } + } + } + } + +#endif + + + +TInt CMdETestScripter::SetEventQueryResultL( CStifItemParser& aItem ) + { + iResultIndices.Reset(); + TPtrC startMark; + User::LeaveIfError( aItem.GetNextString( startMark )); + TLex lex; + TPtrC indexStr; + TInt index; + + if ( startMark.Compare(_L("{")) == 0) + { + while( ETrue ) + { + index = GetEventIndexL( aItem ); + if ( index == KErrCompletion ) + { + break; + } + iResultIndices.Append( index ); + } + } + return KErrNone; + } + +TInt CMdETestScripter::SetRelationQueryResultL( CStifItemParser& aItem ) + { + iResultIndices.Reset(); + TPtrC startMark; + User::LeaveIfError( aItem.GetNextString( startMark )); + TLex lex; + TPtrC indexStr; + TInt index; + + if ( startMark.Compare(_L("{")) == 0) + { + while( ETrue ) + { + index = GetRelationIndexL( aItem ); + if ( index == KErrCompletion ) + { + break; + } + iResultIndices.Append( index ); + } + } + return KErrNone; + } + + +TInt CMdETestScripter::SetObjectQueryResultL( CStifItemParser& aItem ) + { + iResultIndices.Reset(); + TPtrC startMark; + User::LeaveIfError( aItem.GetNextString( startMark )); + TLex lex; + TPtrC indexStr; + TInt index; + + if ( startMark.Compare(_L("{")) == 0) + { + while( ETrue ) + { + index = GetObjectIndexL( aItem ); + if ( index == KErrCompletion ) + { + break; + } + iResultIndices.Append( index ); + } + } + return KErrNone; + } + + +// ----------------------------------------------------------------------------- +// CMdETestScripter::TestPopulateDbL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::TestPopulateDbL( CStifItemParser& /*aItem*/ ) + { + CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL(); + CMdEObjectDef& objectDef = namespaceDef.GetObjectDefL( MdeConstants::Album::KAlbumObject ); + CMdEObject* albumObject = iMdeSession->NewObjectL( + objectDef, MdeConstants::Object::KAutomaticUri ); + CMdEPropertyDef& creationDatePropertyDef = objectDef.GetPropertyDefL( MdeConstants::Object::KCreationDateProperty ); + TTime time( 0 ); + albumObject->AddTimePropertyL( creationDatePropertyDef, time ); + + CMdEPropertyDef& lastModifiedDatePropertyDef = objectDef.GetPropertyDefL( MdeConstants::Object::KLastModifiedDateProperty ); + + albumObject->AddTimePropertyL( lastModifiedDatePropertyDef, time ); + iMdeSession->AddObjectL( *albumObject ); + + CMdEObjectDef& audioObjectDef = namespaceDef.GetObjectDefL( MdeConstants::Audio::KAudioObject ); + CMdEObject* audioObject = iMdeSession->NewObjectL( + audioObjectDef, MdeConstants::Object::KAutomaticUri ); + + audioObject->AddTimePropertyL( creationDatePropertyDef, time ); + + audioObject->AddTimePropertyL( lastModifiedDatePropertyDef, time ); + iMdeSession->AddObjectL( *audioObject ); + CMdERelationDef& relationDef = namespaceDef.GetRelationDefL( MdeConstants::Relations::KContains ); + + CMdERelation* relation = iMdeSession->NewRelationL( relationDef, albumObject->Id(), audioObject->Id(), 0 ); + iMdeSession->AddRelationL( *relation ); + + CMdEObjectDef& objDef = namespaceDef.GetObjectDefL( MdeConstants::Object::KBaseObject ); + + delete iQuery; + iQuery = NULL; + iQuery = iMdeSession->NewObjectQueryL( namespaceDef, objDef, this ); + + CMdELogicCondition& rootCond = iQuery->Conditions(); + + CMdERelationDef& containsRelDef = namespaceDef.GetRelationDefL( + MdeConstants::Relations::KContains ); + + CMdERelationCondition& relCond = rootCond.AddRelationConditionL( + containsRelDef, ERelationConditionSideRight ); + CMdELogicCondition& leftRelCond = relCond.LeftL(); + + leftRelCond.AddObjectConditionL( albumObject->Id() ); + + iQuery->SetResultMode( EQueryResultModeId ); + + iQuery->FindL(); + return KErrNone; + } + diff -r fe894bb075c2 -r 79f826a55db2 mds_plat/metadata_engine_api/tsrc/src/MdETestScripterSchemaCommands.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mds_plat/metadata_engine_api/tsrc/src/MdETestScripterSchemaCommands.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,784 @@ +/* +* Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: ?Description +* +*/ + + +// [INCLUDE FILES] - do not remove +#include +#include +#include +#include +#include "MdETestScripter.h" + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddSchemaObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddSchemaObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->AddSchemaObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveSchemaObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveSchemaObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->RemoveSchemaObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddObjectObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddObjectObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->AddObjectObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveObjectObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveObjectObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->RemoveObjectObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddObjectObserverWithUriL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddObjectObserverWithUriL( CStifItemParser& /* aItem */ ) + { + iMdeSession->AddObjectObserverWithUriL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveObjectObserverWithUriL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveObjectObserverWithUriL( CStifItemParser& /* aItem */ ) + { + iMdeSession->RemoveObjectObserverWithUriL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddObjectPresentObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddObjectPresentObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->AddObjectPresentObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveObjectPresentObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveObjectPresentObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->RemoveObjectPresentObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddRelationObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddRelationObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->AddRelationObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveRelationObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveRelationObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->RemoveRelationObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddRelationItemObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddRelationItemObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->AddRelationItemObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveRelationItemObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveRelationItemObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->RemoveRelationItemObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddRelationPresentObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddRelationPresentObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->AddRelationPresentObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveRelationPresentObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveRelationPresentObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->RemoveRelationPresentObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::AddEventObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddEventObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->AddEventObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveEventObserverL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveEventObserverL( CStifItemParser& /* aItem */ ) + { + iMdeSession->RemoveEventObserverL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::VerifyTItemIdsL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::VerifyTItemIdsL( CStifItemParser& aItem ) + { + TInt mode; + TInt index; + TInt count; + + User::LeaveIfError( aItem.GetNextInt( mode )); + User::LeaveIfError( aItem.GetNextInt( index )); + User::LeaveIfError( aItem.GetNextInt( count )); + + if ( mode == EObject ) + { + CheckTItemIdArrayL( iNotificationItemIdArray, iObjectArray, index, count ); + } + else if ( mode == EEvent ) + { + CheckTItemIdArrayL( iNotificationItemIdArray, iEventArray, index, count ); + } + else if ( mode == ERelation ) + { + CheckTItemIdArrayL( iNotificationItemIdArray, iRelationArray, index, count ); + } + else + { + User::Leave( KErrArgument ); + } + + iNotificationItemIdArray.Reset(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::VerifyMdERelationsL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::VerifyMdERelationsL( CStifItemParser& aItem ) + { + TInt index; + TInt count; + + User::LeaveIfError( aItem.GetNextInt( index )); + User::LeaveIfError( aItem.GetNextInt( count )); + + CheckTMdERelationArrayL( iNotificationRelationArray, index, count ); + iNotificationRelationArray.Reset(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::VerifyObserverNotificationTypeL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::VerifyObserverNotificationTypeL( CStifItemParser& aItem ) + { + TInt type; + + User::LeaveIfError( aItem.GetNextInt( type )); + + TL( iNotificationType == type ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ParentL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::ParentL( CStifItemParser& aItem ) + { + CMdEObjectDef* objectDef = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem ); + CMdEObjectDef* parentDef = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem ); + TL( objectDef->ParentL() == parentDef ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::NameL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::NameL( CStifItemParser& aItem ) + { + TInt mode; + TPtrC name; + + User::LeaveIfError( aItem.GetNextInt( mode )); + if ( mode == EPropertyDef ) + { + CMdEPropertyDef* propDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + User::LeaveIfError( aItem.GetNextString( name )); + TL( name.Compare( propDef->Name()) == 0 ); + } + else if ( mode == ENamespaceDef ) + { + CMdENamespaceDef* spaceDef = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + User::LeaveIfError( aItem.GetNextString( name )); + TL( name.Compare( spaceDef->Name()) == 0 ); + } + else + { + User::Leave( KErrArgument ); + } + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ObjectDefCountL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::ObjectDefCountL( CStifItemParser& aItem ) + { + TInt count; + + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( count )); + + TL( space->ObjectDefCount() == count ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ObjectDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::ObjectDefL( CStifItemParser& aItem ) + { + TInt mode; + TPtrC name; + TInt index; + CMdEObjectDef* objectDef = NULL; + + User::LeaveIfError( aItem.GetNextInt( mode )); + User::LeaveIfError( aItem.GetNextString( name )); + if ( mode == ENamespaceDef ) + { + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( index )); + objectDef = &space->ObjectDefL( index ); + } + else if ( mode == EPropertyDef ) + { + CMdEPropertyDef* propDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + objectDef = &propDef->ObjectDef(); + } + else + { + User::Leave( KErrArgument ); + } + + TL( objectDef ); + iObjectDefArray.Append( objectDef ); + AppendNameL( iObjectDefNameArray, name ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::GetObjectDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::GetObjectDefL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + TPtrC objectString; + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( objectString )); + CMdEObjectDef& objectDef = space->GetObjectDefL( objectString ); + TL( &objectDef ); + iObjectDefArray.Append( &objectDef ); + AppendNameL( iObjectDefNameArray, name ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RelationDefCountL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RelationDefCountL( CStifItemParser& aItem ) + { + TInt count; + + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( count )); + + TL( space->RelationDefCount() == count ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RelationDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RelationDefL( CStifItemParser& aItem ) + { + + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + TInt index; + + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( index )); + + CMdERelationDef& relationDef = space->RelationDefL( index ); + TL( &relationDef ); + iRelationDefArray.Append( &relationDef ); + AppendNameL( iRelationDefNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::GetRelationDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::GetRelationDefL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + TPtrC relationString; + + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( relationString )); + + CMdERelationDef& relationDef = space->GetRelationDefL( relationString ); + TL( &relationDef ); + iRelationDefArray.Append( &relationDef ); + AppendNameL( iRelationDefNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::EventDefCountL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::EventDefCountL( CStifItemParser& aItem ) + { + TInt count; + + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( count )); + + TL( space->EventDefCount() == count ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::EventDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::EventDefL( CStifItemParser& aItem ) + { + + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + TInt index; + + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextInt( index )); + + CMdEEventDef& eventDef = space->EventDefL( index ); + TL( &eventDef ); + iEventDefArray.Append( &eventDef ); + AppendNameL( iEventDefNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::GetEventDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::GetEventDefL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + TPtrC eventString; + + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( eventString )); + CMdEEventDef& eventDef = space->GetEventDefL( eventString ); + TL( &eventDef ); + iEventDefArray.Append( &eventDef ); + AppendNameL( iEventDefNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ExportMetadataL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::ExportMetadataL( CStifItemParser& aItem ) + { + TPtrC path; + TInt mode; + TInt useObjectDefs; + TInt useRelationDefs; + TInt useEventDefs; + + const RPointerArray* objectDefs; + const RPointerArray* relationDefs; + const RPointerArray* eventDefs; + + CMdENamespaceDef* space = SanitizeArrayIndexL( iNamespaceDefArray, *iNamespaceDefNameArray, aItem ); + User::LeaveIfError( aItem.GetNextString( path )); + User::LeaveIfError( aItem.GetNextInt( mode )); + User::LeaveIfError( aItem.GetNextInt( useObjectDefs )); + User::LeaveIfError( aItem.GetNextInt( useRelationDefs )); + User::LeaveIfError( aItem.GetNextInt( useEventDefs )); + + objectDefs = (useObjectDefs) ? &iObjectDefArray : NULL; + relationDefs = (useRelationDefs) ? &iRelationDefArray : NULL; + eventDefs = (useEventDefs) ? &iEventDefArray : NULL; + + TFileName filePath( iFilePath ); + filePath.Append( path ); + filePath.ZeroTerminate(); + + if ( mode == KAsync ) + { + TRequestStatus status = KRequestPending; + RMdEDataBuffer buf; + + CleanupClosePushL( buf ); + iMdeSession->ExportMetadataL( filePath, status, buf, space, + objectDefs, relationDefs, eventDefs ); + User::WaitForRequest( status ); + + CleanupStack::PopAndDestroy( &buf ); + } + else if ( mode == KSync ) + { + iMdeSession->ExportMetadataL( filePath, space, + objectDefs, relationDefs, eventDefs ); + } + else + { + User::Leave( KErrArgument ); + } + iLog->Log( _L( "ExportMetadataL End")); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ImportMetadataL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::ImportMetadataL( CStifItemParser& aItem ) + { + TPtrC path; + TInt mode; + TInt ret = KErrNone; + + User::LeaveIfError( aItem.GetNextString( path )); + User::LeaveIfError( aItem.GetNextInt( mode )); + + TFileName filePath( iFilePath ); + filePath.Append( path ); + filePath.ZeroTerminate(); + + if ( mode == KAsync ) + { + TRequestStatus status = KRequestPending; + TPckgBuf buf( ret ); + + iMdeSession->ImportMetadata( filePath, buf, status ); + User::WaitForRequest( status ); + ret = buf(); + } + else if ( mode == KSync ) + { + ret = iMdeSession->ImportMetadataL( filePath ); + } + else + { + User::Leave( KErrArgument ); + } + iLog->Log( _L( "ImportMetadataL ret: %d" ), ret ); + TL ( ret >= 0 ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ImportSchemaL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::ImportSchemaL( CStifItemParser& aItem ) + { + TPtrC path; + User::LeaveIfError( aItem.GetNextString( path )); + + TFileName filePath( iFilePath ); + filePath.Append( path ); + filePath.ZeroTerminate(); + + iMdeSession->ImportSchemaL( filePath ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::NamespaceDefCountL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::NamespaceDefCountL( CStifItemParser& aItem ) + { + TInt count; + + User::LeaveIfError( aItem.GetNextInt( count )); + + TInt state = iMdeSession->NamespaceDefCount(); + TL( count == state ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::NamespaceDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::NamespaceDefL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + TInt mode; + User::LeaveIfError( aItem.GetNextInt( mode )); + + CMdENamespaceDef* namespaceDef = NULL; + if ( mode == ESession ) + { + TInt index; + + User::LeaveIfError( aItem.GetNextInt( index )); + namespaceDef = &iMdeSession->NamespaceDefL( index ); + } + if ( mode == EEventDef ) + { + CMdEEventDef* eventDef = SanitizeArrayIndexL( iEventDefArray, *iEventDefNameArray, aItem ); + namespaceDef = &eventDef->NamespaceDef(); + } + else if ( mode == EObjectDef ) + { + CMdEObjectDef* objectDef = SanitizeArrayIndexL( iObjectDefArray, *iObjectDefNameArray, aItem ); + namespaceDef = &objectDef->NamespaceDef(); + } + else if ( mode == EPropertyDef ) + { + CMdEPropertyDef* propertyDef = SanitizeArrayIndexL( iPropertyDefArray, *iPropertyDefNameArray, aItem ); + namespaceDef = &propertyDef->NamespaceDef(); + } + else if ( mode == ERelationDef ) + { + CMdERelationDef* relationDef = SanitizeArrayIndexL( iRelationDefArray, *iRelationDefNameArray, aItem ); + namespaceDef = &relationDef->NamespaceDef(); + } + + iNamespaceDefArray.Append( namespaceDef ); + AppendNameL( iNamespaceDefNameArray, name ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::GetNamespaceDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::GetNamespaceDefL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); + TPtrC nsName; + User::LeaveIfError( aItem.GetNextString( nsName )); + + CMdENamespaceDef& namespaceDef = iMdeSession->GetNamespaceDefL( nsName ); + iNamespaceDefArray.Append( &namespaceDef ); + AppendNameL( iNamespaceDefNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::GetDefaultNamespaceDefL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::GetDefaultNamespaceDefL( CStifItemParser& aItem ) + { + TPtrC name; + User::LeaveIfError( aItem.GetNextString( name )); + + CMdENamespaceDef& namespaceDef = iMdeSession->GetDefaultNamespaceDefL(); + iNamespaceDefArray.Append( &namespaceDef ); + AppendNameL( iNamespaceDefNameArray, name ); + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::LoadSchemaL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::LoadSchemaL( CStifItemParser& /* aItem */ ) + { + iMdeSession->LoadSchemaL(); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::EngineSessionL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::EngineSessionL( CStifItemParser& /* aItem */ ) + { + RMdEEngineSession& session = iMdeSession->EngineSession(); + TL( &session ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::GetSchemaVersionL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::GetSchemaVersionL( CStifItemParser& aItem ) + { + TInt majorVersion; + TInt minorVersion; + TInt expectedMajorVersion; + TInt expectedMinorVersion; + + User::LeaveIfError( aItem.GetNextInt( expectedMajorVersion )); + User::LeaveIfError( aItem.GetNextInt( expectedMinorVersion )); + + iMdeSession->GetSchemaVersionL( majorVersion, minorVersion ); + TL( majorVersion == expectedMajorVersion ); + TL( minorVersion == expectedMinorVersion ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::SetObjectToPresentByGuidL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::SetObjectToPresentByGuidL( CStifItemParser& aItem ) + { + TInt guidHigh; + TInt guidLow; + + User::LeaveIfError( aItem.GetNextInt( guidHigh )); + User::LeaveIfError( aItem.GetNextInt( guidLow )); + + iMdeSession->SetObjectToPresentByGuidL( guidHigh, guidLow ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::ClearNamespaceDefArray +// ----------------------------------------------------------------------------- +TInt CMdETestScripter::ResetNamespaceDefArray( CStifItemParser& /*aItem*/ ) + { + iNamespaceDefArray.Reset(); + iNamespaceDefNameArray->Reset(); + return KErrNone; + } + +// End of File diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/data/schema.mde --- a/metadataengine/data/schema.mde Mon Sep 27 15:53:05 2010 +0300 +++ b/metadataengine/data/schema.mde Wed Oct 06 15:08:08 2010 +0300 @@ -166,13 +166,13 @@ property Duration 0 0 8 min max property ReleaseDate 0 0 10 min max property CaptureDate 0 0 10 min max -property Artist 0 0 11 min max 1 +property Artist 0 0 11 min max property Author 0 0 11 min max property Copyright 0 0 11 min max property Legal 0 0 11 min max property Description 0 0 11 min max property Comment 0 0 11 min max -property Genre 0 0 11 min max 1 +property Genre 0 0 11 min max property Track 0 0 4 min max property AudioFourCC 0 0 6 min max @@ -231,8 +231,8 @@ object http://sw.nokia.com/MdE Audio MediaObject 0 property SamplingFrequency 0 0 8 min max -property Album 0 0 11 min max 1 -property Composer 0 0 11 min max 1 +property Album 0 0 11 min max +property Composer 0 0 11 min max property OriginalArtist 0 0 11 min max property AlbumArtist 0 0 11 min max diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/group/bld.inf --- a/metadataengine/group/bld.inf Mon Sep 27 15:53:05 2010 +0300 +++ b/metadataengine/group/bld.inf Wed Oct 06 15:08:08 2010 +0300 @@ -24,7 +24,7 @@ PRJ_EXPORTS ../data/200009F3.txt /epoc32/data/z/private/10202BE9/200009F3.txt -../data/200009F3.txt /epoc32/WINSCW/C/private/10202BE9/200009F3.txt +../data/200009F3.txt /epoc32/winscw/c/private/10202BE9/200009F3.txt ../data/schema.mde /epoc32/winscw/c/private/200009F3/schema.mde ../data/defaultimportfile.mde /epoc32/winscw/c/private/200009F3/defaultimportfile.mde mde_backup_registration.xml /epoc32/winscw/c/private/200009F3/backup_registration.xml diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/server/group/mdsserver.mmp --- a/metadataengine/server/group/mdsserver.mmp Mon Sep 27 15:53:05 2010 +0300 +++ b/metadataengine/server/group/mdsserver.mmp Wed Oct 06 15:08:08 2010 +0300 @@ -79,6 +79,7 @@ SOURCE mdsquerycriteriadeserialization.cpp SOURCE mdebackuprestorewatcher.cpp SOURCE mdsshutdownobserver.cpp +SOURCE mdsdatabaseupdater.cpp MW_LAYER_SYSTEMINCLUDE diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/server/inc/mdsdatabaseupdater.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/metadataengine/server/inc/mdsdatabaseupdater.h Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,42 @@ +/* +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +*/ + +#include + +#ifndef __MDSOBJECTLOCKLIST_H__ +#define __MDSDATABASEUPDATER_H__ + +class CMdSDatabaseUpdater : public CBase + { + public: // Constructors and destructor + + virtual ~CMdSDatabaseUpdater(); + + static CMdSDatabaseUpdater* NewL(); + + private: // Private constructors + + void ConstructL(); + + public: // Public functions + + TBool UpdateDatabaseL( TInt64 aMinorVersion ); + + private: + + }; + +#endif // __MDSDATABASEUPDATER_H__ diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/server/inc/mdsfindsqlclausedef.h --- a/metadataengine/server/inc/mdsfindsqlclausedef.h Mon Sep 27 15:53:05 2010 +0300 +++ b/metadataengine/server/inc/mdsfindsqlclausedef.h Wed Oct 06 15:08:08 2010 +0300 @@ -205,9 +205,6 @@ _LIT( KObjectUriEqual, "URI=?" ); _LIT( KObjectUriBeginsWith, "URI LIKE ?" ); -_LIT( KBaseObjectIdIn, "BO.ObjectId IN" ); -_LIT( KBaseObjectIdNotIn, "BO.ObjectId NOT IN" ); - // Object searches _LIT( KSelectObjectIdFromBaseObject, "SELECT ObjectId FROM Object" ); diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/server/inc/mdsmanipulationengine.h --- a/metadataengine/server/inc/mdsmanipulationengine.h Mon Sep 27 15:53:05 2010 +0300 +++ b/metadataengine/server/inc/mdsmanipulationengine.h Wed Oct 06 15:08:08 2010 +0300 @@ -32,7 +32,7 @@ class CMdSSqlObjectManipulate; // CONSTANT DECLARATION -const TInt KGarbageCollectionDelay = 90; // 1,5 minutes +const TInt KGarbageCollectionDelay = 80; // 1 minute, 20 seconds // CLASS DECLARATION diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/server/inc/mdssqlfindoperation.h --- a/metadataengine/server/inc/mdssqlfindoperation.h Mon Sep 27 15:53:05 2010 +0300 +++ b/metadataengine/server/inc/mdssqlfindoperation.h Wed Oct 06 15:08:08 2010 +0300 @@ -23,7 +23,6 @@ #include "mdssqliteconnection.h" // FORWARD DECLARATIONS -class CMdSSqLiteConnection; class CMdSFindSqlClause; class CMdSFindSequence; class CMdCSerializationBuffer; diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/server/inc/mdssqlobjectmanipulate.h --- a/metadataengine/server/inc/mdssqlobjectmanipulate.h Mon Sep 27 15:53:05 2010 +0300 +++ b/metadataengine/server/inc/mdssqlobjectmanipulate.h Wed Oct 06 15:08:08 2010 +0300 @@ -39,7 +39,6 @@ class TColumn; class CMdSObjectLockList; class CMdSServerSession; -class RMdsStatement; // CLASS DECLARATION /** diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/server/src/mdsdatabaseupdater.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/metadataengine/server/src/mdsdatabaseupdater.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -0,0 +1,44 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "mdsdatabaseupdater.h" +#include "mdssqliteconnection.h" +#include "mdssqldbmaintenance.h" +#include "mdccommon.h" +#include "mdspreferences.h" + +CMdSDatabaseUpdater* CMdSDatabaseUpdater::NewL() + { + CMdSDatabaseUpdater* self = new ( ELeave ) CMdSDatabaseUpdater(); + CleanupStack::PushL( self ); + self->ConstructL(); + CleanupStack::Pop( self ); + return self; + } + +void CMdSDatabaseUpdater::ConstructL() + { + } + +CMdSDatabaseUpdater::~CMdSDatabaseUpdater() + { + } + +TBool CMdSDatabaseUpdater::UpdateDatabaseL( TInt64 /*aMinorVersion*/ ) + { + return EFalse; + } diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/server/src/mdsfindsequence.cpp --- a/metadataengine/server/src/mdsfindsequence.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/metadataengine/server/src/mdsfindsequence.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -85,7 +85,6 @@ void CMdSFindSequence::ConstructL() { CActiveScheduler::Add( this ); - __INIT_LOGGER; } // ------------------------------------------------ diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/server/src/mdsimportexport.cpp --- a/metadataengine/server/src/mdsimportexport.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/metadataengine/server/src/mdsimportexport.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -47,6 +47,7 @@ #include "mdssqldbmaintenance.h" #include "mdspreferences.h" #include "mdscommoninternal.h" +#include "mdsdatabaseupdater.h" const TInt KMdsMaxUriLenght = KMaxFileName; const TChar KMdsLineFeed = '\n'; @@ -880,11 +881,23 @@ // DB version MMdsPreferences::GetL( KMdsDBVersionName, MMdsPreferences::EPreferenceBothGet, majorVersion, &minorVersion ); - if ( majorVersion != KMdSServMajorVersionNumber || (TInt64)minorVersion != KMdSServMinorVersionNumber ) + if ( majorVersion != KMdSServMajorVersionNumber ) { return EFalse; } + if ( (TInt64)minorVersion < KMdSServMinorVersionNumber ) + { + CMdSDatabaseUpdater* updater = CMdSDatabaseUpdater::NewL(); + TBool success( updater->UpdateDatabaseL( (TInt64)minorVersion ) ); + delete updater; + updater = NULL; + if( !success ) + { + return EFalse; + } + } + // schema version MMdsPreferences::GetL( KMdsSchemaVersionName, MMdsPreferences::EPreferenceBothGet, majorVersion, &minorVersion ); diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/server/src/mdsserver.cpp --- a/metadataengine/server/src/mdsserver.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/metadataengine/server/src/mdsserver.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -34,7 +34,7 @@ __DEFINE_LOGGER -const TInt64 KDiskSpaceGarbageCollectorThreshold = 1024*1024; // 1 MB +const TInt64 KDiskSpaceGarbageCollectorThreshold = 1024*1024*2; // 2 MB _LIT( KSchema, "schema.mde" ); _LIT( KDefaultImportProfile, "defaultimportfile.mde" ); @@ -595,6 +595,7 @@ { if (!iShutdown) { + User::RenameThread(KMdSServerNameIAD); CActiveScheduler::Stop(); iShutdown = ETrue; } diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/server/src/mdsserversession.cpp --- a/metadataengine/server/src/mdsserversession.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/metadataengine/server/src/mdsserversession.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -89,9 +89,12 @@ iFindEngines.ResetAndDestroy(); iFindEngines.Close(); - iServer.LockList().UnlockBySession( *this ); - iServer.Notifier().RemoveEntriesBySession( *this ); - + if( !iServer.ShutdownInProgress() ) + { + iServer.LockList().UnlockBySession( *this ); + iServer.Notifier().RemoveEntriesBySession( *this ); + } + // purge any pending notifications iNotificationCache.ResetAndDestroy(); iNotificationCache.Close(); diff -r fe894bb075c2 -r 79f826a55db2 metadataengine/server/src/mdssqlobjectmanipulate.cpp --- a/metadataengine/server/src/mdssqlobjectmanipulate.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/metadataengine/server/src/mdssqlobjectmanipulate.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -3425,11 +3425,13 @@ buffer.ConstBufferL(), emptyRow ) ); iDictionaryToBeCleaned = EFalse; } + + // empryRow, rowDataDelContext, rowDataUpdRel, rowDataDelRel, rowDataUpd, + CleanupStack::PopAndDestroy( 5, &rowDataUpd ); } - // empryRow, rowDataDelContext, rowDataUpdRel, rowDataDelRel, rowDataUpd, // rowDataDel, commonClauseOne - CleanupStack::PopAndDestroy( 7, &commonClauseOne ); + CleanupStack::PopAndDestroy( 2, &commonClauseOne ); #ifdef MDS_PLAYLIST_HARVESTING_ENABLED if( updateResult == 0 ) diff -r fe894bb075c2 -r 79f826a55db2 package_definition.xml --- a/package_definition.xml Mon Sep 27 15:53:05 2010 +0300 +++ b/package_definition.xml Wed Oct 06 15:08:08 2010 +0300 @@ -61,9 +61,6 @@ - - - diff -r fe894bb075c2 -r 79f826a55db2 rom/mds_cellid_reverse_geocode_enabled.iby --- a/rom/mds_cellid_reverse_geocode_enabled.iby Mon Sep 27 15:53:05 2010 +0300 +++ b/rom/mds_cellid_reverse_geocode_enabled.iby Wed Oct 06 15:08:08 2010 +0300 @@ -82,7 +82,6 @@ REM locationtrail file=ABI_DIR\BUILD_DIR\locationtrail.dll SHARED_LIB_DIR\locationtrail.dll - REM tagcreator file=ABI_DIR\BUILD_DIR\tagcreator.dll SHARED_LIB_DIR\tagcreator.dll diff -r fe894bb075c2 -r 79f826a55db2 rom/mds_reverse_geocode_enabled_only.iby --- a/rom/mds_reverse_geocode_enabled_only.iby Mon Sep 27 15:53:05 2010 +0300 +++ b/rom/mds_reverse_geocode_enabled_only.iby Wed Oct 06 15:08:08 2010 +0300 @@ -82,7 +82,6 @@ REM locationtrail file=ABI_DIR\BUILD_DIR\locationtrail.dll SHARED_LIB_DIR\locationtrail.dll - REM tagcreator file=ABI_DIR\BUILD_DIR\tagcreator.dll SHARED_LIB_DIR\tagcreator.dll diff -r fe894bb075c2 -r 79f826a55db2 sis/mds/mds_stub.sis Binary file sis/mds/mds_stub.sis has changed diff -r fe894bb075c2 -r 79f826a55db2 sis/mds/package.pkg --- a/sis/mds/package.pkg Mon Sep 27 15:53:05 2010 +0300 +++ b/sis/mds/package.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -17,7 +17,7 @@ &EN ;packet-header (name, uid, major, minor, build, type) -#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 13, TYPE=SA, RU +#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 15, TYPE=SA, RU ; Localised vendor name %{"Nokia"} diff -r fe894bb075c2 -r 79f826a55db2 sis/mds/package_cellid_reverse_geocode_enabled.pkg --- a/sis/mds/package_cellid_reverse_geocode_enabled.pkg Mon Sep 27 15:53:05 2010 +0300 +++ b/sis/mds/package_cellid_reverse_geocode_enabled.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -17,7 +17,7 @@ &EN ;packet-header (name, uid, major, minor, build, type) -#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 13, TYPE=SA, RU +#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 15, TYPE=SA, RU ; Localised vendor name %{"Nokia"} diff -r fe894bb075c2 -r 79f826a55db2 sis/mds/package_cellidenabled.pkg --- a/sis/mds/package_cellidenabled.pkg Mon Sep 27 15:53:05 2010 +0300 +++ b/sis/mds/package_cellidenabled.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -17,7 +17,7 @@ &EN ;packet-header (name, uid, major, minor, build, type) -#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 13, TYPE=SA, RU +#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 15, TYPE=SA, RU ; Localised vendor name %{"Nokia"} diff -r fe894bb075c2 -r 79f826a55db2 sis/mds/package_reverse_geocode_enabled_only.pkg --- a/sis/mds/package_reverse_geocode_enabled_only.pkg Mon Sep 27 15:53:05 2010 +0300 +++ b/sis/mds/package_reverse_geocode_enabled_only.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -17,7 +17,7 @@ &EN ;packet-header (name, uid, major, minor, build, type) -#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 13, TYPE=SA, RU +#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 15, TYPE=SA, RU ; Localised vendor name %{"Nokia"} diff -r fe894bb075c2 -r 79f826a55db2 sis/mds/package_separate.pkg --- a/sis/mds/package_separate.pkg Mon Sep 27 15:53:05 2010 +0300 +++ b/sis/mds/package_separate.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -17,7 +17,7 @@ &EN ;packet-header (name, uid, major, minor, build, type) -#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 13, TYPE=SA, RU +#{"Metadata System Upgrade"},(0x200009F5), 10, 10, 15, TYPE=SA, RU ; Localised vendor name %{"Nokia"} diff -r fe894bb075c2 -r 79f826a55db2 sis/mds/stub.pkg --- a/sis/mds/stub.pkg Mon Sep 27 15:53:05 2010 +0300 +++ b/sis/mds/stub.pkg Wed Oct 06 15:08:08 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Header -#{"Metadata System"}, (0x200009F5), 10, 10, 13, TYPE=SA +#{"Metadata System"}, (0x200009F5), 10, 10, 15, TYPE=SA ; Localised Vendor name %{"Nokia"} diff -r fe894bb075c2 -r 79f826a55db2 watchdog/src/watchdog.cpp --- a/watchdog/src/watchdog.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/watchdog/src/watchdog.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -277,7 +277,6 @@ { PRINT(_L("CWatchdog::SelfShutdownNotification()")); CActiveScheduler::Stop(); - } void MainL() diff -r fe894bb075c2 -r 79f826a55db2 watchdog/src/wdselfshutdownobserver.cpp --- a/watchdog/src/wdselfshutdownobserver.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/watchdog/src/wdselfshutdownobserver.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -58,7 +58,6 @@ PRINT(_L("CWDSelfShutdownObserver::ConstructL()")); TInt error = RProperty::Define(KWatchdogPSShutdown, KShutdown,RProperty::EInt,KAllowAllPolicy,KPowerMgmtPolicy); - RProperty::Set(KWatchdogPSShutdown,KShutdown,0); // attach to the property User::LeaveIfError( iProperty.Attach(KWatchdogPSShutdown,KShutdown,EOwnerThread) ); diff -r fe894bb075c2 -r 79f826a55db2 watchdog/src/wdshutdownobserver.cpp --- a/watchdog/src/wdshutdownobserver.cpp Mon Sep 27 15:53:05 2010 +0300 +++ b/watchdog/src/wdshutdownobserver.cpp Wed Oct 06 15:08:08 2010 +0300 @@ -32,7 +32,7 @@ // CWDShutdownObserver::NewL() // --------------------------------------------------------------------------- // -CWDShutdownObserver* CWDShutdownObserver::NewL( MWDShutdownObserver& aObserver/*, const TUid& aKeyCategory */) +EXPORT_C CWDShutdownObserver* CWDShutdownObserver::NewL( MWDShutdownObserver& aObserver/*, const TUid& aKeyCategory */) { CWDShutdownObserver* self = new( ELeave )CWDShutdownObserver( aObserver/*, aKeyCategory */); CleanupStack::PushL( self );